symsymh.inc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl, Pierre Muller
  4. Interface for the symbols types of the symtable
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. {************************************************
  19. TSym
  20. ************************************************}
  21. symprop = byte;
  22. { possible types for symtable entries }
  23. tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,programsym,
  24. constsym,enumsym,typedconstsym,errorsym,syssym,
  25. labelsym,absolutesym,propertysym,funcretsym,
  26. macrosym);
  27. { this object is the base for all symbol objects }
  28. psym = ^tsym;
  29. tsym = object
  30. typ : tsymtyp;
  31. _name : pchar;
  32. left,right : psym;
  33. {$ifndef nonextfield}
  34. nextsym : psym;
  35. {$endif nextfield}
  36. speedvalue : longint;
  37. properties : symprop;
  38. owner : psymtable;
  39. indexnb : longint;
  40. fileinfo : tfileposinfo;
  41. {$ifdef GDB}
  42. isstabwritten : boolean;
  43. {$endif GDB}
  44. lastref,
  45. defref,
  46. lastwritten : pref;
  47. refcount : longint;
  48. constructor init(const n : string);
  49. constructor load;
  50. destructor done;virtual;
  51. procedure write;virtual;
  52. procedure deref;virtual;
  53. function name : string;
  54. function mangledname : string;virtual;
  55. procedure setname(const s : string);
  56. procedure insert_in_data;virtual;
  57. {$ifdef GDB}
  58. function stabstring : pchar;virtual;
  59. procedure concatstabto(asmlist : paasmoutput);virtual;
  60. {$endif GDB}
  61. procedure load_references;virtual;
  62. function write_references : boolean;virtual;
  63. {$ifdef BrowserLog}
  64. procedure add_to_browserlog;virtual;
  65. {$endif BrowserLog}
  66. end;
  67. plabelsym = ^tlabelsym;
  68. tlabelsym = object(tsym)
  69. number : plabel;
  70. defined : boolean;
  71. constructor init(const n : string; l : plabel);
  72. destructor done;virtual;
  73. constructor load;
  74. function mangledname : string;virtual;
  75. procedure write;virtual;
  76. end;
  77. punitsym = ^tunitsym;
  78. tunitsym = object(tsym)
  79. unitsymtable : punitsymtable;
  80. prevsym : punitsym;
  81. refs : longint;
  82. constructor init(const n : string;ref : punitsymtable);
  83. constructor load;
  84. destructor done;virtual;
  85. procedure write;virtual;
  86. {$ifdef GDB}
  87. procedure concatstabto(asmlist : paasmoutput);virtual;
  88. {$endif GDB}
  89. end;
  90. pmacrosym = ^tmacrosym;
  91. tmacrosym = object(tsym)
  92. defined : boolean;
  93. buftext : pchar;
  94. buflen : longint;
  95. { macros aren't written to PPU files ! }
  96. constructor init(const n : string);
  97. destructor done;virtual;
  98. end;
  99. perrorsym = ^terrorsym;
  100. terrorsym = object(tsym)
  101. constructor init;
  102. end;
  103. pprocsym = ^tprocsym;
  104. tprocsym = object(tsym)
  105. definition : pprocdef;
  106. {$ifdef CHAINPROCSYMS}
  107. nextprocsym : pprocsym;
  108. {$endif CHAINPROCSYMS}
  109. {$ifdef GDB}
  110. is_global : boolean;{necessary for stab}
  111. {$endif GDB}
  112. constructor init(const n : string);
  113. constructor load;
  114. destructor done;virtual;
  115. function mangledname : string;virtual;
  116. function demangledname:string;
  117. { writes all declarations }
  118. procedure write_parameter_lists;
  119. { tests, if all procedures definitions are defined and not }
  120. { only forward }
  121. procedure check_forward;
  122. procedure write;virtual;
  123. procedure deref;virtual;
  124. procedure load_references;virtual;
  125. function write_references : boolean;virtual;
  126. {$ifdef BrowserLog}
  127. procedure add_to_browserlog;virtual;
  128. {$endif BrowserLog}
  129. {$ifdef GDB}
  130. function stabstring : pchar;virtual;
  131. procedure concatstabto(asmlist : paasmoutput);virtual;
  132. {$endif GDB}
  133. end;
  134. pforwardpointer=^tforwardpointer;
  135. tforwardpointer=record
  136. next : pforwardpointer;
  137. def : ppointerdef;
  138. end;
  139. ttypesym = object(tsym)
  140. definition : pdef;
  141. forwardpointer : pforwardpointer;
  142. {$ifdef GDB}
  143. isusedinstab : boolean;
  144. {$endif GDB}
  145. constructor init(const n : string;d : pdef);
  146. constructor load;
  147. destructor done;virtual;
  148. procedure write;virtual;
  149. procedure deref;virtual;
  150. procedure load_references;virtual;
  151. function write_references : boolean;virtual;
  152. {$ifdef BrowserLog}
  153. procedure add_to_browserlog;virtual;
  154. {$endif BrowserLog}
  155. {$ifdef GDB}
  156. function stabstring : pchar;virtual;
  157. procedure concatstabto(asmlist : paasmoutput);virtual;
  158. {$endif GDB}
  159. end;
  160. pvarsym = ^tvarsym;
  161. tvarsym = object(tsym)
  162. address : longint;
  163. localvarsym : pvarsym;
  164. localaddress : longint; { address of the local copy of a value para, -1 means not used }
  165. islocalcopy : boolean;
  166. definition : pdef;
  167. refs : longint;
  168. var_options : byte;
  169. _mangledname : pchar;
  170. reg : tregister; { if reg<>R_NO, then the variable is an register variable }
  171. varspez : tvarspez; { sets the type of access }
  172. is_valid : byte;
  173. constructor init(const n : string;p : pdef);
  174. constructor init_dll(const n : string;p : pdef);
  175. constructor init_C(const n,mangled : string;p : pdef);
  176. constructor load;
  177. destructor done;virtual;
  178. procedure write;virtual;
  179. procedure deref;virtual;
  180. procedure setmangledname(const s : string);
  181. function mangledname : string;virtual;
  182. procedure insert_in_data;virtual;
  183. function getsize : longint;
  184. function getpushsize : longint;
  185. {$ifdef GDB}
  186. function stabstring : pchar;virtual;
  187. procedure concatstabto(asmlist : paasmoutput);virtual;
  188. {$endif GDB}
  189. end;
  190. ppropertysym = ^tpropertysym;
  191. tpropertysym = object(tsym)
  192. options : longint;
  193. proptype : pdef;
  194. { proppara : pdefcoll; }
  195. readaccesssym,writeaccesssym,storedsym : psym;
  196. readaccessdef,writeaccessdef,storeddef : pdef;
  197. index,default : longint;
  198. constructor init(const n : string);
  199. destructor done;virtual;
  200. constructor load;
  201. function getsize : longint;virtual;
  202. procedure write;virtual;
  203. procedure deref;virtual;
  204. {$ifdef GDB}
  205. { I don't know how (FK) }
  206. function stabstring : pchar;virtual;
  207. procedure concatstabto(asmlist : paasmoutput);virtual;
  208. {$endif GDB}
  209. end;
  210. pfuncretsym = ^tfuncretsym;
  211. tfuncretsym = object(tsym)
  212. funcretprocinfo : pointer{ should be pprocinfo};
  213. funcretdef : pdef;
  214. address : longint;
  215. constructor init(const n : string;approcinfo : pointer{pprocinfo});
  216. {$ifdef GDB}
  217. procedure concatstabto(asmlist : paasmoutput);virtual;
  218. {$endif GDB}
  219. end;
  220. absolutetyp = (tovar,toasm,toaddr);
  221. pabsolutesym = ^tabsolutesym;
  222. tabsolutesym = object(tvarsym)
  223. abstyp : absolutetyp;
  224. absseg : boolean;
  225. ref : psym;
  226. asmname : pstring;
  227. constructor init(const n : string;p : pdef);
  228. constructor load;
  229. procedure deref;virtual;
  230. function mangledname : string;virtual;
  231. procedure write;virtual;
  232. procedure insert_in_data;virtual;
  233. { this creates a problem in gen_vmt !!!!!
  234. because the pdef is not resolved yet !!
  235. we should fix this
  236. constructor init(const s : string;p : pdef;newref : psym);}
  237. {$ifdef GDB}
  238. procedure concatstabto(asmlist : paasmoutput);virtual;
  239. {$endif GDB}
  240. end;
  241. ptypedconstsym = ^ttypedconstsym;
  242. ttypedconstsym = object(tsym)
  243. prefix : pstring;
  244. definition : pdef;
  245. constructor init(const n : string;p : pdef);
  246. constructor load;
  247. destructor done;virtual;
  248. function mangledname : string;virtual;
  249. procedure write;virtual;
  250. procedure deref;virtual;
  251. function getsize:longint;
  252. procedure insert_in_data;virtual;
  253. procedure really_insert_in_data;
  254. {$ifdef GDB}
  255. function stabstring : pchar;virtual;
  256. {$endif GDB}
  257. end;
  258. tconsttype = (constord,conststring,constreal,constbool,
  259. constint,constchar,constset,constnil);
  260. pconstsym = ^tconstsym;
  261. tconstsym = object(tsym)
  262. definition : pdef;
  263. consttype : tconsttype;
  264. value : longint;
  265. constructor init(const n : string;t : tconsttype;v : longint;def : pdef);
  266. constructor load;
  267. function mangledname : string;virtual;
  268. destructor done;virtual;
  269. procedure deref;virtual;
  270. procedure write;virtual;
  271. {$ifdef GDB}
  272. function stabstring : pchar;virtual;
  273. procedure concatstabto(asmlist : paasmoutput);virtual;
  274. {$endif GDB}
  275. end;
  276. tenumsym = object(tsym)
  277. value : longint;
  278. definition : penumdef;
  279. next : penumsym;
  280. constructor init(const n : string;def : penumdef;v : longint);
  281. constructor load;
  282. procedure write;virtual;
  283. procedure deref;virtual;
  284. procedure order;
  285. {$ifdef GDB}
  286. procedure concatstabto(asmlist : paasmoutput);virtual;
  287. {$endif GDB}
  288. end;
  289. pprogramsym = ^tprogramsym;
  290. tprogramsym = object(tsym)
  291. constructor init(const n : string);
  292. end;
  293. psyssym = ^tsyssym;
  294. tsyssym = object(tsym)
  295. number : longint;
  296. constructor init(const n : string;l : longint);
  297. procedure write;virtual;
  298. {$ifdef GDB}
  299. procedure concatstabto(asmlist : paasmoutput);virtual;
  300. {$endif GDB}
  301. end;
  302. {
  303. $Log$
  304. Revision 1.14 1999-01-20 10:20:22 peter
  305. * don't make localvar copies for assembler procedures
  306. Revision 1.13 1999/01/14 21:49:59 peter
  307. * fixed forwardpointer problem with multiple forwards for the same
  308. typesym. It now uses a linkedlist instead of a single pointer
  309. Revision 1.12 1999/01/12 14:25:37 peter
  310. + BrowserLog for browser.log generation
  311. + BrowserCol for browser info in TCollections
  312. * released all other UseBrowser
  313. Revision 1.11 1998/12/30 22:15:55 peter
  314. + farpointer type
  315. * absolutesym now also stores if its far
  316. Revision 1.10 1998/12/30 13:41:15 peter
  317. * released valuepara
  318. Revision 1.9 1998/11/28 16:20:57 peter
  319. + support for dll variables
  320. Revision 1.8 1998/11/18 15:44:19 peter
  321. * VALUEPARA for tp7 compatible value parameters
  322. Revision 1.7 1998/11/16 10:13:50 peter
  323. * label defines are checked at the end of the proc
  324. Revision 1.6 1998/11/13 10:18:12 peter
  325. + nil constants
  326. Revision 1.5 1998/11/05 23:39:32 peter
  327. + typedconst.getsize
  328. Revision 1.4 1998/10/20 08:07:02 pierre
  329. * several memory corruptions due to double freemem solved
  330. => never use p^.loc.location:=p^.left^.loc.location;
  331. + finally I added now by default
  332. that ra386dir translates global and unit symbols
  333. + added a first field in tsymtable and
  334. a nextsym field in tsym
  335. (this allows to obtain ordered type info for
  336. records and objects in gdb !)
  337. Revision 1.3 1998/10/08 17:17:34 pierre
  338. * current_module old scanner tagged as invalid if unit is recompiled
  339. + added ppheap for better info on tracegetmem of heaptrc
  340. (adds line column and file index)
  341. * several memory leaks removed ith help of heaptrc !!
  342. Revision 1.2 1998/09/24 15:11:18 peter
  343. * fixed enum for not GDB
  344. Revision 1.1 1998/09/23 12:03:57 peter
  345. * overloading fix for array of const
  346. }