symsymh.inc 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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. { possible types for symtable entries }
  22. tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,programsym,
  23. constsym,enumsym,typedconstsym,errorsym,syssym,
  24. labelsym,absolutesym,propertysym,funcretsym,
  25. macrosym);
  26. { this object is the base for all symbol objects }
  27. psym = ^tsym;
  28. tsym = object(tsymtableentry)
  29. typ : tsymtyp;
  30. symoptions : tsymoptions;
  31. fileinfo : tfileposinfo;
  32. {$ifdef GDB}
  33. isstabwritten : boolean;
  34. {$endif GDB}
  35. lastref,
  36. defref,
  37. lastwritten : pref;
  38. refcount : longint;
  39. constructor init(const n : string);
  40. constructor load;
  41. destructor done;virtual;
  42. procedure write;virtual;
  43. procedure deref;virtual;
  44. function mangledname : string;virtual;
  45. procedure insert_in_data;virtual;
  46. {$ifdef GDB}
  47. function stabstring : pchar;virtual;
  48. procedure concatstabto(asmlist : paasmoutput);virtual;
  49. {$endif GDB}
  50. procedure load_references;virtual;
  51. function write_references : boolean;virtual;
  52. {$ifdef BrowserLog}
  53. procedure add_to_browserlog;virtual;
  54. {$endif BrowserLog}
  55. end;
  56. plabelsym = ^tlabelsym;
  57. tlabelsym = object(tsym)
  58. lab : pasmlabel;
  59. defined : boolean;
  60. constructor init(const n : string; l : pasmlabel);
  61. destructor done;virtual;
  62. constructor load;
  63. function mangledname : string;virtual;
  64. procedure write;virtual;
  65. end;
  66. punitsym = ^tunitsym;
  67. tunitsym = object(tsym)
  68. unitsymtable : punitsymtable;
  69. prevsym : punitsym;
  70. refs : longint;
  71. constructor init(const n : string;ref : punitsymtable);
  72. constructor load;
  73. destructor done;virtual;
  74. procedure write;virtual;
  75. {$ifdef GDB}
  76. procedure concatstabto(asmlist : paasmoutput);virtual;
  77. {$endif GDB}
  78. end;
  79. pmacrosym = ^tmacrosym;
  80. tmacrosym = object(tsym)
  81. defined,
  82. defined_at_startup,
  83. is_used : boolean;
  84. buftext : pchar;
  85. buflen : longint;
  86. { macros aren't written to PPU files ! }
  87. constructor init(const n : string);
  88. destructor done;virtual;
  89. end;
  90. perrorsym = ^terrorsym;
  91. terrorsym = object(tsym)
  92. constructor init;
  93. end;
  94. tprocsym = object(tsym)
  95. definition : pprocdef;
  96. {$ifdef CHAINPROCSYMS}
  97. nextprocsym : pprocsym;
  98. {$endif CHAINPROCSYMS}
  99. {$ifdef GDB}
  100. is_global : boolean; { necessary for stab }
  101. {$endif GDB}
  102. constructor init(const n : string);
  103. constructor load;
  104. destructor done;virtual;
  105. function mangledname : string;virtual;
  106. function demangledname:string;
  107. { writes all declarations }
  108. procedure write_parameter_lists;
  109. { tests, if all procedures definitions are defined and not }
  110. { only forward }
  111. procedure check_forward;
  112. procedure write;virtual;
  113. procedure deref;virtual;
  114. procedure load_references;virtual;
  115. function write_references : boolean;virtual;
  116. {$ifdef BrowserLog}
  117. procedure add_to_browserlog;virtual;
  118. {$endif BrowserLog}
  119. {$ifdef GDB}
  120. function stabstring : pchar;virtual;
  121. procedure concatstabto(asmlist : paasmoutput);virtual;
  122. {$endif GDB}
  123. end;
  124. ttypesym = object(tsym)
  125. definition : pdef;
  126. synonym : ptypesym;
  127. {$ifdef GDB}
  128. isusedinstab : boolean;
  129. {$endif GDB}
  130. constructor init(const n : string;d : pdef);
  131. constructor load;
  132. destructor done;virtual;
  133. procedure write;virtual;
  134. procedure deref;virtual;
  135. procedure load_references;virtual;
  136. function write_references : boolean;virtual;
  137. {$ifdef BrowserLog}
  138. procedure add_to_browserlog;virtual;
  139. {$endif BrowserLog}
  140. {$ifdef GDB}
  141. function stabstring : pchar;virtual;
  142. procedure concatstabto(asmlist : paasmoutput);virtual;
  143. {$endif GDB}
  144. end;
  145. pvarsym = ^tvarsym;
  146. tvarsym = object(tsym)
  147. address : longint;
  148. localvarsym : pvarsym;
  149. islocalcopy : boolean;
  150. definition : pdef;
  151. definitionsym : ptypesym;
  152. refs : longint;
  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;p : pdef);
  158. constructor init_dll(const n : string;p : pdef);
  159. constructor init_C(const n,mangled : string;p : pdef);
  160. constructor initsym(const n : string;p : ptypesym);
  161. constructor initsym_dll(const n : string;p : ptypesym);
  162. constructor initsym_C(const n,mangled : string;p : ptypesym);
  163. constructor load;
  164. destructor done;virtual;
  165. procedure write;virtual;
  166. procedure deref;virtual;
  167. procedure setmangledname(const s : string);
  168. function mangledname : string;virtual;
  169. procedure insert_in_data;virtual;
  170. function getsize : longint;
  171. function getpushsize : longint;
  172. {$ifdef GDB}
  173. function stabstring : pchar;virtual;
  174. procedure concatstabto(asmlist : paasmoutput);virtual;
  175. {$endif GDB}
  176. private
  177. _mangledname : pchar;
  178. end;
  179. ppropsymlist = ^tpropsymlist;
  180. tpropsymlist = record
  181. sym : psym;
  182. next : ppropsymlist;
  183. end;
  184. ppropertysym = ^tpropertysym;
  185. tpropertysym = object(tsym)
  186. propoptions : tpropertyoptions;
  187. proptype : pdef;
  188. readaccesssym,writeaccesssym,storedsym : ppropsymlist;
  189. readaccessdef,writeaccessdef,storeddef,indexdef : pdef;
  190. index,default : longint;
  191. constructor init(const n : string);
  192. destructor done;virtual;
  193. constructor load;
  194. function getsize : longint;virtual;
  195. procedure write;virtual;
  196. procedure deref;virtual;
  197. {$ifdef GDB}
  198. function stabstring : pchar;virtual;
  199. procedure concatstabto(asmlist : paasmoutput);virtual;
  200. {$endif GDB}
  201. end;
  202. pfuncretsym = ^tfuncretsym;
  203. tfuncretsym = object(tsym)
  204. funcretprocinfo : pointer{ should be pprocinfo};
  205. funcretdef : pdef;
  206. address : longint;
  207. constructor init(const n : string;approcinfo : pointer{pprocinfo});
  208. constructor load;
  209. procedure write;virtual;
  210. procedure deref;virtual;
  211. procedure insert_in_data;virtual;
  212. {$ifdef GDB}
  213. procedure concatstabto(asmlist : paasmoutput);virtual;
  214. {$endif GDB}
  215. end;
  216. absolutetyp = (tovar,toasm,toaddr);
  217. pabsolutesym = ^tabsolutesym;
  218. tabsolutesym = object(tvarsym)
  219. abstyp : absolutetyp;
  220. absseg : boolean;
  221. ref : psym;
  222. asmname : pstring;
  223. constructor init(const n : string;p : pdef);
  224. constructor load;
  225. procedure deref;virtual;
  226. function mangledname : string;virtual;
  227. procedure write;virtual;
  228. procedure insert_in_data;virtual;
  229. {$ifdef GDB}
  230. procedure concatstabto(asmlist : paasmoutput);virtual;
  231. {$endif GDB}
  232. end;
  233. ptypedconstsym = ^ttypedconstsym;
  234. ttypedconstsym = object(tsym)
  235. prefix : pstring;
  236. definition : pdef;
  237. definitionsym : ptypesym;
  238. is_really_const : boolean;
  239. constructor init(const n : string;p : pdef;really_const : boolean);
  240. constructor initsym(const n : string;p : ptypesym;really_const : boolean);
  241. constructor load;
  242. destructor done;virtual;
  243. function mangledname : string;virtual;
  244. procedure write;virtual;
  245. procedure deref;virtual;
  246. function getsize:longint;
  247. procedure insert_in_data;virtual;
  248. {$ifdef GDB}
  249. function stabstring : pchar;virtual;
  250. {$endif GDB}
  251. end;
  252. tconsttype = (constord,conststring,constreal,constbool,
  253. constint,constchar,constset,constpointer,constnil,
  254. constresourcestring);
  255. pconstsym = ^tconstsym;
  256. tconstsym = object(tsym)
  257. definition : pdef;
  258. consttype : tconsttype;
  259. resstrindex, { needed for resource strings }
  260. value,
  261. len : longint; { len is needed for string length }
  262. constructor init(const n : string;t : tconsttype;v : longint);
  263. constructor init_def(const n : string;t : tconsttype;v : longint;def : pdef);
  264. constructor init_string(const n : string;t : tconsttype;str:pchar;l:longint);
  265. constructor load;
  266. destructor done;virtual;
  267. function mangledname : string;virtual;
  268. procedure deref;virtual;
  269. procedure write;virtual;
  270. {$ifdef GDB}
  271. function stabstring : pchar;virtual;
  272. procedure concatstabto(asmlist : paasmoutput);virtual;
  273. {$endif GDB}
  274. end;
  275. tenumsym = object(tsym)
  276. value : longint;
  277. definition : penumdef;
  278. nextenum : penumsym;
  279. constructor init(const n : string;def : penumdef;v : longint);
  280. constructor load;
  281. procedure write;virtual;
  282. procedure deref;virtual;
  283. procedure order;
  284. {$ifdef GDB}
  285. procedure concatstabto(asmlist : paasmoutput);virtual;
  286. {$endif GDB}
  287. end;
  288. pprogramsym = ^tprogramsym;
  289. tprogramsym = object(tsym)
  290. constructor init(const n : string);
  291. end;
  292. psyssym = ^tsyssym;
  293. tsyssym = object(tsym)
  294. number : longint;
  295. constructor init(const n : string;l : longint);
  296. constructor load;
  297. destructor done;virtual;
  298. procedure write;virtual;
  299. {$ifdef GDB}
  300. procedure concatstabto(asmlist : paasmoutput);virtual;
  301. {$endif GDB}
  302. end;
  303. {
  304. $Log$
  305. Revision 1.38 1999-11-08 14:02:17 florian
  306. * problem with "index X"-properties solved
  307. * typed constants of class references are now allowed
  308. Revision 1.37 1999/11/06 14:34:28 peter
  309. * truncated log to 20 revs
  310. Revision 1.36 1999/10/01 08:02:48 peter
  311. * forward type declaration rewritten
  312. Revision 1.35 1999/09/26 21:30:22 peter
  313. + constant pointer support which can happend with typecasting like
  314. const p=pointer(1)
  315. * better procvar parsing in typed consts
  316. Revision 1.34 1999/08/31 15:42:26 pierre
  317. + tmacrosym is_used and defined_at_startup boolean fields added
  318. Revision 1.33 1999/08/23 11:45:45 michael
  319. * Hopefully final attempt at resourcestrings
  320. Revision 1.32 1999/08/14 00:39:01 peter
  321. * hack to support property with record fields
  322. Revision 1.31 1999/08/10 12:33:38 pierre
  323. * pprocsym defined earlier for use in tprocdef
  324. Revision 1.30 1999/08/03 22:03:21 peter
  325. * moved bitmask constants to sets
  326. * some other type/const renamings
  327. Revision 1.29 1999/07/27 23:42:23 peter
  328. * indirect type referencing is now allowed
  329. Revision 1.28 1999/07/24 15:13:01 michael
  330. changes for resourcestrings
  331. Revision 1.27 1999/07/22 09:37:57 florian
  332. + resourcestring implemented
  333. + start of longstring support
  334. Revision 1.26 1999/05/27 19:45:07 peter
  335. * removed oldasm
  336. * plabel -> pasmlabel
  337. * -a switches to source writing automaticly
  338. * assembler readers OOPed
  339. * asmsymbol automaticly external
  340. * jumptables and other label fixes for asm readers
  341. Revision 1.25 1999/05/21 13:55:23 peter
  342. * NEWLAB for label as symbol
  343. Revision 1.24 1999/05/20 22:22:45 pierre
  344. + added synonym filed for ttypesym
  345. allows a clean disposal of tdefs and related ttypesyms
  346. Revision 1.23 1999/05/13 21:59:47 peter
  347. * removed oldppu code
  348. * warning if objpas is loaded from uses
  349. * first things for new deref writing
  350. Revision 1.22 1999/04/26 13:31:53 peter
  351. * release storenumber,double_checksum
  352. Revision 1.21 1999/04/25 22:38:40 pierre
  353. + added is_really_const booleanfield for typedconstsym
  354. for Delphi in $J- mode (not yet implemented !)
  355. Revision 1.20 1999/04/21 09:43:56 peter
  356. * storenumber works
  357. * fixed some typos in double_checksum
  358. + incompatible types type1 and type2 message (with storenumber)
  359. Revision 1.19 1999/04/17 13:16:23 peter
  360. * fixes for storenumber
  361. Revision 1.18 1999/04/14 09:15:03 peter
  362. * first things to store the symbol/def number in the ppu
  363. Revision 1.17 1999/03/31 13:55:23 peter
  364. * assembler inlining working for ag386bin
  365. }