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. psym = ^tsym;
  23. tsym = object(tsymtableentry)
  24. typ : tsymtyp;
  25. symoptions : tsymoptions;
  26. fileinfo : tfileposinfo;
  27. {$ifdef GDB}
  28. isstabwritten : boolean;
  29. {$endif GDB}
  30. refs : longint;
  31. lastref,
  32. defref,
  33. lastwritten : pref;
  34. refcount : longint;
  35. constructor init(const n : string);
  36. constructor load;
  37. destructor done;virtual;
  38. procedure write;virtual;
  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. 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. {$ifdef GDB}
  96. is_global : boolean; { necessary for stab }
  97. {$endif GDB}
  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. definition : pdef;
  123. synonym : ptypesym;
  124. {$ifdef GDB}
  125. isusedinstab : boolean;
  126. {$endif GDB}
  127. constructor init(const n : string;d : pdef);
  128. constructor load;
  129. destructor done;virtual;
  130. procedure write;virtual;
  131. procedure deref;virtual;
  132. procedure load_references;virtual;
  133. function write_references : boolean;virtual;
  134. {$ifdef BrowserLog}
  135. procedure add_to_browserlog;virtual;
  136. {$endif BrowserLog}
  137. {$ifdef GDB}
  138. function stabstring : pchar;virtual;
  139. procedure concatstabto(asmlist : paasmoutput);virtual;
  140. {$endif GDB}
  141. end;
  142. pvarsym = ^tvarsym;
  143. tvarsym = object(tsym)
  144. address : longint;
  145. localvarsym : pvarsym;
  146. islocalcopy : boolean;
  147. definition : pdef;
  148. definitionsym : ptypesym;
  149. varoptions : tvaroptions;
  150. reg : tregister; { if reg<>R_NO, then the variable is an register variable }
  151. varspez : tvarspez; { sets the type of access }
  152. varstate : tvarstate;
  153. constructor init(const n : string;p : pdef);
  154. constructor init_dll(const n : string;p : pdef);
  155. constructor init_C(const n,mangled : string;p : pdef);
  156. constructor initsym(const n : string;p : ptypesym);
  157. constructor initsym_dll(const n : string;p : ptypesym);
  158. constructor initsym_C(const n,mangled : string;p : ptypesym);
  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. ppropsymlist = ^tpropsymlist;
  176. tpropsymlist = record
  177. sym : psym;
  178. next : ppropsymlist;
  179. end;
  180. ppropertysym = ^tpropertysym;
  181. tpropertysym = object(tsym)
  182. propoptions : tpropertyoptions;
  183. proptype : pdef;
  184. readaccesssym,writeaccesssym,storedsym : ppropsymlist;
  185. readaccessdef,writeaccessdef,storeddef,indexdef : 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. 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. funcretdef : pdef;
  202. address : longint;
  203. constructor init(const n : string;approcinfo : pointer{pprocinfo});
  204. constructor load;
  205. procedure write;virtual;
  206. procedure deref;virtual;
  207. procedure insert_in_data;virtual;
  208. {$ifdef GDB}
  209. procedure concatstabto(asmlist : paasmoutput);virtual;
  210. {$endif GDB}
  211. end;
  212. absolutetyp = (tovar,toasm,toaddr);
  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;p : pdef);
  220. constructor load;
  221. procedure deref;virtual;
  222. function mangledname : string;virtual;
  223. procedure write;virtual;
  224. procedure insert_in_data;virtual;
  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. definitionsym : ptypesym;
  234. is_really_const : boolean;
  235. constructor init(const n : string;p : pdef;really_const : boolean);
  236. constructor initsym(const n : string;p : ptypesym;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. tconsttype = (constord,conststring,constreal,constbool,
  249. constint,constchar,constset,constpointer,constnil,
  250. constresourcestring);
  251. pconstsym = ^tconstsym;
  252. tconstsym = object(tsym)
  253. definition : pdef;
  254. consttype : tconsttype;
  255. resstrindex, { needed for resource strings }
  256. value,
  257. len : longint; { len is needed for string length }
  258. constructor init(const n : string;t : tconsttype;v : longint);
  259. constructor init_def(const n : string;t : tconsttype;v : longint;def : pdef);
  260. constructor init_string(const n : string;t : tconsttype;str:pchar;l:longint);
  261. constructor load;
  262. destructor done;virtual;
  263. function mangledname : string;virtual;
  264. procedure deref;virtual;
  265. procedure write;virtual;
  266. {$ifdef GDB}
  267. function stabstring : pchar;virtual;
  268. procedure concatstabto(asmlist : paasmoutput);virtual;
  269. {$endif GDB}
  270. end;
  271. tenumsym = object(tsym)
  272. value : longint;
  273. definition : penumdef;
  274. nextenum : penumsym;
  275. constructor init(const n : string;def : penumdef;v : longint);
  276. constructor load;
  277. procedure write;virtual;
  278. procedure deref;virtual;
  279. procedure order;
  280. {$ifdef GDB}
  281. procedure concatstabto(asmlist : paasmoutput);virtual;
  282. {$endif GDB}
  283. end;
  284. pprogramsym = ^tprogramsym;
  285. tprogramsym = object(tsym)
  286. constructor init(const n : string);
  287. end;
  288. psyssym = ^tsyssym;
  289. tsyssym = object(tsym)
  290. number : longint;
  291. constructor init(const n : string;l : longint);
  292. constructor load;
  293. destructor done;virtual;
  294. procedure write;virtual;
  295. {$ifdef GDB}
  296. procedure concatstabto(asmlist : paasmoutput);virtual;
  297. {$endif GDB}
  298. end;
  299. {
  300. $Log$
  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 ttypesym
  346. allows a clean disposal of tdefs and related ttypesyms
  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. }