1 /* Unicode character classification and properties.
2 Copyright (C) 2002, 2005-2023 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file 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
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17 #ifndef _UNICTYPE_H
18 #define _UNICTYPE_H
19
20 #include "unitypes.h"
21
22 /* Get bool. */
23 #include <stdbool.h>
24
25 /* Get size_t. */
26 #include <stddef.h>
27
28 #if @HAVE_UNISTRING_WOE32DLL_H@
29 # include <unistring/woe32dll.h>
30 #else
31 # define LIBUNISTRING_DLL_VARIABLE
32 #endif
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /* ========================================================================= */
39
40 /* Field 1 of Unicode Character Database: Character name.
41 See "uniname.h". */
42
43 /* ========================================================================= */
44
45 /* Field 2 of Unicode Character Database: General category. */
46
47 /* Data type denoting a General category value. This is not just a bitmask,
48 but rather a bitmask and a pointer to the lookup table, so that programs
49 that use only the predefined bitmasks (i.e. don't combine bitmasks with &
50 and |) don't have a link-time dependency towards the big general table. */
51 typedef struct
52 {
53 uint32_t bitmask : 31;
54 /*bool*/ unsigned int generic : 1;
55 union
56 {
57 const void *table; /* when generic is 0 */
58 bool (*lookup_fn) (ucs4_t uc, uint32_t bitmask); /* when generic is 1 */
59 } lookup;
60 }
61 uc_general_category_t;
62
63 /* Bits and bit masks denoting General category values. UnicodeData-3.2.0.html
64 says a 32-bit integer will always suffice to represent them.
65 These bit masks can only be used with the uc_is_general_category_withtable
66 function. */
67 enum
68 {
69 UC_CATEGORY_MASK_L = 0x0000001f,
70 UC_CATEGORY_MASK_LC = 0x00000007,
71 UC_CATEGORY_MASK_Lu = 0x00000001,
72 UC_CATEGORY_MASK_Ll = 0x00000002,
73 UC_CATEGORY_MASK_Lt = 0x00000004,
74 UC_CATEGORY_MASK_Lm = 0x00000008,
75 UC_CATEGORY_MASK_Lo = 0x00000010,
76 UC_CATEGORY_MASK_M = 0x000000e0,
77 UC_CATEGORY_MASK_Mn = 0x00000020,
78 UC_CATEGORY_MASK_Mc = 0x00000040,
79 UC_CATEGORY_MASK_Me = 0x00000080,
80 UC_CATEGORY_MASK_N = 0x00000700,
81 UC_CATEGORY_MASK_Nd = 0x00000100,
82 UC_CATEGORY_MASK_Nl = 0x00000200,
83 UC_CATEGORY_MASK_No = 0x00000400,
84 UC_CATEGORY_MASK_P = 0x0003f800,
85 UC_CATEGORY_MASK_Pc = 0x00000800,
86 UC_CATEGORY_MASK_Pd = 0x00001000,
87 UC_CATEGORY_MASK_Ps = 0x00002000,
88 UC_CATEGORY_MASK_Pe = 0x00004000,
89 UC_CATEGORY_MASK_Pi = 0x00008000,
90 UC_CATEGORY_MASK_Pf = 0x00010000,
91 UC_CATEGORY_MASK_Po = 0x00020000,
92 UC_CATEGORY_MASK_S = 0x003c0000,
93 UC_CATEGORY_MASK_Sm = 0x00040000,
94 UC_CATEGORY_MASK_Sc = 0x00080000,
95 UC_CATEGORY_MASK_Sk = 0x00100000,
96 UC_CATEGORY_MASK_So = 0x00200000,
97 UC_CATEGORY_MASK_Z = 0x01c00000,
98 UC_CATEGORY_MASK_Zs = 0x00400000,
99 UC_CATEGORY_MASK_Zl = 0x00800000,
100 UC_CATEGORY_MASK_Zp = 0x01000000,
101 UC_CATEGORY_MASK_C = 0x3e000000,
102 UC_CATEGORY_MASK_Cc = 0x02000000,
103 UC_CATEGORY_MASK_Cf = 0x04000000,
104 UC_CATEGORY_MASK_Cs = 0x08000000,
105 UC_CATEGORY_MASK_Co = 0x10000000,
106 UC_CATEGORY_MASK_Cn = 0x20000000
107 };
108
109 /* Predefined General category values. */
110 extern @GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_L;
111 extern @GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_LC;
112 extern @GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lu;
113 extern @GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Ll;
114 extern @GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lt;
115 extern @GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lm;
116 extern @GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lo;
117 extern @GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_M;
118 extern @GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Mn;
119 extern @GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Mc;
120 extern @GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Me;
121 extern @GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_N;
122 extern @GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Nd;
123 extern @GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Nl;
124 extern @GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_No;
125 extern @GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_P;
126 extern @GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pc;
127 extern @GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pd;
128 extern @GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Ps;
129 extern @GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pe;
130 extern @GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pi;
131 extern @GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pf;
132 extern @GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Po;
133 extern @GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_S;
134 extern @GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sm;
135 extern @GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sc;
136 extern @GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sk;
137 extern @GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_So;
138 extern @GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Z;
139 extern @GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zs;
140 extern @GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zl;
141 extern @GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zp;
142 extern @GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_C;
143 extern @GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cc;
144 extern @GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cf;
145 extern @GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cs;
146 extern @GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Co;
147 extern @GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cn;
148 /* Non-public. */
149 extern const uc_general_category_t _UC_CATEGORY_NONE;
150
151 /* Alias names for predefined General category values. */
152 #define UC_LETTER UC_CATEGORY_L
153 #define UC_CASED_LETTER UC_CATEGORY_LC
154 #define UC_UPPERCASE_LETTER UC_CATEGORY_Lu
155 #define UC_LOWERCASE_LETTER UC_CATEGORY_Ll
156 #define UC_TITLECASE_LETTER UC_CATEGORY_Lt
157 #define UC_MODIFIER_LETTER UC_CATEGORY_Lm
158 #define UC_OTHER_LETTER UC_CATEGORY_Lo
159 #define UC_MARK UC_CATEGORY_M
160 #define UC_NON_SPACING_MARK UC_CATEGORY_Mn
161 #define UC_COMBINING_SPACING_MARK UC_CATEGORY_Mc
162 #define UC_ENCLOSING_MARK UC_CATEGORY_Me
163 #define UC_NUMBER UC_CATEGORY_N
164 #define UC_DECIMAL_DIGIT_NUMBER UC_CATEGORY_Nd
165 #define UC_LETTER_NUMBER UC_CATEGORY_Nl
166 #define UC_OTHER_NUMBER UC_CATEGORY_No
167 #define UC_PUNCTUATION UC_CATEGORY_P
168 #define UC_CONNECTOR_PUNCTUATION UC_CATEGORY_Pc
169 #define UC_DASH_PUNCTUATION UC_CATEGORY_Pd
170 #define UC_OPEN_PUNCTUATION UC_CATEGORY_Ps /* a.k.a. UC_START_PUNCTUATION */
171 #define UC_CLOSE_PUNCTUATION UC_CATEGORY_Pe /* a.k.a. UC_END_PUNCTUATION */
172 #define UC_INITIAL_QUOTE_PUNCTUATION UC_CATEGORY_Pi
173 #define UC_FINAL_QUOTE_PUNCTUATION UC_CATEGORY_Pf
174 #define UC_OTHER_PUNCTUATION UC_CATEGORY_Po
175 #define UC_SYMBOL UC_CATEGORY_S
176 #define UC_MATH_SYMBOL UC_CATEGORY_Sm
177 #define UC_CURRENCY_SYMBOL UC_CATEGORY_Sc
178 #define UC_MODIFIER_SYMBOL UC_CATEGORY_Sk
179 #define UC_OTHER_SYMBOL UC_CATEGORY_So
180 #define UC_SEPARATOR UC_CATEGORY_Z
181 #define UC_SPACE_SEPARATOR UC_CATEGORY_Zs
182 #define UC_LINE_SEPARATOR UC_CATEGORY_Zl
183 #define UC_PARAGRAPH_SEPARATOR UC_CATEGORY_Zp
184 #define UC_OTHER UC_CATEGORY_C
185 #define UC_CONTROL UC_CATEGORY_Cc
186 #define UC_FORMAT UC_CATEGORY_Cf
187 #define UC_SURROGATE UC_CATEGORY_Cs /* all of them are invalid characters */
188 #define UC_PRIVATE_USE UC_CATEGORY_Co
189 #define UC_UNASSIGNED UC_CATEGORY_Cn /* some of them are invalid characters */
190
191 /* Return the union of two general categories.
192 This corresponds to the unions of the two sets of characters. */
193 extern uc_general_category_t
194 uc_general_category_or (uc_general_category_t category1,
195 uc_general_category_t category2);
196
197 /* Return the intersection of two general categories as bit masks.
198 This *does*not* correspond to the intersection of the two sets of
199 characters. */
200 extern uc_general_category_t
201 uc_general_category_and (uc_general_category_t category1,
202 uc_general_category_t category2);
203
204 /* Return the intersection of a general category with the complement of a
205 second general category, as bit masks.
206 This *does*not* correspond to the intersection with complement, when
207 viewing the categories as sets of characters. */
208 extern uc_general_category_t
209 uc_general_category_and_not (uc_general_category_t category1,
210 uc_general_category_t category2);
211
212 /* Return the name of a general category. */
213 extern const char *
214 uc_general_category_name (uc_general_category_t category)
215 _UC_ATTRIBUTE_PURE;
216
217 /* Return the long name of a general category. */
218 extern const char *
219 uc_general_category_long_name (uc_general_category_t category)
220 _UC_ATTRIBUTE_PURE;
221
222 /* Return the general category given by name, e.g. "Lu", or by long name,
223 e.g. "Uppercase Letter". */
224 extern uc_general_category_t
225 uc_general_category_byname (const char *category_name)
226 _UC_ATTRIBUTE_PURE;
227
228 /* Return the general category of a Unicode character. */
229 extern uc_general_category_t
230 uc_general_category (ucs4_t uc)
231 _UC_ATTRIBUTE_PURE;
232
233 /* Test whether a Unicode character belongs to a given category.
234 The CATEGORY argument can be the combination of several predefined
235 general categories. */
236 extern bool
237 uc_is_general_category (ucs4_t uc, uc_general_category_t category)
238 _UC_ATTRIBUTE_PURE;
239 /* Likewise. This function uses a big table comprising all categories. */
240 extern bool
241 uc_is_general_category_withtable (ucs4_t uc, uint32_t bitmask)
242 _UC_ATTRIBUTE_CONST;
243
244 /* ========================================================================= */
245
246 /* Field 3 of Unicode Character Database: Canonical combining class. */
247
248 /* The possible results of uc_combining_class (0..255) are described in
249 UCD.html. The list here is not definitive; more values can be added
250 in future versions. */
251 enum
252 {
253 UC_CCC_NR = 0, /* Not Reordered */
254 UC_CCC_OV = 1, /* Overlay */
255 UC_CCC_NK = 7, /* Nukta */
256 UC_CCC_KV = 8, /* Kana Voicing */
257 UC_CCC_VR = 9, /* Virama */
258 UC_CCC_ATBL = 200, /* Attached Below Left */
259 UC_CCC_ATB = 202, /* Attached Below */
260 UC_CCC_ATA = 214, /* Attached Above */
261 UC_CCC_ATAR = 216, /* Attached Above Right */
262 UC_CCC_BL = 218, /* Below Left */
263 UC_CCC_B = 220, /* Below */
264 UC_CCC_BR = 222, /* Below Right */
265 UC_CCC_L = 224, /* Left */
266 UC_CCC_R = 226, /* Right */
267 UC_CCC_AL = 228, /* Above Left */
268 UC_CCC_A = 230, /* Above */
269 UC_CCC_AR = 232, /* Above Right */
270 UC_CCC_DB = 233, /* Double Below */
271 UC_CCC_DA = 234, /* Double Above */
272 UC_CCC_IS = 240 /* Iota Subscript */
273 };
274
275 /* Return the canonical combining class of a Unicode character. */
276 extern int
277 uc_combining_class (ucs4_t uc)
278 _UC_ATTRIBUTE_CONST;
279
280 /* Return the name of a canonical combining class. */
281 extern const char *
282 uc_combining_class_name (int ccc)
283 _UC_ATTRIBUTE_CONST;
284
285 /* Return the long name of a canonical combining class. */
286 extern const char *
287 uc_combining_class_long_name (int ccc)
288 _UC_ATTRIBUTE_CONST;
289
290 /* Return the canonical combining class given by name, e.g. "BL", or by long
291 name, e.g. "Below Left". */
292 extern int
293 uc_combining_class_byname (const char *ccc_name)
294 _UC_ATTRIBUTE_PURE;
295
296 /* ========================================================================= */
297
298 /* Field 4 of Unicode Character Database: Bidi class.
299 Before Unicode 4.0, this field was called "Bidirectional category". */
300
301 enum
302 {
303 UC_BIDI_L, /* Left-to-Right */
304 UC_BIDI_LRE, /* Left-to-Right Embedding */
305 UC_BIDI_LRO, /* Left-to-Right Override */
306 UC_BIDI_R, /* Right-to-Left */
307 UC_BIDI_AL, /* Right-to-Left Arabic */
308 UC_BIDI_RLE, /* Right-to-Left Embedding */
309 UC_BIDI_RLO, /* Right-to-Left Override */
310 UC_BIDI_PDF, /* Pop Directional Format */
311 UC_BIDI_EN, /* European Number */
312 UC_BIDI_ES, /* European Number Separator */
313 UC_BIDI_ET, /* European Number Terminator */
314 UC_BIDI_AN, /* Arabic Number */
315 UC_BIDI_CS, /* Common Number Separator */
316 UC_BIDI_NSM, /* Non-Spacing Mark */
317 UC_BIDI_BN, /* Boundary Neutral */
318 UC_BIDI_B, /* Paragraph Separator */
319 UC_BIDI_S, /* Segment Separator */
320 UC_BIDI_WS, /* Whitespace */
321 UC_BIDI_ON, /* Other Neutral */
322 UC_BIDI_LRI, /* Left-to-Right Isolate */
323 UC_BIDI_RLI, /* Right-to-Left Isolate */
324 UC_BIDI_FSI, /* First Strong Isolate */
325 UC_BIDI_PDI /* Pop Directional Isolate */
326 };
327
328 /* Return the name of a bidi class. */
329 extern const char *
330 uc_bidi_class_name (int bidi_class)
331 _UC_ATTRIBUTE_CONST;
332 /* Same; obsolete function name. */
333 extern const char *
334 uc_bidi_category_name (int category)
335 _UC_ATTRIBUTE_CONST;
336
337 /* Return the long name of a bidi class. */
338 extern const char *
339 uc_bidi_class_long_name (int bidi_class)
340 _UC_ATTRIBUTE_CONST;
341
342 /* Return the bidi class given by name, e.g. "LRE", or by long name, e.g.
343 "Left-to-Right Embedding". */
344 extern int
345 uc_bidi_class_byname (const char *bidi_class_name)
346 _UC_ATTRIBUTE_PURE;
347 /* Same; obsolete function name. */
348 extern int
349 uc_bidi_category_byname (const char *category_name)
350 _UC_ATTRIBUTE_PURE;
351
352 /* Return the bidi class of a Unicode character. */
353 extern int
354 uc_bidi_class (ucs4_t uc)
355 _UC_ATTRIBUTE_CONST;
356 /* Same; obsolete function name. */
357 extern int
358 uc_bidi_category (ucs4_t uc)
359 _UC_ATTRIBUTE_CONST;
360
361 /* Test whether a Unicode character belongs to a given bidi class. */
362 extern bool
363 uc_is_bidi_class (ucs4_t uc, int bidi_class)
364 _UC_ATTRIBUTE_CONST;
365 /* Same; obsolete function name. */
366 extern bool
367 uc_is_bidi_category (ucs4_t uc, int category)
368 _UC_ATTRIBUTE_CONST;
369
370 /* ========================================================================= */
371
372 /* Field 5 of Unicode Character Database: Character decomposition mapping.
373 See "uninorm.h". */
374
375 /* ========================================================================= */
376
377 /* Field 6 of Unicode Character Database: Decimal digit value. */
378
379 /* Return the decimal digit value of a Unicode character. */
380 extern int
381 uc_decimal_value (ucs4_t uc)
382 _UC_ATTRIBUTE_CONST;
383
384 /* ========================================================================= */
385
386 /* Field 7 of Unicode Character Database: Digit value. */
387
388 /* Return the digit value of a Unicode character. */
389 extern int
390 uc_digit_value (ucs4_t uc)
391 _UC_ATTRIBUTE_CONST;
392
393 /* ========================================================================= */
394
395 /* Field 8 of Unicode Character Database: Numeric value. */
396
397 /* Return the numeric value of a Unicode character. */
398 typedef struct
399 {
400 int numerator;
401 int denominator;
402 }
403 uc_fraction_t;
404 extern uc_fraction_t
405 uc_numeric_value (ucs4_t uc)
406 _UC_ATTRIBUTE_CONST;
407
408 /* ========================================================================= */
409
410 /* Field 9 of Unicode Character Database: Mirrored. */
411
412 /* Return the mirrored character of a Unicode character UC in *PUC. */
413 extern bool
414 uc_mirror_char (ucs4_t uc, ucs4_t *puc);
415
416 /* ========================================================================= */
417
418 /* Field 10 of Unicode Character Database: Unicode 1.0 Name.
419 Not available in this library. */
420
421 /* ========================================================================= */
422
423 /* Field 11 of Unicode Character Database: ISO 10646 comment.
424 Not available in this library. */
425
426 /* ========================================================================= */
427
428 /* Field 12, 13, 14 of Unicode Character Database: Uppercase mapping,
429 lowercase mapping, titlecase mapping. See "unicase.h". */
430
431 /* ========================================================================= */
432
433 /* Field 2 of the file ArabicShaping.txt in the Unicode Character Database. */
434
435 /* Possible joining types. */
436 enum
437 {
438 UC_JOINING_TYPE_U, /* Non_Joining */
439 UC_JOINING_TYPE_T, /* Transparent */
440 UC_JOINING_TYPE_C, /* Join_Causing */
441 UC_JOINING_TYPE_L, /* Left_Joining */
442 UC_JOINING_TYPE_R, /* Right_Joining */
443 UC_JOINING_TYPE_D /* Dual_Joining */
444 };
445
446 /* Return the name of a joining type. */
447 extern const char *
448 uc_joining_type_name (int joining_type)
449 _UC_ATTRIBUTE_CONST;
450
451 /* Return the long name of a joining type. */
452 extern const char *
453 uc_joining_type_long_name (int joining_type)
454 _UC_ATTRIBUTE_CONST;
455
456 /* Return the joining type given by name, e.g. "D", or by long name, e.g.
457 "Dual Joining". */
458 extern int
459 uc_joining_type_byname (const char *joining_type_name)
460 _UC_ATTRIBUTE_PURE;
461
462 /* Return the joining type of a Unicode character. */
463 extern int
464 uc_joining_type (ucs4_t uc)
465 _UC_ATTRIBUTE_CONST;
466
467 /* ========================================================================= */
468
469 /* Field 3 of the file ArabicShaping.txt in the Unicode Character Database. */
470
471 /* Possible joining groups.
472 This enumeration may be extended in the future. */
473 enum
474 {
475 UC_JOINING_GROUP_NONE, /* No_Joining_Group */
476 UC_JOINING_GROUP_AIN, /* Ain */
477 UC_JOINING_GROUP_ALAPH, /* Alaph */
478 UC_JOINING_GROUP_ALEF, /* Alef */
479 UC_JOINING_GROUP_BEH, /* Beh */
480 UC_JOINING_GROUP_BETH, /* Beth */
481 UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE, /* Burushaski_Yeh_Barree */
482 UC_JOINING_GROUP_DAL, /* Dal */
483 UC_JOINING_GROUP_DALATH_RISH, /* Dalath_Rish */
484 UC_JOINING_GROUP_E, /* E */
485 UC_JOINING_GROUP_FARSI_YEH, /* Farsi_Yeh */
486 UC_JOINING_GROUP_FE, /* Fe */
487 UC_JOINING_GROUP_FEH, /* Feh */
488 UC_JOINING_GROUP_FINAL_SEMKATH, /* Final_Semkath */
489 UC_JOINING_GROUP_GAF, /* Gaf */
490 UC_JOINING_GROUP_GAMAL, /* Gamal */
491 UC_JOINING_GROUP_HAH, /* Hah */
492 UC_JOINING_GROUP_HE, /* He */
493 UC_JOINING_GROUP_HEH, /* Heh */
494 UC_JOINING_GROUP_HEH_GOAL, /* Heh_Goal */
495 UC_JOINING_GROUP_HETH, /* Heth */
496 UC_JOINING_GROUP_KAF, /* Kaf */
497 UC_JOINING_GROUP_KAPH, /* Kaph */
498 UC_JOINING_GROUP_KHAPH, /* Khaph */
499 UC_JOINING_GROUP_KNOTTED_HEH, /* Knotted_Heh */
500 UC_JOINING_GROUP_LAM, /* Lam */
501 UC_JOINING_GROUP_LAMADH, /* Lamadh */
502 UC_JOINING_GROUP_MEEM, /* Meem */
503 UC_JOINING_GROUP_MIM, /* Mim */
504 UC_JOINING_GROUP_NOON, /* Noon */
505 UC_JOINING_GROUP_NUN, /* Nun */
506 UC_JOINING_GROUP_NYA, /* Nya */
507 UC_JOINING_GROUP_PE, /* Pe */
508 UC_JOINING_GROUP_QAF, /* Qaf */
509 UC_JOINING_GROUP_QAPH, /* Qaph */
510 UC_JOINING_GROUP_REH, /* Reh */
511 UC_JOINING_GROUP_REVERSED_PE, /* Reversed_Pe */
512 UC_JOINING_GROUP_SAD, /* Sad */
513 UC_JOINING_GROUP_SADHE, /* Sadhe */
514 UC_JOINING_GROUP_SEEN, /* Seen */
515 UC_JOINING_GROUP_SEMKATH, /* Semkath */
516 UC_JOINING_GROUP_SHIN, /* Shin */
517 UC_JOINING_GROUP_SWASH_KAF, /* Swash_Kaf */
518 UC_JOINING_GROUP_SYRIAC_WAW, /* Syriac_Waw */
519 UC_JOINING_GROUP_TAH, /* Tah */
520 UC_JOINING_GROUP_TAW, /* Taw */
521 UC_JOINING_GROUP_TEH_MARBUTA, /* Teh_Marbuta */
522 UC_JOINING_GROUP_TEH_MARBUTA_GOAL, /* Teh_Marbuta_Goal */
523 UC_JOINING_GROUP_TETH, /* Teth */
524 UC_JOINING_GROUP_WAW, /* Waw */
525 UC_JOINING_GROUP_YEH, /* Yeh */
526 UC_JOINING_GROUP_YEH_BARREE, /* Yeh_Barree */
527 UC_JOINING_GROUP_YEH_WITH_TAIL, /* Yeh_With_Tail */
528 UC_JOINING_GROUP_YUDH, /* Yudh */
529 UC_JOINING_GROUP_YUDH_HE, /* Yudh_He */
530 UC_JOINING_GROUP_ZAIN, /* Zain */
531 UC_JOINING_GROUP_ZHAIN, /* Zhain */
532 UC_JOINING_GROUP_ROHINGYA_YEH, /* Rohingya_Yeh */
533 UC_JOINING_GROUP_STRAIGHT_WAW, /* Straight_Waw */
534 UC_JOINING_GROUP_MANICHAEAN_ALEPH, /* Manichaean_Aleph */
535 UC_JOINING_GROUP_MANICHAEAN_BETH, /* Manichaean_Beth */
536 UC_JOINING_GROUP_MANICHAEAN_GIMEL, /* Manichaean_Gimel */
537 UC_JOINING_GROUP_MANICHAEAN_DALETH, /* Manichaean_Daleth */
538 UC_JOINING_GROUP_MANICHAEAN_WAW, /* Manichaean_Waw */
539 UC_JOINING_GROUP_MANICHAEAN_ZAYIN, /* Manichaean_Zayin */
540 UC_JOINING_GROUP_MANICHAEAN_HETH, /* Manichaean_Heth */
541 UC_JOINING_GROUP_MANICHAEAN_TETH, /* Manichaean_Teth */
542 UC_JOINING_GROUP_MANICHAEAN_YODH, /* Manichaean_Yodh */
543 UC_JOINING_GROUP_MANICHAEAN_KAPH, /* Manichaean_Kaph */
544 UC_JOINING_GROUP_MANICHAEAN_LAMEDH, /* Manichaean_Lamedh */
545 UC_JOINING_GROUP_MANICHAEAN_DHAMEDH, /* Manichaean_Dhamedh */
546 UC_JOINING_GROUP_MANICHAEAN_THAMEDH, /* Manichaean_Thamedh */
547 UC_JOINING_GROUP_MANICHAEAN_MEM, /* Manichaean_Mem */
548 UC_JOINING_GROUP_MANICHAEAN_NUN, /* Manichaean_Nun */
549 UC_JOINING_GROUP_MANICHAEAN_SAMEKH, /* Manichaean_Aleph */
550 UC_JOINING_GROUP_MANICHAEAN_AYIN, /* Manichaean_Ayin */
551 UC_JOINING_GROUP_MANICHAEAN_PE, /* Manichaean_Pe */
552 UC_JOINING_GROUP_MANICHAEAN_SADHE, /* Manichaean_Sadhe */
553 UC_JOINING_GROUP_MANICHAEAN_QOPH, /* Manichaean_Qoph */
554 UC_JOINING_GROUP_MANICHAEAN_RESH, /* Manichaean_Resh */
555 UC_JOINING_GROUP_MANICHAEAN_TAW, /* Manichaean_Taw */
556 UC_JOINING_GROUP_MANICHAEAN_ONE, /* Manichaean_One */
557 UC_JOINING_GROUP_MANICHAEAN_FIVE, /* Manichaean_Five */
558 UC_JOINING_GROUP_MANICHAEAN_TEN, /* Manichaean_Ten */
559 UC_JOINING_GROUP_MANICHAEAN_TWENTY, /* Manichaean_Twenty */
560 UC_JOINING_GROUP_MANICHAEAN_HUNDRED, /* Manichaean_Hundred */
561 UC_JOINING_GROUP_AFRICAN_FEH, /* African_Feh */
562 UC_JOINING_GROUP_AFRICAN_QAF, /* African_Qaf */
563 UC_JOINING_GROUP_AFRICAN_NOON, /* African_Noon */
564 UC_JOINING_GROUP_MALAYALAM_NGA, /* Malayalam_Nga */
565 UC_JOINING_GROUP_MALAYALAM_JA, /* Malayalam_Ja */
566 UC_JOINING_GROUP_MALAYALAM_NYA, /* Malayalam_Nya */
567 UC_JOINING_GROUP_MALAYALAM_TTA, /* Malayalam_Tta */
568 UC_JOINING_GROUP_MALAYALAM_NNA, /* Malayalam_Nna */
569 UC_JOINING_GROUP_MALAYALAM_NNNA, /* Malayalam_Nnna */
570 UC_JOINING_GROUP_MALAYALAM_BHA, /* Malayalam_Bha */
571 UC_JOINING_GROUP_MALAYALAM_RA, /* Malayalam_Ra */
572 UC_JOINING_GROUP_MALAYALAM_LLA, /* Malayalam_Lla */
573 UC_JOINING_GROUP_MALAYALAM_LLLA, /* Malayalam_Llla */
574 UC_JOINING_GROUP_MALAYALAM_SSA, /* Malayalam_Ssa */
575 UC_JOINING_GROUP_HANIFI_ROHINGYA_PA, /* Hanifi_Rohingya_Pa */
576 UC_JOINING_GROUP_HANIFI_ROHINGYA_KINNA_YA, /* Hanifi_Rohingya_Kinna_Ya */
577 UC_JOINING_GROUP_THIN_YEH, /* Thin_Yeh */
578 UC_JOINING_GROUP_VERTICAL_TAIL /* Vertical_Tail */
579 };
580
581 /* Return the name of a joining group. */
582 extern const char *
583 uc_joining_group_name (int joining_group)
584 _UC_ATTRIBUTE_CONST;
585
586 /* Return the joining group given by name, e.g. "Teh_Marbuta". */
587 extern int
588 uc_joining_group_byname (const char *joining_group_name)
589 _UC_ATTRIBUTE_PURE;
590
591 /* Return the joining group of a Unicode character. */
592 extern int
593 uc_joining_group (ucs4_t uc)
594 _UC_ATTRIBUTE_CONST;
595
596 /* ========================================================================= */
597
598 /* Common API for properties. */
599
600 /* Data type denoting a property. This is not just a number, but rather a
601 pointer to the test functions, so that programs that use only few of the
602 properties don't have a link-time dependency towards all the tables. */
603 typedef struct
604 {
605 bool (*test_fn) (ucs4_t uc);
606 }
607 uc_property_t;
608
609 /* Predefined properties. */
610 /* General. */
611 extern @GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_WHITE_SPACE;
612 extern @GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ALPHABETIC;
613 extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ALPHABETIC;
614 extern @GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NOT_A_CHARACTER;
615 extern @GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT;
616 extern @GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT;
617 extern @GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DEPRECATED;
618 extern @GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LOGICAL_ORDER_EXCEPTION;
619 extern @GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_VARIATION_SELECTOR;
620 extern @GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PRIVATE_USE;
621 extern @GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UNASSIGNED_CODE_VALUE;
622 /* Case. */
623 extern @GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UPPERCASE;
624 extern @GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_UPPERCASE;
625 extern @GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LOWERCASE;
626 extern @GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_LOWERCASE;
627 extern @GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_TITLECASE;
628 extern @GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CASED;
629 extern @GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CASE_IGNORABLE;
630 extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_LOWERCASED;
631 extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_UPPERCASED;
632 extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_TITLECASED;
633 extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEFOLDED;
634 extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEMAPPED;
635 extern @GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SOFT_DOTTED;
636 /* Identifiers. */
637 extern @GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_START;
638 extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ID_START;
639 extern @GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_CONTINUE;
640 extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ID_CONTINUE;
641 extern @GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_XID_START;
642 extern @GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_XID_CONTINUE;
643 extern @GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PATTERN_WHITE_SPACE;
644 extern @GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PATTERN_SYNTAX;
645 /* Shaping and rendering. */
646 extern @GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_JOIN_CONTROL;
647 extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_BASE;
648 extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_EXTEND;
649 extern @GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_GRAPHEME_EXTEND;
650 extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_LINK;
651 /* Bidi. */
652 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_CONTROL;
653 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_LEFT_TO_RIGHT;
654 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT;
655 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT;
656 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUROPEAN_DIGIT;
657 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_SEPARATOR;
658 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_TERMINATOR;
659 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_ARABIC_DIGIT;
660 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_COMMON_SEPARATOR;
661 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_BLOCK_SEPARATOR;
662 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_SEGMENT_SEPARATOR;
663 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_WHITESPACE;
664 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_NON_SPACING_MARK;
665 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_BOUNDARY_NEUTRAL;
666 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_PDF;
667 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE;
668 extern @GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_OTHER_NEUTRAL;
669 /* Numeric. */
670 extern @GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_HEX_DIGIT;
671 extern @GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ASCII_HEX_DIGIT;
672 /* CJK. */
673 extern @GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDEOGRAPHIC;
674 extern @GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UNIFIED_IDEOGRAPH;
675 extern @GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_RADICAL;
676 extern @GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_BINARY_OPERATOR;
677 extern @GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_TRINARY_OPERATOR;
678 /* Emoji. */
679 extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI;
680 extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_PRESENTATION;
681 extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_MODIFIER;
682 extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_MODIFIER_BASE;
683 extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_COMPONENT;
684 extern @GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EXTENDED_PICTOGRAPHIC;
685 /* Misc. */
686 extern @GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ZERO_WIDTH;
687 extern @GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SPACE;
688 extern @GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NON_BREAK;
689 extern @GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ISO_CONTROL;
690 extern @GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_FORMAT_CONTROL;
691 extern @GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DASH;
692 extern @GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_HYPHEN;
693 extern @GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PUNCTUATION;
694 extern @GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LINE_SEPARATOR;
695 extern @GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PARAGRAPH_SEPARATOR;
696 extern @GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_QUOTATION_MARK;
697 extern @GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SENTENCE_TERMINAL;
698 extern @GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_TERMINAL_PUNCTUATION;
699 extern @GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CURRENCY_SYMBOL;
700 extern @GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_MATH;
701 extern @GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_MATH;
702 extern @GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PAIRED_PUNCTUATION;
703 extern @GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LEFT_OF_PAIR;
704 extern @GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_COMBINING;
705 extern @GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_COMPOSITE;
706 extern @GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DECIMAL_DIGIT;
707 extern @GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NUMERIC;
708 extern @GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DIACRITIC;
709 extern @GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EXTENDER;
710 extern @GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IGNORABLE_CONTROL;
711 extern @GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_REGIONAL_INDICATOR;
712
713 /* Return the property given by name, e.g. "White space". */
714 extern uc_property_t
715 uc_property_byname (const char *property_name);
716
717 /* Test whether a property is valid. */
718 #define uc_property_is_valid(property) ((property).test_fn != NULL)
719
720 /* Test whether a Unicode character has a given property. */
721 extern bool
722 uc_is_property (ucs4_t uc, uc_property_t property);
723 extern bool uc_is_property_white_space (ucs4_t uc)
724 _UC_ATTRIBUTE_CONST;
725 extern bool uc_is_property_alphabetic (ucs4_t uc)
726 _UC_ATTRIBUTE_CONST;
727 extern bool uc_is_property_other_alphabetic (ucs4_t uc)
728 _UC_ATTRIBUTE_CONST;
729 extern bool uc_is_property_not_a_character (ucs4_t uc)
730 _UC_ATTRIBUTE_CONST;
731 extern bool uc_is_property_default_ignorable_code_point (ucs4_t uc)
732 _UC_ATTRIBUTE_CONST;
733 extern bool uc_is_property_other_default_ignorable_code_point (ucs4_t uc)
734 _UC_ATTRIBUTE_CONST;
735 extern bool uc_is_property_deprecated (ucs4_t uc)
736 _UC_ATTRIBUTE_CONST;
737 extern bool uc_is_property_logical_order_exception (ucs4_t uc)
738 _UC_ATTRIBUTE_CONST;
739 extern bool uc_is_property_variation_selector (ucs4_t uc)
740 _UC_ATTRIBUTE_CONST;
741 extern bool uc_is_property_private_use (ucs4_t uc)
742 _UC_ATTRIBUTE_CONST;
743 extern bool uc_is_property_unassigned_code_value (ucs4_t uc)
744 _UC_ATTRIBUTE_CONST;
745 extern bool uc_is_property_uppercase (ucs4_t uc)
746 _UC_ATTRIBUTE_CONST;
747 extern bool uc_is_property_other_uppercase (ucs4_t uc)
748 _UC_ATTRIBUTE_CONST;
749 extern bool uc_is_property_lowercase (ucs4_t uc)
750 _UC_ATTRIBUTE_CONST;
751 extern bool uc_is_property_other_lowercase (ucs4_t uc)
752 _UC_ATTRIBUTE_CONST;
753 extern bool uc_is_property_titlecase (ucs4_t uc)
754 _UC_ATTRIBUTE_CONST;
755 extern bool uc_is_property_cased (ucs4_t uc)
756 _UC_ATTRIBUTE_CONST;
757 extern bool uc_is_property_case_ignorable (ucs4_t uc)
758 _UC_ATTRIBUTE_CONST;
759 extern bool uc_is_property_changes_when_lowercased (ucs4_t uc)
760 _UC_ATTRIBUTE_CONST;
761 extern bool uc_is_property_changes_when_uppercased (ucs4_t uc)
762 _UC_ATTRIBUTE_CONST;
763 extern bool uc_is_property_changes_when_titlecased (ucs4_t uc)
764 _UC_ATTRIBUTE_CONST;
765 extern bool uc_is_property_changes_when_casefolded (ucs4_t uc)
766 _UC_ATTRIBUTE_CONST;
767 extern bool uc_is_property_changes_when_casemapped (ucs4_t uc)
768 _UC_ATTRIBUTE_CONST;
769 extern bool uc_is_property_soft_dotted (ucs4_t uc)
770 _UC_ATTRIBUTE_CONST;
771 extern bool uc_is_property_id_start (ucs4_t uc)
772 _UC_ATTRIBUTE_CONST;
773 extern bool uc_is_property_other_id_start (ucs4_t uc)
774 _UC_ATTRIBUTE_CONST;
775 extern bool uc_is_property_id_continue (ucs4_t uc)
776 _UC_ATTRIBUTE_CONST;
777 extern bool uc_is_property_other_id_continue (ucs4_t uc)
778 _UC_ATTRIBUTE_CONST;
779 extern bool uc_is_property_xid_start (ucs4_t uc)
780 _UC_ATTRIBUTE_CONST;
781 extern bool uc_is_property_xid_continue (ucs4_t uc)
782 _UC_ATTRIBUTE_CONST;
783 extern bool uc_is_property_pattern_white_space (ucs4_t uc)
784 _UC_ATTRIBUTE_CONST;
785 extern bool uc_is_property_pattern_syntax (ucs4_t uc)
786 _UC_ATTRIBUTE_CONST;
787 extern bool uc_is_property_join_control (ucs4_t uc)
788 _UC_ATTRIBUTE_CONST;
789 extern bool uc_is_property_grapheme_base (ucs4_t uc)
790 _UC_ATTRIBUTE_CONST;
791 extern bool uc_is_property_grapheme_extend (ucs4_t uc)
792 _UC_ATTRIBUTE_CONST;
793 extern bool uc_is_property_other_grapheme_extend (ucs4_t uc)
794 _UC_ATTRIBUTE_CONST;
795 extern bool uc_is_property_grapheme_link (ucs4_t uc)
796 _UC_ATTRIBUTE_CONST;
797 extern bool uc_is_property_bidi_control (ucs4_t uc)
798 _UC_ATTRIBUTE_CONST;
799 extern bool uc_is_property_bidi_left_to_right (ucs4_t uc)
800 _UC_ATTRIBUTE_CONST;
801 extern bool uc_is_property_bidi_hebrew_right_to_left (ucs4_t uc)
802 _UC_ATTRIBUTE_CONST;
803 extern bool uc_is_property_bidi_arabic_right_to_left (ucs4_t uc)
804 _UC_ATTRIBUTE_CONST;
805 extern bool uc_is_property_bidi_european_digit (ucs4_t uc)
806 _UC_ATTRIBUTE_CONST;
807 extern bool uc_is_property_bidi_eur_num_separator (ucs4_t uc)
808 _UC_ATTRIBUTE_CONST;
809 extern bool uc_is_property_bidi_eur_num_terminator (ucs4_t uc)
810 _UC_ATTRIBUTE_CONST;
811 extern bool uc_is_property_bidi_arabic_digit (ucs4_t uc)
812 _UC_ATTRIBUTE_CONST;
813 extern bool uc_is_property_bidi_common_separator (ucs4_t uc)
814 _UC_ATTRIBUTE_CONST;
815 extern bool uc_is_property_bidi_block_separator (ucs4_t uc)
816 _UC_ATTRIBUTE_CONST;
817 extern bool uc_is_property_bidi_segment_separator (ucs4_t uc)
818 _UC_ATTRIBUTE_CONST;
819 extern bool uc_is_property_bidi_whitespace (ucs4_t uc)
820 _UC_ATTRIBUTE_CONST;
821 extern bool uc_is_property_bidi_non_spacing_mark (ucs4_t uc)
822 _UC_ATTRIBUTE_CONST;
823 extern bool uc_is_property_bidi_boundary_neutral (ucs4_t uc)
824 _UC_ATTRIBUTE_CONST;
825 extern bool uc_is_property_bidi_pdf (ucs4_t uc)
826 _UC_ATTRIBUTE_CONST;
827 extern bool uc_is_property_bidi_embedding_or_override (ucs4_t uc)
828 _UC_ATTRIBUTE_CONST;
829 extern bool uc_is_property_bidi_other_neutral (ucs4_t uc)
830 _UC_ATTRIBUTE_CONST;
831 extern bool uc_is_property_hex_digit (ucs4_t uc)
832 _UC_ATTRIBUTE_CONST;
833 extern bool uc_is_property_ascii_hex_digit (ucs4_t uc)
834 _UC_ATTRIBUTE_CONST;
835 extern bool uc_is_property_ideographic (ucs4_t uc)
836 _UC_ATTRIBUTE_CONST;
837 extern bool uc_is_property_unified_ideograph (ucs4_t uc)
838 _UC_ATTRIBUTE_CONST;
839 extern bool uc_is_property_radical (ucs4_t uc)
840 _UC_ATTRIBUTE_CONST;
841 extern bool uc_is_property_ids_binary_operator (ucs4_t uc)
842 _UC_ATTRIBUTE_CONST;
843 extern bool uc_is_property_ids_trinary_operator (ucs4_t uc)
844 _UC_ATTRIBUTE_CONST;
845 extern bool uc_is_property_emoji (ucs4_t uc)
846 _UC_ATTRIBUTE_CONST;
847 extern bool uc_is_property_emoji_presentation (ucs4_t uc)
848 _UC_ATTRIBUTE_CONST;
849 extern bool uc_is_property_emoji_modifier (ucs4_t uc)
850 _UC_ATTRIBUTE_CONST;
851 extern bool uc_is_property_emoji_modifier_base (ucs4_t uc)
852 _UC_ATTRIBUTE_CONST;
853 extern bool uc_is_property_emoji_component (ucs4_t uc)
854 _UC_ATTRIBUTE_CONST;
855 extern bool uc_is_property_extended_pictographic (ucs4_t uc)
856 _UC_ATTRIBUTE_CONST;
857 extern bool uc_is_property_zero_width (ucs4_t uc)
858 _UC_ATTRIBUTE_CONST;
859 extern bool uc_is_property_space (ucs4_t uc)
860 _UC_ATTRIBUTE_CONST;
861 extern bool uc_is_property_non_break (ucs4_t uc)
862 _UC_ATTRIBUTE_CONST;
863 extern bool uc_is_property_iso_control (ucs4_t uc)
864 _UC_ATTRIBUTE_CONST;
865 extern bool uc_is_property_format_control (ucs4_t uc)
866 _UC_ATTRIBUTE_CONST;
867 extern bool uc_is_property_dash (ucs4_t uc)
868 _UC_ATTRIBUTE_CONST;
869 extern bool uc_is_property_hyphen (ucs4_t uc)
870 _UC_ATTRIBUTE_CONST;
871 extern bool uc_is_property_punctuation (ucs4_t uc)
872 _UC_ATTRIBUTE_CONST;
873 extern bool uc_is_property_line_separator (ucs4_t uc)
874 _UC_ATTRIBUTE_CONST;
875 extern bool uc_is_property_paragraph_separator (ucs4_t uc)
876 _UC_ATTRIBUTE_CONST;
877 extern bool uc_is_property_quotation_mark (ucs4_t uc)
878 _UC_ATTRIBUTE_CONST;
879 extern bool uc_is_property_sentence_terminal (ucs4_t uc)
880 _UC_ATTRIBUTE_CONST;
881 extern bool uc_is_property_terminal_punctuation (ucs4_t uc)
882 _UC_ATTRIBUTE_CONST;
883 extern bool uc_is_property_currency_symbol (ucs4_t uc)
884 _UC_ATTRIBUTE_CONST;
885 extern bool uc_is_property_math (ucs4_t uc)
886 _UC_ATTRIBUTE_CONST;
887 extern bool uc_is_property_other_math (ucs4_t uc)
888 _UC_ATTRIBUTE_CONST;
889 extern bool uc_is_property_paired_punctuation (ucs4_t uc)
890 _UC_ATTRIBUTE_CONST;
891 extern bool uc_is_property_left_of_pair (ucs4_t uc)
892 _UC_ATTRIBUTE_CONST;
893 extern bool uc_is_property_combining (ucs4_t uc)
894 _UC_ATTRIBUTE_CONST;
895 extern bool uc_is_property_composite (ucs4_t uc)
896 _UC_ATTRIBUTE_CONST;
897 extern bool uc_is_property_decimal_digit (ucs4_t uc)
898 _UC_ATTRIBUTE_CONST;
899 extern bool uc_is_property_numeric (ucs4_t uc)
900 _UC_ATTRIBUTE_CONST;
901 extern bool uc_is_property_diacritic (ucs4_t uc)
902 _UC_ATTRIBUTE_CONST;
903 extern bool uc_is_property_extender (ucs4_t uc)
904 _UC_ATTRIBUTE_CONST;
905 extern bool uc_is_property_ignorable_control (ucs4_t uc)
906 _UC_ATTRIBUTE_CONST;
907 extern bool uc_is_property_regional_indicator (ucs4_t uc)
908 _UC_ATTRIBUTE_CONST;
909
910 /* ========================================================================= */
911
912 /* Subdivision of the Unicode characters into scripts. */
913
914 typedef struct
915 {
916 unsigned int code : 21;
917 unsigned int start : 1;
918 unsigned int end : 1;
919 }
920 uc_interval_t;
921 typedef struct
922 {
923 unsigned int nintervals;
924 const uc_interval_t *intervals;
925 const char *name;
926 }
927 uc_script_t;
928
929 /* Return the script of a Unicode character. */
930 extern const uc_script_t *
931 uc_script (ucs4_t uc)
932 _UC_ATTRIBUTE_CONST;
933
934 /* Return the script given by name, e.g. "HAN". */
935 extern const uc_script_t *
936 uc_script_byname (const char *script_name)
937 _UC_ATTRIBUTE_PURE;
938
939 /* Test whether a Unicode character belongs to a given script. */
940 extern bool
941 uc_is_script (ucs4_t uc, const uc_script_t *script)
942 _UC_ATTRIBUTE_PURE;
943
944 /* Get the list of all scripts. */
945 extern void
946 uc_all_scripts (const uc_script_t **scripts, size_t *count);
947
948 /* ========================================================================= */
949
950 /* Subdivision of the Unicode character range into blocks. */
951
952 typedef struct
953 {
954 ucs4_t start;
955 ucs4_t end;
956 const char *name;
957 }
958 uc_block_t;
959
960 /* Return the block a character belongs to. */
961 extern const uc_block_t *
962 uc_block (ucs4_t uc)
963 _UC_ATTRIBUTE_CONST;
964
965 /* Test whether a Unicode character belongs to a given block. */
966 extern bool
967 uc_is_block (ucs4_t uc, const uc_block_t *block)
968 _UC_ATTRIBUTE_PURE;
969
970 /* Get the list of all blocks. */
971 extern void
972 uc_all_blocks (const uc_block_t **blocks, size_t *count);
973
974 /* ========================================================================= */
975
976 /* Properties taken from language standards. */
977
978 /* Test whether a Unicode character is considered whitespace in ISO C 99. */
979 extern bool
980 uc_is_c_whitespace (ucs4_t uc)
981 _UC_ATTRIBUTE_CONST;
982
983 /* Test whether a Unicode character is considered whitespace in Java. */
984 extern bool
985 uc_is_java_whitespace (ucs4_t uc)
986 _UC_ATTRIBUTE_CONST;
987
988 enum
989 {
990 UC_IDENTIFIER_START, /* valid as first or subsequent character */
991 UC_IDENTIFIER_VALID, /* valid as subsequent character only */
992 UC_IDENTIFIER_INVALID, /* not valid */
993 UC_IDENTIFIER_IGNORABLE /* ignorable (Java only) */
994 };
995
996 /* Return the categorization of a Unicode character w.r.t. the ISO C 99
997 identifier syntax. */
998 extern int
999 uc_c_ident_category (ucs4_t uc)
1000 _UC_ATTRIBUTE_CONST;
1001
1002 /* Return the categorization of a Unicode character w.r.t. the Java
1003 identifier syntax. */
1004 extern int
1005 uc_java_ident_category (ucs4_t uc)
1006 _UC_ATTRIBUTE_CONST;
1007
1008 /* ========================================================================= */
1009
1010 /* Like ISO C <ctype.h> and <wctype.h>. These functions are deprecated,
1011 because this set of functions was designed with ASCII in mind and cannot
1012 reflect the more diverse reality of the Unicode character set. But they
1013 can be a quick-and-dirty porting aid when migrating from wchar_t APIs
1014 to Unicode strings. */
1015
1016 /* Test for any character for which 'uc_is_alpha' or 'uc_is_digit' is true. */
1017 extern bool
1018 uc_is_alnum (ucs4_t uc)
1019 _UC_ATTRIBUTE_CONST;
1020
1021 /* Test for any character for which 'uc_is_upper' or 'uc_is_lower' is true,
1022 or any character that is one of a locale-specific set of characters for
1023 which none of 'uc_is_cntrl', 'uc_is_digit', 'uc_is_punct', or 'uc_is_space'
1024 is true. */
1025 extern bool
1026 uc_is_alpha (ucs4_t uc)
1027 _UC_ATTRIBUTE_CONST;
1028
1029 /* Test for any control character. */
1030 extern bool
1031 uc_is_cntrl (ucs4_t uc)
1032 _UC_ATTRIBUTE_CONST;
1033
1034 /* Test for any character that corresponds to a decimal-digit character. */
1035 extern bool
1036 uc_is_digit (ucs4_t uc)
1037 _UC_ATTRIBUTE_CONST;
1038
1039 /* Test for any character for which 'uc_is_print' is true and 'uc_is_space'
1040 is false. */
1041 extern bool
1042 uc_is_graph (ucs4_t uc)
1043 _UC_ATTRIBUTE_CONST;
1044
1045 /* Test for any character that corresponds to a lowercase letter or is one
1046 of a locale-specific set of characters for which none of 'uc_is_cntrl',
1047 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */
1048 extern bool
1049 uc_is_lower (ucs4_t uc)
1050 _UC_ATTRIBUTE_CONST;
1051
1052 /* Test for any printing character. */
1053 extern bool
1054 uc_is_print (ucs4_t uc)
1055 _UC_ATTRIBUTE_CONST;
1056
1057 /* Test for any printing character that is one of a locale-specific set of
1058 characters for which neither 'uc_is_space' nor 'uc_is_alnum' is true. */
1059 extern bool
1060 uc_is_punct (ucs4_t uc)
1061 _UC_ATTRIBUTE_CONST;
1062
1063 /* Test for any character that corresponds to a locale-specific set of
1064 characters for which none of 'uc_is_alnum', 'uc_is_graph', or 'uc_is_punct'
1065 is true. */
1066 extern bool
1067 uc_is_space (ucs4_t uc)
1068 _UC_ATTRIBUTE_CONST;
1069
1070 /* Test for any character that corresponds to an uppercase letter or is one
1071 of a locale-specific set of character for which none of 'uc_is_cntrl',
1072 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */
1073 extern bool
1074 uc_is_upper (ucs4_t uc)
1075 _UC_ATTRIBUTE_CONST;
1076
1077 /* Test for any character that corresponds to a hexadecimal-digit
1078 character. */
1079 extern bool
1080 uc_is_xdigit (ucs4_t uc)
1081 _UC_ATTRIBUTE_CONST;
1082
1083 /* GNU extension. */
1084 /* Test for any character that corresponds to a standard blank character or
1085 a locale-specific set of characters for which 'uc_is_alnum' is false. */
1086 extern bool
1087 uc_is_blank (ucs4_t uc)
1088 _UC_ATTRIBUTE_CONST;
1089
1090 /* ========================================================================= */
1091
1092 #ifdef __cplusplus
1093 }
1094 #endif
1095
1096 #endif /* _UNICTYPE_H */