symsymh.inc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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. islocalcopy : boolean;
  165. definition : pdef;
  166. refs : longint;
  167. var_options : byte;
  168. _mangledname : pchar;
  169. reg : tregister; { if reg<>R_NO, then the variable is an register variable }
  170. varspez : tvarspez; { sets the type of access }
  171. is_valid : byte;
  172. constructor init(const n : string;p : pdef);
  173. constructor init_dll(const n : string;p : pdef);
  174. constructor init_C(const n,mangled : string;p : pdef);
  175. constructor load;
  176. destructor done;virtual;
  177. procedure write;virtual;
  178. procedure deref;virtual;
  179. procedure setmangledname(const s : string);
  180. function mangledname : string;virtual;
  181. procedure insert_in_data;virtual;
  182. function getsize : longint;
  183. function getpushsize : longint;
  184. {$ifdef GDB}
  185. function stabstring : pchar;virtual;
  186. procedure concatstabto(asmlist : paasmoutput);virtual;
  187. {$endif GDB}
  188. end;
  189. ppropertysym = ^tpropertysym;
  190. tpropertysym = object(tsym)
  191. options : longint;
  192. proptype : pdef;
  193. { proppara : pdefcoll; }
  194. readaccesssym,writeaccesssym,storedsym : psym;
  195. readaccessdef,writeaccessdef,storeddef : pdef;
  196. index,default : longint;
  197. constructor init(const n : string);
  198. destructor done;virtual;
  199. constructor load;
  200. function getsize : longint;virtual;
  201. procedure write;virtual;
  202. procedure deref;virtual;
  203. {$ifdef GDB}
  204. { I don't know how (FK) }
  205. function stabstring : pchar;virtual;
  206. procedure concatstabto(asmlist : paasmoutput);virtual;
  207. {$endif GDB}
  208. end;
  209. pfuncretsym = ^tfuncretsym;
  210. tfuncretsym = object(tsym)
  211. funcretprocinfo : pointer{ should be pprocinfo};
  212. funcretdef : pdef;
  213. address : longint;
  214. constructor init(const n : string;approcinfo : pointer{pprocinfo});
  215. constructor load;
  216. procedure write;virtual;
  217. procedure deref;virtual;
  218. procedure insert_in_data;virtual;
  219. {$ifdef GDB}
  220. procedure concatstabto(asmlist : paasmoutput);virtual;
  221. {$endif GDB}
  222. end;
  223. absolutetyp = (tovar,toasm,toaddr);
  224. pabsolutesym = ^tabsolutesym;
  225. tabsolutesym = object(tvarsym)
  226. abstyp : absolutetyp;
  227. absseg : boolean;
  228. ref : psym;
  229. asmname : pstring;
  230. constructor init(const n : string;p : pdef);
  231. constructor load;
  232. procedure deref;virtual;
  233. function mangledname : string;virtual;
  234. procedure write;virtual;
  235. procedure insert_in_data;virtual;
  236. { this creates a problem in gen_vmt !!!!!
  237. because the pdef is not resolved yet !!
  238. we should fix this
  239. constructor init(const s : string;p : pdef;newref : psym);}
  240. {$ifdef GDB}
  241. procedure concatstabto(asmlist : paasmoutput);virtual;
  242. {$endif GDB}
  243. end;
  244. ptypedconstsym = ^ttypedconstsym;
  245. ttypedconstsym = object(tsym)
  246. prefix : pstring;
  247. definition : pdef;
  248. constructor init(const n : string;p : pdef);
  249. constructor load;
  250. destructor done;virtual;
  251. function mangledname : string;virtual;
  252. procedure write;virtual;
  253. procedure deref;virtual;
  254. function getsize:longint;
  255. procedure insert_in_data;virtual;
  256. procedure really_insert_in_data;
  257. {$ifdef GDB}
  258. function stabstring : pchar;virtual;
  259. {$endif GDB}
  260. end;
  261. tconsttype = (constord,conststring,constreal,constbool,
  262. constint,constchar,constset,constnil);
  263. pconstsym = ^tconstsym;
  264. tconstsym = object(tsym)
  265. definition : pdef;
  266. consttype : tconsttype;
  267. value,
  268. len : longint; { len is needed for string length }
  269. constructor init(const n : string;t : tconsttype;v : longint);
  270. constructor init_def(const n : string;t : tconsttype;v : longint;def : pdef);
  271. constructor init_string(const n : string;t : tconsttype;str:pchar;l:longint);
  272. constructor load;
  273. destructor done;virtual;
  274. function mangledname : string;virtual;
  275. procedure deref;virtual;
  276. procedure write;virtual;
  277. {$ifdef GDB}
  278. function stabstring : pchar;virtual;
  279. procedure concatstabto(asmlist : paasmoutput);virtual;
  280. {$endif GDB}
  281. end;
  282. tenumsym = object(tsym)
  283. value : longint;
  284. definition : penumdef;
  285. next : penumsym;
  286. constructor init(const n : string;def : penumdef;v : longint);
  287. constructor load;
  288. procedure write;virtual;
  289. procedure deref;virtual;
  290. procedure order;
  291. {$ifdef GDB}
  292. procedure concatstabto(asmlist : paasmoutput);virtual;
  293. {$endif GDB}
  294. end;
  295. pprogramsym = ^tprogramsym;
  296. tprogramsym = object(tsym)
  297. constructor init(const n : string);
  298. end;
  299. psyssym = ^tsyssym;
  300. tsyssym = object(tsym)
  301. number : longint;
  302. constructor init(const n : string;l : longint);
  303. procedure write;virtual;
  304. {$ifdef GDB}
  305. procedure concatstabto(asmlist : paasmoutput);virtual;
  306. {$endif GDB}
  307. end;
  308. {
  309. $Log$
  310. Revision 1.17 1999-03-31 13:55:23 peter
  311. * assembler inlining working for ag386bin
  312. Revision 1.16 1999/03/24 23:17:29 peter
  313. * fixed bugs 212,222,225,227,229,231,233
  314. Revision 1.15 1999/02/22 13:07:11 pierre
  315. + -b and -bl options work !
  316. + cs_local_browser ($L+) is disabled if cs_browser ($Y+)
  317. is not enabled when quitting global section
  318. * local vars and procedures are not yet stored into PPU
  319. Revision 1.14 1999/01/20 10:20:22 peter
  320. * don't make localvar copies for assembler procedures
  321. Revision 1.13 1999/01/14 21:49:59 peter
  322. * fixed forwardpointer problem with multiple forwards for the same
  323. typesym. It now uses a linkedlist instead of a single pointer
  324. Revision 1.12 1999/01/12 14:25:37 peter
  325. + BrowserLog for browser.log generation
  326. + BrowserCol for browser info in TCollections
  327. * released all other UseBrowser
  328. Revision 1.11 1998/12/30 22:15:55 peter
  329. + farpointer type
  330. * absolutesym now also stores if its far
  331. Revision 1.10 1998/12/30 13:41:15 peter
  332. * released valuepara
  333. Revision 1.9 1998/11/28 16:20:57 peter
  334. + support for dll variables
  335. Revision 1.8 1998/11/18 15:44:19 peter
  336. * VALUEPARA for tp7 compatible value parameters
  337. Revision 1.7 1998/11/16 10:13:50 peter
  338. * label defines are checked at the end of the proc
  339. Revision 1.6 1998/11/13 10:18:12 peter
  340. + nil constants
  341. Revision 1.5 1998/11/05 23:39:32 peter
  342. + typedconst.getsize
  343. Revision 1.4 1998/10/20 08:07:02 pierre
  344. * several memory corruptions due to double freemem solved
  345. => never use p^.loc.location:=p^.left^.loc.location;
  346. + finally I added now by default
  347. that ra386dir translates global and unit symbols
  348. + added a first field in tsymtable and
  349. a nextsym field in tsym
  350. (this allows to obtain ordered type info for
  351. records and objects in gdb !)
  352. Revision 1.3 1998/10/08 17:17:34 pierre
  353. * current_module old scanner tagged as invalid if unit is recompiled
  354. + added ppheap for better info on tracegetmem of heaptrc
  355. (adds line column and file index)
  356. * several memory leaks removed ith help of heaptrc !!
  357. Revision 1.2 1998/09/24 15:11:18 peter
  358. * fixed enum for not GDB
  359. Revision 1.1 1998/09/23 12:03:57 peter
  360. * overloading fix for array of const
  361. }