|
@@ -192,8 +192,6 @@ unit symtable;
|
|
function getdefnr(l : longint) : pdef;
|
|
function getdefnr(l : longint) : pdef;
|
|
function getsymnr(l : longint) : psym;
|
|
function getsymnr(l : longint) : psym;
|
|
{ load/write }
|
|
{ load/write }
|
|
- constructor load;
|
|
|
|
- procedure write;
|
|
|
|
constructor loadas(typ : tsymtabletype);
|
|
constructor loadas(typ : tsymtabletype);
|
|
procedure writeas;
|
|
procedure writeas;
|
|
procedure loaddefs;
|
|
procedure loaddefs;
|
|
@@ -1056,12 +1054,6 @@ implementation
|
|
psym(p)^.deref;
|
|
psym(p)^.deref;
|
|
end;
|
|
end;
|
|
|
|
|
|
- procedure derefsymsdelayed(p : pnamedindexobject);
|
|
|
|
- begin
|
|
|
|
- if psym(p)^.typ in [absolutesym,propertysym] then
|
|
|
|
- psym(p)^.deref;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
procedure check_forward(sym : pnamedindexobject);
|
|
procedure check_forward(sym : pnamedindexobject);
|
|
begin
|
|
begin
|
|
if psym(sym)^.typ=procsym then
|
|
if psym(sym)^.typ=procsym then
|
|
@@ -1536,14 +1528,21 @@ implementation
|
|
hp : pdef;
|
|
hp : pdef;
|
|
hs : psym;
|
|
hs : psym;
|
|
begin
|
|
begin
|
|
|
|
+ { first deref the ttypesyms }
|
|
|
|
+ hs:=psym(symindex^.first);
|
|
|
|
+ while assigned(hs) do
|
|
|
|
+ begin
|
|
|
|
+ hs^.prederef;
|
|
|
|
+ hs:=psym(hs^.next);
|
|
|
|
+ end;
|
|
|
|
+ { deref the definitions }
|
|
hp:=pdef(defindex^.first);
|
|
hp:=pdef(defindex^.first);
|
|
while assigned(hp) do
|
|
while assigned(hp) do
|
|
begin
|
|
begin
|
|
hp^.deref;
|
|
hp^.deref;
|
|
- hp^.symderef;
|
|
|
|
hp:=pdef(hp^.next);
|
|
hp:=pdef(hp^.next);
|
|
end;
|
|
end;
|
|
-
|
|
|
|
|
|
+ { deref the symbols }
|
|
hs:=psym(symindex^.first);
|
|
hs:=psym(symindex^.first);
|
|
while assigned(hs) do
|
|
while assigned(hs) do
|
|
begin
|
|
begin
|
|
@@ -1553,64 +1552,6 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
- constructor tsymtable.load;
|
|
|
|
- var
|
|
|
|
- st_loading : boolean;
|
|
|
|
- begin
|
|
|
|
- st_loading:=in_loading;
|
|
|
|
- in_loading:=true;
|
|
|
|
-{$ifndef NEWMAP}
|
|
|
|
- current_module^.map^[0]:=@self;
|
|
|
|
-{$else NEWMAP}
|
|
|
|
- current_module^.globalsymtable:=@self;
|
|
|
|
-{$endif NEWMAP}
|
|
|
|
-
|
|
|
|
- symtabletype:=unitsymtable;
|
|
|
|
- symtablelevel:=0;
|
|
|
|
-
|
|
|
|
- { unused for units }
|
|
|
|
- address_fixup:=0;
|
|
|
|
-
|
|
|
|
- datasize:=0;
|
|
|
|
- defowner:=nil;
|
|
|
|
- name:=nil;
|
|
|
|
- unitid:=0;
|
|
|
|
- defowner:=nil;
|
|
|
|
- new(symindex,init(indexgrowsize));
|
|
|
|
- new(defindex,init(indexgrowsize));
|
|
|
|
- new(symsearch,init);
|
|
|
|
- symsearch^.usehash;
|
|
|
|
- symsearch^.noclear:=true;
|
|
|
|
- alignment:=def_alignment;
|
|
|
|
-
|
|
|
|
- { load definitions }
|
|
|
|
- loaddefs;
|
|
|
|
-
|
|
|
|
- { load symbols }
|
|
|
|
- loadsyms;
|
|
|
|
-
|
|
|
|
- { Now we can deref the symbols and definitions }
|
|
|
|
- if not(symtabletype in [objectsymtable,recordsymtable]) then
|
|
|
|
- deref;
|
|
|
|
-
|
|
|
|
-{$ifdef NEWMAP}
|
|
|
|
- { necessary for dependencies }
|
|
|
|
- current_module^.globalsymtable:=nil;
|
|
|
|
-{$endif NEWMAP}
|
|
|
|
- in_loading:=st_loading;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- procedure tsymtable.write;
|
|
|
|
- begin
|
|
|
|
- { write definitions }
|
|
|
|
- foreach({$ifndef TP}@{$endif}Order_overloads);
|
|
|
|
- writedefs;
|
|
|
|
- { write symbols }
|
|
|
|
- writesyms;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
constructor tsymtable.loadas(typ : tsymtabletype);
|
|
constructor tsymtable.loadas(typ : tsymtabletype);
|
|
var
|
|
var
|
|
storesymtable : psymtable;
|
|
storesymtable : psymtable;
|
|
@@ -1623,32 +1564,44 @@ implementation
|
|
new(defindex,init(indexgrowsize));
|
|
new(defindex,init(indexgrowsize));
|
|
new(symsearch,init);
|
|
new(symsearch,init);
|
|
symsearch^.noclear:=true;
|
|
symsearch^.noclear:=true;
|
|
|
|
+ { reset }
|
|
defowner:=nil;
|
|
defowner:=nil;
|
|
- if typ in [recordsymtable,objectsymtable] then
|
|
|
|
- begin
|
|
|
|
- storesymtable:=aktrecordsymtable;
|
|
|
|
- aktrecordsymtable:=@self;
|
|
|
|
- end;
|
|
|
|
- if typ in [parasymtable,localsymtable] then
|
|
|
|
- begin
|
|
|
|
- storesymtable:=aktlocalsymtable;
|
|
|
|
- aktlocalsymtable:=@self;
|
|
|
|
- end;
|
|
|
|
- { used for local browser }
|
|
|
|
- if typ=staticppusymtable then
|
|
|
|
- begin
|
|
|
|
- aktstaticsymtable:=@self;
|
|
|
|
- symsearch^.usehash;
|
|
|
|
- end;
|
|
|
|
name:=nil;
|
|
name:=nil;
|
|
alignment:=def_alignment;
|
|
alignment:=def_alignment;
|
|
- { isn't used there }
|
|
|
|
datasize:=0;
|
|
datasize:=0;
|
|
address_fixup:= 0;
|
|
address_fixup:= 0;
|
|
- { also unused }
|
|
|
|
unitid:=0;
|
|
unitid:=0;
|
|
|
|
+ { setup symtabletype specific things }
|
|
|
|
+ case typ of
|
|
|
|
+ unitsymtable :
|
|
|
|
+ begin
|
|
|
|
+ symtablelevel:=0;
|
|
|
|
+{$ifndef NEWMAP}
|
|
|
|
+ current_module^.map^[0]:=@self;
|
|
|
|
+{$else NEWMAP}
|
|
|
|
+ current_module^.globalsymtable:=@self;
|
|
|
|
+{$endif NEWMAP}
|
|
|
|
+ end;
|
|
|
|
+ recordsymtable,
|
|
|
|
+ objectsymtable :
|
|
|
|
+ begin
|
|
|
|
+ storesymtable:=aktrecordsymtable;
|
|
|
|
+ aktrecordsymtable:=@self;
|
|
|
|
+ end;
|
|
|
|
+ parasymtable,
|
|
|
|
+ localsymtable :
|
|
|
|
+ begin
|
|
|
|
+ storesymtable:=aktlocalsymtable;
|
|
|
|
+ aktlocalsymtable:=@self;
|
|
|
|
+ end;
|
|
|
|
+ { used for local browser }
|
|
|
|
+ staticppusymtable :
|
|
|
|
+ begin
|
|
|
|
+ aktstaticsymtable:=@self;
|
|
|
|
+ symsearch^.usehash;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
|
|
- { load definitions }
|
|
|
|
{ we need the correct symtable for registering }
|
|
{ we need the correct symtable for registering }
|
|
if not (typ in [localsymtable,parasymtable,recordsymtable,objectsymtable]) then
|
|
if not (typ in [localsymtable,parasymtable,recordsymtable,objectsymtable]) then
|
|
begin
|
|
begin
|
|
@@ -1662,19 +1615,30 @@ implementation
|
|
{ load symbols }
|
|
{ load symbols }
|
|
loadsyms;
|
|
loadsyms;
|
|
|
|
|
|
- { now we can deref the syms and defs }
|
|
|
|
- if not (typ in [localsymtable,parasymtable,
|
|
|
|
- recordsymtable,objectsymtable]) then
|
|
|
|
- deref;
|
|
|
|
-
|
|
|
|
- if typ in [recordsymtable,objectsymtable] then
|
|
|
|
- aktrecordsymtable:=storesymtable;
|
|
|
|
- if typ in [localsymtable,parasymtable] then
|
|
|
|
- aktlocalsymtable:=storesymtable;
|
|
|
|
if not (typ in [localsymtable,parasymtable,recordsymtable,objectsymtable]) then
|
|
if not (typ in [localsymtable,parasymtable,recordsymtable,objectsymtable]) then
|
|
- begin
|
|
|
|
- symtablestack:=next;
|
|
|
|
- end;
|
|
|
|
|
|
+ begin
|
|
|
|
+ { now we can deref the syms and defs }
|
|
|
|
+ deref;
|
|
|
|
+ { restore symtablestack }
|
|
|
|
+ symtablestack:=next;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ case typ of
|
|
|
|
+ unitsymtable :
|
|
|
|
+ begin
|
|
|
|
+{$ifdef NEWMAP}
|
|
|
|
+ { necessary for dependencies }
|
|
|
|
+ current_module^.globalsymtable:=nil;
|
|
|
|
+{$endif NEWMAP}
|
|
|
|
+ end;
|
|
|
|
+ recordsymtable,
|
|
|
|
+ objectsymtable :
|
|
|
|
+ aktrecordsymtable:=storesymtable;
|
|
|
|
+ localsymtable,
|
|
|
|
+ parasymtable :
|
|
|
|
+ aktlocalsymtable:=storesymtable;
|
|
|
|
+ end;
|
|
|
|
+
|
|
in_loading:=st_loading;
|
|
in_loading:=st_loading;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1684,31 +1648,40 @@ implementation
|
|
oldtyp : byte;
|
|
oldtyp : byte;
|
|
storesymtable : psymtable;
|
|
storesymtable : psymtable;
|
|
begin
|
|
begin
|
|
- oldtyp:=current_ppu^.entrytyp;
|
|
|
|
storesymtable:=aktrecordsymtable;
|
|
storesymtable:=aktrecordsymtable;
|
|
- if symtabletype in [recordsymtable,objectsymtable] then
|
|
|
|
- begin
|
|
|
|
- storesymtable:=aktrecordsymtable;
|
|
|
|
- aktrecordsymtable:=@self;
|
|
|
|
- end;
|
|
|
|
- if symtabletype in [parasymtable,localsymtable] then
|
|
|
|
- begin
|
|
|
|
- storesymtable:=aktlocalsymtable;
|
|
|
|
- aktlocalsymtable:=@self;
|
|
|
|
- end;
|
|
|
|
- if (symtabletype in [recordsymtable,objectsymtable]) then
|
|
|
|
- current_ppu^.entrytyp:=subentryid;
|
|
|
|
|
|
+ case symtabletype of
|
|
|
|
+ recordsymtable,
|
|
|
|
+ objectsymtable :
|
|
|
|
+ begin
|
|
|
|
+ storesymtable:=aktrecordsymtable;
|
|
|
|
+ aktrecordsymtable:=@self;
|
|
|
|
+ oldtyp:=current_ppu^.entrytyp;
|
|
|
|
+ current_ppu^.entrytyp:=subentryid;
|
|
|
|
+ end;
|
|
|
|
+ parasymtable,
|
|
|
|
+ localsymtable :
|
|
|
|
+ begin
|
|
|
|
+ storesymtable:=aktlocalsymtable;
|
|
|
|
+ aktlocalsymtable:=@self;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
{ order procsym overloads }
|
|
{ order procsym overloads }
|
|
foreach({$ifndef TP}@{$endif}Order_overloads);
|
|
foreach({$ifndef TP}@{$endif}Order_overloads);
|
|
{ write definitions }
|
|
{ write definitions }
|
|
writedefs;
|
|
writedefs;
|
|
{ write symbols }
|
|
{ write symbols }
|
|
writesyms;
|
|
writesyms;
|
|
- current_ppu^.entrytyp:=oldtyp;
|
|
|
|
- if symtabletype in [recordsymtable,objectsymtable] then
|
|
|
|
- aktrecordsymtable:=storesymtable;
|
|
|
|
- if symtabletype in [localsymtable,parasymtable] then
|
|
|
|
- aktlocalsymtable:=storesymtable;
|
|
|
|
|
|
+ case symtabletype of
|
|
|
|
+ recordsymtable,
|
|
|
|
+ objectsymtable :
|
|
|
|
+ begin
|
|
|
|
+ current_ppu^.entrytyp:=oldtyp;
|
|
|
|
+ aktrecordsymtable:=storesymtable;
|
|
|
|
+ end;
|
|
|
|
+ localsymtable,
|
|
|
|
+ parasymtable :
|
|
|
|
+ aktlocalsymtable:=storesymtable;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -2192,7 +2165,8 @@ implementation
|
|
{$endif GDB}
|
|
{$endif GDB}
|
|
|
|
|
|
{ load symtables }
|
|
{ load symtables }
|
|
- inherited load;
|
|
|
|
|
|
+ inherited loadas(unitsymtable);
|
|
|
|
+
|
|
{ set the name after because it is set to nil in tsymtable.load !! }
|
|
{ set the name after because it is set to nil in tsymtable.load !! }
|
|
name:=stringdup(current_module^.modulename^);
|
|
name:=stringdup(current_module^.modulename^);
|
|
|
|
|
|
@@ -2303,7 +2277,7 @@ implementation
|
|
current_ppu^.writeentry(ibendinterface);
|
|
current_ppu^.writeentry(ibendinterface);
|
|
|
|
|
|
{ write the symtable entries }
|
|
{ write the symtable entries }
|
|
- inherited write;
|
|
|
|
|
|
+ inherited writeas;
|
|
|
|
|
|
{ all after doesn't affect crc }
|
|
{ all after doesn't affect crc }
|
|
current_ppu^.do_crc:=false;
|
|
current_ppu^.do_crc:=false;
|
|
@@ -2326,7 +2300,7 @@ implementation
|
|
needed for local debugging of unit functions }
|
|
needed for local debugging of unit functions }
|
|
if ((current_module^.flags and uf_local_browser)<>0) and
|
|
if ((current_module^.flags and uf_local_browser)<>0) and
|
|
assigned(current_module^.localsymtable) then
|
|
assigned(current_module^.localsymtable) then
|
|
- psymtable(current_module^.localsymtable)^.write;
|
|
|
|
|
|
+ psymtable(current_module^.localsymtable)^.writeas;
|
|
{ write all browser section }
|
|
{ write all browser section }
|
|
if (current_module^.flags and uf_has_browser)<>0 then
|
|
if (current_module^.flags and uf_has_browser)<>0 then
|
|
begin
|
|
begin
|
|
@@ -2792,7 +2766,11 @@ implementation
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.71 1999-12-18 14:55:21 florian
|
|
|
|
|
|
+ Revision 1.72 2000-01-03 19:26:04 peter
|
|
|
|
+ * fixed resolving of ttypesym which are reference from object/record
|
|
|
|
+ fields.
|
|
|
|
+
|
|
|
|
+ Revision 1.71 1999/12/18 14:55:21 florian
|
|
* very basic widestring support
|
|
* very basic widestring support
|
|
|
|
|
|
Revision 1.70 1999/12/02 11:28:27 peter
|
|
Revision 1.70 1999/12/02 11:28:27 peter
|