2 * Copyright (c) 2000-2015 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 #ifndef __HFS_MACOS_TYPES__
30 #define __HFS_MACOS_TYPES__
32 #include <sys/appleapiopts.h>
35 #ifdef __APPLE_API_PRIVATE
37 #include <sys/param.h>
39 #include <libkern/OSTypes.h>
40 #include <libkern/libkern.h>
41 #include <sys/systm.h>
42 #include <sys/types.h>
47 #define TARGET_OS_WIN32 0
48 #define TARGET_OS_UNIX 0
50 #define PRAGMA_IMPORT 0
51 #define PRAGMA_STRUCT_ALIGN 1
53 #define PRAGMA_STRUCT_PACK 0
54 #define PRAGMA_STRUCT_PACKPUSH 0
57 #define TYPE_LONGLONG 1
59 #define TYPE_LONGLONG 0
67 #define EXTERN_API(_type) extern _type
68 #define EXTERN_API_C(_type) extern _type
70 #define CALLBACK_API_C(_type, _name) _type ( * _name)
72 #define TARGET_API_MACOS_X 1
73 #define TARGET_API_MAC_OS8 0
74 #define TARGET_API_MAC_CARBON 0
78 /****** START OF MACOSTYPES *********/
82 4.4BSD's sys/types.h defines size_t without defining __size_t__:
83 Things are a lot clearer from here on if we define __size_t__ now.
87 /********************************************************************************
91 NULL The C standard for an impossible pointer value
92 nil A carry over from pascal, NULL is prefered for C
94 *********************************************************************************/
106 typedef int16_t OSErr
;
107 typedef u_int32_t ItemCount
;
108 typedef u_int32_t ByteCount
;
109 typedef u_int8_t
* BytePtr
;
110 typedef u_int32_t ByteOffset
;
112 typedef u_int16_t UniChar
;
113 typedef unsigned char Str255
[256];
114 typedef unsigned char Str31
[32];
115 typedef unsigned char * StringPtr
;
116 typedef const unsigned char * ConstStr255Param
;
117 typedef const unsigned char * ConstStr31Param
;
118 typedef const unsigned char * ConstUTF8Param
;
120 typedef u_int8_t Byte
;
122 typedef u_int32_t TextEncoding
;
123 typedef UniChar
* UniCharArrayPtr
;
124 typedef const UniChar
* ConstUniCharArrayPtr
;
127 /********************************************************************************
129 Boolean types and values
131 Boolean A one byte value, holds "false" (0) or "true" (1)
132 false The Boolean value of zero (0)
133 true The Boolean value of one (1)
135 *********************************************************************************/
137 The identifiers "true" and "false" are becoming keywords in C++
138 and work with the new built-in type "bool"
139 "Boolean" will remain an unsigned char for compatibility with source
140 code written before "bool" existed.
142 #if !TYPE_BOOL && !__bool_true_false_are_defined
149 #endif /* !TYPE_BOOL */
152 EXTERN_API( void ) DebugStr(const char * debuggerMsg
);
154 /*********************************************************************************
156 Added types for HFSPlus MacOS X functionality. Needs to be incorporated to
159 *********************************************************************************/
161 typedef struct vnode
* FileReference
;
164 /***** START OF MACOSSTUBS ********/
168 SizeTDef.h -- Common definitions
170 size_t - this type is defined by several ANSI headers.
172 #if ! defined (__size_t__)
174 #if defined (__xlc) || defined (__xlC) || defined (__xlC__) || defined (__MWERKS__)
175 typedef unsigned long size_t;
177 typedef unsigned int size_t;
179 #endif /* __size_t__ */
188 dskFulErr
= -34, /*disk full*/
189 bdNamErr
= -37, /*there may be no bad names in the final system!*/
190 paramErr
= -50, /*error in user parameter list*/
191 memFullErr
= -108, /*Not enough room in heap zone*/
192 fileBoundsErr
= -1309, /*file's EOF, offset, mark or size is too big*/
193 kTECUsedFallbacksStatus
= -8783,
200 kHasBeenInited
= 0x0100,
201 kHasCustomIcon
= 0x0400,
202 kIsStationery
= 0x0800,
203 kNameLocked
= 0x1000,
205 kIsInvisible
= 0x4000,
216 /* Mac OS encodings*/
217 kTextEncodingMacRoman
= 0L,
218 kTextEncodingMacJapanese
= 1,
219 kTextEncodingMacChineseTrad
= 2,
220 kTextEncodingMacKorean
= 3,
221 kTextEncodingMacArabic
= 4,
222 kTextEncodingMacHebrew
= 5,
223 kTextEncodingMacGreek
= 6,
224 kTextEncodingMacCyrillic
= 7,
225 kTextEncodingMacDevanagari
= 9,
226 kTextEncodingMacGurmukhi
= 10,
227 kTextEncodingMacGujarati
= 11,
228 kTextEncodingMacOriya
= 12,
229 kTextEncodingMacBengali
= 13,
230 kTextEncodingMacTamil
= 14,
231 kTextEncodingMacTelugu
= 15,
232 kTextEncodingMacKannada
= 16,
233 kTextEncodingMacMalayalam
= 17,
234 kTextEncodingMacSinhalese
= 18,
235 kTextEncodingMacBurmese
= 19,
236 kTextEncodingMacKhmer
= 20,
237 kTextEncodingMacThai
= 21,
238 kTextEncodingMacLaotian
= 22,
239 kTextEncodingMacGeorgian
= 23,
240 kTextEncodingMacArmenian
= 24,
241 kTextEncodingMacChineseSimp
= 25,
242 kTextEncodingMacTibetan
= 26,
243 kTextEncodingMacMongolian
= 27,
244 kTextEncodingMacEthiopic
= 28,
245 kTextEncodingMacCentralEurRoman
= 29,
246 kTextEncodingMacVietnamese
= 30,
247 kTextEncodingMacExtArabic
= 31, /* The following use script code 0, smRoman*/
248 kTextEncodingMacSymbol
= 33,
249 kTextEncodingMacDingbats
= 34,
250 kTextEncodingMacTurkish
= 35,
251 kTextEncodingMacCroatian
= 36,
252 kTextEncodingMacIcelandic
= 37,
253 kTextEncodingMacRomanian
= 38,
254 kTextEncodingMacUnicode
= 0x7E,
256 kTextEncodingMacFarsi
= 0x8C, /* Like MacArabic but uses Farsi digits */ /* The following use script code 7, smCyrillic */
257 kTextEncodingMacUkrainian
= 0x98, /* The following use script code 32, smUnimplemented */
264 extern void RequireFileLock(FileReference vp
, int shareable
);
265 #define REQUIRE_FILE_LOCK(vp,s) RequireFileLock((vp),(s))
267 #define REQUIRE_FILE_LOCK(vp,s)
272 BlockMoveData(const void * srcPtr
, void * destPtr
, Size byteCount
);
274 #define BlockMoveData(src, dest, len) bcopy((src), (dest), (len))
277 ClearMemory(void * start
, u_int32_t length
);
279 #define ClearMemory(start, length) bzero((start), (size_t)(length));
282 * The maximum number UTF-16 code units required to represent a HFS
283 * standard file name. The derivation for this number is not
284 * documented; it has been this value for some time. Mark, our
285 * resident Unicode expert, says "I'm not entirely certain, but I
286 * think it is the worst case for Korean Hangul conjoining jamos. The
287 * '15' is because a Str31 can contain at most 15 two-byte characters
288 * (in MacKorean encoding). Worst case, each one of those characters
289 * gets normalized to up to 5 UTF-16 code points. Each character is
290 * composed of up to three jamos; up to two of those jamos might not
291 * be in Unicode plane 0, which means they can take two UTF-16 code
292 * points (each) to represent. So your '5' is '2 + 2 + 1'." Sounds
293 * plausible! Safe to ship it, I say!
295 #define MAX_HFS_UNICODE_CHARS (15*5)
297 #endif /* __APPLE_API_PRIVATE */
299 #endif /* __HFS_MACOS_TYPES__ */