symconst.pas 30 KB

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