| 1 | /* |
| 2 | * Copyright (c) 1993-2011 by Apple Inc.. All rights reserved. |
| 3 | * |
| 4 | * @APPLE_LICENSE_HEADER_START@ |
| 5 | * |
| 6 | * This file contains Original Code and/or Modifications of Original Code |
| 7 | * as defined in and that are subject to the Apple Public Source License |
| 8 | * Version 2.0 (the 'License'). You may not use this file except in |
| 9 | * compliance with the License. Please obtain a copy of the License at |
| 10 | * http://www.opensource.apple.com/apsl/ and read it before using this |
| 11 | * file. |
| 12 | * |
| 13 | * The Original Code and all software distributed under the License are |
| 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
| 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
| 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
| 18 | * Please see the License for the specific language governing rights and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | * @APPLE_LICENSE_HEADER_END@ |
| 22 | */ |
| 23 | |
| 24 | /* |
| 25 | File: ConditionalMacros.h |
| 26 | |
| 27 | Contains: Set up for compiler independent conditionals |
| 28 | |
| 29 | Version: CarbonCore-769~1 |
| 30 | |
| 31 | Bugs?: For bug reports, consult the following page on |
| 32 | the World Wide Web: |
| 33 | |
| 34 | http://developer.apple.com/bugreporter/ |
| 35 | |
| 36 | */ |
| 37 | #ifndef __CONDITIONALMACROS__ |
| 38 | #define __CONDITIONALMACROS__ |
| 39 | |
| 40 | #include <Availability.h> |
| 41 | /**************************************************************************************************** |
| 42 | UNIVERSAL_INTERFACES_VERSION |
| 43 | |
| 44 | 0x0400 --> version 4.0 (Mac OS X only) |
| 45 | 0x0335 --> version 3.4 |
| 46 | 0x0331 --> version 3.3.1 |
| 47 | 0x0330 --> version 3.3 |
| 48 | 0x0320 --> version 3.2 |
| 49 | 0x0310 --> version 3.1 |
| 50 | 0x0301 --> version 3.0.1 |
| 51 | 0x0300 --> version 3.0 |
| 52 | 0x0210 --> version 2.1 |
| 53 | This conditional did not exist prior to version 2.1 |
| 54 | ****************************************************************************************************/ |
| 55 | #define UNIVERSAL_INTERFACES_VERSION 0x0400 |
| 56 | /**************************************************************************************************** |
| 57 | |
| 58 | All TARGET_* condtionals are set up by TargetConditionals.h |
| 59 | |
| 60 | ****************************************************************************************************/ |
| 61 | #include <TargetConditionals.h> |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | /**************************************************************************************************** |
| 67 | |
| 68 | PRAGMA_* |
| 69 | These conditionals specify whether the compiler supports particular #pragma's |
| 70 | |
| 71 | PRAGMA_IMPORT - Compiler supports: #pragma import on/off/reset |
| 72 | PRAGMA_ONCE - Compiler supports: #pragma once |
| 73 | PRAGMA_STRUCT_ALIGN - Compiler supports: #pragma options align=mac68k/power/reset |
| 74 | PRAGMA_STRUCT_PACK - Compiler supports: #pragma pack(n) |
| 75 | PRAGMA_STRUCT_PACKPUSH - Compiler supports: #pragma pack(push, n)/pack(pop) |
| 76 | PRAGMA_ENUM_PACK - Compiler supports: #pragma options(!pack_enums) |
| 77 | PRAGMA_ENUM_ALWAYSINT - Compiler supports: #pragma enumsalwaysint on/off/reset |
| 78 | PRAGMA_ENUM_OPTIONS - Compiler supports: #pragma options enum=int/small/reset |
| 79 | |
| 80 | |
| 81 | FOUR_CHAR_CODE |
| 82 | This conditional is deprecated. It was used to work around a bug in one obscure compiler that did not pack multiple characters in single quotes rationally. |
| 83 | It was never intended for endian swapping. |
| 84 | |
| 85 | FOUR_CHAR_CODE('abcd') - Convert a four-char-code to the correct 32-bit value |
| 86 | |
| 87 | |
| 88 | TYPE_* |
| 89 | These conditionals specify whether the compiler supports particular types. |
| 90 | |
| 91 | TYPE_LONGLONG - Compiler supports "long long" 64-bit integers |
| 92 | TYPE_EXTENDED - Compiler supports "extended" 80/96 bit floating point |
| 93 | TYPE_LONGDOUBLE_IS_DOUBLE - Compiler implements "long double" same as "double" |
| 94 | |
| 95 | |
| 96 | FUNCTION_* |
| 97 | These conditionals specify whether the compiler supports particular language extensions |
| 98 | to function prototypes and definitions. |
| 99 | |
| 100 | FUNCTION_PASCAL - Compiler supports "pascal void Foo()" |
| 101 | FUNCTION_DECLSPEC - Compiler supports "__declspec(xxx) void Foo()" |
| 102 | FUNCTION_WIN32CC - Compiler supports "void __cdecl Foo()" and "void __stdcall Foo()" |
| 103 | |
| 104 | ****************************************************************************************************/ |
| 105 | |
| 106 | #if defined(__GNUC__) && (defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__NEXT_CPP__) || defined(__MACOS_CLASSIC__)) |
| 107 | /* |
| 108 | gcc based compilers used on Mac OS X |
| 109 | */ |
| 110 | #define PRAGMA_IMPORT 0 |
| 111 | #define PRAGMA_ONCE 0 |
| 112 | |
| 113 | #if __GNUC__ >= 4 |
| 114 | #define PRAGMA_STRUCT_PACK 1 |
| 115 | #define PRAGMA_STRUCT_PACKPUSH 1 |
| 116 | #else |
| 117 | #define PRAGMA_STRUCT_PACK 0 |
| 118 | #define PRAGMA_STRUCT_PACKPUSH 0 |
| 119 | #endif |
| 120 | |
| 121 | #if __LP64__ || __arm64__ || __ARM_ARCH_7K |
| 122 | #define PRAGMA_STRUCT_ALIGN 0 |
| 123 | #else |
| 124 | #define PRAGMA_STRUCT_ALIGN 1 |
| 125 | #endif |
| 126 | |
| 127 | #define PRAGMA_ENUM_PACK 0 |
| 128 | #define PRAGMA_ENUM_ALWAYSINT 0 |
| 129 | #define PRAGMA_ENUM_OPTIONS 0 |
| 130 | #define FOUR_CHAR_CODE(x) (x) |
| 131 | |
| 132 | #define TYPE_EXTENDED 0 |
| 133 | |
| 134 | #ifdef __ppc__ |
| 135 | #ifdef __LONG_DOUBLE_128__ |
| 136 | #define TYPE_LONGDOUBLE_IS_DOUBLE 0 |
| 137 | #else |
| 138 | #define TYPE_LONGDOUBLE_IS_DOUBLE 1 |
| 139 | #endif |
| 140 | #else |
| 141 | #define TYPE_LONGDOUBLE_IS_DOUBLE 0 |
| 142 | #endif |
| 143 | |
| 144 | #define TYPE_LONGLONG 1 |
| 145 | |
| 146 | #define FUNCTION_PASCAL 0 |
| 147 | #define FUNCTION_DECLSPEC 0 |
| 148 | #define FUNCTION_WIN32CC 0 |
| 149 | |
| 150 | #ifdef __MACOS_CLASSIC__ |
| 151 | #ifndef TARGET_API_MAC_CARBON /* gcc cfm cross compiler assumes you're building Carbon code */ |
| 152 | #define TARGET_API_MAC_CARBON 1 |
| 153 | #endif |
| 154 | #endif |
| 155 | |
| 156 | |
| 157 | |
| 158 | #elif defined(__MWERKS__) |
| 159 | /* |
| 160 | CodeWarrior compiler from Metrowerks/Motorola |
| 161 | */ |
| 162 | #define PRAGMA_ONCE 1 |
| 163 | #define PRAGMA_IMPORT 0 |
| 164 | #define PRAGMA_STRUCT_ALIGN 1 |
| 165 | #define PRAGMA_STRUCT_PACK 1 |
| 166 | #define PRAGMA_STRUCT_PACKPUSH 0 |
| 167 | #define PRAGMA_ENUM_PACK 0 |
| 168 | #define PRAGMA_ENUM_ALWAYSINT 1 |
| 169 | #define PRAGMA_ENUM_OPTIONS 0 |
| 170 | #if __option(enumsalwaysint) && __option(ANSI_strict) |
| 171 | #define FOUR_CHAR_CODE(x) ((long)(x)) /* otherwise compiler will complain about values with high bit set */ |
| 172 | #else |
| 173 | #define FOUR_CHAR_CODE(x) (x) |
| 174 | #endif |
| 175 | #define FUNCTION_PASCAL 1 |
| 176 | #define FUNCTION_DECLSPEC 1 |
| 177 | #define FUNCTION_WIN32CC 0 |
| 178 | |
| 179 | #if __option(longlong) |
| 180 | #define TYPE_LONGLONG 1 |
| 181 | #else |
| 182 | #define TYPE_LONGLONG 0 |
| 183 | #endif |
| 184 | #define TYPE_EXTENDED 0 |
| 185 | #define TYPE_LONGDOUBLE_IS_DOUBLE 1 |
| 186 | |
| 187 | |
| 188 | |
| 189 | #else |
| 190 | /* |
| 191 | Unknown compiler, perhaps set up from the command line |
| 192 | */ |
| 193 | #error unknown compiler |
| 194 | #ifndef PRAGMA_IMPORT |
| 195 | #define PRAGMA_IMPORT 0 |
| 196 | #endif |
| 197 | #ifndef PRAGMA_STRUCT_ALIGN |
| 198 | #define PRAGMA_STRUCT_ALIGN 0 |
| 199 | #endif |
| 200 | #ifndef PRAGMA_ONCE |
| 201 | #define PRAGMA_ONCE 0 |
| 202 | #endif |
| 203 | #ifndef PRAGMA_STRUCT_PACK |
| 204 | #define PRAGMA_STRUCT_PACK 0 |
| 205 | #endif |
| 206 | #ifndef PRAGMA_STRUCT_PACKPUSH |
| 207 | #define PRAGMA_STRUCT_PACKPUSH 0 |
| 208 | #endif |
| 209 | #ifndef PRAGMA_ENUM_PACK |
| 210 | #define PRAGMA_ENUM_PACK 0 |
| 211 | #endif |
| 212 | #ifndef PRAGMA_ENUM_ALWAYSINT |
| 213 | #define PRAGMA_ENUM_ALWAYSINT 0 |
| 214 | #endif |
| 215 | #ifndef PRAGMA_ENUM_OPTIONS |
| 216 | #define PRAGMA_ENUM_OPTIONS 0 |
| 217 | #endif |
| 218 | #ifndef FOUR_CHAR_CODE |
| 219 | #define FOUR_CHAR_CODE(x) (x) |
| 220 | #endif |
| 221 | |
| 222 | #ifndef TYPE_LONGDOUBLE_IS_DOUBLE |
| 223 | #define TYPE_LONGDOUBLE_IS_DOUBLE 1 |
| 224 | #endif |
| 225 | #ifndef TYPE_EXTENDED |
| 226 | #define TYPE_EXTENDED 0 |
| 227 | #endif |
| 228 | #ifndef TYPE_LONGLONG |
| 229 | #define TYPE_LONGLONG 0 |
| 230 | #endif |
| 231 | #ifndef FUNCTION_PASCAL |
| 232 | #define FUNCTION_PASCAL 0 |
| 233 | #endif |
| 234 | #ifndef FUNCTION_DECLSPEC |
| 235 | #define FUNCTION_DECLSPEC 0 |
| 236 | #endif |
| 237 | #ifndef FUNCTION_WIN32CC |
| 238 | #define FUNCTION_WIN32CC 0 |
| 239 | #endif |
| 240 | #endif |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | /**************************************************************************************************** |
| 246 | |
| 247 | Under MacOS, the classic 68k runtime has two calling conventions: pascal or C |
| 248 | Under Win32, there are two calling conventions: __cdecl or __stdcall |
| 249 | Headers and implementation files can use the following macros to make their |
| 250 | source more portable by hiding the calling convention details: |
| 251 | |
| 252 | EXTERN_API* |
| 253 | These macros are used to specify the calling convention on a function prototype. |
| 254 | |
| 255 | EXTERN_API - Classic 68k: pascal, Win32: __cdecl |
| 256 | EXTERN_API_C - Classic 68k: C, Win32: __cdecl |
| 257 | EXTERN_API_STDCALL - Classic 68k: pascal, Win32: __stdcall |
| 258 | EXTERN_API_C_STDCALL - Classic 68k: C, Win32: __stdcall |
| 259 | |
| 260 | |
| 261 | DEFINE_API* |
| 262 | These macros are used to specify the calling convention on a function definition. |
| 263 | |
| 264 | DEFINE_API - Classic 68k: pascal, Win32: __cdecl |
| 265 | DEFINE_API_C - Classic 68k: C, Win32: __cdecl |
| 266 | DEFINE_API_STDCALL - Classic 68k: pascal, Win32: __stdcall |
| 267 | DEFINE_API_C_STDCALL - Classic 68k: C, Win32: __stdcall |
| 268 | |
| 269 | |
| 270 | CALLBACK_API* |
| 271 | These macros are used to specify the calling convention of a function pointer. |
| 272 | |
| 273 | CALLBACK_API - Classic 68k: pascal, Win32: __stdcall |
| 274 | CALLBACK_API_C - Classic 68k: C, Win32: __stdcall |
| 275 | CALLBACK_API_STDCALL - Classic 68k: pascal, Win32: __cdecl |
| 276 | CALLBACK_API_C_STDCALL - Classic 68k: C, Win32: __cdecl |
| 277 | |
| 278 | ****************************************************************************************************/ |
| 279 | |
| 280 | #if FUNCTION_PASCAL && !FUNCTION_DECLSPEC && !FUNCTION_WIN32CC |
| 281 | /* compiler supports pascal keyword only */ |
| 282 | #define EXTERN_API(_type) extern pascal _type |
| 283 | #define EXTERN_API_C(_type) extern _type |
| 284 | #define EXTERN_API_STDCALL(_type) extern pascal _type |
| 285 | #define EXTERN_API_C_STDCALL(_type) extern _type |
| 286 | |
| 287 | #define DEFINE_API(_type) pascal _type |
| 288 | #define DEFINE_API_C(_type) _type |
| 289 | #define DEFINE_API_STDCALL(_type) pascal _type |
| 290 | #define DEFINE_API_C_STDCALL(_type) _type |
| 291 | |
| 292 | #define CALLBACK_API(_type, _name) pascal _type (*_name) |
| 293 | #define CALLBACK_API_C(_type, _name) _type (*_name) |
| 294 | #define CALLBACK_API_STDCALL(_type, _name) pascal _type (*_name) |
| 295 | #define CALLBACK_API_C_STDCALL(_type, _name) _type (*_name) |
| 296 | |
| 297 | #elif FUNCTION_PASCAL && FUNCTION_DECLSPEC && !FUNCTION_WIN32CC |
| 298 | /* compiler supports pascal and __declspec() */ |
| 299 | #define EXTERN_API(_type) extern pascal __declspec(dllimport) _type |
| 300 | #define EXTERN_API_C(_type) extern __declspec(dllimport) _type |
| 301 | #define EXTERN_API_STDCALL(_type) extern pascal __declspec(dllimport) _type |
| 302 | #define EXTERN_API_C_STDCALL(_type) extern __declspec(dllimport) _type |
| 303 | |
| 304 | #define DEFINE_API(_type) pascal __declspec(dllexport) _type |
| 305 | #define DEFINE_API_C(_type) __declspec(dllexport) _type |
| 306 | #define DEFINE_API_STDCALL(_type) pascal __declspec(dllexport) _type |
| 307 | #define DEFINE_API_C_STDCALL(_type) __declspec(dllexport) _type |
| 308 | |
| 309 | #define CALLBACK_API(_type, _name) pascal _type (*_name) |
| 310 | #define CALLBACK_API_C(_type, _name) _type (*_name) |
| 311 | #define CALLBACK_API_STDCALL(_type, _name) pascal _type (*_name) |
| 312 | #define CALLBACK_API_C_STDCALL(_type, _name) _type (*_name) |
| 313 | |
| 314 | #elif !FUNCTION_PASCAL && FUNCTION_DECLSPEC && !FUNCTION_WIN32CC |
| 315 | /* compiler supports __declspec() */ |
| 316 | #define EXTERN_API(_type) extern __declspec(dllimport) _type |
| 317 | #define EXTERN_API_C(_type) extern __declspec(dllimport) _type |
| 318 | #define EXTERN_API_STDCALL(_type) extern __declspec(dllimport) _type |
| 319 | #define EXTERN_API_C_STDCALL(_type) extern __declspec(dllimport) _type |
| 320 | |
| 321 | #define DEFINE_API(_type) __declspec(dllexport) _type |
| 322 | #define DEFINE_API_C(_type) __declspec(dllexport) _type |
| 323 | #define DEFINE_API_STDCALL(_type) __declspec(dllexport) _type |
| 324 | #define DEFINE_API_C_STDCALL(_type) __declspec(dllexport) _type |
| 325 | |
| 326 | #define CALLBACK_API(_type, _name) _type ( * _name) |
| 327 | #define CALLBACK_API_C(_type, _name) _type ( * _name) |
| 328 | #define CALLBACK_API_STDCALL(_type, _name) _type ( * _name) |
| 329 | #define CALLBACK_API_C_STDCALL(_type, _name) _type ( * _name) |
| 330 | |
| 331 | #elif !FUNCTION_PASCAL && FUNCTION_DECLSPEC && FUNCTION_WIN32CC |
| 332 | /* compiler supports __declspec() and __cdecl */ |
| 333 | #define EXTERN_API(_type) __declspec(dllimport) _type __cdecl |
| 334 | #define EXTERN_API_C(_type) __declspec(dllimport) _type __cdecl |
| 335 | #define EXTERN_API_STDCALL(_type) __declspec(dllimport) _type __stdcall |
| 336 | #define EXTERN_API_C_STDCALL(_type) __declspec(dllimport) _type __stdcall |
| 337 | |
| 338 | #define DEFINE_API(_type) __declspec(dllexport) _type __cdecl |
| 339 | #define DEFINE_API_C(_type) __declspec(dllexport) _type __cdecl |
| 340 | #define DEFINE_API_STDCALL(_type) __declspec(dllexport) _type __stdcall |
| 341 | #define DEFINE_API_C_STDCALL(_type) __declspec(dllexport) _type __stdcall |
| 342 | |
| 343 | #define CALLBACK_API(_type, _name) _type (__cdecl * _name) |
| 344 | #define CALLBACK_API_C(_type, _name) _type (__cdecl * _name) |
| 345 | #define CALLBACK_API_STDCALL(_type, _name) _type (__stdcall * _name) |
| 346 | #define CALLBACK_API_C_STDCALL(_type, _name) _type (__stdcall * _name) |
| 347 | |
| 348 | #elif !FUNCTION_PASCAL && !FUNCTION_DECLSPEC && FUNCTION_WIN32CC |
| 349 | /* compiler supports __cdecl */ |
| 350 | #define EXTERN_API(_type) _type __cdecl |
| 351 | #define EXTERN_API_C(_type) _type __cdecl |
| 352 | #define EXTERN_API_STDCALL(_type) _type __stdcall |
| 353 | #define EXTERN_API_C_STDCALL(_type) _type __stdcall |
| 354 | |
| 355 | #define DEFINE_API(_type) _type __cdecl |
| 356 | #define DEFINE_API_C(_type) _type __cdecl |
| 357 | #define DEFINE_API_STDCALL(_type) _type __stdcall |
| 358 | #define DEFINE_API_C_STDCALL(_type) _type __stdcall |
| 359 | |
| 360 | #define CALLBACK_API(_type, _name) _type (__cdecl * _name) |
| 361 | #define CALLBACK_API_C(_type, _name) _type (__cdecl * _name) |
| 362 | #define CALLBACK_API_STDCALL(_type, _name) _type (__stdcall * _name) |
| 363 | #define CALLBACK_API_C_STDCALL(_type, _name) _type (__stdcall * _name) |
| 364 | |
| 365 | #else |
| 366 | /* compiler supports no extensions */ |
| 367 | #define EXTERN_API(_type) extern _type |
| 368 | #define EXTERN_API_C(_type) extern _type |
| 369 | #define EXTERN_API_STDCALL(_type) extern _type |
| 370 | #define EXTERN_API_C_STDCALL(_type) extern _type |
| 371 | |
| 372 | #define DEFINE_API(_type) _type |
| 373 | #define DEFINE_API_C(_type) _type |
| 374 | #define DEFINE_API_STDCALL(_type) _type |
| 375 | #define DEFINE_API_C_STDCALL(_type) _type |
| 376 | |
| 377 | #define CALLBACK_API(_type, _name) _type ( * _name) |
| 378 | #define CALLBACK_API_C(_type, _name) _type ( * _name) |
| 379 | #define CALLBACK_API_STDCALL(_type, _name) _type ( * _name) |
| 380 | #define CALLBACK_API_C_STDCALL(_type, _name) _type ( * _name) |
| 381 | #undef pascal |
| 382 | #define pascal |
| 383 | #endif |
| 384 | |
| 385 | /**************************************************************************************************** |
| 386 | |
| 387 | Set up TARGET_API_*_* values |
| 388 | |
| 389 | ****************************************************************************************************/ |
| 390 | #if !defined(TARGET_API_MAC_OS8) && !defined(TARGET_API_MAC_OSX) && !defined(TARGET_API_MAC_CARBON) |
| 391 | /* No TARGET_API_MAC_* predefined on command line */ |
| 392 | #if TARGET_RT_MAC_MACHO |
| 393 | /* Looks like MachO style compiler */ |
| 394 | #define TARGET_API_MAC_OS8 0 |
| 395 | #define TARGET_API_MAC_CARBON 1 |
| 396 | #define TARGET_API_MAC_OSX 1 |
| 397 | #elif defined(TARGET_CARBON) && TARGET_CARBON |
| 398 | /* grandfather in use of TARGET_CARBON */ |
| 399 | #define TARGET_API_MAC_OS8 0 |
| 400 | #define TARGET_API_MAC_CARBON 1 |
| 401 | #define TARGET_API_MAC_OSX 0 |
| 402 | #elif TARGET_CPU_PPC && TARGET_RT_MAC_CFM |
| 403 | /* Looks like CFM style PPC compiler */ |
| 404 | #define TARGET_API_MAC_OS8 1 |
| 405 | #define TARGET_API_MAC_CARBON 0 |
| 406 | #define TARGET_API_MAC_OSX 0 |
| 407 | #else |
| 408 | /* 68k or some other compiler */ |
| 409 | #define TARGET_API_MAC_OS8 1 |
| 410 | #define TARGET_API_MAC_CARBON 0 |
| 411 | #define TARGET_API_MAC_OSX 0 |
| 412 | #endif /* */ |
| 413 | |
| 414 | #else |
| 415 | #ifndef TARGET_API_MAC_OS8 |
| 416 | #define TARGET_API_MAC_OS8 0 |
| 417 | #endif /* !defined(TARGET_API_MAC_OS8) */ |
| 418 | |
| 419 | #ifndef TARGET_API_MAC_OSX |
| 420 | #define TARGET_API_MAC_OSX TARGET_RT_MAC_MACHO |
| 421 | #endif /* !defined(TARGET_API_MAC_OSX) */ |
| 422 | |
| 423 | #ifndef TARGET_API_MAC_CARBON |
| 424 | #define TARGET_API_MAC_CARBON TARGET_API_MAC_OSX |
| 425 | #endif /* !defined(TARGET_API_MAC_CARBON) */ |
| 426 | |
| 427 | #endif /* !defined(TARGET_API_MAC_OS8) && !defined(TARGET_API_MAC_OSX) && !defined(TARGET_API_MAC_CARBON) */ |
| 428 | |
| 429 | #if TARGET_API_MAC_OS8 && TARGET_API_MAC_OSX |
| 430 | #error TARGET_API_MAC_OS8 and TARGET_API_MAC_OSX are mutually exclusive |
| 431 | #endif /* TARGET_API_MAC_OS8 && TARGET_API_MAC_OSX */ |
| 432 | |
| 433 | #if !TARGET_API_MAC_OS8 && !TARGET_API_MAC_CARBON && !TARGET_API_MAC_OSX |
| 434 | #error At least one of TARGET_API_MAC_* must be true |
| 435 | #endif /* !TARGET_API_MAC_OS8 && !TARGET_API_MAC_CARBON && !TARGET_API_MAC_OSX */ |
| 436 | |
| 437 | /* Support source code still using TARGET_CARBON */ |
| 438 | #ifndef TARGET_CARBON |
| 439 | #if TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8 |
| 440 | #define TARGET_CARBON 1 |
| 441 | #else |
| 442 | #define TARGET_CARBON 0 |
| 443 | #endif /* TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8 */ |
| 444 | |
| 445 | #endif /* !defined(TARGET_CARBON) */ |
| 446 | |
| 447 | /**************************************************************************************************** |
| 448 | Backward compatibility for clients expecting 2.x version on ConditionalMacros.h |
| 449 | |
| 450 | GENERATINGPOWERPC - Compiler is generating PowerPC instructions |
| 451 | GENERATING68K - Compiler is generating 68k family instructions |
| 452 | GENERATING68881 - Compiler is generating mc68881 floating point instructions |
| 453 | GENERATINGCFM - Code being generated assumes CFM calling conventions |
| 454 | CFMSYSTEMCALLS - No A-traps. Systems calls are made using CFM and UPP's |
| 455 | PRAGMA_ALIGN_SUPPORTED - Compiler supports: #pragma options align=mac68k/power/reset |
| 456 | PRAGMA_IMPORT_SUPPORTED - Compiler supports: #pragma import on/off/reset |
| 457 | CGLUESUPPORTED - Clients can use all lowercase toolbox functions that take C strings instead of pascal strings |
| 458 | |
| 459 | ****************************************************************************************************/ |
| 460 | #if !TARGET_API_MAC_CARBON |
| 461 | #define GENERATINGPOWERPC TARGET_CPU_PPC |
| 462 | #define GENERATING68K 0 |
| 463 | #define GENERATING68881 TARGET_RT_MAC_68881 |
| 464 | #define GENERATINGCFM TARGET_RT_MAC_CFM |
| 465 | #define CFMSYSTEMCALLS TARGET_RT_MAC_CFM |
| 466 | #ifndef CGLUESUPPORTED |
| 467 | #define CGLUESUPPORTED 0 |
| 468 | #endif /* !defined(CGLUESUPPORTED) */ |
| 469 | |
| 470 | #ifndef OLDROUTINELOCATIONS |
| 471 | #define OLDROUTINELOCATIONS 0 |
| 472 | #endif /* !defined(OLDROUTINELOCATIONS) */ |
| 473 | |
| 474 | #define PRAGMA_ALIGN_SUPPORTED PRAGMA_STRUCT_ALIGN |
| 475 | #define PRAGMA_IMPORT_SUPPORTED PRAGMA_IMPORT |
| 476 | #else |
| 477 | /* Carbon code should not use old conditionals */ |
| 478 | #define PRAGMA_ALIGN_SUPPORTED ..PRAGMA_ALIGN_SUPPORTED_is_obsolete.. |
| 479 | #define GENERATINGPOWERPC ..GENERATINGPOWERPC_is_obsolete.. |
| 480 | #define GENERATING68K ..GENERATING68K_is_obsolete.. |
| 481 | #define GENERATING68881 ..GENERATING68881_is_obsolete.. |
| 482 | #define GENERATINGCFM ..GENERATINGCFM_is_obsolete.. |
| 483 | #define CFMSYSTEMCALLS ..CFMSYSTEMCALLS_is_obsolete.. |
| 484 | #endif /* !TARGET_API_MAC_CARBON */ |
| 485 | |
| 486 | |
| 487 | |
| 488 | /**************************************************************************************************** |
| 489 | |
| 490 | OLDROUTINENAMES - "Old" names for Macintosh system calls are allowed in source code. |
| 491 | (e.g. DisposPtr instead of DisposePtr). The names of system routine |
| 492 | are now more sensitive to change because CFM binds by name. In the |
| 493 | past, system routine names were compiled out to just an A-Trap. |
| 494 | Macros have been added that each map an old name to its new name. |
| 495 | This allows old routine names to be used in existing source files, |
| 496 | but the macros only work if OLDROUTINENAMES is true. This support |
| 497 | will be removed in the near future. Thus, all source code should |
| 498 | be changed to use the new names! You can set OLDROUTINENAMES to false |
| 499 | to see if your code has any old names left in it. |
| 500 | |
| 501 | ****************************************************************************************************/ |
| 502 | #ifndef OLDROUTINENAMES |
| 503 | #define OLDROUTINENAMES 0 |
| 504 | #endif /* !defined(OLDROUTINENAMES) */ |
| 505 | |
| 506 | |
| 507 | |
| 508 | /**************************************************************************************************** |
| 509 | The following macros isolate the use of 68K inlines in function prototypes. |
| 510 | On the Mac OS under the Classic 68K runtime, function prototypes were followed |
| 511 | by a list of 68K opcodes which the compiler inserted in the generated code instead |
| 512 | of a JSR. Under Classic 68K on the Mac OS, this macro will put the opcodes |
| 513 | in the right syntax. For all other OS's and runtimes the macro suppress the opcodes. |
| 514 | Example: |
| 515 | |
| 516 | EXTERN_P void DrawPicture(PicHandle myPicture, const Rect *dstRect) |
| 517 | ONEWORDINLINE(0xA8F6); |
| 518 | |
| 519 | ****************************************************************************************************/ |
| 520 | |
| 521 | #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM |
| 522 | #define ONEWORDINLINE(w1) = w1 |
| 523 | #define TWOWORDINLINE(w1,w2) = {w1,w2} |
| 524 | #define THREEWORDINLINE(w1,w2,w3) = {w1,w2,w3} |
| 525 | #define FOURWORDINLINE(w1,w2,w3,w4) = {w1,w2,w3,w4} |
| 526 | #define FIVEWORDINLINE(w1,w2,w3,w4,w5) = {w1,w2,w3,w4,w5} |
| 527 | #define SIXWORDINLINE(w1,w2,w3,w4,w5,w6) = {w1,w2,w3,w4,w5,w6} |
| 528 | #define SEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7) = {w1,w2,w3,w4,w5,w6,w7} |
| 529 | #define EIGHTWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8) = {w1,w2,w3,w4,w5,w6,w7,w8} |
| 530 | #define NINEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9) = {w1,w2,w3,w4,w5,w6,w7,w8,w9} |
| 531 | #define TENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10} |
| 532 | #define ELEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11} |
| 533 | #define TWELVEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12} |
| 534 | #else |
| 535 | #define ONEWORDINLINE(w1) |
| 536 | #define TWOWORDINLINE(w1,w2) |
| 537 | #define THREEWORDINLINE(w1,w2,w3) |
| 538 | #define FOURWORDINLINE(w1,w2,w3,w4) |
| 539 | #define FIVEWORDINLINE(w1,w2,w3,w4,w5) |
| 540 | #define SIXWORDINLINE(w1,w2,w3,w4,w5,w6) |
| 541 | #define SEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7) |
| 542 | #define EIGHTWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8) |
| 543 | #define NINEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9) |
| 544 | #define TENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10) |
| 545 | #define ELEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11) |
| 546 | #define TWELVEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12) |
| 547 | #endif |
| 548 | |
| 549 | |
| 550 | /**************************************************************************************************** |
| 551 | |
| 552 | TARGET_CARBON - default: false. Switches all of the above as described. Overrides all others |
| 553 | - NOTE: If you set TARGET_CARBON to 1, then the other switches will be setup by |
| 554 | ConditionalMacros, and should not be set manually. |
| 555 | |
| 556 | If you wish to do development for pre-Carbon Systems, you can set the following: |
| 557 | |
| 558 | OPAQUE_TOOLBOX_STRUCTS - default: false. True for Carbon builds, hides struct fields. |
| 559 | OPAQUE_UPP_TYPES - default: false. True for Carbon builds, UPP types are unique and opaque. |
| 560 | ACCESSOR_CALLS_ARE_FUNCTIONS - default: false. True for Carbon builds, enables accessor functions. |
| 561 | CALL_NOT_IN_CARBON - default: true. False for Carbon builds, hides calls not supported in Carbon. |
| 562 | |
| 563 | Specifically, if you are building a non-Carbon application (one that links against InterfaceLib) |
| 564 | but you wish to use some of the accessor functions, you can set ACCESSOR_CALLS_ARE_FUNCTIONS to 1 |
| 565 | and link with CarbonAccessors.o, which implements just the accessor functions. This will help you |
| 566 | preserve source compatibility between your Carbon and non-Carbon application targets. |
| 567 | |
| 568 | MIXEDMODE_CALLS_ARE_FUNCTIONS - deprecated. |
| 569 | |
| 570 | ****************************************************************************************************/ |
| 571 | #if TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8 |
| 572 | #ifndef OPAQUE_TOOLBOX_STRUCTS |
| 573 | #define OPAQUE_TOOLBOX_STRUCTS 1 |
| 574 | #endif /* !defined(OPAQUE_TOOLBOX_STRUCTS) */ |
| 575 | |
| 576 | #ifndef OPAQUE_UPP_TYPES |
| 577 | #define OPAQUE_UPP_TYPES 1 |
| 578 | #endif /* !defined(OPAQUE_UPP_TYPES) */ |
| 579 | |
| 580 | #ifndef ACCESSOR_CALLS_ARE_FUNCTIONS |
| 581 | #define ACCESSOR_CALLS_ARE_FUNCTIONS 1 |
| 582 | #endif /* !defined(ACCESSOR_CALLS_ARE_FUNCTIONS) */ |
| 583 | |
| 584 | #ifndef CALL_NOT_IN_CARBON |
| 585 | #define CALL_NOT_IN_CARBON 0 |
| 586 | #endif /* !defined(CALL_NOT_IN_CARBON) */ |
| 587 | |
| 588 | #ifndef MIXEDMODE_CALLS_ARE_FUNCTIONS |
| 589 | #define MIXEDMODE_CALLS_ARE_FUNCTIONS 1 |
| 590 | #endif /* !defined(MIXEDMODE_CALLS_ARE_FUNCTIONS) */ |
| 591 | |
| 592 | #else |
| 593 | #ifndef OPAQUE_TOOLBOX_STRUCTS |
| 594 | #define OPAQUE_TOOLBOX_STRUCTS 0 |
| 595 | #endif /* !defined(OPAQUE_TOOLBOX_STRUCTS) */ |
| 596 | |
| 597 | #ifndef ACCESSOR_CALLS_ARE_FUNCTIONS |
| 598 | #define ACCESSOR_CALLS_ARE_FUNCTIONS 0 |
| 599 | #endif /* !defined(ACCESSOR_CALLS_ARE_FUNCTIONS) */ |
| 600 | |
| 601 | /* |
| 602 | * It's possible to have ACCESSOR_CALLS_ARE_FUNCTIONS set to true and OPAQUE_TOOLBOX_STRUCTS |
| 603 | * set to false, but not the other way around, so make sure the defines are not set this way. |
| 604 | */ |
| 605 | #ifndef CALL_NOT_IN_CARBON |
| 606 | #define CALL_NOT_IN_CARBON 1 |
| 607 | #endif /* !defined(CALL_NOT_IN_CARBON) */ |
| 608 | |
| 609 | #ifndef MIXEDMODE_CALLS_ARE_FUNCTIONS |
| 610 | #define MIXEDMODE_CALLS_ARE_FUNCTIONS 0 |
| 611 | #endif /* !defined(MIXEDMODE_CALLS_ARE_FUNCTIONS) */ |
| 612 | |
| 613 | #endif /* TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8 */ |
| 614 | |
| 615 | |
| 616 | |
| 617 | |
| 618 | #endif /* __CONDITIONALMACROS__ */ |
| 619 | |