* moved UpdateAlignmentStr, UpdateOptimizerStr, UpdateWpoStr and UpdateDebugStr from unit globals to unit dirparse

git-svn-id: trunk@25634 -
This commit is contained in:
nickysn 2013-10-04 08:26:02 +00:00
parent 235c06ab34
commit 826b4678f3
2 changed files with 205 additions and 204 deletions

View File

@ -28,8 +28,13 @@ unit dirparse;
interface
uses
globtype;
globtype,
systems;
function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
function UpdateOptimizerStr(s:string;var a:toptimizerswitches):boolean;
function UpdateWpoStr(s: string; var a: twpoptimizerswitches): boolean;
function UpdateDebugStr(s:string;var a:tdebugswitches):boolean;
function UpdateTargetSwitchStr(s: string; var a: ttargetswitches; global: boolean): boolean;
implementation
@ -39,6 +44,205 @@ implementation
cutils,
symtable;
function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
var
tok : string;
vstr : string;
l : longint;
code : integer;
b : talignmentinfo;
begin
UpdateAlignmentStr:=true;
uppervar(s);
fillchar(b,sizeof(b),0);
repeat
tok:=GetToken(s,'=');
if tok='' then
break;
vstr:=GetToken(s,',');
val(vstr,l,code);
if tok='PROC' then
b.procalign:=l
else if tok='JUMP' then
b.jumpalign:=l
else if tok='LOOP' then
b.loopalign:=l
else if tok='CONSTMIN' then
begin
b.constalignmin:=l;
if l>b.constalignmax then
b.constalignmax:=l;
end
else if tok='CONSTMAX' then
b.constalignmax:=l
else if tok='VARMIN' then
begin
b.varalignmin:=l;
if l>b.varalignmax then
b.varalignmax:=l;
end
else if tok='VARMAX' then
b.varalignmax:=l
else if tok='LOCALMIN' then
begin
b.localalignmin:=l;
if l>b.localalignmax then
b.localalignmax:=l;
end
else if tok='LOCALMAX' then
b.localalignmax:=l
else if tok='RECORDMIN' then
begin
b.recordalignmin:=l;
if l>b.recordalignmax then
b.recordalignmax:=l;
end
else if tok='RECORDMAX' then
b.recordalignmax:=l
else { Error }
UpdateAlignmentStr:=false;
until false;
Result:=Result and UpdateAlignment(a,b);
end;
function UpdateOptimizerStr(s:string;var a:toptimizerswitches):boolean;
var
tok : string;
doset,
found : boolean;
opt : toptimizerswitch;
begin
result:=true;
uppervar(s);
repeat
tok:=GetToken(s,',');
if tok='' then
break;
if Copy(tok,1,2)='NO' then
begin
delete(tok,1,2);
doset:=false;
end
else
doset:=true;
found:=false;
for opt:=low(toptimizerswitch) to high(toptimizerswitch) do
begin
if OptimizerSwitchStr[opt]=tok then
begin
found:=true;
break;
end;
end;
if found then
begin
if doset then
include(a,opt)
else
exclude(a,opt);
end
else
result:=false;
until false;
end;
function UpdateWpoStr(s: string; var a: twpoptimizerswitches): boolean;
var
tok : string;
doset,
found : boolean;
opt : twpoptimizerswitch;
begin
result:=true;
uppervar(s);
repeat
tok:=GetToken(s,',');
if tok='' then
break;
if Copy(tok,1,2)='NO' then
begin
delete(tok,1,2);
doset:=false;
end
else
doset:=true;
found:=false;
if (tok = 'ALL') then
begin
for opt:=low(twpoptimizerswitch) to high(twpoptimizerswitch) do
if doset then
include(a,opt)
else
exclude(a,opt);
end
else
begin
for opt:=low(twpoptimizerswitch) to high(twpoptimizerswitch) do
begin
if WPOptimizerSwitchStr[opt]=tok then
begin
found:=true;
break;
end;
end;
if found then
begin
if doset then
include(a,opt)
else
exclude(a,opt);
end
else
result:=false;
end;
until false;
end;
function UpdateDebugStr(s:string;var a:tdebugswitches):boolean;
var
tok : string;
doset,
found : boolean;
opt : tdebugswitch;
begin
result:=true;
uppervar(s);
repeat
tok:=GetToken(s,',');
if tok='' then
break;
if Copy(tok,1,2)='NO' then
begin
delete(tok,1,2);
doset:=false;
end
else
doset:=true;
found:=false;
for opt:=low(tdebugswitch) to high(tdebugswitch) do
begin
if DebugSwitchStr[opt]=tok then
begin
found:=true;
break;
end;
end;
if found then
begin
if doset then
include(a,opt)
else
exclude(a,opt);
end
else
result:=false;
until false;
end;
function UpdateTargetSwitchStr(s: string; var a: ttargetswitches; global: boolean): boolean;
var
tok,

