globtype.pas 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl, Pierre Muller
  4. Global types
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit globtype;
  19. {$i fpcdefs.inc}
  20. interface
  21. const
  22. maxidlen = 64;
  23. type
  24. { Switches which can be changed locally }
  25. tlocalswitch = (cs_localnone,
  26. { codegen }
  27. cs_check_overflow,cs_check_range,cs_check_object,
  28. cs_check_io,cs_check_stack,
  29. cs_omitstackframe,cs_do_assertion,cs_generate_rtti,
  30. cs_full_boolean_eval,cs_typed_const_writable,
  31. { mmx }
  32. cs_mmx,cs_mmx_saturation,
  33. { parser }
  34. cs_typed_addresses,cs_strict_var_strings,cs_ansistrings
  35. );
  36. tlocalswitches = set of tlocalswitch;
  37. { Switches which can be changed only at the beginning of a new module }
  38. tmoduleswitch = (cs_modulenone,
  39. { parser }
  40. cs_fp_emulation,cs_extsyntax,cs_openstring,
  41. { support }
  42. cs_support_inline,cs_support_goto,cs_support_macro,
  43. cs_support_c_operators,cs_static_keyword,
  44. { generation }
  45. cs_profile,cs_debuginfo,cs_browser,cs_local_browser,cs_compilesystem,
  46. cs_lineinfo,cs_threading,cs_implicit_exceptions,
  47. { linking }
  48. cs_create_smart,cs_create_dynamic,cs_create_pic
  49. );
  50. tmoduleswitches = set of tmoduleswitch;
  51. { Switches which can be changed only for a whole program/compilation,
  52. mostly set with commandline }
  53. tglobalswitch = (cs_globalnone,
  54. { parameter switches }
  55. cs_check_unit_name,cs_constructor_name,
  56. { units }
  57. cs_load_objpas_unit,
  58. cs_load_gpc_unit,
  59. { optimizer }
  60. cs_regalloc,cs_uncertainopts,cs_littlesize,cs_optimize,
  61. cs_fastoptimize, cs_slowoptimize,cs_align,
  62. { browser }
  63. cs_browser_log,
  64. { debugger }
  65. cs_gdb_dbx,cs_gdb_gsym,cs_gdb_heaptrc,cs_gdb_lineinfo,
  66. cs_checkpointer,
  67. { assembling }
  68. cs_asm_leave,cs_asm_extern,cs_asm_pipe,cs_asm_source,
  69. cs_asm_regalloc,cs_asm_tempalloc,cs_asm_nodes,
  70. { linking }
  71. cs_link_extern,cs_link_static,cs_link_smart,cs_link_shared,cs_link_deffile,
  72. cs_link_strip,cs_link_staticflag,cs_link_on_target,cs_link_internal,cs_link_map
  73. );
  74. tglobalswitches = set of tglobalswitch;
  75. { Switches which can be changed by a mode (fpc,tp7,delphi) }
  76. tmodeswitch = (m_none,m_all, { needed for keyword }
  77. { generic }
  78. m_fpc,m_objfpc,m_delphi,m_tp7,m_gpc,
  79. { more specific }
  80. m_class, { delphi class model }
  81. m_objpas, { load objpas unit }
  82. m_result, { result in functions }
  83. m_string_pchar, { pchar 2 string conversion }
  84. m_cvar_support, { cvar variable directive }
  85. m_nested_comment, { nested comments }
  86. m_tp_procvar, { tp style procvars (no @ needed) }
  87. m_repeat_forward, { repeating forward declarations is needed }
  88. m_pointer_2_procedure, { allows the assignement of pointers to
  89. procedure variables }
  90. m_autoderef, { does auto dereferencing of struct. vars }
  91. m_initfinal, { initialization/finalization for units }
  92. m_add_pointer, { allow pointer add/sub operations }
  93. m_default_ansistring, { ansistring turned on by default }
  94. m_out, { support the calling convention OUT }
  95. m_default_para, { support default parameters }
  96. m_hintdirective, { support hint directives }
  97. m_duplicate_names { allow locals/paras to have duplicate names of globals }
  98. );
  99. tmodeswitches = set of tmodeswitch;
  100. { win32 & OS/2 application types }
  101. tapptype = (app_none,
  102. app_gui,app_cui,app_fs
  103. );
  104. { interface types }
  105. tinterfacetypes = (
  106. it_interfacecom,
  107. it_interfacecorba
  108. );
  109. { currently parsed block type }
  110. tblock_type = (bt_none,
  111. bt_general,bt_type,bt_const,bt_except
  112. );
  113. { calling convention for tprocdef and tprocvardef }
  114. tproccalloption=(pocall_none,
  115. pocall_cdecl, { procedure uses C styled calling }
  116. pocall_cppdecl, { C++ calling conventions }
  117. pocall_compilerproc, { Procedure is used for internal compiler calls }
  118. pocall_far16, { Far16 for OS/2 }
  119. pocall_fpccall, { FPC default calling }
  120. pocall_inline, { Procedure is an assembler macro }
  121. pocall_internproc, { Procedure has compiler magic}
  122. pocall_palmossyscall, { procedure is a PalmOS system call }
  123. pocall_pascal, { pascal standard left to right }
  124. pocall_register, { procedure uses register (fastcall) calling }
  125. pocall_safecall, { safe call calling conventions }
  126. pocall_stdcall, { procedure uses stdcall call }
  127. pocall_system { system call }
  128. );
  129. tproccalloptions = set of tproccalloption;
  130. const
  131. proccalloptionStr : array[tproccalloption] of string[14]=('',
  132. 'CDecl',
  133. 'CPPDecl',
  134. 'CompilerProc',
  135. 'Far16',
  136. 'FPCCall',
  137. 'Inline',
  138. 'InternProc',
  139. 'PalmOSSysCall',
  140. 'Pascal',
  141. 'Register',
  142. 'SafeCall',
  143. 'StdCall',
  144. 'System'
  145. );
  146. type
  147. stringid = string[maxidlen];
  148. tnormalset = set of byte; { 256 elements set }
  149. pnormalset = ^tnormalset;
  150. pboolean = ^boolean;
  151. pdouble = ^double;
  152. pbyte = ^byte;
  153. pword = ^word;
  154. plongint = ^longint;
  155. plongintarray = plongint;
  156. Tconstant=record
  157. case signed:boolean of
  158. false:
  159. (valueu:cardinal);
  160. true:
  161. (values:longint);
  162. end;
  163. {$ifndef Delphi}
  164. {$ifndef xFPC}
  165. type
  166. pguid = ^tguid;
  167. tguid = packed record
  168. D1: LongWord;
  169. D2: Word;
  170. D3: Word;
  171. D4: array[0..7] of Byte;
  172. end;
  173. {$endif}
  174. {$endif}
  175. const
  176. { link options }
  177. link_none = $0;
  178. link_allways = $1;
  179. link_static = $2;
  180. link_smart = $4;
  181. link_shared = $8;
  182. implementation
  183. end.
  184. {
  185. $Log$
  186. Revision 1.34 2002-10-16 19:01:43 peter
  187. + $IMPLICITEXCEPTIONS switch to turn on/off generation of the
  188. implicit exception frames for procedures with initialized variables
  189. and for constructors. The default is on for compatibility
  190. Revision 1.33 2002/10/14 19:43:41 peter
  191. * threading switch, defines the symbol FPC_THREADING
  192. Revision 1.32 2002/10/05 12:43:24 carl
  193. * fixes for Delphi 6 compilation
  194. (warning : Some features do not work under Delphi)
  195. Revision 1.31 2002/08/19 19:36:42 peter
  196. * More fixes for cross unit inlining, all tnodes are now implemented
  197. * Moved pocall_internconst to po_internconst because it is not a
  198. calling type at all and it conflicted when inlining of these small
  199. functions was requested
  200. Revision 1.30 2002/08/12 15:08:39 carl
  201. + stab register indexes for powerpc (moved from gdb to cpubase)
  202. + tprocessor enumeration moved to cpuinfo
  203. + linker in target_info is now a class
  204. * many many updates for m68k (will soon start to compile)
  205. - removed some ifdef or correct them for correct cpu
  206. Revision 1.29 2002/08/06 20:55:20 florian
  207. * first part of ppc calling conventions fix
  208. Revision 1.28 2002/07/04 20:43:00 florian
  209. * first x86-64 patches
  210. Revision 1.27 2002/07/01 18:46:22 peter
  211. * internal linker
  212. * reorganized aasm layer
  213. Revision 1.26 2002/05/18 13:34:08 peter
  214. * readded missing revisions
  215. Revision 1.25 2002/05/16 19:46:36 carl
  216. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  217. + try to fix temp allocation (still in ifdef)
  218. + generic constructor calls
  219. + start of tassembler / tmodulebase class cleanup
  220. Revision 1.23 2002/05/12 16:53:05 peter
  221. * moved entry and exitcode to ncgutil and cgobj
  222. * foreach gets extra argument for passing local data to the
  223. iterator function
  224. * -CR checks also class typecasts at runtime by changing them
  225. into as
  226. * fixed compiler to cycle with the -CR option
  227. * fixed stabs with elf writer, finally the global variables can
  228. be watched
  229. * removed a lot of routines from cga unit and replaced them by
  230. calls to cgobj
  231. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  232. u32bit then the other is typecasted also to u32bit without giving
  233. a rangecheck warning/error.
  234. * fixed pascal calling method with reversing also the high tree in
  235. the parast, detected by tcalcst3 test
  236. Revision 1.22 2002/04/21 19:02:03 peter
  237. * removed newn and disposen nodes, the code is now directly
  238. inlined from pexpr
  239. * -an option that will write the secondpass nodes to the .s file, this
  240. requires EXTDEBUG define to actually write the info
  241. * fixed various internal errors and crashes due recent code changes
  242. Revision 1.21 2002/03/24 19:05:59 carl
  243. + patch for SPARC from Mazen NEIFER
  244. Revision 1.20 2002/01/24 18:25:48 peter
  245. * implicit result variable generation for assembler routines
  246. * removed m_tp modeswitch, use m_tp7 or not(m_fpc) instead
  247. }