codetools: modeswitch unicodestrings: set FPC_UNICODESTRINGS

git-svn-id: trunk@52685 -
This commit is contained in:
mattias 2016-07-14 09:28:57 +00:00
parent f00b8a8e59
commit 0bd6601f77

View File

@ -191,7 +191,8 @@ type
cmsFinalFields, { allows declaring fields as "final", which means they must be initialised cmsFinalFields, { allows declaring fields as "final", which means they must be initialised
in the (class) constructor and are constant from then on (same as final in the (class) constructor and are constant from then on (same as final
fields in Java) } fields in Java) }
cmsDefault_unicodestring, { ? see http://wiki.freepascal.org/FPC_JVM/Language } cmsDefault_unicodestring, { makes the default string type in $h+ mode unicodestring rather than
ansistring; similarly, char becomes unicodechar rather than ansichar }
cmsTypeHelpers, cmsTypeHelpers,
cmsBlocks cmsBlocks
); );
@ -3410,7 +3411,6 @@ begin
if CompareUpToken(CompilerModeNames[AMode],Src,ValStart,SrcPos) then if CompareUpToken(CompilerModeNames[AMode],Src,ValStart,SrcPos) then
begin begin
CompilerMode:=AMode; CompilerMode:=AMode;
Values.Variables[CompilerModeVars[AMode]]:='1';
ModeValid:=true; ModeValid:=true;
break; break;
end; end;
@ -3440,12 +3440,20 @@ begin
then begin then begin
Result:=true; Result:=true;
s:=[ModeSwitch]; s:=[ModeSwitch];
if ModeSwitch=cmsObjectiveC2 then case ModeSwitch of
Include(s,cmsObjectiveC1); cmsObjectiveC2: Include(s,cmsObjectiveC1);
if (SrcPos<=SrcLen) and (Src[SrcPos]='-') then end;
FCompilerModeSwitches:=FCompilerModeSwitches-s if (SrcPos<=SrcLen) and (Src[SrcPos]='-') then begin
else FCompilerModeSwitches:=FCompilerModeSwitches-s;
case ModeSwitch of
cmsDefault_unicodestring: Values.Undefine('FPC_UNICODESTRINGS');
end;
end else begin
FCompilerModeSwitches:=FCompilerModeSwitches+s; FCompilerModeSwitches:=FCompilerModeSwitches+s;
case ModeSwitch of
cmsDefault_unicodestring: Values.Variables['FPC_UNICODESTRINGS'] := '1';
end;
end;
exit; exit;
end; end;
end; end;
@ -4498,9 +4506,11 @@ end;
procedure TLinkScanner.SetCompilerMode(const AValue: TCompilerMode); procedure TLinkScanner.SetCompilerMode(const AValue: TCompilerMode);
begin begin
if FCompilerMode=AValue then exit; if FCompilerMode=AValue then exit;
Values.Undefine(CompilerModeVars[FCompilerMode]);
FCompilerMode:=AValue; FCompilerMode:=AValue;
FCompilerModeSwitches:=DefaultCompilerModeSwitches[CompilerMode]; FCompilerModeSwitches:=DefaultCompilerModeSwitches[CompilerMode];
FNestedComments:=cmsNested_comment in CompilerModeSwitches; FNestedComments:=cmsNested_comment in CompilerModeSwitches;
Values.Variables[CompilerModeVars[FCompilerMode]]:='1';
end; end;
procedure TLinkScanner.SetDirectiveValueWithSequence( procedure TLinkScanner.SetDirectiveValueWithSequence(