Changeset 7


Ignore:
Timestamp:
May 2, 2014, 10:29:24 AM (10 years ago)
Author:
chronos
Message:
  • Fixed: More robust configuration loading.
  • Added: Show absolute path in missing items in comparison.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/UFormMain.pas

    r6 r7  
    7171procedure TFormMain.FormShow(Sender: TObject);
    7272begin
    73   Config.LoadFromDir('/home/chronos/Stažené/linux-3.14.1', 'x86');
     73  Config.LoadFromDir('/home/jha/Projekty/fpc/kernel_options/linux-3.0', 'x86');
    7474  Reload;
    7575end;
     
    141141    Config2 := TConfigMenu.Create;
    142142    Config.TopNode.SaveToList(List1);
    143     Config2.LoadFromDir('/home/chronos/Stažené/linux-3.12.18', 'x86');
     143    Config2.LoadFromDir('/opt/elinos-D6.0/linux/linux-p4-3.0/', 'p4');
    144144    Config2.TopNode.SaveToList(List2);
    145145    Config.CompareStringLists(List1, List2, Missing1, Missing2);
     146    Config2.OptionListNames(Missing1);
     147    Config.OptionListNames(Missing2);
    146148    FormCompare.Memo1.Lines.Assign(Missing1);
    147149    FormCompare.Memo2.Lines.Assign(Missing2);
  • trunk/UKConfig.pas

    r6 r7  
    11unit UKConfig;
     2
     3// Kconfig format specification:
     4// https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
    25
    36{$mode Delphi}{$H+}
     
    7376    BaseDir: string;
    7477    Version: string;
     78    procedure OptionListNames(List: TStringList);
    7579    procedure PrepareMoveList(var List: TObjectMoves);
    7680    procedure CompareStringLists(List1, List2: TStringList; Missing1,
     
    121125function TMenuNode.GetAbsoluteName: string;
    122126begin
    123   if Assigned(Parent) then Result := Parent.GetAbsoluteName + ' - ';
    124   if Assigned(Parent) then Result := Result + GetName;
     127  if Assigned(Parent) and Assigned(Parent.Parent) then Result := Parent.GetAbsoluteName + ' - ';
     128  Result := Result + GetName;
    125129end;
    126130
     
    347351        State := stNormal;
    348352
    349       if Copy(Trim(Line), 1, 1) = '#' then begin
     353      if (Copy(Trim(Line), 1, 1) = '#') or (Copy(Trim(Line), 1, 2) = '\#') then begin
    350354        // Skip comments
    351355        Continue;
     
    439443        NewItem.Selects.Add(Parameter);
    440444      end else
     445      if Command = '---' then begin
     446        Command := GetNextToken(Line);
     447        if Command = 'help' then begin
     448          Parameter := GetNextToken(Line);
     449          State := stHelp;
     450          HelpIndent := LineIndent;
     451        end;
     452      end else
    441453      if (Command = 'help') or (Command = '---help---') then begin
    442454        Parameter := GetNextToken(Line);
     
    577589  finally
    578590    Content.Free;
     591  end;
     592end;
     593
     594procedure TConfigMenu.OptionListNames(List: TStringList);
     595var
     596  I: Integer;
     597  Node: TMenuNode;
     598begin
     599  for I := 0 to List.Count - 1 do begin
     600    Node := TopNode.FindNode(List[I]);
     601    if Assigned(Node) then
     602      List[I] := List[I] + ' ' + Node.GetAbsoluteName;
    579603  end;
    580604end;
Note: See TracChangeset for help on using the changeset viewer.