symsymh.inc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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. { varsym_C,typedconstsym_C); }
  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. speedvalue : longint;
  34. properties : symprop;
  35. owner : psymtable;
  36. indexnb : longint;
  37. fileinfo : tfileposinfo;
  38. {$ifdef GDB}
  39. isstabwritten : boolean;
  40. {$endif GDB}
  41. {$ifdef UseBrowser}
  42. lastref,
  43. defref,
  44. lastwritten : pref;
  45. refcount : longint;
  46. {$endif UseBrowser}
  47. constructor init(const n : string);
  48. constructor load;
  49. destructor done;virtual;
  50. procedure write;virtual;
  51. procedure deref;virtual;
  52. function name : string;
  53. function mangledname : string;virtual;
  54. procedure setname(const s : string);
  55. procedure insert_in_data;virtual;
  56. {$ifdef GDB}
  57. function stabstring : pchar;virtual;
  58. procedure concatstabto(asmlist : paasmoutput);virtual;
  59. {$endif GDB}
  60. {$ifdef UseBrowser}
  61. procedure load_references;virtual;
  62. function write_references : boolean;virtual;
  63. procedure add_to_browserlog;virtual;
  64. {$endif UseBrowser}
  65. end;
  66. plabelsym = ^tlabelsym;
  67. tlabelsym = object(tsym)
  68. number : plabel;
  69. defined : boolean;
  70. constructor init(const n : string; l : plabel);
  71. constructor load;
  72. destructor done;virtual;
  73. function mangledname : string;virtual;
  74. procedure write;virtual;
  75. end;
  76. punitsym = ^tunitsym;
  77. tunitsym = object(tsym)
  78. unitsymtable : punitsymtable;
  79. prevsym : punitsym;
  80. refs : longint;
  81. constructor init(const n : string;ref : punitsymtable);
  82. constructor load;
  83. destructor done;virtual;
  84. procedure write;virtual;
  85. {$ifdef GDB}
  86. procedure concatstabto(asmlist : paasmoutput);virtual;
  87. {$endif GDB}
  88. end;
  89. pmacrosym = ^tmacrosym;
  90. tmacrosym = object(tsym)
  91. defined : boolean;
  92. buftext : pchar;
  93. buflen : longint;
  94. { macros aren't written to PPU files ! }
  95. constructor init(const n : string);
  96. destructor done;virtual;
  97. end;
  98. perrorsym = ^terrorsym;
  99. terrorsym = object(tsym)
  100. constructor init;
  101. end;
  102. pprocsym = ^tprocsym;
  103. tprocsym = object(tsym)
  104. definition : pprocdef;
  105. {$ifdef CHAINPROCSYMS}
  106. nextprocsym : pprocsym;
  107. {$endif CHAINPROCSYMS}
  108. {$ifdef GDB}
  109. is_global : boolean;{necessary for stab}
  110. {$endif GDB}
  111. constructor init(const n : string);
  112. constructor load;
  113. destructor done;virtual;
  114. function mangledname : string;virtual;
  115. function demangledname:string;
  116. { writes all declarations }
  117. procedure write_parameter_lists;
  118. { tests, if all procedures definitions are defined and not }
  119. { only forward }
  120. procedure check_forward;
  121. procedure write;virtual;
  122. procedure deref;virtual;
  123. {$ifdef UseBrowser}
  124. procedure load_references;virtual;
  125. function write_references : boolean;virtual;
  126. procedure add_to_browserlog;virtual;
  127. {$endif UseBrowser}
  128. {$ifdef GDB}
  129. function stabstring : pchar;virtual;
  130. procedure concatstabto(asmlist : paasmoutput);virtual;
  131. {$endif GDB}
  132. end;
  133. ttypesym = object(tsym)
  134. definition : pdef;
  135. forwardpointer : ppointerdef;
  136. {$ifdef GDB}
  137. isusedinstab : boolean;
  138. {$endif GDB}
  139. constructor init(const n : string;d : pdef);
  140. constructor load;
  141. destructor done;virtual;
  142. procedure write;virtual;
  143. procedure deref;virtual;
  144. {$ifdef UseBrowser}
  145. procedure load_references;virtual;
  146. function write_references : boolean;virtual;
  147. procedure add_to_browserlog;virtual;
  148. {$endif UseBrowser}
  149. {$ifdef GDB}
  150. function stabstring : pchar;virtual;
  151. procedure concatstabto(asmlist : paasmoutput);virtual;
  152. {$endif GDB}
  153. end;
  154. pvarsym = ^tvarsym;
  155. tvarsym = object(tsym)
  156. address : longint;
  157. definition : pdef;
  158. refs : longint;
  159. var_options : byte;
  160. _mangledname : pchar;
  161. reg : tregister; { if reg<>R_NO, then the variable is an register variable }
  162. varspez : tvarspez; { sets the type of access }
  163. is_valid : byte;
  164. constructor init(const n : string;p : pdef);
  165. constructor load;
  166. constructor init_C(const n,mangled : string;p : pdef);
  167. constructor load_C;
  168. destructor done;virtual;
  169. function mangledname : string;virtual;
  170. procedure insert_in_data;virtual;
  171. function getsize : longint;
  172. procedure write;virtual;
  173. procedure deref;virtual;
  174. {$ifdef GDB}
  175. function stabstring : pchar;virtual;
  176. procedure concatstabto(asmlist : paasmoutput);virtual;
  177. {$endif GDB}
  178. end;
  179. ppropertysym = ^tpropertysym;
  180. tpropertysym = object(tsym)
  181. options : longint;
  182. proptype : pdef;
  183. { proppara : pdefcoll; }
  184. readaccesssym,writeaccesssym,storedsym : psym;
  185. readaccessdef,writeaccessdef,storeddef : pdef;
  186. index,default : longint;
  187. constructor init(const n : string);
  188. destructor done;virtual;
  189. constructor load;
  190. function getsize : longint;virtual;
  191. procedure write;virtual;
  192. procedure deref;virtual;
  193. {$ifdef GDB}
  194. { I don't know how (FK) }
  195. function stabstring : pchar;virtual;
  196. procedure concatstabto(asmlist : paasmoutput);virtual;
  197. {$endif GDB}
  198. end;
  199. pfuncretsym = ^tfuncretsym;
  200. tfuncretsym = object(tsym)
  201. funcretprocinfo : pointer{ should be pprocinfo};
  202. funcretdef : pdef;
  203. address : longint;
  204. constructor init(const n : string;approcinfo : pointer{pprocinfo});
  205. {$ifdef GDB}
  206. procedure concatstabto(asmlist : paasmoutput);virtual;
  207. {$endif GDB}
  208. end;
  209. absolutetyp = (tovar,toasm,toaddr);
  210. pabsolutesym = ^tabsolutesym;
  211. tabsolutesym = object(tvarsym)
  212. abstyp : absolutetyp;
  213. absseg : boolean;
  214. ref : psym;
  215. asmname : pstring;
  216. constructor load;
  217. procedure deref;virtual;
  218. function mangledname : string;virtual;
  219. procedure write;virtual;
  220. procedure insert_in_data;virtual;
  221. { this creates a problem in gen_vmt !!!!!
  222. because the pdef is not resolved yet !!
  223. we should fix this
  224. constructor init(const s : string;p : pdef;newref : psym);}
  225. {$ifdef GDB}
  226. procedure concatstabto(asmlist : paasmoutput);virtual;
  227. {$endif GDB}
  228. end;
  229. ptypedconstsym = ^ttypedconstsym;
  230. ttypedconstsym = object(tsym)
  231. prefix : pstring;
  232. definition : pdef;
  233. constructor init(const n : string;p : pdef);
  234. constructor load;
  235. destructor done;virtual;
  236. function mangledname : string;virtual;
  237. procedure write;virtual;
  238. procedure deref;virtual;
  239. procedure insert_in_data;virtual;
  240. procedure really_insert_in_data;
  241. {$ifdef GDB}
  242. function stabstring : pchar;virtual;
  243. {$endif GDB}
  244. end;
  245. tconsttype = (constord,conststring,constreal,constbool,
  246. constint,constchar,constset);
  247. pconstsym = ^tconstsym;
  248. tconstsym = object(tsym)
  249. definition : pdef;
  250. consttype : tconsttype;
  251. value : longint;
  252. constructor init(const n : string;t : tconsttype;v : longint;def : pdef);
  253. constructor load;
  254. function mangledname : string;virtual;
  255. destructor done;virtual;
  256. procedure deref;virtual;
  257. procedure write;virtual;
  258. {$ifdef GDB}
  259. function stabstring : pchar;virtual;
  260. procedure concatstabto(asmlist : paasmoutput);virtual;
  261. {$endif GDB}
  262. end;
  263. tenumsym = object(tsym)
  264. value : longint;
  265. definition : penumdef;
  266. next : penumsym;
  267. constructor init(const n : string;def : penumdef;v : longint);
  268. constructor load;
  269. procedure write;virtual;
  270. procedure deref;virtual;
  271. procedure order;
  272. {$ifdef GDB}
  273. procedure concatstabto(asmlist : paasmoutput);virtual;
  274. {$endif GDB}
  275. end;
  276. pprogramsym = ^tprogramsym;
  277. tprogramsym = object(tsym)
  278. constructor init(const n : string);
  279. end;
  280. psyssym = ^tsyssym;
  281. tsyssym = object(tsym)
  282. number : longint;
  283. constructor init(const n : string;l : longint);
  284. procedure write;virtual;
  285. {$ifdef GDB}
  286. procedure concatstabto(asmlist : paasmoutput);virtual;
  287. {$endif GDB}
  288. end;
  289. {
  290. $Log$
  291. Revision 1.2 1998-09-24 15:11:18 peter
  292. * fixed enum for not GDB
  293. Revision 1.1 1998/09/23 12:03:57 peter
  294. * overloading fix for array of const
  295. }