symsymh.inc 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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. { 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 deref;virtual;
  39. function mangledname : string;virtual;
  40. procedure insert_in_data;virtual;
  41. {$ifdef GDB}
  42. function stabstring : pchar;virtual;
  43. procedure concatstabto(asmlist : paasmoutput);virtual;
  44. {$endif GDB}
  45. procedure load_references;virtual;
  46. function write_references : boolean;virtual;
  47. {$ifdef BrowserLog}
  48. procedure add_to_browserlog;virtual;
  49. {$endif BrowserLog}
  50. end;
  51. plabelsym = ^tlabelsym;
  52. tlabelsym = object(tsym)
  53. lab : pasmlabel;
  54. used,
  55. defined : boolean;
  56. code : pointer; { should be ptree! }
  57. constructor init(const n : string; l : pasmlabel);
  58. destructor done;virtual;
  59. constructor load;
  60. function mangledname : string;virtual;
  61. procedure write;virtual;
  62. end;
  63. punitsym = ^tunitsym;
  64. tunitsym = object(tsym)
  65. unitsymtable : punitsymtable;
  66. prevsym : punitsym;
  67. constructor init(const n : string;ref : punitsymtable);
  68. constructor load;
  69. destructor done;virtual;
  70. procedure write;virtual;
  71. {$ifdef GDB}
  72. procedure concatstabto(asmlist : paasmoutput);virtual;
  73. {$endif GDB}
  74. end;
  75. pmacrosym = ^tmacrosym;
  76. tmacrosym = object(tsym)
  77. defined,
  78. defined_at_startup,
  79. is_used : boolean;
  80. buftext : pchar;
  81. buflen : longint;
  82. { macros aren't written to PPU files ! }
  83. constructor init(const n : string);
  84. destructor done;virtual;
  85. end;
  86. perrorsym = ^terrorsym;
  87. terrorsym = object(tsym)
  88. constructor init;
  89. end;
  90. tprocsym = object(tsym)
  91. definition : pprocdef;
  92. {$ifdef CHAINPROCSYMS}
  93. nextprocsym : pprocsym;
  94. {$endif CHAINPROCSYMS}
  95. is_global : boolean;
  96. constructor init(const n : string);
  97. constructor load;
  98. destructor done;virtual;
  99. function mangledname : string;virtual;
  100. function demangledname:string;
  101. { writes all declarations }
  102. procedure write_parameter_lists;
  103. { tests, if all procedures definitions are defined and not }
  104. { only forward }
  105. procedure check_forward;
  106. procedure order_overloaded;
  107. procedure write;virtual;
  108. procedure deref;virtual;
  109. procedure load_references;virtual;
  110. function write_references : boolean;virtual;
  111. {$ifdef BrowserLog}
  112. procedure add_to_browserlog;virtual;
  113. {$endif BrowserLog}
  114. {$ifdef GDB}
  115. function stabstring : pchar;virtual;
  116. procedure concatstabto(asmlist : paasmoutput);virtual;
  117. {$endif GDB}
  118. end;
  119. ttypesym = object(tsym)
  120. restype : ttype;
  121. synonym : ptypesym;
  122. {$ifdef GDB}
  123. isusedinstab : boolean;
  124. {$endif GDB}
  125. constructor init(const n : string;const tt : ttype);
  126. constructor initdef(const n : string;d : pdef);
  127. constructor load;
  128. destructor done;virtual;
  129. procedure write;virtual;
  130. procedure deref;virtual;
  131. procedure load_references;virtual;
  132. function write_references : boolean;virtual;
  133. {$ifdef BrowserLog}
  134. procedure add_to_browserlog;virtual;
  135. {$endif BrowserLog}
  136. {$ifdef GDB}
  137. function stabstring : pchar;virtual;
  138. procedure concatstabto(asmlist : paasmoutput);virtual;
  139. {$endif GDB}
  140. end;
  141. pvarsym = ^tvarsym;
  142. tvarsym = object(tsym)
  143. address : longint;
  144. localvarsym : pvarsym;
  145. vartype : ttype;
  146. varoptions : tvaroptions;
  147. reg : tregister; { if reg<>R_NO, then the variable is an register variable }
  148. varspez : tvarspez; { sets the type of access }
  149. varstate : tvarstate;
  150. constructor init(const n : string;const tt : ttype);
  151. constructor init_dll(const n : string;const tt : ttype);
  152. constructor init_C(const n,mangled : string;const tt : ttype);
  153. constructor initdef(const n : string;p : pdef);
  154. constructor load;
  155. destructor done;virtual;
  156. procedure write;virtual;
  157. procedure deref;virtual;
  158. procedure setmangledname(const s : string);
  159. function mangledname : string;virtual;
  160. procedure insert_in_data;virtual;
  161. function getsize : longint;
  162. function getpushsize : longint;
  163. {$ifdef GDB}
  164. function stabstring : pchar;virtual;
  165. procedure concatstabto(asmlist : paasmoutput);virtual;
  166. {$endif GDB}
  167. private
  168. _mangledname : pchar;
  169. end;
  170. ppropertysym = ^tpropertysym;
  171. tpropertysym = object(tsym)
  172. propoptions : tpropertyoptions;
  173. proptype : ttype;
  174. propoverriden : ppropertysym;
  175. indextype : ttype;
  176. index,
  177. default : longint;
  178. readaccess,
  179. writeaccess,
  180. storedaccess : psymlist;
  181. constructor init(const n : string);
  182. destructor done;virtual;
  183. constructor load;
  184. function getsize : longint;virtual;
  185. procedure write;virtual;
  186. procedure deref;virtual;
  187. procedure dooverride(overriden:ppropertysym);
  188. {$ifdef GDB}
  189. function stabstring : pchar;virtual;
  190. procedure concatstabto(asmlist : paasmoutput);virtual;
  191. {$endif GDB}
  192. end;
  193. pfuncretsym = ^tfuncretsym;
  194. tfuncretsym = object(tsym)
  195. funcretprocinfo : pointer{ should be pprocinfo};
  196. rettype : ttype;
  197. address : longint;
  198. constructor init(const n : string;approcinfo : pointer{pprocinfo});
  199. constructor load;
  200. destructor done;virtual;
  201. procedure write;virtual;
  202. procedure deref;virtual;
  203. procedure insert_in_data;virtual;
  204. {$ifdef GDB}
  205. procedure concatstabto(asmlist : paasmoutput);virtual;
  206. {$endif GDB}
  207. end;
  208. pabsolutesym = ^tabsolutesym;
  209. tabsolutesym = object(tvarsym)
  210. abstyp : absolutetyp;
  211. absseg : boolean;
  212. ref : psym;
  213. asmname : pstring;
  214. constructor init(const n : string;const tt : ttype);
  215. constructor initdef(const n : string;p : pdef);
  216. constructor load;
  217. procedure deref;virtual;
  218. function mangledname : string;virtual;
  219. procedure write;virtual;
  220. procedure insert_in_data;virtual;
  221. {$ifdef GDB}
  222. procedure concatstabto(asmlist : paasmoutput);virtual;
  223. {$endif GDB}
  224. end;
  225. ptypedconstsym = ^ttypedconstsym;
  226. ttypedconstsym = object(tsym)
  227. prefix : pstring;
  228. typedconsttype : ttype;
  229. is_really_const : boolean;
  230. constructor init(const n : string;p : pdef;really_const : boolean);
  231. constructor inittype(const n : string;const tt : ttype;really_const : boolean);
  232. constructor load;
  233. destructor done;virtual;
  234. function mangledname : string;virtual;
  235. procedure write;virtual;
  236. procedure deref;virtual;
  237. function getsize:longint;
  238. procedure insert_in_data;virtual;
  239. {$ifdef GDB}
  240. function stabstring : pchar;virtual;
  241. {$endif GDB}
  242. end;
  243. pconstsym = ^tconstsym;
  244. tconstsym = object(tsym)
  245. consttype : ttype;
  246. consttyp : tconsttyp;
  247. resstrindex, { needed for resource strings }
  248. value,
  249. len : longint; { len is needed for string length }
  250. constructor init(const n : string;t : tconsttyp;v : longint);
  251. constructor init_def(const n : string;t : tconsttyp;v : longint;def : pdef);
  252. constructor init_string(const n : string;t : tconsttyp;str:pchar;l:longint);
  253. constructor load;
  254. destructor done;virtual;
  255. function mangledname : string;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. nextenum : 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. constructor load;
  285. destructor done;virtual;
  286. procedure write;virtual;
  287. {$ifdef GDB}
  288. procedure concatstabto(asmlist : paasmoutput);virtual;
  289. {$endif GDB}
  290. end;
  291. {
  292. $Log$
  293. Revision 1.43 1999-12-14 09:58:42 florian
  294. + compiler checks now if a goto leaves an exception block
  295. Revision 1.42 1999/11/30 10:40:56 peter
  296. + ttype, tsymlist
  297. Revision 1.41 1999/11/26 00:19:12 peter
  298. * property overriding dereference fix, but it need a bigger redesign
  299. which i'll do tomorrow. This quick hack is for the lazarus ppl so
  300. they can hack on mwcustomedit.
  301. Revision 1.40 1999/11/17 17:05:06 pierre
  302. * Notes/hints changes
  303. Revision 1.39 1999/11/15 22:00:48 peter
  304. * labels used but not defined give error instead of warning, the warning
  305. is now only with declared but not defined and not used.
  306. Revision 1.38 1999/11/08 14:02:17 florian
  307. * problem with "index X"-properties solved
  308. * typed constants of class references are now allowed
  309. Revision 1.37 1999/11/06 14:34:28 peter
  310. * truncated log to 20 revs
  311. Revision 1.36 1999/10/01 08:02:48 peter
  312. * forward type declaration rewritten
  313. Revision 1.35 1999/09/26 21:30:22 peter
  314. + constant pointer support which can happend with typecasting like
  315. const p=pointer(1)
  316. * better procvar parsing in typed consts
  317. Revision 1.34 1999/08/31 15:42:26 pierre
  318. + tmacrosym is_used and defined_at_startup boolean fields added
  319. Revision 1.33 1999/08/23 11:45:45 michael
  320. * Hopefully final attempt at resourcestrings
  321. Revision 1.32 1999/08/14 00:39:01 peter
  322. * hack to support property with record fields
  323. Revision 1.31 1999/08/10 12:33:38 pierre
  324. * pprocsym defined earlier for use in tprocdef
  325. Revision 1.30 1999/08/03 22:03:21 peter
  326. * moved bitmask constants to sets
  327. * some other type/const renamings
  328. Revision 1.29 1999/07/27 23:42:23 peter
  329. * indirect type referencing is now allowed
  330. Revision 1.28 1999/07/24 15:13:01 michael
  331. changes for resourcestrings
  332. Revision 1.27 1999/07/22 09:37:57 florian
  333. + resourcestring implemented
  334. + start of longstring support
  335. Revision 1.26 1999/05/27 19:45:07 peter
  336. * removed oldasm
  337. * plabel -> pasmlabel
  338. * -a switches to source writing automaticly
  339. * assembler readers OOPed
  340. * asmsymbol automaticly external
  341. * jumptables and other label fixes for asm readers
  342. Revision 1.25 1999/05/21 13:55:23 peter
  343. * NEWLAB for label as symbol
  344. Revision 1.24 1999/05/20 22:22:45 pierre
  345. + added synonym filed for ptypesym
  346. allows a clean disposal of tdefs and related ptypesyms
  347. Revision 1.23 1999/05/13 21:59:47 peter
  348. * removed oldppu code
  349. * warning if objpas is loaded from uses
  350. * first things for new deref writing
  351. Revision 1.22 1999/04/26 13:31:53 peter
  352. * release storenumber,double_checksum
  353. Revision 1.21 1999/04/25 22:38:40 pierre
  354. + added is_really_const booleanfield for typedconstsym
  355. for Delphi in $J- mode (not yet implemented !)
  356. Revision 1.20 1999/04/21 09:43:56 peter
  357. * storenumber works
  358. * fixed some typos in double_checksum
  359. + incompatible types type1 and type2 message (with storenumber)
  360. Revision 1.19 1999/04/17 13:16:23 peter
  361. * fixes for storenumber
  362. Revision 1.18 1999/04/14 09:15:03 peter
  363. * first things to store the symbol/def number in the ppu
  364. Revision 1.17 1999/03/31 13:55:23 peter
  365. * assembler inlining working for ag386bin
  366. }