1/*
2 * Copyright (c) 2000-2003, 2005-2013 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_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. 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.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29	File:		HFSUnicodeWrappers.h
30
31	Contains:	IPI to Unicode routines used by File Manager.
32
33	Version:	HFS Plus 1.0
34
35	Written by:	Mark Day
36
37	Copyright:	� 1996-1997 by Apple Computer, Inc., all rights reserved.
38
39	File Ownership:
40
41		DRI:				xxx put dri here xxx
42
43		Other Contact:		xxx put other contact here xxx
44
45		Technology:			xxx put technology here xxx
46
47	Writers:
48
49		(DSH)	Deric Horn
50		(msd)	Mark Day
51		(djb)	Don Brady
52
53	Change History (most recent first):
54
55	  <CS11>	11/16/97	djb		Change Unicode.h to UnicodeConverter.h.
56	  <CS10>	 11/7/97	msd		Remove prototype for CompareUnicodeNames(). Add prototype for
57									FastUnicodeCompare().
58	   <CS9>	10/13/97	djb		Add encoding/index macros and add prototypes for new Get/Set
59									encodding routines.
60	   <CS8>	 9/15/97	djb		InitUnicodeConverter now takes a boolean.
61	   <CS7>	 9/10/97	msd		Add prototype for InitializeEncodingContext.
62	   <CS6>	 6/26/97	DSH		Include  "MockConverter" prototype for DFA usage.
63	   <CS5>	 6/25/97	DSH		Removed Prototype definitions, and checked in Unicode.h and
64									TextCommon.h from Julio Gonzales into InternalInterfaces.
65	   <CS4>	 6/25/97	msd		Add prototypes for some new Unicode routines that haven't
66									appeared in MasterInterfaces yet.
67	   <CS3>	 6/18/97	djb		Add more ConversionContexts routines.
68	   <CS2>	 6/13/97	djb		Switched to ConvertUnicodeToHFSName, ConvertHFSNameToUnicode, &
69									CompareUnicodeNames.
70	   <CS1>	 4/28/97	djb		first checked in
71	  <HFS1>	12/12/96	msd		first checked in
72
73*/
74#ifndef _HFSUNICODEWRAPPERS_
75#define _HFSUNICODEWRAPPERS_
76
77#include <sys/appleapiopts.h>
78
79#ifdef KERNEL
80#ifdef __APPLE_API_PRIVATE
81
82#include "../../hfs_macos_defs.h"
83#include "../../hfs_format.h"
84
85
86extern OSErr ConvertUnicodeToUTF8Mangled ( ByteCount srcLen,
87									ConstUniCharArrayPtr srcStr,
88									ByteCount maxDstLen,
89					 				ByteCount *actualDstLen,
90									unsigned char* dstStr ,
91									HFSCatalogNodeID cnid);
92
93/*
94	This routine compares two Unicode names based on an ordering defined by the HFS Plus B-tree.
95	This ordering must stay fixed for all time.
96
97	Output:
98		-n		name1 < name2	(i.e. name 1 sorts before name 2)
99		 0		name1 = name2
100		+n		name1 > name2
101
102	NOTE: You should not depend on the magnitude of the result, just its sign.  That is, when name1 < name2, then any
103	negative number may be returned.
104*/
105
106extern int32_t FastUnicodeCompare(register ConstUniCharArrayPtr str1, register ItemCount length1,
107								 register ConstUniCharArrayPtr str2, register ItemCount length2);
108
109extern int32_t UnicodeBinaryCompare (register ConstUniCharArrayPtr str1, register ItemCount length1,
110								 register ConstUniCharArrayPtr str2, register ItemCount length2);
111
112extern int32_t FastRelString( ConstStr255Param str1, ConstStr255Param str2 );
113
114
115extern HFSCatalogNodeID GetEmbeddedFileID( ConstStr31Param filename, u_int32_t length, u_int32_t *prefixLength );
116extern u_int32_t CountFilenameExtensionChars( const unsigned char * filename, u_int32_t length );
117
118#endif /* __APPLE_API_PRIVATE */
119#endif /* KERNEL */
120#endif /* _HFSUNICODEWRAPPERS_ */
121