Debian Codegraph @

include/libxml/chvalid.h

raw
1 /**
2 * @file
3 *
4 * @brief Unicode character range checking
5 *
6 * this module exports interfaces for the character
7 * range validation APIs
8 */
9
10 #ifndef __XML_CHVALID_H__
11 #define __XML_CHVALID_H__
12
13 #include <libxml/xmlversion.h>
14 #include <libxml/xmlstring.h>
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 /** @cond ignore */
21
22 /*
23 * Define our typedefs and structures
24 *
25 */
26 typedef struct _xmlChSRange xmlChSRange;
27 typedef xmlChSRange *xmlChSRangePtr;
28 struct _xmlChSRange {
29 unsigned short low;
30 unsigned short high;
31 };
32
33 typedef struct _xmlChLRange xmlChLRange;
34 typedef xmlChLRange *xmlChLRangePtr;
35 struct _xmlChLRange {
36 unsigned int low;
37 unsigned int high;
38 };
39
40 typedef struct _xmlChRangeGroup xmlChRangeGroup;
41 typedef xmlChRangeGroup *xmlChRangeGroupPtr;
42 struct _xmlChRangeGroup {
43 int nbShortRange;
44 int nbLongRange;
45 const xmlChSRange *shortRange; /* points to an array of ranges */
46 const xmlChLRange *longRange;
47 };
48
49 XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
50 XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
51 XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
52 XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
53 XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
54 XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
55 XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
56
57 /**
58 * Range checking routine
59 */
60 XMLPUBFUN int
61 xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
62
63 /** @endcond */
64
65 /**
66 * Automatically generated by genChRanges.py
67 *
68 * @param c char to validate
69 */
70 #define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
71 ((0x61 <= (c)) && ((c) <= 0x7a)) || \
72 ((0xc0 <= (c)) && ((c) <= 0xd6)) || \
73 ((0xd8 <= (c)) && ((c) <= 0xf6)) || \
74 (0xf8 <= (c)))
75
76 /**
77 * Automatically generated by genChRanges.py
78 *
79 * @param c char to validate
80 */
81 #define xmlIsBaseCharQ(c) (((c) < 0x100) ? \
82 xmlIsBaseChar_ch((c)) : \
83 xmlCharInRange((c), &xmlIsBaseCharGroup))
84
85 /**
86 * Automatically generated by genChRanges.py
87 *
88 * @param c char to validate
89 */
90 #define xmlIsBlank_ch(c) (((c) == 0x20) || \
91 ((0x9 <= (c)) && ((c) <= 0xa)) || \
92 ((c) == 0xd))
93
94 /**
95 * Automatically generated by genChRanges.py
96 *
97 * @param c char to validate
98 */
99 #define xmlIsBlankQ(c) (((c) < 0x100) ? \
100 xmlIsBlank_ch((c)) : 0)
101
102
103 /**
104 * Automatically generated by genChRanges.py
105 *
106 * @param c char to validate
107 */
108 #define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \
109 ((c) == 0xd) || \
110 (0x20 <= (c)))
111
112 /**
113 * Automatically generated by genChRanges.py
114 *
115 * @param c char to validate
116 */
117 #define xmlIsCharQ(c) (((c) < 0x100) ? \
118 xmlIsChar_ch((c)) :\
119 (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
120 ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
121 ((0x10000 <= (c)) && ((c) <= 0x10ffff))))
122
123 /**
124 * Automatically generated by genChRanges.py
125 *
126 * @param c char to validate
127 */
128 #define xmlIsCombiningQ(c) (((c) < 0x100) ? \
129 0 : \
130 xmlCharInRange((c), &xmlIsCombiningGroup))
131
132 /**
133 * Automatically generated by genChRanges.py
134 *
135 * @param c char to validate
136 */
137 #define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39)))
138
139 /**
140 * Automatically generated by genChRanges.py
141 *
142 * @param c char to validate
143 */
144 #define xmlIsDigitQ(c) (((c) < 0x100) ? \
145 xmlIsDigit_ch((c)) : \
146 xmlCharInRange((c), &xmlIsDigitGroup))
147
148 /**
149 * Automatically generated by genChRanges.py
150 *
151 * @param c char to validate
152 */
153 #define xmlIsExtender_ch(c) (((c) == 0xb7))
154
155 /**
156 * Automatically generated by genChRanges.py
157 *
158 * @param c char to validate
159 */
160 #define xmlIsExtenderQ(c) (((c) < 0x100) ? \
161 xmlIsExtender_ch((c)) : \
162 xmlCharInRange((c), &xmlIsExtenderGroup))
163
164 /**
165 * Automatically generated by genChRanges.py
166 *
167 * @param c char to validate
168 */
169 #define xmlIsIdeographicQ(c) (((c) < 0x100) ? \
170 0 :\
171 (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
172 ((c) == 0x3007) || \
173 ((0x3021 <= (c)) && ((c) <= 0x3029))))
174
175 /**
176 * Automatically generated by genChRanges.py
177 *
178 * @param c char to validate
179 */
180 #define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)])
181
182 /**
183 * Automatically generated by genChRanges.py
184 *
185 * @param c char to validate
186 */
187 #define xmlIsPubidCharQ(c) (((c) < 0x100) ? \
188 xmlIsPubidChar_ch((c)) : 0)
189
190 XML_DEPRECATED
191 XMLPUBFUN int
192 xmlIsBaseChar(unsigned int ch);
193 XML_DEPRECATED
194 XMLPUBFUN int
195 xmlIsBlank(unsigned int ch);
196 XML_DEPRECATED
197 XMLPUBFUN int
198 xmlIsChar(unsigned int ch);
199 XML_DEPRECATED
200 XMLPUBFUN int
201 xmlIsCombining(unsigned int ch);
202 XML_DEPRECATED
203 XMLPUBFUN int
204 xmlIsDigit(unsigned int ch);
205 XML_DEPRECATED
206 XMLPUBFUN int
207 xmlIsExtender(unsigned int ch);
208 XML_DEPRECATED
209 XMLPUBFUN int
210 xmlIsIdeographic(unsigned int ch);
211 XML_DEPRECATED
212 XMLPUBFUN int
213 xmlIsPubidChar(unsigned int ch);
214
215 #ifdef __cplusplus
216 }
217 #endif
218 #endif /* __XML_CHVALID_H__ */