symconst.pas 32 KB

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