mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 04:39:22 +02:00
codetools: macro directive: storing values
git-svn-id: trunk@23690 -
This commit is contained in:
parent
aa19597663
commit
94d8b4b2b7
@ -283,7 +283,7 @@ type
|
|||||||
FCompilerModeSwitch: TCompilerModeSwitch;
|
FCompilerModeSwitch: TCompilerModeSwitch;
|
||||||
FPascalCompiler: TPascalCompiler;
|
FPascalCompiler: TPascalCompiler;
|
||||||
FMacros: PSourceLinkMakro;
|
FMacros: PSourceLinkMakro;
|
||||||
FMacroCount: integer;
|
FMacroCount, fMacroCapacity: integer;
|
||||||
procedure SetCompilerMode(const AValue: TCompilerMode);
|
procedure SetCompilerMode(const AValue: TCompilerMode);
|
||||||
procedure SetCompilerModeSwitch(const AValue: TCompilerModeSwitch);
|
procedure SetCompilerModeSwitch(const AValue: TCompilerModeSwitch);
|
||||||
procedure SkipTillEndifElse(SkippingUntil: TLSSkippingDirective);
|
procedure SkipTillEndifElse(SkippingUntil: TLSSkippingDirective);
|
||||||
@ -3041,14 +3041,32 @@ end;
|
|||||||
|
|
||||||
procedure TLinkScanner.AddMacroValue(MacroName: PChar; ValueStart,
|
procedure TLinkScanner.AddMacroValue(MacroName: PChar; ValueStart,
|
||||||
ValueEnd: integer);
|
ValueEnd: integer);
|
||||||
|
var
|
||||||
|
i: LongInt;
|
||||||
begin
|
begin
|
||||||
|
i:=IndexOfMacro(MacroName,false);
|
||||||
|
if i<0 then begin
|
||||||
|
// insert new macro
|
||||||
|
i:=IndexOfMacro(MacroName,true);
|
||||||
|
fMacroCapacity:=fMacroCapacity*2;
|
||||||
|
if fMacroCapacity<4 then fMacroCapacity:=4;
|
||||||
|
ReAllocMem(FMacros,SizeOf(TSourceLinkMakro)*fMacroCapacity);
|
||||||
|
if i<FMacroCount then
|
||||||
|
System.Move(FMacros[i],FMacros[i+1],SizeOf(TSourceLinkMakro)*(FMacroCount-i));
|
||||||
|
inc(FMacroCount);
|
||||||
|
end;
|
||||||
|
FMacros[i].Name:=MacroName;
|
||||||
|
FMacros[i].Code:=Code;
|
||||||
|
FMacros[i].StartPos:=ValueStart;
|
||||||
|
FMacros[i].EndPos:=ValueEnd;
|
||||||
|
//WriteLn('TLinkScanner.AddMacroValue ',GetIdentifier(MacroName),' ',copy(Src,ValueStart,ValueEnd-ValueStart));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLinkScanner.ClearMacros;
|
procedure TLinkScanner.ClearMacros;
|
||||||
begin
|
begin
|
||||||
ReAllocMem(FMacros,0);
|
ReAllocMem(FMacros,0);
|
||||||
FMacroCount:=0;
|
FMacroCount:=0;
|
||||||
|
fMacroCapacity:=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLinkScanner.IndexOfMacro(MacroName: PChar; InsertPos: boolean): integer;
|
function TLinkScanner.IndexOfMacro(MacroName: PChar; InsertPos: boolean): integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user