symconst.pas 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 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 fpcdefs.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. mkProcedure= 0;
  62. mkFunction = 1;
  63. mkConstructor = 2;
  64. mkDestructor = 3;
  65. mkClassProcedure= 4;
  66. mkClassFunction = 5;
  67. pfvar = 1;
  68. pfConst = 2;
  69. pfArray = 4;
  70. pfAddress = 8;
  71. pfReference= 16;
  72. pfOut = 32;
  73. {# These are the different possible base values that can
  74. be taken from the lexlevel variable when parsing. The
  75. lexlevel can be bigger if parsding recursive routines.
  76. }
  77. main_program_level = 1;
  78. unit_init_level = 1;
  79. normal_function_level = 2;
  80. type
  81. { Deref entry options }
  82. tdereftype = (derefnil,
  83. derefaktrecordindex,
  84. derefaktstaticindex,
  85. derefunit,
  86. derefrecord,
  87. derefindex,
  88. dereflocal,
  89. derefpara,
  90. derefaktlocal
  91. );
  92. { symbol options }
  93. tsymoption=(sp_none,
  94. sp_public,
  95. sp_private,
  96. sp_published,
  97. sp_protected,
  98. sp_static,
  99. sp_hint_deprecated,
  100. sp_hint_platform,
  101. sp_hint_library,
  102. sp_has_overloaded
  103. );
  104. tsymoptions=set of tsymoption;
  105. { flags for a definition }
  106. tdefoption=(df_none,
  107. df_has_inittable, { init data has been generated }
  108. df_has_rttitable { rtti data has been generated }
  109. );
  110. tdefoptions=set of tdefoption;
  111. { tsymlist entry types }
  112. tsltype = (sl_none,
  113. sl_load,
  114. sl_call,
  115. sl_subscript,
  116. sl_vec
  117. );
  118. { base types for orddef }
  119. tbasetype = (
  120. uvoid,
  121. u8bit,u16bit,u32bit,u64bit,
  122. s8bit,s16bit,s32bit,s64bit,
  123. bool8bit,bool16bit,bool32bit,
  124. uchar,uwidechar
  125. );
  126. { float types }
  127. tfloattype = (
  128. s32real,s64real,s80real,
  129. s64comp,s64currency
  130. );
  131. { string types }
  132. tstringtype = (st_default,
  133. st_shortstring, st_longstring, st_ansistring, st_widestring
  134. );
  135. { set types }
  136. tsettype = (
  137. normset,smallset,varset
  138. );
  139. { basic type for tprocdef and tprocvardef }
  140. tproctypeoption=(potype_none,
  141. potype_proginit, { Program initialization }
  142. potype_unitinit, { unit initialization }
  143. potype_unitfinalize, { unit finalization }
  144. potype_constructor, { Procedure is a constructor }
  145. potype_destructor, { Procedure is a destructor }
  146. potype_operator { Procedure defines an operator }
  147. );
  148. tproctypeoptions=set of tproctypeoption;
  149. { other options for tprocdef and tprocvardef }
  150. tprocoption=(po_none,
  151. po_classmethod, { class method }
  152. po_virtualmethod, { Procedure is a virtual method }
  153. po_abstractmethod, { Procedure is an abstract method }
  154. po_staticmethod, { static method }
  155. po_overridingmethod, { method with override directive }
  156. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  157. po_containsself, { self is passed explicit to the compiler }
  158. po_interrupt, { Procedure is an interrupt handler }
  159. po_iocheck, { IO checking should be done after a call to the procedure }
  160. po_assembler, { Procedure is written in assembler }
  161. po_msgstr, { method for string message handling }
  162. po_msgint, { method for int message handling }
  163. po_exports, { Procedure has export directive (needed for OS/2) }
  164. po_external, { Procedure is external (in other object or lib)}
  165. po_savestdregs, { save std regs cdecl and stdcall need that ! }
  166. po_saveregisters, { save all registers }
  167. po_overload, { procedure is declared with overload directive }
  168. po_varargs, { printf like arguments }
  169. po_leftright, { push arguments from left to right }
  170. po_clearstack { caller clears the stack }
  171. );
  172. tprocoptions=set of tprocoption;
  173. { options for objects and classes }
  174. tobjectdeftype = (odt_none,
  175. odt_class,
  176. odt_object,
  177. odt_interfacecom,
  178. odt_interfacecorba,
  179. odt_cppclass
  180. );
  181. { options for objects and classes }
  182. tobjectoption=(oo_none,
  183. oo_is_forward, { the class is only a forward declared yet }
  184. oo_has_virtual, { the object/class has virtual methods }
  185. oo_has_private,
  186. oo_has_protected,
  187. oo_has_constructor, { the object/class has a constructor }
  188. oo_has_destructor, { the object/class has a destructor }
  189. oo_has_vmt, { the object/class has a vmt }
  190. oo_has_msgstr,
  191. oo_has_msgint,
  192. oo_has_abstract, { the object/class has an abstract method => no instances can be created }
  193. oo_can_have_published { the class has rtti, i.e. you can publish properties }
  194. );
  195. tobjectoptions=set of tobjectoption;
  196. { options for properties }
  197. tpropertyoption=(ppo_none,
  198. ppo_indexed,
  199. ppo_defaultproperty,
  200. ppo_stored,
  201. ppo_hasparameters,
  202. ppo_is_override
  203. );
  204. tpropertyoptions=set of tpropertyoption;
  205. { options for variables }
  206. tvaroption=(vo_none,
  207. vo_regable,
  208. vo_is_C_var,
  209. vo_is_external,
  210. vo_is_dll_var,
  211. vo_is_thread_var,
  212. vo_fpuregable,
  213. vo_is_local_copy,
  214. vo_is_const, { variable is declared as const (parameter) and can't be written to }
  215. vo_is_exported
  216. );
  217. tvaroptions=set of tvaroption;
  218. { types of the symtables }
  219. tsymtabletype = (abstractsymtable,
  220. globalsymtable,staticsymtable,
  221. objectsymtable,recordsymtable,
  222. localsymtable,parasymtable,
  223. withsymtable,stt_exceptsymtable,
  224. { used for inline detection }
  225. inlineparasymtable,inlinelocalsymtable
  226. );
  227. { definition contains the informations about a type }
  228. tdeftype = (abstractdef,arraydef,recorddef,pointerdef,orddef,
  229. stringdef,enumdef,procdef,objectdef,errordef,
  230. filedef,formaldef,setdef,procvardef,floatdef,
  231. classrefdef,forwarddef,variantdef);
  232. { possible types for symtable entries }
  233. tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,
  234. constsym,enumsym,typedconstsym,errorsym,syssym,
  235. labelsym,absolutesym,propertysym,funcretsym,
  236. macrosym,rttisym);
  237. { State of the variable, if it's declared, assigned or used }
  238. tvarstate=(vs_none,
  239. vs_declared,vs_declared_and_first_found,
  240. vs_set_but_first_not_passed,vs_assigned,vs_used
  241. );
  242. tvarspez = (vs_value,vs_const,vs_var,vs_out);
  243. targconvtyp = (act_convertable,act_equal,act_exact);
  244. absolutetyp = (tovar,toasm,toaddr);
  245. tconsttyp = (constnone,
  246. constord,conststring,constreal,constbool,
  247. constint,constchar,constset,constpointer,constnil,
  248. constresourcestring,constwstring,constwchar,constguid
  249. );
  250. { RTTI information to store }
  251. trttitype = (
  252. fullrtti,initrtti
  253. );
  254. {$ifdef GDB}
  255. type
  256. tdefstabstatus = (
  257. not_written,
  258. being_written,
  259. written);
  260. const
  261. tagtypes : Set of tdeftype =
  262. [recorddef,enumdef,
  263. {$IfNDef GDBKnowsStrings}
  264. stringdef,
  265. {$EndIf not GDBKnowsStrings}
  266. {$IfNDef GDBKnowsFiles}
  267. filedef,
  268. {$EndIf not GDBKnowsFiles}
  269. objectdef];
  270. {$endif GDB}
  271. const
  272. { relevant options for assigning a proc or a procvar to a procvar }
  273. po_compatibility_options = [
  274. po_classmethod,
  275. po_staticmethod,
  276. po_methodpointer,
  277. po_containsself,
  278. po_interrupt,
  279. po_iocheck,
  280. po_varargs,
  281. po_exports
  282. ];
  283. const
  284. SymTypeName : array[tsymtyp] of string[12] =
  285. ('abstractsym','variable','type','proc','unit',
  286. 'const','enum','typed const','errorsym','system sym',
  287. 'label','absolute','property','funcret',
  288. 'macrosym','rttisym');
  289. implementation
  290. end.
  291. {
  292. $Log$
  293. Revision 1.33 2002-07-01 16:23:54 peter
  294. * cg64 patch
  295. * basics for currency
  296. * asnode updates for class and interface (not finished)
  297. Revision 1.32 2002/05/18 13:34:18 peter
  298. * readded missing revisions
  299. Revision 1.31 2002/05/16 19:46:44 carl
  300. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  301. + try to fix temp allocation (still in ifdef)
  302. + generic constructor calls
  303. + start of tassembler / tmodulebase class cleanup
  304. Revision 1.30 2002/05/14 19:34:50 peter
  305. * removed old logs and updated copyright year
  306. Revision 1.29 2002/05/12 16:53:10 peter
  307. * moved entry and exitcode to ncgutil and cgobj
  308. * foreach gets extra argument for passing local data to the
  309. iterator function
  310. * -CR checks also class typecasts at runtime by changing them
  311. into as
  312. * fixed compiler to cycle with the -CR option
  313. * fixed stabs with elf writer, finally the global variables can
  314. be watched
  315. * removed a lot of routines from cga unit and replaced them by
  316. calls to cgobj
  317. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  318. u32bit then the other is typecasted also to u32bit without giving
  319. a rangecheck warning/error.
  320. * fixed pascal calling method with reversing also the high tree in
  321. the parast, detected by tcalcst3 test
  322. Revision 1.28 2002/01/06 12:08:15 peter
  323. * removed uauto from orddef, use new range_to_basetype generating
  324. the correct ordinal type for a range
  325. }