2
File: ConditionalMacros.p
4
Contains: Set up for compiler independent conditionals
6
Version: Technology: Universal Interface Files
7
Release: Universal Interfaces 3.4.2
9
Copyright: � 1993-2002 by Apple Computer, Inc., all rights reserved
11
Bugs?: For bug reports, consult the following page on
14
http://www.freepascal.org/bugs.html
20
Modified for use with Free Pascal
22
Please report any bugs to <gpc@microbizz.nl>
31
unit ConditionalMacros;
33
{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
34
{$setc GAP_INTERFACES_VERSION := $0200}
36
{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
37
{$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
40
{$ifc defined CPUPOWERPC and defined CPUI386}
41
{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
43
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
44
{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
47
{$ifc not defined __ppc__ and defined CPUPOWERPC}
52
{$ifc not defined __i386__ and defined CPUI386}
58
{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
59
{$error Conflicting definitions for __ppc__ and __i386__}
62
{$ifc defined __ppc__ and __ppc__}
63
{$setc TARGET_CPU_PPC := TRUE}
64
{$setc TARGET_CPU_X86 := FALSE}
65
{$elifc defined __i386__ and __i386__}
66
{$setc TARGET_CPU_PPC := FALSE}
67
{$setc TARGET_CPU_X86 := TRUE}
69
{$error Neither __ppc__ nor __i386__ is defined.}
71
{$setc TARGET_CPU_PPC_64 := FALSE}
73
{$ifc defined FPC_BIG_ENDIAN}
74
{$setc TARGET_RT_BIG_ENDIAN := TRUE}
75
{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
76
{$elifc defined FPC_LITTLE_ENDIAN}
77
{$setc TARGET_RT_BIG_ENDIAN := FALSE}
78
{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
80
{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
82
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
83
{$setc CALL_NOT_IN_CARBON := FALSE}
84
{$setc OLDROUTINENAMES := FALSE}
85
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
86
{$setc OPAQUE_UPP_TYPES := TRUE}
87
{$setc OTCARBONAPPLICATION := TRUE}
88
{$setc OTKERNEL := FALSE}
89
{$setc PM_USE_SESSION_APIS := TRUE}
90
{$setc TARGET_API_MAC_CARBON := TRUE}
91
{$setc TARGET_API_MAC_OS8 := FALSE}
92
{$setc TARGET_API_MAC_OSX := TRUE}
93
{$setc TARGET_CARBON := TRUE}
94
{$setc TARGET_CPU_68K := FALSE}
95
{$setc TARGET_CPU_MIPS := FALSE}
96
{$setc TARGET_CPU_SPARC := FALSE}
97
{$setc TARGET_OS_MAC := TRUE}
98
{$setc TARGET_OS_UNIX := FALSE}
99
{$setc TARGET_OS_WIN32 := FALSE}
100
{$setc TARGET_RT_MAC_68881 := FALSE}
101
{$setc TARGET_RT_MAC_CFM := FALSE}
102
{$setc TARGET_RT_MAC_MACHO := TRUE}
103
{$setc TYPED_FUNCTION_POINTERS := TRUE}
104
{$setc TYPE_BOOL := FALSE}
105
{$setc TYPE_EXTENDED := FALSE}
106
{$setc TYPE_LONGLONG := TRUE}
109
{***************************************************************************************************
110
UNIVERSAL_INTERFACES_VERSION
112
0x0400 --> version 4.0 (Mac OS X only)
113
0x0341 --> version 3.4.1
114
0x0340 --> version 3.4
115
0x0331 --> version 3.3.1
116
0x0330 --> version 3.3
117
0x0320 --> version 3.2
118
0x0310 --> version 3.1
119
0x0301 --> version 3.0.1
120
0x0300 --> version 3.0
121
0x0210 --> version 2.1
122
This conditional did not exist prior to version 2.1
123
***************************************************************************************************}
126
{***************************************************************************************************
129
These conditionals specify which microprocessor instruction set is being
130
generated. At most one of these is true, the rest are false.
132
TARGET_CPU_PPC - Compiler is generating PowerPC instructions
133
TARGET_CPU_68K - Compiler is generating 680x0 instructions
134
TARGET_CPU_X86 - Compiler is generating x86 instructions
135
TARGET_CPU_MIPS - Compiler is generating MIPS instructions
136
TARGET_CPU_SPARC - Compiler is generating Sparc instructions
137
TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions
141
These conditionals specify in which Operating System the generated code will
142
run. At most one of the these is true, the rest are false.
144
TARGET_OS_MAC - Generate code will run under Mac OS
145
TARGET_OS_WIN32 - Generate code will run under 32-bit Windows
146
TARGET_OS_UNIX - Generate code will run under some unix
150
These conditionals specify in which runtime the generated code will
151
run. This is needed when the OS and CPU support more than one runtime
152
(e.g. MacOS on 68K supports CFM68K and Classic 68k).
154
TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers
155
TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers
156
TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
157
TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O style runtime
158
TARGET_RT_MAC_68881 - TARGET_OS_MAC is true and 68881 floating point instructions used
162
These conditionals are used to differentiate between sets of API's on the same
163
processor under the same OS. The first section after _API_ is the OS. The
164
second section is the API set. Unlike TARGET_OS_ and TARGET_CPU_, these
165
conditionals are not mutally exclusive. This file will attempt to auto-configure
166
all TARGET_API_�_� values, but will often need a TARGET_API_�_� value predefined
167
in order to disambiguate.
169
TARGET_API_MAC_OS8 - Code is being compiled to run on System 7 through Mac OS 8.x
170
TARGET_API_MAC_CARBON - Code is being compiled to run on Mac OS 8 and Mac OS X via CarbonLib
171
TARGET_API_MAC_OSX - Code is being compiled to run on Mac OS X
175
These conditionals specify whether the compiler supports particular #pragma's
177
PRAGMA_IMPORT - Compiler supports: #pragma import on/off/reset
178
PRAGMA_ONCE - Compiler supports: #pragma once
179
PRAGMA_STRUCT_ALIGN - Compiler supports: #pragma options align=mac68k/power/reset
180
PRAGMA_STRUCT_PACK - Compiler supports: #pragma pack(n)
181
PRAGMA_STRUCT_PACKPUSH - Compiler supports: #pragma pack(push, n)/pack(pop)
182
PRAGMA_ENUM_PACK - Compiler supports: #pragma options(!pack_enums)
183
PRAGMA_ENUM_ALWAYSINT - Compiler supports: #pragma enumsalwaysint on/off/reset
184
PRAGMA_ENUM_OPTIONS - Compiler supports: #pragma options enum=int/small/reset
188
This conditional does the proper byte swapping to assue that a four character code (e.g. 'TEXT')
189
is compiled down to the correct value on all compilers.
191
$61626364 (* 'abcd' *) - Convert a four-char-code to the correct 32-bit value
195
These conditionals specify whether the compiler supports particular types.
197
TYPE_LONGLONG - Compiler supports "long long" 64-bit integers
198
TYPE_BOOL - Compiler supports "bool"
199
TYPE_EXTENDED - Compiler supports "extended" 80/96 bit floating point
200
TYPE_LONGDOUBLE_IS_DOUBLE - Compiler implements "long double" same as "double"
204
These conditionals specify whether the compiler supports particular language extensions
205
to function prototypes and definitions.
207
FUNCTION_PASCAL - Compiler supports "pascal void Foo()"
208
FUNCTION_DECLSPEC - Compiler supports "__declspec(xxx) void Foo()"
209
FUNCTION_WIN32CC - Compiler supports "void __cdecl Foo()" and "void __stdcall Foo()"
211
***************************************************************************************************}
214
{***************************************************************************************************
215
Backward compatibility for clients expecting 2.x version on ConditionalMacros.h
217
GENERATINGPOWERPC - Compiler is generating PowerPC instructions
218
GENERATING68K - Compiler is generating 68k family instructions
219
GENERATING68881 - Compiler is generating mc68881 floating point instructions
220
GENERATINGCFM - Code being generated assumes CFM calling conventions
221
CFMSYSTEMCALLS - No A-traps. Systems calls are made using CFM and UPP's
222
PRAGMA_ALIGN_SUPPORTED - Compiler supports: #pragma options align=mac68k/power/reset
223
PRAGMA_IMPORT_SUPPORTED - Compiler supports: #pragma import on/off/reset
224
CGLUESUPPORTED - Clients can use all lowercase toolbox functions that take C strings instead of pascal strings
226
***************************************************************************************************}
229
{***************************************************************************************************
231
OLDROUTINENAMES - "Old" names for Macintosh system calls are allowed in source code.
232
(e.g. DisposPtr instead of DisposePtr). The names of system routine
233
are now more sensitive to change because CFM binds by name. In the
234
past, system routine names were compiled out to just an A-Trap.
235
Macros have been added that each map an old name to its new name.
236
This allows old routine names to be used in existing source files,
237
but the macros only work if OLDROUTINENAMES is true. This support
238
will be removed in the near future. Thus, all source code should
239
be changed to use the new names! You can set OLDROUTINENAMES to false
240
to see if your code has any old names left in it.
242
***************************************************************************************************}
245
{***************************************************************************************************
247
TARGET_CARBON - default: false. Switches all of the above as described. Overrides all others
248
- NOTE: If you set TARGET_CARBON to 1, then the other switches will be setup by
249
ConditionalMacros, and should not be set manually.
251
If you wish to do development for pre-Carbon Systems, you can set the following:
253
OPAQUE_TOOLBOX_STRUCTS - default: false. True for Carbon builds, hides struct fields.
254
OPAQUE_UPP_TYPES - default: false. True for Carbon builds, UPP types are unique and opaque.
255
ACCESSOR_CALLS_ARE_FUNCTIONS - default: false. True for Carbon builds, enables accessor functions.
256
CALL_NOT_IN_CARBON - default: true. False for Carbon builds, hides calls not supported in Carbon.
258
Specifically, if you are building a non-Carbon application (one that links against InterfaceLib)
259
but you wish to use some of the accessor functions, you can set ACCESSOR_CALLS_ARE_FUNCTIONS to 1
260
and link with CarbonAccessors.o, which implements just the accessor functions. This will help you
261
preserve source compatibility between your Carbon and non-Carbon application targets.
263
MIXEDMODE_CALLS_ARE_FUNCTIONS - deprecated.
265
***************************************************************************************************}