2 * 28 bits for 44 character classifications
3 * generated by char-mapper on 05/06/12 at 16:20:58
5 * This file contains the character classifications
6 * used by AutoGen and AutoOpts for identifying tokens.
7 * The table is static scope, so %guard is empty.
9 * This file is part of AutoGen.
10 * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
12 * AutoGen is free software: you can redistribute it and/or modify it under the
13 * terms of the GNU General Public License as published by the Free Software
14 * Foundation, either version 3 of the License, or (at your option) any later
17 * AutoGen is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef AG_CHAR_MAP_H_GUARD
25 #define AG_CHAR_MAP_H_GUARD 1
28 # if defined(HAVE_INTTYPES_H)
29 # include <inttypes.h>
31 # elif defined(HAVE_STDINT_H)
34 # elif !defined(HAVE_UINT32_T)
36 typedef unsigned int uint32_t;
37 # elif SIZEOF_LONG == 4
38 typedef unsigned long uint32_t;
40 # endif /* HAVE_*INT*_H header */
42 #else /* not HAVE_CONFIG_H -- */
43 # include <inttypes.h>
44 #endif /* HAVE_CONFIG_H */
46 #if 0 /* mapping specification source (from autogen.map) */
49 // %file ag-char-map.h
53 // %comment -- see above
67 // alt-white "\v\f\r\b"
68 // whitespace +horiz-white +newline +alt-white
69 // non-nl-white +horiz-white +alt-white
76 // dec-digit "89" +oct-digit
77 // hex-digit "a-fA-F" +dec-digit
80 // alphabetic +lower-case +upper-case
81 // alphanumeric +alphabetic +dec-digit
82 // var-first +underscore +alphabetic
83 // variable-name +var-first +dec-digit
84 // option-name "^-" +variable-name
85 // value-name +colon +option-name
87 // compound-name +value-name +name-sep +horiz-white
88 // scheme-note +parentheses +quote
90 // unquotable "!-~" -"#,;<=>[\\]`{}?*" -quote -parentheses
91 // end-xml-token "/>" +whitespace
92 // plus-n-space +plus +whitespace
93 // punctuation "!-~" -alphanumeric -"_"
94 // suffix "-._" +alphanumeric
95 // suffix-fmt +percent +suffix +dir-sep
96 // false-type "nNfF0" +nul-byte
97 // file-name +dir-sep +suffix
98 // end-token +nul-byte +whitespace
99 // end-list-entry +comma +end-token
100 // set-separator "|+" +end-list-entry
101 // signed-number +inversion +dec-digit
102 // make-script +dollar +newline
104 #endif /* 0 -- mapping spec. source */
107 typedef uint32_t ag_char_map_mask_t
;
109 #define IS_NEWLINE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000001)
110 #define SPN_NEWLINE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 0)
111 #define BRK_NEWLINE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 0)
112 #define SPN_NEWLINE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 0)
113 #define BRK_NEWLINE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 0)
114 #define IS_NUL_BYTE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000002)
115 #define SPN_NUL_BYTE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 1)
116 #define BRK_NUL_BYTE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 1)
117 #define SPN_NUL_BYTE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 1)
118 #define BRK_NUL_BYTE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 1)
119 #define IS_DIR_SEP_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000004)
120 #define SPN_DIR_SEP_CHARS(_s) spn_ag_char_map_chars((char *)_s, 2)
121 #define BRK_DIR_SEP_CHARS(_s) brk_ag_char_map_chars((char *)_s, 2)
122 #define SPN_DIR_SEP_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 2)
123 #define BRK_DIR_SEP_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 2)
124 #define IS_PERCENT_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000008)
125 #define SPN_PERCENT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 3)
126 #define BRK_PERCENT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 3)
127 #define SPN_PERCENT_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 3)
128 #define BRK_PERCENT_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 3)
129 #define IS_COMMA_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000010)
130 #define SPN_COMMA_CHARS(_s) spn_ag_char_map_chars((char *)_s, 4)
131 #define BRK_COMMA_CHARS(_s) brk_ag_char_map_chars((char *)_s, 4)
132 #define SPN_COMMA_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 4)
133 #define BRK_COMMA_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 4)
134 #define IS_COLON_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000020)
135 #define SPN_COLON_CHARS(_s) spn_ag_char_map_chars((char *)_s, 5)
136 #define BRK_COLON_CHARS(_s) brk_ag_char_map_chars((char *)_s, 5)
137 #define SPN_COLON_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 5)
138 #define BRK_COLON_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 5)
139 #define IS_UNDERSCORE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000040)
140 #define SPN_UNDERSCORE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 6)
141 #define BRK_UNDERSCORE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 6)
142 #define SPN_UNDERSCORE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 6)
143 #define BRK_UNDERSCORE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 6)
144 #define IS_PLUS_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000080)
145 #define SPN_PLUS_CHARS(_s) spn_ag_char_map_chars((char *)_s, 7)
146 #define BRK_PLUS_CHARS(_s) brk_ag_char_map_chars((char *)_s, 7)
147 #define SPN_PLUS_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 7)
148 #define BRK_PLUS_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 7)
149 #define IS_DOLLAR_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000100)
150 #define SPN_DOLLAR_CHARS(_s) spn_ag_char_map_chars((char *)_s, 8)
151 #define BRK_DOLLAR_CHARS(_s) brk_ag_char_map_chars((char *)_s, 8)
152 #define SPN_DOLLAR_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 8)
153 #define BRK_DOLLAR_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 8)
154 #define IS_HORIZ_WHITE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000200)
155 #define SPN_HORIZ_WHITE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 9)
156 #define BRK_HORIZ_WHITE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 9)
157 #define SPN_HORIZ_WHITE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 9)
158 #define BRK_HORIZ_WHITE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 9)
159 #define IS_ALT_WHITE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000400)
160 #define SPN_ALT_WHITE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 10)
161 #define BRK_ALT_WHITE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 10)
162 #define SPN_ALT_WHITE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 10)
163 #define BRK_ALT_WHITE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 10)
164 #define IS_WHITESPACE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000601)
165 #define SPN_WHITESPACE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 11)
166 #define BRK_WHITESPACE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 11)
167 #define SPN_WHITESPACE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 11)
168 #define BRK_WHITESPACE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 11)
169 #define IS_NON_NL_WHITE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000600)
170 #define SPN_NON_NL_WHITE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 12)
171 #define BRK_NON_NL_WHITE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 12)
172 #define SPN_NON_NL_WHITE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 12)
173 #define BRK_NON_NL_WHITE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 12)
174 #define IS_QUOTE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000800)
175 #define SPN_QUOTE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 13)
176 #define BRK_QUOTE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 13)
177 #define SPN_QUOTE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 13)
178 #define BRK_QUOTE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 13)
179 #define IS_PARENTHESES_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0001000)
180 #define SPN_PARENTHESES_CHARS(_s) spn_ag_char_map_chars((char *)_s, 14)
181 #define BRK_PARENTHESES_CHARS(_s) brk_ag_char_map_chars((char *)_s, 14)
182 #define SPN_PARENTHESES_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 14)
183 #define BRK_PARENTHESES_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 14)
184 #define IS_GRAPHIC_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0002000)
185 #define SPN_GRAPHIC_CHARS(_s) spn_ag_char_map_chars((char *)_s, 15)
186 #define BRK_GRAPHIC_CHARS(_s) brk_ag_char_map_chars((char *)_s, 15)
187 #define SPN_GRAPHIC_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 15)
188 #define BRK_GRAPHIC_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 15)
189 #define IS_INVERSION_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0004000)
190 #define SPN_INVERSION_CHARS(_s) spn_ag_char_map_chars((char *)_s, 16)
191 #define BRK_INVERSION_CHARS(_s) brk_ag_char_map_chars((char *)_s, 16)
192 #define SPN_INVERSION_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 16)
193 #define BRK_INVERSION_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 16)
194 #define IS_OCT_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0008000)
195 #define SPN_OCT_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 17)
196 #define BRK_OCT_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 17)
197 #define SPN_OCT_DIGIT_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 17)
198 #define BRK_OCT_DIGIT_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 17)
199 #define IS_DEC_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0018000)
200 #define SPN_DEC_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 18)
201 #define BRK_DEC_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 18)
202 #define SPN_DEC_DIGIT_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 18)
203 #define BRK_DEC_DIGIT_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 18)
204 #define IS_HEX_DIGIT_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0038000)
205 #define SPN_HEX_DIGIT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 19)
206 #define BRK_HEX_DIGIT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 19)
207 #define SPN_HEX_DIGIT_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 19)
208 #define BRK_HEX_DIGIT_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 19)
209 #define IS_LOWER_CASE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0040000)
210 #define SPN_LOWER_CASE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 20)
211 #define BRK_LOWER_CASE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 20)
212 #define SPN_LOWER_CASE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 20)
213 #define BRK_LOWER_CASE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 20)
214 #define IS_UPPER_CASE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0080000)
215 #define SPN_UPPER_CASE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 21)
216 #define BRK_UPPER_CASE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 21)
217 #define SPN_UPPER_CASE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 21)
218 #define BRK_UPPER_CASE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 21)
219 #define IS_ALPHABETIC_CHAR( _c) is_ag_char_map_char((char)( _c), 0x00C0000)
220 #define SPN_ALPHABETIC_CHARS(_s) spn_ag_char_map_chars((char *)_s, 22)
221 #define BRK_ALPHABETIC_CHARS(_s) brk_ag_char_map_chars((char *)_s, 22)
222 #define SPN_ALPHABETIC_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 22)
223 #define BRK_ALPHABETIC_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 22)
224 #define IS_ALPHANUMERIC_CHAR( _c) is_ag_char_map_char((char)( _c), 0x00D8000)
225 #define SPN_ALPHANUMERIC_CHARS(_s) spn_ag_char_map_chars((char *)_s, 23)
226 #define BRK_ALPHANUMERIC_CHARS(_s) brk_ag_char_map_chars((char *)_s, 23)
227 #define SPN_ALPHANUMERIC_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 23)
228 #define BRK_ALPHANUMERIC_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 23)
229 #define IS_VAR_FIRST_CHAR( _c) is_ag_char_map_char((char)( _c), 0x00C0040)
230 #define SPN_VAR_FIRST_CHARS(_s) spn_ag_char_map_chars((char *)_s, 24)
231 #define BRK_VAR_FIRST_CHARS(_s) brk_ag_char_map_chars((char *)_s, 24)
232 #define SPN_VAR_FIRST_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 24)
233 #define BRK_VAR_FIRST_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 24)
234 #define IS_VARIABLE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c), 0x00D8040)
235 #define SPN_VARIABLE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 25)
236 #define BRK_VARIABLE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 25)
237 #define SPN_VARIABLE_NAME_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 25)
238 #define BRK_VARIABLE_NAME_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 25)
239 #define IS_OPTION_NAME_CHAR( _c) is_ag_char_map_char((char)( _c), 0x01D8040)
240 #define SPN_OPTION_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 26)
241 #define BRK_OPTION_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 26)
242 #define SPN_OPTION_NAME_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 26)
243 #define BRK_OPTION_NAME_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 26)
244 #define IS_VALUE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c), 0x01D8060)
245 #define SPN_VALUE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 27)
246 #define BRK_VALUE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 27)
247 #define SPN_VALUE_NAME_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 27)
248 #define BRK_VALUE_NAME_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 27)
249 #define IS_NAME_SEP_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0200000)
250 #define SPN_NAME_SEP_CHARS(_s) spn_ag_char_map_chars((char *)_s, 28)
251 #define BRK_NAME_SEP_CHARS(_s) brk_ag_char_map_chars((char *)_s, 28)
252 #define SPN_NAME_SEP_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 28)
253 #define BRK_NAME_SEP_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 28)
254 #define IS_COMPOUND_NAME_CHAR( _c) is_ag_char_map_char((char)( _c), 0x03D8260)
255 #define SPN_COMPOUND_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 29)
256 #define BRK_COMPOUND_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 29)
257 #define SPN_COMPOUND_NAME_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 29)
258 #define BRK_COMPOUND_NAME_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 29)
259 #define IS_SCHEME_NOTE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0001800)
260 #define SPN_SCHEME_NOTE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 30)
261 #define BRK_SCHEME_NOTE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 30)
262 #define SPN_SCHEME_NOTE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 30)
263 #define BRK_SCHEME_NOTE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 30)
264 #define IS_UNQUOTABLE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0400000)
265 #define SPN_UNQUOTABLE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 31)
266 #define BRK_UNQUOTABLE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 31)
267 #define SPN_UNQUOTABLE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 31)
268 #define BRK_UNQUOTABLE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 31)
269 #define IS_END_XML_TOKEN_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0800601)
270 #define SPN_END_XML_TOKEN_CHARS(_s) spn_ag_char_map_chars((char *)_s, 32)
271 #define BRK_END_XML_TOKEN_CHARS(_s) brk_ag_char_map_chars((char *)_s, 32)
272 #define SPN_END_XML_TOKEN_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 32)
273 #define BRK_END_XML_TOKEN_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 32)
274 #define IS_PLUS_N_SPACE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000681)
275 #define SPN_PLUS_N_SPACE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 33)
276 #define BRK_PLUS_N_SPACE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 33)
277 #define SPN_PLUS_N_SPACE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 33)
278 #define BRK_PLUS_N_SPACE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 33)
279 #define IS_PUNCTUATION_CHAR( _c) is_ag_char_map_char((char)( _c), 0x1000000)
280 #define SPN_PUNCTUATION_CHARS(_s) spn_ag_char_map_chars((char *)_s, 34)
281 #define BRK_PUNCTUATION_CHARS(_s) brk_ag_char_map_chars((char *)_s, 34)
282 #define SPN_PUNCTUATION_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 34)
283 #define BRK_PUNCTUATION_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 34)
284 #define IS_SUFFIX_CHAR( _c) is_ag_char_map_char((char)( _c), 0x20D8000)
285 #define SPN_SUFFIX_CHARS(_s) spn_ag_char_map_chars((char *)_s, 35)
286 #define BRK_SUFFIX_CHARS(_s) brk_ag_char_map_chars((char *)_s, 35)
287 #define SPN_SUFFIX_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 35)
288 #define BRK_SUFFIX_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 35)
289 #define IS_SUFFIX_FMT_CHAR( _c) is_ag_char_map_char((char)( _c), 0x20D800C)
290 #define SPN_SUFFIX_FMT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 36)
291 #define BRK_SUFFIX_FMT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 36)
292 #define SPN_SUFFIX_FMT_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 36)
293 #define BRK_SUFFIX_FMT_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 36)
294 #define IS_FALSE_TYPE_CHAR( _c) is_ag_char_map_char((char)( _c), 0x4000002)
295 #define SPN_FALSE_TYPE_CHARS(_s) spn_ag_char_map_chars((char *)_s, 37)
296 #define BRK_FALSE_TYPE_CHARS(_s) brk_ag_char_map_chars((char *)_s, 37)
297 #define SPN_FALSE_TYPE_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 37)
298 #define BRK_FALSE_TYPE_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 37)
299 #define IS_FILE_NAME_CHAR( _c) is_ag_char_map_char((char)( _c), 0x20D8004)
300 #define SPN_FILE_NAME_CHARS(_s) spn_ag_char_map_chars((char *)_s, 38)
301 #define BRK_FILE_NAME_CHARS(_s) brk_ag_char_map_chars((char *)_s, 38)
302 #define SPN_FILE_NAME_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 38)
303 #define BRK_FILE_NAME_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 38)
304 #define IS_END_TOKEN_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000603)
305 #define SPN_END_TOKEN_CHARS(_s) spn_ag_char_map_chars((char *)_s, 39)
306 #define BRK_END_TOKEN_CHARS(_s) brk_ag_char_map_chars((char *)_s, 39)
307 #define SPN_END_TOKEN_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 39)
308 #define BRK_END_TOKEN_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 39)
309 #define IS_END_LIST_ENTRY_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000613)
310 #define SPN_END_LIST_ENTRY_CHARS(_s) spn_ag_char_map_chars((char *)_s, 40)
311 #define BRK_END_LIST_ENTRY_CHARS(_s) brk_ag_char_map_chars((char *)_s, 40)
312 #define SPN_END_LIST_ENTRY_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 40)
313 #define BRK_END_LIST_ENTRY_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 40)
314 #define IS_SET_SEPARATOR_CHAR( _c) is_ag_char_map_char((char)( _c), 0x8000613)
315 #define SPN_SET_SEPARATOR_CHARS(_s) spn_ag_char_map_chars((char *)_s, 41)
316 #define BRK_SET_SEPARATOR_CHARS(_s) brk_ag_char_map_chars((char *)_s, 41)
317 #define SPN_SET_SEPARATOR_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 41)
318 #define BRK_SET_SEPARATOR_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 41)
319 #define IS_SIGNED_NUMBER_CHAR( _c) is_ag_char_map_char((char)( _c), 0x001C000)
320 #define SPN_SIGNED_NUMBER_CHARS(_s) spn_ag_char_map_chars((char *)_s, 42)
321 #define BRK_SIGNED_NUMBER_CHARS(_s) brk_ag_char_map_chars((char *)_s, 42)
322 #define SPN_SIGNED_NUMBER_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 42)
323 #define BRK_SIGNED_NUMBER_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 42)
324 #define IS_MAKE_SCRIPT_CHAR( _c) is_ag_char_map_char((char)( _c), 0x0000101)
325 #define SPN_MAKE_SCRIPT_CHARS(_s) spn_ag_char_map_chars((char *)_s, 43)
326 #define BRK_MAKE_SCRIPT_CHARS(_s) brk_ag_char_map_chars((char *)_s, 43)
327 #define SPN_MAKE_SCRIPT_BACK(s,e) spn_ag_char_map_back((char *)s, (char *)e, 43)
328 #define BRK_MAKE_SCRIPT_BACK(s,e) brk_ag_char_map_back((char *)s, (char *)e, 43)
330 static ag_char_map_mask_t
const ag_char_map_table
[128] = {
331 /*NUL*/ 0x0000002, /*x01*/ 0x0000000, /*x02*/ 0x0000000, /*x03*/ 0x0000000,
332 /*x04*/ 0x0000000, /*x05*/ 0x0000000, /*x06*/ 0x0000000, /*BEL*/ 0x0000000,
333 /* BS*/ 0x0000400, /* HT*/ 0x0000200, /* NL*/ 0x0000001, /* VT*/ 0x0000400,
334 /* FF*/ 0x0000400, /* CR*/ 0x0000400, /*x0E*/ 0x0000000, /*x0F*/ 0x0000000,
335 /*x10*/ 0x0000000, /*x11*/ 0x0000000, /*x12*/ 0x0000000, /*x13*/ 0x0000000,
336 /*x14*/ 0x0000000, /*x15*/ 0x0000000, /*x16*/ 0x0000000, /*x17*/ 0x0000000,
337 /*x18*/ 0x0000000, /*x19*/ 0x0000000, /*x1A*/ 0x0000000, /*ESC*/ 0x0000000,
338 /*x1C*/ 0x0000000, /*x1D*/ 0x0000000, /*x1E*/ 0x0000000, /*x1F*/ 0x0000000,
339 /* */ 0x0000200, /* ! */ 0x1402000, /* " */ 0x1002800, /* # */ 0x1002000,
340 /* $ */ 0x1402100, /* % */ 0x1402008, /* & */ 0x1402000, /* ' */ 0x1002800,
341 /* ( */ 0x1003000, /* ) */ 0x1003000, /* * */ 0x1002000, /* + */ 0x9402080,
342 /* , */ 0x1002010, /* - */ 0x3506000, /* . */ 0x3602000, /* / */ 0x1C02004,
343 /* 0 */ 0x440A000, /* 1 */ 0x040A000, /* 2 */ 0x040A000, /* 3 */ 0x040A000,
344 /* 4 */ 0x040A000, /* 5 */ 0x040A000, /* 6 */ 0x040A000, /* 7 */ 0x040A000,
345 /* 8 */ 0x0412000, /* 9 */ 0x0412000, /* : */ 0x1402020, /* ; */ 0x1002000,
346 /* < */ 0x1002000, /* = */ 0x1002000, /* > */ 0x1802000, /* ? */ 0x1002000,
347 /* @ */ 0x1402000, /* A */ 0x04A2000, /* B */ 0x04A2000, /* C */ 0x04A2000,
348 /* D */ 0x04A2000, /* E */ 0x04A2000, /* F */ 0x44A2000, /* G */ 0x0482000,
349 /* H */ 0x0482000, /* I */ 0x0482000, /* J */ 0x0482000, /* K */ 0x0482000,
350 /* L */ 0x0482000, /* M */ 0x0482000, /* N */ 0x4482000, /* O */ 0x0482000,
351 /* P */ 0x0482000, /* Q */ 0x0482000, /* R */ 0x0482000, /* S */ 0x0482000,
352 /* T */ 0x0482000, /* U */ 0x0482000, /* V */ 0x0482000, /* W */ 0x0482000,
353 /* X */ 0x0482000, /* Y */ 0x0482000, /* Z */ 0x0482000, /* [ */ 0x1202000,
354 /* \ */ 0x1002004, /* ] */ 0x1202000, /* ^ */ 0x1502000, /* _ */ 0x2402040,
355 /* ` */ 0x1002000, /* a */ 0x0462000, /* b */ 0x0462000, /* c */ 0x0462000,
356 /* d */ 0x0462000, /* e */ 0x0462000, /* f */ 0x4462000, /* g */ 0x0442000,
357 /* h */ 0x0442000, /* i */ 0x0442000, /* j */ 0x0442000, /* k */ 0x0442000,
358 /* l */ 0x0442000, /* m */ 0x0442000, /* n */ 0x4442000, /* o */ 0x0442000,
359 /* p */ 0x0442000, /* q */ 0x0442000, /* r */ 0x0442000, /* s */ 0x0442000,
360 /* t */ 0x0442000, /* u */ 0x0442000, /* v */ 0x0442000, /* w */ 0x0442000,
361 /* x */ 0x0442000, /* y */ 0x0442000, /* z */ 0x0442000, /* { */ 0x1002000,
362 /* | */ 0x9402000, /* } */ 0x1002000, /* ~ */ 0x1406000, /*x7F*/ 0x0000000
368 static unsigned char const * ag_char_map_spanners
[44];
370 * Character category masks. Some categories may have multiple bits,
371 * if their definition incorporates other character categories.
372 * This mask array is only used by calc_ag_char_map_spanners().
374 static ag_char_map_mask_t
const ag_char_map_masks
[44] = {
375 0x0000001, /* NEWLINE */
376 0x0000002, /* NUL_BYTE */
377 0x0000004, /* DIR_SEP */
378 0x0000008, /* PERCENT */
379 0x0000010, /* COMMA */
380 0x0000020, /* COLON */
381 0x0000040, /* UNDERSCORE */
382 0x0000080, /* PLUS */
383 0x0000100, /* DOLLAR */
384 0x0000200, /* HORIZ_WHITE */
385 0x0000400, /* ALT_WHITE */
386 0x0000601, /* WHITESPACE */
387 0x0000600, /* NON_NL_WHITE */
388 0x0000800, /* QUOTE */
389 0x0001000, /* PARENTHESES */
390 0x0002000, /* GRAPHIC */
391 0x0004000, /* INVERSION */
392 0x0008000, /* OCT_DIGIT */
393 0x0018000, /* DEC_DIGIT */
394 0x0038000, /* HEX_DIGIT */
395 0x0040000, /* LOWER_CASE */
396 0x0080000, /* UPPER_CASE */
397 0x00C0000, /* ALPHABETIC */
398 0x00D8000, /* ALPHANUMERIC */
399 0x00C0040, /* VAR_FIRST */
400 0x00D8040, /* VARIABLE_NAME */
401 0x01D8040, /* OPTION_NAME */
402 0x01D8060, /* VALUE_NAME */
403 0x0200000, /* NAME_SEP */
404 0x03D8260, /* COMPOUND_NAME */
405 0x0001800, /* SCHEME_NOTE */
406 0x0400000, /* UNQUOTABLE */
407 0x0800601, /* END_XML_TOKEN */
408 0x0000681, /* PLUS_N_SPACE */
409 0x1000000, /* PUNCTUATION */
410 0x20D8000, /* SUFFIX */
411 0x20D800C, /* SUFFIX_FMT */
412 0x4000002, /* FALSE_TYPE */
413 0x20D8004, /* FILE_NAME */
414 0x0000603, /* END_TOKEN */
415 0x0000613, /* END_LIST_ENTRY */
416 0x8000613, /* SET_SEPARATOR */
417 0x001C000, /* SIGNED_NUMBER */
418 0x0000101, /* MAKE_SCRIPT */
421 #define lock_ag_char_map_spanners()
422 #define unlock_ag_char_map_spanners()
424 static unsigned char const *
425 calc_ag_char_map_spanners(unsigned int mask_ix
)
427 lock_ag_char_map_spanners();
428 if (ag_char_map_spanners
[mask_ix
] == NULL
) {
430 ag_char_map_mask_t mask
= ag_char_map_masks
[mask_ix
];
431 unsigned char * res
= malloc(256 /* 1 << NBBY */);
433 for (; ix
< 128; ix
++)
434 if (ag_char_map_table
[ix
] & mask
)
436 ag_char_map_spanners
[mask_ix
] = res
;
438 unlock_ag_char_map_spanners();
439 return ag_char_map_spanners
[mask_ix
];
441 #define ag_char_map_masks POISONED_ag_char_map_masks
444 is_ag_char_map_char(char ch
, ag_char_map_mask_t mask
)
446 unsigned int ix
= (unsigned char)ch
;
447 return ((ix
< 128) && ((ag_char_map_table
[ix
] & mask
) != 0));
451 spn_ag_char_map_chars(char * p
, unsigned int mask_ix
)
453 unsigned char const * v
= ag_char_map_spanners
[mask_ix
];
455 v
= calc_ag_char_map_spanners(mask_ix
);
456 while (v
[(unsigned)*p
]) p
++;
461 brk_ag_char_map_chars(char * p
, unsigned int mask_ix
)
463 unsigned char const * v
= ag_char_map_spanners
[mask_ix
];
465 v
= calc_ag_char_map_spanners(mask_ix
);
466 while ((*p
!= '\0') && (! v
[(unsigned)*p
])) p
++;
471 spn_ag_char_map_back(char * s
, char * e
, unsigned int mask_ix
)
473 unsigned char const * v
= ag_char_map_spanners
[mask_ix
];
475 v
= calc_ag_char_map_spanners(mask_ix
);
476 if (s
>= e
) e
= s
+ strlen(s
);
477 while ((e
> s
) && v
[(unsigned)e
[-1]]) e
--;
482 brk_ag_char_map_back(char * s
, char * e
, unsigned int mask_ix
)
484 unsigned char const * v
= ag_char_map_spanners
[mask_ix
];
486 v
= calc_ag_char_map_spanners(mask_ix
);
487 if (s
== e
) e
+= strlen(e
);
488 while ((e
> s
) && (! v
[(unsigned)e
[-1]])) e
--;
491 #endif /* AG_CHAR_MAP_H_GUARD */