View File

@ -528,10 +528,6 @@ interface
{$if defined(arm) or defined(avr)}
function SetControllerType(const s:string;var a:tcontrollertype):boolean;
{$endif defined(arm) or defined(avr)}
function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
function UpdateOptimizerStr(s:string;var a:toptimizerswitches):boolean;
function UpdateWpoStr(s: string; var a: twpoptimizerswitches): boolean;
function UpdateDebugStr(s:string;var a:tdebugswitches):boolean;
function IncludeFeature(const s : string) : boolean;
function SetMinFPConstPrec(const s: string; var a: tfloattype) : boolean;
@ -1191,205 +1187,6 @@ implementation
{$endif defined(arm) or defined(avr)}
function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
var
tok : string;
vstr : string;
l : longint;
code : integer;
b : talignmentinfo;
begin
UpdateAlignmentStr:=true;
uppervar(s);
fillchar(b,sizeof(b),0);
repeat
tok:=GetToken(s,'=');
if tok='' then
break;
vstr:=GetToken(s,',');
val(vstr,l,code);
if tok='PROC' then
b.procalign:=l
else if tok='JUMP' then
b.jumpalign:=l
else if tok='LOOP' then
b.loopalign:=l
else if tok='CONSTMIN' then
begin
b.constalignmin:=l;
if l>b.constalignmax then
b.constalignmax:=l;
end
else if tok='CONSTMAX' then
b.constalignmax:=l
else if tok='VARMIN' then
begin
b.varalignmin:=l;
if l>b.varalignmax then
b.varalignmax:=l;
end
else if tok='VARMAX' then
b.varalignmax:=l
else if tok='LOCALMIN' then
begin
b.localalignmin:=l;
if l>b.localalignmax then
b.localalignmax:=l;
end
else if tok='LOCALMAX' then
b.localalignmax:=l
else if tok='RECORDMIN' then
begin
b.recordalignmin:=l;
if l>b.recordalignmax then
b.recordalignmax:=l;
end
else if tok='RECORDMAX' then
b.recordalignmax:=l
else { Error }
UpdateAlignmentStr:=false;
until false;
Result:=Result and UpdateAlignment(a,b);
end;
function UpdateOptimizerStr(s:string;var a:toptimizerswitches):boolean;
var
tok : string;
doset,
found : boolean;
opt : toptimizerswitch;
begin
result:=true;
uppervar(s);
repeat
tok:=GetToken(s,',');
if tok='' then
break;
if Copy(tok,1,2)='NO' then
begin
delete(tok,1,2);
doset:=false;
end
else
doset:=true;
found:=false;
for opt:=low(toptimizerswitch) to high(toptimizerswitch) do
begin
if OptimizerSwitchStr[opt]=tok then
begin
found:=true;
break;
end;
end;
if found then
begin
if doset then
include(a,opt)
else
exclude(a,opt);
end
else
result:=false;
until false;
end;
function UpdateWpoStr(s: string; var a: twpoptimizerswitches): boolean;
var
tok : string;
doset,
found : boolean;
opt : twpoptimizerswitch;
begin
result:=true;
uppervar(s);
repeat
tok:=GetToken(s,',');
if tok='' then
break;
if Copy(tok,1,2)='NO' then
begin
delete(tok,1,2);
doset:=false;
end
else
doset:=true;
found:=false;
if (tok = 'ALL') then
begin
for opt:=low(twpoptimizerswitch) to high(twpoptimizerswitch) do
if doset then
include(a,opt)
else
exclude(a,opt);
end
else
begin
for opt:=low(twpoptimizerswitch) to high(twpoptimizerswitch) do
begin
if WPOptimizerSwitchStr[opt]=tok then
begin
found:=true;
break;
end;
end;
if found then
begin
if doset then
include(a,opt)
else
exclude(a,opt);
end
else
result:=false;
end;
until false;
end;
function UpdateDebugStr(s:string;var a:tdebugswitches):boolean;
var
tok : string;
doset,
found : boolean;
opt : tdebugswitch;
begin
result:=true;
uppervar(s);
repeat
tok:=GetToken(s,',');
if tok='' then
break;
if Copy(tok,1,2)='NO' then
begin
delete(tok,1,2);
doset:=false;
end
else
doset:=true;
found:=false;
for opt:=low(tdebugswitch) to high(tdebugswitch) do
begin
if DebugSwitchStr[opt]=tok then
begin
found:=true;
break;
end;
end;
if found then
begin
if doset then
include(a,opt)
else
exclude(a,opt);
end
else
result:=false;
until false;
end;
function IncludeFeature(const s : string) : boolean;
var
i : tfeature;