maint: update copyright
[gnulib.git] / lib / unicase / context.h
1 /* Case-mapping contexts of UTF-8/UTF-16/UTF-32 substring.
2    Copyright (C) 2009-2014 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 /* The context of a prefix string combines the information of the "Before C"
20    conditions of the Unicode Standard,
21    <http://www.unicode.org/versions/Unicode5.0.0/ch03.pdf>, section 3.13,
22    table 3-14 "Context Specification for Casing".
23
24    casing_prefix_context_t contains the following fields:
25
26      // Helper for evaluating the FINAL_SIGMA condition:
27      //  Last character that was not case-ignorable.
28      ucs4_t last_char_except_ignorable;
29
30      // Helper for evaluating the AFTER_SOFT_DOTTED and AFTER_I conditions:
31      // Last character that was of combining class 230 ("Above") or 0.
32      ucs4_t last_char_normal_or_above;
33
34    Three bits would be sufficient to carry the context information, but
35    that would require to invoke uc_is_cased and uc_is_property_soft_dotted
36    ahead of time, more often than actually needed.  */
37
38
39 /* The context of a suffix string combines the information of the "After C"
40    conditions of the Unicode Standard,
41    <http://www.unicode.org/versions/Unicode5.0.0/ch03.pdf>, section 3.13,
42    table 3-14 "Context Specification for Casing".
43
44    casing_suffix_context_t contains the following fields:
45
46      // For evaluating the FINAL_SIGMA condition:
47      //  First character that was not case-ignorable.
48      ucs4_t first_char_except_ignorable;
49
50      // For evaluating the MORE_ABOVE condition:
51      // Bit 0 is set if the suffix contains a character of combining class
52      // 230 (Above) with no character of combining class 0 or 230 (Above)
53      // before it.
54      //
55      // For evaluating the BEFORE_DOT condition:
56      // Bit 1 is set if the suffix contains a COMBINING DOT ABOVE (U+0307)
57      // with no character of combining class 0 or 230 (Above) before it.
58      //
59      uint32_t bits;
60
61    Three bits would be sufficient to carry the context information, but
62    that would require to invoke uc_is_cased ahead of time, more often than
63    actually needed.  */
64 #define SCC_MORE_ABOVE_MASK  1
65 #define SCC_BEFORE_DOT_MASK  2