globtype.pas 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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 defines.inc}
  20. interface
  21. const
  22. maxidlen = 64;
  23. type
  24. { System independent float names }
  25. {$ifdef i386}
  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. pbestreal=^bestreal;
  62. { Switches which can be changed locally }
  63. tlocalswitch = (cs_localnone,
  64. { codegen }
  65. cs_check_overflow,cs_check_range,cs_check_object_ext,
  66. cs_check_io,cs_check_stack,
  67. cs_omitstackframe,cs_do_assertion,cs_generate_rtti,
  68. cs_full_boolean_eval,cs_typed_const_writable,
  69. { mmx }
  70. cs_mmx,cs_mmx_saturation,
  71. { parser }
  72. cs_typed_addresses,cs_strict_var_strings,cs_ansistrings
  73. );
  74. tlocalswitches = set of tlocalswitch;
  75. { Switches which can be changed only at the beginning of a new module }
  76. tmoduleswitch = (cs_modulenone,
  77. { parser }
  78. cs_fp_emulation,cs_extsyntax,cs_openstring,
  79. { support }
  80. cs_support_inline,cs_support_goto,cs_support_macro,
  81. cs_support_c_operators,cs_static_keyword,
  82. { generation }
  83. cs_profile,cs_debuginfo,cs_browser,cs_local_browser,cs_compilesystem,
  84. cs_lineinfo,
  85. { linking }
  86. cs_create_smart,cs_create_dynamic
  87. );
  88. tmoduleswitches = set of tmoduleswitch;
  89. { Switches which can be changed only for a whole program/compilation,
  90. mostly set with commandline }
  91. tglobalswitch = (cs_globalnone,
  92. { parameter switches }
  93. cs_check_unit_name,cs_constructor_name,
  94. { units }
  95. cs_load_objpas_unit,
  96. cs_load_gpc_unit,
  97. { optimizer }
  98. cs_regalloc,cs_uncertainopts,cs_littlesize,cs_optimize,
  99. cs_fastoptimize, cs_slowoptimize,cs_align,
  100. { browser }
  101. cs_browser_log,
  102. { debugger }
  103. cs_gdb_dbx,cs_gdb_gsym,cs_gdb_heaptrc,cs_gdb_lineinfo,cs_checkpointer,
  104. { assembling }
  105. cs_asm_leave,cs_asm_extern,cs_asm_pipe,cs_asm_source,
  106. cs_asm_regalloc,cs_asm_tempalloc,
  107. { linking }
  108. cs_link_extern,cs_link_static,cs_link_smart,cs_link_shared,cs_link_deffile,
  109. cs_link_strip,cs_link_staticflag,cs_link_on_target
  110. );
  111. tglobalswitches = set of tglobalswitch;
  112. { Switches which can be changed by a mode (fpc,tp7,delphi) }
  113. tmodeswitch = (m_none,m_all, { needed for keyword }
  114. { generic }
  115. m_fpc,m_objfpc,m_delphi,m_tp7,m_gpc,
  116. { more specific }
  117. m_class, { delphi class model }
  118. m_objpas, { load objpas unit }
  119. m_result, { result in functions }
  120. m_string_pchar, { pchar 2 string conversion }
  121. m_cvar_support, { cvar variable directive }
  122. m_nested_comment, { nested comments }
  123. m_tp_procvar, { tp style procvars (no @ needed) }
  124. m_repeat_forward, { repeating forward declarations is needed }
  125. m_pointer_2_procedure, { allows the assignement of pointers to
  126. procedure variables }
  127. m_autoderef, { does auto dereferencing of struct. vars }
  128. m_initfinal, { initialization/finalization for units }
  129. m_add_pointer, { allow pointer add/sub operations }
  130. m_default_ansistring, { ansistring turned on by default }
  131. m_out, { support the calling convention OUT }
  132. m_default_para, { support default parameters }
  133. m_hintdirective, { support hint directives }
  134. m_duplicate_names { allow locals/paras to have duplicate names of globals }
  135. );
  136. tmodeswitches = set of tmodeswitch;
  137. { win32 & OS/2 application types }
  138. tapptype = (app_none,
  139. app_gui,app_cui,app_fs
  140. );
  141. { interface types }
  142. tinterfacetypes = (
  143. it_interfacecom,
  144. it_interfacecorba
  145. );
  146. { currently parsed block type }
  147. tblock_type = (bt_none,
  148. bt_general,bt_type,bt_const,bt_except
  149. );
  150. { calling convention for tprocdef and tprocvardef }
  151. tproccalloption=(pocall_none,
  152. pocall_cdecl, { procedure uses C styled calling }
  153. pocall_cppdecl, { C++ calling conventions }
  154. pocall_compilerproc, { Procedure is used for internal compiler calls }
  155. pocall_far16, { Far16 for OS/2 }
  156. pocall_fpccall, { FPC default calling }
  157. pocall_inline, { Procedure is an assembler macro }
  158. pocall_internconst, { procedure has constant evaluator intern }
  159. pocall_internproc, { Procedure has compiler magic}
  160. pocall_palmossyscall, { procedure is a PalmOS system call }
  161. pocall_pascal, { pascal standard left to right }
  162. pocall_register, { procedure uses register (fastcall) calling }
  163. pocall_safecall, { safe call calling conventions }
  164. pocall_stdcall, { procedure uses stdcall call }
  165. pocall_system { system call }
  166. );
  167. tproccalloptions = set of tproccalloption;
  168. const
  169. proccalloptionStr : array[tproccalloption] of string[14]=('',
  170. 'CDecl',
  171. 'CPPDecl',
  172. 'CompilerProc',
  173. 'Far16',
  174. 'FPCCall',
  175. 'Inline',
  176. 'InternConst',
  177. 'InternProc',
  178. 'PalmOSSysCall',
  179. 'Pascal',
  180. 'Register',
  181. 'SafeCall',
  182. 'StdCall',
  183. 'System'
  184. );
  185. type
  186. stringid = string[maxidlen];
  187. tnormalset = set of byte; { 256 elements set }
  188. pnormalset = ^tnormalset;
  189. pdouble = ^double;
  190. pbyte = ^byte;
  191. pword = ^word;
  192. plongint = ^longint;
  193. Tconstant=record
  194. case signed:boolean of
  195. false:
  196. (valueu:cardinal);
  197. true:
  198. (values:longint);
  199. end;
  200. {$ifndef Delphi}
  201. {$ifndef xFPC}
  202. type
  203. pguid = ^tguid;
  204. tguid = packed record
  205. D1: LongWord;
  206. D2: Word;
  207. D3: Word;
  208. D4: array[0..7] of Byte;
  209. end;
  210. {$endif}
  211. {$endif}
  212. const
  213. { link options }
  214. link_none = $0;
  215. link_allways = $1;
  216. link_static = $2;
  217. link_smart = $4;
  218. link_shared = $8;
  219. implementation
  220. end.
  221. {
  222. $Log$
  223. Revision 1.20 2002-01-24 18:25:48 peter
  224. * implicit result variable generation for assembler routines
  225. * removed m_tp modeswitch, use m_tp7 or not(m_fpc) instead
  226. Revision 1.19 2001/10/25 21:22:32 peter
  227. * calling convention rewrite
  228. Revision 1.18 2001/10/24 11:46:06 marco
  229. * Opt Align fix.
  230. Revision 1.17 2001/10/23 21:49:42 peter
  231. * $calling directive and -Cc commandline patch added
  232. from Pavel Ozerski
  233. Revision 1.16 2001/10/20 20:30:21 peter
  234. * read only typed const support, switch $J-
  235. Revision 1.15 2001/09/17 21:29:11 peter
  236. * merged netbsd, fpu-overflow from fixes branch
  237. Revision 1.14 2001/07/30 20:59:27 peter
  238. * m68k updates from v10 merged
  239. Revision 1.13 2001/07/01 20:16:15 peter
  240. * alignmentinfo record added
  241. * -Oa argument supports more alignment settings that can be specified
  242. per type: PROC,LOOP,VARMIN,VARMAX,CONSTMIN,CONSTMAX,RECORDMIN
  243. RECORDMAX,LOCALMIN,LOCALMAX. It is possible to set the mimimum
  244. required alignment and the maximum usefull alignment. The final
  245. alignment will be choosen per variable size dependent on these
  246. settings
  247. Revision 1.12 2001/06/03 21:57:35 peter
  248. + hint directive parsing support
  249. Revision 1.11 2001/01/20 18:32:52 hajny
  250. + APPTYPE support under OS/2, app_fs, GetEnvPChar for OS/2
  251. Revision 1.10 2000/11/29 00:30:30 florian
  252. * unused units removed from uses clause
  253. * some changes for widestrings
  254. Revision 1.9 2000/11/12 22:20:37 peter
  255. * create generic toutputsection for binary writers
  256. Revision 1.8 2000/11/04 14:25:19 florian
  257. + merged Attila's changes for interfaces, not tested yet
  258. Revision 1.7 2000/09/24 15:06:16 peter
  259. * use defines.inc
  260. Revision 1.6 2000/09/21 11:30:49 jonas
  261. + support for full boolean evaluation (b+/b-), default remains short
  262. circuit boolean evaluation
  263. Revision 1.5 2000/08/05 13:25:06 peter
  264. * packenum 1 fixes (merged)
  265. Revision 1.4 2000/08/02 19:49:59 peter
  266. * first things for default parameters
  267. Revision 1.3 2000/07/13 12:08:25 michael
  268. + patched to 1.1.0 with former 1.09patch from peter
  269. Revision 1.2 2000/07/13 11:32:41 michael
  270. + removed logs
  271. }