symconst.pas 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  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. mac68k_alignment = -3;
  27. { if you change one of the following contants, }
  28. { you have also to change the typinfo unit}
  29. { and the rtl/i386,template/rttip.inc files }
  30. tkUnknown = 0;
  31. tkInteger = 1;
  32. tkChar = 2;
  33. tkEnumeration = 3;
  34. tkFloat = 4;
  35. tkSet = 5;
  36. tkMethod = 6;
  37. tkSString = 7;
  38. tkString = tkSString;
  39. tkLString = 8;
  40. tkAString = 9;
  41. tkWString = 10;
  42. tkVariant = 11;
  43. tkArray = 12;
  44. tkRecord = 13;
  45. tkInterface= 14;
  46. tkClass = 15;
  47. tkObject = 16;
  48. tkWChar = 17;
  49. tkBool = 18;
  50. tkInt64 = 19;
  51. tkQWord = 20;
  52. tkDynArray = 21;
  53. tkInterfaceCorba = 22;
  54. tkProcVar = 23;
  55. tkUString = 24;
  56. tkUChar = 25;
  57. tkHelper = 26;
  58. tkFile = 27;
  59. tkClassRef = 28;
  60. tkPointer = 29;
  61. otSByte = 0;
  62. otUByte = 1;
  63. otSWord = 2;
  64. otUWord = 3;
  65. otSLong = 4;
  66. otULong = 5;
  67. otSLongLong = 6;
  68. otULongLong = 7;
  69. ftSingle = 0;
  70. ftDouble = 1;
  71. ftExtended = 2;
  72. ftComp = 3;
  73. ftCurr = 4;
  74. ftFloat128 = 5;
  75. mkProcedure = 0;
  76. mkFunction = 1;
  77. mkConstructor = 2;
  78. mkDestructor = 3;
  79. mkClassProcedure = 4;
  80. mkClassFunction = 5;
  81. mkClassConstructor = 6;
  82. mkClassDestructor = 7;
  83. mkOperatorOverload = 8;
  84. // delphi has the next too:
  85. //mkSafeProcedure = 9;
  86. //mkSafeFunction = 10;
  87. pfvar = 1;
  88. pfConst = 2;
  89. pfArray = 4;
  90. pfAddress = 8;
  91. pfReference= 16;
  92. pfOut = 32;
  93. pfConstRef = 64;
  94. unknown_level = 0;
  95. main_program_level = 1;
  96. normal_function_level = 2;
  97. { implicit parameter positions, normal parameters start at 10
  98. and will increase with 10 for each parameter. The high parameters
  99. will be inserted with n+1 }
  100. paranr_blockselfpara = 1;
  101. paranr_parentfp = 2;
  102. paranr_parentfp_delphi_cc_leftright = 2;
  103. {$ifndef aarch64}
  104. paranr_self = 3;
  105. paranr_result = 4;
  106. {$else aarch64}
  107. { on AArch64, the result parameter is passed in a special register, so its
  108. order doesn't really matter -- except for LLVM, where the "sret" parameter
  109. must always be the first -> give it a higher number; can't do it for other
  110. platforms, because that would change the register assignment/parameter order
  111. and the current one is presumably Delphi-compatible }
  112. paranr_result = 3;
  113. paranr_self = 4;
  114. {$endif aarch64}
  115. paranr_vmt = 5;
  116. { the implicit parameters for Objective-C methods need to come
  117. after the hidden result parameter }
  118. paranr_objc_self = 5;
  119. paranr_objc_cmd = 6;
  120. { Required to support variations of syscalls on MorphOS }
  121. paranr_syscall_basesysv = 9;
  122. paranr_syscall_sysvbase = high(word)-5;
  123. paranr_syscall_r12base = high(word)-4;
  124. paranr_syscall_legacy = high(word)-3;
  125. paranr_result_leftright = high(word)-2;
  126. paranr_parentfp_delphi_cc = high(word)-1;
  127. { prefix for names of class helper procsyms added to regular symtables }
  128. class_helper_prefix = 'CH$';
  129. { tsym.symid value in case the sym has not yet been registered }
  130. symid_not_registered = -2;
  131. { tsym.symid value in case the sym has been registered, but not put in a
  132. symtable }
  133. symid_registered_nost = -1;
  134. { tdef.defid value in case the def has not yet been registered }
  135. defid_not_registered = -2;
  136. { tdef.defid value in case the sym has been registered, but not put in a
  137. symtable }
  138. defid_registered_nost = -1;
  139. type
  140. { keep this in sync with TIntfFlag in rtl/objpas/typinfo.pp }
  141. TCompilerIntfFlag = (ifHasGuid,ifDispInterface,ifDispatch,ifHasStrGUID);
  142. { Deref entry options }
  143. tdereftype = (deref_nil,
  144. deref_unit,
  145. deref_symid,
  146. deref_defid
  147. );
  148. { symbol visibility }
  149. tvisibility=(
  150. vis_hidden,
  151. vis_strictprivate,
  152. vis_private,
  153. vis_strictprotected,
  154. vis_protected,
  155. vis_public,
  156. vis_published,
  157. vis_none
  158. );
  159. { symbol options }
  160. tsymoption=(sp_none,
  161. sp_static, { static symbol in class/object/record }
  162. sp_hint_deprecated,
  163. sp_hint_platform,
  164. sp_hint_library,
  165. sp_hint_unimplemented,
  166. sp_has_overloaded,
  167. sp_internal, { internal symbol, not reported as unused }
  168. sp_implicitrename,
  169. sp_hint_experimental,
  170. sp_generic_para,
  171. sp_has_deprecated_msg,
  172. sp_generic_dummy, { this is used for symbols that are generated when a
  173. generic is encountered to ease inline
  174. specializations, etc; those symbols can be
  175. "overridden" with a completely different symbol }
  176. sp_explicitrename { this is used to keep track of type renames created
  177. by the user }
  178. );
  179. tsymoptions=set of tsymoption;
  180. { flags for a definition }
  181. tdefoption=(df_none,
  182. { type is unique, i.e. declared with type = type <tdef>; }
  183. df_unique,
  184. { type is a generic }
  185. df_generic,
  186. { type is a specialization of a generic type }
  187. df_specialization,
  188. { def has been copied from another def so symtable is not owned }
  189. df_copied_def,
  190. { def was created as a generic constraint and thus is only "shallow" }
  191. df_genconstraint
  192. );
  193. tdefoptions=set of tdefoption;
  194. tdefstate=(ds_none,
  195. ds_vmt_written,
  196. ds_rtti_table_used,
  197. ds_init_table_used,
  198. ds_rtti_table_written,
  199. ds_init_table_written,
  200. ds_dwarf_dbg_info_used,
  201. ds_dwarf_dbg_info_written
  202. );
  203. tdefstates=set of tdefstate;
  204. { flags for generic type constraints }
  205. tgenericconstraintflag=(gcf_none,
  206. gcf_constructor, { specialization type needs to have a constructor }
  207. gcf_class, { specialization type needs to be a class }
  208. gcf_record { specialization type needs to be a record type }
  209. );
  210. tgenericconstraintflags=set of tgenericconstraintflag;
  211. { tsymlist entry types }
  212. tsltype = (sl_none,
  213. sl_load,
  214. sl_call,
  215. sl_subscript,
  216. sl_vec,
  217. sl_typeconv,
  218. sl_absolutetype
  219. );
  220. { base types for orddef }
  221. tordtype = (
  222. uvoid,
  223. u8bit,u16bit,u32bit,u64bit,
  224. s8bit,s16bit,s32bit,s64bit,
  225. pasbool8,pasbool16,pasbool32,pasbool64,
  226. bool8bit,bool16bit,bool32bit,bool64bit,
  227. uchar,uwidechar,scurrency
  228. );
  229. tordtypeset = set of tordtype;
  230. { string types }
  231. tstringtype = (
  232. st_shortstring,
  233. st_longstring,
  234. st_ansistring,
  235. st_widestring,
  236. st_unicodestring
  237. );
  238. tvarianttype = (
  239. vt_normalvariant,vt_olevariant
  240. );
  241. tcallercallee = (callnoside,callerside,calleeside,callbothsides);
  242. { basic type for tprocdef and tprocvardef }
  243. tproctypeoption=(potype_none,
  244. potype_proginit, { Program initialization }
  245. potype_unitinit, { unit initialization }
  246. potype_unitfinalize, { unit finalization }
  247. potype_constructor, { Procedure is a constructor }
  248. potype_destructor, { Procedure is a destructor }
  249. potype_operator, { Procedure defines an operator }
  250. potype_procedure,
  251. potype_function,
  252. potype_class_constructor, { class constructor }
  253. potype_class_destructor, { class destructor }
  254. potype_propgetter, { Dispinterface property accessors }
  255. potype_propsetter,
  256. potype_exceptfilter, { SEH exception filter or termination handler }
  257. potype_mainstub { "main" function that calls through to FPC_SYSTEMMAIN }
  258. );
  259. tproctypeoptions=set of tproctypeoption;
  260. { other options for tprocdef and tprocvardef }
  261. tprocoption=(po_none,
  262. po_classmethod, { class method }
  263. po_virtualmethod, { Procedure is a virtual method }
  264. po_abstractmethod, { Procedure is an abstract method }
  265. po_finalmethod, { Procedure is a final method }
  266. po_staticmethod, { static method }
  267. po_overridingmethod, { method with override directive }
  268. po_methodpointer, { method pointer, only in procvardef, also used for 'with object do' }
  269. po_interrupt, { Procedure is an interrupt handler }
  270. po_iocheck, { IO checking should be done after a call to the procedure }
  271. po_assembler, { Procedure is written in assembler }
  272. po_msgstr, { method for string message handling }
  273. po_msgint, { method for int message handling }
  274. po_exports, { Procedure has export directive (needed for OS/2) }
  275. po_external, { Procedure is external (in other object or lib)}
  276. po_overload, { procedure is declared with overload directive }
  277. po_varargs, { printf like arguments }
  278. po_internconst, { procedure has constant evaluator intern }
  279. { flag that only the address of a method is returned and not a full methodpointer }
  280. po_addressonly,
  281. { procedure is exported }
  282. po_public,
  283. { calling convention is specified explicitly }
  284. po_hascallingconvention,
  285. { reintroduce flag }
  286. po_reintroduce,
  287. { location of parameters is given explicitly as it is necessary for some syscall
  288. conventions like that one of MorphOS }
  289. po_explicitparaloc,
  290. { no stackframe will be generated, used by lowlevel assembler like get_frame }
  291. po_nostackframe,
  292. po_has_mangledname,
  293. po_has_public_name,
  294. po_forward,
  295. po_global,
  296. { The different kind of syscalls on MorphOS }
  297. po_syscall_legacy,
  298. po_syscall_sysv,
  299. po_syscall_basesysv,
  300. po_syscall_sysvbase,
  301. po_syscall_r12base,
  302. { Used to record the fact that a symbol is asociated to this syscall }
  303. po_syscall_has_libsym,
  304. { Procedure can be inlined }
  305. po_inline,
  306. { Procedure is used for internal compiler calls }
  307. po_compilerproc,
  308. { importing }
  309. po_has_importdll,
  310. po_has_importname,
  311. po_kylixlocal,
  312. po_dispid,
  313. { weakly linked (i.e., may or may not exist at run time) }
  314. po_weakexternal,
  315. { Objective-C method }
  316. po_objc,
  317. { enumerator support }
  318. po_enumerator_movenext,
  319. { optional Objective-C protocol method }
  320. po_optional,
  321. { nested procedure that uses Delphi-style calling convention for passing
  322. the frame pointer (pushed on the stack, always the last parameter,
  323. removed by the caller). Required for nested procvar compatibility,
  324. because such procvars can hold both regular and nested procedures
  325. (when calling a regular procedure using the above convention, it will
  326. simply not see the frame pointer parameter, and since the caller cleans
  327. up the stack will also remain balanced) }
  328. po_delphi_nested_cc,
  329. { allows the routine's RawByteString var/out parameters to accept parameters
  330. that do not match exactly (without typeconversion) }
  331. po_rtlproc,
  332. { Non-virtual method of a Java class that has been transformed into a
  333. "virtual; final;" method for JVM-implementation reasons }
  334. po_java_nonvirtual,
  335. { automatically inherited routine from parent class, ignore for resolving
  336. overloads (on the JVM target, constructors are not automatically
  337. inherited, so we explicitly have to add the constructors of the parent
  338. class to the child class; this influences the overload resolution logic
  339. though, so ignore them there) }
  340. po_ignore_for_overload_resolution,
  341. { the visibility of of this procdef was raised automatically by the
  342. compiler, e.g. because it was designated as a getter/setter for a property
  343. with a higher visibility on the JVM target }
  344. po_auto_raised_visibility,
  345. { procedure is far (x86 only) }
  346. po_far,
  347. { the procedure never returns, this information is usefull for dfa }
  348. po_noreturn,
  349. { procvar is a function reference }
  350. po_is_function_ref,
  351. { procvar is a block (http://en.wikipedia.org/wiki/Blocks_(C_language_extension) ) }
  352. po_is_block
  353. );
  354. tprocoptions=set of tprocoption;
  355. { options that should not trigger the recompilation of a unit if they change
  356. between the interface and the implementation }
  357. timplprocoption = (
  358. { the routine contains no code }
  359. pio_empty,
  360. { the inline body of this routine is available }
  361. pio_has_inlininginfo
  362. );
  363. timplprocoptions = set of timplprocoption;
  364. { kinds of synthetic procdefs that can be generated }
  365. tsynthetickind = (
  366. tsk_none,
  367. tsk_anon_inherited, // anonymous inherited call
  368. tsk_jvm_clone, // Java-style clone method
  369. tsk_record_deepcopy, // deepcopy for records field by field
  370. tsk_record_initialize, // initialize for records field by field (explicit rather than via rtti)
  371. tsk_empty, // an empty routine
  372. tsk_tcinit, // initialisation of typed constants
  373. tsk_callthrough, // call through to another routine with the same parameters/return type (its def is stored in the skpara field)
  374. tsk_callthrough_nonabstract,// call through to another routine if the current class not abstract (otherwise do the same as tsk_empty)
  375. tsk_jvm_enum_values, // Java "values" class method of JLEnum descendants
  376. tsk_jvm_enum_valueof, // Java "valueOf" class method of JLEnum descendants
  377. tsk_jvm_enum_classconstr, // Java class constructor for JLEnum descendants
  378. tsk_jvm_enum_jumps_constr, // Java constructor for JLEnum descendants for enums with jumps
  379. tsk_jvm_enum_fpcordinal, // Java FPCOrdinal function that returns the enum's ordinal value from an FPC POV
  380. tsk_jvm_enum_fpcvalueof, // Java FPCValueOf function that returns the enum instance corresponding to an ordinal from an FPC POV
  381. tsk_jvm_enum_long2set, // Java fpcLongToEnumSet function that returns an enumset corresponding to a bit pattern in a jlong
  382. tsk_jvm_enum_bitset2set, // Java fpcBitSetToEnumSet function that returns an enumset corresponding to a BitSet
  383. tsk_jvm_enum_set2Set, // Java fpcEnumSetToEnumSet function that returns an enumset corresponding to another enumset (different enum kind)
  384. tsk_jvm_procvar_invoke, // Java invoke method that calls a wrapped procvar
  385. tsk_jvm_procvar_intconstr, // Java procvar class constructor that accepts an interface instance for easy Java interoperation
  386. tsk_jvm_virtual_clmethod, // Java wrapper for virtual class method
  387. tsk_field_getter, // getter for a field (callthrough property is passed in skpara)
  388. tsk_field_setter, // Setter for a field (callthrough property is passed in skpara)
  389. tsk_block_invoke_procvar, // Call a procvar to invoke inside a block
  390. tsk_interface_wrapper // Call through to a method from an interface wrapper
  391. );
  392. { synthetic procdef supplementary information (tprocdef.skpara) }
  393. tskpara_interface_wrapper = record
  394. pd: pointer;
  395. offset: longint;
  396. end;
  397. pskpara_interface_wrapper = ^tskpara_interface_wrapper;
  398. { options for objects and classes }
  399. tobjecttyp = (odt_none,
  400. odt_class,
  401. odt_object,
  402. odt_interfacecom,
  403. odt_interfacecom_property,
  404. odt_interfacecom_function,
  405. odt_interfacecorba,
  406. odt_cppclass,
  407. odt_dispinterface,
  408. odt_objcclass,
  409. odt_objcprotocol,
  410. odt_objccategory, { note that these are changed into odt_class afterwards }
  411. odt_helper,
  412. odt_javaclass,
  413. odt_interfacejava
  414. );
  415. { defines the type of the extended "structure"; only used for parsing }
  416. thelpertype=(ht_none,
  417. ht_class,
  418. ht_record,
  419. ht_type
  420. );
  421. { Variations in interfaces implementation }
  422. { Beware, this data is duplicated in the compiler and rtl. }
  423. { Do not change the order of the fields. }
  424. tinterfaceentrytype = (etStandard,
  425. etVirtualMethodResult,
  426. etStaticMethodResult,
  427. etFieldValue,
  428. etVirtualMethodClass,
  429. etStaticMethodClass,
  430. etFieldValueClass
  431. );
  432. { options for objects and classes }
  433. tobjectoption=(oo_none,
  434. oo_is_forward, { the class is only a forward declared yet }
  435. oo_is_abstract, { the class is abstract - only descendants can be used }
  436. oo_is_sealed, { the class is sealed - can't have descendants }
  437. oo_has_virtual, { the object/class has virtual methods }
  438. oo_has_private,
  439. oo_has_protected,
  440. oo_has_strictprivate,
  441. oo_has_strictprotected,
  442. oo_has_constructor, { the object/class has a constructor }
  443. oo_has_destructor, { the object/class has a destructor }
  444. oo_has_vmt, { the object/class has a vmt }
  445. oo_has_msgstr,
  446. oo_has_msgint,
  447. oo_can_have_published,{ the class has rtti, i.e. you can publish properties }
  448. oo_has_default_property,
  449. oo_has_valid_guid,
  450. oo_has_enumerator_movenext,
  451. oo_has_enumerator_current,
  452. oo_is_external, { the class is externally implemented (objcclass, cppclass) }
  453. oo_is_formal, { the class is only formally defined in this module (x = objcclass; external [name 'x'];) }
  454. oo_is_classhelper, { objcclasses that represent categories, and Delpi-style class helpers, are marked like this }
  455. oo_has_class_constructor, { the object/class has a class constructor }
  456. oo_has_class_destructor, { the object/class has a class destructor }
  457. oo_is_enum_class, { the class represents an enum (JVM) }
  458. oo_has_new_destructor { the object/class declares a destructor (apart from potentially inherting one from the parent) }
  459. );
  460. tobjectoptions=set of tobjectoption;
  461. tarraydefoption=(
  462. ado_IsConvertedPointer, // array created from pointer (e.g. PInteger(Ptr)[1])
  463. ado_IsDynamicArray, // dynamic array
  464. ado_IsVariant, //
  465. ado_IsConstructor, // array constructor (e.g. something = [1,2,3])
  466. ado_IsArrayOfConst, // array of const
  467. ado_IsConstString, // string constant
  468. ado_IsBitPacked // bitpacked array
  469. );
  470. tarraydefoptions=set of tarraydefoption;
  471. { options for properties }
  472. tpropertyoption=(ppo_none,
  473. ppo_indexed, { delcared wwith "index" keyword }
  474. ppo_defaultproperty,
  475. ppo_stored,
  476. ppo_hasparameters, { has parameters: prop[param1, param2: type] }
  477. ppo_implements,
  478. ppo_enumerator_current, { implements current property for enumerator }
  479. ppo_overrides, { overrides ancestor property }
  480. ppo_dispid_write { no longer used }
  481. );
  482. tpropertyoptions=set of tpropertyoption;
  483. { options for variables }
  484. tvaroption=(vo_none,
  485. vo_is_external,
  486. vo_is_dll_var,
  487. vo_is_thread_var,
  488. vo_has_local_copy,
  489. vo_is_const, { variable is declared as const (parameter) and can't be written to }
  490. vo_is_public,
  491. vo_is_high_para,
  492. vo_is_funcret,
  493. vo_is_self,
  494. vo_is_vmt,
  495. vo_is_result, { special result variable }
  496. vo_is_parentfp,
  497. vo_is_loop_counter, { used to detect assignments to loop counter }
  498. vo_is_hidden_para,
  499. vo_has_explicit_paraloc,
  500. vo_is_syscall_lib,
  501. vo_has_mangledname,
  502. vo_is_typed_const,
  503. vo_is_range_check,
  504. vo_is_overflow_check,
  505. vo_is_typinfo_para,
  506. vo_is_weak_external,
  507. { Objective-C message selector parameter }
  508. vo_is_msgsel,
  509. { first field of variant part of a record }
  510. vo_is_first_field,
  511. vo_volatile,
  512. vo_has_section,
  513. { variable contains a winlike WideString which should be finalized
  514. even in $J- state }
  515. vo_force_finalize,
  516. { this is an internal variable that is used for Default() intrinsic in code
  517. sections }
  518. vo_is_default_var
  519. );
  520. tvaroptions=set of tvaroption;
  521. { register variable }
  522. tvarregable=(vr_none,
  523. vr_intreg,
  524. vr_fpureg,
  525. vr_mmreg,
  526. { does not mean "needs address register", but "if it's a parameter which is }
  527. { passed by reference, then its address can be put in a register }
  528. vr_addr
  529. );
  530. { types of the symtables }
  531. TSymtabletype = (
  532. abstractsymtable, { not a real symtable }
  533. globalsymtable, { unit interface symtable }
  534. staticsymtable, { unit implementation symtable }
  535. ObjectSymtable, { object symtable }
  536. recordsymtable, { record symtable }
  537. localsymtable, { subroutine symtable }
  538. parasymtable, { arguments symtable }
  539. withsymtable, { with operator symtable }
  540. stt_excepTSymtable, { try/except symtable }
  541. exportedmacrosymtable, { }
  542. localmacrosymtable, { }
  543. enumsymtable, { symtable for enum members }
  544. arraysymtable { used to store parameterised type
  545. in array }
  546. );
  547. { options for symtables }
  548. tsymtableoption = (
  549. sto_has_helper, { contains at least one helper symbol }
  550. sto_has_generic, { contains at least one generic symbol }
  551. sto_has_operator, { contains at least one operator overload }
  552. sto_needs_init_final { the symtable needs initialization and/or
  553. finalization of variables/constants }
  554. );
  555. tsymtableoptions = set of tsymtableoption;
  556. { definition contains the informations about a type }
  557. tdeftyp = (abstractdef,
  558. arraydef,recorddef,pointerdef,orddef,
  559. stringdef,enumdef,procdef,objectdef,errordef,
  560. filedef,formaldef,setdef,procvardef,floatdef,
  561. classrefdef,forwarddef,variantdef,undefineddef
  562. );
  563. { possible types for symtable entries }
  564. tsymtyp = (abstractsym,
  565. staticvarsym,localvarsym,paravarsym,fieldvarsym,
  566. typesym,procsym,unitsym,constsym,enumsym,
  567. errorsym,syssym,labelsym,absolutevarsym,propertysym,
  568. macrosym,namespacesym,undefinedsym,programparasym
  569. );
  570. { State of the variable:
  571. vs_declared: variable has been declared, not initialised
  572. (e.g. normal variable, out parameter)
  573. vs_initialised: variable has been declared and is valid
  574. (e.g. typed constant, var/const parameter)
  575. vs_read: variable has been read and the read was checked for validity
  576. (so a warning has been given if necessary)
  577. vs_read_not_warned: variable has been read, but we didn't warn about
  578. whether or not the variable was valid
  579. (e.g. read of global variable -> warn at end of compilation unit if
  580. the state is vs_read_not_warned, since that means it's only read and
  581. never written)
  582. vs_referred_not_inited: variable has been used in length/low/high/@/...
  583. expression, was not yet initialised and needn't be at that time
  584. (e.g. length() of a statically allocated array, or sizeof(variable))
  585. vs_written: variable has been assigned/written to, but not yet read
  586. (e.g. assigning something to a variable/parameter)
  587. vs_readwritten: variable has been written to and read from }
  588. tvarstate=(vs_none,
  589. vs_declared,vs_initialised,vs_read,vs_read_not_warned,
  590. vs_referred_not_inited,vs_written,vs_readwritten
  591. );
  592. tvarspez = (vs_value,vs_const,vs_var,vs_out,vs_constref,vs_final);
  593. absolutetyp = (tovar,toasm,toaddr);
  594. tconsttyp = (constnone,
  595. constord,conststring,constreal,
  596. constset,constpointer,constnil,
  597. constresourcestring,constwstring,constguid
  598. );
  599. { RTTI information to store }
  600. trttitype = (
  601. fullrtti,initrtti,
  602. { Objective-C }
  603. objcmetartti,objcmetarortti,
  604. objcclassrtti,objcclassrortti
  605. );
  606. { prefixes for internally generated type names (centralised to avoid
  607. accidental collisions) }
  608. tinternaltypeprefix = (
  609. itp_1byte,
  610. itp_llvmstruct,
  611. itp_vmtdef,
  612. itp_vmt_tstringmesssagetable,
  613. itp_vmt_msgint_table_entries,
  614. itp_vmt_tmethod_name_table,
  615. itp_vmt_intern_msgint_table,
  616. itp_vmt_intern_tmethodnamerec,
  617. itp_vmt_intern_tmethodnametable,
  618. itp_rttidef,
  619. itp_rtti_header,
  620. itp_rtti_prop,
  621. itp_rtti_ansistr,
  622. itp_rtti_ord_outer,
  623. itp_rtti_ord_inner,
  624. itp_rtti_ord_64bit,
  625. itp_rtti_normal_array,
  626. itp_rtti_dyn_array,
  627. itp_rtti_proc_param,
  628. itp_threadvar_record
  629. );
  630. { The order is from low priority to high priority,
  631. Note: the operators > and < are used on this list }
  632. tequaltype = (
  633. te_incompatible,
  634. te_convert_operator,
  635. te_convert_l6,
  636. te_convert_l5, { ad infinitum... }
  637. te_convert_l4, { and yet even less preferred conversion }
  638. te_convert_l3, { even less preferred conversion (possibly with loss of data) }
  639. te_convert_l2, { compatible less preferred conversion }
  640. te_convert_l1, { compatible conversion }
  641. te_equal, { the definitions are equal }
  642. te_exact
  643. );
  644. tvariantequaltype = (
  645. tve_incompatible,
  646. tve_chari64,
  647. tve_sstring,
  648. tve_astring,
  649. tve_wstring,
  650. tve_ustring,
  651. tve_boolformal,
  652. tve_extended,
  653. tve_dblcurrency,
  654. tve_single,
  655. tve_cardinal,
  656. tve_longint,
  657. tve_smallint,
  658. tve_word,
  659. tve_shortint,
  660. tve_byte
  661. );
  662. tvariantequaltypes = set of tvariantequaltype;
  663. tdefdbgstatus = (
  664. dbg_state_unused,
  665. dbg_state_used,
  666. dbg_state_writing,
  667. dbg_state_written,
  668. dbg_state_queued
  669. );
  670. tx86pointertyp = (x86pt_near, x86pt_near_cs, x86pt_near_ds, x86pt_near_ss,
  671. x86pt_near_es, x86pt_near_fs, x86pt_near_gs, x86pt_far, x86pt_huge);
  672. var
  673. clearstack_pocalls : tproccalloptions;
  674. cdecl_pocalls : tproccalloptions;
  675. const
  676. {$ifndef jvm}
  677. inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has_protected,
  678. oo_has_strictprotected,oo_has_strictprivate,oo_has_constructor,oo_has_destructor,
  679. oo_can_have_published];
  680. {$else not jvm}
  681. { constructors are not inherited in Java }
  682. inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has_protected,
  683. oo_has_strictprotected,oo_has_strictprivate,oo_has_destructor,
  684. oo_can_have_published];
  685. {$endif not jvm}
  686. {$ifdef i386}
  687. { we only take this into account on i386, on other platforms we always
  688. push in the same order
  689. }
  690. pushleftright_pocalls : tproccalloptions = [pocall_register,pocall_pascal];
  691. {$endif}
  692. {$ifdef i8086}
  693. { we only take this into account on i386, on other platforms we always
  694. push in the same order
  695. }
  696. pushleftright_pocalls : tproccalloptions = [pocall_register,pocall_pascal];
  697. {$endif}
  698. SymTypeName : array[tsymtyp] of string[14] = (
  699. 'abstractsym','globalvar','localvar','paravar','fieldvar',
  700. 'type','proc','unit','const','enum',
  701. 'errorsym','system sym','label','absolutevar','property',
  702. 'macrosym','namespace','undefinedsym','programparasym'
  703. );
  704. typName : array[tdeftyp] of string[12] = (
  705. 'abstractdef','arraydef','recorddef','pointerdef','orddef',
  706. 'stringdef','enumdef','procdef','objectdef','errordef',
  707. 'filedef','formaldef','setdef','procvardef','floatdef',
  708. 'classrefdef','forwarddef','variantdef','undefineddef'
  709. );
  710. EqualTypeName : array[tequaltype] of string[16] = (
  711. 'incompatible','convert_operator','convert_l6', 'convert_l5','convert_l4','convert_l3',
  712. 'convert_l2','convert_l1','equal','exact'
  713. );
  714. visibilityName : array[tvisibility] of string[16] = (
  715. 'hidden','strict private','private','strict protected','protected',
  716. 'public','published',''
  717. );
  718. internaltypeprefixName : array[tinternaltypeprefix] of TSymStr = (
  719. '$1byte$',
  720. '$llvmstruct$',
  721. '$vmtdef$',
  722. '$vmt_TStringMesssageTable$',
  723. '$vmt_msgint_table_entries$',
  724. '$vmt_tmethod_name_table$',
  725. '$vmt_intern_msgint_table$',
  726. '$vmt_intern_tmethodnamerec$',
  727. '$vmt_intern_tmethodnametable$',
  728. '$rttidef$',
  729. '$rtti_header$',
  730. '$rtti_prop$',
  731. '$rtti_ansistr$',
  732. '$rtti_ord_outer$',
  733. '$rtti_ord_inner$',
  734. '$rtti_ord_64bit$',
  735. '$rtti_normal_array$',
  736. '$rtti_dyn_array$',
  737. '$rtti_proc_param$',
  738. '$threadvar_record$'
  739. );
  740. {$ifndef jvm}
  741. default_class_type=odt_class;
  742. {$else not jvm}
  743. default_class_type=odt_javaclass;
  744. {$endif not jvm}
  745. { !! Be sure to keep these in sync with ones in rtl/inc/varianth.inc }
  746. varempty = 0;
  747. varnull = 1;
  748. varsmallint = 2;
  749. varinteger = 3;
  750. varsingle = 4;
  751. vardouble = 5;
  752. varcurrency = 6;
  753. vardate = 7;
  754. varolestr = 8;
  755. vardispatch = 9;
  756. varerror = 10;
  757. varboolean = 11;
  758. varvariant = 12;
  759. varunknown = 13;
  760. vardecimal = 14;
  761. varshortint = 16;
  762. varbyte = 17;
  763. varword = 18;
  764. varlongword = 19;
  765. varint64 = 20;
  766. varqword = 21;
  767. varUndefined = -1;
  768. varstrarg = $48;
  769. varustrarg = $49;
  770. varstring = $100;
  771. varany = $101;
  772. varustring = $102;
  773. vardefmask = $fff;
  774. vararray = $2000;
  775. varbyref = $4000;
  776. { blocks-related constants }
  777. blocks_procvar_invoke_type_name = '__FPC_invoke_pvtype';
  778. implementation
  779. end.