symconst.pas 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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. );
  99. tsymoptions=set of tsymoption;
  100. { flags for a definition }
  101. tdefoption=(df_none,
  102. df_need_rtti, { the definitions needs rtti }
  103. df_has_rtti { the rtti is generated }
  104. );
  105. tdefoptions=set of tdefoption;
  106. { base types for orddef }
  107. tbasetype = (
  108. uauto,uvoid,uchar,
  109. u8bit,u16bit,u32bit,
  110. s8bit,s16bit,s32bit,
  111. bool8bit,bool16bit,bool32bit,
  112. u64bit,s64bit,uwidechar
  113. );
  114. { float types }
  115. tfloattype = (
  116. s32real,s64real,s80real,
  117. s64comp,
  118. f16bit,f32bit
  119. );
  120. { string types }
  121. tstringtype = (st_default,
  122. st_shortstring, st_longstring, st_ansistring, st_widestring
  123. );
  124. { set types }
  125. tsettype = (
  126. normset,smallset,varset
  127. );
  128. { calling convention for tprocdef and tprocvardef }
  129. tproccalloption=(pocall_none,
  130. pocall_clearstack, { Use IBM flat calling convention. (Used by GCC.) }
  131. pocall_leftright, { Push parameters from left to right }
  132. pocall_cdecl, { procedure uses C styled calling }
  133. pocall_register, { procedure uses register (fastcall) calling }
  134. pocall_stdcall, { procedure uses stdcall call }
  135. pocall_safecall, { safe call calling conventions }
  136. pocall_palmossyscall, { procedure is a PalmOS system call }
  137. pocall_system,
  138. pocall_inline, { Procedure is an assembler macro }
  139. pocall_internproc, { Procedure has compiler magic}
  140. pocall_internconst, { procedure has constant evaluator intern }
  141. pocall_cppdecl { C++ calling conventions }
  142. );
  143. tproccalloptions=set of tproccalloption;
  144. { basic type for tprocdef and tprocvardef }
  145. tproctypeoption=(potype_none,
  146. potype_proginit, { Program initialization }
  147. potype_unitinit, { unit initialization }
  148. potype_unitfinalize, { unit finalization }
  149. potype_constructor, { Procedure is a constructor }
  150. potype_destructor, { Procedure is a destructor }
  151. potype_operator { Procedure defines an operator }
  152. );
  153. tproctypeoptions=set of tproctypeoption;
  154. { other options for tprocdef and tprocvardef }
  155. tprocoption=(po_none,
  156. po_classmethod, { class method }
  157. po_virtualmethod, { Procedure is a virtual method }
  158. po_abstractmethod, { Procedure is an abstract method }
  159. po_staticmethod, { static method }
  160. po_overridingmethod, { method with override directive }
  161. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  162. po_containsself, { self is passed explicit to the compiler }
  163. po_interrupt, { Procedure is an interrupt handler }
  164. po_iocheck, { IO checking should be done after a call to the procedure }
  165. po_assembler, { Procedure is written in assembler }
  166. po_msgstr, { method for string message handling }
  167. po_msgint, { method for int message handling }
  168. po_exports, { Procedure has export directive (needed for OS/2) }
  169. po_external, { Procedure is external (in other object or lib)}
  170. po_savestdregs, { save std regs cdecl and stdcall need that ! }
  171. po_saveregisters, { save all registers }
  172. po_overload { procedure is declared with overload directive }
  173. );
  174. tprocoptions=set of tprocoption;
  175. { options for objects and classes }
  176. tobjectdeftype = (
  177. odt_class,
  178. odt_object,
  179. odt_interfacecom,
  180. odt_interfacecorba,
  181. odt_cppclass
  182. );
  183. { options for objects and classes }
  184. tobjectoption=(oo_none,
  185. oo_is_forward, { the class is only a forward declared yet }
  186. oo_has_virtual, { the object/class has virtual methods }
  187. oo_has_private,
  188. oo_has_protected,
  189. oo_has_constructor, { the object/class has a constructor }
  190. oo_has_destructor, { the object/class has a destructor }
  191. oo_has_vmt, { the object/class has a vmt }
  192. oo_has_msgstr,
  193. oo_has_msgint,
  194. oo_has_abstract, { the object/class has an abstract method => no instances can be created }
  195. oo_can_have_published { the class has rtti, i.e. you can publish properties }
  196. );
  197. tobjectoptions=set of tobjectoption;
  198. { options for properties }
  199. tpropertyoption=(ppo_none,
  200. ppo_indexed,
  201. ppo_defaultproperty,
  202. ppo_stored,
  203. ppo_hasparameters,
  204. ppo_is_override
  205. );
  206. tpropertyoptions=set of tpropertyoption;
  207. { options for variables }
  208. tvaroption=(vo_none,
  209. vo_regable,
  210. vo_is_C_var,
  211. vo_is_external,
  212. vo_is_dll_var,
  213. vo_is_thread_var,
  214. vo_fpuregable,
  215. vo_is_local_copy,
  216. vo_is_const, { variable is declared as const (parameter) and can't be written to }
  217. vo_is_exported
  218. );
  219. tvaroptions=set of tvaroption;
  220. { types of the symtables }
  221. tsymtabletype = (invalidsymtable,withsymtable,staticsymtable,
  222. globalsymtable,unitsymtable,
  223. objectsymtable,recordsymtable,
  224. macrosymtable,localsymtable,
  225. parasymtable,inlineparasymtable,
  226. inlinelocalsymtable,stt_exceptsymtable,
  227. { only used for PPU reading of static part
  228. of a unit }
  229. staticppusymtable);
  230. { definition contains the informations about a type }
  231. tdeftype = (abstractdef,arraydef,recorddef,pointerdef,orddef,
  232. stringdef,enumdef,procdef,objectdef,errordef,
  233. filedef,formaldef,setdef,procvardef,floatdef,
  234. classrefdef,forwarddef);
  235. { possible types for symtable entries }
  236. tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,
  237. constsym,enumsym,typedconstsym,errorsym,syssym,
  238. labelsym,absolutesym,propertysym,funcretsym,
  239. macrosym);
  240. { State of the variable, if it's declared, assigned or used }
  241. tvarstate=(vs_none,
  242. vs_declared,vs_declared_and_first_found,
  243. vs_set_but_first_not_passed,vs_assigned,vs_used
  244. );
  245. absolutetyp = (tovar,toasm,toaddr);
  246. tconsttyp = (constnone,
  247. constord,conststring,constreal,constbool,
  248. constint,constchar,constset,constpointer,constnil,
  249. constresourcestring
  250. );
  251. {$ifdef GDB}
  252. type
  253. tdefstabstatus = (
  254. not_written,
  255. being_written,
  256. written);
  257. const
  258. tagtypes : Set of tdeftype =
  259. [recorddef,enumdef,
  260. {$IfNDef GDBKnowsStrings}
  261. stringdef,
  262. {$EndIf not GDBKnowsStrings}
  263. {$IfNDef GDBKnowsFiles}
  264. filedef,
  265. {$EndIf not GDBKnowsFiles}
  266. objectdef];
  267. {$endif GDB}
  268. const
  269. { relevant options for assigning a proc or a procvar to a procvar }
  270. po_compatibility_options = [
  271. po_classmethod,
  272. po_staticmethod,
  273. po_methodpointer,
  274. po_containsself,
  275. po_interrupt,
  276. po_iocheck,
  277. po_exports
  278. ];
  279. const
  280. SymTypeName : array[tsymtyp] of string[12] =
  281. ('abstractsym','variable','type','proc','unit',
  282. 'const','enum','typed const','errorsym','system sym',
  283. 'label','absolute','property','funcret',
  284. 'macrosym');
  285. implementation
  286. end.
  287. {
  288. $Log$
  289. Revision 1.12 2000-11-04 14:25:21 florian
  290. + merged Attila's changes for interfaces, not tested yet
  291. Revision 1.11 2000/10/31 22:02:51 peter
  292. * symtable splitted, no real code changes
  293. Revision 1.9 2000/10/15 07:47:52 peter
  294. * unit names and procedure names are stored mixed case
  295. Revision 1.8 2000/10/14 10:14:52 peter
  296. * moehrendorf oct 2000 rewrite
  297. Revision 1.7 2000/09/24 15:06:28 peter
  298. * use defines.inc
  299. Revision 1.6 2000/08/21 11:27:44 pierre
  300. * fix the stabs problems
  301. Revision 1.5 2000/08/06 19:39:28 peter
  302. * default parameters working !
  303. Revision 1.4 2000/08/05 13:25:06 peter
  304. * packenum 1 fixes (merged)
  305. Revision 1.3 2000/07/13 12:08:27 michael
  306. + patched to 1.1.0 with former 1.09patch from peter
  307. Revision 1.2 2000/07/13 11:32:49 michael
  308. + removed logs
  309. }