|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: this module exports interfaces for the character |
|
15 * range validation APIs |
|
16 * |
|
17 */ |
|
18 |
|
19 /* |
|
20 * Summary: Unicode character range checking |
|
21 * Description: this module exports interfaces for the character |
|
22 * range validation APIs |
|
23 * |
|
24 * This file is automatically generated from the cvs source |
|
25 * definition files using the genChRanges.py Python script |
|
26 * |
|
27 * Generation date: Tue Nov 18 08:14:21 2003 |
|
28 * Sources: chvalid.def |
|
29 * Author: William Brack <wbrack@mmm.com.hk> |
|
30 */ |
|
31 |
|
32 #ifndef __XML_CHVALID_H__ |
|
33 #define __XML_CHVALID_H__ |
|
34 |
|
35 #include <libxml/xmlversion.h> |
|
36 #include <libxml/xmlstring.h> |
|
37 |
|
38 #ifdef __cplusplus |
|
39 extern "C" { |
|
40 #endif |
|
41 |
|
42 /* |
|
43 * Define our typedefs and structures |
|
44 * |
|
45 */ |
|
46 typedef struct _xmlChSRange xmlChSRange; |
|
47 typedef xmlChSRange *xmlChSRangePtr; |
|
48 struct _xmlChSRange { |
|
49 unsigned short low; |
|
50 unsigned short high; |
|
51 }; |
|
52 |
|
53 typedef struct _xmlChLRange xmlChLRange; |
|
54 typedef xmlChLRange *xmlChLRangePtr; |
|
55 struct _xmlChLRange { |
|
56 unsigned int low; |
|
57 unsigned int high; |
|
58 }; |
|
59 |
|
60 typedef struct _xmlChRangeGroup xmlChRangeGroup; |
|
61 typedef xmlChRangeGroup *xmlChRangeGroupPtr; |
|
62 struct _xmlChRangeGroup { |
|
63 int nbShortRange; |
|
64 int nbLongRange; |
|
65 xmlChSRangePtr shortRange; /* points to an array of ranges */ |
|
66 xmlChLRangePtr longRange; |
|
67 }; |
|
68 |
|
69 /** |
|
70 * Range checking routine |
|
71 */ |
|
72 XMLPUBFUN int XMLCALL |
|
73 xmlCharInRange(unsigned int val, const xmlChRangeGroupPtr group); |
|
74 |
|
75 |
|
76 /** |
|
77 * xmlIsBaseChar_ch: |
|
78 * @c: char to validate |
|
79 * |
|
80 * Automatically generated by genChRanges.py |
|
81 */ |
|
82 #define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ |
|
83 ((0x61 <= (c)) && ((c) <= 0x7a)) || \ |
|
84 ((0xc0 <= (c)) && ((c) <= 0xd6)) || \ |
|
85 ((0xd8 <= (c)) && ((c) <= 0xf6)) || \ |
|
86 (0xf8 <= (c))) |
|
87 |
|
88 /** |
|
89 * xmlIsBaseCharQ: |
|
90 * @c: char to validate |
|
91 * |
|
92 * Automatically generated by genChRanges.py |
|
93 */ |
|
94 #define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ |
|
95 xmlIsBaseChar_ch((c)) : \ |
|
96 xmlCharInRange((c), &xmlIsBaseCharGroup)) |
|
97 |
|
98 XMLPUBVAR xmlChRangeGroup xmlIsBaseCharGroup; |
|
99 |
|
100 /** |
|
101 * xmlIsBlank_ch: |
|
102 * @c: char to validate |
|
103 * |
|
104 * Automatically generated by genChRanges.py |
|
105 */ |
|
106 #define xmlIsBlank_ch(c) (((c) == 0x20) || \ |
|
107 ((0x9 <= (c)) && ((c) <= 0xa)) || \ |
|
108 ((c) == 0xd)) |
|
109 |
|
110 /** |
|
111 * xmlIsBlankQ: |
|
112 * @c: char to validate |
|
113 * |
|
114 * Automatically generated by genChRanges.py |
|
115 */ |
|
116 #define xmlIsBlankQ(c) (((c) < 0x100) ? \ |
|
117 xmlIsBlank_ch((c)) : 0) |
|
118 |
|
119 |
|
120 /** |
|
121 * xmlIsChar_ch: |
|
122 * @c: char to validate |
|
123 * |
|
124 * Automatically generated by genChRanges.py |
|
125 */ |
|
126 #define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ |
|
127 ((c) == 0xd) || \ |
|
128 (0x20 <= (c))) |
|
129 |
|
130 /** |
|
131 * xmlIsCharQ: |
|
132 * @c: char to validate |
|
133 * |
|
134 * Automatically generated by genChRanges.py |
|
135 */ |
|
136 #define xmlIsCharQ(c) (((c) < 0x100) ? \ |
|
137 xmlIsChar_ch((c)) :\ |
|
138 (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ |
|
139 ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ |
|
140 ((0x10000 <= (c)) && ((c) <= 0x10ffff)))) |
|
141 |
|
142 XMLPUBVAR xmlChRangeGroup xmlIsCharGroup; |
|
143 |
|
144 /** |
|
145 * xmlIsCombiningQ: |
|
146 * @c: char to validate |
|
147 * |
|
148 * Automatically generated by genChRanges.py |
|
149 */ |
|
150 #define xmlIsCombiningQ(c) (((c) < 0x100) ? \ |
|
151 0 : \ |
|
152 xmlCharInRange((c), &xmlIsCombiningGroup)) |
|
153 |
|
154 XMLPUBVAR xmlChRangeGroup xmlIsCombiningGroup; |
|
155 |
|
156 /** |
|
157 * xmlIsDigit_ch: |
|
158 * @c: char to validate |
|
159 * |
|
160 * Automatically generated by genChRanges.py |
|
161 */ |
|
162 #define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) |
|
163 |
|
164 /** |
|
165 * xmlIsDigitQ: |
|
166 * @c: char to validate |
|
167 * |
|
168 * Automatically generated by genChRanges.py |
|
169 */ |
|
170 #define xmlIsDigitQ(c) (((c) < 0x100) ? \ |
|
171 xmlIsDigit_ch((c)) : \ |
|
172 xmlCharInRange((c), &xmlIsDigitGroup)) |
|
173 |
|
174 XMLPUBVAR xmlChRangeGroup xmlIsDigitGroup; |
|
175 |
|
176 /** |
|
177 * xmlIsExtender_ch: |
|
178 * @c: char to validate |
|
179 * |
|
180 * Automatically generated by genChRanges.py |
|
181 */ |
|
182 #define xmlIsExtender_ch(c) (((c) == 0xb7)) |
|
183 |
|
184 /** |
|
185 * xmlIsExtenderQ: |
|
186 * @c: char to validate |
|
187 * |
|
188 * Automatically generated by genChRanges.py |
|
189 */ |
|
190 #define xmlIsExtenderQ(c) (((c) < 0x100) ? \ |
|
191 xmlIsExtender_ch((c)) : \ |
|
192 xmlCharInRange((c), &xmlIsExtenderGroup)) |
|
193 |
|
194 XMLPUBVAR xmlChRangeGroup xmlIsExtenderGroup; |
|
195 |
|
196 /** |
|
197 * xmlIsIdeographicQ: |
|
198 * @c: char to validate |
|
199 * |
|
200 * Automatically generated by genChRanges.py |
|
201 */ |
|
202 #define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ |
|
203 0 :\ |
|
204 (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ |
|
205 ((c) == 0x3007) || \ |
|
206 ((0x3021 <= (c)) && ((c) <= 0x3029)))) |
|
207 |
|
208 XMLPUBVAR xmlChRangeGroup xmlIsIdeographicGroup; |
|
209 XMLPUBVAR unsigned char xmlIsPubidChar_tab[256]; |
|
210 |
|
211 /** |
|
212 * xmlIsPubidChar_ch: |
|
213 * @c: char to validate |
|
214 * |
|
215 * Automatically generated by genChRanges.py |
|
216 */ |
|
217 #define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) |
|
218 |
|
219 /** |
|
220 * xmlIsPubidCharQ: |
|
221 * @c: char to validate |
|
222 * |
|
223 * Automatically generated by genChRanges.py |
|
224 */ |
|
225 #define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ |
|
226 xmlIsPubidChar_ch((c)) : 0) |
|
227 |
|
228 XMLPUBFUN int XMLCALL |
|
229 xmlIsBaseChar(unsigned int ch); |
|
230 XMLPUBFUN int XMLCALL |
|
231 xmlIsBlank(unsigned int ch); |
|
232 XMLPUBFUN int XMLCALL |
|
233 xmlIsChar(unsigned int ch); |
|
234 XMLPUBFUN int XMLCALL |
|
235 xmlIsCombining(unsigned int ch); |
|
236 XMLPUBFUN int XMLCALL |
|
237 xmlIsDigit(unsigned int ch); |
|
238 XMLPUBFUN int XMLCALL |
|
239 xmlIsExtender(unsigned int ch); |
|
240 XMLPUBFUN int XMLCALL |
|
241 xmlIsIdeographic(unsigned int ch); |
|
242 XMLPUBFUN int XMLCALL |
|
243 xmlIsPubidChar(unsigned int ch); |
|
244 |
|
245 #ifdef __cplusplus |
|
246 } |
|
247 #endif |
|
248 #endif /* __XML_CHVALID_H__ */ |