symconst.pas 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl, Pierre Muller
  4. Symbol table constants
  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. unit symconst;
  19. {$i defines.inc}
  20. interface
  21. const
  22. def_alignment = 4;
  23. { if you change one of the following contants, }
  24. { you have also to change the typinfo unit}
  25. { and the rtl/i386,template/rttip.inc files }
  26. tkUnknown = 0;
  27. tkInteger = 1;
  28. tkChar = 2;
  29. tkEnumeration = 3;
  30. tkFloat = 4;
  31. tkSet = 5;
  32. tkMethod = 6;
  33. tkSString = 7;
  34. tkString = tkSString;
  35. tkLString = 8;
  36. tkAString = 9;
  37. tkWString = 10;
  38. tkVariant = 11;
  39. tkArray = 12;
  40. tkRecord = 13;
  41. tkInterface= 14;
  42. tkClass = 15;
  43. tkObject = 16;
  44. tkWChar = 17;
  45. tkBool = 18;
  46. tkInt64 = 19;
  47. tkQWord = 20;
  48. tkDynArray = 21;
  49. tkInterfaceCorba = 22;
  50. otSByte = 0;
  51. otUByte = 1;
  52. otSWord = 2;
  53. otUWord = 3;
  54. otSLong = 4;
  55. otULong = 5;
  56. ftSingle = 0;
  57. ftDouble = 1;
  58. ftExtended = 2;
  59. ftComp = 3;
  60. ftCurr = 4;
  61. ftFixed16 = 5;
  62. ftFixed32 = 6;
  63. mkProcedure= 0;
  64. mkFunction = 1;
  65. mkConstructor = 2;
  66. mkDestructor = 3;
  67. mkClassProcedure= 4;
  68. mkClassFunction = 5;
  69. pfvar = 1;
  70. pfConst = 2;
  71. pfArray = 4;
  72. pfAddress = 8;
  73. pfReference= 16;
  74. pfOut = 32;
  75. main_program_level = 1;
  76. unit_init_level = 1;
  77. normal_function_level = 2;
  78. type
  79. { Deref entry options }
  80. tdereftype = (derefnil,
  81. derefaktrecordindex,
  82. derefaktstaticindex,
  83. derefunit,
  84. derefrecord,
  85. derefindex,
  86. dereflocal,
  87. derefpara,
  88. derefaktlocal
  89. );
  90. { symbol options }
  91. tsymoption=(sp_none,
  92. sp_public,
  93. sp_private,
  94. sp_published,
  95. sp_protected,
  96. sp_static,
  97. sp_primary_typesym { this is for typesym, to know who is the primary symbol of a def }
  98. {$ifdef tp}
  99. ,sp_7
  100. ,sp_8
  101. ,sp_9
  102. ,sp_10
  103. ,sp_11
  104. ,sp_12
  105. ,sp_13
  106. ,sp_14
  107. ,sp_15
  108. ,sp_16
  109. ,sp_17
  110. ,sp_18
  111. ,sp_19
  112. ,sp_20
  113. ,sp_21
  114. ,sp_22
  115. ,sp_23
  116. ,sp_24
  117. {$endif}
  118. );
  119. tsymoptions=set of tsymoption;
  120. { flags for a definition }
  121. tdefoption=(df_none,
  122. df_need_rtti, { the definitions needs rtti }
  123. df_has_rtti { the rtti is generated }
  124. {$ifdef tp}
  125. ,df_3
  126. ,df_4
  127. ,df_5
  128. ,df_6
  129. ,df_7
  130. ,df_8
  131. ,df_9
  132. ,df_10
  133. ,df_11
  134. ,df_12
  135. ,df_13
  136. ,df_14
  137. ,df_15
  138. ,df_16
  139. ,df_17
  140. ,df_18
  141. ,df_19
  142. ,df_20
  143. ,df_21
  144. ,df_22
  145. ,df_23
  146. ,df_24
  147. {$endif}
  148. );
  149. tdefoptions=set of tdefoption;
  150. { base types for orddef }
  151. tbasetype = (
  152. uauto,uvoid,uchar,
  153. u8bit,u16bit,u32bit,
  154. s8bit,s16bit,s32bit,
  155. bool8bit,bool16bit,bool32bit,
  156. u64bit,s64bit,uwidechar
  157. );
  158. { float types }
  159. tfloattype = (
  160. s32real,s64real,s80real,
  161. s64comp,
  162. f16bit,f32bit
  163. );
  164. { string types }
  165. tstringtype = (st_default,
  166. st_shortstring, st_longstring, st_ansistring, st_widestring
  167. );
  168. { set types }
  169. tsettype = (
  170. normset,smallset,varset
  171. );
  172. { calling convention for tprocdef and tprocvardef }
  173. tproccalloption=(pocall_none,
  174. pocall_clearstack, { Use IBM flat calling convention. (Used by GCC.) }
  175. pocall_leftright, { Push parameters from left to right }
  176. pocall_cdecl, { procedure uses C styled calling }
  177. pocall_register, { procedure uses register (fastcall) calling }
  178. pocall_stdcall, { procedure uses stdcall call }
  179. pocall_safecall, { safe call calling conventions }
  180. pocall_palmossyscall, { procedure is a PalmOS system call }
  181. pocall_system,
  182. pocall_inline, { Procedure is an assembler macro }
  183. pocall_internproc, { Procedure has compiler magic}
  184. pocall_internconst, { procedure has constant evaluator intern }
  185. pocall_cppdecl { C++ calling conventions }
  186. ,pocall_13
  187. ,pocall_14
  188. ,pocall_15
  189. ,pocall_16
  190. ,pocall_17
  191. ,pocall_18
  192. ,pocall_19
  193. ,pocall_20
  194. ,pocall_21
  195. ,pocall_22
  196. ,pocall_23
  197. ,pocall_24
  198. );
  199. tproccalloptions=set of tproccalloption;
  200. { basic type for tprocdef and tprocvardef }
  201. tproctypeoption=(potype_none,
  202. potype_proginit, { Program initialization }
  203. potype_unitinit, { unit initialization }
  204. potype_unitfinalize, { unit finalization }
  205. potype_constructor, { Procedure is a constructor }
  206. potype_destructor, { Procedure is a destructor }
  207. potype_operator { Procedure defines an operator }
  208. ,potype_7
  209. ,potype_8
  210. ,potype_9
  211. ,potype_10
  212. ,potype_11
  213. ,potype_12
  214. ,potype_13
  215. ,potype_14
  216. ,potype_15
  217. ,potype_16
  218. ,potype_17
  219. ,potype_18
  220. ,potype_19
  221. ,potype_20
  222. ,potype_21
  223. ,potype_22
  224. ,potype_23
  225. ,potype_24
  226. );
  227. tproctypeoptions=set of tproctypeoption;
  228. { other options for tprocdef and tprocvardef }
  229. tprocoption=(po_none,
  230. po_classmethod, { class method }
  231. po_virtualmethod, { Procedure is a virtual method }
  232. po_abstractmethod, { Procedure is an abstract method }
  233. po_staticmethod, { static method }
  234. po_overridingmethod, { method with override directive }
  235. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  236. po_containsself, { self is passed explicit to the compiler }
  237. po_interrupt, { Procedure is an interrupt handler }
  238. po_iocheck, { IO checking should be done after a call to the procedure }
  239. po_assembler, { Procedure is written in assembler }
  240. po_msgstr, { method for string message handling }
  241. po_msgint, { method for int message handling }
  242. po_exports, { Procedure has export directive (needed for OS/2) }
  243. po_external, { Procedure is external (in other object or lib)}
  244. po_savestdregs, { save std regs cdecl and stdcall need that ! }
  245. po_saveregisters, { save all registers }
  246. po_overload { procedure is declared with overload directive }
  247. ,po_18
  248. ,po_19
  249. ,po_20
  250. ,po_21
  251. ,po_22
  252. ,po_23
  253. ,po_24
  254. );
  255. tprocoptions=set of tprocoption;
  256. { options for objects and classes }
  257. tobjectdeftype = (odt_none,
  258. odt_class,
  259. odt_object,
  260. odt_interfacecom,
  261. odt_interfacecorba,
  262. odt_cppclass
  263. );
  264. { options for objects and classes }
  265. tobjectoption=(oo_none,
  266. oo_is_forward, { the class is only a forward declared yet }
  267. oo_has_virtual, { the object/class has virtual methods }
  268. oo_has_private,
  269. oo_has_protected,
  270. oo_has_constructor, { the object/class has a constructor }
  271. oo_has_destructor, { the object/class has a destructor }
  272. oo_has_vmt, { the object/class has a vmt }
  273. oo_has_msgstr,
  274. oo_has_msgint,
  275. oo_has_abstract, { the object/class has an abstract method => no instances can be created }
  276. oo_can_have_published { the class has rtti, i.e. you can publish properties }
  277. ,oo_12
  278. ,oo_13
  279. ,oo_14
  280. ,oo_15
  281. ,oo_16
  282. ,oo_17
  283. ,oo_18
  284. ,oo_19
  285. ,oo_20
  286. ,oo_21
  287. ,oo_22
  288. ,oo_23
  289. ,oo_24
  290. );
  291. tobjectoptions=set of tobjectoption;
  292. { options for properties }
  293. tpropertyoption=(ppo_none,
  294. ppo_indexed,
  295. ppo_defaultproperty,
  296. ppo_stored,
  297. ppo_hasparameters,
  298. ppo_is_override
  299. ,ppo_6
  300. ,ppo_7
  301. ,ppo_8
  302. ,ppo_9
  303. ,ppo_10
  304. ,ppo_11
  305. ,ppo_12
  306. ,ppo_13
  307. ,ppo_14
  308. ,ppo_15
  309. ,ppo_16
  310. ,ppo_17
  311. ,ppo_18
  312. ,ppo_19
  313. ,ppo_20
  314. ,ppo_21
  315. ,ppo_22
  316. ,ppo_23
  317. ,ppo_24
  318. );
  319. tpropertyoptions=set of tpropertyoption;
  320. { options for variables }
  321. tvaroption=(vo_none,
  322. vo_regable,
  323. vo_is_C_var,
  324. vo_is_external,
  325. vo_is_dll_var,
  326. vo_is_thread_var,
  327. vo_fpuregable,
  328. vo_is_local_copy,
  329. vo_is_const, { variable is declared as const (parameter) and can't be written to }
  330. vo_is_exported
  331. ,vo_10
  332. ,vo_11
  333. ,vo_12
  334. ,vo_13
  335. ,vo_14
  336. ,vo_15
  337. ,vo_16
  338. ,vo_17
  339. ,vo_18
  340. ,vo_19
  341. ,vo_20
  342. ,vo_21
  343. ,vo_22
  344. ,vo_23
  345. ,vo_24
  346. );
  347. tvaroptions=set of tvaroption;
  348. { types of the symtables }
  349. tsymtabletype = (invalidsymtable,withsymtable,staticsymtable,
  350. globalsymtable,unitsymtable,
  351. objectsymtable,recordsymtable,
  352. macrosymtable,localsymtable,
  353. parasymtable,inlineparasymtable,
  354. inlinelocalsymtable,stt_exceptsymtable,
  355. { only used for PPU reading of static part
  356. of a unit }
  357. staticppusymtable);
  358. { definition contains the informations about a type }
  359. tdeftype = (abstractdef,arraydef,recorddef,pointerdef,orddef,
  360. stringdef,enumdef,procdef,objectdef,errordef,
  361. filedef,formaldef,setdef,procvardef,floatdef,
  362. classrefdef,forwarddef,variantdef);
  363. { possible types for symtable entries }
  364. tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,
  365. constsym,enumsym,typedconstsym,errorsym,syssym,
  366. labelsym,absolutesym,propertysym,funcretsym,
  367. macrosym);
  368. { State of the variable, if it's declared, assigned or used }
  369. tvarstate=(vs_none,
  370. vs_declared,vs_declared_and_first_found,
  371. vs_set_but_first_not_passed,vs_assigned,vs_used
  372. );
  373. absolutetyp = (tovar,toasm,toaddr);
  374. tconsttyp = (constnone,
  375. constord,conststring,constreal,constbool,
  376. constint,constchar,constset,constpointer,constnil,
  377. constresourcestring
  378. );
  379. {$ifdef GDB}
  380. type
  381. tdefstabstatus = (
  382. not_written,
  383. being_written,
  384. written);
  385. const
  386. tagtypes : Set of tdeftype =
  387. [recorddef,enumdef,
  388. {$IfNDef GDBKnowsStrings}
  389. stringdef,
  390. {$EndIf not GDBKnowsStrings}
  391. {$IfNDef GDBKnowsFiles}
  392. filedef,
  393. {$EndIf not GDBKnowsFiles}
  394. objectdef];
  395. {$endif GDB}
  396. const
  397. { relevant options for assigning a proc or a procvar to a procvar }
  398. po_compatibility_options = [
  399. po_classmethod,
  400. po_staticmethod,
  401. po_methodpointer,
  402. po_containsself,
  403. po_interrupt,
  404. po_iocheck,
  405. po_exports
  406. ];
  407. const
  408. SymTypeName : array[tsymtyp] of string[12] =
  409. ('abstractsym','variable','type','proc','unit',
  410. 'const','enum','typed const','errorsym','system sym',
  411. 'label','absolute','property','funcret',
  412. 'macrosym');
  413. implementation
  414. end.
  415. {
  416. $Log$
  417. Revision 1.14 2001-03-22 00:10:58 florian
  418. + basic variant type support in the compiler
  419. Revision 1.13 2001/02/26 19:44:55 peter
  420. * merged generic m68k updates from fixes branch
  421. Revision 1.12 2000/11/04 14:25:21 florian
  422. + merged Attila's changes for interfaces, not tested yet
  423. Revision 1.11 2000/10/31 22:02:51 peter
  424. * symtable splitted, no real code changes
  425. Revision 1.9 2000/10/15 07:47:52 peter
  426. * unit names and procedure names are stored mixed case
  427. Revision 1.8 2000/10/14 10:14:52 peter
  428. * moehrendorf oct 2000 rewrite
  429. Revision 1.7 2000/09/24 15:06:28 peter
  430. * use defines.inc
  431. Revision 1.6 2000/08/21 11:27:44 pierre
  432. * fix the stabs problems
  433. Revision 1.5 2000/08/06 19:39:28 peter
  434. * default parameters working !
  435. Revision 1.4 2000/08/05 13:25:06 peter
  436. * packenum 1 fixes (merged)
  437. Revision 1.3 2000/07/13 12:08:27 michael
  438. + patched to 1.1.0 with former 1.09patch from peter
  439. Revision 1.2 2000/07/13 11:32:49 michael
  440. + removed logs
  441. }