]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | File: hfs_macos_types.h | |
24 | ||
25 | Contains: Basic Macintosh OS data types. | |
26 | ||
27 | Version: System 7.5 | |
28 | ||
29 | DRI: Nick Kledzik | |
30 | ||
31 | History: | |
32 | 12-Aug-1999 Scott Roberts Created from ConditionalMacros.h, MacOSStubs.h, MacOSTypes.h | |
33 | ||
34 | ||
35 | ||
36 | */ | |
37 | ||
38 | ||
39 | #ifndef __hfs_macos_types__ | |
40 | #define __hfs_macos_types__ | |
41 | ||
42 | ||
43 | #include <sys/param.h> | |
44 | #ifdef KERNEL | |
45 | #include <libkern/libkern.h> | |
46 | #include <sys/systm.h> | |
47 | #endif | |
48 | ||
49 | #include <sys/types.h> | |
50 | #include <sys/time.h> | |
51 | #include <sys/proc.h> | |
52 | #include <sys/lock.h> | |
53 | ||
54 | /****** START OF CONDITIONALMACROS *********/ | |
55 | ||
56 | #if defined(__ppc__) || defined(powerpc) || defined(ppc) | |
57 | #define TARGET_CPU_PPC 1 | |
58 | #define TARGET_CPU_68K 0 | |
59 | #define TARGET_CPU_X86 0 | |
60 | #define TARGET_CPU_MIPS 0 | |
61 | #define TARGET_CPU_SPARC 0 | |
62 | #define TARGET_CPU_ALPHA 0 | |
63 | #define TARGET_RT_MAC_CFM 0 | |
64 | #define TARGET_RT_MAC_MACHO 1 | |
65 | #define TARGET_RT_MAC_68881 0 | |
66 | #define TARGET_RT_LITTLE_ENDIAN 0 | |
67 | #define TARGET_RT_BIG_ENDIAN 1 | |
68 | #elif defined(m68k) | |
69 | #define TARGET_CPU_PPC 0 | |
70 | #define TARGET_CPU_68K 1 | |
71 | #define TARGET_CPU_X86 0 | |
72 | #define TARGET_CPU_MIPS 0 | |
73 | #define TARGET_CPU_SPARC 0 | |
74 | #define TARGET_CPU_ALPHA 0 | |
75 | #define TARGET_RT_MAC_CFM 0 | |
76 | #define TARGET_RT_MAC_MACHO 1 | |
77 | #define TARGET_RT_MAC_68881 0 | |
78 | #define TARGET_RT_LITTLE_ENDIAN 0 | |
79 | #define TARGET_RT_BIG_ENDIAN 1 | |
80 | #elif defined(sparc) | |
81 | #define TARGET_CPU_PPC 0 | |
82 | #define TARGET_CPU_68K 0 | |
83 | #define TARGET_CPU_X86 0 | |
84 | #define TARGET_CPU_MIPS 0 | |
85 | #define TARGET_CPU_SPARC 1 | |
86 | #define TARGET_CPU_ALPHA 0 | |
87 | #define TARGET_RT_MAC_CFM 0 | |
88 | #define TARGET_RT_MAC_MACHO 1 | |
89 | #define TARGET_RT_MAC_68881 0 | |
90 | #define TARGET_RT_LITTLE_ENDIAN 0 | |
91 | #define TARGET_RT_BIG_ENDIAN 1 | |
92 | #elif defined(__i386__) || defined(i386) || defined(intel) | |
93 | #define TARGET_CPU_PPC 0 | |
94 | #define TARGET_CPU_68K 0 | |
95 | #define TARGET_CPU_X86 1 | |
96 | #define TARGET_CPU_MIPS 0 | |
97 | #define TARGET_CPU_SPARC 0 | |
98 | #define TARGET_CPU_ALPHA 0 | |
99 | #define TARGET_RT_MAC_CFM 0 | |
100 | #define TARGET_RT_MAC_MACHO 1 | |
101 | #define TARGET_RT_MAC_68881 0 | |
102 | #define TARGET_RT_LITTLE_ENDIAN 1 | |
103 | #define TARGET_RT_BIG_ENDIAN 0 | |
104 | #else | |
105 | #error unrecognized GNU C compiler | |
106 | #endif | |
107 | ||
108 | ||
109 | #define TARGET_OS_MAC 0 | |
110 | #define TARGET_OS_WIN32 0 | |
111 | #define TARGET_OS_UNIX 0 | |
112 | ||
113 | #define PRAGMA_IMPORT 0 | |
114 | #define PRAGMA_STRUCT_ALIGN 1 | |
115 | #define PRAGMA_ONCE 0 | |
116 | #define PRAGMA_STRUCT_PACK 0 | |
117 | #define PRAGMA_STRUCT_PACKPUSH 0 | |
118 | #define PRAGMA_ENUM_PACK 0 | |
119 | #define PRAGMA_ENUM_ALWAYSINT 0 | |
120 | #define PRAGMA_ENUM_OPTIONS 0 | |
121 | #define FOUR_CHAR_CODE(x) (x) | |
122 | ||
123 | #define TYPE_EXTENDED 0 | |
124 | #if __GNUC__ >= 2 | |
125 | #define TYPE_LONGLONG 1 | |
126 | #else | |
127 | #define TYPE_LONGLONG 0 | |
128 | #endif | |
129 | #ifdef __cplusplus | |
130 | #define TYPE_BOOL 1 | |
131 | #else | |
132 | #define TYPE_BOOL 0 | |
133 | #endif | |
134 | ||
135 | #define FUNCTION_PASCAL 0 | |
136 | #define FUNCTION_DECLSPEC 0 | |
137 | #define FUNCTION_WIN32CC 0 | |
138 | ||
139 | ||
140 | #define EXTERN_API(_type) extern _type | |
141 | #define EXTERN_API_C(_type) extern _type | |
142 | #define EXTERN_API_STDCALL(_type) extern _type | |
143 | #define EXTERN_API_C_STDCALL(_type) extern _type | |
144 | ||
145 | #define DEFINE_API(_type) _type | |
146 | #define DEFINE_API_C(_type) _type | |
147 | #define DEFINE_API_STDCALL(_type) _type | |
148 | #define DEFINE_API_C_STDCALL(_type) _type | |
149 | ||
150 | #define CALLBACK_API(_type, _name) _type ( * _name) | |
151 | #define CALLBACK_API_C(_type, _name) _type ( * _name) | |
152 | #define CALLBACK_API_STDCALL(_type, _name) _type ( * _name) | |
153 | #define CALLBACK_API_C_STDCALL(_type, _name) _type ( * _name) | |
154 | ||
155 | #define TARGET_API_MACOS_X 1 | |
156 | #define TARGET_API_MAC_OS8 0 | |
157 | #define TARGET_API_MAC_CARBON 0 | |
158 | ||
159 | #define ONEWORDINLINE(w1) | |
160 | #define TWOWORDINLINE(w1,w2) | |
161 | #define THREEWORDINLINE(w1,w2,w3) | |
162 | #define FOURWORDINLINE(w1,w2,w3,w4) | |
163 | #define FIVEWORDINLINE(w1,w2,w3,w4,w5) | |
164 | #define SIXWORDINLINE(w1,w2,w3,w4,w5,w6) | |
165 | #define SEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7) | |
166 | #define EIGHTWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8) | |
167 | #define NINEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9) | |
168 | #define TENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10) | |
169 | #define ELEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11) | |
170 | #define TWELVEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12) | |
171 | ||
172 | ||
173 | /****** START OF MACOSTYPES *********/ | |
174 | ||
175 | ||
176 | /* | |
177 | 4.4BSD's sys/types.h defines size_t without defining __size_t__: | |
178 | Things are a lot clearer from here on if we define __size_t__ now. | |
179 | */ | |
180 | #define __size_t__ | |
181 | ||
182 | /* | |
183 | Convert kernel's diagnostic flag to MacOS's | |
184 | */ | |
185 | #if HFS_DIAGNOSTIC | |
186 | #define DEBUG_BUILD 1 | |
187 | #else | |
188 | #define DEBUG_BUILD 0 | |
189 | #endif /* DIAGNOSTIC */ | |
190 | ||
191 | /******************************************************************************** | |
192 | ||
193 | Special values in C | |
194 | ||
195 | NULL The C standard for an impossible pointer value | |
196 | nil A carry over from pascal, NULL is prefered for C | |
197 | ||
198 | *********************************************************************************/ | |
199 | #ifndef NULL | |
200 | #define NULL 0 | |
201 | #endif | |
202 | ||
203 | #ifndef nil | |
204 | #define nil NULL | |
205 | #endif | |
206 | ||
207 | ||
208 | /******************************************************************************** | |
209 | ||
210 | Base integer types for all target OS's and CPU's | |
211 | ||
212 | UInt8 8-bit unsigned integer | |
213 | SInt8 8-bit signed integer | |
214 | UInt16 16-bit unsigned integer | |
215 | SInt16 16-bit signed integer | |
216 | UInt32 32-bit unsigned integer | |
217 | SInt32 32-bit signed integer | |
218 | UInt64 64-bit unsigned integer | |
219 | SInt64 64-bit signed integer | |
220 | ||
221 | *********************************************************************************/ | |
222 | typedef u_int8_t UInt8; | |
223 | typedef int8_t SInt8; | |
224 | typedef u_int16_t UInt16; | |
225 | typedef int16_t SInt16; | |
226 | typedef u_int32_t UInt32; | |
227 | typedef int32_t SInt32; | |
228 | typedef u_int64_t UInt64; | |
229 | typedef int64_t SInt64; | |
230 | ||
231 | ||
232 | ||
233 | /******************************************************************************** | |
234 | ||
235 | Base floating point types | |
236 | ||
237 | Float32 32 bit IEEE float: 1 sign bit, 8 exponent bits, 23 fraction bits | |
238 | Float64 64 bit IEEE float: 1 sign bit, 11 exponent bits, 52 fraction bits | |
239 | Float80 80 bit MacOS float: 1 sign bit, 15 exponent bits, 1 integer bit, 63 fraction bits | |
240 | Float96 96 bit 68881 float: 1 sign bit, 15 exponent bits, 16 pad bits, 1 integer bit, 63 fraction bits | |
241 | ||
242 | Note: These are fixed size floating point types, useful when writing a floating | |
243 | point value to disk. If your compiler does not support a particular size | |
244 | float, a struct is used instead. | |
245 | Use of of the NCEG types (e.g. double_t) or an ANSI C type (e.g. double) if | |
246 | you want a floating point representation that is natural for any given | |
247 | compiler, but might be a different size on different compilers. | |
248 | ||
249 | *********************************************************************************/ | |
250 | typedef float Float32; | |
251 | typedef double Float64; | |
252 | ||
253 | struct Float80 { | |
254 | SInt16 exp; | |
255 | UInt16 man[4]; | |
256 | }; | |
257 | typedef struct Float80 Float80; | |
258 | ||
259 | struct Float96 { | |
260 | SInt16 exp[2]; /* the second 16-bits is always zero */ | |
261 | UInt16 man[4]; | |
262 | }; | |
263 | typedef struct Float96 Float96; | |
264 | ||
265 | ||
266 | ||
267 | /******************************************************************************** | |
268 | ||
269 | MacOS Memory Manager types | |
270 | ||
271 | Ptr Pointer to a non-relocatable block | |
272 | Handle Pointer to a master pointer to a relocatable block | |
273 | Size The number of bytes in a block (signed for historical reasons) | |
274 | ||
275 | *********************************************************************************/ | |
276 | typedef char * Ptr; | |
277 | typedef Ptr * Handle; | |
278 | typedef long Size; | |
279 | /******************************************************************************** | |
280 | ||
281 | Higher level basic types | |
282 | ||
283 | OSErr 16-bit result error code | |
284 | OSStatus 32-bit result error code | |
285 | LogicalAddress Address in the clients virtual address space | |
286 | ConstLogicalAddress Address in the clients virtual address space that will only be read | |
287 | PhysicalAddress Real address as used on the hardware bus | |
288 | BytePtr Pointer to an array of bytes | |
289 | ByteCount The size of an array of bytes | |
290 | ByteOffset An offset into an array of bytes | |
291 | ItemCount 32-bit iteration count | |
292 | OptionBits Standard 32-bit set of bit flags | |
293 | PBVersion ? | |
294 | Duration 32-bit millisecond timer for drivers | |
295 | AbsoluteTime 64-bit clock | |
296 | ScriptCode The coarse features of a written language (e.g. Roman vs Cyrillic) | |
297 | LangCode A particular language (e.g. English) | |
298 | RegionCode A variation of a language (British vs American English) | |
299 | FourCharCode A 32-bit value made by packing four 1 byte characters together | |
300 | OSType A FourCharCode used in the OS and file system (e.g. creator) | |
301 | ResType A FourCharCode used to tag resources (e.g. 'DLOG') | |
302 | ||
303 | *********************************************************************************/ | |
304 | typedef SInt16 OSErr; | |
305 | typedef SInt32 OSStatus; | |
306 | typedef void * LogicalAddress; | |
307 | typedef const void * ConstLogicalAddress; | |
308 | typedef void * PhysicalAddress; | |
309 | typedef UInt8 * BytePtr; | |
310 | typedef UInt32 ByteCount; | |
311 | typedef UInt32 ByteOffset; | |
312 | typedef SInt32 Duration; | |
313 | typedef UInt64 AbsoluteTime; | |
314 | typedef UInt32 OptionBits; | |
315 | typedef UInt32 ItemCount; | |
316 | typedef UInt32 PBVersion; | |
317 | typedef SInt16 ScriptCode; | |
318 | typedef SInt16 LangCode; | |
319 | typedef SInt16 RegionCode; | |
320 | typedef unsigned long FourCharCode; | |
321 | typedef FourCharCode OSType; | |
322 | typedef FourCharCode ResType; | |
323 | typedef OSType * OSTypePtr; | |
324 | typedef ResType * ResTypePtr; | |
325 | ||
326 | ||
327 | /******************************************************************************** | |
328 | ||
329 | Boolean types and values | |
330 | ||
331 | Boolean A one byte value, holds "false" (0) or "true" (1) | |
332 | false The Boolean value of zero (0) | |
333 | true The Boolean value of one (1) | |
334 | ||
335 | *********************************************************************************/ | |
336 | /* | |
337 | The identifiers "true" and "false" are becoming keywords in C++ | |
338 | and work with the new built-in type "bool" | |
339 | "Boolean" will remain an unsigned char for compatibility with source | |
340 | code written before "bool" existed. | |
341 | */ | |
342 | #if !TYPE_BOOL | |
343 | ||
344 | enum { | |
345 | false = 0, | |
346 | true = 1 | |
347 | }; | |
348 | ||
349 | #endif /* !TYPE_BOOL */ | |
350 | ||
351 | typedef unsigned char Boolean; | |
352 | ||
353 | ||
354 | /******************************************************************************** | |
355 | ||
356 | Function Pointer Types | |
357 | ||
358 | ProcPtr Generic pointer to a function | |
359 | Register68kProcPtr Pointer to a 68K function that expects parameters in registers | |
360 | UniversalProcPtr Pointer to classic 68K code or a RoutineDescriptor | |
361 | ||
362 | ProcHandle Pointer to a ProcPtr | |
363 | UniversalProcHandle Pointer to a UniversalProcPtr | |
364 | ||
365 | *********************************************************************************/ | |
366 | typedef long (*ProcPtr)(); | |
367 | typedef void (*Register68kProcPtr)(); | |
368 | ||
369 | typedef ProcPtr UniversalProcPtr; | |
370 | ||
371 | typedef ProcPtr * ProcHandle; | |
372 | typedef UniversalProcPtr * UniversalProcHandle; | |
373 | ||
374 | /******************************************************************************** | |
375 | ||
376 | Quickdraw Types | |
377 | ||
378 | Point 2D Quickdraw coordinate, range: -32K to +32K | |
379 | Rect Rectangluar Quickdraw area | |
380 | Style Quickdraw font rendering styles | |
381 | StyleParameter Style when used as a parameter (historical 68K convention) | |
382 | StyleField Style when used as a field (historical 68K convention) | |
383 | CharParameter Char when used as a parameter (historical 68K convention) | |
384 | ||
385 | Note: The original Macintosh toolbox in 68K Pascal defined Style as a SET. | |
386 | Both Style and CHAR occupy 8-bits in packed records or 16-bits when | |
387 | used as fields in non-packed records or as parameters. | |
388 | ||
389 | *********************************************************************************/ | |
390 | struct Point { | |
391 | short v; | |
392 | short h; | |
393 | }; | |
394 | typedef struct Point Point; | |
395 | ||
396 | typedef Point * PointPtr; | |
397 | struct Rect { | |
398 | short top; | |
399 | short left; | |
400 | short bottom; | |
401 | short right; | |
402 | }; | |
403 | typedef struct Rect Rect; | |
404 | ||
405 | typedef Rect * RectPtr; | |
406 | typedef short CharParameter; | |
407 | ||
408 | enum { | |
409 | normal = 0, | |
410 | bold = 1, | |
411 | italic = 2, | |
412 | underline = 4, | |
413 | outline = 8, | |
414 | shadow = 0x10, | |
415 | condense = 0x20, | |
416 | extend = 0x40 | |
417 | }; | |
418 | ||
419 | typedef unsigned char Style; | |
420 | typedef short StyleParameter; | |
421 | typedef Style StyleField; | |
422 | ||
423 | ||
424 | /******************************************************************************** | |
425 | ||
426 | Common Constants | |
427 | ||
428 | noErr OSErr: function performed properly - no error | |
429 | kNilOptions OptionBits: all flags false | |
430 | kInvalidID KernelID: NULL is for pointers as kInvalidID is for ID's | |
431 | kVariableLengthArray array bounds: variable length array | |
432 | ||
433 | Note: kVariableLengthArray is used in array bounds to specify a variable length array. | |
434 | It is ususally used in variable length structs when the last field is an array | |
435 | of any size. Before ANSI C, we used zero as the bounds of variable length | |
436 | array, but zero length array are illegal in ANSI C. Example usage: | |
437 | ||
438 | struct FooList | |
439 | { | |
440 | short listLength; | |
441 | Foo elements[kVariableLengthArray]; | |
442 | }; | |
443 | ||
444 | *********************************************************************************/ | |
445 | ||
446 | enum { | |
447 | noErr = 0 | |
448 | }; | |
449 | ||
450 | ||
451 | enum { | |
452 | kNilOptions = 0 | |
453 | }; | |
454 | ||
455 | #define kInvalidID 0 | |
456 | ||
457 | enum { | |
458 | kVariableLengthArray = 1 | |
459 | }; | |
460 | ||
461 | ||
462 | ||
463 | /******************************************************************************** | |
464 | ||
465 | String Types | |
466 | ||
467 | UniChar A single UniCode character (16-bits) | |
468 | ||
469 | StrNNN Pascal string holding up to NNN bytes | |
470 | StringPtr Pointer to a pascal string | |
471 | StringHandle Pointer to a StringPtr | |
472 | ConstStrNNNParam For function parameters only - means string is const | |
473 | ||
474 | CStringPtr Pointer to a C string (same as: char*) | |
475 | ConstCStringPtr Pointer to a const C string (same as: const char*) | |
476 | ||
477 | Note: The length of a pascal string is stored in the first byte. | |
478 | A pascal string does not have a termination byte and can be at most 255 bytes long. | |
479 | The first character in a pascal string is offset one byte from the start of the string. | |
480 | ||
481 | A C string is terminated with a byte of value zero. | |
482 | A C string has no length limitation. | |
483 | The first character in a C string is the first byte of the string. | |
484 | ||
485 | ||
486 | *********************************************************************************/ | |
487 | typedef UInt16 UniChar; | |
488 | typedef unsigned char Str255[256]; | |
489 | typedef unsigned char Str63[64]; | |
490 | typedef unsigned char Str32[33]; | |
491 | typedef unsigned char Str31[32]; | |
492 | typedef unsigned char Str27[28]; | |
493 | typedef unsigned char Str15[16]; | |
494 | /* | |
495 | The type Str32 is used in many AppleTalk based data structures. | |
496 | It holds up to 32 one byte chars. The problem is that with the | |
497 | length byte it is 33 bytes long. This can cause weird alignment | |
498 | problems in structures. To fix this the type "Str32Field" has | |
499 | been created. It should only be used to hold 32 chars, but | |
500 | it is 34 bytes long so that there are no alignment problems. | |
501 | */ | |
502 | typedef unsigned char Str32Field[34]; | |
503 | typedef unsigned char * StringPtr; | |
504 | typedef StringPtr * StringHandle; | |
505 | typedef const unsigned char * ConstStr255Param; | |
506 | typedef const unsigned char * ConstStr63Param; | |
507 | typedef const unsigned char * ConstStr32Param; | |
508 | typedef const unsigned char * ConstStr31Param; | |
509 | typedef const unsigned char * ConstStr27Param; | |
510 | typedef const unsigned char * ConstStr15Param; | |
511 | #ifdef __cplusplus | |
512 | inline unsigned char StrLength(ConstStr255Param string) { return (*string); } | |
513 | #else | |
514 | #define StrLength(string) (*(unsigned char *)(string)) | |
515 | #endif /* defined(__cplusplus) */ | |
516 | ||
517 | typedef const unsigned char * ConstUTF8Param; | |
518 | ||
519 | /********************************************************************************* | |
520 | ||
521 | Old names for types | |
522 | ||
523 | *********************************************************************************/ | |
524 | typedef UInt8 Byte; | |
525 | typedef SInt8 SignedByte; | |
526 | typedef SInt64 * WidePtr; | |
527 | typedef UInt64 * UnsignedWidePtr; | |
528 | typedef Float80 extended80; | |
529 | typedef Float96 extended96; | |
530 | typedef SInt8 VHSelect; | |
531 | ||
532 | ||
533 | EXTERN_API( void ) | |
534 | DebugStr (ConstStr255Param debuggerMsg); | |
535 | ||
536 | /********************************************************************************* | |
537 | ||
538 | Added types for HFSPlus MacOS X functionality. Needs to be incorporated to | |
539 | other places | |
540 | ||
541 | *********************************************************************************/ | |
542 | ||
543 | typedef struct vnode* FileReference; | |
544 | #define kNoFileReference NULL | |
545 | ||
546 | ||
547 | #define HFSInstrumentation 0 | |
548 | ||
549 | ||
550 | /***** START OF MACOSSTUBS ********/ | |
551 | ||
552 | ||
553 | /* | |
554 | SizeTDef.h -- Common definitions | |
555 | ||
556 | size_t - this type is defined by several ANSI headers. | |
557 | */ | |
558 | #if ! defined (__size_t__) | |
559 | #define __size_t__ | |
560 | #if defined (__xlc) || defined (__xlC) || defined (__xlC__) || defined (__MWERKS__) | |
561 | typedef unsigned long size_t; | |
562 | #else /* __xlC */ | |
563 | typedef unsigned int size_t; | |
564 | #endif /* __xlC */ | |
565 | #endif /* __size_t__ */ | |
566 | ||
567 | ||
568 | /* | |
569 | StdDef.h -- Common definitions | |
570 | ||
571 | */ | |
572 | ||
573 | #define offsetof(structure,field) ((size_t)&((structure *) 0)->field) | |
574 | ||
575 | ||
576 | ||
577 | /* | |
578 | File: Errors.h | |
579 | ||
580 | */ | |
581 | enum { | |
582 | paramErr = -50, /*error in user parameter list*/ | |
583 | noHardwareErr = -200, /*Sound Manager Error Returns*/ | |
584 | notEnoughHardwareErr = -201, /*Sound Manager Error Returns*/ | |
585 | userCanceledErr = -128, | |
586 | qErr = -1, /*queue element not found during deletion*/ | |
587 | vTypErr = -2, /*invalid queue element*/ | |
588 | corErr = -3, /*core routine number out of range*/ | |
589 | unimpErr = -4, /*unimplemented core routine*/ | |
590 | SlpTypeErr = -5, /*invalid queue element*/ | |
591 | seNoDB = -8, /*no debugger installed to handle debugger command*/ | |
592 | controlErr = -17, /*I/O System Errors*/ | |
593 | statusErr = -18, /*I/O System Errors*/ | |
594 | readErr = -19, /*I/O System Errors*/ | |
595 | writErr = -20, /*I/O System Errors*/ | |
596 | badUnitErr = -21, /*I/O System Errors*/ | |
597 | unitEmptyErr = -22, /*I/O System Errors*/ | |
598 | openErr = -23, /*I/O System Errors*/ | |
599 | closErr = -24, /*I/O System Errors*/ | |
600 | dRemovErr = -25, /*tried to remove an open driver*/ | |
601 | dInstErr = -26 /*DrvrInstall couldn't find driver in resources*/ | |
602 | }; | |
603 | ||
604 | enum { /* Printing Errors */ | |
605 | iMemFullErr = -108, | |
606 | iIOAbort = -27, /*Scrap Manager errors*/ | |
607 | noScrapErr = -100, /*No scrap exists error*/ | |
608 | noTypeErr = -102, /*No object of that type in scrap*/ | |
609 | memROZWarn = -99, /*soft error in ROZ*/ | |
610 | memROZError = -99, /*hard error in ROZ*/ | |
611 | memROZErr = -99, /*hard error in ROZ*/ | |
612 | memFullErr = -108, /*Not enough room in heap zone*/ | |
613 | nilHandleErr = -109, /*Master Pointer was NIL in HandleZone or other*/ | |
614 | memWZErr = -111, /*WhichZone failed (applied to free block)*/ | |
615 | memPurErr = -112, /*trying to purge a locked or non-purgeable block*/ | |
616 | memAdrErr = -110 /*address was odd; or out of range*/ | |
617 | }; | |
618 | ||
619 | ||
620 | ||
621 | enum { | |
622 | abortErr = -27, /*IO call aborted by KillIO*/ | |
623 | iIOAbortErr = -27, /*IO abort error (Printing Manager)*/ | |
624 | notOpenErr = -28, /*Couldn't rd/wr/ctl/sts cause driver not opened*/ | |
625 | unitTblFullErr = -29, /*unit table has no more entries*/ | |
626 | dceExtErr = -30, /*dce extension error*/ | |
627 | slotNumErr = -360, /*invalid slot # error*/ | |
628 | gcrOnMFMErr = -400, /*gcr format on high density media error*/ | |
629 | dirFulErr = -33, /*Directory full*/ | |
630 | dskFulErr = -34, /*disk full*/ | |
631 | nsvErr = -35, /*no such volume*/ | |
632 | ioErr = -36, /*I/O error (bummers)*/ | |
633 | bdNamErr = -37, /*there may be no bad names in the final system!*/ | |
634 | fnOpnErr = -38, /*File not open*/ | |
635 | eofErr = -39, /*End of file*/ | |
636 | posErr = -40, /*tried to position to before start of file (r/w)*/ | |
637 | mFulErr = -41, /*memory full (open) or file won't fit (load)*/ | |
638 | tmfoErr = -42, /*too many files open*/ | |
639 | fnfErr = -43, /*File not found*/ | |
640 | wPrErr = -44, /*diskette is write protected.*/ | |
641 | fLckdErr = -45 /*file is locked*/ | |
642 | }; | |
643 | ||
644 | ||
645 | enum { | |
646 | vLckdErr = -46, /*volume is locked*/ | |
647 | fBsyErr = -47, /*File is busy (delete)*/ | |
648 | dupFNErr = -48, /*duplicate filename (rename)*/ | |
649 | opWrErr = -49, /*file already open with with write permission*/ | |
650 | rfNumErr = -51, /*refnum error*/ | |
651 | gfpErr = -52, /*get file position error*/ | |
652 | volOffLinErr = -53, /*volume not on line error (was Ejected)*/ | |
653 | permErr = -54, /*permissions error (on file open)*/ | |
654 | volOnLinErr = -55, /*drive volume already on-line at MountVol*/ | |
655 | nsDrvErr = -56, /*no such drive (tried to mount a bad drive num)*/ | |
656 | noMacDskErr = -57, /*not a mac diskette (sig bytes are wrong)*/ | |
657 | extFSErr = -58, /*volume in question belongs to an external fs*/ | |
658 | fsRnErr = -59, /*file system internal error:during rename the old entry was deleted but could not be restored.*/ | |
659 | badMDBErr = -60, /*bad master directory block*/ | |
660 | wrPermErr = -61, /*write permissions error*/ | |
661 | dirNFErr = -120, /*Directory not found*/ | |
662 | tmwdoErr = -121, /*No free WDCB available*/ | |
663 | badMovErr = -122, /*Move into offspring error*/ | |
664 | wrgVolTypErr = -123, /*Wrong volume type error [operation not supported for MFS]*/ | |
665 | volGoneErr = -124 /*Server volume has been disconnected.*/ | |
666 | }; | |
667 | ||
668 | enum { | |
669 | /*Dictionary Manager errors*/ | |
670 | notBTree = -410, /*The file is not a dictionary.*/ | |
671 | btNoSpace = -413, /*Can't allocate disk space.*/ | |
672 | btDupRecErr = -414, /*Record already exists.*/ | |
673 | btRecNotFnd = -415, /*Record cannot be found.*/ | |
674 | btKeyLenErr = -416, /*Maximum key length is too long or equal to zero.*/ | |
675 | btKeyAttrErr = -417, /*There is no such a key attribute.*/ | |
676 | unknownInsertModeErr = -20000, /*There is no such an insert mode.*/ | |
677 | recordDataTooBigErr = -20001, /*The record data is bigger than buffer size (1024 bytes).*/ | |
678 | invalidIndexErr = -20002 /*The recordIndex parameter is not valid.*/ | |
679 | }; | |
680 | ||
681 | ||
682 | enum { | |
683 | fidNotFound = -1300, /*no file thread exists.*/ | |
684 | fidExists = -1301, /*file id already exists*/ | |
685 | notAFileErr = -1302, /*directory specified*/ | |
686 | diffVolErr = -1303, /*files on different volumes*/ | |
687 | catChangedErr = -1304, /*the catalog has been modified*/ | |
688 | desktopDamagedErr = -1305, /*desktop database files are corrupted*/ | |
689 | sameFileErr = -1306, /*can't exchange a file with itself*/ | |
690 | badFidErr = -1307, /*file id is dangling or doesn't match with the file number*/ | |
691 | notARemountErr = -1308, /*when _Mount allows only remounts and doesn't get one*/ | |
692 | fileBoundsErr = -1309, /*file's EOF, offset, mark or size is too big*/ | |
693 | fsDataTooBigErr = -1310, /*file or volume is too big for system*/ | |
694 | volVMBusyErr = -1311, /*can't eject because volume is in use by VM*/ | |
695 | envNotPresent = -5500, /*returned by glue.*/ | |
696 | envBadVers = -5501, /*Version non-positive*/ | |
697 | envVersTooBig = -5502, /*Version bigger than call can handle*/ | |
698 | fontDecError = -64, /*error during font declaration*/ | |
699 | fontNotDeclared = -65, /*font not declared*/ | |
700 | fontSubErr = -66, /*font substitution occured*/ | |
701 | fontNotOutlineErr = -32615, /*bitmap font passed to routine that does outlines only*/ | |
702 | firstDskErr = -84, /*I/O System Errors*/ | |
703 | lastDskErr = -64, /*I/O System Errors*/ | |
704 | noDriveErr = -64, /*drive not installed*/ | |
705 | offLinErr = -65, /*r/w requested for an off-line drive*/ | |
706 | noNybErr = -66 /*couldn't find 5 nybbles in 200 tries*/ | |
707 | }; | |
708 | ||
709 | enum { | |
710 | /* general text errors*/ | |
711 | kTextUnsupportedEncodingErr = -8738, /* specified encoding not supported for this operation*/ | |
712 | kTextMalformedInputErr = -8739, /* in DBCS, for example, high byte followed by invalid low byte*/ | |
713 | kTextUndefinedElementErr = -8740, /* text conversion errors*/ | |
714 | kTECMissingTableErr = -8745, | |
715 | kTECTableChecksumErr = -8746, | |
716 | kTECTableFormatErr = -8747, | |
717 | kTECCorruptConverterErr = -8748, /* invalid converter object reference*/ | |
718 | kTECNoConversionPathErr = -8749, | |
719 | kTECBufferBelowMinimumSizeErr = -8750, /* output buffer too small to allow processing of first input text element*/ | |
720 | kTECArrayFullErr = -8751, /* supplied name buffer or TextRun, TextEncoding, or UnicodeMapping array is too small*/ | |
721 | kTECBadTextRunErr = -8752, | |
722 | kTECPartialCharErr = -8753, /* input buffer ends in the middle of a multibyte character, conversion stopped*/ | |
723 | kTECUnmappableElementErr = -8754, | |
724 | kTECIncompleteElementErr = -8755, /* text element may be incomplete or is too long for internal buffers*/ | |
725 | kTECDirectionErr = -8756, /* direction stack overflow, etc.*/ | |
726 | kTECGlobalsUnavailableErr = -8770, /* globals have already been deallocated (premature TERM)*/ | |
727 | kTECItemUnavailableErr = -8771, /* item (e.g. name) not available for specified region (& encoding if relevant)*/ | |
728 | /* text conversion status codes*/ | |
729 | kTECUsedFallbacksStatus = -8783, | |
730 | kTECNeedFlushStatus = -8784, | |
731 | kTECOutputBufferFullStatus = -8785, /* output buffer has no room for conversion of next input text element (partial conversion)*/ | |
732 | /* deprecated error & status codes for low-level converter*/ | |
733 | unicodeChecksumErr = -8769, | |
734 | unicodeNoTableErr = -8768, | |
735 | unicodeVariantErr = -8767, | |
736 | unicodeFallbacksErr = -8766, | |
737 | unicodePartConvertErr = -8765, | |
738 | unicodeBufErr = -8764, | |
739 | unicodeCharErr = -8763, | |
740 | unicodeElementErr = -8762, | |
741 | unicodeNotFoundErr = -8761, | |
742 | unicodeTableFormatErr = -8760, | |
743 | unicodeDirectionErr = -8759, | |
744 | unicodeContextualErr = -8758, | |
745 | unicodeTextEncodingDataErr = -8757 | |
746 | }; | |
747 | ||
748 | ||
749 | /* | |
750 | File: MacMemory.h | |
751 | ||
752 | ||
753 | */ | |
754 | ||
755 | ||
756 | /* | |
757 | File: MixedMode.h | |
758 | ||
759 | */ | |
760 | ||
761 | /* Calling Conventions */ | |
762 | typedef unsigned short CallingConventionType; | |
763 | ||
764 | enum { | |
765 | kPascalStackBased = 0, | |
766 | kCStackBased = 1, | |
767 | kRegisterBased = 2, | |
768 | kD0DispatchedPascalStackBased = 8, | |
769 | kD1DispatchedPascalStackBased = 12, | |
770 | kD0DispatchedCStackBased = 9, | |
771 | kStackDispatchedPascalStackBased = 14, | |
772 | kThinkCStackBased = 5 | |
773 | }; | |
774 | ||
775 | ||
776 | #define STACK_UPP_TYPE(name) name | |
777 | #define REGISTER_UPP_TYPE(name) name | |
778 | ||
779 | ||
780 | /* | |
781 | File: OSUtils.h | |
782 | ||
783 | */ | |
784 | typedef struct QElem QElem; | |
785 | ||
786 | typedef QElem * QElemPtr; | |
787 | struct QHdr { | |
788 | short qFlags; | |
789 | QElemPtr qHead; | |
790 | QElemPtr qTail; | |
791 | }; | |
792 | typedef struct QHdr QHdr; | |
793 | ||
794 | typedef QHdr * QHdrPtr; | |
795 | ||
796 | typedef CALLBACK_API( void , DeferredTaskProcPtr )(long dtParam); | |
797 | /* | |
798 | WARNING: DeferredTaskProcPtr uses register based parameters under classic 68k | |
799 | and cannot be written in a high-level language without | |
800 | the help of mixed mode or assembly glue. | |
801 | */ | |
802 | typedef REGISTER_UPP_TYPE(DeferredTaskProcPtr) DeferredTaskUPP; | |
803 | enum { uppDeferredTaskProcInfo = 0x0000B802 }; /* register no_return_value Func(4_bytes:A1) */ | |
804 | #define NewDeferredTaskProc(userRoutine) (DeferredTaskUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDeferredTaskProcInfo, GetCurrentArchitecture()) | |
805 | #define CallDeferredTaskProc(userRoutine, dtParam) CALL_ONE_PARAMETER_UPP((userRoutine), uppDeferredTaskProcInfo, (dtParam)) | |
806 | struct DeferredTask { | |
807 | QElemPtr qLink; | |
808 | short qType; | |
809 | short dtFlags; | |
810 | DeferredTaskUPP dtAddr; | |
811 | long dtParam; | |
812 | long dtReserved; | |
813 | }; | |
814 | typedef struct DeferredTask DeferredTask; | |
815 | ||
816 | typedef DeferredTask * DeferredTaskPtr; | |
817 | ||
818 | /* | |
819 | File: Finder.h | |
820 | ||
821 | ||
822 | */ | |
823 | ||
824 | /* | |
825 |