2 * Summary: Unicode character range checking
3 * Description: this module exports interfaces for the character
4 * range validation APIs
6 * This file is automatically generated from the cvs source
7 * definition files using the genChRanges.py Python script
9 * Generation date: Tue Nov 18 08:14:21 2003
10 * Sources: chvalid.def
11 * Author: William Brack <wbrack@mmm.com.hk>
13 * See Copyright for the status of this software.
14 * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
25 #pragma warning(disable: 4127 4132 4510 4512 4610)
27 #include "libxml2_xmlstring.h"
34 * Define our typedefs and structures
38 // XMLENGINE: xmlChSRangePtr declared as const now
39 typedef struct _xmlChSRange xmlChSRange;
40 typedef const xmlChSRange* xmlChSRangePtr;
42 const unsigned short low;
43 const unsigned short high;
46 typedef struct _xmlChLRange xmlChLRange;
47 typedef const xmlChLRange* xmlChLRangePtr;
49 const unsigned int low;
50 const unsigned int high;
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;
63 * Range checking routine
66 xmlCharInRange(unsigned int val, const xmlChRangeGroupPtr group);
71 * @c: char to validate
73 * Automatically generated by genChRanges.py
75 #define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
76 ((0x61 <= (c)) && ((c) <= 0x7a)) || \
77 ((0xc0 <= (c)) && ((c) <= 0xd6)) || \
78 ((0xd8 <= (c)) && ((c) <= 0xf6)) || \
80 #ifndef UNDEF_IMPORT_C_IN_DATA
81 XMLPUBVAR const xmlChSRange xmlIsBaseChar_srng[197];
85 * @c: char to validate
87 * Automatically generated by genChRanges.py
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;
97 * @c: char to validate
99 * Automatically generated by genChRanges.py
103 #define xmlIsBlank_ch(c) (((c) == 0x20) || \
104 ((0x9 <= (c)) && ((c) <= 0xa)) || \
109 * @c: char to validate
111 * Automatically generated by genChRanges.py
113 #define xmlIsBlankQ(c) (((c) < 0x100) ? \
114 xmlIsBlank_ch((c)) : 0)
119 * @c: char to validate
121 * Automatically generated by genChRanges.py
123 #define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \
129 * @c: char to validate
131 * Automatically generated by genChRanges.py
133 #define xmlIsCharQ(c) (((c) < 0x100) ? \
135 (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
136 ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
137 ((0x10000 <= (c)) && ((c) <= 0x10ffff))))
139 //XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
143 * @c: char to validate
145 * Automatically generated by genChRanges.py
147 #define xmlIsCombiningQ(c) (((c) < 0x100) ? \
149 xmlCharInRange((c), &xmlIsCombiningGroup))
150 #ifndef UNDEF_IMPORT_C_IN_DATA
151 XMLPUBVAR const xmlChSRange xmlIsCombining_srng[];
152 XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
156 * @c: char to validate
158 * Automatically generated by genChRanges.py
160 #define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39)))
164 * @c: char to validate
166 * Automatically generated by genChRanges.py
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[];
177 * @c: char to validate
179 * Automatically generated by genChRanges.py
181 #define xmlIsExtender_ch(c) (((c) == 0xb7))
185 * @c: char to validate
187 * Automatically generated by genChRanges.py
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;
198 * @c: char to validate
200 * Automatically generated by genChRanges.py
202 #define xmlIsIdeographicQ(c) (((c) < 0x100) ? 0 : \
203 (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
205 ((0x3021 <= (c)) && ((c) <= 0x3029))))
209 * @c: char to validate
211 * Automatically generated by genChRanges.py
213 #define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)])
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
223 #ifndef UNDEF_IMPORT_C_IN_DATA
224 XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
228 * @c: char to validate
230 * Automatically generated by genChRanges.py
232 #define xmlIsPubidCharQ(c) (((c) < 0x100) ? xmlIsPubidChar_ch((c)) : 0)
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 */
250 #endif /* XML_CHVALID_H */