Changeset 7 for trunk/UKConfig.pas


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

Legend:

Unmodified
Added
Removed
  • 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.