Debian Codegraph @

lib/unicase/special-casing.in.h

raw
1 /* Special casing table.
2 Copyright (C) 2009-2024 Free Software Foundation, Inc.
3 Written by Bruno Haible <[email protected]>, 2009.
4
5 This file is free software.
6 It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
7 You can redistribute it and/or modify it under either
8 - the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation, either version 3, or (at your
10 option) any later version, or
11 - the terms of the GNU General Public License as published by the
12 Free Software Foundation; either version 2, or (at your option)
13 any later version, or
14 - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
15
16 This file is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License and the GNU General Public License
20 for more details.
21
22 You should have received a copy of the GNU Lesser General Public
23 License and of the GNU General Public License along with this
24 program. If not, see <https://www.gnu.org/licenses/>. */
25
26 #include <stddef.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32
33 /* A special casing context.
34 A context is negated through x -> -x. */
35 enum
36 {
37 SCC_ALWAYS = 0,
38 SCC_FINAL_SIGMA = 1,
39 SCC_AFTER_SOFT_DOTTED = 2,
40 SCC_MORE_ABOVE = 3,
41 SCC_BEFORE_DOT = 4,
42 SCC_AFTER_I = 5
43 };
44
45 struct special_casing_rule
46 {
47 /* The first two bytes are the code, in big-endian order. The third byte
48 only distinguishes different rules pertaining to the same code. */
49 /*unsigned*/ char code[3];
50
51 /* True when this rule is not the last one for the given code. */
52 /*bool*/ unsigned int has_next : 1;
53
54 /* Context. */
55 signed int context : 7;
56
57 /* Language, or an empty string. */
58 char language[2];
59
60 /* Mapping to upper case. Between 0 and 3 characters. Filled with 0s. */
61 unsigned short upper[3];
62
63 /* Mapping to lower case. Between 0 and 3 characters. Filled with 0s. */
64 unsigned short lower[3];
65
66 /* Mapping to title case. Between 0 and 3 characters. Filled with 0s. */
67 unsigned short title[3];
68
69 /* Casefolding mapping. Between 0 and 3 characters. Filled with 0s. */
70 unsigned short casefold[3];
71 };
72
73 extern const struct special_casing_rule *
74 gl_unicase_special_lookup (const char *str, size_t len);
75
76
77 #ifdef __cplusplus
78 }
79 #endif