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