symconst.pas 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  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. uses
  22. globtype;
  23. const
  24. def_alignment = 4;
  25. { if you change one of the following contants, }
  26. { you have also to change the typinfo unit}
  27. { and the rtl/i386,template/rttip.inc files }
  28. tkUnknown = 0;
  29. tkInteger = 1;
  30. tkChar = 2;
  31. tkEnumeration = 3;
  32. tkFloat = 4;
  33. tkSet = 5;
  34. tkMethod = 6;
  35. tkSString = 7;
  36. tkString = tkSString;
  37. tkLString = 8;
  38. {$ifdef ansistring_bits}
  39. tkA32String = 9;
  40. {$else}
  41. tkAString = 9;
  42. {$endif}
  43. tkWString = 10;
  44. tkVariant = 11;
  45. tkArray = 12;
  46. tkRecord = 13;
  47. tkInterface= 14;
  48. tkClass = 15;
  49. tkObject = 16;
  50. tkWChar = 17;
  51. tkBool = 18;
  52. tkInt64 = 19;
  53. tkQWord = 20;
  54. tkDynArray = 21;
  55. tkInterfaceCorba = 22;
  56. {$ifdef ansistring_bits}
  57. tkA16string = 23;
  58. tkA64string = 24;
  59. {$endif}
  60. otSByte = 0;
  61. otUByte = 1;
  62. otSWord = 2;
  63. otUWord = 3;
  64. otSLong = 4;
  65. otULong = 5;
  66. ftSingle = 0;
  67. ftDouble = 1;
  68. ftExtended = 2;
  69. ftComp = 3;
  70. ftCurr = 4;
  71. ftFloat128 = 5;
  72. mkProcedure= 0;
  73. mkFunction = 1;
  74. mkConstructor = 2;
  75. mkDestructor = 3;
  76. mkClassProcedure= 4;
  77. mkClassFunction = 5;
  78. pfvar = 1;
  79. pfConst = 2;
  80. pfArray = 4;
  81. pfAddress = 8;
  82. pfReference= 16;
  83. pfOut = 32;
  84. unknown_level = 0;
  85. main_program_level = 1;
  86. normal_function_level = 2;
  87. type
  88. { Deref entry options }
  89. tdereftype = (deref_nil,
  90. deref_sym,
  91. deref_def,
  92. deref_aktrecord,
  93. deref_aktstatic,
  94. deref_aktglobal,
  95. deref_aktlocal,
  96. deref_aktpara,
  97. deref_unit,
  98. deref_record,
  99. deref_local,
  100. deref_para,
  101. deref_parent_object
  102. );
  103. { symbol options }
  104. tsymoption=(sp_none,
  105. sp_public,
  106. sp_private,
  107. sp_published,
  108. sp_protected,
  109. sp_static,
  110. sp_hint_deprecated,
  111. sp_hint_platform,
  112. sp_hint_library,
  113. sp_hint_unimplemented,
  114. sp_has_overloaded,
  115. sp_internal { internal symbol, not reported as unused }
  116. );
  117. tsymoptions=set of tsymoption;
  118. { flags for a definition }
  119. tdefoption=(df_none,
  120. { init data has been generated }
  121. df_has_inittable,
  122. { rtti data has been generated }
  123. df_has_rttitable,
  124. { type is unique, i.e. declared with type = type <tdef>; }
  125. df_unique
  126. );
  127. tdefoptions=set of tdefoption;
  128. { tsymlist entry types }
  129. tsltype = (sl_none,
  130. sl_load,
  131. sl_call,
  132. sl_subscript,
  133. sl_vec,
  134. sl_typeconv
  135. );
  136. { base types for orddef }
  137. tbasetype = (
  138. uvoid,
  139. u8bit,u16bit,u32bit,u64bit,
  140. s8bit,s16bit,s32bit,s64bit,
  141. bool8bit,bool16bit,bool32bit,
  142. uchar,uwidechar,scurrency
  143. );
  144. { float types }
  145. tfloattype = (
  146. s32real,s64real,s80real,
  147. s64comp,s64currency,s128real
  148. );
  149. { string types }
  150. tstringtype = (st_default,
  151. st_shortstring,
  152. st_longstring,
  153. {$ifndef ansistring_bits}
  154. st_ansistring,
  155. {$else}
  156. st_ansistring16,
  157. st_ansistring32,
  158. st_ansistring64,
  159. {$endif}
  160. st_widestring
  161. );
  162. { set types }
  163. tsettype = (
  164. normset,smallset,varset
  165. );
  166. tvarianttype = (
  167. vt_normalvariant,vt_olevariant
  168. );
  169. tcallercallee = (callerside,calleeside);
  170. { basic type for tprocdef and tprocvardef }
  171. tproctypeoption=(potype_none,
  172. potype_proginit, { Program initialization }
  173. potype_unitinit, { unit initialization }
  174. potype_unitfinalize, { unit finalization }
  175. potype_constructor, { Procedure is a constructor }
  176. potype_destructor, { Procedure is a destructor }
  177. potype_operator { Procedure defines an operator }
  178. );
  179. tproctypeoptions=set of tproctypeoption;
  180. { other options for tprocdef and tprocvardef }
  181. tprocoption=(po_none,
  182. po_classmethod, { class method }
  183. po_virtualmethod, { Procedure is a virtual method }
  184. po_abstractmethod, { Procedure is an abstract method }
  185. po_staticmethod, { static method }
  186. po_overridingmethod, { method with override directive }
  187. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  188. po_interrupt, { Procedure is an interrupt handler }
  189. po_iocheck, { IO checking should be done after a call to the procedure }
  190. po_assembler, { Procedure is written in assembler }
  191. po_msgstr, { method for string message handling }
  192. po_msgint, { method for int message handling }
  193. po_exports, { Procedure has export directive (needed for OS/2) }
  194. po_external, { Procedure is external (in other object or lib)}
  195. po_saveregisters, { save all registers }
  196. po_overload, { procedure is declared with overload directive }
  197. po_varargs, { printf like arguments }
  198. po_internconst, { procedure has constant evaluator intern }
  199. { flag that only the address of a method is returned and not a full methodpointer }
  200. po_addressonly,
  201. { procedure is exported }
  202. po_public,
  203. { calling convention is specified explicitly }
  204. po_hascallingconvention,
  205. { reintroduce flag }
  206. po_reintroduce,
  207. { location of parameters is given explicitly as it is necessary for some syscall
  208. conventions like that one of MorphOS }
  209. po_explicitparaloc,
  210. { no stackframe will be generated, used by lowlevel assembler like get_frame }
  211. po_nostackframe
  212. );
  213. tprocoptions=set of tprocoption;
  214. { options for objects and classes }
  215. tobjectdeftype = (odt_none,
  216. odt_class,
  217. odt_object,
  218. odt_interfacecom,
  219. odt_interfacecorba,
  220. odt_cppclass,
  221. odt_dispinterface
  222. );
  223. { options for objects and classes }
  224. tobjectoption=(oo_none,
  225. oo_is_forward, { the class is only a forward declared yet }
  226. oo_has_virtual, { the object/class has virtual methods }
  227. oo_has_private,
  228. oo_has_protected,
  229. oo_has_constructor, { the object/class has a constructor }
  230. oo_has_destructor, { the object/class has a destructor }
  231. oo_has_vmt, { the object/class has a vmt }
  232. oo_has_msgstr,
  233. oo_has_msgint,
  234. oo_can_have_published,{ the class has rtti, i.e. you can publish properties }
  235. oo_has_default_property
  236. );
  237. tobjectoptions=set of tobjectoption;
  238. { options for properties }
  239. tpropertyoption=(ppo_none,
  240. ppo_indexed,
  241. ppo_defaultproperty,
  242. ppo_stored,
  243. ppo_hasparameters,
  244. ppo_is_override
  245. );
  246. tpropertyoptions=set of tpropertyoption;
  247. { options for variables }
  248. tvaroption=(vo_none,
  249. vo_is_C_var,
  250. vo_is_external,
  251. vo_is_dll_var,
  252. vo_is_thread_var,
  253. vo_has_local_copy,
  254. vo_is_const, { variable is declared as const (parameter) and can't be written to }
  255. vo_is_exported,
  256. vo_is_high_value,
  257. vo_is_funcret,
  258. vo_is_self,
  259. vo_is_vmt,
  260. vo_is_result, { special result variable }
  261. vo_is_parentfp,
  262. vo_is_loop_counter { used to detect assignments to loop counter }
  263. );
  264. tvaroptions=set of tvaroption;
  265. { register variable }
  266. tvarregable=(vr_none,
  267. vr_intreg,
  268. vr_fpureg,
  269. vr_mmreg
  270. );
  271. { types of the symtables }
  272. tsymtabletype = (abstractsymtable,
  273. globalsymtable,staticsymtable,
  274. objectsymtable,recordsymtable,
  275. localsymtable,parasymtable,
  276. withsymtable,stt_exceptsymtable
  277. );
  278. { definition contains the informations about a type }
  279. tdeftype = (abstractdef,arraydef,recorddef,pointerdef,orddef,
  280. stringdef,enumdef,procdef,objectdef,errordef,
  281. filedef,formaldef,setdef,procvardef,floatdef,
  282. classrefdef,forwarddef,variantdef);
  283. { possible types for symtable entries }
  284. tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,
  285. constsym,enumsym,typedconstsym,errorsym,syssym,
  286. labelsym,absolutesym,propertysym,macrosym,rttisym);
  287. { State of the variable, if it's declared, assigned or used }
  288. tvarstate=(vs_none,
  289. vs_declared,vs_assigned,vs_used
  290. );
  291. tvarspez = (vs_value,vs_const,vs_var,vs_out);
  292. absolutetyp = (tovar,toasm,toaddr);
  293. tconsttyp = (constnone,
  294. constord,conststring,constreal,
  295. constset,constpointer,constnil,
  296. constresourcestring,constwstring,constguid
  297. );
  298. { RTTI information to store }
  299. trttitype = (
  300. fullrtti,initrtti
  301. );
  302. { The order is from low priority to high priority,
  303. Note: the operators > and < are used on this list }
  304. tequaltype = (
  305. te_incompatible,
  306. te_convert_operator,
  307. te_convert_l3, { compatible conversion with possible loss of data }
  308. te_convert_l2, { compatible less prefered conversion }
  309. te_convert_l1, { compatible conversion }
  310. te_equal, { the definitions are equal }
  311. te_exact
  312. );
  313. {$ifdef GDB}
  314. type
  315. tdefstabstatus = (
  316. stab_state_unused,
  317. stab_state_used,
  318. stab_state_writing,
  319. stab_state_written
  320. );
  321. const
  322. tagtypes : Set of tdeftype =
  323. [recorddef,enumdef,
  324. {$IfNDef GDBKnowsStrings}
  325. stringdef,
  326. {$EndIf not GDBKnowsStrings}
  327. {$IfNDef GDBKnowsFiles}
  328. filedef,
  329. {$EndIf not GDBKnowsFiles}
  330. objectdef];
  331. {$endif GDB}
  332. const
  333. savestdregs_pocalls = [
  334. pocall_cdecl,pocall_cppdecl,pocall_syscall,
  335. pocall_stdcall,pocall_safecall,pocall_compilerproc,
  336. pocall_register,pocall_softfloat
  337. ];
  338. clearstack_pocalls = [
  339. pocall_cdecl,pocall_cppdecl,pocall_syscall
  340. ];
  341. pushleftright_pocalls : tproccalloptions = [pocall_register,pocall_pascal];
  342. SymTypeName : array[tsymtyp] of string[12] = (
  343. 'abstractsym','variable','type','proc','unit',
  344. 'const','enum','typed const','errorsym','system sym',
  345. 'label','absolute','property','macrosym','rttisym'
  346. );
  347. DefTypeName : array[tdeftype] of string[12] = (
  348. 'abstractdef','arraydef','recorddef','pointerdef','orddef',
  349. 'stringdef','enumdef','procdef','objectdef','errordef',
  350. 'filedef','formaldef','setdef','procvardef','floatdef',
  351. 'classrefdef','forwarddef','variantdef'
  352. );
  353. EqualTypeName : array[tequaltype] of string[16] = (
  354. 'incompatible','convert_operator','convert_l3','convert_l2',
  355. 'convert_l1','equal','exact'
  356. );
  357. implementation
  358. initialization
  359. if pocall_default in [pocall_register,pocall_internproc] then
  360. include(pushleftright_pocalls,pocall_compilerproc);
  361. end.
  362. {
  363. $Log$
  364. Revision 1.89 2004-10-08 17:09:43 peter
  365. * tvarsym.varregable added, split vo_regable from varoptions
  366. Revision 1.88 2004/09/13 20:30:22 peter
  367. * vo_is_loop_counter added
  368. Revision 1.87 2004/08/25 15:57:04 peter
  369. * allow only 1 default property
  370. Revision 1.86 2004/07/09 22:17:32 peter
  371. * revert has_localst patch
  372. * replace aktstaticsymtable/aktglobalsymtable with current_module
  373. Revision 1.85 2004/07/06 19:52:04 peter
  374. * fix storing of localst in ppu
  375. Revision 1.84 2004/06/20 08:55:30 florian
  376. * logs truncated
  377. Revision 1.83 2004/06/16 20:07:09 florian
  378. * dwarf branch merged
  379. Revision 1.82 2004/05/23 14:32:17 peter
  380. * tprocinfoflag moved to globtype
  381. Revision 1.81 2004/04/29 19:56:37 daniel
  382. * Prepare compiler infrastructure for multiple ansistring types
  383. Revision 1.80 2004/04/28 15:19:03 florian
  384. + syscall directive support for MorphOS added
  385. Revision 1.79 2004/04/18 15:22:24 florian
  386. + location support for arguments, currently PowerPC/MorphOS only
  387. }