2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 File: HFSUnicodeWrappers.h
25 Contains: IPI to Unicode routines used by File Manager.
31 Copyright: © 1996-1997 by Apple Computer, Inc., all rights reserved.
35 DRI: xxx put dri here xxx
37 Other Contact: xxx put other contact here xxx
39 Technology: xxx put technology here xxx
47 Change History (most recent first):
49 <CS11> 11/16/97 djb Change Unicode.h to UnicodeConverter.h.
50 <CS10> 11/7/97 msd Remove prototype for CompareUnicodeNames(). Add prototype for
52 <CS9> 10/13/97 djb Add encoding/index macros and add prototypes for new Get/Set
54 <CS8> 9/15/97 djb InitUnicodeConverter now takes a boolean.
55 <CS7> 9/10/97 msd Add prototype for InitializeEncodingContext.
56 <CS6> 6/26/97 DSH Include "MockConverter" prototype for DFA usage.
57 <CS5> 6/25/97 DSH Removed Prototype definitions, and checked in Unicode.h and
58 TextCommon.h from Julio Gonzales into InternalInterfaces.
59 <CS4> 6/25/97 msd Add prototypes for some new Unicode routines that haven't
60 appeared in MasterInterfaces yet.
61 <CS3> 6/18/97 djb Add more ConversionContexts routines.
62 <CS2> 6/13/97 djb Switched to ConvertUnicodeToHFSName, ConvertHFSNameToUnicode, &
64 <CS1> 4/28/97 djb first checked in
65 <HFS1> 12/12/96 msd first checked in
69 #include "../../hfs_macos_defs.h"
70 #include "../../hfs_format.h"
74 // For runtime table lookups and for the volume encoding bitmap we
75 // need to map some encodings to keep them in a reasonable range.
79 kIndexMacUkrainian
= 48, // MacUkrainian encoding is 152
80 kIndexMacFarsi
= 49 // MacFarsi encoding is 140
83 #define MapEncodingToIndex(e) \
84 ( (e) < 48 ? (e) : ( (e) == kTextEncodingMacUkrainian ? kIndexMacUkrainian : ( (e) == kTextEncodingMacFarsi ? kIndexMacFarsi : kTextEncodingMacRoman) ) )
86 #define MapIndexToEncoding(i) \
87 ( (i) == kIndexMacFarsi ? kTextEncodingMacFarsi : ( (i) == kIndexMacUkrainian ? kTextEncodingMacUkrainian : (i) ) )
89 #define ValidMacEncoding(e) \
90 ( ((e) < 39) || ((e) == kTextEncodingMacFarsi) || ((e) == kTextEncodingMacUkrainian) )
93 extern OSErr
ConvertUnicodeToUTF8Mangled ( ByteCount srcLen
,
94 ConstUniCharArrayPtr srcStr
,
96 ByteCount
*actualDstLen
,
97 unsigned char* dstStr
,
98 HFSCatalogNodeID cnid
);
101 This routine compares two Unicode names based on an ordering defined by the HFS Plus B-tree.
102 This ordering must stay fixed for all time.
105 -n name1 < name2 (i.e. name 1 sorts before name 2)
109 NOTE: You should not depend on the magnitude of the result, just its sign. That is, when name1 < name2, then any
110 negative number may be returned.
113 extern SInt32
FastUnicodeCompare(register ConstUniCharArrayPtr str1
, register ItemCount length1
,
114 register ConstUniCharArrayPtr str2
, register ItemCount length2
);
117 extern SInt32
FastRelString( ConstStr255Param str1
, ConstStr255Param str2
);
120 extern HFSCatalogNodeID
GetEmbeddedFileID( ConstStr31Param filename
, UInt32 length
, UInt32
*prefixLength
);