symsymh.inc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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. { this object is the base for all symbol objects }
  22. tsym = object(tsymtableentry)
  23. typ : tsymtyp;
  24. symoptions : tsymoptions;
  25. fileinfo : tfileposinfo;
  26. {$ifdef GDB}
  27. isstabwritten : boolean;
  28. {$endif GDB}
  29. refs : longint;
  30. lastref,
  31. defref,
  32. lastwritten : pref;
  33. refcount : longint;
  34. constructor init(const n : string);
  35. constructor load;
  36. destructor done;virtual;
  37. procedure write;virtual;
  38. procedure prederef;virtual; { needed for ttypesym to be deref'd first }
  39. procedure deref;virtual;
  40. function mangledname : string;virtual;
  41. procedure insert_in_data;virtual;
  42. {$ifdef GDB}
  43. function stabstring : pchar;virtual;
  44. procedure concatstabto(asmlist : paasmoutput);virtual;
  45. {$endif GDB}
  46. procedure load_references;virtual;
  47. function write_references : boolean;virtual;
  48. {$ifdef BrowserLog}
  49. procedure add_to_browserlog;virtual;
  50. {$endif BrowserLog}
  51. end;
  52. plabelsym = ^tlabelsym;
  53. tlabelsym = object(tsym)
  54. lab : pasmlabel;
  55. used,
  56. defined : boolean;
  57. code : pointer; { should be ptree! }
  58. constructor init(const n : string; l : pasmlabel);
  59. destructor done;virtual;
  60. constructor load;
  61. function mangledname : string;virtual;
  62. procedure write;virtual;
  63. end;
  64. punitsym = ^tunitsym;
  65. tunitsym = object(tsym)
  66. unitsymtable : punitsymtable;
  67. prevsym : punitsym;
  68. constructor init(const n : string;ref : punitsymtable);
  69. constructor load;
  70. destructor done;virtual;
  71. procedure write;virtual;
  72. procedure restoreunitsym;
  73. {$ifdef GDB}
  74. procedure concatstabto(asmlist : paasmoutput);virtual;
  75. {$endif GDB}
  76. end;
  77. pmacrosym = ^tmacrosym;
  78. tmacrosym = object(tsym)
  79. defined,
  80. defined_at_startup,
  81. is_used : boolean;
  82. buftext : pchar;
  83. buflen : longint;
  84. { macros aren't written to PPU files ! }
  85. constructor init(const n : string);
  86. destructor done;virtual;
  87. end;
  88. perrorsym = ^terrorsym;
  89. terrorsym = object(tsym)
  90. constructor init;
  91. end;
  92. tprocsym = object(tsym)
  93. definition : pprocdef;
  94. {$ifdef CHAINPROCSYMS}
  95. nextprocsym : pprocsym;
  96. {$endif CHAINPROCSYMS}
  97. is_global : boolean;
  98. constructor init(const n : string);
  99. constructor load;
  100. destructor done;virtual;
  101. function mangledname : string;virtual;
  102. function demangledname:string;
  103. { writes all declarations }
  104. procedure write_parameter_lists;
  105. { tests, if all procedures definitions are defined and not }
  106. { only forward }
  107. procedure check_forward;
  108. procedure order_overloaded;
  109. procedure write;virtual;
  110. procedure deref;virtual;
  111. procedure load_references;virtual;
  112. function write_references : boolean;virtual;
  113. {$ifdef BrowserLog}
  114. procedure add_to_browserlog;virtual;
  115. {$endif BrowserLog}
  116. {$ifdef GDB}
  117. function stabstring : pchar;virtual;
  118. procedure concatstabto(asmlist : paasmoutput);virtual;
  119. {$endif GDB}
  120. end;
  121. ttypesym = object(tsym)
  122. restype : ttype;
  123. {$ifdef SYNONYM}
  124. synonym : ptypesym;
  125. {$endif}
  126. {$ifdef GDB}
  127. isusedinstab : boolean;
  128. {$endif GDB}
  129. constructor init(const n : string;const tt : ttype);
  130. constructor initdef(const n : string;d : pdef);
  131. constructor load;
  132. {$ifdef SYNONYM}
  133. destructor done;virtual;
  134. {$endif}
  135. procedure write;virtual;
  136. procedure prederef;virtual;
  137. procedure load_references;virtual;
  138. function write_references : boolean;virtual;
  139. {$ifdef BrowserLog}
  140. procedure add_to_browserlog;virtual;
  141. {$endif BrowserLog}
  142. {$ifdef GDB}
  143. function stabstring : pchar;virtual;
  144. procedure concatstabto(asmlist : paasmoutput);virtual;
  145. {$endif GDB}
  146. end;
  147. pvarsym = ^tvarsym;
  148. tvarsym = object(tsym)
  149. address : longint;
  150. localvarsym : pvarsym;
  151. vartype : ttype;
  152. varoptions : tvaroptions;
  153. reg : tregister; { if reg<>R_NO, then the variable is an register variable }
  154. varspez : tvarspez; { sets the type of access }
  155. varstate : tvarstate;
  156. constructor init(const n : string;const tt : ttype);
  157. constructor init_dll(const n : string;const tt : ttype);
  158. constructor init_C(const n,mangled : string;const tt : ttype);
  159. constructor initdef(const n : string;p : pdef);
  160. constructor load;
  161. destructor done;virtual;
  162. procedure write;virtual;
  163. procedure deref;virtual;
  164. procedure setmangledname(const s : string);
  165. function mangledname : string;virtual;
  166. procedure insert_in_data;virtual;
  167. function getsize : longint;
  168. function getpushsize : longint;
  169. {$ifdef GDB}
  170. function stabstring : pchar;virtual;
  171. procedure concatstabto(asmlist : paasmoutput);virtual;
  172. {$endif GDB}
  173. private
  174. _mangledname : pchar;
  175. end;
  176. ppropertysym = ^tpropertysym;
  177. tpropertysym = object(tsym)
  178. propoptions : tpropertyoptions;
  179. proptype : ttype;
  180. propoverriden : ppropertysym;
  181. indextype : ttype;
  182. index,
  183. default : longint;
  184. readaccess,
  185. writeaccess,
  186. storedaccess : psymlist;
  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. procedure dooverride(overriden:ppropertysym);
  194. {$ifdef GDB}
  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. rettype : ttype;
  203. address : longint;
  204. constructor init(const n : string;approcinfo : pointer{pprocinfo});
  205. constructor load;
  206. destructor done;virtual;
  207. procedure write;virtual;
  208. procedure deref;virtual;
  209. procedure insert_in_data;virtual;
  210. {$ifdef GDB}
  211. procedure concatstabto(asmlist : paasmoutput);virtual;
  212. {$endif GDB}
  213. end;
  214. pabsolutesym = ^tabsolutesym;
  215. tabsolutesym = object(tvarsym)
  216. abstyp : absolutetyp;
  217. absseg : boolean;
  218. ref : psym;
  219. asmname : pstring;
  220. constructor init(const n : string;const tt : ttype);
  221. constructor initdef(const n : string;p : pdef);
  222. constructor load;
  223. procedure deref;virtual;
  224. function mangledname : string;virtual;
  225. procedure write;virtual;
  226. procedure insert_in_data;virtual;
  227. {$ifdef GDB}
  228. procedure concatstabto(asmlist : paasmoutput);virtual;
  229. {$endif GDB}
  230. end;
  231. ptypedconstsym = ^ttypedconstsym;
  232. ttypedconstsym = object(tsym)
  233. prefix : pstring;
  234. typedconsttype : ttype;
  235. is_really_const : boolean;
  236. constructor init(const n : string;p : pdef;really_const : boolean);
  237. constructor inittype(const n : string;const tt : ttype;really_const : boolean);
  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. {$ifdef GDB}
  246. function stabstring : pchar;virtual;
  247. {$endif GDB}
  248. end;
  249. pconstsym = ^tconstsym;
  250. tconstsym = object(tsym)
  251. consttype : ttype;
  252. consttyp : tconsttyp;
  253. resstrindex, { needed for resource strings }
  254. value,
  255. len : longint; { len is needed for string length }
  256. constructor init(const n : string;t : tconsttyp;v : longint);
  257. constructor init_def(const n : string;t : tconsttyp;v : longint;def : pdef);
  258. constructor init_string(const n : string;t : tconsttyp;str:pchar;l:longint);
  259. constructor load;
  260. destructor done;virtual;
  261. function mangledname : string;virtual;
  262. procedure deref;virtual;
  263. procedure write;virtual;
  264. {$ifdef GDB}
  265. function stabstring : pchar;virtual;
  266. procedure concatstabto(asmlist : paasmoutput);virtual;
  267. {$endif GDB}
  268. end;
  269. tenumsym = object(tsym)
  270. value : longint;
  271. definition : penumdef;
  272. nextenum : penumsym;
  273. constructor init(const n : string;def : penumdef;v : longint);
  274. constructor load;
  275. procedure write;virtual;
  276. procedure deref;virtual;
  277. procedure order;
  278. {$ifdef GDB}
  279. procedure concatstabto(asmlist : paasmoutput);virtual;
  280. {$endif GDB}
  281. end;
  282. pprogramsym = ^tprogramsym;
  283. tprogramsym = object(tsym)
  284. constructor init(const n : string);
  285. end;
  286. psyssym = ^tsyssym;
  287. tsyssym = object(tsym)
  288. number : longint;
  289. constructor init(const n : string;l : longint);
  290. constructor load;
  291. destructor done;virtual;
  292. procedure write;virtual;
  293. {$ifdef GDB}
  294. procedure concatstabto(asmlist : paasmoutput);virtual;
  295. {$endif GDB}
  296. end;
  297. {
  298. $Log$
  299. Revision 1.49 2000-05-03 14:34:05 pierre
  300. * fix the unitsym chain
  301. Revision 1.48 2000/04/27 10:06:04 pierre
  302. * fix for snapshot failue
  303. * order_overloaded reintrocduced and adapted to operators
  304. Revision 1.47 2000/04/26 08:54:19 pierre
  305. * More changes for operator bug
  306. Order_overloaded method removed because it conflicted with
  307. new implementation where the defs are ordered
  308. according to the unit loading order !
  309. Revision 1.46 2000/02/09 13:23:05 peter
  310. * log truncated
  311. Revision 1.45 2000/01/07 01:14:41 peter
  312. * updated copyright to 2000
  313. Revision 1.44 2000/01/03 19:26:04 peter
  314. * fixed resolving of ttypesym which are reference from object/record
  315. fields.
  316. Revision 1.43 1999/12/14 09:58:42 florian
  317. + compiler checks now if a goto leaves an exception block
  318. Revision 1.42 1999/11/30 10:40:56 peter
  319. + ttype, tsymlist
  320. Revision 1.41 1999/11/26 00:19:12 peter
  321. * property overriding dereference fix, but it need a bigger redesign
  322. which i'll do tomorrow. This quick hack is for the lazarus ppl so
  323. they can hack on mwcustomedit.
  324. Revision 1.40 1999/11/17 17:05:06 pierre
  325. * Notes/hints changes
  326. Revision 1.39 1999/11/15 22:00:48 peter
  327. * labels used but not defined give error instead of warning, the warning
  328. is now only with declared but not defined and not used.
  329. Revision 1.38 1999/11/08 14:02:17 florian
  330. * problem with "index X"-properties solved
  331. * typed constants of class references are now allowed
  332. Revision 1.37 1999/11/06 14:34:28 peter
  333. * truncated log to 20 revs
  334. Revision 1.36 1999/10/01 08:02:48 peter
  335. * forward type declaration rewritten
  336. Revision 1.35 1999/09/26 21:30:22 peter
  337. + constant pointer support which can happend with typecasting like
  338. const p=pointer(1)
  339. * better procvar parsing in typed consts
  340. Revision 1.34 1999/08/31 15:42:26 pierre
  341. + tmacrosym is_used and defined_at_startup boolean fields added
  342. Revision 1.33 1999/08/23 11:45:45 michael
  343. * Hopefully final attempt at resourcestrings
  344. Revision 1.32 1999/08/14 00:39:01 peter
  345. * hack to support property with record fields
  346. Revision 1.31 1999/08/10 12:33:38 pierre
  347. * pprocsym defined earlier for use in tprocdef
  348. Revision 1.30 1999/08/03 22:03:21 peter
  349. * moved bitmask constants to sets
  350. * some other type/const renamings
  351. Revision 1.29 1999/07/27 23:42:23 peter
  352. * indirect type referencing is now allowed
  353. Revision 1.28 1999/07/24 15:13:01 michael
  354. changes for resourcestrings
  355. Revision 1.27 1999/07/22 09:37:57 florian
  356. + resourcestring implemented
  357. + start of longstring support
  358. }