xref: /xnu-12377.61.12/bsd/sys/unicode.h (revision 4d495c6e23c53686cf65f45067f79024cf5dcee8)
1*4d495c6eSApple OSS Distributions /*
2*4d495c6eSApple OSS Distributions  * Copyright (c) 2016-2023 Apple Inc. All rights reserved.
3*4d495c6eSApple OSS Distributions  *
4*4d495c6eSApple OSS Distributions  * @APPLE_LICENSE_HEADER_START@
5*4d495c6eSApple OSS Distributions  *
6*4d495c6eSApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*4d495c6eSApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*4d495c6eSApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*4d495c6eSApple OSS Distributions  * compliance with the License. Please obtain a copy of the License at
10*4d495c6eSApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this
11*4d495c6eSApple OSS Distributions  * file.
12*4d495c6eSApple OSS Distributions  *
13*4d495c6eSApple OSS Distributions  * The Original Code and all software distributed under the License are
14*4d495c6eSApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15*4d495c6eSApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16*4d495c6eSApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17*4d495c6eSApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18*4d495c6eSApple OSS Distributions  * Please see the License for the specific language governing rights and
19*4d495c6eSApple OSS Distributions  * limitations under the License.
20*4d495c6eSApple OSS Distributions  *
21*4d495c6eSApple OSS Distributions  * @APPLE_LICENSE_HEADER_END@
22*4d495c6eSApple OSS Distributions  */
23*4d495c6eSApple OSS Distributions 
24*4d495c6eSApple OSS Distributions #ifndef unicode_h
25*4d495c6eSApple OSS Distributions #define unicode_h
26*4d495c6eSApple OSS Distributions 
27*4d495c6eSApple OSS Distributions #ifdef KERNEL_PRIVATE
28*4d495c6eSApple OSS Distributions 
29*4d495c6eSApple OSS Distributions #include <sys/cdefs.h>
30*4d495c6eSApple OSS Distributions #include <stdbool.h>
31*4d495c6eSApple OSS Distributions 
32*4d495c6eSApple OSS Distributions /*
33*4d495c6eSApple OSS Distributions  * WARNING - callers that use the following Unicode normalization interface for on-disk
34*4d495c6eSApple OSS Distributions  * structures should be aware that the implementation will be periodically updated for
35*4d495c6eSApple OSS Distributions  * the latest Unicode standard version.
36*4d495c6eSApple OSS Distributions  */
37*4d495c6eSApple OSS Distributions 
38*4d495c6eSApple OSS Distributions enum {
39*4d495c6eSApple OSS Distributions 	/* Maximum size of UTF32 reordering buffer for stream-safe format */
40*4d495c6eSApple OSS Distributions 	kNCFStreamSafeBufMax = 32
41*4d495c6eSApple OSS Distributions };
42*4d495c6eSApple OSS Distributions 
43*4d495c6eSApple OSS Distributions /*
44*4d495c6eSApple OSS Distributions  * utf8_normalizeOptCaseFoldAndHash
45*4d495c6eSApple OSS Distributions  *
46*4d495c6eSApple OSS Distributions  * Convert a given UTF-8 string to UTF-32 in one of the following normalized forms,
47*4d495c6eSApple OSS Distributions  * as specified by the case_sens parameter, and feed the result incrementally to
48*4d495c6eSApple OSS Distributions  * the provided hash function callback:
49*4d495c6eSApple OSS Distributions  * - "canonical caseless form" (case-folded NFD, as described by definition D145
50*4d495c6eSApple OSS Distributions  *    in chapter 3 of The Unicode Standard); for case-insensitive behavior.
51*4d495c6eSApple OSS Distributions  * - standard NFD; for case-sensitive behavior (if case_sens = true).
52*4d495c6eSApple OSS Distributions  *
53*4d495c6eSApple OSS Distributions  * The input string should be valid UTF-8 that meets the criteria for stream safe
54*4d495c6eSApple OSS Distributions  * text as described in http://unicode.org/reports/tr15/#Stream_Safe_Text_Format.
55*4d495c6eSApple OSS Distributions  * It should not contain ASCII 0x00 or '/'.
56*4d495c6eSApple OSS Distributions  *
57*4d495c6eSApple OSS Distributions  * str:       The input UTF-8 string (need not be 0 terminated)
58*4d495c6eSApple OSS Distributions  * str_len:   The byte length of the input string (excluding any 0 terminator)
59*4d495c6eSApple OSS Distributions  * case_sens: False for case-insensitive behavior; generates canonical caseless form.
60*4d495c6eSApple OSS Distributions  *            True for case-sensitive behavior; generates standard NFD.
61*4d495c6eSApple OSS Distributions  * hash_func: A pointer to a hashing function to compute the hash of the
62*4d495c6eSApple OSS Distributions  *            normalized/case-folded result. buf contains buf_len bytes
63*4d495c6eSApple OSS Distributions  *            of data to be added to the hash using the caller-supplied
64*4d495c6eSApple OSS Distributions  *            context (ctx).
65*4d495c6eSApple OSS Distributions  * hash_ctx:  The context for the hash function.
66*4d495c6eSApple OSS Distributions  *
67*4d495c6eSApple OSS Distributions  * Returns: 0 on success, or
68*4d495c6eSApple OSS Distributions  *          EILSEQ: The input string contains illegal ASCII-range characters
69*4d495c6eSApple OSS Distributions  *                  (0x00 or '/'), or is not well-formed stream-safe UTF-8, or
70*4d495c6eSApple OSS Distributions  *                  contains codepoints that are non-characters or unassigned in
71*4d495c6eSApple OSS Distributions  *                  the version of Unicode currently supported.
72*4d495c6eSApple OSS Distributions  */
73*4d495c6eSApple OSS Distributions int utf8_normalizeOptCaseFoldAndHash(const char *str,
74*4d495c6eSApple OSS Distributions     size_t      str_len,
75*4d495c6eSApple OSS Distributions     bool        case_sens,
76*4d495c6eSApple OSS Distributions     void      (*hash_func)(void *buf, size_t buf_len, void *ctx),
77*4d495c6eSApple OSS Distributions     void       *hash_ctx);
78*4d495c6eSApple OSS Distributions 
79*4d495c6eSApple OSS Distributions /*
80*4d495c6eSApple OSS Distributions  * utf8_normalizeOptCaseFoldAndCompare
81*4d495c6eSApple OSS Distributions  *
82*4d495c6eSApple OSS Distributions  * Determine whether two UTF-8 strings are equal after converting each to one of the
83*4d495c6eSApple OSS Distributions  * following normalized forms, as specified by the case_sens parameter:
84*4d495c6eSApple OSS Distributions  * - "canonical caseless form" (case-folded NFD); for case-insensitive comparison.
85*4d495c6eSApple OSS Distributions  * - standard NFD; for case-sensitive comparison (if case_sens = true).
86*4d495c6eSApple OSS Distributions  * On success, sets are_equal to true if the strings are equal, or false if they are not.
87*4d495c6eSApple OSS Distributions  *
88*4d495c6eSApple OSS Distributions  * The input strings should be valid UTF-8 that meet the criteria for stream safe
89*4d495c6eSApple OSS Distributions  * text as described in http://unicode.org/reports/tr15/#Stream_Safe_Text_Format.
90*4d495c6eSApple OSS Distributions  * They should not contain ASCII 0x00 or '/'.
91*4d495c6eSApple OSS Distributions  *
92*4d495c6eSApple OSS Distributions  * strA:      A UTF-8 string to be compared (need not be 0 terminated)
93*4d495c6eSApple OSS Distributions  * strA_len:  The byte length of strA (excluding any 0 terminator)
94*4d495c6eSApple OSS Distributions  * strB:      The second UTF-8 string to be compared (need not be 0 terminated)
95*4d495c6eSApple OSS Distributions  * strB_len:  The byte length of strB (excluding any 0 terminator)
96*4d495c6eSApple OSS Distributions  * case_sens: False for case-insensitive behavior; compares canonical caseless forms.
97*4d495c6eSApple OSS Distributions  *            True for case-sensitive behavior; compares standard NFD forms.
98*4d495c6eSApple OSS Distributions  * are_equal: On success, set to true if the strings are equal, or set to false
99*4d495c6eSApple OSS Distributions  *            if they are not.
100*4d495c6eSApple OSS Distributions  *
101*4d495c6eSApple OSS Distributions  * Returns: 0 on success, or
102*4d495c6eSApple OSS Distributions  *          EILSEQ: One or both of the input strings contains illegal ASCII-range
103*4d495c6eSApple OSS Distributions  *                  characters (0x00 or '/'), or is not well-formed stream-safe UTF-8,
104*4d495c6eSApple OSS Distributions  *                  or contains codepoints that are non-characters or unassigned in
105*4d495c6eSApple OSS Distributions  *                  the version of Unicode currently supported.
106*4d495c6eSApple OSS Distributions  *                  Note: The comparison may terminate early when a difference is
107*4d495c6eSApple OSS Distributions  *                        detected, and may return 0 and set *are_equal=false even
108*4d495c6eSApple OSS Distributions  *                        if one or both strings are invalid.
109*4d495c6eSApple OSS Distributions  */
110*4d495c6eSApple OSS Distributions int utf8_normalizeOptCaseFoldAndCompare(const char *strA,
111*4d495c6eSApple OSS Distributions     size_t      strA_len,
112*4d495c6eSApple OSS Distributions     const char *strB,
113*4d495c6eSApple OSS Distributions     size_t      strB_len,
114*4d495c6eSApple OSS Distributions     bool        case_sens,
115*4d495c6eSApple OSS Distributions     bool       *are_equal);
116*4d495c6eSApple OSS Distributions 
117*4d495c6eSApple OSS Distributions /*
118*4d495c6eSApple OSS Distributions  * utf8_normalizeOptCaseFold
119*4d495c6eSApple OSS Distributions  *
120*4d495c6eSApple OSS Distributions  * Convert a given UTF-8 string to UTF-32 in one of the following normalized forms,
121*4d495c6eSApple OSS Distributions  * as specified by the case_sens parameter, and copy the result to the ustr
122*4d495c6eSApple OSS Distributions  * buffer:
123*4d495c6eSApple OSS Distributions  * - "canonical caseless form" (case-folded NFD, as described by definition D145
124*4d495c6eSApple OSS Distributions  *    in chapter 3 of The Unicode Standard); for case-insensitive behavior.
125*4d495c6eSApple OSS Distributions  * - standard NFD; for case-sensitive behavior (if case_sens = true).
126*4d495c6eSApple OSS Distributions  *
127*4d495c6eSApple OSS Distributions  * The input string should be valid UTF-8 that meets the criteria for stream safe
128*4d495c6eSApple OSS Distributions  * text as described in http://unicode.org/reports/tr15/#Stream_Safe_Text_Format.
129*4d495c6eSApple OSS Distributions  * It should not contain ASCII 0x00 or '/'.
130*4d495c6eSApple OSS Distributions  *
131*4d495c6eSApple OSS Distributions  * str:       The input UTF-8 string (need not be 0 terminated)
132*4d495c6eSApple OSS Distributions  * str_len:   The byte length of the input string (excluding any 0 terminator)
133*4d495c6eSApple OSS Distributions  * case_sens: False for case-insensitive behavior; generates canonical caseless form.
134*4d495c6eSApple OSS Distributions  *            True for case-sensitive behavior; generates standard NFD.
135*4d495c6eSApple OSS Distributions  * ustr:      A pointer to a buffer for the resulting UTF-32 string.
136*4d495c6eSApple OSS Distributions  * ustr_size: The capacity of ustr, in UTF-32 units.
137*4d495c6eSApple OSS Distributions  * ustr_len:  Pointer to a value that will be filled in with the actual length
138*4d495c6eSApple OSS Distributions  *            in UTF-32 units of the string copied to ustr.
139*4d495c6eSApple OSS Distributions  *
140*4d495c6eSApple OSS Distributions  * Returns: 0 on success, or
141*4d495c6eSApple OSS Distributions  *          EILSEQ: The input string contains illegal ASCII-range characters
142*4d495c6eSApple OSS Distributions  *                  (0x00 or '/'), or is not well-formed stream-safe UTF-8, or
143*4d495c6eSApple OSS Distributions  *                  contains codepoints that are non-characters or unassigned in
144*4d495c6eSApple OSS Distributions  *                  the version of Unicode currently supported.
145*4d495c6eSApple OSS Distributions  *          ENOMEM: ustr_size is insufficient for the resulting string. In this
146*4d495c6eSApple OSS Distributions  *                  case the value returned in *ustr_len is invalid.
147*4d495c6eSApple OSS Distributions  */
148*4d495c6eSApple OSS Distributions int utf8_normalizeOptCaseFold(const char *str,
149*4d495c6eSApple OSS Distributions     size_t      str_len,
150*4d495c6eSApple OSS Distributions     bool        case_sens,
151*4d495c6eSApple OSS Distributions     int32_t    *ustr,
152*4d495c6eSApple OSS Distributions     int32_t     ustr_size,
153*4d495c6eSApple OSS Distributions     int32_t    *ustr_len);
154*4d495c6eSApple OSS Distributions 
155*4d495c6eSApple OSS Distributions /*
156*4d495c6eSApple OSS Distributions  * utf8_normalizeOptCaseFoldToUTF8
157*4d495c6eSApple OSS Distributions  *
158*4d495c6eSApple OSS Distributions  * Convert a given UTF-8 string to UTF-8 in one of the following normalized forms,
159*4d495c6eSApple OSS Distributions  * as specified by the case_sens parameter, and copy the result to the ustr
160*4d495c6eSApple OSS Distributions  * buffer:
161*4d495c6eSApple OSS Distributions  * - "canonical caseless form" (case-folded NFD, as described by definition D145
162*4d495c6eSApple OSS Distributions  *    in chapter 3 of The Unicode Standard); for case-insensitive behavior.
163*4d495c6eSApple OSS Distributions  * - standard NFD; for case-sensitive behavior (if case_sens = true).
164*4d495c6eSApple OSS Distributions  *
165*4d495c6eSApple OSS Distributions  * The input string should be valid UTF-8 that meets the criteria for stream safe
166*4d495c6eSApple OSS Distributions  * text as described in http://unicode.org/reports/tr15/#Stream_Safe_Text_Format.
167*4d495c6eSApple OSS Distributions  * It should not contain ASCII 0x00 or '/'.
168*4d495c6eSApple OSS Distributions  *
169*4d495c6eSApple OSS Distributions  * str:       The input UTF-8 string (need not be 0 terminated)
170*4d495c6eSApple OSS Distributions  * str_len:   The byte length of the input string (excluding any 0 terminator)
171*4d495c6eSApple OSS Distributions  * case_sens: False for case-insensitive behavior; generates canonical caseless form.
172*4d495c6eSApple OSS Distributions  *            True for case-sensitive behavior; generates standard NFD.
173*4d495c6eSApple OSS Distributions  * ustr:      A pointer to a buffer for the resulting UTF-8 string.
174*4d495c6eSApple OSS Distributions  * ustr_size: The capacity of ustr, in bytes.
175*4d495c6eSApple OSS Distributions  * ustr_len:  Pointer to a value that will be filled in with the actual length
176*4d495c6eSApple OSS Distributions  *            in bytes of the string copied to ustr.
177*4d495c6eSApple OSS Distributions  *
178*4d495c6eSApple OSS Distributions  * Returns: 0 on success, or
179*4d495c6eSApple OSS Distributions  *          EILSEQ: The input string contains illegal ASCII-range characters
180*4d495c6eSApple OSS Distributions  *                  (0x00 or '/'), or is not well-formed stream-safe UTF-8, or
181*4d495c6eSApple OSS Distributions  *                  contains codepoints that are non-characters or unassigned in
182*4d495c6eSApple OSS Distributions  *                  the version of Unicode currently supported.
183*4d495c6eSApple OSS Distributions  *          ENOMEM: ustr_size is insufficient for the resulting string. In this
184*4d495c6eSApple OSS Distributions  *                  case the value returned in *ustr_len is invalid.
185*4d495c6eSApple OSS Distributions  */
186*4d495c6eSApple OSS Distributions int utf8_normalizeOptCaseFoldToUTF8(const char *str,
187*4d495c6eSApple OSS Distributions     size_t      str_len,
188*4d495c6eSApple OSS Distributions     bool        case_sens,
189*4d495c6eSApple OSS Distributions     char       *ustr,
190*4d495c6eSApple OSS Distributions     size_t      ustr_size,
191*4d495c6eSApple OSS Distributions     size_t     *ustr_len);
192*4d495c6eSApple OSS Distributions 
193*4d495c6eSApple OSS Distributions /*
194*4d495c6eSApple OSS Distributions  * utf8_normalizeOptCaseFoldToUTF8ForPath
195*4d495c6eSApple OSS Distributions  *
196*4d495c6eSApple OSS Distributions  * Convert a given UTF-8 path string to UTF-8 in one of the following normalized forms,
197*4d495c6eSApple OSS Distributions  * as specified by the case_sens parameter, and copy the result to the ustr
198*4d495c6eSApple OSS Distributions  * buffer:
199*4d495c6eSApple OSS Distributions  * - "canonical caseless form" (case-folded NFD, as described by definition D145
200*4d495c6eSApple OSS Distributions  *    in chapter 3 of The Unicode Standard); for case-insensitive behavior.
201*4d495c6eSApple OSS Distributions  * - standard NFD; for case-sensitive behavior (if case_sens = true).
202*4d495c6eSApple OSS Distributions  *
203*4d495c6eSApple OSS Distributions  * The input string should be valid UTF-8 that meets the criteria for stream safe
204*4d495c6eSApple OSS Distributions  * text as described in http://unicode.org/reports/tr15/#Stream_Safe_Text_Format.
205*4d495c6eSApple OSS Distributions  *
206*4d495c6eSApple OSS Distributions  * str:       The input UTF-8 path string
207*4d495c6eSApple OSS Distributions  * str_len:   The byte length of the input path string (excluding any 0 terminator)
208*4d495c6eSApple OSS Distributions  * case_sens: False for case-insensitive behavior; generates canonical caseless form.
209*4d495c6eSApple OSS Distributions  *            True for case-sensitive behavior; generates standard NFD.
210*4d495c6eSApple OSS Distributions  * ustr:      A pointer to a buffer for the resulting UTF-8 string.
211*4d495c6eSApple OSS Distributions  * ustr_size: The capacity of ustr, in bytes.
212*4d495c6eSApple OSS Distributions  * ustr_len:  Pointer to a value that will be filled in with the actual length
213*4d495c6eSApple OSS Distributions  *            in bytes of the string copied to ustr.
214*4d495c6eSApple OSS Distributions  *
215*4d495c6eSApple OSS Distributions  * Returns: 0 on success, or
216*4d495c6eSApple OSS Distributions  *          EILSEQ: The input string contains illegal ASCII-range characters
217*4d495c6eSApple OSS Distributions  *                  (0x00), or is not well-formed stream-safe UTF-8, or
218*4d495c6eSApple OSS Distributions  *                  contains codepoints that are non-characters or unassigned in
219*4d495c6eSApple OSS Distributions  *                  the version of Unicode currently supported.
220*4d495c6eSApple OSS Distributions  *          ENOMEM: ustr_size is insufficient for the resulting string. In this
221*4d495c6eSApple OSS Distributions  *                  case the value returned in *ustr_len is invalid.
222*4d495c6eSApple OSS Distributions  */
223*4d495c6eSApple OSS Distributions int utf8_normalizeOptCaseFoldToUTF8ForPath(const char *str,
224*4d495c6eSApple OSS Distributions     size_t      str_len,
225*4d495c6eSApple OSS Distributions     bool        case_sens,
226*4d495c6eSApple OSS Distributions     char       *ustr,
227*4d495c6eSApple OSS Distributions     size_t      ustr_size,
228*4d495c6eSApple OSS Distributions     size_t     *ustr_len);
229*4d495c6eSApple OSS Distributions 
230*4d495c6eSApple OSS Distributions /*
231*4d495c6eSApple OSS Distributions  * utf8_normalizeOptCaseFoldAndMatchSubstring
232*4d495c6eSApple OSS Distributions  *
233*4d495c6eSApple OSS Distributions  * Determine whether the normalized UTF32 string derived from a specified UTF-8 string
234*4d495c6eSApple OSS Distributions  * strA contains another UTF32 string ustrB which has already been normalized, typically
235*4d495c6eSApple OSS Distributions  * with normalizeOptCaseFold. The normalization for both strings is one of the following,
236*4d495c6eSApple OSS Distributions  * as specified by the case_sens parameter:
237*4d495c6eSApple OSS Distributions  * - "canonical caseless form" (case-folded NFD); for case-insensitive comparison.
238*4d495c6eSApple OSS Distributions  * - standard NFD; for case-sensitive comparison (if case_sens = true).
239*4d495c6eSApple OSS Distributions  * On success, sets are_equal to true if strA contains ustrB, or false otherwise.
240*4d495c6eSApple OSS Distributions  *
241*4d495c6eSApple OSS Distributions  * The input string strA should be valid UTF-8 that meets the criteria for stream safe
242*4d495c6eSApple OSS Distributions  * text as described in http://unicode.org/reports/tr15/#Stream_Safe_Text_Format.
243*4d495c6eSApple OSS Distributions  * It should not contain ASCII 0x00 or '/'.
244*4d495c6eSApple OSS Distributions  *
245*4d495c6eSApple OSS Distributions  * strA:      A UTF-8 string (need not be 0 terminated) in which to search for the
246*4d495c6eSApple OSS Distributions  *            substring specified by ustrB.
247*4d495c6eSApple OSS Distributions  * strA_len:  The byte length of strA (excluding any 0 terminator)
248*4d495c6eSApple OSS Distributions  * ustrB:     A normalized UTF-32 substring (need not be 0 terminated) to be searched
249*4d495c6eSApple OSS Distributions  *            for in the UTF-32 string resulting from converting strA to the normalized
250*4d495c6eSApple OSS Distributions  *            UTF-32 form specified by the case_sens parameter; ustrB must already be
251*4d495c6eSApple OSS Distributions  *            in that form. Normally this will be produced using normalizeOptCaseFold.
252*4d495c6eSApple OSS Distributions  * ustrB_len: The length of ustrB in UTF-32 units (excluding any 0 terminator).
253*4d495c6eSApple OSS Distributions  * case_sens: False for case-insensitive matching; compares canonical caseless forms.
254*4d495c6eSApple OSS Distributions  *            True for case-sensitive matching; compares standard NFD forms.
255*4d495c6eSApple OSS Distributions  * buf:       Pointer to caller-supplied working memory for storing the portion of
256*4d495c6eSApple OSS Distributions  *            strA which has been converted to normalized UTF-32.
257*4d495c6eSApple OSS Distributions  * buf_size:  The size of buf.
258*4d495c6eSApple OSS Distributions  * has_match: On success, set to true if strA (when converter to UTF-32 and normalized
259*4d495c6eSApple OSS Distributions  *            per case_sens) contains ustrB, set to false otherwise.
260*4d495c6eSApple OSS Distributions  *
261*4d495c6eSApple OSS Distributions  * Returns: 0 on success, or
262*4d495c6eSApple OSS Distributions  *          EILSEQ: strA contains illegal ASCII-range characters (0x00 or '/'), or is
263*4d495c6eSApple OSS Distributions  *                  not well-formed stream-safe UTF-8, or contains codepoints that are
264*4d495c6eSApple OSS Distributions  *                  non-characters or unassigned in the version of Unicode currently
265*4d495c6eSApple OSS Distributions  *                  supported.
266*4d495c6eSApple OSS Distributions  *                  Note: The search may terminate early when a match is detected, and
267*4d495c6eSApple OSS Distributions  *                        may return 0 and set *has_match=true even if strA is invalid.
268*4d495c6eSApple OSS Distributions  *          ENOMEM: buf_size is insufficient.
269*4d495c6eSApple OSS Distributions  */
270*4d495c6eSApple OSS Distributions int utf8_normalizeOptCaseFoldAndMatchSubstring(const char    *strA,
271*4d495c6eSApple OSS Distributions     size_t         strA_len,
272*4d495c6eSApple OSS Distributions     const int32_t *ustrB,
273*4d495c6eSApple OSS Distributions     int32_t        ustrB_len,
274*4d495c6eSApple OSS Distributions     bool           case_sens,
275*4d495c6eSApple OSS Distributions     void          *buf,
276*4d495c6eSApple OSS Distributions     size_t         buf_size,
277*4d495c6eSApple OSS Distributions     bool          *has_match);
278*4d495c6eSApple OSS Distributions 
279*4d495c6eSApple OSS Distributions /*
280*4d495c6eSApple OSS Distributions  * utf8_normalizeOptCaseFoldGetUVersion
281*4d495c6eSApple OSS Distributions  *
282*4d495c6eSApple OSS Distributions  * Get the Unicode and code version currently associated with the normalizeOptCaseFold
283*4d495c6eSApple OSS Distributions  * functions. The caller allocates the version array and passes it to the function,
284*4d495c6eSApple OSS Distributions  * which will fill out the array as follows:
285*4d495c6eSApple OSS Distributions  * version[0] = Unicode major version; for Unicode 6.3.0 this would be 6
286*4d495c6eSApple OSS Distributions  * version[1] = Unicode minor version; for Unicode 6.3.0 this would be 3
287*4d495c6eSApple OSS Distributions  * version[2] = Unicode patch version; for Unicode 6.3.0 this would be 0
288*4d495c6eSApple OSS Distributions  * version[3] = Code revision level; for any given Unicode version, this value starts
289*4d495c6eSApple OSS Distributions  *              at 0 and is incremented for each significant revision to the
290*4d495c6eSApple OSS Distributions  *              normalizeOptCaseFold functions.
291*4d495c6eSApple OSS Distributions  */
292*4d495c6eSApple OSS Distributions void utf8_normalizeOptCaseFoldGetUVersion(unsigned char version[4]);
293*4d495c6eSApple OSS Distributions 
294*4d495c6eSApple OSS Distributions #endif /* KERNEL_PRIVATE */
295*4d495c6eSApple OSS Distributions 
296*4d495c6eSApple OSS Distributions #endif  /* unicode_h */
297