]> git.proxmox.com Git - mirror_zfs-debian.git/blame - zfs/lib/libport/include/sys/u8_textprep.h
Remove stray stub kernel files which should be brought in my linux-kernel-module...
[mirror_zfs-debian.git] / zfs / lib / libport / include / sys / u8_textprep.h
CommitLineData
34dc7c2f
BB
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#include "zfs_config.h"
27
28#ifdef HAVE_UNICODE
29#include_next <sys/u8_textprep.h>
30#else
31
32#ifndef _SYS_U8_TEXTPREP_H
33#define _SYS_U8_TEXTPREP_H
34
35#include <sys/isa_defs.h>
36#include <sys/types.h>
37#include <sys/errno.h>
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43/*
44 * Unicode encoding conversion functions and their macros.
45 */
46#define UCONV_IN_BIG_ENDIAN 0x0001
47#define UCONV_OUT_BIG_ENDIAN 0x0002
48#define UCONV_IN_SYSTEM_ENDIAN 0x0004
49#define UCONV_OUT_SYSTEM_ENDIAN 0x0008
50#define UCONV_IN_LITTLE_ENDIAN 0x0010
51#define UCONV_OUT_LITTLE_ENDIAN 0x0020
52#define UCONV_IGNORE_NULL 0x0040
53#define UCONV_IN_ACCEPT_BOM 0x0080
54#define UCONV_OUT_EMIT_BOM 0x0100
55
56extern int uconv_u16tou32(const uint16_t *, size_t *, uint32_t *, size_t *,
57 int);
58extern int uconv_u16tou8(const uint16_t *, size_t *, uchar_t *, size_t *, int);
59extern int uconv_u32tou16(const uint32_t *, size_t *, uint16_t *, size_t *,
60 int);
61extern int uconv_u32tou8(const uint32_t *, size_t *, uchar_t *, size_t *, int);
62extern int uconv_u8tou16(const uchar_t *, size_t *, uint16_t *, size_t *, int);
63extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int);
64
65/*
66 * UTF-8 text preparation functions and their macros.
67 *
68 * Among the macros defined, U8_CANON_DECOMP, U8_COMPAT_DECOMP, and
69 * U8_CANON_COMP are not public interfaces and must not be used directly
70 * at the flag input argument.
71 */
72#define U8_STRCMP_CS (0x00000001)
73#define U8_STRCMP_CI_UPPER (0x00000002)
74#define U8_STRCMP_CI_LOWER (0x00000004)
75
76#define U8_CANON_DECOMP (0x00000010)
77#define U8_COMPAT_DECOMP (0x00000020)
78#define U8_CANON_COMP (0x00000040)
79
80#define U8_STRCMP_NFD (U8_CANON_DECOMP)
81#define U8_STRCMP_NFC (U8_CANON_DECOMP | U8_CANON_COMP)
82#define U8_STRCMP_NFKD (U8_COMPAT_DECOMP)
83#define U8_STRCMP_NFKC (U8_COMPAT_DECOMP | U8_CANON_COMP)
84
85#define U8_TEXTPREP_TOUPPER (U8_STRCMP_CI_UPPER)
86#define U8_TEXTPREP_TOLOWER (U8_STRCMP_CI_LOWER)
87
88#define U8_TEXTPREP_NFD (U8_STRCMP_NFD)
89#define U8_TEXTPREP_NFC (U8_STRCMP_NFC)
90#define U8_TEXTPREP_NFKD (U8_STRCMP_NFKD)
91#define U8_TEXTPREP_NFKC (U8_STRCMP_NFKC)
92
93#define U8_TEXTPREP_IGNORE_NULL (0x00010000)
94#define U8_TEXTPREP_IGNORE_INVALID (0x00020000)
95#define U8_TEXTPREP_NOWAIT (0x00040000)
96
97#define U8_UNICODE_320 (0)
98#define U8_UNICODE_500 (1)
99#define U8_UNICODE_LATEST (U8_UNICODE_500)
100
101#define U8_VALIDATE_ENTIRE (0x00100000)
102#define U8_VALIDATE_CHECK_ADDITIONAL (0x00200000)
103#define U8_VALIDATE_UCS2_RANGE (0x00400000)
104
105#define U8_ILLEGAL_CHAR (-1)
106#define U8_OUT_OF_RANGE_CHAR (-2)
107
108extern int u8_validate(char *, size_t, char **, int, int *);
109extern int u8_strcmp(const char *, const char *, size_t, int, size_t, int *);
110extern size_t u8_textprep_str(char *, size_t *, char *, size_t *, int, size_t,
111 int *);
112
113#ifdef __cplusplus
114}
115#endif
116
117#endif /* HAVE_UNICODE */
118
119#endif /* _SYS_U8_TEXTPREP_H */