symconst.pas 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl, Pierre Muller
  3. Symbol table constants
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit symconst;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. globtype;
  22. const
  23. def_alignment = 4;
  24. { if you change one of the following contants, }
  25. { you have also to change the typinfo unit}
  26. { and the rtl/i386,template/rttip.inc files }
  27. tkUnknown = 0;
  28. tkInteger = 1;
  29. tkChar = 2;
  30. tkEnumeration = 3;
  31. tkFloat = 4;
  32. tkSet = 5;
  33. tkMethod = 6;
  34. tkSString = 7;
  35. tkString = tkSString;
  36. tkLString = 8;
  37. {$ifdef ansistring_bits}
  38. tkA32String = 9;
  39. {$else}
  40. tkAString = 9;
  41. {$endif}
  42. tkWString = 10;
  43. tkVariant = 11;
  44. tkArray = 12;
  45. tkRecord = 13;
  46. tkInterface= 14;
  47. tkClass = 15;
  48. tkObject = 16;
  49. tkWChar = 17;
  50. tkBool = 18;
  51. tkInt64 = 19;
  52. tkQWord = 20;
  53. tkDynArray = 21;
  54. tkInterfaceCorba = 22;
  55. {$ifdef ansistring_bits}
  56. tkA16string = 23;
  57. tkA64string = 24;
  58. {$endif}
  59. tkprocvar = 25;
  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. { implicit parameter positions, normal parameters start at 10
  88. and will increase with 10 for each parameter. The high parameters
  89. will be inserted with n+1 }
  90. paranr_parentfp = 1;
  91. paranr_result = 2;
  92. paranr_self = 3;
  93. paranr_vmt = 4;
  94. { Required to support variations of syscalls on MorphOS }
  95. paranr_syscall_basesysv = 9;
  96. paranr_syscall_sysvbase = high(word)-4;
  97. paranr_syscall_r12base = high(word)-3;
  98. paranr_syscall_legacy = high(word)-2;
  99. paranr_result_leftright = high(word)-1;
  100. type
  101. { keep this in sync with TIntfFlag in rtl/objpas/typinfo.pp }
  102. TCompilerIntfFlag = (ifHasGuid,ifDispInterface,ifDispatch,ifHasStrGUID);
  103. { Deref entry options }
  104. tdereftype = (deref_nil,
  105. deref_sym,
  106. deref_def,
  107. deref_aktrecord,
  108. deref_aktstatic,
  109. deref_aktglobal,
  110. deref_aktlocal,
  111. deref_aktpara,
  112. deref_unit,
  113. deref_record,
  114. deref_local,
  115. deref_para,
  116. deref_parent_object
  117. );
  118. { symbol options }
  119. tsymoption=(sp_none,
  120. sp_public,
  121. sp_private,
  122. sp_published,
  123. sp_protected,
  124. sp_static,
  125. sp_hint_deprecated,
  126. sp_hint_platform,
  127. sp_hint_library,
  128. sp_hint_unimplemented,
  129. sp_has_overloaded,
  130. sp_internal, { internal symbol, not reported as unused }
  131. sp_strictprivate,
  132. sp_strictprotected
  133. );
  134. tsymoptions=set of tsymoption;
  135. { flags for a definition }
  136. tdefoption=(df_none,
  137. { init data has been generated }
  138. df_has_inittable,
  139. { rtti data has been generated }
  140. df_has_rttitable,
  141. { type is unique, i.e. declared with type = type <tdef>; }
  142. df_unique
  143. );
  144. tdefoptions=set of tdefoption;
  145. { tsymlist entry types }
  146. tsltype = (sl_none,
  147. sl_load,
  148. sl_call,
  149. sl_subscript,
  150. sl_vec,
  151. sl_typeconv,
  152. sl_absolutetype
  153. );
  154. { base types for orddef }
  155. tbasetype = (
  156. uvoid,
  157. u8bit,u16bit,u32bit,u64bit,
  158. s8bit,s16bit,s32bit,s64bit,
  159. bool8bit,bool16bit,bool32bit,
  160. uchar,uwidechar,scurrency
  161. );
  162. { float types }
  163. tfloattype = (
  164. s32real,s64real,s80real,
  165. s64comp,s64currency,s128real
  166. );
  167. { string types }
  168. tstringtype = (st_default,
  169. st_shortstring,
  170. st_longstring,
  171. {$ifndef ansistring_bits}
  172. st_ansistring,
  173. {$else}
  174. st_ansistring16,
  175. st_ansistring32,
  176. st_ansistring64,
  177. {$endif}
  178. st_widestring
  179. );
  180. { set types }
  181. tsettype = (
  182. normset,smallset,varset
  183. );
  184. tvarianttype = (
  185. vt_normalvariant,vt_olevariant
  186. );
  187. tcallercallee = (callerside,calleeside);
  188. { basic type for tprocdef and tprocvardef }
  189. tproctypeoption=(potype_none,
  190. potype_proginit, { Program initialization }
  191. potype_unitinit, { unit initialization }
  192. potype_unitfinalize, { unit finalization }
  193. potype_constructor, { Procedure is a constructor }
  194. potype_destructor, { Procedure is a destructor }
  195. potype_operator, { Procedure defines an operator }
  196. potype_procedure,
  197. potype_function
  198. );
  199. tproctypeoptions=set of tproctypeoption;
  200. { other options for tprocdef and tprocvardef }
  201. tprocoption=(po_none,
  202. po_classmethod, { class method }
  203. po_virtualmethod, { Procedure is a virtual method }
  204. po_abstractmethod, { Procedure is an abstract method }
  205. po_staticmethod, { static method }
  206. po_overridingmethod, { method with override directive }
  207. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  208. po_interrupt, { Procedure is an interrupt handler }
  209. po_iocheck, { IO checking should be done after a call to the procedure }
  210. po_assembler, { Procedure is written in assembler }
  211. po_msgstr, { method for string message handling }
  212. po_msgint, { method for int message handling }
  213. po_exports, { Procedure has export directive (needed for OS/2) }
  214. po_external, { Procedure is external (in other object or lib)}
  215. po_overload, { procedure is declared with overload directive }
  216. po_varargs, { printf like arguments }
  217. po_internconst, { procedure has constant evaluator intern }
  218. { flag that only the address of a method is returned and not a full methodpointer }
  219. po_addressonly,
  220. { procedure is exported }
  221. po_public,
  222. { calling convention is specified explicitly }
  223. po_hascallingconvention,
  224. { reintroduce flag }
  225. po_reintroduce,
  226. { location of parameters is given explicitly as it is necessary for some syscall
  227. conventions like that one of MorphOS }
  228. po_explicitparaloc,
  229. { no stackframe will be generated, used by lowlevel assembler like get_frame }
  230. po_nostackframe,
  231. po_has_mangledname,
  232. po_has_public_name,
  233. po_forward,
  234. po_global,
  235. po_has_inlininginfo,
  236. { The different kind of syscalls on MorphOS }
  237. po_syscall_legacy,
  238. po_syscall_sysv,
  239. po_syscall_basesysv,
  240. po_syscall_sysvbase,
  241. po_syscall_r12base,
  242. po_local,
  243. { Procedure can be inlined }
  244. po_inline,
  245. { Procedure is used for internal compiler calls }
  246. po_compilerproc
  247. );
  248. tprocoptions=set of tprocoption;
  249. { options for objects and classes }
  250. tobjectdeftype = (odt_none,
  251. odt_class,
  252. odt_object,
  253. odt_interfacecom,
  254. odt_interfacecorba,
  255. odt_cppclass,
  256. odt_dispinterface
  257. );
  258. { options for objects and classes }
  259. tobjectoption=(oo_none,
  260. oo_is_forward, { the class is only a forward declared yet }
  261. oo_has_virtual, { the object/class has virtual methods }
  262. oo_has_private,
  263. oo_has_protected,
  264. oo_has_strictprivate,
  265. oo_has_strictprotected,
  266. oo_has_constructor, { the object/class has a constructor }
  267. oo_has_destructor, { the object/class has a destructor }
  268. oo_has_vmt, { the object/class has a vmt }
  269. oo_has_msgstr,
  270. oo_has_msgint,
  271. oo_can_have_published,{ the class has rtti, i.e. you can publish properties }
  272. oo_has_default_property
  273. );
  274. tobjectoptions=set of tobjectoption;
  275. { options for properties }
  276. tpropertyoption=(ppo_none,
  277. ppo_indexed,
  278. ppo_defaultproperty,
  279. ppo_stored,
  280. ppo_hasparameters,
  281. ppo_is_override
  282. );
  283. tpropertyoptions=set of tpropertyoption;
  284. { options for variables }
  285. tvaroption=(vo_none,
  286. vo_is_C_var,
  287. vo_is_external,
  288. vo_is_dll_var,
  289. vo_is_thread_var,
  290. vo_has_local_copy,
  291. vo_is_const, { variable is declared as const (parameter) and can't be written to }
  292. vo_is_exported,
  293. vo_is_high_para,
  294. vo_is_funcret,
  295. vo_is_self,
  296. vo_is_vmt,
  297. vo_is_result, { special result variable }
  298. vo_is_parentfp,
  299. vo_is_loop_counter, { used to detect assignments to loop counter }
  300. vo_is_hidden_para,
  301. vo_has_explicit_paraloc,
  302. vo_is_syscall_lib,
  303. vo_has_mangledname
  304. );
  305. tvaroptions=set of tvaroption;
  306. { register variable }
  307. tvarregable=(vr_none,
  308. vr_intreg,
  309. vr_fpureg,
  310. vr_mmreg
  311. );
  312. { types of the symtables }
  313. tsymtabletype = (abstractsymtable,
  314. globalsymtable,staticsymtable,
  315. objectsymtable,recordsymtable,
  316. localsymtable,parasymtable,
  317. withsymtable,stt_exceptsymtable,
  318. exportedmacrosymtable, localmacrosymtable
  319. );
  320. { definition contains the informations about a type }
  321. tdeftype = (abstractdef,arraydef,recorddef,pointerdef,orddef,
  322. stringdef,enumdef,procdef,objectdef,errordef,
  323. filedef,formaldef,setdef,procvardef,floatdef,
  324. classrefdef,forwarddef,variantdef);
  325. { possible types for symtable entries }
  326. tsymtyp = (abstractsym,globalvarsym,localvarsym,paravarsym,fieldvarsym,
  327. typesym,procsym,unitsym,constsym,enumsym,typedconstsym,
  328. errorsym,syssym,labelsym,absolutevarsym,propertysym,
  329. macrosym,rttisym);
  330. { State of the variable, if it's declared, assigned or used }
  331. tvarstate=(vs_none,
  332. vs_declared,vs_assigned,vs_used
  333. );
  334. tvarspez = (vs_value,vs_const,vs_var,vs_out);
  335. absolutetyp = (tovar,toasm,toaddr);
  336. tconsttyp = (constnone,
  337. constord,conststring,constreal,
  338. constset,constpointer,constnil,
  339. constresourcestring,constwstring,constguid
  340. );
  341. { RTTI information to store }
  342. trttitype = (
  343. fullrtti,initrtti
  344. );
  345. { The order is from low priority to high priority,
  346. Note: the operators > and < are used on this list }
  347. tequaltype = (
  348. te_incompatible,
  349. te_convert_operator,
  350. te_convert_l3, { compatible conversion with possible loss of data }
  351. te_convert_l2, { compatible less prefered conversion }
  352. te_convert_l1, { compatible conversion }
  353. te_equal, { the definitions are equal }
  354. te_exact
  355. );
  356. {$ifdef GDB}
  357. type
  358. tdefstabstatus = (
  359. stab_state_unused,
  360. stab_state_used,
  361. stab_state_writing,
  362. stab_state_written
  363. );
  364. const
  365. tagtypes : Set of tdeftype =
  366. [recorddef,enumdef,
  367. {$IfNDef GDBKnowsStrings}
  368. stringdef,
  369. {$EndIf not GDBKnowsStrings}
  370. {$IfNDef GDBKnowsFiles}
  371. filedef,
  372. {$EndIf not GDBKnowsFiles}
  373. objectdef];
  374. {$endif GDB}
  375. const
  376. inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has_protected,
  377. oo_has_strictprotected,oo_has_strictprivate,oo_has_constructor,oo_has_destructor];
  378. clearstack_pocalls = [
  379. pocall_cdecl,pocall_cppdecl,pocall_syscall
  380. ];
  381. pushleftright_pocalls : tproccalloptions = [pocall_register,pocall_pascal,pocall_mwpascal];
  382. SymTypeName : array[tsymtyp] of string[12] = (
  383. 'abstractsym','globalvar','localvar','paravar','fieldvar',
  384. 'type','proc','unit','const','enum','typed const',
  385. 'errorsym','system sym','label','absolutevar','property',
  386. 'macrosym','rttisym'
  387. );
  388. DefTypeName : array[tdeftype] of string[12] = (
  389. 'abstractdef','arraydef','recorddef','pointerdef','orddef',
  390. 'stringdef','enumdef','procdef','objectdef','errordef',
  391. 'filedef','formaldef','setdef','procvardef','floatdef',
  392. 'classrefdef','forwarddef','variantdef'
  393. );
  394. EqualTypeName : array[tequaltype] of string[16] = (
  395. 'incompatible','convert_operator','convert_l3','convert_l2',
  396. 'convert_l1','equal','exact'
  397. );
  398. implementation
  399. end.