symsymh.inc 13 KB

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