mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 13:49:07 +02:00
* String items can also be separated by spaces
This commit is contained in:
parent
29d778ac51
commit
216d00e8bc
@ -154,7 +154,7 @@ var
|
|||||||
CfgFile : text;
|
CfgFile : text;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
TSwitchItem
|
TSwitchItem
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
constructor TSwitchItem.Init(const n,p:string);
|
constructor TSwitchItem.Init(const n,p:string);
|
||||||
@ -183,7 +183,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
TSelectItem
|
TSelectItem
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
constructor TSelectItem.Init(const n,p:string);
|
constructor TSelectItem.Init(const n,p:string);
|
||||||
@ -194,7 +194,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
TBooleanItem
|
TBooleanItem
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
constructor TBooleanItem.Init(const n,p:string);
|
constructor TBooleanItem.Init(const n,p:string);
|
||||||
@ -218,7 +218,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
TStringItem
|
TStringItem
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
constructor TStringItem.Init(const n,p:string;mult:boolean);
|
constructor TStringItem.Init(const n,p:string;mult:boolean);
|
||||||
@ -249,7 +249,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
TLongintItem
|
TLongintItem
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
constructor TLongintItem.Init(const n,p:string);
|
constructor TLongintItem.Init(const n,p:string);
|
||||||
@ -282,7 +282,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
TSwitch
|
TSwitch
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
constructor TSwitches.Init(ch:char);
|
constructor TSwitches.Init(ch:char);
|
||||||
@ -452,25 +452,28 @@ var
|
|||||||
procedure writeitem(P:PSwitchItem);{$ifndef FPC}far;{$endif}
|
procedure writeitem(P:PSwitchItem);{$ifndef FPC}far;{$endif}
|
||||||
var
|
var
|
||||||
s,s1 : string;
|
s,s1 : string;
|
||||||
i : integer;
|
i,j : integer;
|
||||||
begin
|
begin
|
||||||
if P^.NeedParam then
|
if P^.NeedParam then
|
||||||
begin
|
begin
|
||||||
if (P^.Typ=ot_string) and (PStringItem(P)^.Multiple) then
|
if (P^.Typ=ot_string) and (PStringItem(P)^.Multiple) then
|
||||||
begin
|
begin
|
||||||
s:=PStringItem(P)^.Str[SwitchesMode];
|
s:=PStringItem(P)^.Str[SwitchesMode];
|
||||||
repeat
|
repeat
|
||||||
i:=pos(';',s);
|
i:=pos(';',s);
|
||||||
if i=0 then
|
j:=pos(' ',s);
|
||||||
i:=256;
|
if i=0 then
|
||||||
s1:=Copy(s,1,i-1);
|
i:=256;
|
||||||
if s1<>'' then
|
if (j>0) and (j<i) then
|
||||||
writeln(CfgFile,' -'+Pref+P^.Param+s1);
|
i:=j;
|
||||||
Delete(s,1,i);
|
s1:=Copy(s,1,i-1);
|
||||||
until s='';
|
if s1<>'' then
|
||||||
end
|
writeln(CfgFile,' -'+Pref+P^.Param+s1);
|
||||||
|
Delete(s,1,i);
|
||||||
|
until s='';
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Writeln(CfgFile,' -'+Pref+P^.Param+P^.ParamValue);
|
Writeln(CfgFile,' -'+Pref+P^.Param+P^.ParamValue);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -494,9 +497,9 @@ begin
|
|||||||
if i=0 then i:=256;
|
if i=0 then i:=256;
|
||||||
writeln(CfgFile,' '+Copy(s,1,i-1));
|
writeln(CfgFile,' '+Copy(s,1,i-1));
|
||||||
if i=256 then
|
if i=256 then
|
||||||
s:=''
|
s:=''
|
||||||
else
|
else
|
||||||
s:=copy(s,i+1,255);
|
s:=copy(s,i+1,255);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -507,7 +510,7 @@ function TSwitches.ReadItemsCfg(const s:string):boolean;
|
|||||||
begin
|
begin
|
||||||
{ empty items are not equivalent to others !! }
|
{ empty items are not equivalent to others !! }
|
||||||
CheckItem:=((S='') and (P^.Param='')) or
|
CheckItem:=((S='') and (P^.Param='')) or
|
||||||
((Length(S)>0) and (P^.Param=Copy(s,1,length(P^.Param))));
|
((Length(S)>0) and (P^.Param=Copy(s,1,length(P^.Param))));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -521,12 +524,12 @@ begin
|
|||||||
ot_Select : SelNr[SwitchesMode]:=Items^.IndexOf(FoundP);
|
ot_Select : SelNr[SwitchesMode]:=Items^.IndexOf(FoundP);
|
||||||
ot_Boolean : PBooleanItem(FoundP)^.IsSet[SwitchesMode]:=true;
|
ot_Boolean : PBooleanItem(FoundP)^.IsSet[SwitchesMode]:=true;
|
||||||
ot_String : begin
|
ot_String : begin
|
||||||
if (PStringItem(FoundP)^.Multiple) and (PStringItem(FoundP)^.Str[SwitchesMode]<>'') then
|
if (PStringItem(FoundP)^.Multiple) and (PStringItem(FoundP)^.Str[SwitchesMode]<>'') then
|
||||||
PStringItem(FoundP)^.Str[SwitchesMode]:=PStringItem(FoundP)^.Str[SwitchesMode]+';'+
|
PStringItem(FoundP)^.Str[SwitchesMode]:=PStringItem(FoundP)^.Str[SwitchesMode]+';'+
|
||||||
Copy(s,length(FoundP^.Param)+1,255)
|
Copy(s,length(FoundP^.Param)+1,255)
|
||||||
else
|
else
|
||||||
PStringItem(FoundP)^.Str[SwitchesMode]:=Copy(s,length(FoundP^.Param)+1,255);
|
PStringItem(FoundP)^.Str[SwitchesMode]:=Copy(s,length(FoundP^.Param)+1,255);
|
||||||
end;
|
end;
|
||||||
ot_Longint : Val(Copy(s,length(FoundP^.Param)+1,255),PLongintItem(FoundP)^.Val[SwitchesMode],code);
|
ot_Longint : Val(Copy(s,length(FoundP^.Param)+1,255),PLongintItem(FoundP)^.Val[SwitchesMode],code);
|
||||||
end;
|
end;
|
||||||
ReadItemsCfg:=true;
|
ReadItemsCfg:=true;
|
||||||
@ -537,7 +540,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
Read / Write
|
Read / Write
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
procedure WriteSwitches(const fn:string);
|
procedure WriteSwitches(const fn:string);
|
||||||
@ -614,17 +617,17 @@ begin
|
|||||||
'T' : res:=TargetSwitches^.ReadItemsCfg(s);
|
'T' : res:=TargetSwitches^.ReadItemsCfg(s);
|
||||||
'R' : res:=AsmReaderSwitches^.ReadItemsCfg(s);
|
'R' : res:=AsmReaderSwitches^.ReadItemsCfg(s);
|
||||||
'C' : begin
|
'C' : begin
|
||||||
res:=CodegenSwitches^.ReadItemsCfg(s);
|
res:=CodegenSwitches^.ReadItemsCfg(s);
|
||||||
if not res then
|
if not res then
|
||||||
res:=MemorySwitches^.ReadItemsCfg(s);
|
res:=MemorySwitches^.ReadItemsCfg(s);
|
||||||
end;
|
end;
|
||||||
'v' : res:=VerboseSwitches^.ReadItemsCfg(s);
|
'v' : res:=VerboseSwitches^.ReadItemsCfg(s);
|
||||||
'O' : begin
|
'O' : begin
|
||||||
res:=true;
|
res:=true;
|
||||||
if not OptimizationSwitches^.ReadItemsCfg(s) then
|
if not OptimizationSwitches^.ReadItemsCfg(s) then
|
||||||
if not ProcessorSwitches^.ReadItemsCfg(s) then
|
if not ProcessorSwitches^.ReadItemsCfg(s) then
|
||||||
res:=OptimizingGoalSwitches^.ReadItemsCfg(s)
|
res:=OptimizingGoalSwitches^.ReadItemsCfg(s)
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{ keep all others as a string }
|
{ keep all others as a string }
|
||||||
if not res then
|
if not res then
|
||||||
@ -633,13 +636,13 @@ begin
|
|||||||
else
|
else
|
||||||
if (Copy(s,1,7)='#IFDEF ') then
|
if (Copy(s,1,7)='#IFDEF ') then
|
||||||
begin
|
begin
|
||||||
Delete(s,1,7);
|
Delete(s,1,7);
|
||||||
for i:=low(TSwitchMode) to high(TSwitchMode) do
|
for i:=low(TSwitchMode) to high(TSwitchMode) do
|
||||||
if s=SwitchesModeStr[i] then
|
if s=SwitchesModeStr[i] then
|
||||||
begin
|
begin
|
||||||
SwitchesMode:=i;
|
SwitchesMode:=i;
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else;
|
else;
|
||||||
end;
|
end;
|
||||||
@ -675,7 +678,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
Initialize
|
Initialize
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
procedure InitSwitches;
|
procedure InitSwitches;
|
||||||
@ -827,7 +830,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.9 1999-02-10 09:45:55 pierre
|
Revision 1.10 1999-02-16 12:46:38 pierre
|
||||||
|
* String items can also be separated by spaces
|
||||||
|
|
||||||
|
Revision 1.9 1999/02/10 09:45:55 pierre
|
||||||
* MemorySizeSwitches Removed (was duplicate of MemorySwitches !)
|
* MemorySizeSwitches Removed (was duplicate of MemorySwitches !)
|
||||||
* Added missing disposes at exit
|
* Added missing disposes at exit
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user