* UpdateTargetSwitchStr moved from unit globals to unit options in order to

avoid the dependency of unit globals on unit symtable, which breaks the build
  of ppudump

git-svn-id: trunk@25596 -
This commit is contained in:
nickysn 2013-09-28 15:43:56 +00:00
parent a48b44cfe5
commit 989c543ea2
3 changed files with 92 additions and 94 deletions

View File

@ -532,7 +532,6 @@ interface
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;
function IncludeFeature(const s : string) : boolean;
function SetMinFPConstPrec(const s: string; var a: tfloattype) : boolean;
@ -567,8 +566,7 @@ implementation
windirs,
{$endif VER2_4}
{$endif}
comphook,
symtable;
comphook;
{****************************************************************************
TLinkStrMap
@ -1392,95 +1390,6 @@ implementation
end;
function UpdateTargetSwitchStr(s: string; var a: ttargetswitches; global: boolean): boolean;
var
tok,
value : string;
setstr: string[2];
equalspos: longint;
doset,
gotvalue,
found : boolean;
opt : ttargetswitch;
begin
result:=true;
repeat
tok:=GetToken(s,',');
if tok='' then
break;
setstr:=upper(copy(tok,length(tok),1));
if setstr='-' then
begin
setlength(tok,length(tok)-1);
doset:=false;
end
else
doset:=true;
{ value specified? }
gotvalue:=false;
equalspos:=pos('=',tok);
if equalspos<>0 then
begin
value:=copy(tok,equalspos+1,length(tok));
delete(tok,equalspos,length(tok));
gotvalue:=true;
end;
found:=false;
uppervar(tok);
for opt:=low(ttargetswitch) to high(ttargetswitch) do
begin
if TargetSwitchStr[opt].name=tok then
begin
found:=true;
break;
end;
end;
if found then
begin
if not global and
TargetSwitchStr[opt].isglobal then
result:=false
else if not TargetSwitchStr[opt].hasvalue then
begin
if gotvalue then
result:=false;
if (TargetSwitchStr[opt].define<>'') and (doset xor (opt in a)) then
if doset then
def_system_macro(TargetSwitchStr[opt].define)
else
undef_system_macro(TargetSwitchStr[opt].define);
if doset then
include(a,opt)
else
exclude(a,opt)
end
else
begin
if not gotvalue or
not doset then
result:=false
else
begin
case opt of
ts_auto_getter_prefix:
prop_auto_getter_prefix:=value;
ts_auto_setter_predix:
prop_auto_setter_prefix:=value;
else
begin
writeln('Internalerror 2012053001');
halt(1);
end;
end;
end;
end;
end
else
result:=false;
until false;
end;
function IncludeFeature(const s : string) : boolean;
var
i : tfeature;

View File

@ -79,9 +79,9 @@ Type
var
coption : TOptionClass;
function UpdateTargetSwitchStr(s: string; var a: ttargetswitches; global: boolean): boolean;
procedure read_arguments(cmd:TCmdStr);
implementation
uses
@ -150,6 +150,95 @@ begin
init_settings.globalswitches:=init_settings.globalswitches-[cs_link_shared,cs_link_smart];
end;
function UpdateTargetSwitchStr(s: string; var a: ttargetswitches; global: boolean): boolean;
var
tok,
value : string;
setstr: string[2];
equalspos: longint;
doset,
gotvalue,
found : boolean;
opt : ttargetswitch;
begin
result:=true;
repeat
tok:=GetToken(s,',');
if tok='' then
break;
setstr:=upper(copy(tok,length(tok),1));
if setstr='-' then
begin
setlength(tok,length(tok)-1);
doset:=false;
end
else
doset:=true;
{ value specified? }
gotvalue:=false;
equalspos:=pos('=',tok);
if equalspos<>0 then
begin
value:=copy(tok,equalspos+1,length(tok));
delete(tok,equalspos,length(tok));
gotvalue:=true;
end;
found:=false;
uppervar(tok);
for opt:=low(ttargetswitch) to high(ttargetswitch) do
begin
if TargetSwitchStr[opt].name=tok then
begin
found:=true;
break;
end;
end;
if found then
begin
if not global and
TargetSwitchStr[opt].isglobal then
result:=false
else if not TargetSwitchStr[opt].hasvalue then
begin
if gotvalue then
result:=false;
if (TargetSwitchStr[opt].define<>'') and (doset xor (opt in a)) then
if doset then
def_system_macro(TargetSwitchStr[opt].define)
else
undef_system_macro(TargetSwitchStr[opt].define);
if doset then
include(a,opt)
else
exclude(a,opt)
end
else
begin
if not gotvalue or
not doset then
result:=false
else
begin
case opt of
ts_auto_getter_prefix:
prop_auto_getter_prefix:=value;
ts_auto_setter_predix:
prop_auto_setter_prefix:=value;
else
begin
writeln('Internalerror 2012053001');
halt(1);
end;
end;
end;
end;
end
else
result:=false;
until false;
end;
{****************************************************************************
Toption
****************************************************************************}

View File

@ -52,7 +52,7 @@ unit scandir;
uses
SysUtils,
cutils,cfileutl,
globals,systems,widestr,cpuinfo,
globals,systems,options,widestr,cpuinfo,
verbose,comphook,ppu,
scanner,switches,
fmodule,