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