123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 |
- {
- $Id$
- Copyright (c) 1993-98 by Florian Klaempfl, Pierre Muller
- Interface for the symbols types of the symtable
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- ****************************************************************************
- }
- {************************************************
- TSym
- ************************************************}
- symprop = byte;
- { possible types for symtable entries }
- tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,programsym,
- constsym,enumsym,typedconstsym,errorsym,syssym,
- labelsym,absolutesym,propertysym,funcretsym,
- macrosym);
- { this object is the base for all symbol objects }
- psym = ^tsym;
- tsym = object(tsymtableentry)
- typ : tsymtyp;
- properties : symprop;
- fileinfo : tfileposinfo;
- {$ifdef GDB}
- isstabwritten : boolean;
- {$endif GDB}
- lastref,
- defref,
- lastwritten : pref;
- refcount : longint;
- constructor init(const n : string);
- constructor load;
- destructor done;virtual;
- procedure write;virtual;
- procedure deref;virtual;
- function mangledname : string;virtual;
- procedure insert_in_data;virtual;
- {$ifdef GDB}
- function stabstring : pchar;virtual;
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- procedure load_references;virtual;
- function write_references : boolean;virtual;
- {$ifdef BrowserLog}
- procedure add_to_browserlog;virtual;
- {$endif BrowserLog}
- end;
- plabelsym = ^tlabelsym;
- tlabelsym = object(tsym)
- number : plabel;
- defined : boolean;
- constructor init(const n : string; l : plabel);
- destructor done;virtual;
- constructor load;
- function mangledname : string;virtual;
- procedure write;virtual;
- end;
- punitsym = ^tunitsym;
- tunitsym = object(tsym)
- unitsymtable : punitsymtable;
- prevsym : punitsym;
- refs : longint;
- constructor init(const n : string;ref : punitsymtable);
- constructor load;
- destructor done;virtual;
- procedure write;virtual;
- {$ifdef GDB}
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- end;
- pmacrosym = ^tmacrosym;
- tmacrosym = object(tsym)
- defined : boolean;
- buftext : pchar;
- buflen : longint;
- { macros aren't written to PPU files ! }
- constructor init(const n : string);
- destructor done;virtual;
- end;
- perrorsym = ^terrorsym;
- terrorsym = object(tsym)
- constructor init;
- end;
- pprocsym = ^tprocsym;
- tprocsym = object(tsym)
- definition : pprocdef;
- {$ifdef CHAINPROCSYMS}
- nextprocsym : pprocsym;
- {$endif CHAINPROCSYMS}
- {$ifdef GDB}
- is_global : boolean;{necessary for stab}
- {$endif GDB}
- constructor init(const n : string);
- constructor load;
- destructor done;virtual;
- function mangledname : string;virtual;
- function demangledname:string;
- { writes all declarations }
- procedure write_parameter_lists;
- { tests, if all procedures definitions are defined and not }
- { only forward }
- procedure check_forward;
- procedure write;virtual;
- procedure deref;virtual;
- procedure load_references;virtual;
- function write_references : boolean;virtual;
- {$ifdef BrowserLog}
- procedure add_to_browserlog;virtual;
- {$endif BrowserLog}
- {$ifdef GDB}
- function stabstring : pchar;virtual;
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- end;
- pforwardpointer=^tforwardpointer;
- tforwardpointer=record
- next : pforwardpointer;
- def : ppointerdef;
- end;
- ttypesym = object(tsym)
- definition : pdef;
- {$ifdef GDB}
- isusedinstab : boolean;
- {$endif GDB}
- constructor init(const n : string;d : pdef);
- constructor load;
- destructor done;virtual;
- procedure write;virtual;
- procedure deref;virtual;
- procedure addforwardpointer(p:ppointerdef);
- procedure updateforwarddef(p:pdef);
- procedure load_references;virtual;
- function write_references : boolean;virtual;
- {$ifdef BrowserLog}
- procedure add_to_browserlog;virtual;
- {$endif BrowserLog}
- {$ifdef GDB}
- function stabstring : pchar;virtual;
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- private
- forwardpointer : pforwardpointer;
- end;
- pvarsym = ^tvarsym;
- tvarsym = object(tsym)
- address : longint;
- localvarsym : pvarsym;
- islocalcopy : boolean;
- definition : pdef;
- refs : longint;
- var_options : byte;
- _mangledname : pchar;
- reg : tregister; { if reg<>R_NO, then the variable is an register variable }
- varspez : tvarspez; { sets the type of access }
- is_valid : byte;
- constructor init(const n : string;p : pdef);
- constructor init_dll(const n : string;p : pdef);
- constructor init_C(const n,mangled : string;p : pdef);
- constructor load;
- destructor done;virtual;
- procedure write;virtual;
- procedure deref;virtual;
- procedure setmangledname(const s : string);
- function mangledname : string;virtual;
- procedure insert_in_data;virtual;
- function getsize : longint;
- function getpushsize : longint;
- {$ifdef GDB}
- function stabstring : pchar;virtual;
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- end;
- ppropertysym = ^tpropertysym;
- tpropertysym = object(tsym)
- options : longint;
- proptype : pdef;
- { proppara : pdefcoll; }
- readaccesssym,writeaccesssym,storedsym : psym;
- readaccessdef,writeaccessdef,storeddef : pdef;
- index,default : longint;
- constructor init(const n : string);
- destructor done;virtual;
- constructor load;
- function getsize : longint;virtual;
- procedure write;virtual;
- procedure deref;virtual;
- {$ifdef GDB}
- { I don't know how (FK) }
- function stabstring : pchar;virtual;
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- end;
- pfuncretsym = ^tfuncretsym;
- tfuncretsym = object(tsym)
- funcretprocinfo : pointer{ should be pprocinfo};
- funcretdef : pdef;
- address : longint;
- constructor init(const n : string;approcinfo : pointer{pprocinfo});
- constructor load;
- procedure write;virtual;
- procedure deref;virtual;
- procedure insert_in_data;virtual;
- {$ifdef GDB}
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- end;
- absolutetyp = (tovar,toasm,toaddr);
- pabsolutesym = ^tabsolutesym;
- tabsolutesym = object(tvarsym)
- abstyp : absolutetyp;
- absseg : boolean;
- ref : psym;
- asmname : pstring;
- constructor init(const n : string;p : pdef);
- constructor load;
- procedure deref;virtual;
- function mangledname : string;virtual;
- procedure write;virtual;
- procedure insert_in_data;virtual;
- { this creates a problem in gen_vmt !!!!!
- because the pdef is not resolved yet !!
- we should fix this
- constructor init(const s : string;p : pdef;newref : psym);}
- {$ifdef GDB}
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- end;
- ptypedconstsym = ^ttypedconstsym;
- ttypedconstsym = object(tsym)
- prefix : pstring;
- definition : pdef;
- is_really_const : boolean;
- constructor init(const n : string;p : pdef;really_const : boolean);
- constructor load;
- destructor done;virtual;
- function mangledname : string;virtual;
- procedure write;virtual;
- procedure deref;virtual;
- function getsize:longint;
- procedure insert_in_data;virtual;
- procedure really_insert_in_data;
- {$ifdef GDB}
- function stabstring : pchar;virtual;
- {$endif GDB}
- end;
- tconsttype = (constord,conststring,constreal,constbool,
- constint,constchar,constset,constnil);
- pconstsym = ^tconstsym;
- tconstsym = object(tsym)
- definition : pdef;
- consttype : tconsttype;
- value,
- len : longint; { len is needed for string length }
- constructor init(const n : string;t : tconsttype;v : longint);
- constructor init_def(const n : string;t : tconsttype;v : longint;def : pdef);
- constructor init_string(const n : string;t : tconsttype;str:pchar;l:longint);
- constructor load;
- destructor done;virtual;
- function mangledname : string;virtual;
- procedure deref;virtual;
- procedure write;virtual;
- {$ifdef GDB}
- function stabstring : pchar;virtual;
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- end;
- tenumsym = object(tsym)
- value : longint;
- definition : penumdef;
- nextenum : penumsym;
- constructor init(const n : string;def : penumdef;v : longint);
- constructor load;
- procedure write;virtual;
- procedure deref;virtual;
- procedure order;
- {$ifdef GDB}
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- end;
- pprogramsym = ^tprogramsym;
- tprogramsym = object(tsym)
- constructor init(const n : string);
- end;
- psyssym = ^tsyssym;
- tsyssym = object(tsym)
- number : longint;
- constructor init(const n : string;l : longint);
- constructor load;
- destructor done;virtual;
- procedure write;virtual;
- {$ifdef GDB}
- procedure concatstabto(asmlist : paasmoutput);virtual;
- {$endif GDB}
- end;
- {
- $Log$
- Revision 1.23 1999-05-13 21:59:47 peter
- * removed oldppu code
- * warning if objpas is loaded from uses
- * first things for new deref writing
- Revision 1.22 1999/04/26 13:31:53 peter
- * release storenumber,double_checksum
- Revision 1.21 1999/04/25 22:38:40 pierre
- + added is_really_const booleanfield for typedconstsym
- for Delphi in $J- mode (not yet implemented !)
- Revision 1.20 1999/04/21 09:43:56 peter
- * storenumber works
- * fixed some typos in double_checksum
- + incompatible types type1 and type2 message (with storenumber)
- Revision 1.19 1999/04/17 13:16:23 peter
- * fixes for storenumber
- Revision 1.18 1999/04/14 09:15:03 peter
- * first things to store the symbol/def number in the ppu
- Revision 1.17 1999/03/31 13:55:23 peter
- * assembler inlining working for ag386bin
- Revision 1.16 1999/03/24 23:17:29 peter
- * fixed bugs 212,222,225,227,229,231,233
- Revision 1.15 1999/02/22 13:07:11 pierre
- + -b and -bl options work !
- + cs_local_browser ($L+) is disabled if cs_browser ($Y+)
- is not enabled when quitting global section
- * local vars and procedures are not yet stored into PPU
- Revision 1.14 1999/01/20 10:20:22 peter
- * don't make localvar copies for assembler procedures
- Revision 1.13 1999/01/14 21:49:59 peter
- * fixed forwardpointer problem with multiple forwards for the same
- typesym. It now uses a linkedlist instead of a single pointer
- Revision 1.12 1999/01/12 14:25:37 peter
- + BrowserLog for browser.log generation
- + BrowserCol for browser info in TCollections
- * released all other UseBrowser
- Revision 1.11 1998/12/30 22:15:55 peter
- + farpointer type
- * absolutesym now also stores if its far
- Revision 1.10 1998/12/30 13:41:15 peter
- * released valuepara
- Revision 1.9 1998/11/28 16:20:57 peter
- + support for dll variables
- Revision 1.8 1998/11/18 15:44:19 peter
- * VALUEPARA for tp7 compatible value parameters
- Revision 1.7 1998/11/16 10:13:50 peter
- * label defines are checked at the end of the proc
- Revision 1.6 1998/11/13 10:18:12 peter
- + nil constants
- Revision 1.5 1998/11/05 23:39:32 peter
- + typedconst.getsize
- Revision 1.4 1998/10/20 08:07:02 pierre
- * several memory corruptions due to double freemem solved
- => never use p^.loc.location:=p^.left^.loc.location;
- + finally I added now by default
- that ra386dir translates global and unit symbols
- + added a first field in tsymtable and
- a nextsym field in tsym
- (this allows to obtain ordered type info for
- records and objects in gdb !)
- Revision 1.3 1998/10/08 17:17:34 pierre
- * current_module old scanner tagged as invalid if unit is recompiled
- + added ppheap for better info on tracegetmem of heaptrc
- (adds line column and file index)
- * several memory leaks removed ith help of heaptrc !!
- Revision 1.2 1998/09/24 15:11:18 peter
- * fixed enum for not GDB
- Revision 1.1 1998/09/23 12:03:57 peter
- * overloading fix for array of const
- }
|