| 1 | /* |
| 2 | * Copyright (c) 1985-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: MacTypes.h |
| 26 | |
| 27 | Contains: Basic Macintosh data types. |
| 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 __MACTYPES__ |
| 38 | #define __MACTYPES__ |
| 39 | |
| 40 | #if __has_include(<ConditionalMacros.h>) |
| 41 | #include <ConditionalMacros.h> |
| 42 | #endif |
| 43 | |
| 44 | #include <TargetConditionals.h> |
| 45 | |
| 46 | #include <stdbool.h> |
| 47 | |
| 48 | #include <sys/types.h> |
| 49 | |
| 50 | #include <Availability.h> |
| 51 | |
| 52 | #if PRAGMA_ONCE |
| 53 | #pragma once |
| 54 | #endif |
| 55 | |
| 56 | #ifdef __cplusplus |
| 57 | extern "C" { |
| 58 | #endif |
| 59 | |
| 60 | #pragma pack(push, 2) |
| 61 | |
| 62 | |
| 63 | /* |
| 64 | CarbonCore Deprecation flags. |
| 65 | |
| 66 | Certain Carbon API functions are deprecated in 10.3 and later |
| 67 | systems. These will produce a warning when compiling on 10.3. |
| 68 | |
| 69 | Other functions and constants do not produce meaningful |
| 70 | results when building Carbon for Mac OS X. For these |
| 71 | functions, no-op macros are provided, but only when the |
| 72 | ALLOW_OBSOLETE_CARBON flag is defined to be 0: eg |
| 73 | -DALLOW_OBSOLETE_CARBON=0. |
| 74 | */ |
| 75 | |
| 76 | #if ! defined(ALLOW_OBSOLETE_CARBON) || ! ALLOW_OBSOLETE_CARBON |
| 77 | |
| 78 | #define ALLOW_OBSOLETE_CARBON_MACMEMORY 0 |
| 79 | #define ALLOW_OBSOLETE_CARBON_OSUTILS 0 |
| 80 | |
| 81 | #else |
| 82 | |
| 83 | #define ALLOW_OBSOLETE_CARBON_MACMEMORY 1 /* Removes obsolete constants; turns HLock/HUnlock into no-op macros */ |
| 84 | #define ALLOW_OBSOLETE_CARBON_OSUTILS 1 /* Removes obsolete structures */ |
| 85 | |
| 86 | #endif |
| 87 | |
| 88 | #ifndef NULL |
| 89 | #define NULL __DARWIN_NULL |
| 90 | #endif /* ! NULL */ |
| 91 | #ifndef nil |
| 92 | #if defined(__has_feature) |
| 93 | #if __has_feature(cxx_nullptr) |
| 94 | #define nil nullptr |
| 95 | #else |
| 96 | #define nil __DARWIN_NULL |
| 97 | #endif |
| 98 | #else |
| 99 | #define nil __DARWIN_NULL |
| 100 | #endif |
| 101 | #endif |
| 102 | |
| 103 | /******************************************************************************** |
| 104 | |
| 105 | Base integer types for all target OS's and CPU's |
| 106 | |
| 107 | UInt8 8-bit unsigned integer |
| 108 | SInt8 8-bit signed integer |
| 109 | UInt16 16-bit unsigned integer |
| 110 | SInt16 16-bit signed integer |
| 111 | UInt32 32-bit unsigned integer |
| 112 | SInt32 32-bit signed integer |
| 113 | UInt64 64-bit unsigned integer |
| 114 | SInt64 64-bit signed integer |
| 115 | |
| 116 | *********************************************************************************/ |
| 117 | typedef unsigned char UInt8; |
| 118 | typedef signed char SInt8; |
| 119 | typedef unsigned short UInt16; |
| 120 | typedef signed short SInt16; |
| 121 | |
| 122 | #if __LP64__ |
| 123 | typedef unsigned int UInt32; |
| 124 | typedef signed int SInt32; |
| 125 | #else |
| 126 | typedef unsigned long UInt32; |
| 127 | typedef signed long SInt32; |
| 128 | #endif |
| 129 | |
| 130 | /* avoid redeclaration if libkern/OSTypes.h */ |
| 131 | #ifndef _OS_OSTYPES_H |
| 132 | #if TARGET_RT_BIG_ENDIAN |
| 133 | struct wide { |
| 134 | SInt32 hi; |
| 135 | UInt32 lo; |
| 136 | }; |
| 137 | typedef struct wide wide; |
| 138 | struct UnsignedWide { |
| 139 | UInt32 hi; |
| 140 | UInt32 lo; |
| 141 | }; |
| 142 | typedef struct UnsignedWide UnsignedWide; |
| 143 | #else |
| 144 | struct wide { |
| 145 | UInt32 lo; |
| 146 | SInt32 hi; |
| 147 | }; |
| 148 | typedef struct wide wide; |
| 149 | struct UnsignedWide { |
| 150 | UInt32 lo; |
| 151 | UInt32 hi; |
| 152 | }; |
| 153 | typedef struct UnsignedWide UnsignedWide; |
| 154 | #endif /* TARGET_RT_BIG_ENDIAN */ |
| 155 | |
| 156 | #endif |
| 157 | |
| 158 | #if TYPE_LONGLONG || 0 |
| 159 | /* |
| 160 | Note: wide and UnsignedWide must always be structs for source code |
| 161 | compatibility. On the other hand UInt64 and SInt64 can be |
| 162 | either a struct or a long long, depending on the compiler. |
| 163 | |
| 164 | If you use UInt64 and SInt64 you should do all operations on |
| 165 | those data types through the functions/macros in Math64.h. |
| 166 | This will assure that your code compiles with compilers that |
| 167 | support long long and those that don't. |
| 168 | |
| 169 | The MS Visual C/C++ compiler uses __int64 instead of long long. |
| 170 | */ |
| 171 | #if defined(_MSC_VER) && !defined(__MWERKS__) && defined(_M_IX86) |
| 172 | typedef signed __int64 SInt64; |
| 173 | typedef unsigned __int64 UInt64; |
| 174 | #else |
| 175 | typedef signed long long SInt64; |
| 176 | typedef unsigned long long UInt64; |
| 177 | #endif |
| 178 | #else |
| 179 | |
| 180 | |
| 181 | typedef wide SInt64; |
| 182 | typedef UnsignedWide UInt64; |
| 183 | #endif |
| 184 | |
| 185 | /******************************************************************************** |
| 186 | |
| 187 | Base fixed point types |
| 188 | |
| 189 | Fixed 16-bit signed integer plus 16-bit fraction |
| 190 | UnsignedFixed 16-bit unsigned integer plus 16-bit fraction |
| 191 | Fract 2-bit signed integer plus 30-bit fraction |
| 192 | ShortFixed 8-bit signed integer plus 8-bit fraction |
| 193 | |
| 194 | *********************************************************************************/ |
| 195 | typedef SInt32 Fixed; |
| 196 | typedef Fixed * FixedPtr; |
| 197 | typedef SInt32 Fract; |
| 198 | typedef Fract * FractPtr; |
| 199 | typedef UInt32 UnsignedFixed; |
| 200 | typedef UnsignedFixed * UnsignedFixedPtr; |
| 201 | typedef short ShortFixed; |
| 202 | typedef ShortFixed * ShortFixedPtr; |
| 203 | |
| 204 | |
| 205 | /******************************************************************************** |
| 206 | |
| 207 | Base floating point types |
| 208 | |
| 209 | Float32 32 bit IEEE float: 1 sign bit, 8 exponent bits, 23 fraction bits |
| 210 | Float64 64 bit IEEE float: 1 sign bit, 11 exponent bits, 52 fraction bits |
| 211 | Float80 80 bit MacOS float: 1 sign bit, 15 exponent bits, 1 integer bit, 63 fraction bits |
| 212 | Float96 96 bit 68881 float: 1 sign bit, 15 exponent bits, 16 pad bits, 1 integer bit, 63 fraction bits |
| 213 | |
| 214 | Note: These are fixed size floating point types, useful when writing a floating |
| 215 | point value to disk. If your compiler does not support a particular size |
| 216 | float, a struct is used instead. |
| 217 | Use one of the NCEG types (e.g. double_t) or an ANSI C type (e.g. double) if |
| 218 | you want a floating point representation that is natural for any given |
| 219 | compiler, but might be a different size on different compilers. |
| 220 | |
| 221 | *********************************************************************************/ |
| 222 | typedef float Float32; |
| 223 | typedef double Float64; |
| 224 | struct Float80 { |
| 225 | SInt16 exp; |
| 226 | UInt16 man[4]; |
| 227 | }; |
| 228 | typedef struct Float80 Float80; |
| 229 | |
| 230 | struct Float96 { |
| 231 | SInt16 exp[2]; /* the second 16-bits are undefined */ |
| 232 | UInt16 man[4]; |
| 233 | }; |
| 234 | typedef struct Float96 Float96; |
| 235 | struct Float32Point { |
| 236 | Float32 x; |
| 237 | Float32 y; |
| 238 | }; |
| 239 | typedef struct Float32Point Float32Point; |
| 240 | |
| 241 | /******************************************************************************** |
| 242 | |
| 243 | MacOS Memory Manager types |
| 244 | |
| 245 | Ptr Pointer to a non-relocatable block |
| 246 | Handle Pointer to a master pointer to a relocatable block |
| 247 | Size The number of bytes in a block (signed for historical reasons) |
| 248 | |
| 249 | *********************************************************************************/ |
| 250 | typedef char * Ptr; |
| 251 | typedef Ptr * Handle; |
| 252 | typedef long Size; |
| 253 | |
| 254 | /******************************************************************************** |
| 255 | |
| 256 | Higher level basic types |
| 257 | |
| 258 | OSErr 16-bit result error code |
| 259 | OSStatus 32-bit result error code |
| 260 | LogicalAddress Address in the clients virtual address space |
| 261 | ConstLogicalAddress Address in the clients virtual address space that will only be read |
| 262 | PhysicalAddress Real address as used on the hardware bus |
| 263 | BytePtr Pointer to an array of bytes |
| 264 | ByteCount The size of an array of bytes |
| 265 | ByteOffset An offset into an array of bytes |
| 266 | ItemCount 32-bit iteration count |
| 267 | OptionBits Standard 32-bit set of bit flags |
| 268 | PBVersion ? |
| 269 | Duration 32-bit millisecond timer for drivers |
| 270 | AbsoluteTime 64-bit clock |
| 271 | ScriptCode A particular set of written characters (e.g. Roman vs Cyrillic) and their encoding |
| 272 | LangCode A particular language (e.g. English), as represented using a particular ScriptCode |
| 273 | RegionCode Designates a language as used in a particular region (e.g. British vs American |
| 274 | English) together with other region-dependent characteristics (e.g. date format) |
| 275 | FourCharCode A 32-bit value made by packing four 1 byte characters together |
| 276 | OSType A FourCharCode used in the OS and file system (e.g. creator) |
| 277 | ResType A FourCharCode used to tag resources (e.g. 'DLOG') |
| 278 | |
| 279 | *********************************************************************************/ |
| 280 | typedef SInt16 OSErr; |
| 281 | typedef SInt32 OSStatus; |
| 282 | typedef void * LogicalAddress; |
| 283 | typedef const void * ConstLogicalAddress; |
| 284 | typedef void * PhysicalAddress; |
| 285 | typedef UInt8 * BytePtr; |
| 286 | typedef unsigned long ByteCount; |
| 287 | typedef unsigned long ByteOffset; |
| 288 | typedef SInt32 Duration; |
| 289 | typedef UnsignedWide AbsoluteTime; |
| 290 | typedef UInt32 OptionBits; |
| 291 | typedef unsigned long ItemCount; |
| 292 | typedef UInt32 PBVersion; |
| 293 | typedef SInt16 ScriptCode; |
| 294 | typedef SInt16 LangCode; |
| 295 | typedef SInt16 RegionCode; |
| 296 | typedef UInt32 FourCharCode; |
| 297 | typedef FourCharCode OSType; |
| 298 | typedef FourCharCode ResType; |
| 299 | typedef OSType * OSTypePtr; |
| 300 | typedef ResType * ResTypePtr; |
| 301 | /******************************************************************************** |
| 302 | |
| 303 | Boolean types and values |
| 304 | |
| 305 | Boolean Mac OS historic type, sizeof(Boolean)==1 |
| 306 | bool Defined in stdbool.h, ISO C/C++ standard type |
| 307 | false Now defined in stdbool.h |
| 308 | true Now defined in stdbool.h |
| 309 | |
| 310 | *********************************************************************************/ |
| 311 | typedef unsigned char Boolean; |
| 312 | |
| 313 | #if !0 |
| 314 | /******************************************************************************** |
| 315 | |
| 316 | Function Pointer Types |
| 317 | |
| 318 | ProcPtr Generic pointer to a function |
| 319 | Register68kProcPtr Pointer to a 68K function that expects parameters in registers |
| 320 | UniversalProcPtr Pointer to classic 68K code or a RoutineDescriptor |
| 321 | |
| 322 | ProcHandle Pointer to a ProcPtr |
| 323 | UniversalProcHandle Pointer to a UniversalProcPtr |
| 324 | |
| 325 | *********************************************************************************/ |
| 326 | typedef CALLBACK_API_C( long , ProcPtr )(void); |
| 327 | typedef CALLBACK_API( void , Register68kProcPtr )(void); |
| 328 | #if TARGET_RT_MAC_CFM |
| 329 | /* The RoutineDescriptor structure is defined in MixedMode.h */ |
| 330 | typedef struct RoutineDescriptor *UniversalProcPtr; |
| 331 | #else |
| 332 | typedef ProcPtr UniversalProcPtr; |
| 333 | #endif /* TARGET_RT_MAC_CFM */ |
| 334 | |
| 335 | typedef ProcPtr * ProcHandle; |
| 336 | typedef UniversalProcPtr * UniversalProcHandle; |
| 337 | #endif |
| 338 | |
| 339 | /******************************************************************************** |
| 340 | |
| 341 | RefCon Types |
| 342 | |
| 343 | For access to private data in callbacks, etc.; refcons are generally |
| 344 | used as a pointer to something, but in the 32-bit world refcons in |
| 345 | different APIs have had various types: pointer, unsigned scalar, and |
| 346 | signed scalar. The RefCon types defined here support the current 32-bit |
| 347 | usage but provide normalization to pointer types for 64-bit. |
| 348 | |
| 349 | PRefCon is preferred for new APIs; URefCon and SRefCon are primarily |
| 350 | for compatibility with existing APIs. |
| 351 | |
| 352 | *********************************************************************************/ |
| 353 | typedef void * PRefCon; |
| 354 | #if __LP64__ |
| 355 | typedef void * URefCon; |
| 356 | typedef void * SRefCon; |
| 357 | #else |
| 358 | typedef UInt32 URefCon; |
| 359 | typedef SInt32 SRefCon; |
| 360 | #endif /* __LP64__ */ |
| 361 | |
| 362 | /******************************************************************************** |
| 363 | |
| 364 | Common Constants |
| 365 | |
| 366 | noErr OSErr: function performed properly - no error |
| 367 | kNilOptions OptionBits: all flags false |
| 368 | kInvalidID KernelID: NULL is for pointers as kInvalidID is for ID's |
| 369 | kVariableLengthArray array bounds: variable length array |
| 370 | |
| 371 | Note: kVariableLengthArray was used in array bounds to specify a variable length array, |
| 372 | usually the last field in a struct. Now that the C language supports |
| 373 | 		 the concept of flexible array members, you can instead use: |
| 374 | 		 |
| 375 | 		struct BarList |
| 376 | 		{ |
| 377 | 			short	listLength; |
| 378 | 			Bar		elements[]; |
| 379 | 		}; |
| 380 | |
| 381 | 		However, this changes the semantics somewhat, as sizeof( BarList ) contains |
| 382 | 		no space for any of the elements, so to allocate a list with space for |
| 383 | 		the count elements |
| 384 | |
| 385 | 		struct BarList* l = (struct BarList*) malloc( sizeof(BarList) + count * sizeof(Bar) ); |
| 386 | |
| 387 | *********************************************************************************/ |
| 388 | enum { |
| 389 | noErr = 0 |
| 390 | }; |
| 391 | |
| 392 | enum { |
| 393 | kNilOptions = 0 |
| 394 | }; |
| 395 | |
| 396 | #define kInvalidID 0 |
| 397 | enum { |
| 398 | kVariableLengthArray |
| 399 | #ifdef __has_extension |
| 400 | #if __has_extension(enumerator_attributes) |
| 401 | 		__attribute__((deprecated)) |
| 402 | 	#endif |
| 403 | #endif |
| 404 | = 1 |
| 405 | }; |
| 406 | |
| 407 | enum { |
| 408 | kUnknownType = 0x3F3F3F3F /* "????" QuickTime 3.0: default unknown ResType or OSType */ |
| 409 | }; |
| 410 | |
| 411 | |
| 412 | |
| 413 | /******************************************************************************** |
| 414 | |
| 415 | String Types and Unicode Types |
| 416 | |
| 417 | UnicodeScalarValue, A complete Unicode character in UTF-32 format, with |
| 418 | UTF32Char values from 0 through 0x10FFFF (excluding the surrogate |
| 419 | range 0xD800-0xDFFF and certain disallowed values). |
| 420 | |
| 421 | UniChar, A 16-bit Unicode code value in the default UTF-16 format. |
| 422 | UTF16Char UnicodeScalarValues 0-0xFFFF are expressed in UTF-16 |
| 423 | format using a single UTF16Char with the same value. |
| 424 | UnicodeScalarValues 0x10000-0x10FFFF are expressed in |
| 425 | UTF-16 format using a pair of UTF16Chars - one in the |
| 426 | high surrogate range (0xD800-0xDBFF) followed by one in |
| 427 | the low surrogate range (0xDC00-0xDFFF). All of the |
| 428 | characters defined in Unicode versions through 3.0 are |
| 429 | in the range 0-0xFFFF and can be expressed using a single |
| 430 | UTF16Char, thus the term "Unicode character" generally |
| 431 | refers to a UniChar = UTF16Char. |
| 432 | |
| 433 | UTF8Char An 8-bit code value in UTF-8 format. UnicodeScalarValues |
| 434 | 0-0x7F are expressed in UTF-8 format using one UTF8Char |
| 435 | with the same value. UnicodeScalarValues above 0x7F are |
| 436 | expressed in UTF-8 format using 2-4 UTF8Chars, all with |
| 437 | values in the range 0x80-0xF4 (UnicodeScalarValues |
| 438 | 0x100-0xFFFF use two or three UTF8Chars, |
| 439 | UnicodeScalarValues 0x10000-0x10FFFF use four UTF8Chars). |
| 440 | |
| 441 | UniCharCount A count of UTF-16 code values in an array or buffer. |
| 442 | |
| 443 | StrNNN Pascal string holding up to NNN bytes |
| 444 | StringPtr Pointer to a pascal string |
| 445 | StringHandle Pointer to a StringPtr |
| 446 | ConstStringPtr Pointer to a read-only pascal string |
| 447 | ConstStrNNNParam For function parameters only - means string is const |
| 448 | |
| 449 | CStringPtr Pointer to a C string (in C: char*) |
| 450 | ConstCStringPtr Pointer to a read-only C string (in C: const char*) |
| 451 | |
| 452 | Note: The length of a pascal string is stored as the first byte. |
| 453 | A pascal string does not have a termination byte. |
| 454 | A pascal string can hold at most 255 bytes of data. |
| 455 | The first character in a pascal string is offset one byte from the start of the string. |
| 456 | |
| 457 | A C string is terminated with a byte of value zero. |
| 458 | A C string has no length limitation. |
| 459 | The first character in a C string is the zeroth byte of the string. |
| 460 | |
| 461 | |
| 462 | *********************************************************************************/ |
| 463 | typedef UInt32 UnicodeScalarValue; |
| 464 | typedef UInt32 UTF32Char; |
| 465 | typedef UInt16 UniChar; |
| 466 | typedef UInt16 UTF16Char; |
| 467 | typedef UInt8 UTF8Char; |
| 468 | typedef UniChar * UniCharPtr; |
| 469 | typedef unsigned long UniCharCount; |
| 470 | typedef UniCharCount * UniCharCountPtr; |
| 471 | typedef unsigned char Str255[256]; |
| 472 | typedef unsigned char Str63[64]; |
| 473 | typedef unsigned char Str32[33]; |
| 474 | typedef unsigned char Str31[32]; |
| 475 | typedef unsigned char Str27[28]; |
| 476 | typedef unsigned char Str15[16]; |
| 477 | /* |
| 478 | The type Str32 is used in many AppleTalk based data structures. |
| 479 | It holds up to 32 one byte chars. The problem is that with the |
| 480 | length byte it is 33 bytes long. This can cause weird alignment |
| 481 | problems in structures. To fix this the type "Str32Field" has |
| 482 | been created. It should only be used to hold 32 chars, but |
| 483 | it is 34 bytes long so that there are no alignment problems. |
| 484 | */ |
| 485 | typedef unsigned char Str32Field[34]; |
| 486 | /* |
| 487 | QuickTime 3.0: |
| 488 | The type StrFileName is used to make MacOS structs work |
| 489 | cross-platform. For example FSSpec or SFReply previously |
| 490 | contained a Str63 field. They now contain a StrFileName |
| 491 | field which is the same when targeting the MacOS but is |
| 492 | a 256 char buffer for Win32 and unix, allowing them to |
| 493 | contain long file names. |
| 494 | */ |
| 495 | typedef Str63 StrFileName; |
| 496 | typedef unsigned char * StringPtr; |
| 497 | typedef StringPtr * StringHandle; |
| 498 | typedef const unsigned char * ConstStringPtr; |
| 499 | typedef const unsigned char * ConstStr255Param; |
| 500 | typedef const unsigned char * ConstStr63Param; |
| 501 | typedef const unsigned char * ConstStr32Param; |
| 502 | typedef const unsigned char * ConstStr31Param; |
| 503 | typedef const unsigned char * ConstStr27Param; |
| 504 | typedef const unsigned char * ConstStr15Param; |
| 505 | typedef ConstStr63Param ConstStrFileNameParam; |
| 506 | #ifdef __cplusplus |
| 507 | inline unsigned char StrLength(ConstStr255Param string) { return (*string); } |
| 508 | #else |
| 509 | #define StrLength(string) (*(const unsigned char *)(string)) |
| 510 | #endif /* defined(__cplusplus) */ |
| 511 | |
| 512 | #if OLDROUTINENAMES |
| 513 | #define Length(string) StrLength(string) |
| 514 | #endif /* OLDROUTINENAMES */ |
| 515 | |
| 516 | /******************************************************************************** |
| 517 | |
| 518 | Process Manager type ProcessSerialNumber (previously in Processes.h) |
| 519 | |
| 520 | *********************************************************************************/ |
| 521 | /* type for unique process identifier */ |
| 522 | struct ProcessSerialNumber { |
| 523 | UInt32 highLongOfPSN; |
| 524 | UInt32 lowLongOfPSN; |
| 525 | }; |
| 526 | typedef struct ProcessSerialNumber ProcessSerialNumber; |
| 527 | typedef ProcessSerialNumber * ProcessSerialNumberPtr; |
| 528 | /******************************************************************************** |
| 529 | |
| 530 | Quickdraw Types |
| 531 | |
| 532 | Point 2D Quickdraw coordinate, range: -32K to +32K |
| 533 | Rect Rectangular Quickdraw area |
| 534 | Style Quickdraw font rendering styles |
| 535 | StyleParameter Style when used as a parameter (historical 68K convention) |
| 536 | StyleField Style when used as a field (historical 68K convention) |
| 537 | CharParameter Char when used as a parameter (historical 68K convention) |
| 538 | |
| 539 | Note: The original Macintosh toolbox in 68K Pascal defined Style as a SET. |
| 540 | Both Style and CHAR occupy 8-bits in packed records or 16-bits when |
| 541 | used as fields in non-packed records or as parameters. |
| 542 | |
| 543 | *********************************************************************************/ |
| 544 | struct Point { |
| 545 | short v; |
| 546 | short h; |
| 547 | }; |
| 548 | typedef struct Point Point; |
| 549 | typedef Point * PointPtr; |
| 550 | struct Rect { |
| 551 | short top; |
| 552 | short left; |
| 553 | short bottom; |
| 554 | short right; |
| 555 | }; |
| 556 | typedef struct Rect Rect; |
| 557 | typedef Rect * RectPtr; |
| 558 | struct FixedPoint { |
| 559 | Fixed x; |
| 560 | Fixed y; |
| 561 | }; |
| 562 | typedef struct FixedPoint FixedPoint; |
| 563 | struct FixedRect { |
| 564 | Fixed left; |
| 565 | Fixed top; |
| 566 | Fixed right; |
| 567 | Fixed bottom; |
| 568 | }; |
| 569 | typedef struct FixedRect FixedRect; |
| 570 | |
| 571 | typedef short CharParameter; |
| 572 | enum { |
| 573 | normal = 0, |
| 574 | bold = 1, |
| 575 | italic = 2, |
| 576 | underline = 4, |
| 577 | outline = 8, |
| 578 | shadow = 0x10, |
| 579 | condense = 0x20, |
| 580 | extend = 0x40 |
| 581 | }; |
| 582 | |
| 583 | typedef unsigned char Style; |
| 584 | typedef short StyleParameter; |
| 585 | typedef Style StyleField; |
| 586 | |
| 587 | |
| 588 | /******************************************************************************** |
| 589 | |
| 590 | QuickTime TimeBase types (previously in Movies.h) |
| 591 | |
| 592 | TimeValue Count of units |
| 593 | TimeScale Units per second |
| 594 | CompTimeValue 64-bit count of units (always a struct) |
| 595 | TimeValue64 64-bit count of units (long long or struct) |
| 596 | TimeBase An opaque reference to a time base |
| 597 | TimeRecord Package of TimeBase, duration, and scale |
| 598 | |
| 599 | *********************************************************************************/ |
| 600 | typedef SInt32 TimeValue; |
| 601 | typedef SInt32 TimeScale; |
| 602 | typedef wide CompTimeValue; |
| 603 | typedef SInt64 TimeValue64; |
| 604 | typedef struct TimeBaseRecord* TimeBase; |
| 605 | struct TimeRecord { |
| 606 | CompTimeValue value; /* units (duration or absolute) */ |
| 607 | TimeScale scale; /* units per second */ |
| 608 | TimeBase base; /* refernce to the time base */ |
| 609 | }; |
| 610 | typedef struct TimeRecord TimeRecord; |
| 611 | |
| 612 | /******************************************************************************** |
| 613 | |
| 614 | THINK C base objects |
| 615 | |
| 616 | HandleObject Root class for handle based THINK C++ objects |
| 617 | PascalObject Root class for pascal style objects in THINK C++ |
| 618 | |
| 619 | *********************************************************************************/ |
| 620 | #if defined(__SC__) && !defined(__STDC__) && defined(__cplusplus) |
| 621 | class __machdl HandleObject {}; |
| 622 | #if TARGET_CPU_68K |
| 623 | class __pasobj PascalObject {}; |
| 624 | #endif |
| 625 | #endif |
| 626 | |
| 627 | |
| 628 | /******************************************************************************** |
| 629 | |
| 630 | MacOS versioning structures |
| 631 | |
| 632 | VersRec Contents of a 'vers' resource |
| 633 | VersRecPtr Pointer to a VersRecPtr |
| 634 | VersRecHndl Resource Handle containing a VersRec |
| 635 | NumVersion Packed BCD version representation (e.g. "4.2.1a3" is 0x04214003) |
| 636 | UniversalProcPtr Pointer to classic 68K code or a RoutineDescriptor |
| 637 | |
| 638 | ProcHandle Pointer to a ProcPtr |
| 639 | UniversalProcHandle Pointer to a UniversalProcPtr |
| 640 | |
| 641 | *********************************************************************************/ |
| 642 | #if TARGET_RT_BIG_ENDIAN |
| 643 | struct NumVersion { |
| 644 | /* Numeric version part of 'vers' resource */ |
| 645 | UInt8 majorRev; /*1st part of version number in BCD*/ |
| 646 | UInt8 minorAndBugRev; /*2nd & 3rd part of version number share a byte*/ |
| 647 | UInt8 stage; /*stage code: dev, alpha, beta, final*/ |
| 648 | UInt8 nonRelRev; /*revision level of non-released version*/ |
| 649 | }; |
| 650 | typedef struct NumVersion NumVersion; |
| 651 | #else |
| 652 | struct NumVersion { |
| 653 | /* Numeric version part of 'vers' resource accessable in little endian format */ |
| 654 | UInt8 nonRelRev; /*revision level of non-released version*/ |
| 655 | UInt8 stage; /*stage code: dev, alpha, beta, final*/ |
| 656 | UInt8 minorAndBugRev; /*2nd & 3rd part of version number share a byte*/ |
| 657 | UInt8 majorRev; /*1st part of version number in BCD*/ |
| 658 | }; |
| 659 | typedef struct NumVersion NumVersion; |
| 660 | #endif /* TARGET_RT_BIG_ENDIAN */ |
| 661 | |
| 662 | enum { |
| 663 | /* Version Release Stage Codes */ |
| 664 | developStage = 0x20, |
| 665 | alphaStage = 0x40, |
| 666 | betaStage = 0x60, |
| 667 | finalStage = 0x80 |
| 668 | }; |
| 669 | |
| 670 | union NumVersionVariant { |
| 671 | /* NumVersionVariant is a wrapper so NumVersion can be accessed as a 32-bit value */ |
| 672 | NumVersion parts; |
| 673 | UInt32 whole; |
| 674 | }; |
| 675 | typedef union NumVersionVariant NumVersionVariant; |
| 676 | typedef NumVersionVariant * NumVersionVariantPtr; |
| 677 | typedef NumVersionVariantPtr * NumVersionVariantHandle; |
| 678 | struct VersRec { |
| 679 | /* 'vers' resource format */ |
| 680 | NumVersion numericVersion; /*encoded version number*/ |
| 681 | short countryCode; /*country code from intl utilities*/ |
| 682 | Str255 shortVersion; /*version number string - worst case*/ |
| 683 | Str255 reserved; /*longMessage string packed after shortVersion*/ |
| 684 | }; |
| 685 | typedef struct VersRec VersRec; |
| 686 | typedef VersRec * VersRecPtr; |
| 687 | typedef VersRecPtr * VersRecHndl; |
| 688 | /********************************************************************************* |
| 689 | |
| 690 | Old names for types |
| 691 | |
| 692 | *********************************************************************************/ |
| 693 | typedef UInt8 Byte; |
| 694 | typedef SInt8 SignedByte; |
| 695 | typedef wide * WidePtr; |
| 696 | typedef UnsignedWide * UnsignedWidePtr; |
| 697 | typedef Float80 extended80; |
| 698 | typedef Float96 extended96; |
| 699 | typedef SInt8 VHSelect; |
| 700 | |
| 701 | #if !0 |
| 702 | /********************************************************************************* |
| 703 | |
| 704 | Debugger functions |
| 705 | |
| 706 | *********************************************************************************/ |
| 707 | /* |
| 708 | * Debugger() |
| 709 | * |
| 710 | * Availability: |
| 711 | * Mac OS X: in version 10.0 and later in CoreServices.framework |
| 712 | * CarbonLib: in CarbonLib 1.0 and later |
| 713 | * Non-Carbon CFM: in InterfaceLib 7.1 and later |
| 714 | */ |
| 715 | extern void |
| 716 | Debugger(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA); |
| 717 | |
| 718 | |
| 719 | /* |
| 720 | * DebugStr() |
| 721 | * |
| 722 | * Availability: |
| 723 | * Mac OS X: in version 10.0 and later in CoreServices.framework |
| 724 | * CarbonLib: in CarbonLib 1.0 and later |
| 725 | * Non-Carbon CFM: in InterfaceLib 7.1 and later |
| 726 | */ |
| 727 | extern void |
| 728 | DebugStr(ConstStr255Param debuggerMsg) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA); |
| 729 | #endif |
| 730 | |
| 731 | /* |
| 732 | * debugstr() |
| 733 | * |
| 734 | * Availability: |
| 735 | * Mac OS X: not available |
| 736 | * CarbonLib: not available |
| 737 | * Non-Carbon CFM: in InterfaceLib 7.1 and later |
| 738 | */ |
| 739 | |
| 740 | |
| 741 | #if TARGET_CPU_PPC |
| 742 | /* Only for Mac OS native drivers */ |
| 743 | /* |
| 744 | * SysDebug() |
| 745 | * |
| 746 | * Availability: |
| 747 | * Mac OS X: not available |
| 748 | * CarbonLib: not available |
| 749 | * Non-Carbon CFM: in DriverServicesLib 1.0 and later |
| 750 | */ |
| 751 | |
| 752 | |
| 753 | /* |
| 754 | * SysDebugStr() |
| 755 | * |
| 756 | * Availability: |
| 757 | * Mac OS X: not available |
| 758 | * CarbonLib: not available |
| 759 | * Non-Carbon CFM: in DriverServicesLib 1.0 and later |
| 760 | */ |
| 761 | |
| 762 | |
| 763 | #endif /* TARGET_CPU_PPC */ |
| 764 | |
| 765 | /* SADE break points */ |
| 766 | /* |
| 767 | * SysBreak() |
| 768 | * |
| 769 | * Availability: |
| 770 | * Mac OS X: in version 10.0 and later in CoreServices.framework |
| 771 | * CarbonLib: in CarbonLib 1.0 and later |
| 772 | * Non-Carbon CFM: in InterfaceLib 7.1 and later |
| 773 | */ |
| 774 | extern void |
| 775 | SysBreak(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA); |
| 776 | |
| 777 | |
| 778 | /* |
| 779 | * SysBreakStr() |
| 780 | * |
| 781 | * Availability: |
| 782 | * Mac OS X: in version 10.0 and later in CoreServices.framework |
| 783 | * CarbonLib: in CarbonLib 1.0 and later |
| 784 | * Non-Carbon CFM: in InterfaceLib 7.1 and later |
| 785 | */ |
| 786 | extern void |
| 787 | SysBreakStr(ConstStr255Param debuggerMsg) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA); |
| 788 | |
| 789 | |
| 790 | /* |
| 791 | * SysBreakFunc() |
| 792 | * |
| 793 | * Availability: |
| 794 | * Mac OS X: in version 10.0 and later in CoreServices.framework |
| 795 | * CarbonLib: in CarbonLib 1.0 and later |
| 796 | * Non-Carbon CFM: in InterfaceLib 7.1 and later |
| 797 | */ |
| 798 | extern void |
| 799 | SysBreakFunc(ConstStr255Param debuggerMsg) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA); |
| 800 | |
| 801 | |
| 802 | /* old names for Debugger and DebugStr */ |
| 803 | #if OLDROUTINENAMES && TARGET_CPU_68K |
| 804 | #define Debugger68k() Debugger() |
| 805 | #define DebugStr68k(s) DebugStr(s) |
| 806 | #endif |
| 807 | |
| 808 | |
| 809 | #pragma pack(pop) |
| 810 | |
| 811 | #ifdef __cplusplus |
| 812 | } |
| 813 | #endif |
| 814 | |
| 815 | #endif /* __MACTYPES__ */ |
| 816 | |