globtype.pas 9.9 KB

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