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