symsymh.inc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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. procedure order_overloaded;
  108. procedure write;virtual;
  109. procedure deref;virtual;
  110. procedure load_references;virtual;
  111. function write_references : boolean;virtual;
  112. {$ifdef BrowserLog}
  113. procedure add_to_browserlog;virtual;
  114. {$endif BrowserLog}
  115. {$ifdef GDB}
  116. function stabstring : pchar;virtual;
  117. procedure concatstabto(asmlist : paasmoutput);virtual;
  118. {$endif GDB}
  119. end;
  120. ttypesym = object(tsym)
  121. restype : ttype;
  122. {$ifdef SYNONYM}
  123. synonym : ptypesym;
  124. {$endif}
  125. {$ifdef GDB}
  126. isusedinstab : boolean;
  127. {$endif GDB}
  128. constructor init(const n : string;const tt : ttype);
  129. constructor initdef(const n : string;d : pdef);
  130. constructor load;
  131. {$ifdef SYNONYM}
  132. destructor done;virtual;
  133. {$endif}
  134. procedure write;virtual;
  135. procedure prederef;virtual;
  136. procedure load_references;virtual;
  137. function write_references : boolean;virtual;
  138. {$ifdef BrowserLog}
  139. procedure add_to_browserlog;virtual;
  140. {$endif BrowserLog}
  141. {$ifdef GDB}
  142. function stabstring : pchar;virtual;
  143. procedure concatstabto(asmlist : paasmoutput);virtual;
  144. {$endif GDB}
  145. end;
  146. pvarsym = ^tvarsym;
  147. tvarsym = object(tsym)
  148. address : longint;
  149. localvarsym : pvarsym;
  150. vartype : ttype;
  151. varoptions : tvaroptions;
  152. reg : tregister; { if reg<>R_NO, then the variable is an register variable }
  153. varspez : tvarspez; { sets the type of access }
  154. varstate : tvarstate;
  155. constructor init(const n : string;const tt : ttype);
  156. constructor init_dll(const n : string;const tt : ttype);
  157. constructor init_C(const n,mangled : string;const tt : ttype);
  158. constructor initdef(const n : string;p : pdef);
  159. constructor load;
  160. destructor done;virtual;
  161. procedure write;virtual;
  162. procedure deref;virtual;
  163. procedure setmangledname(const s : string);
  164. function mangledname : string;virtual;
  165. procedure insert_in_data;virtual;
  166. function getsize : longint;
  167. function getpushsize : longint;
  168. {$ifdef GDB}
  169. function stabstring : pchar;virtual;
  170. procedure concatstabto(asmlist : paasmoutput);virtual;
  171. {$endif GDB}
  172. private
  173. _mangledname : pchar;
  174. end;
  175. ppropertysym = ^tpropertysym;
  176. tpropertysym = object(tsym)
  177. propoptions : tpropertyoptions;
  178. proptype : ttype;
  179. propoverriden : ppropertysym;
  180. indextype : ttype;
  181. index,
  182. default : longint;
  183. readaccess,
  184. writeaccess,
  185. storedaccess : psymlist;
  186. constructor init(const n : string);
  187. destructor done;virtual;
  188. constructor load;
  189. function getsize : longint;virtual;
  190. procedure write;virtual;
  191. procedure deref;virtual;
  192. procedure dooverride(overriden:ppropertysym);
  193. {$ifdef GDB}
  194. function stabstring : pchar;virtual;
  195. procedure concatstabto(asmlist : paasmoutput);virtual;
  196. {$endif GDB}
  197. end;
  198. pfuncretsym = ^tfuncretsym;
  199. tfuncretsym = object(tsym)
  200. funcretprocinfo : pointer{ should be pprocinfo};
  201. rettype : ttype;
  202. address : longint;
  203. constructor init(const n : string;approcinfo : pointer{pprocinfo});
  204. constructor load;
  205. destructor done;virtual;
  206. procedure write;virtual;
  207. procedure deref;virtual;
  208. procedure insert_in_data;virtual;
  209. {$ifdef GDB}
  210. procedure concatstabto(asmlist : paasmoutput);virtual;
  211. {$endif GDB}
  212. end;
  213. pabsolutesym = ^tabsolutesym;
  214. tabsolutesym = object(tvarsym)
  215. abstyp : absolutetyp;
  216. absseg : boolean;
  217. ref : psym;
  218. asmname : pstring;
  219. constructor init(const n : string;const tt : ttype);
  220. constructor initdef(const n : string;p : pdef);
  221. constructor load;
  222. procedure deref;virtual;
  223. function mangledname : string;virtual;
  224. procedure write;virtual;
  225. procedure insert_in_data;virtual;
  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. typedconsttype : ttype;
  234. is_really_const : boolean;
  235. constructor init(const n : string;p : pdef;really_const : boolean);
  236. constructor inittype(const n : string;const tt : ttype;really_const : boolean);
  237. constructor load;
  238. destructor done;virtual;
  239. function mangledname : string;virtual;
  240. procedure write;virtual;
  241. procedure deref;virtual;
  242. function getsize:longint;
  243. procedure insert_in_data;virtual;
  244. {$ifdef GDB}
  245. function stabstring : pchar;virtual;
  246. {$endif GDB}
  247. end;
  248. pconstsym = ^tconstsym;
  249. tconstsym = object(tsym)
  250. consttype : ttype;
  251. consttyp : tconsttyp;
  252. resstrindex, { needed for resource strings }
  253. value,
  254. len : longint; { len is needed for string length }
  255. constructor init(const n : string;t : tconsttyp;v : longint);
  256. constructor init_def(const n : string;t : tconsttyp;v : longint;def : pdef);
  257. constructor init_string(const n : string;t : tconsttyp;str:pchar;l:longint);
  258. constructor load;
  259. destructor done;virtual;
  260. function mangledname : string;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. nextenum : 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. constructor load;
  290. destructor done;virtual;
  291. procedure write;virtual;
  292. {$ifdef GDB}
  293. procedure concatstabto(asmlist : paasmoutput);virtual;
  294. {$endif GDB}
  295. end;
  296. {
  297. $Log$
  298. Revision 1.46 2000-02-09 13:23:05 peter
  299. * log truncated
  300. Revision 1.45 2000/01/07 01:14:41 peter
  301. * updated copyright to 2000
  302. Revision 1.44 2000/01/03 19:26:04 peter
  303. * fixed resolving of ttypesym which are reference from object/record
  304. fields.
  305. Revision 1.43 1999/12/14 09:58:42 florian
  306. + compiler checks now if a goto leaves an exception block
  307. Revision 1.42 1999/11/30 10:40:56 peter
  308. + ttype, tsymlist
  309. Revision 1.41 1999/11/26 00:19:12 peter
  310. * property overriding dereference fix, but it need a bigger redesign
  311. which i'll do tomorrow. This quick hack is for the lazarus ppl so
  312. they can hack on mwcustomedit.
  313. Revision 1.40 1999/11/17 17:05:06 pierre
  314. * Notes/hints changes
  315. Revision 1.39 1999/11/15 22:00:48 peter
  316. * labels used but not defined give error instead of warning, the warning
  317. is now only with declared but not defined and not used.
  318. Revision 1.38 1999/11/08 14:02:17 florian
  319. * problem with "index X"-properties solved
  320. * typed constants of class references are now allowed
  321. Revision 1.37 1999/11/06 14:34:28 peter
  322. * truncated log to 20 revs
  323. Revision 1.36 1999/10/01 08:02:48 peter
  324. * forward type declaration rewritten
  325. Revision 1.35 1999/09/26 21:30:22 peter
  326. + constant pointer support which can happend with typecasting like
  327. const p=pointer(1)
  328. * better procvar parsing in typed consts
  329. Revision 1.34 1999/08/31 15:42:26 pierre
  330. + tmacrosym is_used and defined_at_startup boolean fields added
  331. Revision 1.33 1999/08/23 11:45:45 michael
  332. * Hopefully final attempt at resourcestrings
  333. Revision 1.32 1999/08/14 00:39:01 peter
  334. * hack to support property with record fields
  335. Revision 1.31 1999/08/10 12:33:38 pierre
  336. * pprocsym defined earlier for use in tprocdef
  337. Revision 1.30 1999/08/03 22:03:21 peter
  338. * moved bitmask constants to sets
  339. * some other type/const renamings
  340. Revision 1.29 1999/07/27 23:42:23 peter
  341. * indirect type referencing is now allowed
  342. Revision 1.28 1999/07/24 15:13:01 michael
  343. changes for resourcestrings
  344. Revision 1.27 1999/07/22 09:37:57 florian
  345. + resourcestring implemented
  346. + start of longstring support
  347. }