symsymh.inc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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. constructor load;
  76. destructor done;virtual;
  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. definition : pdef;
  162. refs : longint;
  163. var_options : byte;
  164. _mangledname : pchar;
  165. reg : tregister; { if reg<>R_NO, then the variable is an register variable }
  166. varspez : tvarspez; { sets the type of access }
  167. is_valid : byte;
  168. constructor init(const n : string;p : pdef);
  169. constructor load;
  170. constructor init_C(const n,mangled : string;p : pdef);
  171. constructor load_C;
  172. destructor done;virtual;
  173. function mangledname : string;virtual;
  174. procedure insert_in_data;virtual;
  175. function getsize : longint;
  176. procedure write;virtual;
  177. procedure deref;virtual;
  178. {$ifdef GDB}
  179. function stabstring : pchar;virtual;
  180. procedure concatstabto(asmlist : paasmoutput);virtual;
  181. {$endif GDB}
  182. end;
  183. ppropertysym = ^tpropertysym;
  184. tpropertysym = object(tsym)
  185. options : longint;
  186. proptype : pdef;
  187. { proppara : pdefcoll; }
  188. readaccesssym,writeaccesssym,storedsym : psym;
  189. readaccessdef,writeaccessdef,storeddef : pdef;
  190. index,default : longint;
  191. constructor init(const n : string);
  192. destructor done;virtual;
  193. constructor load;
  194. function getsize : longint;virtual;
  195. procedure write;virtual;
  196. procedure deref;virtual;
  197. {$ifdef GDB}
  198. { I don't know how (FK) }
  199. function stabstring : pchar;virtual;
  200. procedure concatstabto(asmlist : paasmoutput);virtual;
  201. {$endif GDB}
  202. end;
  203. pfuncretsym = ^tfuncretsym;
  204. tfuncretsym = object(tsym)
  205. funcretprocinfo : pointer{ should be pprocinfo};
  206. funcretdef : pdef;
  207. address : longint;
  208. constructor init(const n : string;approcinfo : pointer{pprocinfo});
  209. {$ifdef GDB}
  210. procedure concatstabto(asmlist : paasmoutput);virtual;
  211. {$endif GDB}
  212. end;
  213. absolutetyp = (tovar,toasm,toaddr);
  214. pabsolutesym = ^tabsolutesym;
  215. tabsolutesym = object(tvarsym)
  216. abstyp : absolutetyp;
  217. absseg : boolean;
  218. ref : psym;
  219. asmname : pstring;
  220. constructor load;
  221. procedure deref;virtual;
  222. function mangledname : string;virtual;
  223. procedure write;virtual;
  224. procedure insert_in_data;virtual;
  225. { this creates a problem in gen_vmt !!!!!
  226. because the pdef is not resolved yet !!
  227. we should fix this
  228. constructor init(const s : string;p : pdef;newref : psym);}
  229. {$ifdef GDB}
  230. procedure concatstabto(asmlist : paasmoutput);virtual;
  231. {$endif GDB}
  232. end;
  233. ptypedconstsym = ^ttypedconstsym;
  234. ttypedconstsym = object(tsym)
  235. prefix : pstring;
  236. definition : pdef;
  237. constructor init(const n : string;p : pdef);
  238. constructor load;
  239. destructor done;virtual;
  240. function mangledname : string;virtual;
  241. procedure write;virtual;
  242. procedure deref;virtual;
  243. function getsize:longint;
  244. procedure insert_in_data;virtual;
  245. procedure really_insert_in_data;
  246. {$ifdef GDB}
  247. function stabstring : pchar;virtual;
  248. {$endif GDB}
  249. end;
  250. tconsttype = (constord,conststring,constreal,constbool,
  251. constint,constchar,constset,constnil);
  252. pconstsym = ^tconstsym;
  253. tconstsym = object(tsym)
  254. definition : pdef;
  255. consttype : tconsttype;
  256. value : longint;
  257. constructor init(const n : string;t : tconsttype;v : longint;def : pdef);
  258. constructor load;
  259. function mangledname : string;virtual;
  260. destructor done;virtual;
  261. procedure deref;virtual;
  262. procedure write;virtual;
  263. {$ifdef GDB}
  264. function stabstring : pchar;virtual;
  265. procedure concatstabto(asmlist : paasmoutput);virtual;
  266. {$endif GDB}
  267. end;
  268. tenumsym = object(tsym)
  269. value : longint;
  270. definition : penumdef;
  271. next : penumsym;
  272. constructor init(const n : string;def : penumdef;v : longint);
  273. constructor load;
  274. procedure write;virtual;
  275. procedure deref;virtual;
  276. procedure order;
  277. {$ifdef GDB}
  278. procedure concatstabto(asmlist : paasmoutput);virtual;
  279. {$endif GDB}
  280. end;
  281. pprogramsym = ^tprogramsym;
  282. tprogramsym = object(tsym)
  283. constructor init(const n : string);
  284. end;
  285. psyssym = ^tsyssym;
  286. tsyssym = object(tsym)
  287. number : longint;
  288. constructor init(const n : string;l : longint);
  289. procedure write;virtual;
  290. {$ifdef GDB}
  291. procedure concatstabto(asmlist : paasmoutput);virtual;
  292. {$endif GDB}
  293. end;
  294. {
  295. $Log$
  296. Revision 1.6 1998-11-13 10:18:12 peter
  297. + nil constants
  298. Revision 1.5 1998/11/05 23:39:32 peter
  299. + typedconst.getsize
  300. Revision 1.4 1998/10/20 08:07:02 pierre
  301. * several memory corruptions due to double freemem solved
  302. => never use p^.loc.location:=p^.left^.loc.location;
  303. + finally I added now by default
  304. that ra386dir translates global and unit symbols
  305. + added a first field in tsymtable and
  306. a nextsym field in tsym
  307. (this allows to obtain ordered type info for
  308. records and objects in gdb !)
  309. Revision 1.3 1998/10/08 17:17:34 pierre
  310. * current_module old scanner tagged as invalid if unit is recompiled
  311. + added ppheap for better info on tracegetmem of heaptrc
  312. (adds line column and file index)
  313. * several memory leaks removed ith help of heaptrc !!
  314. Revision 1.2 1998/09/24 15:11:18 peter
  315. * fixed enum for not GDB
  316. Revision 1.1 1998/09/23 12:03:57 peter
  317. * overloading fix for array of const
  318. }