symconst.pas 13 KB

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