- Timestamp:
- May 2, 2014, 3:39:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UKConfig.pas
r8 r9 23 23 TObjectMoves = array of TObjectMove; 24 24 25 TExpOperator = (eoAnd, eoOr); 26 27 { TExpression } 28 29 TExpression = class 30 ExpOperator: TExpOperator; 31 Items: TObjectList; // TList<TExpression> 32 constructor Create; 33 destructor Destroy; override; 34 end; 35 36 TExpressionVar = class 37 Name: string; 38 Negative: Boolean; 39 end; 40 25 41 { TMenuNode } 26 42 27 43 TMenuNode = class 44 Index: Integer; 28 45 ID: string; 29 46 Name: string; … … 66 83 Arch: string; 67 84 FOnLog: TOnLogEvent; 85 IndexCounter: Integer; 68 86 function GetTopCondition: string; 69 87 procedure Log(Text: string); … … 89 107 implementation 90 108 109 { TExpression } 110 111 constructor TExpression.Create; 112 begin 113 Items := TObjectList.Create; 114 end; 115 116 destructor TExpression.Destroy; 117 begin 118 Items.Free; 119 inherited Destroy; 120 end; 121 91 122 { TMenuNode } 92 123 … … 150 181 with List do begin 151 182 Clear; 183 Add('Index: ' + IntToStr(Index)); 152 184 Add('ID: ' + ID); 153 185 Add('Name: ' + Name); … … 199 231 Index: Integer; 200 232 P: TMenuNode; 201 begin 202 if ID = 'EXT4_FS' then 233 LatestNode: TMenuNode; 234 begin 235 if ID = 'PARAVIRT_DEBUG' then 203 236 Name := Name + '$'; 204 237 NewParent := Parent; … … 212 245 end; 213 246 end;} 214 if Depends.Count > 0 then begin 215 Index := Lookup.IndexOf(Depends[0]); 247 I := 0; 248 LatestNode := NewParent; 249 while I < Depends.Count do begin 250 Index := Lookup.IndexOf(Depends[I]); 216 251 if Index <> -1 then Node := TMenuNode(Lookup.Objects[Index]) 217 252 else Node := nil; 218 if Assigned(Node) and (NewParent <> Node) and (Node.HaveUpperNode(NewParent)) then begin 219 NewParent := Node; 253 if Assigned(Node) and (NewParent <> Node) and (Node.HaveUpperNode(NewParent)) and 254 (Node.Index > LatestNode.Index) then begin 255 LatestNode := Node; 220 256 end; 221 end; 257 Inc(I); 258 end; 259 NewParent := LatestNode; 260 222 261 if NewParent <> Parent then begin 223 262 NewMove.Source := Self; … … 436 475 Parameter := GetNextToken(Line); 437 476 if Parameter = 'on' then begin 438 Parameter := GetNextToken(Line);439 if Copy(Parameter, 1, 1) = '!' then Delete(Parameter, 1, 1);440 477 if not Assigned(NewItem) then raise Exception.Create('Item not defined. ' + GetLog); 441 NewItem.Depends.Add(Parameter); 478 // Just try to load symbol list. Do not parse expression 479 while Trim(Line) <> '' do begin 480 Parameter := GetNextToken(Line); 481 if Copy(Parameter, 1, 1) = '!' then Delete(Parameter, 1, 1); 482 if Copy(Parameter, 1, 1) = '(' then Delete(Parameter, 1, 1); 483 if Copy(Parameter, Length(Parameter), 1) = ')' then Delete(Parameter, Length(Parameter), 1); 484 Parameter := Trim(Parameter); 485 if (Parameter <> '&&') and (Parameter <> '||') then 486 NewItem.Depends.Add(Parameter); 487 end; 442 488 end; 443 489 end else … … 470 516 NewItem.ID := Parameter; 471 517 NewItem.Condition := GetTopCondition; 518 NewItem.Index := IndexCounter; 519 Inc(IndexCounter); 472 520 CurrentMenu.Items.Add(NewItem); 473 521 if Command = 'menuconfig' then NewItem.MenuConfig := True; … … 479 527 NewItem.Name := Parameter; 480 528 NewItem.Condition := GetTopCondition; 529 NewItem.Index := IndexCounter; 530 Inc(IndexCounter); 481 531 NewItem.ValueType := vtComment; 482 532 CurrentMenu.Items.Add(NewItem); … … 498 548 NewMenu.Parent := CurrentMenu; 499 549 NewMenu.Condition := GetTopCondition; 550 NewMenu.Index := IndexCounter; 551 Inc(IndexCounter); 500 552 ConditionStack.AddObject('', nil); 501 553 NewItem := NewMenu; … … 563 615 TopNode.Name := 'Root'; 564 616 CurrentMenu := TopNode; 617 IndexCounter := 1; 565 618 ParseFile(BaseDir + DirectorySeparator + 'Kconfig'); 566 619 end;
Note:
See TracChangeset
for help on using the changeset viewer.