1 /* Unicode character classification and properties.
2 Copyright (C) 2002, 2005-2011 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
32 /* ========================================================================= */
34 /* Field 1 of Unicode Character Database: Character name.
37 /* ========================================================================= */
39 /* Field 2 of Unicode Character Database: General category. */
41 /* Data type denoting a General category value. This is not just a bitmask,
42 but rather a bitmask and a pointer to the lookup table, so that programs
43 that use only the predefined bitmasks (i.e. don't combine bitmasks with &
44 and |) don't have a link-time dependency towards the big general table. */
47 uint32_t bitmask : 31;
48 /*bool*/ unsigned int generic : 1;
51 const void *table; /* when generic is 0 */
52 bool (*lookup_fn) (ucs4_t uc, uint32_t bitmask); /* when generic is 1 */
55 uc_general_category_t;
57 /* Bits and bit masks denoting General category values. UnicodeData-3.2.0.html
58 says a 32-bit integer will always suffice to represent them.
59 These bit masks can only be used with the uc_is_general_category_withtable
63 UC_CATEGORY_MASK_L = 0x0000001f,
64 UC_CATEGORY_MASK_Lu = 0x00000001,
65 UC_CATEGORY_MASK_Ll = 0x00000002,
66 UC_CATEGORY_MASK_Lt = 0x00000004,
67 UC_CATEGORY_MASK_Lm = 0x00000008,
68 UC_CATEGORY_MASK_Lo = 0x00000010,
69 UC_CATEGORY_MASK_M = 0x000000e0,
70 UC_CATEGORY_MASK_Mn = 0x00000020,
71 UC_CATEGORY_MASK_Mc = 0x00000040,
72 UC_CATEGORY_MASK_Me = 0x00000080,
73 UC_CATEGORY_MASK_N = 0x00000700,
74 UC_CATEGORY_MASK_Nd = 0x00000100,
75 UC_CATEGORY_MASK_Nl = 0x00000200,
76 UC_CATEGORY_MASK_No = 0x00000400,
77 UC_CATEGORY_MASK_P = 0x0003f800,
78 UC_CATEGORY_MASK_Pc = 0x00000800,
79 UC_CATEGORY_MASK_Pd = 0x00001000,
80 UC_CATEGORY_MASK_Ps = 0x00002000,
81 UC_CATEGORY_MASK_Pe = 0x00004000,
82 UC_CATEGORY_MASK_Pi = 0x00008000,
83 UC_CATEGORY_MASK_Pf = 0x00010000,
84 UC_CATEGORY_MASK_Po = 0x00020000,
85 UC_CATEGORY_MASK_S = 0x003c0000,
86 UC_CATEGORY_MASK_Sm = 0x00040000,
87 UC_CATEGORY_MASK_Sc = 0x00080000,
88 UC_CATEGORY_MASK_Sk = 0x00100000,
89 UC_CATEGORY_MASK_So = 0x00200000,
90 UC_CATEGORY_MASK_Z = 0x01c00000,
91 UC_CATEGORY_MASK_Zs = 0x00400000,
92 UC_CATEGORY_MASK_Zl = 0x00800000,
93 UC_CATEGORY_MASK_Zp = 0x01000000,
94 UC_CATEGORY_MASK_C = 0x3e000000,
95 UC_CATEGORY_MASK_Cc = 0x02000000,
96 UC_CATEGORY_MASK_Cf = 0x04000000,
97 UC_CATEGORY_MASK_Cs = 0x08000000,
98 UC_CATEGORY_MASK_Co = 0x10000000,
99 UC_CATEGORY_MASK_Cn = 0x20000000
102 /* Predefined General category values. */
103 extern const uc_general_category_t UC_CATEGORY_L;
104 extern const uc_general_category_t UC_CATEGORY_Lu;
105 extern const uc_general_category_t UC_CATEGORY_Ll;
106 extern const uc_general_category_t UC_CATEGORY_Lt;
107 extern const uc_general_category_t UC_CATEGORY_Lm;
108 extern const uc_general_category_t UC_CATEGORY_Lo;
109 extern const uc_general_category_t UC_CATEGORY_M;
110 extern const uc_general_category_t UC_CATEGORY_Mn;
111 extern const uc_general_category_t UC_CATEGORY_Mc;
112 extern const uc_general_category_t UC_CATEGORY_Me;
113 extern const uc_general_category_t UC_CATEGORY_N;
114 extern const uc_general_category_t UC_CATEGORY_Nd;
115 extern const uc_general_category_t UC_CATEGORY_Nl;
116 extern const uc_general_category_t UC_CATEGORY_No;
117 extern const uc_general_category_t UC_CATEGORY_P;
118 extern const uc_general_category_t UC_CATEGORY_Pc;
119 extern const uc_general_category_t UC_CATEGORY_Pd;
120 extern const uc_general_category_t UC_CATEGORY_Ps;
121 extern const uc_general_category_t UC_CATEGORY_Pe;
122 extern const uc_general_category_t UC_CATEGORY_Pi;
123 extern const uc_general_category_t UC_CATEGORY_Pf;
124 extern const uc_general_category_t UC_CATEGORY_Po;
125 extern const uc_general_category_t UC_CATEGORY_S;
126 extern const uc_general_category_t UC_CATEGORY_Sm;
127 extern const uc_general_category_t UC_CATEGORY_Sc;
128 extern const uc_general_category_t UC_CATEGORY_Sk;
129 extern const uc_general_category_t UC_CATEGORY_So;
130 extern const uc_general_category_t UC_CATEGORY_Z;
131 extern const uc_general_category_t UC_CATEGORY_Zs;
132 extern const uc_general_category_t UC_CATEGORY_Zl;
133 extern const uc_general_category_t UC_CATEGORY_Zp;
134 extern const uc_general_category_t UC_CATEGORY_C;
135 extern const uc_general_category_t UC_CATEGORY_Cc;
136 extern const uc_general_category_t UC_CATEGORY_Cf;
137 extern const uc_general_category_t UC_CATEGORY_Cs;
138 extern const uc_general_category_t UC_CATEGORY_Co;
139 extern const uc_general_category_t UC_CATEGORY_Cn;
141 extern const uc_general_category_t _UC_CATEGORY_NONE;
143 /* Alias names for predefined General category values. */
144 #define UC_LETTER UC_CATEGORY_L
145 #define UC_UPPERCASE_LETTER UC_CATEGORY_Lu
146 #define UC_LOWERCASE_LETTER UC_CATEGORY_Ll
147 #define UC_TITLECASE_LETTER UC_CATEGORY_Lt
148 #define UC_MODIFIER_LETTER UC_CATEGORY_Lm
149 #define UC_OTHER_LETTER UC_CATEGORY_Lo
150 #define UC_MARK UC_CATEGORY_M
151 #define UC_NON_SPACING_MARK UC_CATEGORY_Mn
152 #define UC_COMBINING_SPACING_MARK UC_CATEGORY_Mc
153 #define UC_ENCLOSING_MARK UC_CATEGORY_Me
154 #define UC_NUMBER UC_CATEGORY_N
155 #define UC_DECIMAL_DIGIT_NUMBER UC_CATEGORY_Nd
156 #define UC_LETTER_NUMBER UC_CATEGORY_Nl
157 #define UC_OTHER_NUMBER UC_CATEGORY_No
158 #define UC_PUNCTUATION UC_CATEGORY_P
159 #define UC_CONNECTOR_PUNCTUATION UC_CATEGORY_Pc
160 #define UC_DASH_PUNCTUATION UC_CATEGORY_Pd
161 #define UC_OPEN_PUNCTUATION UC_CATEGORY_Ps /* a.k.a. UC_START_PUNCTUATION */
162 #define UC_CLOSE_PUNCTUATION UC_CATEGORY_Pe /* a.k.a. UC_END_PUNCTUATION */
163 #define UC_INITIAL_QUOTE_PUNCTUATION UC_CATEGORY_Pi
164 #define UC_FINAL_QUOTE_PUNCTUATION UC_CATEGORY_Pf
165 #define UC_OTHER_PUNCTUATION UC_CATEGORY_Po
166 #define UC_SYMBOL UC_CATEGORY_S
167 #define UC_MATH_SYMBOL UC_CATEGORY_Sm
168 #define UC_CURRENCY_SYMBOL UC_CATEGORY_Sc
169 #define UC_MODIFIER_SYMBOL UC_CATEGORY_Sk
170 #define UC_OTHER_SYMBOL UC_CATEGORY_So
171 #define UC_SEPARATOR UC_CATEGORY_Z
172 #define UC_SPACE_SEPARATOR UC_CATEGORY_Zs
173 #define UC_LINE_SEPARATOR UC_CATEGORY_Zl
174 #define UC_PARAGRAPH_SEPARATOR UC_CATEGORY_Zp
175 #define UC_OTHER UC_CATEGORY_C
176 #define UC_CONTROL UC_CATEGORY_Cc
177 #define UC_FORMAT UC_CATEGORY_Cf
178 #define UC_SURROGATE UC_CATEGORY_Cs /* all of them are invalid characters */
179 #define UC_PRIVATE_USE UC_CATEGORY_Co
180 #define UC_UNASSIGNED UC_CATEGORY_Cn /* some of them are invalid characters */
182 /* Return the union of two general categories.
183 This corresponds to the unions of the two sets of characters. */
184 extern uc_general_category_t
185 uc_general_category_or (uc_general_category_t category1,
186 uc_general_category_t category2);
188 /* Return the intersection of two general categories as bit masks.
189 This *does*not* correspond to the intersection of the two sets of
191 extern uc_general_category_t
192 uc_general_category_and (uc_general_category_t category1,
193 uc_general_category_t category2);
195 /* Return the intersection of a general category with the complement of a
196 second general category, as bit masks.
197 This *does*not* correspond to the intersection with complement, when
198 viewing the categories as sets of characters. */
199 extern uc_general_category_t
200 uc_general_category_and_not (uc_general_category_t category1,
201 uc_general_category_t category2);
203 /* Return the name of a general category. */
205 uc_general_category_name (uc_general_category_t category);
207 /* Return the general category given by name, e.g. "Lu". */
208 extern uc_general_category_t
209 uc_general_category_byname (const char *category_name);
211 /* Return the general category of a Unicode character. */
212 extern uc_general_category_t
213 uc_general_category (ucs4_t uc);
215 /* Test whether a Unicode character belongs to a given category.
216 The CATEGORY argument can be the combination of several predefined
217 general categories. */
219 uc_is_general_category (ucs4_t uc, uc_general_category_t category);
220 /* Likewise. This function uses a big table comprising all categories. */
222 uc_is_general_category_withtable (ucs4_t uc, uint32_t bitmask);
224 /* ========================================================================= */
226 /* Field 3 of Unicode Character Database: Canonical combining class. */
228 /* The possible results of uc_combining_class (0..255) are described in
229 UCD.html. The list here is not definitive; more values can be added
230 in future versions. */
233 UC_CCC_NR = 0, /* Not Reordered */
234 UC_CCC_OV = 1, /* Overlay */
235 UC_CCC_NK = 7, /* Nukta */
236 UC_CCC_KV = 8, /* Kana Voicing */
237 UC_CCC_VR = 9, /* Virama */
238 UC_CCC_ATBL = 200, /* Attached Below Left */
239 UC_CCC_ATB = 202, /* Attached Below */
240 UC_CCC_ATAR = 216, /* Attached Above Right */
241 UC_CCC_BL = 218, /* Below Left */
242 UC_CCC_B = 220, /* Below */
243 UC_CCC_BR = 222, /* Below Right */
244 UC_CCC_L = 224, /* Left */
245 UC_CCC_R = 226, /* Right */
246 UC_CCC_AL = 228, /* Above Left */
247 UC_CCC_A = 230, /* Above */
248 UC_CCC_AR = 232, /* Above Right */
249 UC_CCC_DB = 233, /* Double Below */
250 UC_CCC_DA = 234, /* Double Above */
251 UC_CCC_IS = 240 /* Iota Subscript */
254 /* Return the canonical combining class of a Unicode character. */
256 uc_combining_class (ucs4_t uc);
258 /* ========================================================================= */
260 /* Field 4 of Unicode Character Database: Bidi class.
261 Before Unicode 4.0, this field was called "Bidirectional category". */
265 UC_BIDI_L, /* Left-to-Right */
266 UC_BIDI_LRE, /* Left-to-Right Embedding */
267 UC_BIDI_LRO, /* Left-to-Right Override */
268 UC_BIDI_R, /* Right-to-Left */
269 UC_BIDI_AL, /* Right-to-Left Arabic */
270 UC_BIDI_RLE, /* Right-to-Left Embedding */
271 UC_BIDI_RLO, /* Right-to-Left Override */
272 UC_BIDI_PDF, /* Pop Directional Format */
273 UC_BIDI_EN, /* European Number */
274 UC_BIDI_ES, /* European Number Separator */
275 UC_BIDI_ET, /* European Number Terminator */
276 UC_BIDI_AN, /* Arabic Number */
277 UC_BIDI_CS, /* Common Number Separator */
278 UC_BIDI_NSM, /* Non-Spacing Mark */
279 UC_BIDI_BN, /* Boundary Neutral */
280 UC_BIDI_B, /* Paragraph Separator */
281 UC_BIDI_S, /* Segment Separator */
282 UC_BIDI_WS, /* Whitespace */
283 UC_BIDI_ON /* Other Neutral */
286 /* Return the name of a bidi class. */
288 uc_bidi_class_name (int bidi_class);
289 /* Same; obsolete function name. */
291 uc_bidi_category_name (int category);
293 /* Return the bidi class given by name, e.g. "LRE". */
295 uc_bidi_class_byname (const char *bidi_class_name);
296 /* Same; obsolete function name. */
298 uc_bidi_category_byname (const char *category_name);
300 /* Return the bidi class of a Unicode character. */
302 uc_bidi_class (ucs4_t uc);
303 /* Same; obsolete function name. */
305 uc_bidi_category (ucs4_t uc);
307 /* Test whether a Unicode character belongs to a given bidi class. */
309 uc_is_bidi_class (ucs4_t uc, int bidi_class);
310 /* Same; obsolete function name. */
312 uc_is_bidi_category (ucs4_t uc, int category);
314 /* ========================================================================= */
316 /* Field 5 of Unicode Character Database: Character decomposition mapping.
319 /* ========================================================================= */
321 /* Field 6 of Unicode Character Database: Decimal digit value. */
323 /* Return the decimal digit value of a Unicode character. */
325 uc_decimal_value (ucs4_t uc);
327 /* ========================================================================= */
329 /* Field 7 of Unicode Character Database: Digit value. */
331 /* Return the digit value of a Unicode character. */
333 uc_digit_value (ucs4_t uc);
335 /* ========================================================================= */
337 /* Field 8 of Unicode Character Database: Numeric value. */
339 /* Return the numeric value of a Unicode character. */
347 uc_numeric_value (ucs4_t uc);
349 /* ========================================================================= */
351 /* Field 9 of Unicode Character Database: Mirrored. */
353 /* Return the mirrored character of a Unicode character UC in *PUC. */
355 uc_mirror_char (ucs4_t uc, ucs4_t *puc);
357 /* ========================================================================= */
359 /* Field 10 of Unicode Character Database: Unicode 1.0 Name.
360 Not available in this library. */
362 /* ========================================================================= */
364 /* Field 11 of Unicode Character Database: ISO 10646 comment.
365 Not available in this library. */
367 /* ========================================================================= */
369 /* Field 12, 13, 14 of Unicode Character Database: Uppercase mapping,
370 lowercase mapping, titlecase mapping. See "unicase.h". */
372 /* ========================================================================= */
374 /* Field 2 of the file ArabicShaping.txt in the Unicode Character Database. */
376 /* Possible joining types. */
379 UC_JOINING_TYPE_U, /* Non_Joining */
380 UC_JOINING_TYPE_T, /* Transparent */
381 UC_JOINING_TYPE_C, /* Join_Causing */
382 UC_JOINING_TYPE_L, /* Left_Joining */
383 UC_JOINING_TYPE_R, /* Right_Joining */
384 UC_JOINING_TYPE_D /* Dual_Joining */
387 /* Return the name of a joining type. */
389 uc_joining_type_name (int joining_type);
391 /* Return the joining type given by name, e.g. "D". */
393 uc_joining_type_byname (const char *joining_type_name);
395 /* Return the joining type of a Unicode character. */
397 uc_joining_type (ucs4_t uc);
399 /* ========================================================================= */
401 /* Field 3 of the file ArabicShaping.txt in the Unicode Character Database. */
403 /* Possible joining groups.
404 This enumeration may be extended in the future. */
407 UC_JOINING_GROUP_NONE, /* No_Joining_Group */
408 UC_JOINING_GROUP_AIN, /* Ain */
409 UC_JOINING_GROUP_ALAPH, /* Alaph */
410 UC_JOINING_GROUP_ALEF, /* Alef */
411 UC_JOINING_GROUP_BEH, /* Beh */
412 UC_JOINING_GROUP_BETH, /* Beth */
413 UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE, /* Burushaski_Yeh_Barree */
414 UC_JOINING_GROUP_DAL, /* Dal */
415 UC_JOINING_GROUP_DALATH_RISH, /* Dalath_Rish */
416 UC_JOINING_GROUP_E, /* E */
417 UC_JOINING_GROUP_FARSI_YEH, /* Farsi_Yeh */
418 UC_JOINING_GROUP_FE, /* Fe */
419 UC_JOINING_GROUP_FEH, /* Feh */
420 UC_JOINING_GROUP_FINAL_SEMKATH, /* Final_Semkath */
421 UC_JOINING_GROUP_GAF, /* Gaf */
422 UC_JOINING_GROUP_GAMAL, /* Gamal */
423 UC_JOINING_GROUP_HAH, /* Hah */
424 UC_JOINING_GROUP_HE, /* He */
425 UC_JOINING_GROUP_HEH, /* Heh */
426 UC_JOINING_GROUP_HEH_GOAL, /* Heh_Goal */
427 UC_JOINING_GROUP_HETH, /* Heth */
428 UC_JOINING_GROUP_KAF, /* Kaf */
429 UC_JOINING_GROUP_KAPH, /* Kaph */
430 UC_JOINING_GROUP_KHAPH, /* Khaph */
431 UC_JOINING_GROUP_KNOTTED_HEH, /* Knotted_Heh */
432 UC_JOINING_GROUP_LAM, /* Lam */
433 UC_JOINING_GROUP_LAMADH, /* Lamadh */
434 UC_JOINING_GROUP_MEEM, /* Meem */
435 UC_JOINING_GROUP_MIM, /* Mim */
436 UC_JOINING_GROUP_NOON, /* Noon */
437 UC_JOINING_GROUP_NUN, /* Nun */
438 UC_JOINING_GROUP_NYA, /* Nya */
439 UC_JOINING_GROUP_PE, /* Pe */
440 UC_JOINING_GROUP_QAF, /* Qaf */
441 UC_JOINING_GROUP_QAPH, /* Qaph */
442 UC_JOINING_GROUP_REH, /* Reh */
443 UC_JOINING_GROUP_REVERSED_PE, /* Reversed_Pe */
444 UC_JOINING_GROUP_SAD, /* Sad */
445 UC_JOINING_GROUP_SADHE, /* Sadhe */
446 UC_JOINING_GROUP_SEEN, /* Seen */
447 UC_JOINING_GROUP_SEMKATH, /* Semkath */
448 UC_JOINING_GROUP_SHIN, /* Shin */
449 UC_JOINING_GROUP_SWASH_KAF, /* Swash_Kaf */
450 UC_JOINING_GROUP_SYRIAC_WAW, /* Syriac_Waw */
451 UC_JOINING_GROUP_TAH, /* Tah */
452 UC_JOINING_GROUP_TAW, /* Taw */
453 UC_JOINING_GROUP_TEH_MARBUTA, /* Teh_Marbuta */
454 UC_JOINING_GROUP_TEH_MARBUTA_GOAL, /* Teh_Marbuta_Goal */
455 UC_JOINING_GROUP_TETH, /* Teth */
456 UC_JOINING_GROUP_WAW, /* Waw */
457 UC_JOINING_GROUP_YEH, /* Yeh */
458 UC_JOINING_GROUP_YEH_BARREE, /* Yeh_Barree */
459 UC_JOINING_GROUP_YEH_WITH_TAIL, /* Yeh_With_Tail */
460 UC_JOINING_GROUP_YUDH, /* Yudh */
461 UC_JOINING_GROUP_YUDH_HE, /* Yudh_He */
462 UC_JOINING_GROUP_ZAIN, /* Zain */
463 UC_JOINING_GROUP_ZHAIN /* Zhain */
466 /* Return the name of a joining group. */
468 uc_joining_group_name (int joining_group);
470 /* Return the joining group given by name, e.g. "Teh_Marbuta". */
472 uc_joining_group_byname (const char *joining_group_name);
474 /* Return the joining group of a Unicode character. */
476 uc_joining_group (ucs4_t uc);
478 /* ========================================================================= */
480 /* Common API for properties. */
482 /* Data type denoting a property. This is not just a number, but rather a
483 pointer to the test functions, so that programs that use only few of the
484 properties don't have a link-time dependency towards all the tables. */
487 bool (*test_fn) (ucs4_t uc);
491 /* Predefined properties. */
493 extern const uc_property_t UC_PROPERTY_WHITE_SPACE;
494 extern const uc_property_t UC_PROPERTY_ALPHABETIC;
495 extern const uc_property_t UC_PROPERTY_OTHER_ALPHABETIC;
496 extern const uc_property_t UC_PROPERTY_NOT_A_CHARACTER;
497 extern const uc_property_t UC_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT;
498 extern const uc_property_t UC_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT;
499 extern const uc_property_t UC_PROPERTY_DEPRECATED;
500 extern const uc_property_t UC_PROPERTY_LOGICAL_ORDER_EXCEPTION;
501 extern const uc_property_t UC_PROPERTY_VARIATION_SELECTOR;
502 extern const uc_property_t UC_PROPERTY_PRIVATE_USE;
503 extern const uc_property_t UC_PROPERTY_UNASSIGNED_CODE_VALUE;
505 extern const uc_property_t UC_PROPERTY_UPPERCASE;
506 extern const uc_property_t UC_PROPERTY_OTHER_UPPERCASE;
507 extern const uc_property_t UC_PROPERTY_LOWERCASE;
508 extern const uc_property_t UC_PROPERTY_OTHER_LOWERCASE;
509 extern const uc_property_t UC_PROPERTY_TITLECASE;
510 extern const uc_property_t UC_PROPERTY_CASED;
511 extern const uc_property_t UC_PROPERTY_CASE_IGNORABLE;
512 extern const uc_property_t UC_PROPERTY_CHANGES_WHEN_LOWERCASED;
513 extern const uc_property_t UC_PROPERTY_CHANGES_WHEN_UPPERCASED;
514 extern const uc_property_t UC_PROPERTY_CHANGES_WHEN_TITLECASED;
515 extern const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEFOLDED;
516 extern const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEMAPPED;
517 extern const uc_property_t UC_PROPERTY_SOFT_DOTTED;
519 extern const uc_property_t UC_PROPERTY_ID_START;
520 extern const uc_property_t UC_PROPERTY_OTHER_ID_START;
521 extern const uc_property_t UC_PROPERTY_ID_CONTINUE;
522 extern const uc_property_t UC_PROPERTY_OTHER_ID_CONTINUE;
523 extern const uc_property_t UC_PROPERTY_XID_START;
524 extern const uc_property_t UC_PROPERTY_XID_CONTINUE;
525 extern const uc_property_t UC_PROPERTY_PATTERN_WHITE_SPACE;
526 extern const uc_property_t UC_PROPERTY_PATTERN_SYNTAX;
527 /* Shaping and rendering. */
528 extern const uc_property_t UC_PROPERTY_JOIN_CONTROL;
529 extern const uc_property_t UC_PROPERTY_GRAPHEME_BASE;
530 extern const uc_property_t UC_PROPERTY_GRAPHEME_EXTEND;
531 extern const uc_property_t UC_PROPERTY_OTHER_GRAPHEME_EXTEND;
532 extern const uc_property_t UC_PROPERTY_GRAPHEME_LINK;
534 extern const uc_property_t UC_PROPERTY_BIDI_CONTROL;
535 extern const uc_property_t UC_PROPERTY_BIDI_LEFT_TO_RIGHT;
536 extern const uc_property_t UC_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT;
537 extern const uc_property_t UC_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT;
538 extern const uc_property_t UC_PROPERTY_BIDI_EUROPEAN_DIGIT;
539 extern const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_SEPARATOR;
540 extern const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_TERMINATOR;
541 extern const uc_property_t UC_PROPERTY_BIDI_ARABIC_DIGIT;
542 extern const uc_property_t UC_PROPERTY_BIDI_COMMON_SEPARATOR;
543 extern const uc_property_t UC_PROPERTY_BIDI_BLOCK_SEPARATOR;
544 extern const uc_property_t UC_PROPERTY_BIDI_SEGMENT_SEPARATOR;
545 extern const uc_property_t UC_PROPERTY_BIDI_WHITESPACE;
546 extern const uc_property_t UC_PROPERTY_BIDI_NON_SPACING_MARK;
547 extern const uc_property_t UC_PROPERTY_BIDI_BOUNDARY_NEUTRAL;
548 extern const uc_property_t UC_PROPERTY_BIDI_PDF;
549 extern const uc_property_t UC_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE;
550 extern const uc_property_t UC_PROPERTY_BIDI_OTHER_NEUTRAL;
552 extern const uc_property_t UC_PROPERTY_HEX_DIGIT;
553 extern const uc_property_t UC_PROPERTY_ASCII_HEX_DIGIT;
555 extern const uc_property_t UC_PROPERTY_IDEOGRAPHIC;
556 extern const uc_property_t UC_PROPERTY_UNIFIED_IDEOGRAPH;
557 extern const uc_property_t UC_PROPERTY_RADICAL;
558 extern const uc_property_t UC_PROPERTY_IDS_BINARY_OPERATOR;
559 extern const uc_property_t UC_PROPERTY_IDS_TRINARY_OPERATOR;
561 extern const uc_property_t UC_PROPERTY_ZERO_WIDTH;
562 extern const uc_property_t UC_PROPERTY_SPACE;
563 extern const uc_property_t UC_PROPERTY_NON_BREAK;
564 extern const uc_property_t UC_PROPERTY_ISO_CONTROL;
565 extern const uc_property_t UC_PROPERTY_FORMAT_CONTROL;
566 extern const uc_property_t UC_PROPERTY_DASH;
567 extern const uc_property_t UC_PROPERTY_HYPHEN;
568 extern const uc_property_t UC_PROPERTY_PUNCTUATION;
569 extern const uc_property_t UC_PROPERTY_LINE_SEPARATOR;
570 extern const uc_property_t UC_PROPERTY_PARAGRAPH_SEPARATOR;
571 extern const uc_property_t UC_PROPERTY_QUOTATION_MARK;
572 extern const uc_property_t UC_PROPERTY_SENTENCE_TERMINAL;
573 extern const uc_property_t UC_PROPERTY_TERMINAL_PUNCTUATION;
574 extern const uc_property_t UC_PROPERTY_CURRENCY_SYMBOL;
575 extern const uc_property_t UC_PROPERTY_MATH;
576 extern const uc_property_t UC_PROPERTY_OTHER_MATH;
577 extern const uc_property_t UC_PROPERTY_PAIRED_PUNCTUATION;
578 extern const uc_property_t UC_PROPERTY_LEFT_OF_PAIR;
579 extern const uc_property_t UC_PROPERTY_COMBINING;
580 extern const uc_property_t UC_PROPERTY_COMPOSITE;
581 extern const uc_property_t UC_PROPERTY_DECIMAL_DIGIT;
582 extern const uc_property_t UC_PROPERTY_NUMERIC;
583 extern const uc_property_t UC_PROPERTY_DIACRITIC;
584 extern const uc_property_t UC_PROPERTY_EXTENDER;
585 extern const uc_property_t UC_PROPERTY_IGNORABLE_CONTROL;
587 /* Return the property given by name, e.g. "White space". */
589 uc_property_byname (const char *property_name);
591 /* Test whether a property is valid. */
592 #define uc_property_is_valid(property) ((property).test_fn != NULL)
594 /* Test whether a Unicode character has a given property. */
596 uc_is_property (ucs4_t uc, uc_property_t property);
597 extern bool uc_is_property_white_space (ucs4_t uc);
598 extern bool uc_is_property_alphabetic (ucs4_t uc);
599 extern bool uc_is_property_other_alphabetic (ucs4_t uc);
600 extern bool uc_is_property_not_a_character (ucs4_t uc);
601 extern bool uc_is_property_default_ignorable_code_point (ucs4_t uc);
602 extern bool uc_is_property_other_default_ignorable_code_point (ucs4_t uc);
603 extern bool uc_is_property_deprecated (ucs4_t uc);
604 extern bool uc_is_property_logical_order_exception (ucs4_t uc);
605 extern bool uc_is_property_variation_selector (ucs4_t uc);
606 extern bool uc_is_property_private_use (ucs4_t uc);
607 extern bool uc_is_property_unassigned_code_value (ucs4_t uc);
608 extern bool uc_is_property_uppercase (ucs4_t uc);
609 extern bool uc_is_property_other_uppercase (ucs4_t uc);
610 extern bool uc_is_property_lowercase (ucs4_t uc);
611 extern bool uc_is_property_other_lowercase (ucs4_t uc);
612 extern bool uc_is_property_titlecase (ucs4_t uc);
613 extern bool uc_is_property_cased (ucs4_t uc);
614 extern bool uc_is_property_case_ignorable (ucs4_t uc);
615 extern bool uc_is_property_changes_when_lowercased (ucs4_t uc);
616 extern bool uc_is_property_changes_when_uppercased (ucs4_t uc);
617 extern bool uc_is_property_changes_when_titlecased (ucs4_t uc);
618 extern bool uc_is_property_changes_when_casefolded (ucs4_t uc);
619 extern bool uc_is_property_changes_when_casemapped (ucs4_t uc);
620 extern bool uc_is_property_soft_dotted (ucs4_t uc);
621 extern bool uc_is_property_id_start (ucs4_t uc);
622 extern bool uc_is_property_other_id_start (ucs4_t uc);
623 extern bool uc_is_property_id_continue (ucs4_t uc);
624 extern bool uc_is_property_other_id_continue (ucs4_t uc);
625 extern bool uc_is_property_xid_start (ucs4_t uc);
626 extern bool uc_is_property_xid_continue (ucs4_t uc);
627 extern bool uc_is_property_pattern_white_space (ucs4_t uc);
628 extern bool uc_is_property_pattern_syntax (ucs4_t uc);
629 extern bool uc_is_property_join_control (ucs4_t uc);
630 extern bool uc_is_property_grapheme_base (ucs4_t uc);
631 extern bool uc_is_property_grapheme_extend (ucs4_t uc);
632 extern bool uc_is_property_other_grapheme_extend (ucs4_t uc);
633 extern bool uc_is_property_grapheme_link (ucs4_t uc);
634 extern bool uc_is_property_bidi_control (ucs4_t uc);
635 extern bool uc_is_property_bidi_left_to_right (ucs4_t uc);
636 extern bool uc_is_property_bidi_hebrew_right_to_left (ucs4_t uc);
637 extern bool uc_is_property_bidi_arabic_right_to_left (ucs4_t uc);
638 extern bool uc_is_property_bidi_european_digit (ucs4_t uc);
639 extern bool uc_is_property_bidi_eur_num_separator (ucs4_t uc);
640 extern bool uc_is_property_bidi_eur_num_terminator (ucs4_t uc);
641 extern bool uc_is_property_bidi_arabic_digit (ucs4_t uc);
642 extern bool uc_is_property_bidi_common_separator (ucs4_t uc);
643 extern bool uc_is_property_bidi_block_separator (ucs4_t uc);
644 extern bool uc_is_property_bidi_segment_separator (ucs4_t uc);
645 extern bool uc_is_property_bidi_whitespace (ucs4_t uc);
646 extern bool uc_is_property_bidi_non_spacing_mark (ucs4_t uc);
647 extern bool uc_is_property_bidi_boundary_neutral (ucs4_t uc);
648 extern bool uc_is_property_bidi_pdf (ucs4_t uc);
649 extern bool uc_is_property_bidi_embedding_or_override (ucs4_t uc);
650 extern bool uc_is_property_bidi_other_neutral (ucs4_t uc);
651 extern bool uc_is_property_hex_digit (ucs4_t uc);
652 extern bool uc_is_property_ascii_hex_digit (ucs4_t uc);
653 extern bool uc_is_property_ideographic (ucs4_t uc);
654 extern bool uc_is_property_unified_ideograph (ucs4_t uc);
655 extern bool uc_is_property_radical (ucs4_t uc);
656 extern bool uc_is_property_ids_binary_operator (ucs4_t uc);
657 extern bool uc_is_property_ids_trinary_operator (ucs4_t uc);
658 extern bool uc_is_property_zero_width (ucs4_t uc);
659 extern bool uc_is_property_space (ucs4_t uc);
660 extern bool uc_is_property_non_break (ucs4_t uc);
661 extern bool uc_is_property_iso_control (ucs4_t uc);
662 extern bool uc_is_property_format_control (ucs4_t uc);
663 extern bool uc_is_property_dash (ucs4_t uc);
664 extern bool uc_is_property_hyphen (ucs4_t uc);
665 extern bool uc_is_property_punctuation (ucs4_t uc);
666 extern bool uc_is_property_line_separator (ucs4_t uc);
667 extern bool uc_is_property_paragraph_separator (ucs4_t uc);
668 extern bool uc_is_property_quotation_mark (ucs4_t uc);
669 extern bool uc_is_property_sentence_terminal (ucs4_t uc);
670 extern bool uc_is_property_terminal_punctuation (ucs4_t uc);
671 extern bool uc_is_property_currency_symbol (ucs4_t uc);
672 extern bool uc_is_property_math (ucs4_t uc);
673 extern bool uc_is_property_other_math (ucs4_t uc);
674 extern bool uc_is_property_paired_punctuation (ucs4_t uc);
675 extern bool uc_is_property_left_of_pair (ucs4_t uc);
676 extern bool uc_is_property_combining (ucs4_t uc);
677 extern bool uc_is_property_composite (ucs4_t uc);
678 extern bool uc_is_property_decimal_digit (ucs4_t uc);
679 extern bool uc_is_property_numeric (ucs4_t uc);
680 extern bool uc_is_property_diacritic (ucs4_t uc);
681 extern bool uc_is_property_extender (ucs4_t uc);
682 extern bool uc_is_property_ignorable_control (ucs4_t uc);
684 /* ========================================================================= */
686 /* Subdivision of the Unicode characters into scripts. */
690 unsigned int code : 21;
691 unsigned int start : 1;
692 unsigned int end : 1;
697 unsigned int nintervals;
698 const uc_interval_t *intervals;
703 /* Return the script of a Unicode character. */
704 extern const uc_script_t *
705 uc_script (ucs4_t uc);
707 /* Return the script given by name, e.g. "HAN". */
708 extern const uc_script_t *
709 uc_script_byname (const char *script_name);
711 /* Test whether a Unicode character belongs to a given script. */
713 uc_is_script (ucs4_t uc, const uc_script_t *script);
715 /* Get the list of all scripts. */
717 uc_all_scripts (const uc_script_t **scripts, size_t *count);
719 /* ========================================================================= */
721 /* Subdivision of the Unicode character range into blocks. */
731 /* Return the block a character belongs to. */
732 extern const uc_block_t *
733 uc_block (ucs4_t uc);
735 /* Test whether a Unicode character belongs to a given block. */
737 uc_is_block (ucs4_t uc, const uc_block_t *block);
739 /* Get the list of all blocks. */
741 uc_all_blocks (const uc_block_t **blocks, size_t *count);
743 /* ========================================================================= */
745 /* Properties taken from language standards. */
747 /* Test whether a Unicode character is considered whitespace in ISO C 99. */
749 uc_is_c_whitespace (ucs4_t uc);
751 /* Test whether a Unicode character is considered whitespace in Java. */
753 uc_is_java_whitespace (ucs4_t uc);
757 UC_IDENTIFIER_START, /* valid as first or subsequent character */
758 UC_IDENTIFIER_VALID, /* valid as subsequent character only */
759 UC_IDENTIFIER_INVALID, /* not valid */
760 UC_IDENTIFIER_IGNORABLE /* ignorable (Java only) */
763 /* Return the categorization of a Unicode character w.r.t. the ISO C 99
764 identifier syntax. */
766 uc_c_ident_category (ucs4_t uc);
768 /* Return the categorization of a Unicode character w.r.t. the Java
769 identifier syntax. */
771 uc_java_ident_category (ucs4_t uc);
773 /* ========================================================================= */
775 /* Like ISO C <ctype.h> and <wctype.h>. These functions are deprecated,
776 because this set of functions was designed with ASCII in mind and cannot
777 reflect the more diverse reality of the Unicode character set. But they
778 can be a quick-and-dirty porting aid when migrating from wchar_t APIs
779 to Unicode strings. */
781 /* Test for any character for which 'uc_is_alpha' or 'uc_is_digit' is true. */
783 uc_is_alnum (ucs4_t uc);
785 /* Test for any character for which 'uc_is_upper' or 'uc_is_lower' is true,
786 or any character that is one of a locale-specific set of characters for
787 which none of 'uc_is_cntrl', 'uc_is_digit', 'uc_is_punct', or 'uc_is_space'
790 uc_is_alpha (ucs4_t uc);
792 /* Test for any control character. */
794 uc_is_cntrl (ucs4_t uc);
796 /* Test for any character that corresponds to a decimal-digit character. */
798 uc_is_digit (ucs4_t uc);
800 /* Test for any character for which 'uc_is_print' is true and 'uc_is_space'
803 uc_is_graph (ucs4_t uc);
805 /* Test for any character that corresponds to a lowercase letter or is one
806 of a locale-specific set of characters for which none of 'uc_is_cntrl',
807 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */
809 uc_is_lower (ucs4_t uc);
811 /* Test for any printing character. */
813 uc_is_print (ucs4_t uc);
815 /* Test for any printing character that is one of a locale-specific set of
816 characters for which neither 'uc_is_space' nor 'uc_is_alnum' is true. */
818 uc_is_punct (ucs4_t uc);
820 /* Test for any character that corresponds to a locale-specific set of
821 characters for which none of 'uc_is_alnum', 'uc_is_graph', or 'uc_is_punct'
824 uc_is_space (ucs4_t uc);
826 /* Test for any character that corresponds to an uppercase letter or is one
827 of a locale-specific set of character for which none of 'uc_is_cntrl',
828 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */
830 uc_is_upper (ucs4_t uc);
832 /* Test for any character that corresponds to a hexadecimal-digit
835 uc_is_xdigit (ucs4_t uc);
838 /* Test for any character that corresponds to a standard blank character or
839 a locale-specific set of characters for which 'uc_is_alnum' is false. */
841 uc_is_blank (ucs4_t uc);
843 /* ========================================================================= */
849 #endif /* _UNICTYPE_H */