1 /* Properties of Unicode characters.
2 Copyright (C) 2007, 2011-2021 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2007.
5 This program is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Lesser General Public License as published
7 by the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
26 /* Indices stored in the 'struct named_category' elements of the perfect hash
27 table. We don't use uc_general_category_t values or their addresses
28 directly, because this would introduce load-time relocations. */
32 UC_PROPERTY_INDEX_WHITE_SPACE
,
33 UC_PROPERTY_INDEX_ALPHABETIC
,
34 UC_PROPERTY_INDEX_OTHER_ALPHABETIC
,
35 UC_PROPERTY_INDEX_NOT_A_CHARACTER
,
36 UC_PROPERTY_INDEX_DEFAULT_IGNORABLE_CODE_POINT
,
37 UC_PROPERTY_INDEX_OTHER_DEFAULT_IGNORABLE_CODE_POINT
,
38 UC_PROPERTY_INDEX_DEPRECATED
,
39 UC_PROPERTY_INDEX_LOGICAL_ORDER_EXCEPTION
,
40 UC_PROPERTY_INDEX_VARIATION_SELECTOR
,
41 UC_PROPERTY_INDEX_PRIVATE_USE
,
42 UC_PROPERTY_INDEX_UNASSIGNED_CODE_VALUE
,
44 UC_PROPERTY_INDEX_UPPERCASE
,
45 UC_PROPERTY_INDEX_OTHER_UPPERCASE
,
46 UC_PROPERTY_INDEX_LOWERCASE
,
47 UC_PROPERTY_INDEX_OTHER_LOWERCASE
,
48 UC_PROPERTY_INDEX_TITLECASE
,
49 UC_PROPERTY_INDEX_CASED
,
50 UC_PROPERTY_INDEX_CASE_IGNORABLE
,
51 UC_PROPERTY_INDEX_CHANGES_WHEN_LOWERCASED
,
52 UC_PROPERTY_INDEX_CHANGES_WHEN_UPPERCASED
,
53 UC_PROPERTY_INDEX_CHANGES_WHEN_TITLECASED
,
54 UC_PROPERTY_INDEX_CHANGES_WHEN_CASEFOLDED
,
55 UC_PROPERTY_INDEX_CHANGES_WHEN_CASEMAPPED
,
56 UC_PROPERTY_INDEX_SOFT_DOTTED
,
58 UC_PROPERTY_INDEX_ID_START
,
59 UC_PROPERTY_INDEX_OTHER_ID_START
,
60 UC_PROPERTY_INDEX_ID_CONTINUE
,
61 UC_PROPERTY_INDEX_OTHER_ID_CONTINUE
,
62 UC_PROPERTY_INDEX_XID_START
,
63 UC_PROPERTY_INDEX_XID_CONTINUE
,
64 UC_PROPERTY_INDEX_PATTERN_WHITE_SPACE
,
65 UC_PROPERTY_INDEX_PATTERN_SYNTAX
,
66 /* Shaping and rendering. */
67 UC_PROPERTY_INDEX_JOIN_CONTROL
,
68 UC_PROPERTY_INDEX_GRAPHEME_BASE
,
69 UC_PROPERTY_INDEX_GRAPHEME_EXTEND
,
70 UC_PROPERTY_INDEX_OTHER_GRAPHEME_EXTEND
,
71 UC_PROPERTY_INDEX_GRAPHEME_LINK
,
73 UC_PROPERTY_INDEX_BIDI_CONTROL
,
74 UC_PROPERTY_INDEX_BIDI_LEFT_TO_RIGHT
,
75 UC_PROPERTY_INDEX_BIDI_HEBREW_RIGHT_TO_LEFT
,
76 UC_PROPERTY_INDEX_BIDI_ARABIC_RIGHT_TO_LEFT
,
77 UC_PROPERTY_INDEX_BIDI_EUROPEAN_DIGIT
,
78 UC_PROPERTY_INDEX_BIDI_EUR_NUM_SEPARATOR
,
79 UC_PROPERTY_INDEX_BIDI_EUR_NUM_TERMINATOR
,
80 UC_PROPERTY_INDEX_BIDI_ARABIC_DIGIT
,
81 UC_PROPERTY_INDEX_BIDI_COMMON_SEPARATOR
,
82 UC_PROPERTY_INDEX_BIDI_BLOCK_SEPARATOR
,
83 UC_PROPERTY_INDEX_BIDI_SEGMENT_SEPARATOR
,
84 UC_PROPERTY_INDEX_BIDI_WHITESPACE
,
85 UC_PROPERTY_INDEX_BIDI_NON_SPACING_MARK
,
86 UC_PROPERTY_INDEX_BIDI_BOUNDARY_NEUTRAL
,
87 UC_PROPERTY_INDEX_BIDI_PDF
,
88 UC_PROPERTY_INDEX_BIDI_EMBEDDING_OR_OVERRIDE
,
89 UC_PROPERTY_INDEX_BIDI_OTHER_NEUTRAL
,
91 UC_PROPERTY_INDEX_HEX_DIGIT
,
92 UC_PROPERTY_INDEX_ASCII_HEX_DIGIT
,
94 UC_PROPERTY_INDEX_IDEOGRAPHIC
,
95 UC_PROPERTY_INDEX_UNIFIED_IDEOGRAPH
,
96 UC_PROPERTY_INDEX_RADICAL
,
97 UC_PROPERTY_INDEX_IDS_BINARY_OPERATOR
,
98 UC_PROPERTY_INDEX_IDS_TRINARY_OPERATOR
,
100 UC_PROPERTY_INDEX_ZERO_WIDTH
,
101 UC_PROPERTY_INDEX_SPACE
,
102 UC_PROPERTY_INDEX_NON_BREAK
,
103 UC_PROPERTY_INDEX_ISO_CONTROL
,
104 UC_PROPERTY_INDEX_FORMAT_CONTROL
,
105 UC_PROPERTY_INDEX_DASH
,
106 UC_PROPERTY_INDEX_HYPHEN
,
107 UC_PROPERTY_INDEX_PUNCTUATION
,
108 UC_PROPERTY_INDEX_LINE_SEPARATOR
,
109 UC_PROPERTY_INDEX_PARAGRAPH_SEPARATOR
,
110 UC_PROPERTY_INDEX_QUOTATION_MARK
,
111 UC_PROPERTY_INDEX_SENTENCE_TERMINAL
,
112 UC_PROPERTY_INDEX_TERMINAL_PUNCTUATION
,
113 UC_PROPERTY_INDEX_CURRENCY_SYMBOL
,
114 UC_PROPERTY_INDEX_MATH
,
115 UC_PROPERTY_INDEX_OTHER_MATH
,
116 UC_PROPERTY_INDEX_PAIRED_PUNCTUATION
,
117 UC_PROPERTY_INDEX_LEFT_OF_PAIR
,
118 UC_PROPERTY_INDEX_COMBINING
,
119 UC_PROPERTY_INDEX_COMPOSITE
,
120 UC_PROPERTY_INDEX_DECIMAL_DIGIT
,
121 UC_PROPERTY_INDEX_NUMERIC
,
122 UC_PROPERTY_INDEX_DIACRITIC
,
123 UC_PROPERTY_INDEX_EXTENDER
,
124 UC_PROPERTY_INDEX_IGNORABLE_CONTROL
127 /* Get gperf generated lookup function. */
128 #include "unictype/pr_byname.h"
130 static const uc_property_t UC_PROPERTY_NONE
= { NULL
};
133 uc_property_byname (const char *property_name
)
135 char buf
[MAX_WORD_LENGTH
+ 1];
139 const struct named_property
*found
;
141 for (cp
= property_name
, bp
= buf
, count
= MAX_WORD_LENGTH
+ 1; ; cp
++, bp
++)
143 unsigned char c
= (unsigned char) *cp
;
146 if (c
>= 'A' && c
<= 'Z')
148 else if (c
== ' ' || c
== '-')
156 found
= uc_property_lookup (buf
, bp
- buf
);
158 /* Use a 'switch' statement here, because a table would introduce load-time
160 switch (found
->property_index
)
162 case UC_PROPERTY_INDEX_WHITE_SPACE
:
163 return UC_PROPERTY_WHITE_SPACE
;
164 case UC_PROPERTY_INDEX_ALPHABETIC
:
165 return UC_PROPERTY_ALPHABETIC
;
166 case UC_PROPERTY_INDEX_OTHER_ALPHABETIC
:
167 return UC_PROPERTY_OTHER_ALPHABETIC
;
168 case UC_PROPERTY_INDEX_NOT_A_CHARACTER
:
169 return UC_PROPERTY_NOT_A_CHARACTER
;
170 case UC_PROPERTY_INDEX_DEFAULT_IGNORABLE_CODE_POINT
:
171 return UC_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT
;
172 case UC_PROPERTY_INDEX_OTHER_DEFAULT_IGNORABLE_CODE_POINT
:
173 return UC_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT
;
174 case UC_PROPERTY_INDEX_DEPRECATED
:
175 return UC_PROPERTY_DEPRECATED
;
176 case UC_PROPERTY_INDEX_LOGICAL_ORDER_EXCEPTION
:
177 return UC_PROPERTY_LOGICAL_ORDER_EXCEPTION
;
178 case UC_PROPERTY_INDEX_VARIATION_SELECTOR
:
179 return UC_PROPERTY_VARIATION_SELECTOR
;
180 case UC_PROPERTY_INDEX_PRIVATE_USE
:
181 return UC_PROPERTY_PRIVATE_USE
;
182 case UC_PROPERTY_INDEX_UNASSIGNED_CODE_VALUE
:
183 return UC_PROPERTY_UNASSIGNED_CODE_VALUE
;
184 case UC_PROPERTY_INDEX_UPPERCASE
:
185 return UC_PROPERTY_UPPERCASE
;
186 case UC_PROPERTY_INDEX_OTHER_UPPERCASE
:
187 return UC_PROPERTY_OTHER_UPPERCASE
;
188 case UC_PROPERTY_INDEX_LOWERCASE
:
189 return UC_PROPERTY_LOWERCASE
;
190 case UC_PROPERTY_INDEX_OTHER_LOWERCASE
:
191 return UC_PROPERTY_OTHER_LOWERCASE
;
192 case UC_PROPERTY_INDEX_TITLECASE
:
193 return UC_PROPERTY_TITLECASE
;
194 case UC_PROPERTY_INDEX_CASED
:
195 return UC_PROPERTY_CASED
;
196 case UC_PROPERTY_INDEX_CASE_IGNORABLE
:
197 return UC_PROPERTY_CASE_IGNORABLE
;
198 case UC_PROPERTY_INDEX_CHANGES_WHEN_LOWERCASED
:
199 return UC_PROPERTY_CHANGES_WHEN_LOWERCASED
;
200 case UC_PROPERTY_INDEX_CHANGES_WHEN_UPPERCASED
:
201 return UC_PROPERTY_CHANGES_WHEN_UPPERCASED
;
202 case UC_PROPERTY_INDEX_CHANGES_WHEN_TITLECASED
:
203 return UC_PROPERTY_CHANGES_WHEN_TITLECASED
;
204 case UC_PROPERTY_INDEX_CHANGES_WHEN_CASEFOLDED
:
205 return UC_PROPERTY_CHANGES_WHEN_CASEFOLDED
;
206 case UC_PROPERTY_INDEX_CHANGES_WHEN_CASEMAPPED
:
207 return UC_PROPERTY_CHANGES_WHEN_CASEMAPPED
;
208 case UC_PROPERTY_INDEX_SOFT_DOTTED
:
209 return UC_PROPERTY_SOFT_DOTTED
;
210 case UC_PROPERTY_INDEX_ID_START
:
211 return UC_PROPERTY_ID_START
;
212 case UC_PROPERTY_INDEX_OTHER_ID_START
:
213 return UC_PROPERTY_OTHER_ID_START
;
214 case UC_PROPERTY_INDEX_ID_CONTINUE
:
215 return UC_PROPERTY_ID_CONTINUE
;
216 case UC_PROPERTY_INDEX_OTHER_ID_CONTINUE
:
217 return UC_PROPERTY_OTHER_ID_CONTINUE
;
218 case UC_PROPERTY_INDEX_XID_START
:
219 return UC_PROPERTY_XID_START
;
220 case UC_PROPERTY_INDEX_XID_CONTINUE
:
221 return UC_PROPERTY_XID_CONTINUE
;
222 case UC_PROPERTY_INDEX_PATTERN_WHITE_SPACE
:
223 return UC_PROPERTY_PATTERN_WHITE_SPACE
;
224 case UC_PROPERTY_INDEX_PATTERN_SYNTAX
:
225 return UC_PROPERTY_PATTERN_SYNTAX
;
226 case UC_PROPERTY_INDEX_JOIN_CONTROL
:
227 return UC_PROPERTY_JOIN_CONTROL
;
228 case UC_PROPERTY_INDEX_GRAPHEME_BASE
:
229 return UC_PROPERTY_GRAPHEME_BASE
;
230 case UC_PROPERTY_INDEX_GRAPHEME_EXTEND
:
231 return UC_PROPERTY_GRAPHEME_EXTEND
;
232 case UC_PROPERTY_INDEX_OTHER_GRAPHEME_EXTEND
:
233 return UC_PROPERTY_OTHER_GRAPHEME_EXTEND
;
234 case UC_PROPERTY_INDEX_GRAPHEME_LINK
:
235 return UC_PROPERTY_GRAPHEME_LINK
;
236 case UC_PROPERTY_INDEX_BIDI_CONTROL
:
237 return UC_PROPERTY_BIDI_CONTROL
;
238 case UC_PROPERTY_INDEX_BIDI_LEFT_TO_RIGHT
:
239 return UC_PROPERTY_BIDI_LEFT_TO_RIGHT
;
240 case UC_PROPERTY_INDEX_BIDI_HEBREW_RIGHT_TO_LEFT
:
241 return UC_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT
;
242 case UC_PROPERTY_INDEX_BIDI_ARABIC_RIGHT_TO_LEFT
:
243 return UC_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT
;
244 case UC_PROPERTY_INDEX_BIDI_EUROPEAN_DIGIT
:
245 return UC_PROPERTY_BIDI_EUROPEAN_DIGIT
;
246 case UC_PROPERTY_INDEX_BIDI_EUR_NUM_SEPARATOR
:
247 return UC_PROPERTY_BIDI_EUR_NUM_SEPARATOR
;
248 case UC_PROPERTY_INDEX_BIDI_EUR_NUM_TERMINATOR
:
249 return UC_PROPERTY_BIDI_EUR_NUM_TERMINATOR
;
250 case UC_PROPERTY_INDEX_BIDI_ARABIC_DIGIT
:
251 return UC_PROPERTY_BIDI_ARABIC_DIGIT
;
252 case UC_PROPERTY_INDEX_BIDI_COMMON_SEPARATOR
:
253 return UC_PROPERTY_BIDI_COMMON_SEPARATOR
;
254 case UC_PROPERTY_INDEX_BIDI_BLOCK_SEPARATOR
:
255 return UC_PROPERTY_BIDI_BLOCK_SEPARATOR
;
256 case UC_PROPERTY_INDEX_BIDI_SEGMENT_SEPARATOR
:
257 return UC_PROPERTY_BIDI_SEGMENT_SEPARATOR
;
258 case UC_PROPERTY_INDEX_BIDI_WHITESPACE
:
259 return UC_PROPERTY_BIDI_WHITESPACE
;
260 case UC_PROPERTY_INDEX_BIDI_NON_SPACING_MARK
:
261 return UC_PROPERTY_BIDI_NON_SPACING_MARK
;
262 case UC_PROPERTY_INDEX_BIDI_BOUNDARY_NEUTRAL
:
263 return UC_PROPERTY_BIDI_BOUNDARY_NEUTRAL
;
264 case UC_PROPERTY_INDEX_BIDI_PDF
:
265 return UC_PROPERTY_BIDI_PDF
;
266 case UC_PROPERTY_INDEX_BIDI_EMBEDDING_OR_OVERRIDE
:
267 return UC_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE
;
268 case UC_PROPERTY_INDEX_BIDI_OTHER_NEUTRAL
:
269 return UC_PROPERTY_BIDI_OTHER_NEUTRAL
;
270 case UC_PROPERTY_INDEX_HEX_DIGIT
:
271 return UC_PROPERTY_HEX_DIGIT
;
272 case UC_PROPERTY_INDEX_ASCII_HEX_DIGIT
:
273 return UC_PROPERTY_ASCII_HEX_DIGIT
;
274 case UC_PROPERTY_INDEX_IDEOGRAPHIC
:
275 return UC_PROPERTY_IDEOGRAPHIC
;
276 case UC_PROPERTY_INDEX_UNIFIED_IDEOGRAPH
:
277 return UC_PROPERTY_UNIFIED_IDEOGRAPH
;
278 case UC_PROPERTY_INDEX_RADICAL
:
279 return UC_PROPERTY_RADICAL
;
280 case UC_PROPERTY_INDEX_IDS_BINARY_OPERATOR
:
281 return UC_PROPERTY_IDS_BINARY_OPERATOR
;
282 case UC_PROPERTY_INDEX_IDS_TRINARY_OPERATOR
:
283 return UC_PROPERTY_IDS_TRINARY_OPERATOR
;
284 case UC_PROPERTY_INDEX_ZERO_WIDTH
:
285 return UC_PROPERTY_ZERO_WIDTH
;
286 case UC_PROPERTY_INDEX_SPACE
:
287 return UC_PROPERTY_SPACE
;
288 case UC_PROPERTY_INDEX_NON_BREAK
:
289 return UC_PROPERTY_NON_BREAK
;
290 case UC_PROPERTY_INDEX_ISO_CONTROL
:
291 return UC_PROPERTY_ISO_CONTROL
;
292 case UC_PROPERTY_INDEX_FORMAT_CONTROL
:
293 return UC_PROPERTY_FORMAT_CONTROL
;
294 case UC_PROPERTY_INDEX_DASH
:
295 return UC_PROPERTY_DASH
;
296 case UC_PROPERTY_INDEX_HYPHEN
:
297 return UC_PROPERTY_HYPHEN
;
298 case UC_PROPERTY_INDEX_PUNCTUATION
:
299 return UC_PROPERTY_PUNCTUATION
;
300 case UC_PROPERTY_INDEX_LINE_SEPARATOR
:
301 return UC_PROPERTY_LINE_SEPARATOR
;
302 case UC_PROPERTY_INDEX_PARAGRAPH_SEPARATOR
:
303 return UC_PROPERTY_PARAGRAPH_SEPARATOR
;
304 case UC_PROPERTY_INDEX_QUOTATION_MARK
:
305 return UC_PROPERTY_QUOTATION_MARK
;
306 case UC_PROPERTY_INDEX_SENTENCE_TERMINAL
:
307 return UC_PROPERTY_SENTENCE_TERMINAL
;
308 case UC_PROPERTY_INDEX_TERMINAL_PUNCTUATION
:
309 return UC_PROPERTY_TERMINAL_PUNCTUATION
;
310 case UC_PROPERTY_INDEX_CURRENCY_SYMBOL
:
311 return UC_PROPERTY_CURRENCY_SYMBOL
;
312 case UC_PROPERTY_INDEX_MATH
:
313 return UC_PROPERTY_MATH
;
314 case UC_PROPERTY_INDEX_OTHER_MATH
:
315 return UC_PROPERTY_OTHER_MATH
;
316 case UC_PROPERTY_INDEX_PAIRED_PUNCTUATION
:
317 return UC_PROPERTY_PAIRED_PUNCTUATION
;
318 case UC_PROPERTY_INDEX_LEFT_OF_PAIR
:
319 return UC_PROPERTY_LEFT_OF_PAIR
;
320 case UC_PROPERTY_INDEX_COMBINING
:
321 return UC_PROPERTY_COMBINING
;
322 case UC_PROPERTY_INDEX_COMPOSITE
:
323 return UC_PROPERTY_COMPOSITE
;
324 case UC_PROPERTY_INDEX_DECIMAL_DIGIT
:
325 return UC_PROPERTY_DECIMAL_DIGIT
;
326 case UC_PROPERTY_INDEX_NUMERIC
:
327 return UC_PROPERTY_NUMERIC
;
328 case UC_PROPERTY_INDEX_DIACRITIC
:
329 return UC_PROPERTY_DIACRITIC
;
330 case UC_PROPERTY_INDEX_EXTENDER
:
331 return UC_PROPERTY_EXTENDER
;
332 case UC_PROPERTY_INDEX_IGNORABLE_CONTROL
:
333 return UC_PROPERTY_IGNORABLE_CONTROL
;
338 return UC_PROPERTY_NONE
;