symconst.pas 13 KB

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