]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep.h
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / sys / cddl / contrib / opensolaris / uts / common / sys / u8_textprep.h
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25
26 #ifndef _SYS_U8_TEXTPREP_H
27 #define _SYS_U8_TEXTPREP_H
28
29 #pragma ident   "%Z%%M% %I%     %E% SMI"
30
31 #include <sys/isa_defs.h>
32 #include <sys/types.h>
33 #include <sys/errno.h>
34
35 #ifdef  __cplusplus
36 extern "C" {
37 #endif
38
39 /*
40  * UTF-8 text preparation functions and their macros.
41  *
42  * Among the macros defined, U8_CANON_DECOMP, U8_COMPAT_DECOMP, and
43  * U8_CANON_COMP are not public interfaces and must not be used directly
44  * at the flag input argument.
45  */
46 #define U8_STRCMP_CS                    (0x00000001)
47 #define U8_STRCMP_CI_UPPER              (0x00000002)
48 #define U8_STRCMP_CI_LOWER              (0x00000004)
49
50 #define U8_CANON_DECOMP                 (0x00000010)
51 #define U8_COMPAT_DECOMP                (0x00000020)
52 #define U8_CANON_COMP                   (0x00000040)
53
54 #define U8_STRCMP_NFD                   (U8_CANON_DECOMP)
55 #define U8_STRCMP_NFC                   (U8_CANON_DECOMP | U8_CANON_COMP)
56 #define U8_STRCMP_NFKD                  (U8_COMPAT_DECOMP)
57 #define U8_STRCMP_NFKC                  (U8_COMPAT_DECOMP | U8_CANON_COMP)
58
59 #define U8_TEXTPREP_TOUPPER             (U8_STRCMP_CI_UPPER)
60 #define U8_TEXTPREP_TOLOWER             (U8_STRCMP_CI_LOWER)
61
62 #define U8_TEXTPREP_NFD                 (U8_STRCMP_NFD)
63 #define U8_TEXTPREP_NFC                 (U8_STRCMP_NFC)
64 #define U8_TEXTPREP_NFKD                (U8_STRCMP_NFKD)
65 #define U8_TEXTPREP_NFKC                (U8_STRCMP_NFKC)
66
67 #define U8_TEXTPREP_IGNORE_NULL         (0x00010000)
68 #define U8_TEXTPREP_IGNORE_INVALID      (0x00020000)
69 #define U8_TEXTPREP_NOWAIT              (0x00040000)
70
71 #define U8_UNICODE_320                  (0)
72 #define U8_UNICODE_500                  (1)
73 #define U8_UNICODE_LATEST               (U8_UNICODE_500)
74
75 #define U8_VALIDATE_ENTIRE              (0x00100000)
76 #define U8_VALIDATE_CHECK_ADDITIONAL    (0x00200000)
77 #define U8_VALIDATE_UCS2_RANGE          (0x00400000)
78
79 #define U8_ILLEGAL_CHAR                 (-1)
80 #define U8_OUT_OF_RANGE_CHAR            (-2)
81
82 extern int u8_validate(char *, size_t, char **, int, int *);
83 extern int u8_strcmp(const char *, const char *, size_t, int, size_t, int *);
84 extern size_t u8_textprep_str(char *, size_t *, char *, size_t *, int, size_t,
85         int *);
86
87 #ifdef  __cplusplus
88 }
89 #endif
90
91 #endif  /* _SYS_U8_TEXTPREP_H */