symsymh.inc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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. speedvalue : longint;
  35. properties : symprop;
  36. owner : psymtable;
  37. indexnb : longint;
  38. fileinfo : tfileposinfo;
  39. {$ifdef GDB}
  40. isstabwritten : boolean;
  41. {$endif GDB}
  42. {$ifdef UseBrowser}
  43. lastref,
  44. defref,
  45. lastwritten : pref;
  46. refcount : longint;
  47. {$endif UseBrowser}
  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. {$ifdef UseBrowser}
  62. procedure load_references;virtual;
  63. function write_references : boolean;virtual;
  64. procedure add_to_browserlog;virtual;
  65. {$endif UseBrowser}
  66. end;
  67. plabelsym = ^tlabelsym;
  68. tlabelsym = object(tsym)
  69. number : plabel;
  70. defined : boolean;
  71. constructor init(const n : string; l : plabel);
  72. constructor load;
  73. destructor done;virtual;
  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. {$ifdef UseBrowser}
  125. procedure load_references;virtual;
  126. function write_references : boolean;virtual;
  127. procedure add_to_browserlog;virtual;
  128. {$endif UseBrowser}
  129. {$ifdef GDB}
  130. function stabstring : pchar;virtual;
  131. procedure concatstabto(asmlist : paasmoutput);virtual;
  132. {$endif GDB}
  133. end;
  134. ttypesym = object(tsym)
  135. definition : pdef;
  136. forwardpointer : ppointerdef;
  137. {$ifdef GDB}
  138. isusedinstab : boolean;
  139. {$endif GDB}
  140. constructor init(const n : string;d : pdef);
  141. constructor load;
  142. destructor done;virtual;
  143. procedure write;virtual;
  144. procedure deref;virtual;
  145. {$ifdef UseBrowser}
  146. procedure load_references;virtual;
  147. function write_references : boolean;virtual;
  148. procedure add_to_browserlog;virtual;
  149. {$endif UseBrowser}
  150. {$ifdef GDB}
  151. function stabstring : pchar;virtual;
  152. procedure concatstabto(asmlist : paasmoutput);virtual;
  153. {$endif GDB}
  154. end;
  155. pvarsym = ^tvarsym;
  156. tvarsym = object(tsym)
  157. address : longint;
  158. definition : pdef;
  159. refs : longint;
  160. var_options : byte;
  161. _mangledname : pchar;
  162. reg : tregister; { if reg<>R_NO, then the variable is an register variable }
  163. varspez : tvarspez; { sets the type of access }
  164. is_valid : byte;
  165. constructor init(const n : string;p : pdef);
  166. constructor load;
  167. constructor init_C(const n,mangled : string;p : pdef);
  168. constructor load_C;
  169. destructor done;virtual;
  170. function mangledname : string;virtual;
  171. procedure insert_in_data;virtual;
  172. function getsize : longint;
  173. procedure write;virtual;
  174. procedure deref;virtual;
  175. {$ifdef GDB}
  176. function stabstring : pchar;virtual;
  177. procedure concatstabto(asmlist : paasmoutput);virtual;
  178. {$endif GDB}
  179. end;
  180. ppropertysym = ^tpropertysym;
  181. tpropertysym = object(tsym)
  182. options : longint;
  183. proptype : pdef;
  184. { proppara : pdefcoll; }
  185. readaccesssym,writeaccesssym,storedsym : psym;
  186. readaccessdef,writeaccessdef,storeddef : pdef;
  187. index,default : longint;
  188. constructor init(const n : string);
  189. destructor done;virtual;
  190. constructor load;
  191. function getsize : longint;virtual;
  192. procedure write;virtual;
  193. procedure deref;virtual;
  194. {$ifdef GDB}
  195. { I don't know how (FK) }
  196. function stabstring : pchar;virtual;
  197. procedure concatstabto(asmlist : paasmoutput);virtual;
  198. {$endif GDB}
  199. end;
  200. pfuncretsym = ^tfuncretsym;
  201. tfuncretsym = object(tsym)
  202. funcretprocinfo : pointer{ should be pprocinfo};
  203. funcretdef : pdef;
  204. address : longint;
  205. constructor init(const n : string;approcinfo : pointer{pprocinfo});
  206. {$ifdef GDB}
  207. procedure concatstabto(asmlist : paasmoutput);virtual;
  208. {$endif GDB}
  209. end;
  210. absolutetyp = (tovar,toasm,toaddr);
  211. pabsolutesym = ^tabsolutesym;
  212. tabsolutesym = object(tvarsym)
  213. abstyp : absolutetyp;
  214. absseg : boolean;
  215. ref : psym;
  216. asmname : pstring;
  217. constructor load;
  218. procedure deref;virtual;
  219. function mangledname : string;virtual;
  220. procedure write;virtual;
  221. procedure insert_in_data;virtual;
  222. { this creates a problem in gen_vmt !!!!!
  223. because the pdef is not resolved yet !!
  224. we should fix this
  225. constructor init(const s : string;p : pdef;newref : psym);}
  226. {$ifdef GDB}
  227. procedure concatstabto(asmlist : paasmoutput);virtual;
  228. {$endif GDB}
  229. end;
  230. ptypedconstsym = ^ttypedconstsym;
  231. ttypedconstsym = object(tsym)
  232. prefix : pstring;
  233. definition : pdef;
  234. constructor init(const n : string;p : pdef);
  235. constructor load;
  236. destructor done;virtual;
  237. function mangledname : string;virtual;
  238. procedure write;virtual;
  239. procedure deref;virtual;
  240. procedure insert_in_data;virtual;
  241. procedure really_insert_in_data;
  242. {$ifdef GDB}
  243. function stabstring : pchar;virtual;
  244. {$endif GDB}
  245. end;
  246. tconsttype = (constord,conststring,constreal,constbool,
  247. constint,constchar,constset);
  248. pconstsym = ^tconstsym;
  249. tconstsym = object(tsym)
  250. definition : pdef;
  251. consttype : tconsttype;
  252. value : longint;
  253. constructor init(const n : string;t : tconsttype;v : longint;def : pdef);
  254. constructor load;
  255. function mangledname : string;virtual;
  256. destructor done;virtual;
  257. procedure deref;virtual;
  258. procedure write;virtual;
  259. {$ifdef GDB}
  260. function stabstring : pchar;virtual;
  261. procedure concatstabto(asmlist : paasmoutput);virtual;
  262. {$endif GDB}
  263. end;
  264. tenumsym = object(tsym)
  265. value : longint;
  266. definition : penumdef;
  267. next : penumsym;
  268. constructor init(const n : string;def : penumdef;v : longint);
  269. constructor load;
  270. procedure write;virtual;
  271. procedure deref;virtual;
  272. procedure order;
  273. {$ifdef GDB}
  274. procedure concatstabto(asmlist : paasmoutput);virtual;
  275. {$endif GDB}
  276. end;
  277. pprogramsym = ^tprogramsym;
  278. tprogramsym = object(tsym)
  279. constructor init(const n : string);
  280. end;
  281. psyssym = ^tsyssym;
  282. tsyssym = object(tsym)
  283. number : longint;
  284. constructor init(const n : string;l : longint);
  285. procedure write;virtual;
  286. {$ifdef GDB}
  287. procedure concatstabto(asmlist : paasmoutput);virtual;
  288. {$endif GDB}
  289. end;
  290. {
  291. $Log$
  292. Revision 1.3 1998-10-08 17:17:34 pierre
  293. * current_module old scanner tagged as invalid if unit is recompiled
  294. + added ppheap for better info on tracegetmem of heaptrc
  295. (adds line column and file index)
  296. * several memory leaks removed ith help of heaptrc !!
  297. Revision 1.2 1998/09/24 15:11:18 peter
  298. * fixed enum for not GDB
  299. Revision 1.1 1998/09/23 12:03:57 peter
  300. * overloading fix for array of const
  301. }