globtype.pas 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl, Pierre Muller
  3. Global types
  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 globtype;
  18. {$i fpcdefs.inc}
  19. interface
  20. const
  21. maxidlen = 127;
  22. type
  23. { TCmdStr is used to pass command line parameters to an external program to be
  24. executed from the FPC application. In some circomstances, this can be more
  25. than 255 characters. That's why using Ansi Strings}
  26. TCmdStr = AnsiString;
  27. TPathStr = AnsiString;
  28. {$ifdef symansistr}
  29. TSymStr = AnsiString;
  30. {$else symansistr}
  31. TSymStr = ShortString;
  32. {$endif symansistr}
  33. PSymStr = ^TSymStr;
  34. Int32 = Longint;
  35. { Integer type corresponding to pointer size }
  36. {$ifdef cpu64bitaddr}
  37. PUint = qword;
  38. PInt = int64;
  39. {$endif cpu64bitaddr}
  40. {$ifdef cpu32bitaddr}
  41. PUint = cardinal;
  42. PInt = longint;
  43. {$endif cpu32bitaddr}
  44. {$ifdef cpu16bitaddr}
  45. PUint = word;
  46. PInt = Smallint;
  47. {$endif cpu16bitaddr}
  48. { Natural integer register type and size for the target machine }
  49. {$ifdef cpu64bitalu}
  50. AWord = qword;
  51. AInt = Int64;
  52. Const
  53. AIntBits = 64;
  54. {$endif cpu64bitalu}
  55. {$ifdef cpu32bitalu}
  56. AWord = longword;
  57. AInt = longint;
  58. Const
  59. AIntBits = 32;
  60. {$endif cpu32bitalu}
  61. {$ifdef cpu16bitalu}
  62. AWord = Word;
  63. AInt = Smallint;
  64. Const
  65. AIntBits = 16;
  66. {$endif cpu16bitalu}
  67. {$ifdef cpu8bitalu}
  68. AWord = Byte;
  69. AInt = Shortint;
  70. Const
  71. AIntBits = 8;
  72. {$endif cpu8bitalu}
  73. Type
  74. PAWord = ^AWord;
  75. PAInt = ^AInt;
  76. { target cpu specific type used to store data sizes }
  77. ASizeInt = PInt;
  78. ASizeUInt = PUInt;
  79. { type used for handling constants etc. in the code generator }
  80. TCGInt = Int64;
  81. { This must be an ordinal type with the same size as a pointer
  82. Note: Must be unsigned! Otherwise, ugly code like
  83. pointer(-1) will result in a pointer with the value
  84. $fffffffffffffff on a 32bit machine if the compiler uses
  85. int64 constants internally (JM) }
  86. {$ifdef i8086}
  87. TConstPtrUInt = LongWord; { 32-bit for far pointers support }
  88. {$else i8086}
  89. TConstPtrUInt = AWord;
  90. {$endif i8086}
  91. { Use a variant record to be sure that the array if aligned correctly }
  92. tcompdoublerec=record
  93. case byte of
  94. 0 : (bytes:array[0..7] of byte);
  95. 1 : (value:double);
  96. end;
  97. tcompextendedrec=record
  98. case byte of
  99. 0 : (bytes:array[0..9] of byte);
  100. 1 : (value:extended);
  101. end;
  102. pconstset = ^tconstset;
  103. tconstset = set of 0..255;
  104. { Switches which can be changed locally }
  105. tlocalswitch = (cs_localnone,
  106. { codegen }
  107. cs_check_overflow,cs_check_range,cs_check_object,
  108. cs_check_io,cs_check_stack,
  109. cs_checkpointer,cs_check_ordinal_size,
  110. cs_generate_stackframes,cs_do_assertion,cs_generate_rtti,
  111. cs_full_boolean_eval,cs_typed_const_writable,cs_allow_enum_calc,
  112. cs_do_inline,cs_fpu_fwait,cs_ieee_errors,
  113. cs_check_low_addr_load,
  114. { mmx }
  115. cs_mmx,cs_mmx_saturation,
  116. { parser }
  117. cs_typed_addresses,cs_strict_var_strings,cs_refcountedstrings,
  118. cs_bitpacking,cs_varpropsetter,cs_scopedenums,cs_pointermath,
  119. { macpas specific}
  120. cs_external_var, cs_externally_visible,
  121. { jvm specific }
  122. cs_check_var_copyout,
  123. cs_zerobasedstrings,
  124. { i8086 specific }
  125. cs_force_far_calls,
  126. cs_hugeptr_arithmetic_normalization,
  127. cs_hugeptr_comparison_normalization
  128. );
  129. tlocalswitches = set of tlocalswitch;
  130. { Switches which can be changed only at the beginning of a new module }
  131. tmoduleswitch = (cs_modulenone,
  132. { parser }
  133. cs_fp_emulation,cs_extsyntax,cs_openstring,
  134. { support }
  135. cs_support_goto,cs_support_macro,
  136. cs_support_c_operators,
  137. { generation }
  138. cs_profile,cs_debuginfo,cs_compilesystem,
  139. cs_lineinfo,cs_implicit_exceptions,cs_explicit_codepage,
  140. { linking }
  141. cs_create_smart,cs_create_dynamic,cs_create_pic,
  142. { browser switches are back }
  143. cs_browser,cs_local_browser,
  144. { target specific }
  145. cs_executable_stack,
  146. { i8086 specific }
  147. cs_huge_code
  148. );
  149. tmoduleswitches = set of tmoduleswitch;
  150. { Switches which can be changed only for a whole program/compilation,
  151. mostly set with commandline }
  152. tglobalswitch = (cs_globalnone,
  153. { parameter switches }
  154. cs_check_unit_name,cs_constructor_name,cs_support_exceptions,
  155. cs_support_c_objectivepas,
  156. { units }
  157. cs_load_objpas_unit,
  158. cs_load_gpc_unit,
  159. cs_load_fpcylix_unit,
  160. cs_support_vectors,
  161. { debuginfo }
  162. cs_use_heaptrc,cs_use_lineinfo,
  163. cs_gdb_valgrind,cs_no_regalloc,cs_stabs_preservecase,
  164. { assembling }
  165. cs_asm_leave,cs_asm_extern,cs_asm_pipe,cs_asm_source,
  166. cs_asm_regalloc,cs_asm_tempalloc,cs_asm_nodes,
  167. { linking }
  168. cs_link_nolink,cs_link_static,cs_link_smart,cs_link_shared,cs_link_deffile,
  169. cs_link_strip,cs_link_staticflag,cs_link_on_target,cs_link_extern,cs_link_opt_vtable,
  170. cs_link_opt_used_sections,cs_link_separate_dbg_file,
  171. cs_link_map,cs_link_pthread,cs_link_no_default_lib_order,
  172. cs_link_native
  173. );
  174. tglobalswitches = set of tglobalswitch;
  175. { global switches specific to debug information }
  176. tdebugswitch = (ds_none,
  177. { enable set support in dwarf debug info, breaks gdb versions }
  178. { without support for that tag (they refuse to parse the rest }
  179. { of the debug information) }
  180. ds_dwarf_sets,
  181. { use absolute paths for include files in stabs. Pro: gdb }
  182. { always knows full path to file. Con: doesn't work anymore }
  183. { if the include file is moved (otherwise, things still work }
  184. { if your source hierarchy is the same, but has a different }
  185. { base path) }
  186. ds_stabs_abs_include_files,
  187. { prefix method names by "classname__" in DWARF (like is done }
  188. { for Stabs); not enabled by default, because otherwise once }
  189. { support for calling methods has been added to gdb, you'd }
  190. { always have to type classinstance.classname__methodname() }
  191. ds_dwarf_method_class_prefix
  192. );
  193. tdebugswitches = set of tdebugswitch;
  194. { global target-specific switches }
  195. ttargetswitch = (ts_none,
  196. { generate code that results in smaller TOCs than normal (AIX) }
  197. ts_small_toc,
  198. { for the JVM target: generate integer array initializations via string
  199. constants in order to reduce the generated code size (Java routines
  200. are limited to 64kb of bytecode) }
  201. ts_compact_int_array_init,
  202. { for the JVM target: intialize enum fields in constructors with the
  203. enum class instance corresponding to ordinal value 0 (not done by
  204. default because this initialization can only be performed after the
  205. inherited constructors have run, and if they call a virtual method
  206. of the current class, then this virtual method may already have
  207. initialized that field with another value and the constructor
  208. initialization will result in data loss }
  209. ts_jvm_enum_field_init,
  210. { when automatically generating getters/setters for properties, use
  211. these strings as prefixes for the generated getters/setter names }
  212. ts_auto_getter_prefix,
  213. ts_auto_setter_predix,
  214. ts_thumb_interworking,
  215. { lowercase the first character of routine names, used to generate
  216. names that are compliant with Java coding standards from code
  217. written according to Delphi coding standards }
  218. ts_lowercase_proc_start,
  219. { initialise local variables on the JVM target so you won't get
  220. accidental uses of uninitialised values }
  221. ts_init_locals,
  222. { emit a CLD instruction before using the x86 string instructions }
  223. ts_cld
  224. );
  225. ttargetswitches = set of ttargetswitch;
  226. { adding a new entry here requires also adding the appropriate define in
  227. systemh.inc (FK)
  228. }
  229. tfeature = (
  230. f_heap,f_init_final,f_rtti,f_classes,f_exceptions,f_exitcode,
  231. f_ansistrings,f_widestrings,f_textio,f_consoleio,f_fileio,
  232. f_random,f_variants,f_objects,f_dynarrays,f_threading,f_commandargs,
  233. f_processes,f_stackcheck,f_dynlibs,f_softfpu,f_objectivec1,f_resources,
  234. f_unicodestring
  235. );
  236. tfeatures = set of tfeature;
  237. type
  238. { optimizer }
  239. toptimizerswitch = (cs_opt_none,
  240. cs_opt_level1,cs_opt_level2,cs_opt_level3,cs_opt_level4,
  241. cs_opt_regvar,cs_opt_uncertain,cs_opt_size,cs_opt_stackframe,
  242. cs_opt_peephole,cs_opt_asmcse,cs_opt_loopunroll,cs_opt_tailrecursion,cs_opt_nodecse,
  243. cs_opt_nodedfa,cs_opt_loopstrength,cs_opt_scheduler,cs_opt_autoinline,cs_useebp,cs_userbp,
  244. cs_opt_reorder_fields,cs_opt_fastmath,
  245. { Allow removing expressions whose result is not used, even when this
  246. can change program behaviour (range check errors disappear,
  247. access violations due to invalid pointer derefences disappear, ...).
  248. Note: it does not (and must not) remove expressions that have
  249. explicit side-effects, only implicit side-effects (like the ones
  250. mentioned before) can disappear.
  251. }
  252. cs_opt_dead_values,
  253. { compiler checks for empty procedures/methods and removes calls to them if possible }
  254. cs_opt_remove_emtpy_proc,
  255. cs_opt_constant_propagate,
  256. cs_opt_dead_store_eliminate,
  257. cs_opt_forcenostackframe
  258. );
  259. toptimizerswitches = set of toptimizerswitch;
  260. { whole program optimizer }
  261. twpoptimizerswitch = (
  262. cs_wpo_devirtualize_calls,cs_wpo_optimize_vmts,
  263. cs_wpo_symbol_liveness
  264. );
  265. twpoptimizerswitches = set of twpoptimizerswitch;
  266. type
  267. { Used by ARM / AVR / MIPSEL to differentiate between specific microcontrollers }
  268. tcontrollerdatatype = record
  269. controllertypestr, controllerunitstr: string[20];
  270. flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
  271. end;
  272. ttargetswitchinfo = record
  273. name: string[22];
  274. { target switch can have an arbitratry value, not only on/off }
  275. hasvalue: boolean;
  276. { target switch can be used only globally }
  277. isglobal: boolean;
  278. define: string[15];
  279. end;
  280. const
  281. OptimizerSwitchStr : array[toptimizerswitch] of string[17] = ('',
  282. 'LEVEL1','LEVEL2','LEVEL3','LEVEL4',
  283. 'REGVAR','UNCERTAIN','SIZE','STACKFRAME',
  284. 'PEEPHOLE','ASMCSE','LOOPUNROLL','TAILREC','CSE',
  285. 'DFA','STRENGTH','SCHEDULE','AUTOINLINE','USEEBP','USERBP',
  286. 'ORDERFIELDS','FASTMATH','DEADVALUES','REMOVEEMPTYPROCS',
  287. 'CONSTPROP',
  288. 'DEADSTORE','FORCENOSTACKFRAME'
  289. );
  290. WPOptimizerSwitchStr : array [twpoptimizerswitch] of string[14] = (
  291. 'DEVIRTCALLS','OPTVMTS','SYMBOLLIVENESS'
  292. );
  293. DebugSwitchStr : array[tdebugswitch] of string[22] = ('',
  294. 'DWARFSETS','STABSABSINCLUDES','DWARFMETHODCLASSPREFIX');
  295. TargetSwitchStr : array[ttargetswitch] of ttargetswitchinfo = (
  296. (name: ''; hasvalue: false; isglobal: true ; define: ''),
  297. (name: 'SMALLTOC'; hasvalue: false; isglobal: true ; define: ''),
  298. (name: 'COMPACTINTARRAYINIT'; hasvalue: false; isglobal: true ; define: ''),
  299. (name: 'ENUMFIELDINIT'; hasvalue: false; isglobal: true ; define: ''),
  300. (name: 'AUTOGETTERPREFIX'; hasvalue: true ; isglobal: false; define: ''),
  301. (name: 'AUTOSETTERPREFIX'; hasvalue: true ; isglobal: false; define: ''),
  302. (name: 'THUMBINTERWORKING'; hasvalue: false; isglobal: true ; define: ''),
  303. (name: 'LOWERCASEPROCSTART'; hasvalue: false; isglobal: true ; define: ''),
  304. (name: 'INITLOCALS'; hasvalue: false; isglobal: true ; define: ''),
  305. (name: 'CLD'; hasvalue: false; isglobal: true ; define: 'FPC_ENABLED_CLD')
  306. );
  307. { switches being applied to all CPUs at the given level }
  308. genericlevel1optimizerswitches = [cs_opt_level1,cs_opt_peephole];
  309. genericlevel2optimizerswitches = [cs_opt_level2,cs_opt_remove_emtpy_proc];
  310. genericlevel3optimizerswitches = [cs_opt_level3,cs_opt_constant_propagate,cs_opt_nodedfa];
  311. genericlevel4optimizerswitches = [cs_opt_level4,cs_opt_reorder_fields,cs_opt_dead_values,cs_opt_fastmath];
  312. { whole program optimizations whose information generation requires
  313. information from all loaded units
  314. }
  315. WPOptimizationsNeedingAllUnitInfo = [cs_wpo_devirtualize_calls,cs_wpo_optimize_vmts];
  316. featurestr : array[tfeature] of string[14] = (
  317. 'HEAP','INITFINAL','RTTI','CLASSES','EXCEPTIONS','EXITCODE',
  318. 'ANSISTRINGS','WIDESTRINGS','TEXTIO','CONSOLEIO','FILEIO',
  319. 'RANDOM','VARIANTS','OBJECTS','DYNARRAYS','THREADING','COMMANDARGS',
  320. 'PROCESSES','STACKCHECK','DYNLIBS','SOFTFPU','OBJECTIVEC1','RESOURCES',
  321. 'UNICODESTRINGS'
  322. );
  323. type
  324. { Switches which can be changed by a mode (fpc,tp7,delphi) }
  325. tmodeswitch = (m_none,
  326. { generic }
  327. m_fpc,m_objfpc,m_delphi,m_tp7,m_mac,m_iso,
  328. {$ifdef fpc_mode}m_gpc,{$endif}
  329. { more specific }
  330. m_class, { delphi class model }
  331. m_objpas, { load objpas unit }
  332. m_result, { result in functions }
  333. m_string_pchar, { pchar 2 string conversion }
  334. m_cvar_support, { cvar variable directive }
  335. m_nested_comment, { nested comments }
  336. m_tp_procvar, { tp style procvars (no @ needed) }
  337. m_mac_procvar, { macpas style procvars }
  338. m_repeat_forward, { repeating forward declarations is needed }
  339. m_pointer_2_procedure, { allows the assignement of pointers to
  340. procedure variables }
  341. m_autoderef, { does auto dereferencing of struct. vars }
  342. m_initfinal, { initialization/finalization for units }
  343. m_default_ansistring, { ansistring turned on by default }
  344. m_out, { support the calling convention OUT }
  345. m_default_para, { support default parameters }
  346. m_hintdirective, { support hint directives }
  347. m_duplicate_names, { allow locals/paras to have duplicate names of globals }
  348. m_property, { allow properties }
  349. m_default_inline, { allow inline proc directive }
  350. m_except, { allow exception-related keywords }
  351. m_objectivec1, { support interfacing with Objective-C (1.0) }
  352. m_objectivec2, { support interfacing with Objective-C (2.0) }
  353. m_nested_procvars, { support nested procedural variables }
  354. m_non_local_goto, { support non local gotos (like iso pascal) }
  355. m_advanced_records, { advanced record syntax with visibility sections, methods and properties }
  356. m_isolike_unary_minus, { unary minus like in iso pascal: same precedence level as binary minus/plus }
  357. m_systemcodepage, { use system codepage as compiler codepage by default, emit ansistrings with system codepage }
  358. m_final_fields, { allows declaring fields as "final", which means they must be initialised
  359. in the (class) constructor and are constant from then on (same as final
  360. fields in Java) }
  361. m_default_unicodestring, { makes the default string type in $h+ mode unicodestring rather than
  362. ansistring; similarly, char becomes unicodechar rather than ansichar }
  363. m_type_helpers, { allows the declaration of "type helper" (non-Delphi) or "record helper"
  364. (Delphi) for primitive types }
  365. m_blocks { support for http://en.wikipedia.org/wiki/Blocks_(C_language_extension) }
  366. );
  367. tmodeswitches = set of tmodeswitch;
  368. const
  369. alllanguagemodes = [m_fpc,m_objfpc,m_delphi,m_tp7,m_mac,m_iso];
  370. type
  371. { Application types (platform specific) }
  372. tapptype = (
  373. app_none,
  374. app_native, { native for Windows and NativeNT targets }
  375. app_gui, { graphic user-interface application }
  376. app_cui, { console application }
  377. app_fs, { full-screen type application (OS/2 and EMX only) }
  378. app_tool, { tool application, (MPW tool for MacOS, MacOS only) }
  379. app_arm7, { for Nintendo DS target }
  380. app_arm9, { for Nintendo DS target }
  381. app_bundle, { dynamically loadable bundle, Darwin only }
  382. app_com { DOS .COM file }
  383. );
  384. { interface types }
  385. tinterfacetypes = (
  386. it_interfacecom,
  387. it_interfacecorba,
  388. it_interfacejava
  389. );
  390. { currently parsed block type }
  391. tblock_type = (
  392. bt_none, { not assigned }
  393. bt_general, { default }
  394. bt_type, { type section }
  395. bt_const, { const section }
  396. bt_const_type, { const part of type. e.g.: ": Integer = 1" }
  397. bt_var, { variable declaration }
  398. bt_var_type, { type of variable }
  399. bt_except, { except section }
  400. bt_body { procedure body }
  401. );
  402. { Temp types }
  403. ttemptype = (tt_none,
  404. { free temp location, can be reused for something else }
  405. tt_free,
  406. { temp location that will be freed when ttgobj.UnGetTemp/
  407. ttgobj.UnGetIfTemp is called on it }
  408. tt_normal,
  409. { temp location that will not be freed; if it has to be
  410. freed, first ttgobj.changetemptype() it to tt_normal,
  411. or call ttgobj.UnGetLocal() instead (for local variables,
  412. since they are also persistent temps) }
  413. tt_persistent,
  414. { temp location that can never be reused anymore, even
  415. after it has been freed }
  416. tt_noreuse,
  417. { freed version of the above }
  418. tt_freenoreuse,
  419. { temp location that has been allocated by the register
  420. allocator and that can be reallocated only by the
  421. register allocator }
  422. tt_regallocator,
  423. { freed version of the above }
  424. tt_freeregallocator);
  425. ttemptypeset = set of ttemptype;
  426. { calling convention for tprocdef and tprocvardef }
  427. tproccalloption=(pocall_none,
  428. { procedure uses C styled calling }
  429. pocall_cdecl,
  430. { C++ calling conventions }
  431. pocall_cppdecl,
  432. { Far16 for OS/2 }
  433. pocall_far16,
  434. { Old style FPC default calling }
  435. pocall_oldfpccall,
  436. { Procedure has compiler magic}
  437. pocall_internproc,
  438. { procedure is a system call, applies e.g. to MorphOS and PalmOS }
  439. pocall_syscall,
  440. { pascal standard left to right }
  441. pocall_pascal,
  442. { procedure uses register (fastcall) calling }
  443. pocall_register,
  444. { safe call calling conventions }
  445. pocall_safecall,
  446. { procedure uses stdcall call }
  447. pocall_stdcall,
  448. { Special calling convention for cpus without a floating point
  449. unit. Floating point numbers are passed in integer registers
  450. instead of floating point registers. Depending on the other
  451. available calling conventions available for the cpu
  452. this replaces either pocall_fastcall or pocall_stdcall.
  453. }
  454. pocall_softfloat,
  455. { Metrowerks Pascal. Special case on Mac OS (X): passes all }
  456. { constant records by reference. }
  457. pocall_mwpascal,
  458. { Special interrupt handler for embedded systems }
  459. pocall_interrupt
  460. );
  461. tproccalloptions = set of tproccalloption;
  462. const
  463. proccalloptionStr : array[tproccalloption] of string[14]=('',
  464. 'CDecl',
  465. 'CPPDecl',
  466. 'Far16',
  467. 'OldFPCCall',
  468. 'InternProc',
  469. 'SysCall',
  470. 'Pascal',
  471. 'Register',
  472. 'SafeCall',
  473. 'StdCall',
  474. 'SoftFloat',
  475. 'MWPascal',
  476. 'Interrupt'
  477. );
  478. { Default calling convention }
  479. {$if defined(i8086)}
  480. pocall_default = pocall_pascal;
  481. {$elseif defined(i386) or defined(x86_64)}
  482. pocall_default = pocall_register;
  483. {$else}
  484. pocall_default = pocall_stdcall;
  485. {$endif}
  486. cstylearrayofconst = [pocall_cdecl,pocall_cppdecl,pocall_mwpascal];
  487. modeswitchstr : array[tmodeswitch] of string[18] = ('',
  488. '','','','','','',
  489. {$ifdef fpc_mode}'',{$endif}
  490. { more specific }
  491. 'CLASS',
  492. 'OBJPAS',
  493. 'RESULT',
  494. 'PCHARTOSTRING',
  495. 'CVAR',
  496. 'NESTEDCOMMENTS',
  497. 'CLASSICPROCVARS',
  498. 'MACPROCVARS',
  499. 'REPEATFORWARD',
  500. 'POINTERTOPROCVAR',
  501. 'AUTODEREF',
  502. 'INITFINAL',
  503. 'ANSISTRINGS',
  504. 'OUT',
  505. 'DEFAULTPARAMETERS',
  506. 'HINTDIRECTIVE',
  507. 'DUPLICATELOCALS',
  508. 'PROPERTIES',
  509. 'ALLOWINLINE',
  510. 'EXCEPTIONS',
  511. 'OBJECTIVEC1',
  512. 'OBJECTIVEC2',
  513. 'NESTEDPROCVARS',
  514. 'NONLOCALGOTO',
  515. 'ADVANCEDRECORDS',
  516. 'ISOUNARYMINUS',
  517. 'SYSTEMCODEPAGE',
  518. 'FINALFIELDS',
  519. 'UNICODESTRINGS',
  520. 'TYPEHELPERS',
  521. 'CBLOCKS');
  522. type
  523. tprocinfoflag=(
  524. { procedure has at least one assembler block }
  525. pi_has_assembler_block,
  526. { procedure does a call }
  527. pi_do_call,
  528. { procedure has a try statement = no register optimization }
  529. pi_uses_exceptions,
  530. { procedure is declared as @var(assembler), don't optimize}
  531. pi_is_assembler,
  532. { procedure contains data which needs to be finalized }
  533. pi_needs_implicit_finally,
  534. { procedure has the implicit try..finally generated }
  535. pi_has_implicit_finally,
  536. { procedure uses fpu}
  537. pi_uses_fpu,
  538. { procedure uses GOT for PIC code }
  539. pi_needs_got,
  540. { references var/proc/type/const in static symtable,
  541. i.e. not allowed for inlining from other units }
  542. pi_uses_static_symtable,
  543. { set if the procedure has to push parameters onto the stack }
  544. pi_has_stackparameter,
  545. { set if the procedure has at least one label }
  546. pi_has_label,
  547. { calls itself recursive }
  548. pi_is_recursive,
  549. { stack frame optimization not possible (only on x86 probably) }
  550. pi_needs_stackframe,
  551. { set if the procedure has at least one register saved on the stack }
  552. pi_has_saved_regs,
  553. { dfa was generated for this proc }
  554. pi_dfaavailable,
  555. { subroutine contains interprocedural used labels }
  556. pi_has_interproclabel,
  557. { subroutine has unwind info (win64) }
  558. pi_has_unwind_info,
  559. { subroutine contains interprocedural gotos }
  560. pi_has_global_goto,
  561. { subroutine contains inherited call }
  562. pi_has_inherited,
  563. { subroutine has nested exit }
  564. pi_has_nested_exit,
  565. { allocates memory on stack, so stack is unbalanced on exit }
  566. pi_has_stack_allocs,
  567. { set if the stack frame of the procedure is estimated }
  568. pi_estimatestacksize,
  569. { the routine calls a C-style varargs function }
  570. pi_calls_c_varargs
  571. );
  572. tprocinfoflags=set of tprocinfoflag;
  573. type
  574. { float types -- warning, this enum/order is used internally by the RTL
  575. as well in rtl/inc/real2str.inc }
  576. tfloattype = (
  577. s32real,s64real,s80real,sc80real { the C "long double" type on x86 },
  578. s64comp,s64currency,s128real
  579. );
  580. type
  581. { register allocator live range extension direction }
  582. TRADirection = (rad_forward, rad_backwards, rad_backwards_reinit);
  583. type
  584. TIDString = string[maxidlen];
  585. tnormalset = set of byte; { 256 elements set }
  586. pnormalset = ^tnormalset;
  587. pboolean = ^boolean;
  588. pdouble = ^double;
  589. pbyte = ^byte;
  590. pword = ^word;
  591. plongint = ^longint;
  592. plongintarray = plongint;
  593. pfileposinfo = ^tfileposinfo;
  594. tfileposinfo = record
  595. { if types of column or fileindex are changed, modify tcompilerppufile.putposinfo }
  596. line : longint;
  597. column : word;
  598. fileindex : word;
  599. moduleindex : word;
  600. end;
  601. {$ifndef xFPC}
  602. type
  603. pguid = ^tguid;
  604. tguid = packed record
  605. D1: LongWord;
  606. D2: Word;
  607. D3: Word;
  608. D4: array[0..7] of Byte;
  609. end;
  610. {$endif}
  611. tstringencoding = Word;
  612. tcodepagestring = string[20];
  613. const
  614. { link options }
  615. link_none = $0;
  616. link_always = $1;
  617. link_static = $2;
  618. link_smart = $4;
  619. link_shared = $8;
  620. type
  621. { a message state }
  622. tmsgstate = (
  623. ms_on := 1,
  624. ms_off := 2,
  625. ms_error := 3,
  626. ms_on_global := $11, // turn on output
  627. ms_off_global := $22, // turn off output
  628. ms_error_global := $33 // cast to error
  629. );
  630. const
  631. { Mask for current value of message state }
  632. ms_local_mask = $0f;
  633. { Mask for global value of message state
  634. that needs to be restored when changing units }
  635. ms_global_mask = $f0;
  636. { Shift used to convert global to local message state }
  637. ms_shift = 4;
  638. type
  639. pmessagestaterecord = ^tmessagestaterecord;
  640. tmessagestaterecord = record
  641. next : pmessagestaterecord;
  642. value : longint;
  643. state : tmsgstate;
  644. end;
  645. type
  646. tx86memorymodel = (mm_tiny,mm_small,mm_medium,mm_compact,mm_large,mm_huge);
  647. const
  648. x86memorymodelstr : array[tx86memorymodel] of string[7]=(
  649. 'TINY',
  650. 'SMALL',
  651. 'MEDIUM',
  652. 'COMPACT',
  653. 'LARGE',
  654. 'HUGE');
  655. { hide Sysutils.ExecuteProcess in units using this one after SysUtils}
  656. const
  657. ExecuteProcess = 'Do not use' deprecated 'Use cfileutil.RequotedExecuteProcess instead, ExecuteProcess cannot deal with single quotes as used by Unix command lines';
  658. implementation
  659. end.