mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 21:20:29 +02:00
symdef.pas, tprocdef:
+ new token buffer that holds the declaration of the generic function/method while the one from tdef contains the body ppu.pas: * increase PPU version utils/ppuutils/ppudump.pp: * also read the declaration token buffer, it's however not printed yet (ToDo!) git-svn-id: trunk@31759 -
This commit is contained in:
parent
e8c68a09c1
commit
e44a51f10d
@ -43,7 +43,7 @@ type
|
|||||||
{$endif Test_Double_checksum}
|
{$endif Test_Double_checksum}
|
||||||
|
|
||||||
const
|
const
|
||||||
CurrentPPUVersion = 177;
|
CurrentPPUVersion = 178;
|
||||||
|
|
||||||
{ buffer sizes }
|
{ buffer sizes }
|
||||||
maxentrysize = 1024;
|
maxentrysize = 1024;
|
||||||
|
@ -721,6 +721,8 @@ interface
|
|||||||
{$endif}
|
{$endif}
|
||||||
symoptions : tsymoptions;
|
symoptions : tsymoptions;
|
||||||
deprecatedmsg : pshortstring;
|
deprecatedmsg : pshortstring;
|
||||||
|
{ generic support }
|
||||||
|
genericdecltokenbuf : tdynamicarray;
|
||||||
{ symbol owning this definition }
|
{ symbol owning this definition }
|
||||||
procsym : tsym;
|
procsym : tsym;
|
||||||
procsymderef : tderef;
|
procsymderef : tderef;
|
||||||
@ -779,6 +781,7 @@ interface
|
|||||||
function is_methodpointer:boolean;override;
|
function is_methodpointer:boolean;override;
|
||||||
function is_addressonly:boolean;override;
|
function is_addressonly:boolean;override;
|
||||||
procedure make_external;
|
procedure make_external;
|
||||||
|
procedure init_genericdecl;
|
||||||
|
|
||||||
{ aliases to fields only required when a function is implemented in
|
{ aliases to fields only required when a function is implemented in
|
||||||
the current unit }
|
the current unit }
|
||||||
@ -5182,8 +5185,9 @@ implementation
|
|||||||
|
|
||||||
constructor tprocdef.ppuload(ppufile:tcompilerppufile);
|
constructor tprocdef.ppuload(ppufile:tcompilerppufile);
|
||||||
var
|
var
|
||||||
i,aliasnamescount : longint;
|
i,aliasnamescount,sizeleft : longint;
|
||||||
level : byte;
|
level : byte;
|
||||||
|
buf : array[0..255] of byte;
|
||||||
begin
|
begin
|
||||||
inherited ppuload(procdef,ppufile);
|
inherited ppuload(procdef,ppufile);
|
||||||
{$ifdef symansistr}
|
{$ifdef symansistr}
|
||||||
@ -5245,6 +5249,23 @@ implementation
|
|||||||
for i:=1 to aliasnamescount do
|
for i:=1 to aliasnamescount do
|
||||||
aliasnames.insert(ppufile.getstring);
|
aliasnames.insert(ppufile.getstring);
|
||||||
|
|
||||||
|
{ load the token stream containing the declaration }
|
||||||
|
sizeleft:=ppufile.getlongint;
|
||||||
|
if sizeleft>0 then
|
||||||
|
begin
|
||||||
|
init_genericdecl;
|
||||||
|
while sizeleft>0 do
|
||||||
|
begin
|
||||||
|
if sizeleft>sizeof(buf) then
|
||||||
|
i:=sizeof(buf)
|
||||||
|
else
|
||||||
|
i:=sizeleft;
|
||||||
|
ppufile.getdata(buf,i);
|
||||||
|
genericdecltokenbuf.write(buf,i);
|
||||||
|
dec(sizeleft,i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
ppuload_platform(ppufile);
|
ppuload_platform(ppufile);
|
||||||
|
|
||||||
{ load para symtable }
|
{ load para symtable }
|
||||||
@ -5305,6 +5326,8 @@ implementation
|
|||||||
freemem(implprocdefinfo);
|
freemem(implprocdefinfo);
|
||||||
implprocdefinfo:=nil;
|
implprocdefinfo:=nil;
|
||||||
end;
|
end;
|
||||||
|
genericdecltokenbuf.free;
|
||||||
|
genericdecltokenbuf:=nil;
|
||||||
stringdispose(import_dll);
|
stringdispose(import_dll);
|
||||||
stringdispose(import_name);
|
stringdispose(import_name);
|
||||||
stringdispose(deprecatedmsg);
|
stringdispose(deprecatedmsg);
|
||||||
@ -5329,8 +5352,9 @@ implementation
|
|||||||
procedure tprocdef.ppuwrite(ppufile:tcompilerppufile);
|
procedure tprocdef.ppuwrite(ppufile:tcompilerppufile);
|
||||||
var
|
var
|
||||||
oldintfcrc : boolean;
|
oldintfcrc : boolean;
|
||||||
aliasnamescount : longint;
|
aliasnamescount,i,sizeleft : longint;
|
||||||
item : TCmdStrListItem;
|
item : TCmdStrListItem;
|
||||||
|
buf : array[0..255] of byte;
|
||||||
begin
|
begin
|
||||||
{ released procdef? }
|
{ released procdef? }
|
||||||
if not assigned(parast) then
|
if not assigned(parast) then
|
||||||
@ -5397,6 +5421,26 @@ implementation
|
|||||||
|
|
||||||
ppufile.do_crc:=oldintfcrc;
|
ppufile.do_crc:=oldintfcrc;
|
||||||
|
|
||||||
|
{ generic tokens for the declaration }
|
||||||
|
if assigned(genericdecltokenbuf) and (genericdecltokenbuf.size>0) then
|
||||||
|
begin
|
||||||
|
sizeleft:=genericdecltokenbuf.size;
|
||||||
|
genericdecltokenbuf.seek(0);
|
||||||
|
ppufile.putlongint(sizeleft);
|
||||||
|
while sizeleft>0 do
|
||||||
|
begin
|
||||||
|
if sizeleft>sizeof(buf) then
|
||||||
|
i:=sizeof(buf)
|
||||||
|
else
|
||||||
|
i:=sizeleft;
|
||||||
|
genericdecltokenbuf.read(buf,i);
|
||||||
|
ppufile.putdata(buf,i);
|
||||||
|
dec(sizeleft,i);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ppufile.putlongint(0);
|
||||||
|
|
||||||
{ write this entry }
|
{ write this entry }
|
||||||
writeentry(ppufile,ibprocdef);
|
writeentry(ppufile,ibprocdef);
|
||||||
|
|
||||||
@ -5532,6 +5576,14 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.init_genericdecl;
|
||||||
|
begin
|
||||||
|
if assigned(genericdecltokenbuf) then
|
||||||
|
internalerror(2015061901);
|
||||||
|
genericdecltokenbuf:=tdynamicarray.create(256);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tprocdef.GetSymtable(t:tGetSymtable):TSymtable;
|
function tprocdef.GetSymtable(t:tGetSymtable):TSymtable;
|
||||||
begin
|
begin
|
||||||
case t of
|
case t of
|
||||||
|
@ -2718,7 +2718,8 @@ procedure readdefinitions(const s:string; ParentDef: TPpuContainerDef);
|
|||||||
{ type tvarianttype is in symconst unit }
|
{ type tvarianttype is in symconst unit }
|
||||||
var
|
var
|
||||||
b : byte;
|
b : byte;
|
||||||
l,j : longint;
|
l,j,tokenbufsize : longint;
|
||||||
|
tokenbuf : pbyte;
|
||||||
calloption : tproccalloption;
|
calloption : tproccalloption;
|
||||||
procoptions : tprocoptions;
|
procoptions : tprocoptions;
|
||||||
implprocoptions: timplprocoptions;
|
implprocoptions: timplprocoptions;
|
||||||
@ -3029,6 +3030,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
writeln;
|
writeln;
|
||||||
end;
|
end;
|
||||||
|
tokenbufsize:=ppufile.getlongint;
|
||||||
|
if tokenbufsize<>0 then
|
||||||
|
begin
|
||||||
|
write ([space,' Declaration token buffer : TODO']);
|
||||||
|
tokenbuf:=allocmem(tokenbufsize);
|
||||||
|
ppufile.getdata(tokenbuf^,tokenbufsize);
|
||||||
|
freemem(tokenbuf);
|
||||||
|
end;
|
||||||
if not EndOfEntry then
|
if not EndOfEntry then
|
||||||
HasMoreInfos;
|
HasMoreInfos;
|
||||||
space:=' '+space;
|
space:=' '+space;
|
||||||
|
Loading…
Reference in New Issue
Block a user