symsymh.inc 14 KB

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