|
@@ -38,7 +38,7 @@ type
|
|
|
|
|
|
TSwitchMode = (om_Normal,om_Debug,om_Release);
|
|
|
|
|
|
- TSwitchItemTyp = (ot_Select,ot_Boolean,ot_String,ot_Longint);
|
|
|
+ TSwitchItemTyp = (ot_Select,ot_Boolean,ot_String,ot_MultiString,ot_Longint);
|
|
|
|
|
|
PSwitchItem = ^TSwitchItem;
|
|
|
TSwitchItem = object(TObject)
|
|
@@ -48,8 +48,9 @@ type
|
|
|
ParamID : TParamID;
|
|
|
constructor Init(const n,p:string; AID: TParamID);
|
|
|
function NeedParam:boolean;virtual;
|
|
|
- function ParamValue:string;virtual;
|
|
|
+ function ParamValue(nr:sw_integer):string;virtual;
|
|
|
function ParamValueBool(SM: TSwitchMode):boolean;virtual;
|
|
|
+ function ParamCount:sw_integer;virtual;
|
|
|
function GetSwitchStr(SM: TSwitchMode): string; virtual;
|
|
|
function GetNumberStr(SM: TSwitchMode): string; virtual;
|
|
|
function GetOptionStr(SM: TSwitchMode): string; virtual;
|
|
@@ -81,10 +82,22 @@ type
|
|
|
SeparateSpaces : boolean;
|
|
|
constructor Init(const n,p:string;AID: TParamID; mult,allowspaces:boolean);
|
|
|
function NeedParam:boolean;virtual;
|
|
|
- function ParamValue:string;virtual;
|
|
|
+ function ParamValue(nr:sw_integer):string;virtual;
|
|
|
procedure Reset;virtual;
|
|
|
end;
|
|
|
|
|
|
+ PMultiStringItem = ^TMultiStringItem;
|
|
|
+ TMultiStringItem = object(TSwitchItem)
|
|
|
+ MultiStr : array[TSwitchMode] of PunsortedStringCollection;
|
|
|
+ constructor Init(const n,p:string;AID: TParamID);
|
|
|
+ function NeedParam:boolean;virtual;
|
|
|
+ function ParamValue(nr:sw_integer):string;virtual;
|
|
|
+ function ParamCount:sw_integer;virtual;
|
|
|
+ procedure Reset;virtual;
|
|
|
+ destructor done;virtual;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
PLongintItem = ^TLongintItem;
|
|
|
TLongintItem = object(TSwitchItem)
|
|
|
Val : array[TSwitchMode] of longint;
|
|
@@ -110,13 +123,16 @@ type
|
|
|
procedure AddBooleanItem(const name,param:string; AID: TParamID);
|
|
|
procedure AddLongintItem(const name,param:string; AID: TParamID);
|
|
|
procedure AddStringItem(const name,param:string;AID: TParamID;mult,allowspaces:boolean);
|
|
|
+ procedure AddMultiStringItem(const name,param:string;AID: TParamID);
|
|
|
function GetCurrSel:integer;
|
|
|
function GetCurrSelParam : String;
|
|
|
function GetBooleanItem(index:integer):boolean;
|
|
|
function GetLongintItem(index:integer):longint;
|
|
|
function GetStringItem(index:integer):string;
|
|
|
+ function GetMultiStringItem(index:integer):PunsortedStringCollection;
|
|
|
+ function GetItemTyp(index:integer):TSwitchItemTyp;
|
|
|
procedure SetCurrSel(index:integer);
|
|
|
- function SetCurrSelParam(const s : String) : boolean;
|
|
|
+ function SetCurrSelParam(const s:string) : boolean;
|
|
|
procedure SetBooleanItem(index:integer;b:boolean);
|
|
|
procedure SetLongintItem(index:integer;l:longint);
|
|
|
procedure SetStringItem(index:integer;const s:string);
|
|
@@ -203,7 +219,7 @@ begin
|
|
|
end;
|
|
|
|
|
|
|
|
|
-function TSwitchItem.ParamValue:string;
|
|
|
+function TSwitchItem.ParamValue(nr:sw_integer):string;
|
|
|
begin
|
|
|
ParamValue:='';
|
|
|
end;
|
|
@@ -214,6 +230,12 @@ begin
|
|
|
ParamValueBool:=false;
|
|
|
end;
|
|
|
|
|
|
+function TSwitchItem.ParamCount:sw_integer;
|
|
|
+
|
|
|
+begin
|
|
|
+ ParamCount:=1;
|
|
|
+end;
|
|
|
+
|
|
|
function TSwitchItem.GetSwitchStr(SM: TSwitchMode): string;
|
|
|
begin
|
|
|
Abstract;
|
|
@@ -309,7 +331,7 @@ begin
|
|
|
end;
|
|
|
|
|
|
|
|
|
-function TStringItem.ParamValue:string;
|
|
|
+function TStringItem.ParamValue(nr:sw_integer):string;
|
|
|
begin
|
|
|
ParamValue:=Str[SwitchesMode];
|
|
|
end;
|
|
@@ -320,6 +342,58 @@ begin
|
|
|
FillChar(Str,sizeof(Str),0);
|
|
|
end;
|
|
|
|
|
|
+{*****************************************************************************
|
|
|
+ TMultiStringItem
|
|
|
+*****************************************************************************}
|
|
|
+
|
|
|
+constructor TMultiStringItem.Init(const n,p:string;AID:TParamID);
|
|
|
+
|
|
|
+var i:TSwitchMode;
|
|
|
+
|
|
|
+begin
|
|
|
+ inherited Init(n,p,AID);
|
|
|
+ typ:=ot_MultiString;
|
|
|
+ for i:=low(MultiStr) to high(MultiStr) do
|
|
|
+ new(MultiStr[i],init(5,5));
|
|
|
+{ Reset;}
|
|
|
+end;
|
|
|
+
|
|
|
+function TMultiStringItem.NeedParam:boolean;
|
|
|
+
|
|
|
+begin
|
|
|
+ NeedParam:=(multistr[SwitchesMode]^.count<>0);
|
|
|
+end;
|
|
|
+
|
|
|
+function TMultiStringItem.ParamValue(nr:sw_integer):string;
|
|
|
+
|
|
|
+begin
|
|
|
+ ParamValue:=MultiStr[SwitchesMode]^.at(nr)^;
|
|
|
+end;
|
|
|
+
|
|
|
+function TMultiStringItem.ParamCount:sw_integer;
|
|
|
+
|
|
|
+begin
|
|
|
+ ParamCount:=Multistr[SwitchesMode]^.count;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TMultiStringItem.Reset;
|
|
|
+
|
|
|
+var i:TSwitchMode;
|
|
|
+
|
|
|
+begin
|
|
|
+ for i:=low(multiStr) to high(multiStr) do
|
|
|
+ MultiStr[i]^.freeall;
|
|
|
+end;
|
|
|
+
|
|
|
+destructor TmultiStringItem.done;
|
|
|
+
|
|
|
+var i:TSwitchMode;
|
|
|
+
|
|
|
+begin
|
|
|
+ for i:=low(MultiStr) to high(MultiStr) do
|
|
|
+ dispose(MultiStr[i],done);
|
|
|
+ inherited done;
|
|
|
+end;
|
|
|
|
|
|
{*****************************************************************************
|
|
|
TLongintItem
|
|
@@ -410,11 +484,15 @@ begin
|
|
|
end;
|
|
|
|
|
|
|
|
|
-procedure TSwitches.AddStringItem(const name,param:string;AID: TParamID;mult,allowspaces:boolean);
|
|
|
+procedure TSwitches.AddStringItem(const name,param:string;AID:TParamID;mult,allowspaces:boolean);
|
|
|
begin
|
|
|
Items^.Insert(New(PStringItem,Init(name,Param,AID,mult,allowspaces)));
|
|
|
end;
|
|
|
|
|
|
+procedure TSwitches.AddMultiStringItem(const name,param:string;AID:TParamID);
|
|
|
+begin
|
|
|
+ Items^.Insert(New(PMultiStringItem,Init(name,Param,AID)));
|
|
|
+end;
|
|
|
|
|
|
function TSwitches.ItemCount:integer;
|
|
|
begin
|
|
@@ -496,6 +574,29 @@ begin
|
|
|
GetStringItem:='';
|
|
|
end;
|
|
|
|
|
|
+function TSwitches.GetMultiStringItem(index:integer):PUnsortedStringCollection;
|
|
|
+
|
|
|
+var p:PMultiStringItem;
|
|
|
+
|
|
|
+begin
|
|
|
+ if index<ItemCount then
|
|
|
+ p:=Items^.at(Index)
|
|
|
+ else
|
|
|
+ p:=nil;
|
|
|
+ if (p<>nil) and (p^.typ=ot_multistring) then
|
|
|
+ GetMultiStringItem:=p^.MultiStr[SwitchesMode]
|
|
|
+ else
|
|
|
+ GetMultiStringItem:=nil;
|
|
|
+end;
|
|
|
+
|
|
|
+function TSwitches.GetItemTyp(index:integer):TSwitchItemTyp;
|
|
|
+
|
|
|
+var p:PSwitchItem;
|
|
|
+
|
|
|
+begin
|
|
|
+ assert(index<itemcount);
|
|
|
+ GetItemTyp:=PSwitchItem(items^.at(index))^.typ;
|
|
|
+end;
|
|
|
|
|
|
procedure TSwitches.SetBooleanItem(index:integer;b:boolean);
|
|
|
var
|
|
@@ -613,7 +714,8 @@ var
|
|
|
end
|
|
|
else
|
|
|
if P^.Param<>'/' then
|
|
|
- Writeln(CfgFile,' -'+Pref+P^.Param+P^.ParamValue);
|
|
|
+ for i:=0 to p^.ParamCount-1 do
|
|
|
+ Writeln(CfgFile,' -'+Pref+P^.Param+P^.ParamValue(i));
|
|
|
end;
|
|
|
end;
|
|
|
|
|
@@ -681,6 +783,8 @@ begin
|
|
|
else
|
|
|
PStringItem(FoundP)^.Str[SwitchesMode]:=Copy(s,length(FoundP^.Param)+1,255);
|
|
|
end;
|
|
|
+ ot_MultiString :
|
|
|
+ PMultiStringItem(foundP)^.MultiStr[SwitchesMode]^.insert(newstr(copy(s,length(foundP^.param)+1,255)));
|
|
|
ot_Longint : Val(Copy(s,length(FoundP^.Param)+1,255),PLongintItem(FoundP)^.Val[SwitchesMode],code);
|
|
|
end;
|
|
|
ReadItemsCfg:=true;
|
|
@@ -988,10 +1092,10 @@ begin
|
|
|
New(DirectorySwitches,Init('F'));
|
|
|
with DirectorySwitches^ do
|
|
|
begin
|
|
|
- AddStringItem(opt_unitdirectories,'u',idNone,true,true);
|
|
|
- AddStringItem(opt_includedirectories,'i',idNone,true,true);
|
|
|
- AddStringItem(opt_librarydirectories,'l',idNone,true,true);
|
|
|
- AddStringItem(opt_objectdirectories,'o',idNone,true,true);
|
|
|
+ AddMultiStringItem(opt_unitdirectories,'u',idNone);
|
|
|
+ AddMultiStringItem(opt_includedirectories,'i',idNone);
|
|
|
+ AddMultiStringItem(opt_librarydirectories,'l',idNone);
|
|
|
+ AddMultiStringItem(opt_objectdirectories,'o',idNone);
|
|
|
AddStringItem(opt_exeppudirectories,'E',idNone,true,true);
|
|
|
AddStringItem(opt_ppuoutputdirectory,'U',idNone,true,true);
|
|
|
AddStringItem(opt_cross_tools_directory,'D',idNone,true,true);
|