]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/utfconv.h
cc470b4acb355d45e82bdb31b77a60a9a4b723cd
[apple/xnu.git] / bsd / sys / utfconv.h
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _SYS_UTFCONV_H_
25 #define _SYS_UTFCONV_H_
26
27 #include <sys/appleapiopts.h>
28 #include <sys/cdefs.h>
29
30 #ifdef KERNEL
31 #ifdef __APPLE_API_UNSTABLE
32 /*
33 * UTF-8 encode/decode flags
34 */
35 #define UTF_REVERSE_ENDIAN 0x01 /* reverse UCS-2 byte order */
36 #define UTF_NO_NULL_TERM 0x02 /* do not add null termination */
37 #define UTF_DECOMPOSED 0x04 /* generate fully decomposed UCS-2 */
38 #define UTF_PRECOMPOSED 0x08 /* generate precomposed UCS-2 */
39
40 __BEGIN_DECLS
41 size_t utf8_encodelen(const u_int16_t *, size_t, u_int16_t, int);
42
43 int utf8_encodestr(const u_int16_t *, size_t, u_int8_t *, size_t *,
44 size_t, u_int16_t, int);
45
46 int utf8_decodestr(const u_int8_t *, size_t, u_int16_t *,size_t *,
47 size_t, u_int16_t, int);
48
49 int utf8_validatestr(const u_int8_t*, size_t);
50
51 __END_DECLS
52
53 #endif /* __APPLE_API_UNSTABLE */
54 #endif /* KERNEL */
55
56 #endif /* !_SYS_UTFCONV_H_ */