symsymh.inc 12 KB

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