1 /* $NetBSD: unicode.h,v 1.4 2014/12/10 04:37:55 christos Exp $ */
3 /* Id: unicode.h,v 1.1 2003/06/04 00:25:43 marka Exp */
5 * Copyright (c) 2000,2001 Japan Network Information Center.
8 * By using this file, you agree to the terms and conditions set forth bellow.
10 * LICENSE TERMS AND CONDITIONS
12 * The following License Terms and Conditions apply, unless a different
13 * license is obtained from Japan Network Information Center ("JPNIC"),
14 * a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
15 * Chiyoda-ku, Tokyo 101-0047, Japan.
17 * 1. Use, Modification and Redistribution (including distribution of any
18 * modified or derived work) in source and/or binary forms is permitted
19 * under this License Terms and Conditions.
21 * 2. Redistribution of source code must retain the copyright notices as they
22 * appear in each source code file, this License Terms and Conditions.
24 * 3. Redistribution in binary form must reproduce the Copyright Notice,
25 * this License Terms and Conditions, in the documentation and/or other
26 * materials provided with the distribution. For the purposes of binary
27 * distribution the "Copyright Notice" refers to the following language:
28 * "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
30 * 4. The name of JPNIC may not be used to endorse or promote products
31 * derived from this Software without specific prior written approval of
34 * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
35 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
37 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
41 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
42 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
43 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
44 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
48 #define IDN_UNICODE_H 1
55 * Unicode attributes retriever.
57 * All the information this module provides is based on UnicodeData.txt,
58 * CompositionExclusions-1.txt and SpecialCasing.txt, all of which can be
59 * obtained from unicode.org.
61 * Unicode characters are represented as 'unsigned long'.
64 #include <idn/result.h>
67 * A Handle for Unicode versions.
69 typedef struct idn__unicode_ops
*idn__unicode_version_t
;
72 * Context information for case conversion.
75 idn__unicode_context_unknown
,
76 idn__unicode_context_final
,
77 idn__unicode_context_nonfinal
78 } idn__unicode_context_t
;
81 * Create a handle for a specific Unicode version.
82 * The version number (such as "3.0.1") is specified by 'version' parameter.
83 * If it is NULL, the latest version is used.
84 * The handle is stored in '*versionp', which is used various functions
85 * in this and unormalize modules.
89 * idn_notfound -- specified version not found.
92 idn__unicode_create(const char *version
, idn__unicode_version_t
*versionp
);
95 * Close a handle which was created by 'idn__unicode_create'.
98 idn__unicode_destroy(idn__unicode_version_t version
);
101 * Get canonical class.
103 * For characters out of unicode range (i.e. above 0xffff), 0 will
107 idn__unicode_canonicalclass(idn__unicode_version_t version
, unsigned long c
);
110 * Decompose a character.
112 * Decompose character given by 'c', and put the result into 'v',
113 * which can hold 'vlen' characters. The number of decomposed characters
114 * will be stored in '*decomp_lenp'.
116 * If 'compat' is true, compatibility decomposition is performed.
117 * Otherwise canonical decomposition is done.
119 * Since decomposition is done recursively, no further decomposition
123 * idn_success -- ok, decomposed.
124 * idn_notfound -- no decomposition possible.
125 * idn_buffer_overflow -- 'vlen' is too small.
128 idn__unicode_decompose(idn__unicode_version_t version
,
129 int compat
, unsigned long *v
, size_t vlen
,
130 unsigned long c
, int *decomp_lenp
);
133 * Perform canonical composition.
135 * Do canonical composition to the character sequence 'c1' and 'c2', put the
136 * result into '*compp'.
138 * Since Unicode Nomalization Froms requires only canonical composition,
139 * compatibility composition is not supported.
142 * idn_success -- ok, composed.
143 * idn_notfound -- no composition possible.
146 idn__unicode_compose(idn__unicode_version_t version
,
147 unsigned long c1
, unsigned long c2
, unsigned long *compp
);
150 * Returns if there may be a canonical composition sequence which starts
151 * with the given character.
154 * 1 -- there may be a composition sequence
156 * 0 -- no, there is definitely no such sequences.
159 idn__unicode_iscompositecandidate(idn__unicode_version_t version
,
166 #endif /* IDN_UNICODE_H */