Mercurial > hg > octave-kai > gnulib-hg
annotate lib/gen-uni-tables.c @ 11639:b2e769838448
hash: fix memory leak in last patch
* lib/hash.c (hash_rehash): Avoid memory leak.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Thu, 18 Jun 2009 15:24:38 -0600 |
parents | 1688f282d648 |
children | 336613691e47 |
rev | line source |
---|---|
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* Generate Unicode conforming character classification tables and |
11141
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
2 line break properties tables and word break property tables and |
11176
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
3 decomposition/composition and case mapping tables from a UnicodeData file. |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 Copyright (C) 2000-2002, 2004, 2007-2009 Free Software Foundation, Inc. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 Written by Bruno Haible <bruno@clisp.org>, 2000-2002. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 This program is free software: you can redistribute it and/or modify |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 it under the terms of the GNU General Public License as published by |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 (at your option) any later version. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 This program is distributed in the hope that it will be useful, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 GNU General Public License for more details. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 /* Usage example: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 $ gen-uni-tables /usr/local/share/Unidata/UnicodeData.txt \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 /usr/local/share/Unidata/PropList.txt \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 /usr/local/share/Unidata/DerivedCoreProperties.txt \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 /usr/local/share/Unidata/Scripts.txt \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 /usr/local/share/Unidata/Blocks.txt \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 /usr/local/share/Unidata/PropList-3.0.1.txt \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 /usr/local/share/Unidata/EastAsianWidth.txt \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 /usr/local/share/Unidata/LineBreak.txt \ |
11132
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
29 /usr/local/share/Unidata/WordBreakProperty.txt \ |
11176
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
30 /usr/local/share/Unidata/CompositionExclusions.txt \ |
11303
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
31 /usr/local/share/Unidata/SpecialCasing.txt \ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
32 /usr/local/share/Unidata/CaseFolding.txt \ |
11127 | 33 5.1.0 |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 #include <stdbool.h> |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 #include <stdint.h> |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 #include <stdio.h> |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 #include <stdlib.h> |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 #include <string.h> |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 #include <time.h> |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
45 /* Reading UnicodeData.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
46 /* See UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
47 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 /* This structure represents one line in the UnicodeData.txt file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 struct unicode_attribute |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 const char *name; /* Character name */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 const char *category; /* General category */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 const char *combining; /* Canonical combining class */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 const char *bidi; /* Bidirectional category */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 const char *decomposition; /* Character decomposition mapping */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 const char *decdigit; /* Decimal digit value */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 const char *digit; /* Digit value */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 const char *numeric; /* Numeric value */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 bool mirrored; /* mirrored */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 const char *oldname; /* Old Unicode 1.0 name */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 const char *comment; /* Comment */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
62 unsigned int upper; /* Uppercase mapping */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
63 unsigned int lower; /* Lowercase mapping */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
64 unsigned int title; /* Titlecase mapping */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 }; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
66 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
67 /* Missing fields are represented with "" for strings, and NONE for |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
68 characters. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
69 #define NONE (~(unsigned int)0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
70 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
71 /* The entire contents of the UnicodeData.txt file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
72 struct unicode_attribute unicode_attributes [0x110000]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
73 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
74 /* Stores in unicode_attributes[i] the values from the given fields. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
75 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
76 fill_attribute (unsigned int i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
77 const char *field1, const char *field2, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
78 const char *field3, const char *field4, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
79 const char *field5, const char *field6, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
80 const char *field7, const char *field8, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
81 const char *field9, const char *field10, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
82 const char *field11, const char *field12, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
83 const char *field13, const char *field14) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
84 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
85 struct unicode_attribute * uni; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
86 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
87 if (i >= 0x110000) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
88 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
89 fprintf (stderr, "index too large\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
90 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
91 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
92 if (strcmp (field2, "Cs") == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
93 /* Surrogates are UTF-16 artefacts, not real characters. Ignore them. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
94 return; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
95 uni = &unicode_attributes[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
96 /* Copy the strings. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
97 uni->name = strdup (field1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
98 uni->category = (field2[0] == '\0' ? "" : strdup (field2)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
99 uni->combining = (field3[0] == '\0' ? "" : strdup (field3)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
100 uni->bidi = (field4[0] == '\0' ? "" : strdup (field4)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
101 uni->decomposition = (field5[0] == '\0' ? "" : strdup (field5)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
102 uni->decdigit = (field6[0] == '\0' ? "" : strdup (field6)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
103 uni->digit = (field7[0] == '\0' ? "" : strdup (field7)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
104 uni->numeric = (field8[0] == '\0' ? "" : strdup (field8)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
105 uni->mirrored = (field9[0] == 'Y'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
106 uni->oldname = (field10[0] == '\0' ? "" : strdup (field10)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
107 uni->comment = (field11[0] == '\0' ? "" : strdup (field11)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
108 uni->upper = (field12[0] =='\0' ? NONE : strtoul (field12, NULL, 16)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
109 uni->lower = (field13[0] =='\0' ? NONE : strtoul (field13, NULL, 16)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
110 uni->title = (field14[0] =='\0' ? NONE : strtoul (field14, NULL, 16)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
111 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
112 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
113 /* Maximum length of a field in the UnicodeData.txt file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
114 #define FIELDLEN 120 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
115 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
116 /* Reads the next field from STREAM. The buffer BUFFER has size FIELDLEN. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
117 Reads up to (but excluding) DELIM. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
118 Returns 1 when a field was successfully read, otherwise 0. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
119 static int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
120 getfield (FILE *stream, char *buffer, int delim) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
121 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
122 int count = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
123 int c; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
124 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
125 for (; (c = getc (stream)), (c != EOF && c != delim); ) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
126 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
127 /* The original unicode.org UnicodeData.txt file happens to have |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
128 CR/LF line terminators. Silently convert to LF. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
129 if (c == '\r') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
130 continue; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
131 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
132 /* Put c into the buffer. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
133 if (++count >= FIELDLEN - 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
134 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
135 fprintf (stderr, "field longer than expected, increase FIELDLEN\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
136 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
137 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
138 *buffer++ = c; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
139 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
140 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
141 if (c == EOF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
142 return 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
143 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
144 *buffer = '\0'; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
145 return 1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
146 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
147 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
148 /* Stores in unicode_attributes[] the entire contents of the UnicodeData.txt |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
149 file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
150 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
151 fill_attributes (const char *unicodedata_filename) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
152 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
153 unsigned int i, j; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
154 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
155 char field0[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
156 char field1[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
157 char field2[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
158 char field3[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
159 char field4[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
160 char field5[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
161 char field6[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
162 char field7[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
163 char field8[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
164 char field9[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
165 char field10[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
166 char field11[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
167 char field12[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
168 char field13[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
169 char field14[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
170 int lineno = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
171 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
172 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
173 unicode_attributes[i].name = NULL; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
174 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
175 stream = fopen (unicodedata_filename, "r"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
176 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
177 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
178 fprintf (stderr, "error during fopen of '%s'\n", unicodedata_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
179 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
180 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
181 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
182 for (;;) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
183 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
184 int n; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
185 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
186 lineno++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
187 n = getfield (stream, field0, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
188 n += getfield (stream, field1, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
189 n += getfield (stream, field2, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
190 n += getfield (stream, field3, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
191 n += getfield (stream, field4, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
192 n += getfield (stream, field5, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
193 n += getfield (stream, field6, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
194 n += getfield (stream, field7, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
195 n += getfield (stream, field8, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
196 n += getfield (stream, field9, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
197 n += getfield (stream, field10, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
198 n += getfield (stream, field11, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
199 n += getfield (stream, field12, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
200 n += getfield (stream, field13, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
201 n += getfield (stream, field14, '\n'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
202 if (n == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
203 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
204 if (n != 15) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
205 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
206 fprintf (stderr, "short line in '%s':%d\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
207 unicodedata_filename, lineno); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
208 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
209 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
210 i = strtoul (field0, NULL, 16); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
211 if (field1[0] == '<' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
212 && strlen (field1) >= 9 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
213 && strcmp (field1 + strlen(field1) - 8, ", First>") == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
214 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
215 /* Deal with a range. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
216 lineno++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
217 n = getfield (stream, field0, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
218 n += getfield (stream, field1, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
219 n += getfield (stream, field2, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
220 n += getfield (stream, field3, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
221 n += getfield (stream, field4, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
222 n += getfield (stream, field5, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
223 n += getfield (stream, field6, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
224 n += getfield (stream, field7, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
225 n += getfield (stream, field8, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
226 n += getfield (stream, field9, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
227 n += getfield (stream, field10, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
228 n += getfield (stream, field11, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
229 n += getfield (stream, field12, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
230 n += getfield (stream, field13, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
231 n += getfield (stream, field14, '\n'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
232 if (n != 15) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
233 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
234 fprintf (stderr, "missing end range in '%s':%d\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
235 unicodedata_filename, lineno); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
236 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
237 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
238 if (!(field1[0] == '<' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
239 && strlen (field1) >= 8 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
240 && strcmp (field1 + strlen (field1) - 7, ", Last>") == 0)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
241 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
242 fprintf (stderr, "missing end range in '%s':%d\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
243 unicodedata_filename, lineno); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
244 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
245 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
246 field1[strlen (field1) - 7] = '\0'; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
247 j = strtoul (field0, NULL, 16); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
248 for (; i <= j; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
249 fill_attribute (i, field1+1, field2, field3, field4, field5, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
250 field6, field7, field8, field9, field10, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
251 field11, field12, field13, field14); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
252 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
253 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
254 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
255 /* Single character line */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
256 fill_attribute (i, field1, field2, field3, field4, field5, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
257 field6, field7, field8, field9, field10, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
258 field11, field12, field13, field14); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
259 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
260 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
261 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
262 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
263 fprintf (stderr, "error reading from '%s'\n", unicodedata_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
264 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
265 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
266 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
267 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
268 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
269 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
270 /* General category. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
271 /* See Unicode 3.0 book, section 4.5, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
272 UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
273 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
274 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
275 is_category_L (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
276 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
277 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
278 && unicode_attributes[ch].category[0] == 'L'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
279 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
280 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
281 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
282 is_category_Lu (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
283 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
284 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
285 && unicode_attributes[ch].category[0] == 'L' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
286 && unicode_attributes[ch].category[1] == 'u'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
287 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
288 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
289 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
290 is_category_Ll (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
291 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
292 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
293 && unicode_attributes[ch].category[0] == 'L' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
294 && unicode_attributes[ch].category[1] == 'l'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
295 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
296 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
297 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
298 is_category_Lt (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
299 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
300 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
301 && unicode_attributes[ch].category[0] == 'L' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
302 && unicode_attributes[ch].category[1] == 't'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
303 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
304 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
305 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
306 is_category_Lm (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
307 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
308 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
309 && unicode_attributes[ch].category[0] == 'L' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
310 && unicode_attributes[ch].category[1] == 'm'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
311 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
312 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
313 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
314 is_category_Lo (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
315 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
316 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
317 && unicode_attributes[ch].category[0] == 'L' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
318 && unicode_attributes[ch].category[1] == 'o'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
319 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
320 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
321 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
322 is_category_M (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
323 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
324 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
325 && unicode_attributes[ch].category[0] == 'M'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
326 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
327 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
328 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
329 is_category_Mn (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
330 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
331 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
332 && unicode_attributes[ch].category[0] == 'M' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
333 && unicode_attributes[ch].category[1] == 'n'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
334 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
335 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
336 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
337 is_category_Mc (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
338 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
339 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
340 && unicode_attributes[ch].category[0] == 'M' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
341 && unicode_attributes[ch].category[1] == 'c'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
342 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
343 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
344 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
345 is_category_Me (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
346 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
347 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
348 && unicode_attributes[ch].category[0] == 'M' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
349 && unicode_attributes[ch].category[1] == 'e'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
350 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
351 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
352 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
353 is_category_N (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
354 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
355 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
356 && unicode_attributes[ch].category[0] == 'N'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
357 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
358 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
359 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
360 is_category_Nd (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
361 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
362 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
363 && unicode_attributes[ch].category[0] == 'N' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
364 && unicode_attributes[ch].category[1] == 'd'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
365 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
366 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
367 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
368 is_category_Nl (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
369 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
370 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
371 && unicode_attributes[ch].category[0] == 'N' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
372 && unicode_attributes[ch].category[1] == 'l'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
373 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
374 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
375 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
376 is_category_No (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
377 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
378 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
379 && unicode_attributes[ch].category[0] == 'N' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
380 && unicode_attributes[ch].category[1] == 'o'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
381 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
382 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
383 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
384 is_category_P (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
385 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
386 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
387 && unicode_attributes[ch].category[0] == 'P'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
388 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
389 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
390 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
391 is_category_Pc (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
392 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
393 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
394 && unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
395 && unicode_attributes[ch].category[1] == 'c'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
396 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
397 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
398 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
399 is_category_Pd (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
400 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
401 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
402 && unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
403 && unicode_attributes[ch].category[1] == 'd'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
404 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
405 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
406 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
407 is_category_Ps (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
408 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
409 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
410 && unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
411 && unicode_attributes[ch].category[1] == 's'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
412 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
413 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
414 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
415 is_category_Pe (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
416 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
417 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
418 && unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
419 && unicode_attributes[ch].category[1] == 'e'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
420 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
421 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
422 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
423 is_category_Pi (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
424 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
425 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
426 && unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
427 && unicode_attributes[ch].category[1] == 'i'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
428 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
429 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
430 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
431 is_category_Pf (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
432 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
433 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
434 && unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
435 && unicode_attributes[ch].category[1] == 'f'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
436 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
437 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
438 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
439 is_category_Po (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
440 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
441 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
442 && unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
443 && unicode_attributes[ch].category[1] == 'o'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
444 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
445 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
446 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
447 is_category_S (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
448 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
449 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
450 && unicode_attributes[ch].category[0] == 'S'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
451 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
452 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
453 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
454 is_category_Sm (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
455 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
456 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
457 && unicode_attributes[ch].category[0] == 'S' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
458 && unicode_attributes[ch].category[1] == 'm'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
459 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
460 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
461 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
462 is_category_Sc (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
463 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
464 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
465 && unicode_attributes[ch].category[0] == 'S' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
466 && unicode_attributes[ch].category[1] == 'c'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
467 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
468 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
469 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
470 is_category_Sk (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
471 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
472 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
473 && unicode_attributes[ch].category[0] == 'S' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
474 && unicode_attributes[ch].category[1] == 'k'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
475 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
476 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
477 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
478 is_category_So (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
479 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
480 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
481 && unicode_attributes[ch].category[0] == 'S' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
482 && unicode_attributes[ch].category[1] == 'o'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
483 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
484 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
485 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
486 is_category_Z (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
487 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
488 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
489 && unicode_attributes[ch].category[0] == 'Z'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
490 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
491 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
492 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
493 is_category_Zs (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
494 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
495 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
496 && unicode_attributes[ch].category[0] == 'Z' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
497 && unicode_attributes[ch].category[1] == 's'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
498 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
499 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
500 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
501 is_category_Zl (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
502 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
503 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
504 && unicode_attributes[ch].category[0] == 'Z' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
505 && unicode_attributes[ch].category[1] == 'l'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
506 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
507 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
508 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
509 is_category_Zp (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
510 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
511 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
512 && unicode_attributes[ch].category[0] == 'Z' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
513 && unicode_attributes[ch].category[1] == 'p'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
514 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
515 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
516 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
517 is_category_C (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
518 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
519 return (unicode_attributes[ch].name == NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
520 || unicode_attributes[ch].category[0] == 'C'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
521 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
522 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
523 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
524 is_category_Cc (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
525 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
526 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
527 && unicode_attributes[ch].category[0] == 'C' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
528 && unicode_attributes[ch].category[1] == 'c'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
529 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
530 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
531 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
532 is_category_Cf (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
533 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
534 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
535 && unicode_attributes[ch].category[0] == 'C' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
536 && unicode_attributes[ch].category[1] == 'f'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
537 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
538 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
539 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
540 is_category_Cs (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
541 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
542 return (ch >= 0xd800 && ch < 0xe000); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
543 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
544 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
545 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
546 is_category_Co (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
547 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
548 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
549 && unicode_attributes[ch].category[0] == 'C' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
550 && unicode_attributes[ch].category[1] == 'o'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
551 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
552 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
553 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
554 is_category_Cn (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
555 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
556 return (unicode_attributes[ch].name == NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
557 && !(ch >= 0xd800 && ch < 0xe000)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
558 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
559 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
560 /* Output a boolean property in a human readable format. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
561 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
562 debug_output_predicate (const char *filename, bool (*predicate) (unsigned int)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
563 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
564 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
565 unsigned int ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
566 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
567 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
568 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
569 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
570 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
571 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
572 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
573 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
574 #if 0 /* This yields huge text output. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
575 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
576 if (predicate (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
577 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
578 fprintf (stream, "0x%04X\n", ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
579 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
580 #else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
581 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
582 if (predicate (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
583 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
584 unsigned int first = ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
585 unsigned int last; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
586 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
587 while (ch + 1 < 0x110000 && predicate (ch + 1)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
588 ch++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
589 last = ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
590 if (first < last) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
591 fprintf (stream, "0x%04X..0x%04X\n", first, last); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
592 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
593 fprintf (stream, "0x%04X\n", ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
594 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
595 #endif |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
596 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
597 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
598 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
599 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
600 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
601 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
602 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
603 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
604 /* Output the unit test for a boolean property. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
605 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
606 output_predicate_test (const char *filename, bool (*predicate) (unsigned int), const char *expression) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
607 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
608 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
609 bool need_comma; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
610 unsigned int ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
611 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
612 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
613 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
614 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
615 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
616 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
617 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
618 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
619 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
620 fprintf (stream, "/* Test the Unicode character type functions.\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
621 fprintf (stream, " Copyright (C) 2007 Free Software Foundation, Inc.\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
622 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
623 fprintf (stream, " This program is free software: you can redistribute it and/or modify\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
624 fprintf (stream, " it under the terms of the GNU General Public License as published by\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
625 fprintf (stream, " the Free Software Foundation; either version 3 of the License, or\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
626 fprintf (stream, " (at your option) any later version.\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
627 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
628 fprintf (stream, " This program is distributed in the hope that it will be useful,\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
629 fprintf (stream, " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
630 fprintf (stream, " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
631 fprintf (stream, " GNU General Public License for more details.\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
632 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
633 fprintf (stream, " You should have received a copy of the GNU General Public License\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
634 fprintf (stream, " along with this program. If not, see <http://www.gnu.org/licenses/>. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
635 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
636 fprintf (stream, "#include \"test-predicate-part1.h\"\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
637 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
638 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
639 need_comma = false; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
640 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
641 if (predicate (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
642 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
643 unsigned int first = ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
644 unsigned int last; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
645 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
646 while (ch + 1 < 0x110000 && predicate (ch + 1)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
647 ch++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
648 last = ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
649 if (need_comma) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
650 fprintf (stream, ",\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
651 fprintf (stream, " { 0x%04X, 0x%04X }", first, last); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
652 need_comma = true; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
653 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
654 if (need_comma) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
655 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
656 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
657 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
658 fprintf (stream, "#define PREDICATE(c) %s\n", expression); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
659 fprintf (stream, "#include \"test-predicate-part2.h\"\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
660 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
661 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
662 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
663 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
664 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
665 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
666 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
667 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
668 /* Construction of sparse 3-level tables. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
669 #define TABLE predicate_table |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
670 #define xmalloc malloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
671 #define xrealloc realloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
672 #include "3levelbit.h" |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
673 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
674 /* Output a boolean property in a three-level bitmap. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
675 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
676 output_predicate (const char *filename, bool (*predicate) (unsigned int), const char *name, const char *comment, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
677 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
678 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
679 unsigned int ch, i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
680 struct predicate_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
681 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
682 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
683 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
684 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
685 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
686 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
687 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
688 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
689 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
690 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
691 fprintf (stream, "/* %s of Unicode characters. */\n", comment); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
692 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
693 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
694 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
695 t.p = 4; /* or: 5 */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
696 t.q = 7; /* or: 6 */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
697 predicate_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
698 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
699 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
700 if (predicate (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
701 predicate_table_add (&t, ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
702 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
703 predicate_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
704 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
705 /* Offsets in t.result, in memory of this process. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
706 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
707 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
708 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
709 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
710 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
711 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
712 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
713 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
714 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
715 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
716 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
717 if (i != 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
718 fprintf (stream, "#define header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
719 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
720 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
721 fprintf (stream, "static const\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
722 fprintf (stream, "struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
723 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
724 fprintf (stream, " int header[1];\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
725 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
726 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
727 fprintf (stream, " /*unsigned*/ int level3[%zu << %d];\n", t.level3_size, t.p); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
728 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
729 fprintf (stream, "%s =\n", name); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
730 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
731 fprintf (stream, " { %d },\n", ((uint32_t *) t.result)[1]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
732 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
733 if (t.level1_size > 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
734 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
735 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
736 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
737 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
738 if (i > 0 && (i % 1) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
739 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
740 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
741 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
742 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
743 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
744 fprintf (stream, " %5zu * sizeof (int) / sizeof (short) + %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
745 1 + t.level1_size, (offset - level2_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
746 if (i+1 < t.level1_size) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
747 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
748 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
749 if (t.level1_size > 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
750 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
751 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
752 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
753 if (t.level2_size << t.q > 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
754 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
755 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
756 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
757 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
758 if (i > 0 && (i % 1) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
759 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
760 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
761 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
762 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
763 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
764 fprintf (stream, " %5zu + %5zu * sizeof (short) / sizeof (int) + %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
765 1 + t.level1_size, t.level2_size << t.q, (offset - level3_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
766 if (i+1 < t.level2_size << t.q) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
767 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
768 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
769 if (t.level2_size << t.q > 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
770 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
771 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
772 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
773 if (t.level3_size << t.p > 4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
774 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
775 for (i = 0; i < t.level3_size << t.p; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
776 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
777 if (i > 0 && (i % 4) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
778 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
779 fprintf (stream, " 0x%08X", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
780 ((uint32_t *) (t.result + level3_offset))[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
781 if (i+1 < t.level3_size << t.p) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
782 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
783 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
784 if (t.level3_size << t.p > 4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
785 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
786 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
787 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
788 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
789 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
790 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
791 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
792 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
793 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
794 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
795 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
796 /* Output all categories. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
797 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
798 output_categories (const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
799 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
800 #define CATEGORY(C) \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
801 debug_output_predicate ("unictype/categ_" #C ".txt", is_category_ ## C); \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
802 output_predicate_test ("../tests/unictype/test-categ_" #C ".c", is_category_ ## C, "uc_is_general_category (c, UC_CATEGORY_" #C ")"); \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
803 output_predicate ("unictype/categ_" #C ".h", is_category_ ## C, "u_categ_" #C, "Categories", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
804 CATEGORY (L) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
805 CATEGORY (Lu) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
806 CATEGORY (Ll) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
807 CATEGORY (Lt) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
808 CATEGORY (Lm) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
809 CATEGORY (Lo) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
810 CATEGORY (M) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
811 CATEGORY (Mn) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
812 CATEGORY (Mc) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
813 CATEGORY (Me) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
814 CATEGORY (N) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
815 CATEGORY (Nd) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
816 CATEGORY (Nl) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
817 CATEGORY (No) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
818 CATEGORY (P) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
819 CATEGORY (Pc) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
820 CATEGORY (Pd) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
821 CATEGORY (Ps) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
822 CATEGORY (Pe) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
823 CATEGORY (Pi) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
824 CATEGORY (Pf) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
825 CATEGORY (Po) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
826 CATEGORY (S) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
827 CATEGORY (Sm) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
828 CATEGORY (Sc) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
829 CATEGORY (Sk) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
830 CATEGORY (So) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
831 CATEGORY (Z) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
832 CATEGORY (Zs) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
833 CATEGORY (Zl) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
834 CATEGORY (Zp) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
835 CATEGORY (C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
836 CATEGORY (Cc) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
837 CATEGORY (Cf) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
838 CATEGORY (Cs) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
839 CATEGORY (Co) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
840 CATEGORY (Cn) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
841 #undef CATEGORY |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
842 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
843 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
844 enum |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
845 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
846 UC_CATEGORY_MASK_L = 0x0000001f, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
847 UC_CATEGORY_MASK_Lu = 0x00000001, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
848 UC_CATEGORY_MASK_Ll = 0x00000002, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
849 UC_CATEGORY_MASK_Lt = 0x00000004, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
850 UC_CATEGORY_MASK_Lm = 0x00000008, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
851 UC_CATEGORY_MASK_Lo = 0x00000010, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
852 UC_CATEGORY_MASK_M = 0x000000e0, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
853 UC_CATEGORY_MASK_Mn = 0x00000020, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
854 UC_CATEGORY_MASK_Mc = 0x00000040, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
855 UC_CATEGORY_MASK_Me = 0x00000080, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
856 UC_CATEGORY_MASK_N = 0x00000700, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
857 UC_CATEGORY_MASK_Nd = 0x00000100, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
858 UC_CATEGORY_MASK_Nl = 0x00000200, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
859 UC_CATEGORY_MASK_No = 0x00000400, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
860 UC_CATEGORY_MASK_P = 0x0003f800, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
861 UC_CATEGORY_MASK_Pc = 0x00000800, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
862 UC_CATEGORY_MASK_Pd = 0x00001000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
863 UC_CATEGORY_MASK_Ps = 0x00002000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
864 UC_CATEGORY_MASK_Pe = 0x00004000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
865 UC_CATEGORY_MASK_Pi = 0x00008000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
866 UC_CATEGORY_MASK_Pf = 0x00010000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
867 UC_CATEGORY_MASK_Po = 0x00020000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
868 UC_CATEGORY_MASK_S = 0x003c0000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
869 UC_CATEGORY_MASK_Sm = 0x00040000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
870 UC_CATEGORY_MASK_Sc = 0x00080000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
871 UC_CATEGORY_MASK_Sk = 0x00100000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
872 UC_CATEGORY_MASK_So = 0x00200000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
873 UC_CATEGORY_MASK_Z = 0x01c00000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
874 UC_CATEGORY_MASK_Zs = 0x00400000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
875 UC_CATEGORY_MASK_Zl = 0x00800000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
876 UC_CATEGORY_MASK_Zp = 0x01000000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
877 UC_CATEGORY_MASK_C = 0x3e000000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
878 UC_CATEGORY_MASK_Cc = 0x02000000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
879 UC_CATEGORY_MASK_Cf = 0x04000000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
880 UC_CATEGORY_MASK_Cs = 0x08000000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
881 UC_CATEGORY_MASK_Co = 0x10000000, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
882 UC_CATEGORY_MASK_Cn = 0x20000000 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
883 }; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
884 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
885 static int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
886 general_category_byname (const char *category_name) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
887 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
888 if (category_name[0] != '\0' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
889 && (category_name[1] == '\0' || category_name[2] == '\0')) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
890 switch (category_name[0]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
891 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
892 case 'L': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
893 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
894 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
895 case '\0': return UC_CATEGORY_MASK_L; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
896 case 'u': return UC_CATEGORY_MASK_Lu; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
897 case 'l': return UC_CATEGORY_MASK_Ll; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
898 case 't': return UC_CATEGORY_MASK_Lt; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
899 case 'm': return UC_CATEGORY_MASK_Lm; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
900 case 'o': return UC_CATEGORY_MASK_Lo; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
901 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
902 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
903 case 'M': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
904 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
905 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
906 case '\0': return UC_CATEGORY_MASK_M; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
907 case 'n': return UC_CATEGORY_MASK_Mn; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
908 case 'c': return UC_CATEGORY_MASK_Mc; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
909 case 'e': return UC_CATEGORY_MASK_Me; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
910 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
911 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
912 case 'N': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
913 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
914 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
915 case '\0': return UC_CATEGORY_MASK_N; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
916 case 'd': return UC_CATEGORY_MASK_Nd; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
917 case 'l': return UC_CATEGORY_MASK_Nl; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
918 case 'o': return UC_CATEGORY_MASK_No; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
919 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
920 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
921 case 'P': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
922 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
923 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
924 case '\0': return UC_CATEGORY_MASK_P; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
925 case 'c': return UC_CATEGORY_MASK_Pc; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
926 case 'd': return UC_CATEGORY_MASK_Pd; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
927 case 's': return UC_CATEGORY_MASK_Ps; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
928 case 'e': return UC_CATEGORY_MASK_Pe; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
929 case 'i': return UC_CATEGORY_MASK_Pi; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
930 case 'f': return UC_CATEGORY_MASK_Pf; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
931 case 'o': return UC_CATEGORY_MASK_Po; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
932 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
933 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
934 case 'S': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
935 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
936 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
937 case '\0': return UC_CATEGORY_MASK_S; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
938 case 'm': return UC_CATEGORY_MASK_Sm; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
939 case 'c': return UC_CATEGORY_MASK_Sc; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
940 case 'k': return UC_CATEGORY_MASK_Sk; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
941 case 'o': return UC_CATEGORY_MASK_So; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
942 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
943 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
944 case 'Z': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
945 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
946 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
947 case '\0': return UC_CATEGORY_MASK_Z; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
948 case 's': return UC_CATEGORY_MASK_Zs; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
949 case 'l': return UC_CATEGORY_MASK_Zl; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
950 case 'p': return UC_CATEGORY_MASK_Zp; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
951 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
952 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
953 case 'C': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
954 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
955 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
956 case '\0': return UC_CATEGORY_MASK_C; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
957 case 'c': return UC_CATEGORY_MASK_Cc; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
958 case 'f': return UC_CATEGORY_MASK_Cf; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
959 case 's': return UC_CATEGORY_MASK_Cs; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
960 case 'o': return UC_CATEGORY_MASK_Co; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
961 case 'n': return UC_CATEGORY_MASK_Cn; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
962 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
963 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
964 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
965 /* Invalid category name. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
966 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
967 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
968 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
969 /* Construction of sparse 3-level tables. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
970 #define TABLE category_table |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
971 #define ELEMENT uint8_t |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
972 #define DEFAULT 29 /* = log2(UC_CATEGORY_MASK_Cn) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
973 #define xmalloc malloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
974 #define xrealloc realloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
975 #include "3level.h" |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
976 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
977 /* Output the per-character category table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
978 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
979 output_category (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
980 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
981 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
982 unsigned int ch, i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
983 struct category_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
984 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
985 uint16_t *level3_packed; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
986 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
987 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
988 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
989 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
990 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
991 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
992 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
993 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
994 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
995 fprintf (stream, "/* Categories of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
996 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
997 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
998 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
999 t.p = 7; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1000 t.q = 9; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1001 category_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1002 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1003 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1004 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1005 int value; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1006 unsigned int log2_value; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1007 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1008 if (is_category_Cs (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1009 value = UC_CATEGORY_MASK_Cs; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1010 else if (unicode_attributes[ch].name != NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1011 value = general_category_byname (unicode_attributes[ch].category); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1012 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1013 continue; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1014 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1015 /* Now value should contain exactly one bit. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1016 if (value == 0 || ((value & (value - 1)) != 0)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1017 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1018 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1019 for (log2_value = 0; value > 1; value >>= 1, log2_value++); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1020 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1021 category_table_add (&t, ch, log2_value); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1022 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1023 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1024 category_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1025 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1026 /* Offsets in t.result, in memory of this process. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1027 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1028 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1029 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1030 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1031 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1032 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1033 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1034 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1035 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1036 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1037 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1038 fprintf (stream, "#define category_header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1039 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1040 fprintf (stream, "static const\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1041 fprintf (stream, "struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1042 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1043 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1044 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1045 fprintf (stream, " unsigned short level3[%zu * %d + 1];\n", t.level3_size, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1046 (1 << t.p) * 5 / 16); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1047 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1048 fprintf (stream, "u_category =\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1049 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1050 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1051 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1052 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1053 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1054 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1055 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1056 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1057 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1058 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1059 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1060 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1061 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
1062 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1063 (offset - level2_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1064 if (i+1 < t.level1_size) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1065 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1066 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1067 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1068 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1069 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1070 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1071 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1072 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1073 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1074 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1075 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1076 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1077 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1078 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1079 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1080 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1081 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
1082 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1083 (offset - level3_offset) / sizeof (uint8_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1084 if (i+1 < t.level2_size << t.q) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1085 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1086 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1087 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1088 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1089 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1090 /* Pack the level3 array. Each entry needs 5 bits only. Use 16-bit units, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1091 not 32-bit units, in order to make the lookup function easier. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1092 level3_packed = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1093 (uint16_t *) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1094 calloc ((t.level3_size << t.p) * 5 / 16 + 1, sizeof (uint16_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1095 for (i = 0; i < t.level3_size << t.p; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1096 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1097 unsigned int j = (i * 5) / 16; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1098 unsigned int k = (i * 5) % 16; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1099 uint32_t value = ((unsigned char *) (t.result + level3_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1100 value = level3_packed[j] | (level3_packed[j+1] << 16) | (value << k); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1101 level3_packed[j] = value & 0xffff; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1102 level3_packed[j+1] = value >> 16; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1103 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1104 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1105 if ((t.level3_size << t.p) * 5 / 16 + 1 > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1106 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1107 for (i = 0; i < (t.level3_size << t.p) * 5 / 16 + 1; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1108 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1109 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1110 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1111 fprintf (stream, " 0x%04x", level3_packed[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1112 if (i+1 < (t.level3_size << t.p) * 5 / 16 + 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1113 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1114 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1115 if ((t.level3_size << t.p) * 5 / 16 + 1 > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1116 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1117 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1118 free (level3_packed); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1119 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1120 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1121 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1122 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1123 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1124 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1125 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1126 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1127 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1128 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1129 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1130 /* Canonical combining class. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1131 /* See Unicode 3.0 book, section 4.2, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1132 UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1133 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1134 /* Construction of sparse 3-level tables. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1135 #define TABLE combclass_table |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1136 #define ELEMENT uint8_t |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1137 #define DEFAULT 0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1138 #define xmalloc malloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1139 #define xrealloc realloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1140 #include "3level.h" |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1141 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1142 /* Output the per-character combining class table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1143 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1144 output_combclass (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1145 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1146 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1147 unsigned int ch, i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1148 struct combclass_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1149 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1150 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1151 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1152 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1153 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1154 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1155 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1156 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1157 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1158 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1159 fprintf (stream, "/* Combining class of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1160 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1161 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1162 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1163 t.p = 7; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1164 t.q = 9; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1165 combclass_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1166 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1167 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1168 if (unicode_attributes[ch].name != NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1169 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1170 int value = atoi (unicode_attributes[ch].combining); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1171 if (!(value >= 0 && value <= 255)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1172 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1173 combclass_table_add (&t, ch, value); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1174 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1175 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1176 combclass_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1177 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1178 /* Offsets in t.result, in memory of this process. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1179 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1180 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1181 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1182 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1183 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1184 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1185 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1186 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1187 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1188 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1189 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1190 fprintf (stream, "#define combclass_header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1191 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1192 fprintf (stream, "static const\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1193 fprintf (stream, "struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1194 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1195 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1196 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1197 fprintf (stream, " unsigned char level3[%zu << %d];\n", t.level3_size, t.p); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1198 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1199 fprintf (stream, "u_combclass =\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1200 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1201 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1202 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1203 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1204 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1205 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1206 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1207 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1208 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1209 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1210 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1211 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1212 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
1213 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1214 (offset - level2_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1215 if (i+1 < t.level1_size) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1216 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1217 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1218 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1219 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1220 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1221 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1222 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1223 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1224 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1225 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1226 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1227 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1228 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1229 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1230 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1231 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1232 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
1233 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1234 (offset - level3_offset) / sizeof (uint8_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1235 if (i+1 < t.level2_size << t.q) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1236 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1237 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1238 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1239 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1240 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1241 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1242 if (t.level3_size << t.p > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1243 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1244 for (i = 0; i < t.level3_size << t.p; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1245 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1246 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1247 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1248 fprintf (stream, " %3d", ((uint8_t *) (t.result + level3_offset))[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1249 if (i+1 < t.level3_size << t.p) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1250 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1251 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1252 if (t.level3_size << t.p > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1253 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1254 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1255 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1256 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1257 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1258 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1259 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1260 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1261 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1262 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1263 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1264 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1265 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1266 /* Bidirectional category. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1267 /* See Unicode 3.0 book, section 4.3, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1268 UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1269 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1270 enum |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1271 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1272 UC_BIDI_L, /* Left-to-Right */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1273 UC_BIDI_LRE, /* Left-to-Right Embedding */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1274 UC_BIDI_LRO, /* Left-to-Right Override */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1275 UC_BIDI_R, /* Right-to-Left */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1276 UC_BIDI_AL, /* Right-to-Left Arabic */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1277 UC_BIDI_RLE, /* Right-to-Left Embedding */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1278 UC_BIDI_RLO, /* Right-to-Left Override */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1279 UC_BIDI_PDF, /* Pop Directional Format */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1280 UC_BIDI_EN, /* European Number */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1281 UC_BIDI_ES, /* European Number Separator */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1282 UC_BIDI_ET, /* European Number Terminator */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1283 UC_BIDI_AN, /* Arabic Number */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1284 UC_BIDI_CS, /* Common Number Separator */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1285 UC_BIDI_NSM, /* Non-Spacing Mark */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1286 UC_BIDI_BN, /* Boundary Neutral */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1287 UC_BIDI_B, /* Paragraph Separator */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1288 UC_BIDI_S, /* Segment Separator */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1289 UC_BIDI_WS, /* Whitespace */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1290 UC_BIDI_ON /* Other Neutral */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1291 }; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1292 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1293 static int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1294 bidi_category_byname (const char *category_name) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1295 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1296 switch (category_name[0]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1297 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1298 case 'A': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1299 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1300 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1301 case 'L': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1302 if (category_name[2] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1303 return UC_BIDI_AL; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1304 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1305 case 'N': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1306 if (category_name[2] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1307 return UC_BIDI_AN; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1308 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1309 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1310 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1311 case 'B': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1312 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1313 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1314 case '\0': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1315 return UC_BIDI_B; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1316 case 'N': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1317 if (category_name[2] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1318 return UC_BIDI_BN; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1319 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1320 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1321 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1322 case 'C': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1323 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1324 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1325 case 'S': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1326 if (category_name[2] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1327 return UC_BIDI_CS; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1328 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1329 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1330 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1331 case 'E': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1332 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1333 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1334 case 'N': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1335 if (category_name[2] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1336 return UC_BIDI_EN; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1337 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1338 case 'S': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1339 if (category_name[2] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1340 return UC_BIDI_ES; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1341 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1342 case 'T': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1343 if (category_name[2] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1344 return UC_BIDI_ET; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1345 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1346 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1347 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1348 case 'L': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1349 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1350 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1351 case '\0': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1352 return UC_BIDI_L; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1353 case 'R': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1354 switch (category_name[2]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1355 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1356 case 'E': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1357 if (category_name[3] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1358 return UC_BIDI_LRE; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1359 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1360 case 'O': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1361 if (category_name[3] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1362 return UC_BIDI_LRO; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1363 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1364 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1365 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1366 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1367 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1368 case 'N': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1369 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1370 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1371 case 'S': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1372 switch (category_name[2]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1373 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1374 case 'M': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1375 if (category_name[3] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1376 return UC_BIDI_NSM; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1377 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1378 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1379 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1380 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1381 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1382 case 'O': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1383 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1384 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1385 case 'N': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1386 if (category_name[2] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1387 return UC_BIDI_ON; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1388 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1389 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1390 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1391 case 'P': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1392 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1393 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1394 case 'D': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1395 switch (category_name[2]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1396 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1397 case 'F': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1398 if (category_name[3] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1399 return UC_BIDI_PDF; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1400 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1401 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1402 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1403 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1404 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1405 case 'R': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1406 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1407 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1408 case '\0': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1409 return UC_BIDI_R; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1410 case 'L': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1411 switch (category_name[2]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1412 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1413 case 'E': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1414 if (category_name[3] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1415 return UC_BIDI_RLE; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1416 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1417 case 'O': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1418 if (category_name[3] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1419 return UC_BIDI_RLO; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1420 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1421 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1422 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1423 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1424 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1425 case 'S': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1426 if (category_name[1] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1427 return UC_BIDI_S; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1428 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1429 case 'W': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1430 switch (category_name[1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1431 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1432 case 'S': |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1433 if (category_name[2] == '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1434 return UC_BIDI_WS; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1435 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1436 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1437 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1438 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1439 /* Invalid bidi category name. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1440 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1441 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1442 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1443 static int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1444 get_bidi_category (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1445 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1446 if (unicode_attributes[ch].name != NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1447 return bidi_category_byname (unicode_attributes[ch].bidi); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1448 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1449 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1450 /* The bidi category of unassigned characters depends on the range. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1451 See UTR #9 and DerivedBidiClass.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1452 if ((ch >= 0x0590 && ch <= 0x05FF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1453 || (ch >= 0x07FB && ch <= 0x08FF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1454 || (ch >= 0xFB37 && ch <= 0xFB45) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1455 || (ch >= 0x10800 && ch <= 0x10FFF)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1456 return UC_BIDI_R; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1457 else if ((ch >= 0x0600 && ch <= 0x07BF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1458 || (ch >= 0x2064 && ch <= 0x2069) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1459 || (ch >= 0xFBB2 && ch <= 0xFDCF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1460 || (ch >= 0xFDFE && ch <= 0xFEFE)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1461 return UC_BIDI_AL; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1462 else if ((ch >= 0xFDD0 && ch <= 0xFDEF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1463 || (ch >= 0xFFF0 && ch <= 0xFFFF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1464 || (ch & 0xFFFF) == 0xFFFE |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1465 || (ch & 0xFFFF) == 0xFFFF |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1466 || (ch >= 0xE0000 && ch <= 0xE0FFF)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1467 return UC_BIDI_BN; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1468 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1469 return UC_BIDI_L; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1470 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1471 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1472 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1473 /* Construction of sparse 3-level tables. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1474 #define TABLE bidi_category_table |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1475 #define ELEMENT uint8_t |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1476 #define DEFAULT UC_BIDI_L |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1477 #define xmalloc malloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1478 #define xrealloc realloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1479 #include "3level.h" |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1480 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1481 /* Output the per-character bidi category table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1482 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1483 output_bidi_category (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1484 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1485 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1486 unsigned int ch, i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1487 struct bidi_category_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1488 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1489 uint16_t *level3_packed; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1490 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1491 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1492 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1493 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1494 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1495 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1496 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1497 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1498 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1499 fprintf (stream, "/* Bidi categories of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1500 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1501 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1502 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1503 t.p = 7; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1504 t.q = 9; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1505 bidi_category_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1506 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1507 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1508 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1509 int value = get_bidi_category (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1510 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1511 bidi_category_table_add (&t, ch, value); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1512 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1513 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1514 bidi_category_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1515 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1516 /* Offsets in t.result, in memory of this process. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1517 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1518 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1519 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1520 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1521 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1522 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1523 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1524 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1525 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1526 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1527 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1528 fprintf (stream, "#define bidi_category_header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1529 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1530 fprintf (stream, "static const\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1531 fprintf (stream, "struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1532 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1533 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1534 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1535 fprintf (stream, " unsigned short level3[%zu * %d + 1];\n", t.level3_size, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1536 (1 << t.p) * 5 / 16); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1537 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1538 fprintf (stream, "u_bidi_category =\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1539 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1540 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1541 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1542 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1543 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1544 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1545 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1546 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1547 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1548 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1549 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1550 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1551 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
1552 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1553 (offset - level2_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1554 if (i+1 < t.level1_size) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1555 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1556 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1557 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1558 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1559 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1560 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1561 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1562 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1563 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1564 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1565 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1566 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1567 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1568 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1569 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1570 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1571 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
1572 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1573 (offset - level3_offset) / sizeof (uint8_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1574 if (i+1 < t.level2_size << t.q) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1575 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1576 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1577 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1578 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1579 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1580 /* Pack the level3 array. Each entry needs 5 bits only. Use 16-bit units, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1581 not 32-bit units, in order to make the lookup function easier. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1582 level3_packed = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1583 (uint16_t *) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1584 calloc ((t.level3_size << t.p) * 5 / 16 + 1, sizeof (uint16_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1585 for (i = 0; i < t.level3_size << t.p; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1586 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1587 unsigned int j = (i * 5) / 16; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1588 unsigned int k = (i * 5) % 16; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1589 uint32_t value = ((unsigned char *) (t.result + level3_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1590 value = level3_packed[j] | (level3_packed[j+1] << 16) | (value << k); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1591 level3_packed[j] = value & 0xffff; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1592 level3_packed[j+1] = value >> 16; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1593 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1594 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1595 if ((t.level3_size << t.p) * 5 / 16 + 1 > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1596 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1597 for (i = 0; i < (t.level3_size << t.p) * 5 / 16 + 1; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1598 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1599 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1600 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1601 fprintf (stream, " 0x%04x", level3_packed[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1602 if (i+1 < (t.level3_size << t.p) * 5 / 16 + 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1603 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1604 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1605 if ((t.level3_size << t.p) * 5 / 16 + 1 > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1606 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1607 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1608 free (level3_packed); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1609 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1610 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1611 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1612 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1613 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1614 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1615 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1616 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1617 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1618 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1619 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1620 /* Decimal digit value. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1621 /* See Unicode 3.0 book, section 4.6. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1622 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1623 static int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1624 get_decdigit_value (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1625 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1626 if (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1627 && unicode_attributes[ch].decdigit[0] != '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1628 return atoi (unicode_attributes[ch].decdigit); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1629 return -1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1630 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1631 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1632 /* Construction of sparse 3-level tables. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1633 #define TABLE decdigit_table |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1634 #define ELEMENT uint8_t |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1635 #define DEFAULT 0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1636 #define xmalloc malloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1637 #define xrealloc realloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1638 #include "3level.h" |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1639 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1640 /* Output the unit test for the per-character decimal digit value table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1641 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1642 output_decimal_digit_test (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1643 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1644 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1645 bool need_comma; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1646 unsigned int ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1647 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1648 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1649 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1650 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1651 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1652 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1653 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1654 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1655 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1656 fprintf (stream, "/* Decimal digit values of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1657 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1658 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1659 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1660 need_comma = false; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1661 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1662 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1663 int value = get_decdigit_value (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1664 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1665 if (!(value >= -1 && value < 10)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1666 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1667 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1668 if (value >= 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1669 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1670 if (need_comma) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1671 fprintf (stream, ",\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1672 fprintf (stream, " { 0x%04X, %d }", ch, value); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1673 need_comma = true; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1674 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1675 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1676 if (need_comma) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1677 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1678 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1679 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1680 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1681 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1682 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1683 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1684 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1685 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1686 /* Output the per-character decimal digit value table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1687 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1688 output_decimal_digit (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1689 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1690 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1691 unsigned int ch, i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1692 struct decdigit_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1693 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1694 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1695 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1696 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1697 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1698 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1699 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1700 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1701 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1702 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1703 fprintf (stream, "/* Decimal digit values of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1704 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1705 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1706 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1707 t.p = 7; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1708 t.q = 9; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1709 decdigit_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1710 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1711 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1712 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1713 int value = 1 + get_decdigit_value (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1714 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1715 if (!(value >= 0 && value <= 10)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1716 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1717 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1718 decdigit_table_add (&t, ch, value); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1719 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1720 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1721 decdigit_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1722 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1723 /* Offsets in t.result, in memory of this process. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1724 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1725 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1726 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1727 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1728 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1729 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1730 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1731 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1732 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1733 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1734 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1735 fprintf (stream, "#define decdigit_header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1736 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1737 fprintf (stream, "static const\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1738 fprintf (stream, "struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1739 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1740 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1741 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1742 fprintf (stream, " unsigned char level3[%zu << %d];\n", t.level3_size, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1743 t.p - 1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1744 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1745 fprintf (stream, "u_decdigit =\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1746 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1747 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1748 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1749 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1750 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1751 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1752 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1753 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1754 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1755 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1756 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1757 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1758 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
1759 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1760 (offset - level2_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1761 if (i+1 < t.level1_size) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1762 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1763 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1764 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1765 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1766 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1767 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1768 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1769 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1770 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1771 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1772 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1773 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1774 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1775 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1776 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1777 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1778 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
1779 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1780 (offset - level3_offset) / sizeof (uint8_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1781 if (i+1 < t.level2_size << t.q) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1782 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1783 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1784 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1785 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1786 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1787 /* Pack the level3 array. Each entry needs 4 bits only. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1788 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1789 if (t.level3_size << (t.p - 1) > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1790 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1791 for (i = 0; i < t.level3_size << (t.p - 1); i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1792 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1793 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1794 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1795 fprintf (stream, " 0x%02x", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1796 ((uint8_t *) (t.result + level3_offset))[2*i] |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1797 + (((uint8_t *) (t.result + level3_offset))[2*i+1] << 4)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1798 if (i+1 < t.level3_size << (t.p - 1)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1799 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1800 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1801 if (t.level3_size << (t.p - 1) > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1802 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1803 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1804 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1805 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1806 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1807 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1808 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1809 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1810 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1811 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1812 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1813 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1814 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1815 /* Digit value. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1816 /* See Unicode 3.0 book, section 4.6. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1817 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1818 static int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1819 get_digit_value (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1820 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1821 if (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1822 && unicode_attributes[ch].digit[0] != '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1823 return atoi (unicode_attributes[ch].digit); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1824 return -1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1825 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1826 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1827 /* Output the unit test for the per-character digit value table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1828 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1829 output_digit_test (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1830 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1831 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1832 bool need_comma; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1833 unsigned int ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1834 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1835 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1836 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1837 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1838 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1839 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1840 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1841 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1842 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1843 fprintf (stream, "/* Digit values of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1844 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1845 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1846 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1847 need_comma = false; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1848 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1849 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1850 int value = get_digit_value (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1851 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1852 if (!(value >= -1 && value < 10)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1853 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1854 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1855 if (value >= 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1856 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1857 if (need_comma) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1858 fprintf (stream, ",\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1859 fprintf (stream, " { 0x%04X, %d }", ch, value); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1860 need_comma = true; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1861 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1862 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1863 if (need_comma) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1864 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1865 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1866 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1867 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1868 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1869 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1870 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1871 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1872 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1873 /* Output the per-character digit value table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1874 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1875 output_digit (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1876 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1877 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1878 unsigned int ch, i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1879 struct decdigit_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1880 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1881 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1882 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1883 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1884 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1885 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1886 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1887 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1888 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1889 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1890 fprintf (stream, "/* Digit values of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1891 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1892 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1893 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1894 t.p = 7; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1895 t.q = 9; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1896 decdigit_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1897 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1898 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1899 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1900 int value = 1 + get_digit_value (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1901 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1902 if (!(value >= 0 && value <= 10)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1903 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1904 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1905 decdigit_table_add (&t, ch, value); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1906 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1907 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1908 decdigit_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1909 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1910 /* Offsets in t.result, in memory of this process. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1911 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1912 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1913 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1914 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1915 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1916 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1917 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1918 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1919 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1920 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1921 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1922 fprintf (stream, "#define digit_header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1923 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1924 fprintf (stream, "static const\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1925 fprintf (stream, "struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1926 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1927 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1928 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1929 fprintf (stream, " unsigned char level3[%zu << %d];\n", t.level3_size, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1930 t.p - 1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1931 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1932 fprintf (stream, "u_digit =\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1933 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1934 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1935 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1936 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1937 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1938 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1939 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1940 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1941 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1942 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1943 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1944 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1945 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
1946 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1947 (offset - level2_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1948 if (i+1 < t.level1_size) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1949 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1950 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1951 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1952 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1953 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1954 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1955 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1956 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1957 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1958 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1959 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1960 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1961 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1962 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1963 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1964 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1965 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
1966 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1967 (offset - level3_offset) / sizeof (uint8_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1968 if (i+1 < t.level2_size << t.q) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1969 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1970 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1971 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1972 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1973 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1974 /* Pack the level3 array. Each entry needs 4 bits only. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1975 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1976 if (t.level3_size << (t.p - 1) > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1977 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1978 for (i = 0; i < t.level3_size << (t.p - 1); i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1979 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1980 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1981 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1982 fprintf (stream, " 0x%02x", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1983 ((uint8_t *) (t.result + level3_offset))[2*i] |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1984 + (((uint8_t *) (t.result + level3_offset))[2*i+1] << 4)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1985 if (i+1 < t.level3_size << (t.p - 1)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1986 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1987 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1988 if (t.level3_size << (t.p - 1) > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1989 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1990 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1991 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1992 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1993 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1994 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1995 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1996 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1997 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1998 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1999 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2000 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2001 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2002 /* Numeric value. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2003 /* See Unicode 3.0 book, section 4.6. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2004 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2005 typedef struct { int numerator; int denominator; } uc_fraction_t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2006 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2007 static uc_fraction_t |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2008 get_numeric_value (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2009 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2010 uc_fraction_t value; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2011 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2012 if (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2013 && unicode_attributes[ch].numeric[0] != '\0') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2014 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2015 const char *str = unicode_attributes[ch].numeric; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2016 /* str is of the form "integer" or "integer/posinteger". */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2017 value.numerator = atoi (str); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2018 if (strchr (str, '/') != NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2019 value.denominator = atoi (strchr (str, '/') + 1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2020 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2021 value.denominator = 1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2022 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2023 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2024 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2025 value.numerator = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2026 value.denominator = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2027 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2028 return value; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2029 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2030 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2031 /* Output the unit test for the per-character numeric value table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2032 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2033 output_numeric_test (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2034 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2035 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2036 bool need_comma; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2037 unsigned int ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2038 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2039 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2040 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2041 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2042 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2043 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2044 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2045 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2046 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2047 fprintf (stream, "/* Numeric values of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2048 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2049 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2050 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2051 need_comma = false; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2052 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2053 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2054 uc_fraction_t value = get_numeric_value (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2055 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2056 if (value.numerator != 0 || value.denominator != 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2057 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2058 if (need_comma) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2059 fprintf (stream, ",\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2060 fprintf (stream, " { 0x%04X, %d, %d }", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2061 ch, value.numerator, value.denominator); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2062 need_comma = true; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2063 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2064 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2065 if (need_comma) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2066 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2067 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2068 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2069 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2070 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2071 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2072 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2073 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2074 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2075 /* Construction of sparse 3-level tables. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2076 #define TABLE numeric_table |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2077 #define ELEMENT uint8_t |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2078 #define DEFAULT 0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2079 #define xmalloc malloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2080 #define xrealloc realloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2081 #include "3level.h" |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2082 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2083 /* Output the per-character numeric value table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2084 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2085 output_numeric (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2086 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2087 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2088 uc_fraction_t fractions[128]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2089 unsigned int nfractions; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2090 unsigned int ch, i, j; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2091 struct numeric_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2092 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2093 uint16_t *level3_packed; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2094 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2095 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2096 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2097 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2098 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2099 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2100 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2101 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2102 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2103 fprintf (stream, "/* Numeric values of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2104 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2105 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2106 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2107 /* Create table of occurring fractions. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2108 nfractions = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2109 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2110 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2111 uc_fraction_t value = get_numeric_value (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2112 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2113 for (i = 0; i < nfractions; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2114 if (value.numerator == fractions[i].numerator |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2115 && value.denominator == fractions[i].denominator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2116 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2117 if (i == nfractions) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2118 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2119 if (nfractions == 128) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2120 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2121 for (i = 0; i < nfractions; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2122 if (value.denominator < fractions[i].denominator |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2123 || (value.denominator == fractions[i].denominator |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2124 && value.numerator < fractions[i].numerator)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2125 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2126 for (j = nfractions; j > i; j--) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2127 fractions[j] = fractions[j - 1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2128 fractions[i] = value; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2129 nfractions++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2130 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2131 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2132 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2133 fprintf (stream, "static const uc_fraction_t u_numeric_values[%d] =\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2134 nfractions); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2135 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2136 for (i = 0; i < nfractions; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2137 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2138 fprintf (stream, " { %d, %d }", fractions[i].numerator, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2139 fractions[i].denominator); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2140 if (i+1 < nfractions) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2141 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2142 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2143 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2144 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2145 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2146 t.p = 7; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2147 t.q = 9; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2148 numeric_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2149 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2150 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2151 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2152 uc_fraction_t value = get_numeric_value (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2153 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2154 for (i = 0; i < nfractions; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2155 if (value.numerator == fractions[i].numerator |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2156 && value.denominator == fractions[i].denominator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2157 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2158 if (i == nfractions) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2159 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2160 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2161 numeric_table_add (&t, ch, i); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2162 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2163 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2164 numeric_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2165 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2166 /* Offsets in t.result, in memory of this process. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2167 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2168 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2169 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2170 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2171 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2172 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2173 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2174 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2175 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2176 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2177 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2178 fprintf (stream, "#define numeric_header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2179 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2180 fprintf (stream, "static const\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2181 fprintf (stream, "struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2182 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2183 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2184 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2185 fprintf (stream, " unsigned short level3[%zu * %d + 1];\n", t.level3_size, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2186 (1 << t.p) * 7 / 16); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2187 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2188 fprintf (stream, "u_numeric =\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2189 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2190 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2191 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2192 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2193 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2194 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2195 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2196 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2197 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2198 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2199 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2200 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2201 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
2202 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2203 (offset - level2_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2204 if (i+1 < t.level1_size) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2205 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2206 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2207 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2208 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2209 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2210 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2211 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2212 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2213 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2214 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2215 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2216 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2217 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2218 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2219 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2220 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2221 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
2222 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2223 (offset - level3_offset) / sizeof (uint8_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2224 if (i+1 < t.level2_size << t.q) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2225 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2226 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2227 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2228 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2229 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2230 /* Pack the level3 array. Each entry needs 7 bits only. Use 16-bit units, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2231 not 32-bit units, in order to make the lookup function easier. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2232 level3_packed = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2233 (uint16_t *) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2234 calloc ((t.level3_size << t.p) * 7 / 16 + 1, sizeof (uint16_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2235 for (i = 0; i < t.level3_size << t.p; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2236 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2237 unsigned int j = (i * 7) / 16; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2238 unsigned int k = (i * 7) % 16; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2239 uint32_t value = ((unsigned char *) (t.result + level3_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2240 value = level3_packed[j] | (level3_packed[j+1] << 16) | (value << k); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2241 level3_packed[j] = value & 0xffff; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2242 level3_packed[j+1] = value >> 16; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2243 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2244 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2245 if ((t.level3_size << t.p) * 7 / 16 + 1 > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2246 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2247 for (i = 0; i < (t.level3_size << t.p) * 7 / 16 + 1; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2248 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2249 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2250 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2251 fprintf (stream, " 0x%04x", level3_packed[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2252 if (i+1 < (t.level3_size << t.p) * 7 / 16 + 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2253 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2254 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2255 if ((t.level3_size << t.p) * 7 / 16 + 1 > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2256 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2257 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2258 free (level3_packed); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2259 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2260 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2261 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2262 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2263 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2264 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2265 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2266 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2267 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2268 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2269 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2270 /* Mirrored. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2271 /* See Unicode 3.0 book, section 4.7, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2272 UAX #9. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2273 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2274 /* List of mirrored character pairs. This is a subset of the characters |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2275 having the BidiMirrored property. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2276 static unsigned int mirror_pairs[][2] = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2277 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2278 { 0x0028, 0x0029 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2279 { 0x003C, 0x003E }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2280 { 0x005B, 0x005D }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2281 { 0x007B, 0x007D }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2282 { 0x00AB, 0x00BB }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2283 { 0x2039, 0x203A }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2284 { 0x2045, 0x2046 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2285 { 0x207D, 0x207E }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2286 { 0x208D, 0x208E }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2287 { 0x2208, 0x220B }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2288 { 0x220A, 0x220D }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2289 { 0x223C, 0x223D }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2290 { 0x2243, 0x22CD }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2291 { 0x2252, 0x2253 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2292 { 0x2254, 0x2255 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2293 { 0x2264, 0x2265 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2294 { 0x2266, 0x2267 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2295 { 0x226A, 0x226B }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2296 { 0x2276, 0x2277 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2297 { 0x2278, 0x2279 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2298 { 0x227A, 0x227B }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2299 { 0x227C, 0x227D }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2300 { 0x2282, 0x2283 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2301 { 0x2286, 0x2287 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2302 { 0x228F, 0x2290 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2303 { 0x2291, 0x2292 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2304 { 0x22A2, 0x22A3 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2305 { 0x22B0, 0x22B1 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2306 { 0x22B2, 0x22B3 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2307 { 0x22B4, 0x22B5 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2308 { 0x22B6, 0x22B7 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2309 { 0x22C9, 0x22CA }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2310 { 0x22CB, 0x22CC }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2311 { 0x22D0, 0x22D1 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2312 { 0x22D6, 0x22D7 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2313 { 0x22D8, 0x22D9 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2314 { 0x22DA, 0x22DB }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2315 { 0x22DC, 0x22DD }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2316 { 0x22DE, 0x22DF }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2317 { 0x22F0, 0x22F1 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2318 { 0x2308, 0x2309 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2319 { 0x230A, 0x230B }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2320 { 0x2329, 0x232A }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2321 { 0x3008, 0x3009 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2322 { 0x300A, 0x300B }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2323 { 0x300C, 0x300D }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2324 { 0x300E, 0x300F }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2325 { 0x3010, 0x3011 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2326 { 0x3014, 0x3015 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2327 { 0x3016, 0x3017 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2328 { 0x3018, 0x3019 }, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2329 { 0x301A, 0x301B } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2330 }; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2331 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2332 static int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2333 get_mirror_value (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2334 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2335 bool mirrored; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2336 unsigned int mirror_char; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2337 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2338 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2339 mirrored = (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2340 && unicode_attributes[ch].mirrored); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2341 mirror_char = 0xfffd; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2342 for (i = 0; i < sizeof (mirror_pairs) / sizeof (mirror_pairs[0]); i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2343 if (ch == mirror_pairs[i][0]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2344 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2345 mirror_char = mirror_pairs[i][1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2346 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2347 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2348 else if (ch == mirror_pairs[i][1]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2349 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2350 mirror_char = mirror_pairs[i][0]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2351 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2352 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2353 if (mirrored) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2354 return (int) mirror_char - (int) ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2355 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2356 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2357 if (mirror_char != 0xfffd) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2358 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2359 return 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2360 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2361 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2362 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2363 /* Construction of sparse 3-level tables. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2364 #define TABLE mirror_table |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2365 #define ELEMENT int32_t |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2366 #define DEFAULT 0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2367 #define xmalloc malloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2368 #define xrealloc realloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2369 #include "3level.h" |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2370 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2371 /* Output the per-character mirror table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2372 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2373 output_mirror (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2374 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2375 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2376 unsigned int ch, i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2377 struct mirror_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2378 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2379 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2380 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2381 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2382 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2383 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2384 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2385 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2386 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2387 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2388 fprintf (stream, "/* Mirrored Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2389 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2390 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2391 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2392 t.p = 7; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2393 t.q = 9; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2394 mirror_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2395 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2396 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2397 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2398 int value = get_mirror_value (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2399 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2400 mirror_table_add (&t, ch, value); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2401 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2402 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2403 mirror_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2404 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2405 /* Offsets in t.result, in memory of this process. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2406 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2407 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2408 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2409 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2410 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2411 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2412 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2413 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2414 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2415 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2416 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2417 fprintf (stream, "#define mirror_header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2418 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2419 fprintf (stream, "static const\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2420 fprintf (stream, "struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2421 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2422 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2423 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2424 fprintf (stream, " int level3[%zu << %d];\n", t.level3_size, t.p); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2425 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2426 fprintf (stream, "u_mirror =\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2427 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2428 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2429 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2430 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2431 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2432 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2433 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2434 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2435 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2436 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2437 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2438 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2439 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
2440 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2441 (offset - level2_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2442 if (i+1 < t.level1_size) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2443 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2444 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2445 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2446 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2447 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2448 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2449 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2450 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2451 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2452 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2453 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2454 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2455 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2456 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2457 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2458 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2459 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
2460 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2461 (offset - level3_offset) / sizeof (int32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2462 if (i+1 < t.level2_size << t.q) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2463 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2464 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2465 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2466 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2467 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2468 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2469 if (t.level3_size << t.p > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2470 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2471 for (i = 0; i < t.level3_size << t.p; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2472 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2473 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2474 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2475 fprintf (stream, " %5d", ((int32_t *) (t.result + level3_offset))[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2476 if (i+1 < t.level3_size << t.p) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2477 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2478 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2479 if (t.level3_size << t.p > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2480 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2481 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2482 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2483 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2484 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2485 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2486 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2487 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2488 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2489 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2490 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2491 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2492 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2493 /* Properties. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2494 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2495 /* Reading PropList.txt and DerivedCoreProperties.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2496 enum |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2497 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2498 /* PropList.txt */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2499 PROP_WHITE_SPACE, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2500 PROP_BIDI_CONTROL, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2501 PROP_JOIN_CONTROL, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2502 PROP_DASH, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2503 PROP_HYPHEN, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2504 PROP_QUOTATION_MARK, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2505 PROP_TERMINAL_PUNCTUATION, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2506 PROP_OTHER_MATH, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2507 PROP_HEX_DIGIT, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2508 PROP_ASCII_HEX_DIGIT, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2509 PROP_OTHER_ALPHABETIC, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2510 PROP_IDEOGRAPHIC, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2511 PROP_DIACRITIC, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2512 PROP_EXTENDER, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2513 PROP_OTHER_LOWERCASE, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2514 PROP_OTHER_UPPERCASE, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2515 PROP_NONCHARACTER_CODE_POINT, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2516 PROP_OTHER_GRAPHEME_EXTEND, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2517 PROP_IDS_BINARY_OPERATOR, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2518 PROP_IDS_TRINARY_OPERATOR, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2519 PROP_RADICAL, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2520 PROP_UNIFIED_IDEOGRAPH, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2521 PROP_OTHER_DEFAULT_IGNORABLE_CODE_POINT, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2522 PROP_DEPRECATED, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2523 PROP_SOFT_DOTTED, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2524 PROP_LOGICAL_ORDER_EXCEPTION, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2525 PROP_OTHER_ID_START, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2526 PROP_OTHER_ID_CONTINUE, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2527 PROP_STERM, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2528 PROP_VARIATION_SELECTOR, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2529 PROP_PATTERN_WHITE_SPACE, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2530 PROP_PATTERN_SYNTAX, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2531 /* DerivedCoreProperties.txt */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2532 PROP_MATH, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2533 PROP_ALPHABETIC, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2534 PROP_LOWERCASE, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2535 PROP_UPPERCASE, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2536 PROP_ID_START, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2537 PROP_ID_CONTINUE, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2538 PROP_XID_START, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2539 PROP_XID_CONTINUE, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2540 PROP_DEFAULT_IGNORABLE_CODE_POINT, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2541 PROP_GRAPHEME_EXTEND, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2542 PROP_GRAPHEME_BASE, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2543 PROP_GRAPHEME_LINK |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2544 }; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2545 unsigned long long unicode_properties[0x110000]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2546 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2547 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2548 clear_properties (void) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2549 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2550 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2551 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2552 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2553 unicode_properties[i] = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2554 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2555 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2556 /* Stores in unicode_properties[] the properties from the |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2557 PropList.txt or DerivedCoreProperties.txt file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2558 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2559 fill_properties (const char *proplist_filename) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2560 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2561 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2562 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2563 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2564 stream = fopen (proplist_filename, "r"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2565 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2566 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2567 fprintf (stderr, "error during fopen of '%s'\n", proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2568 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2569 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2570 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2571 for (;;) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2572 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2573 char buf[200+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2574 unsigned int i1, i2; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2575 char padding[200+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2576 char propname[200+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2577 unsigned int propvalue; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2578 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2579 if (fscanf (stream, "%200[^\n]\n", buf) < 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2580 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2581 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2582 if (buf[0] == '\0' || buf[0] == '#') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2583 continue; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2584 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2585 if (sscanf (buf, "%X..%X%[ ;]%[^ ]", &i1, &i2, padding, propname) != 4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2586 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2587 if (sscanf (buf, "%X%[ ;]%[^ ]", &i1, padding, propname) != 3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2588 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2589 fprintf (stderr, "parse error in '%s'\n", proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2590 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2591 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2592 i2 = i1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2593 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2594 #define PROP(name,value) \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2595 if (strcmp (propname, name) == 0) propvalue = value; else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2596 /* PropList.txt */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2597 PROP ("White_Space", PROP_WHITE_SPACE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2598 PROP ("Bidi_Control", PROP_BIDI_CONTROL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2599 PROP ("Join_Control", PROP_JOIN_CONTROL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2600 PROP ("Dash", PROP_DASH) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2601 PROP ("Hyphen", PROP_HYPHEN) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2602 PROP ("Quotation_Mark", PROP_QUOTATION_MARK) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2603 PROP ("Terminal_Punctuation", PROP_TERMINAL_PUNCTUATION) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2604 PROP ("Other_Math", PROP_OTHER_MATH) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2605 PROP ("Hex_Digit", PROP_HEX_DIGIT) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2606 PROP ("ASCII_Hex_Digit", PROP_ASCII_HEX_DIGIT) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2607 PROP ("Other_Alphabetic", PROP_OTHER_ALPHABETIC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2608 PROP ("Ideographic", PROP_IDEOGRAPHIC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2609 PROP ("Diacritic", PROP_DIACRITIC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2610 PROP ("Extender", PROP_EXTENDER) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2611 PROP ("Other_Lowercase", PROP_OTHER_LOWERCASE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2612 PROP ("Other_Uppercase", PROP_OTHER_UPPERCASE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2613 PROP ("Noncharacter_Code_Point", PROP_NONCHARACTER_CODE_POINT) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2614 PROP ("Other_Grapheme_Extend", PROP_OTHER_GRAPHEME_EXTEND) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2615 PROP ("IDS_Binary_Operator", PROP_IDS_BINARY_OPERATOR) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2616 PROP ("IDS_Trinary_Operator", PROP_IDS_TRINARY_OPERATOR) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2617 PROP ("Radical", PROP_RADICAL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2618 PROP ("Unified_Ideograph", PROP_UNIFIED_IDEOGRAPH) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2619 PROP ("Other_Default_Ignorable_Code_Point", PROP_OTHER_DEFAULT_IGNORABLE_CODE_POINT) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2620 PROP ("Deprecated", PROP_DEPRECATED) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2621 PROP ("Soft_Dotted", PROP_SOFT_DOTTED) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2622 PROP ("Logical_Order_Exception", PROP_LOGICAL_ORDER_EXCEPTION) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2623 PROP ("Other_ID_Start", PROP_OTHER_ID_START) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2624 PROP ("Other_ID_Continue", PROP_OTHER_ID_CONTINUE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2625 PROP ("STerm", PROP_STERM) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2626 PROP ("Variation_Selector", PROP_VARIATION_SELECTOR) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2627 PROP ("Pattern_White_Space", PROP_PATTERN_WHITE_SPACE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2628 PROP ("Pattern_Syntax", PROP_PATTERN_SYNTAX) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2629 /* DerivedCoreProperties.txt */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2630 PROP ("Math", PROP_MATH) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2631 PROP ("Alphabetic", PROP_ALPHABETIC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2632 PROP ("Lowercase", PROP_LOWERCASE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2633 PROP ("Uppercase", PROP_UPPERCASE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2634 PROP ("ID_Start", PROP_ID_START) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2635 PROP ("ID_Continue", PROP_ID_CONTINUE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2636 PROP ("XID_Start", PROP_XID_START) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2637 PROP ("XID_Continue", PROP_XID_CONTINUE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2638 PROP ("Default_Ignorable_Code_Point", PROP_DEFAULT_IGNORABLE_CODE_POINT) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2639 PROP ("Grapheme_Extend", PROP_GRAPHEME_EXTEND) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2640 PROP ("Grapheme_Base", PROP_GRAPHEME_BASE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2641 PROP ("Grapheme_Link", PROP_GRAPHEME_LINK) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2642 #undef PROP |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2643 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2644 fprintf (stderr, "unknown property named '%s' in '%s'\n", propname, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2645 proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2646 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2647 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2648 if (!(i1 <= i2 && i2 < 0x110000)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2649 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2650 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2651 for (i = i1; i <= i2; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2652 unicode_properties[i] |= 1ULL << propvalue; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2653 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2654 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2655 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2656 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2657 fprintf (stderr, "error reading from '%s'\n", proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2658 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2659 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2660 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2661 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2662 /* Stores in array the given property from the Unicode 3.0 PropList.txt |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2663 file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2664 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2665 fill_property30 (char array[0x110000], const char *proplist_filename, const char *property_name) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2666 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2667 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2668 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2669 char buf[100+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2670 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2671 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2672 array[i] = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2673 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2674 stream = fopen (proplist_filename, "r"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2675 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2676 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2677 fprintf (stderr, "error during fopen of '%s'\n", proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2678 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2679 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2680 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2681 /* Search for the "Property dump for: ..." line. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2682 do |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2683 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2684 if (fscanf (stream, "%100[^\n]\n", buf) < 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2685 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2686 fprintf (stderr, "no property found in '%s'\n", proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2687 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2688 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2689 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2690 while (strstr (buf, property_name) == NULL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2691 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2692 for (;;) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2693 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2694 unsigned int i1, i2; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2695 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2696 if (fscanf (stream, "%100[^\n]\n", buf) < 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2697 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2698 if (buf[0] == '*') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2699 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2700 if (strlen (buf) >= 10 && buf[4] == '.' && buf[5] == '.') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2701 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2702 if (sscanf (buf, "%4X..%4X", &i1, &i2) < 2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2703 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2704 fprintf (stderr, "parse error in property in '%s'\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2705 proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2706 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2707 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2708 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2709 else if (strlen (buf) >= 4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2710 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2711 if (sscanf (buf, "%4X", &i1) < 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2712 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2713 fprintf (stderr, "parse error in property in '%s'\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2714 proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2715 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2716 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2717 i2 = i1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2718 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2719 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2720 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2721 fprintf (stderr, "parse error in property in '%s'\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2722 proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2723 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2724 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2725 if (!(i1 <= i2 && i2 < 0x110000)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2726 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2727 for (i = i1; i <= i2; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2728 array[i] = 1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2729 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2730 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2731 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2732 fprintf (stderr, "error reading from '%s'\n", proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2733 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2734 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2735 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2736 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2737 /* Properties from Unicode 3.0 PropList.txt file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2738 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2739 /* The paired punctuation property from the PropList.txt file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2740 char unicode_pairedpunctuation[0x110000]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2741 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2742 /* The left of pair property from the PropList.txt file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2743 char unicode_leftofpair[0x110000]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2744 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2745 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2746 fill_properties30 (const char *proplist30_filename) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2747 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2748 fill_property30 (unicode_pairedpunctuation, proplist30_filename, "(Paired Punctuation)"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2749 fill_property30 (unicode_leftofpair, proplist30_filename, "(Left of Pair)"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2750 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2751 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2752 /* ------------------------------------------------------------------------- */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2753 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2754 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2755 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2756 is_property_white_space (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2757 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2758 return ((unicode_properties[ch] & (1ULL << PROP_WHITE_SPACE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2759 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2760 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2761 /* See Unicode 3.0 book, section 4.10, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2762 PropList.txt, UCD.html, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2763 DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2764 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2765 is_property_alphabetic (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2766 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2767 bool result1 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2768 is_category_L (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2769 || ((unicode_properties[ch] & (1ULL << PROP_OTHER_ALPHABETIC)) != 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2770 /* For some reason, the following are listed as having property |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2771 Alphabetic but not as having property Other_Alphabetic. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2772 || (ch >= 0x16EE && ch <= 0x16F0) /* RUNIC SYMBOLS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2773 || (ch >= 0x2160 && ch <= 0x2182) /* ROMAN NUMERALS */ |
11127 | 2774 || (ch >= 0x2185 && ch <= 0x2188) /* ROMAN NUMERALS */ |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2775 || (ch >= 0x24D0 && ch <= 0x24E9) /* CIRCLED LATIN SMALL LETTER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2776 || (ch == 0x3007) /* IDEOGRAPHIC NUMBER ZERO */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2777 || (ch >= 0x3021 && ch <= 0x3029) /* HANGZHOU NUMERAL */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2778 || (ch >= 0x3038 && ch <= 0x303A) /* HANGZHOU NUMERAL */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2779 || (ch >= 0x10140 && ch <= 0x10174) /* GREEK ACROPHONICS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2780 || (ch == 0x10341) /* GOTHIC LETTER NINETY */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2781 || (ch == 0x1034A) /* GOTHIC LETTER NINE HUNDRED */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2782 || (ch >= 0x103D1 && ch <= 0x103D5) /* OLD PERSIAN NUMBERS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2783 || (ch >= 0x12400 && ch <= 0x12462); /* CUNEIFORM NUMERIC SIGNS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2784 bool result2 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2785 ((unicode_properties[ch] & (1ULL << PROP_ALPHABETIC)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2786 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2787 if (result1 != result2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2788 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2789 return result1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2790 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2791 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2792 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2793 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2794 is_property_other_alphabetic (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2795 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2796 return ((unicode_properties[ch] & (1ULL << PROP_OTHER_ALPHABETIC)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2797 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2798 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2799 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2800 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2801 is_property_not_a_character (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2802 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2803 return ((unicode_properties[ch] & (1ULL << PROP_NONCHARACTER_CODE_POINT)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2804 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2805 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2806 /* See PropList.txt, UCD.html, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2807 DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2808 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2809 is_property_default_ignorable_code_point (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2810 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2811 bool result1 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2812 (is_category_Cf (ch) |
11127 | 2813 && !(ch >= 0xFFF9 && ch <= 0xFFFB) /* Annotations */ |
2814 && !((ch >= 0x0600 && ch <= 0x0603) || ch == 0x06DD || ch == 0x070F)) | |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2815 || ((unicode_properties[ch] & (1ULL << PROP_OTHER_DEFAULT_IGNORABLE_CODE_POINT)) != 0) |
11127 | 2816 || ((unicode_properties[ch] & (1ULL << PROP_VARIATION_SELECTOR)) != 0); |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2817 bool result2 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2818 ((unicode_properties[ch] & (1ULL << PROP_DEFAULT_IGNORABLE_CODE_POINT)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2819 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2820 if (result1 != result2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2821 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2822 return result1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2823 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2824 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2825 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2826 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2827 is_property_other_default_ignorable_code_point (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2828 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2829 return ((unicode_properties[ch] & (1ULL << PROP_OTHER_DEFAULT_IGNORABLE_CODE_POINT)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2830 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2831 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2832 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2833 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2834 is_property_deprecated (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2835 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2836 return ((unicode_properties[ch] & (1ULL << PROP_DEPRECATED)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2837 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2838 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2839 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2840 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2841 is_property_logical_order_exception (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2842 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2843 return ((unicode_properties[ch] & (1ULL << PROP_LOGICAL_ORDER_EXCEPTION)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2844 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2845 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2846 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2847 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2848 is_property_variation_selector (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2849 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2850 return ((unicode_properties[ch] & (1ULL << PROP_VARIATION_SELECTOR)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2851 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2852 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2853 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2854 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2855 is_property_private_use (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2856 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2857 /* Determined through "grep 'Private Use,' UnicodeData-3.1.0.txt". */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2858 return (ch >= 0xE000 && ch <= 0xF8FF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2859 || (ch >= 0xF0000 && ch <= 0xFFFFD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2860 || (ch >= 0x100000 && ch <= 0x10FFFD); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2861 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2862 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2863 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2864 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2865 is_property_unassigned_code_value (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2866 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2867 return (is_category_Cn (ch) && !is_property_not_a_character (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2868 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2869 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2870 /* See PropList.txt, UCD.html, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2871 DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2872 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2873 is_property_uppercase (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2874 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2875 bool result1 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2876 is_category_Lu (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2877 || ((unicode_properties[ch] & (1ULL << PROP_OTHER_UPPERCASE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2878 bool result2 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2879 ((unicode_properties[ch] & (1ULL << PROP_UPPERCASE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2880 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2881 if (result1 != result2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2882 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2883 return result1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2884 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2885 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2886 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2887 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2888 is_property_other_uppercase (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2889 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2890 return ((unicode_properties[ch] & (1ULL << PROP_OTHER_UPPERCASE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2891 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2892 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2893 /* See PropList.txt, UCD.html, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2894 DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2895 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2896 is_property_lowercase (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2897 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2898 bool result1 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2899 is_category_Ll (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2900 || ((unicode_properties[ch] & (1ULL << PROP_OTHER_LOWERCASE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2901 bool result2 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2902 ((unicode_properties[ch] & (1ULL << PROP_LOWERCASE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2903 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2904 if (result1 != result2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2905 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2906 return result1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2907 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2908 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2909 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2910 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2911 is_property_other_lowercase (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2912 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2913 return ((unicode_properties[ch] & (1ULL << PROP_OTHER_LOWERCASE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2914 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2915 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2916 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2917 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2918 is_property_titlecase (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2919 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2920 return is_category_Lt (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2921 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2922 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2923 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2924 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2925 is_property_soft_dotted (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2926 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2927 return ((unicode_properties[ch] & (1ULL << PROP_SOFT_DOTTED)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2928 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2929 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2930 /* See DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2931 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2932 is_property_id_start (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2933 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2934 return ((unicode_properties[ch] & (1ULL << PROP_ID_START)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2935 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2936 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2937 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2938 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2939 is_property_other_id_start (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2940 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2941 return ((unicode_properties[ch] & (1ULL << PROP_OTHER_ID_START)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2942 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2943 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2944 /* See DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2945 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2946 is_property_id_continue (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2947 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2948 return ((unicode_properties[ch] & (1ULL << PROP_ID_CONTINUE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2949 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2950 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2951 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2952 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2953 is_property_other_id_continue (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2954 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2955 return ((unicode_properties[ch] & (1ULL << PROP_OTHER_ID_CONTINUE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2956 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2957 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2958 /* See DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2959 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2960 is_property_xid_start (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2961 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2962 return ((unicode_properties[ch] & (1ULL << PROP_XID_START)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2963 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2964 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2965 /* See DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2966 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2967 is_property_xid_continue (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2968 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2969 return ((unicode_properties[ch] & (1ULL << PROP_XID_CONTINUE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2970 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2971 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2972 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2973 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2974 is_property_pattern_white_space (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2975 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2976 return ((unicode_properties[ch] & (1ULL << PROP_PATTERN_WHITE_SPACE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2977 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2978 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2979 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2980 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2981 is_property_pattern_syntax (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2982 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2983 return ((unicode_properties[ch] & (1ULL << PROP_PATTERN_SYNTAX)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2984 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2985 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2986 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2987 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2988 is_property_join_control (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2989 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2990 return ((unicode_properties[ch] & (1ULL << PROP_JOIN_CONTROL)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2991 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2992 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2993 /* See DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2994 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2995 is_property_grapheme_base (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2996 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2997 return ((unicode_properties[ch] & (1ULL << PROP_GRAPHEME_BASE)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2998 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2999 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3000 /* See DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3001 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3002 is_property_grapheme_extend (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3003 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3004 return ((unicode_properties[ch] & (1ULL << PROP_GRAPHEME_EXTEND)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3005 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3006 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3007 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3008 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3009 is_property_other_grapheme_extend (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3010 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3011 return ((unicode_properties[ch] & (1ULL << PROP_OTHER_GRAPHEME_EXTEND)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3012 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3013 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3014 /* See DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3015 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3016 is_property_grapheme_link (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3017 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3018 return ((unicode_properties[ch] & (1ULL << PROP_GRAPHEME_LINK)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3019 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3020 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3021 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3022 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3023 is_property_bidi_control (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3024 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3025 return ((unicode_properties[ch] & (1ULL << PROP_BIDI_CONTROL)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3026 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3027 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3028 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3029 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3030 is_property_bidi_left_to_right (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3031 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3032 return (get_bidi_category (ch) == UC_BIDI_L); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3033 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3034 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3035 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3036 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3037 is_property_bidi_hebrew_right_to_left (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3038 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3039 return (get_bidi_category (ch) == UC_BIDI_R); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3040 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3041 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3042 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3043 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3044 is_property_bidi_arabic_right_to_left (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3045 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3046 return (get_bidi_category (ch) == UC_BIDI_AL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3047 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3048 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3049 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3050 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3051 is_property_bidi_european_digit (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3052 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3053 return (get_bidi_category (ch) == UC_BIDI_EN); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3054 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3055 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3056 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3057 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3058 is_property_bidi_eur_num_separator (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3059 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3060 return (get_bidi_category (ch) == UC_BIDI_ES); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3061 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3062 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3063 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3064 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3065 is_property_bidi_eur_num_terminator (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3066 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3067 return (get_bidi_category (ch) == UC_BIDI_ET); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3068 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3069 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3070 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3071 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3072 is_property_bidi_arabic_digit (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3073 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3074 return (get_bidi_category (ch) == UC_BIDI_AN); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3075 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3076 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3077 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3078 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3079 is_property_bidi_common_separator (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3080 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3081 return (get_bidi_category (ch) == UC_BIDI_CS); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3082 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3083 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3084 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3085 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3086 is_property_bidi_block_separator (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3087 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3088 return (get_bidi_category (ch) == UC_BIDI_B); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3089 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3090 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3091 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3092 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3093 is_property_bidi_segment_separator (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3094 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3095 return (get_bidi_category (ch) == UC_BIDI_S); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3096 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3097 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3098 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3099 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3100 is_property_bidi_whitespace (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3101 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3102 return (get_bidi_category (ch) == UC_BIDI_WS); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3103 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3104 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3105 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3106 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3107 is_property_bidi_non_spacing_mark (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3108 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3109 return (get_bidi_category (ch) == UC_BIDI_NSM); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3110 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3111 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3112 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3113 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3114 is_property_bidi_boundary_neutral (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3115 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3116 return (get_bidi_category (ch) == UC_BIDI_BN); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3117 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3118 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3119 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3120 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3121 is_property_bidi_pdf (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3122 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3123 return (get_bidi_category (ch) == UC_BIDI_PDF); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3124 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3125 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3126 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3127 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3128 is_property_bidi_embedding_or_override (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3129 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3130 int category = get_bidi_category (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3131 return (category == UC_BIDI_LRE || category == UC_BIDI_LRO |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3132 || category == UC_BIDI_RLE || category == UC_BIDI_RLO); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3133 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3134 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3135 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3136 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3137 is_property_bidi_other_neutral (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3138 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3139 return (get_bidi_category (ch) == UC_BIDI_ON); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3140 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3141 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3142 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3143 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3144 is_property_hex_digit (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3145 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3146 return ((unicode_properties[ch] & (1ULL << PROP_HEX_DIGIT)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3147 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3148 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3149 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3150 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3151 is_property_ascii_hex_digit (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3152 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3153 return ((unicode_properties[ch] & (1ULL << PROP_ASCII_HEX_DIGIT)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3154 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3155 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3156 /* See Unicode 3.0 book, section 4.10, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3157 PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3158 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3159 is_property_ideographic (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3160 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3161 return ((unicode_properties[ch] & (1ULL << PROP_IDEOGRAPHIC)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3162 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3163 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3164 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3165 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3166 is_property_unified_ideograph (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3167 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3168 return ((unicode_properties[ch] & (1ULL << PROP_UNIFIED_IDEOGRAPH)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3169 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3170 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3171 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3172 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3173 is_property_radical (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3174 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3175 return ((unicode_properties[ch] & (1ULL << PROP_RADICAL)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3176 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3177 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3178 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3179 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3180 is_property_ids_binary_operator (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3181 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3182 return ((unicode_properties[ch] & (1ULL << PROP_IDS_BINARY_OPERATOR)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3183 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3184 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3185 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3186 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3187 is_property_ids_trinary_operator (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3188 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3189 return ((unicode_properties[ch] & (1ULL << PROP_IDS_TRINARY_OPERATOR)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3190 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3191 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3192 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3193 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3194 is_property_zero_width (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3195 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3196 return is_category_Cf (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3197 || (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3198 && strstr (unicode_attributes[ch].name, "ZERO WIDTH") != NULL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3199 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3200 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3201 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3202 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3203 is_property_space (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3204 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3205 return is_category_Zs (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3206 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3207 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3208 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3209 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3210 is_property_non_break (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3211 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3212 /* This is exactly the set of characters having line breaking |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3213 property GL. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3214 return (ch == 0x00A0 /* NO-BREAK SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3215 || ch == 0x034F /* COMBINING GRAPHEME JOINER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3216 || ch == 0x035C /* COMBINING DOUBLE BREVE BELOW */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3217 || ch == 0x035D /* COMBINING DOUBLE BREVE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3218 || ch == 0x035E /* COMBINING DOUBLE MACRON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3219 || ch == 0x035F /* COMBINING DOUBLE MACRON BELOW */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3220 || ch == 0x0360 /* COMBINING DOUBLE TILDE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3221 || ch == 0x0361 /* COMBINING DOUBLE INVERTED BREVE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3222 || ch == 0x0362 /* COMBINING DOUBLE RIGHTWARDS ARROW BELOW */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3223 || ch == 0x0F08 /* TIBETAN MARK SBRUL SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3224 || ch == 0x0F0C /* TIBETAN MARK DELIMITER TSHEG BSTAR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3225 || ch == 0x0F12 /* TIBETAN MARK RGYA GRAM SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3226 || ch == 0x180E /* MONGOLIAN VOWEL SEPARATOR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3227 || ch == 0x2007 /* FIGURE SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3228 || ch == 0x2011 /* NON-BREAKING HYPHEN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3229 || ch == 0x202F /* NARROW NO-BREAK SPACE */); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3230 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3231 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3232 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3233 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3234 is_property_iso_control (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3235 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3236 bool result1 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3237 (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3238 && strcmp (unicode_attributes[ch].name, "<control>") == 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3239 bool result2 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3240 is_category_Cc (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3241 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3242 if (result1 != result2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3243 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3244 return result1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3245 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3246 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3247 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3248 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3249 is_property_format_control (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3250 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3251 return (is_category_Cf (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3252 && get_bidi_category (ch) == UC_BIDI_BN |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3253 && !is_property_join_control (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3254 && ch != 0xFEFF); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3255 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3256 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3257 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3258 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3259 is_property_dash (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3260 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3261 return ((unicode_properties[ch] & (1ULL << PROP_DASH)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3262 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3263 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3264 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3265 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3266 is_property_hyphen (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3267 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3268 return ((unicode_properties[ch] & (1ULL << PROP_HYPHEN)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3269 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3270 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3271 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3272 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3273 is_property_punctuation (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3274 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3275 return is_category_P (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3276 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3277 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3278 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3279 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3280 is_property_line_separator (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3281 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3282 return is_category_Zl (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3283 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3284 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3285 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3286 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3287 is_property_paragraph_separator (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3288 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3289 return is_category_Zp (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3290 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3291 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3292 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3293 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3294 is_property_quotation_mark (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3295 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3296 return ((unicode_properties[ch] & (1ULL << PROP_QUOTATION_MARK)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3297 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3298 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3299 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3300 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3301 is_property_sentence_terminal (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3302 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3303 return ((unicode_properties[ch] & (1ULL << PROP_STERM)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3304 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3305 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3306 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3307 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3308 is_property_terminal_punctuation (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3309 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3310 return ((unicode_properties[ch] & (1ULL << PROP_TERMINAL_PUNCTUATION)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3311 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3312 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3313 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3314 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3315 is_property_currency_symbol (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3316 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3317 return is_category_Sc (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3318 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3319 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3320 /* See Unicode 3.0 book, section 4.9, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3321 PropList.txt, UCD.html, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3322 DerivedCoreProperties.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3323 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3324 is_property_math (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3325 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3326 bool result1 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3327 is_category_Sm (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3328 || ((unicode_properties[ch] & (1ULL << PROP_OTHER_MATH)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3329 bool result2 = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3330 ((unicode_properties[ch] & (1ULL << PROP_MATH)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3331 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3332 if (result1 != result2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3333 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3334 return result1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3335 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3336 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3337 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3338 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3339 is_property_other_math (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3340 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3341 return ((unicode_properties[ch] & (1ULL << PROP_OTHER_MATH)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3342 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3343 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3344 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3345 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3346 is_property_paired_punctuation (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3347 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3348 return unicode_pairedpunctuation[ch]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3349 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3350 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3351 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3352 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3353 is_property_left_of_pair (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3354 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3355 return unicode_leftofpair[ch]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3356 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3357 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3358 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3359 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3360 is_property_combining (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3361 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3362 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3363 && (strcmp (unicode_attributes[ch].combining, "0") != 0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3364 || is_category_Mc (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3365 || is_category_Me (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3366 || is_category_Mn (ch))); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3367 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3368 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3369 #if 0 /* same as is_property_bidi_non_spacing_mark */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3370 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3371 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3372 is_property_non_spacing (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3373 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3374 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3375 && get_bidi_category (ch) == UC_BIDI_NSM); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3376 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3377 #endif |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3378 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3379 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3380 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3381 is_property_composite (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3382 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3383 /* This definition differs from the one in PropList-3.0.1.txt, but is more |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3384 logical in some sense. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3385 if (ch >= 0xAC00 && ch <= 0xD7A4) /* Hangul Syllables */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3386 return true; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3387 if (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3388 && unicode_attributes[ch].decomposition != NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3389 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3390 /* Test whether the decomposition contains more than one character, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3391 and the first is not a space. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3392 const char *decomp = unicode_attributes[ch].decomposition; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3393 if (decomp[0] == '<') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3394 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3395 decomp = strchr (decomp, '>') + 1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3396 if (decomp[0] == ' ') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3397 decomp++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3398 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3399 return strchr (decomp, ' ') != NULL && strncmp (decomp, "0020 ", 5) != 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3400 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3401 return false; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3402 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3403 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3404 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3405 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3406 is_property_decimal_digit (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3407 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3408 return is_category_Nd (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3409 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3410 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3411 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3412 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3413 is_property_numeric (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3414 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3415 return ((get_numeric_value (ch)).denominator > 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3416 || (ch == 0x09F8) /* BENGALI CURRENCY NUMERATOR ONE LESS THAN THE DENOMINATOR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3417 || (ch == 0x2183); /* ROMAN NUMERAL REVERSED ONE HUNDRED */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3418 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3419 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3420 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3421 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3422 is_property_diacritic (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3423 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3424 return ((unicode_properties[ch] & (1ULL << PROP_DIACRITIC)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3425 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3426 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3427 /* See PropList.txt, UCD.html. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3428 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3429 is_property_extender (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3430 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3431 return ((unicode_properties[ch] & (1ULL << PROP_EXTENDER)) != 0); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3432 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3433 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3434 /* See PropList-3.0.1.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3435 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3436 is_property_ignorable_control (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3437 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3438 return ((is_category_Cc (ch) && get_bidi_category (ch) == UC_BIDI_BN) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3439 || is_category_Cf (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3440 && ch != 0x0000; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3441 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3442 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3443 /* ------------------------------------------------------------------------- */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3444 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3445 /* Output all properties. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3446 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3447 output_properties (const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3448 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3449 #define PROPERTY(P) \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3450 debug_output_predicate ("unictype/pr_" #P ".txt", is_property_ ## P); \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3451 output_predicate_test ("../tests/unictype/test-pr_" #P ".c", is_property_ ## P, "uc_is_property_" #P " (c)"); \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3452 output_predicate ("unictype/pr_" #P ".h", is_property_ ## P, "u_property_" #P, "Properties", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3453 PROPERTY(white_space) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3454 PROPERTY(alphabetic) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3455 PROPERTY(other_alphabetic) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3456 PROPERTY(not_a_character) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3457 PROPERTY(default_ignorable_code_point) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3458 PROPERTY(other_default_ignorable_code_point) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3459 PROPERTY(deprecated) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3460 PROPERTY(logical_order_exception) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3461 PROPERTY(variation_selector) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3462 PROPERTY(private_use) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3463 PROPERTY(unassigned_code_value) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3464 PROPERTY(uppercase) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3465 PROPERTY(other_uppercase) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3466 PROPERTY(lowercase) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3467 PROPERTY(other_lowercase) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3468 PROPERTY(titlecase) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3469 PROPERTY(soft_dotted) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3470 PROPERTY(id_start) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3471 PROPERTY(other_id_start) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3472 PROPERTY(id_continue) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3473 PROPERTY(other_id_continue) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3474 PROPERTY(xid_start) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3475 PROPERTY(xid_continue) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3476 PROPERTY(pattern_white_space) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3477 PROPERTY(pattern_syntax) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3478 PROPERTY(join_control) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3479 PROPERTY(grapheme_base) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3480 PROPERTY(grapheme_extend) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3481 PROPERTY(other_grapheme_extend) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3482 PROPERTY(grapheme_link) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3483 PROPERTY(bidi_control) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3484 PROPERTY(bidi_left_to_right) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3485 PROPERTY(bidi_hebrew_right_to_left) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3486 PROPERTY(bidi_arabic_right_to_left) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3487 PROPERTY(bidi_european_digit) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3488 PROPERTY(bidi_eur_num_separator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3489 PROPERTY(bidi_eur_num_terminator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3490 PROPERTY(bidi_arabic_digit) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3491 PROPERTY(bidi_common_separator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3492 PROPERTY(bidi_block_separator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3493 PROPERTY(bidi_segment_separator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3494 PROPERTY(bidi_whitespace) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3495 PROPERTY(bidi_non_spacing_mark) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3496 PROPERTY(bidi_boundary_neutral) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3497 PROPERTY(bidi_pdf) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3498 PROPERTY(bidi_embedding_or_override) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3499 PROPERTY(bidi_other_neutral) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3500 PROPERTY(hex_digit) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3501 PROPERTY(ascii_hex_digit) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3502 PROPERTY(ideographic) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3503 PROPERTY(unified_ideograph) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3504 PROPERTY(radical) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3505 PROPERTY(ids_binary_operator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3506 PROPERTY(ids_trinary_operator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3507 PROPERTY(zero_width) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3508 PROPERTY(space) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3509 PROPERTY(non_break) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3510 PROPERTY(iso_control) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3511 PROPERTY(format_control) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3512 PROPERTY(dash) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3513 PROPERTY(hyphen) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3514 PROPERTY(punctuation) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3515 PROPERTY(line_separator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3516 PROPERTY(paragraph_separator) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3517 PROPERTY(quotation_mark) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3518 PROPERTY(sentence_terminal) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3519 PROPERTY(terminal_punctuation) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3520 PROPERTY(currency_symbol) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3521 PROPERTY(math) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3522 PROPERTY(other_math) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3523 PROPERTY(paired_punctuation) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3524 PROPERTY(left_of_pair) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3525 PROPERTY(combining) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3526 PROPERTY(composite) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3527 PROPERTY(decimal_digit) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3528 PROPERTY(numeric) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3529 PROPERTY(diacritic) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3530 PROPERTY(extender) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3531 PROPERTY(ignorable_control) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3532 #undef PROPERTY |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3533 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3534 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3535 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3536 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3537 /* Scripts. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3538 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3539 static const char *scripts[256]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3540 static unsigned int numscripts; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3541 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3542 static uint8_t unicode_scripts[0x110000]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3543 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3544 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3545 fill_scripts (const char *scripts_filename) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3546 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3547 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3548 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3549 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3550 stream = fopen (scripts_filename, "r"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3551 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3552 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3553 fprintf (stderr, "error during fopen of '%s'\n", scripts_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3554 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3555 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3556 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3557 numscripts = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3558 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3559 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3560 unicode_scripts[i] = (uint8_t)~(uint8_t)0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3561 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3562 for (;;) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3563 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3564 char buf[200+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3565 unsigned int i1, i2; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3566 char padding[200+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3567 char scriptname[200+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3568 int script; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3569 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3570 if (fscanf (stream, "%200[^\n]\n", buf) < 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3571 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3572 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3573 if (buf[0] == '\0' || buf[0] == '#') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3574 continue; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3575 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3576 if (sscanf (buf, "%X..%X%[ ;]%[^ ]", &i1, &i2, padding, scriptname) != 4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3577 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3578 if (sscanf (buf, "%X%[ ;]%[^ ]", &i1, padding, scriptname) != 3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3579 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3580 fprintf (stderr, "parse error in '%s'\n", scripts_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3581 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3582 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3583 i2 = i1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3584 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3585 if (i2 < i1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3586 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3587 if (i2 >= 0x110000) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3588 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3589 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3590 for (script = numscripts - 1; script >= 0; script--) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3591 if (strcmp (scripts[script], scriptname) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3592 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3593 if (script < 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3594 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3595 scripts[numscripts] = strdup (scriptname); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3596 script = numscripts; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3597 numscripts++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3598 if (numscripts == 256) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3599 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3600 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3601 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3602 for (i = i1; i <= i2; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3603 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3604 if (unicode_scripts[i] != (uint8_t)~(uint8_t)0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3605 fprintf (stderr, "0x%04X belongs to multiple scripts\n", i); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3606 unicode_scripts[i] = script; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3607 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3608 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3609 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3610 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3611 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3612 fprintf (stderr, "error reading from '%s'\n", scripts_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3613 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3614 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3615 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3616 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3617 /* Construction of sparse 3-level tables. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3618 #define TABLE script_table |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3619 #define ELEMENT uint8_t |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3620 #define DEFAULT (uint8_t)~(uint8_t)0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3621 #define xmalloc malloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3622 #define xrealloc realloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3623 #include "3level.h" |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3624 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3625 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3626 output_scripts (const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3627 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3628 const char *filename = "unictype/scripts.h"; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3629 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3630 unsigned int ch, s, i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3631 struct script_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3632 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3633 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3634 typedef struct |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3635 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3636 const char *lowercase_name; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3637 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3638 scriptinfo_t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3639 scriptinfo_t scriptinfo[256]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3640 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3641 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3642 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3643 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3644 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3645 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3646 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3647 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3648 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3649 fprintf (stream, "/* Unicode scripts. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3650 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3651 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3652 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3653 for (s = 0; s < numscripts; s++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3654 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3655 char *lcp = strdup (scripts[s]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3656 char *cp; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3657 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3658 for (cp = lcp; *cp != '\0'; cp++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3659 if (*cp >= 'A' && *cp <= 'Z') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3660 *cp += 'a' - 'A'; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3661 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3662 scriptinfo[s].lowercase_name = lcp; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3663 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3664 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3665 for (s = 0; s < numscripts; s++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3666 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3667 fprintf (stream, "static const uc_interval_t script_%s_intervals[] =\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3668 scriptinfo[s].lowercase_name); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3669 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3670 i = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3671 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3672 if (unicode_scripts[ch] == s) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3673 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3674 unsigned int start; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3675 unsigned int end; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3676 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3677 start = ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3678 while (ch + 1 < 0x110000 && unicode_scripts[ch + 1] == s) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3679 ch++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3680 end = ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3681 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3682 if (i > 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3683 fprintf (stream, ",\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3684 if (start == end) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3685 fprintf (stream, " { 0x%04X, 1, 1 }", start); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3686 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3687 fprintf (stream, " { 0x%04X, 1, 0 }, { 0x%04X, 0, 1 }", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3688 start, end); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3689 i++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3690 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3691 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3692 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3693 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3694 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3695 fprintf (stream, "static const uc_script_t scripts[%d] =\n", numscripts); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3696 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3697 for (s = 0; s < numscripts; s++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3698 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3699 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3700 fprintf (stream, " sizeof (script_%s_intervals) / sizeof (uc_interval_t),\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3701 scriptinfo[s].lowercase_name); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3702 fprintf (stream, " script_%s_intervals,\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3703 scriptinfo[s].lowercase_name); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3704 fprintf (stream, " \"%s\"\n", scripts[s]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3705 fprintf (stream, " }"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3706 if (s+1 < numscripts) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3707 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3708 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3709 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3710 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3711 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3712 t.p = 7; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3713 t.q = 9; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3714 script_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3715 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3716 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3717 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3718 unsigned int s = unicode_scripts[ch]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3719 if (s != (uint8_t)~(uint8_t)0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3720 script_table_add (&t, ch, s); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3721 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3722 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3723 script_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3724 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3725 /* Offsets in t.result, in memory of this process. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3726 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3727 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3728 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3729 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3730 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3731 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3732 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3733 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3734 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3735 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3736 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3737 fprintf (stream, "#define script_header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3738 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3739 fprintf (stream, "static const\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3740 fprintf (stream, "struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3741 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3742 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3743 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3744 fprintf (stream, " unsigned char level3[%zu << %d];\n", t.level3_size, t.p); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3745 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3746 fprintf (stream, "u_script =\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3747 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3748 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3749 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3750 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3751 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3752 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3753 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3754 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3755 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3756 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3757 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3758 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3759 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
3760 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3761 (offset - level2_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3762 if (i+1 < t.level1_size) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3763 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3764 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3765 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3766 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3767 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3768 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3769 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3770 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3771 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3772 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3773 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3774 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3775 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3776 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3777 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3778 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3779 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
3780 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3781 (offset - level3_offset) / sizeof (uint8_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3782 if (i+1 < t.level2_size << t.q) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3783 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3784 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3785 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3786 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3787 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3788 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3789 if (t.level3_size << t.p > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3790 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3791 for (i = 0; i < t.level3_size << t.p; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3792 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3793 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3794 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3795 fprintf (stream, " %3d", ((uint8_t *) (t.result + level3_offset))[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3796 if (i+1 < t.level3_size << t.p) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3797 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3798 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3799 if (t.level3_size << t.p > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3800 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3801 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3802 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3803 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3804 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3805 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3806 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3807 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3808 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3809 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3810 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3811 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3812 output_scripts_byname (const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3813 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3814 const char *filename = "unictype/scripts_byname.gperf"; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3815 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3816 unsigned int s; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3817 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3818 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3819 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3820 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3821 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3822 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3823 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3824 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3825 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3826 fprintf (stream, "/* Unicode scripts. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3827 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3828 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3829 fprintf (stream, "struct named_script { const char *name; unsigned int index; };\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3830 fprintf (stream, "%%struct-type\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3831 fprintf (stream, "%%language=ANSI-C\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3832 fprintf (stream, "%%define hash-function-name scripts_hash\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3833 fprintf (stream, "%%define lookup-function-name uc_script_lookup\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3834 fprintf (stream, "%%readonly-tables\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3835 fprintf (stream, "%%global-table\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3836 fprintf (stream, "%%define word-array-name script_names\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3837 fprintf (stream, "%%%%\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3838 for (s = 0; s < numscripts; s++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3839 fprintf (stream, "%s, %u\n", scripts[s], s); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3840 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3841 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3842 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3843 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3844 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3845 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3846 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3847 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3848 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3849 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3850 /* Blocks. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3851 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3852 typedef struct { unsigned int start; unsigned int end; const char *name; } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3853 block_t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3854 static block_t blocks[256]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3855 static unsigned int numblocks; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3856 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3857 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3858 fill_blocks (const char *blocks_filename) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3859 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3860 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3861 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3862 stream = fopen (blocks_filename, "r"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3863 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3864 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3865 fprintf (stderr, "error during fopen of '%s'\n", blocks_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3866 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3867 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3868 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3869 for (;;) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3870 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3871 char buf[200+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3872 unsigned int i1, i2; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3873 char padding[200+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3874 char blockname[200+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3875 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3876 if (fscanf (stream, "%200[^\n]\n", buf) < 1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3877 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3878 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3879 if (buf[0] == '\0' || buf[0] == '#') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3880 continue; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3881 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3882 if (sscanf (buf, "%X..%X%[ ;]%[^\r]", &i1, &i2, padding, blockname) != 4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3883 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3884 fprintf (stderr, "parse error in '%s'\n", blocks_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3885 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3886 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3887 blocks[numblocks].start = i1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3888 blocks[numblocks].end = i2; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3889 blocks[numblocks].name = strdup (blockname); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3890 /* It must be sorted. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3891 if (numblocks > 0 && !(blocks[numblocks-1].end < blocks[numblocks].start)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3892 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3893 numblocks++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3894 if (numblocks == 256) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3895 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3896 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3897 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3898 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3899 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3900 fprintf (stderr, "error reading from '%s'\n", blocks_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3901 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3902 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3903 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3904 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3905 /* Return the smallest block index among the blocks for characters >= ch. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3906 static unsigned int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3907 block_first_index (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3908 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3909 /* Binary search. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3910 unsigned int lo = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3911 unsigned int hi = numblocks; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3912 /* Invariants: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3913 All blocks[i], i < lo, have blocks[i].end < ch, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3914 all blocks[i], i >= hi, have blocks[i].end >= ch. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3915 while (lo < hi) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3916 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3917 unsigned int mid = (lo + hi) / 2; /* >= lo, < hi */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3918 if (blocks[mid].end < ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3919 lo = mid + 1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3920 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3921 hi = mid; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3922 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3923 return hi; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3924 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3925 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3926 /* Return the largest block index among the blocks for characters <= ch, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3927 plus 1. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3928 static unsigned int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3929 block_last_index (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3930 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3931 /* Binary search. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3932 unsigned int lo = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3933 unsigned int hi = numblocks; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3934 /* Invariants: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3935 All blocks[i], i < lo, have blocks[i].start <= ch, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3936 all blocks[i], i >= hi, have blocks[i].start > ch. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3937 while (lo < hi) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3938 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3939 unsigned int mid = (lo + hi) / 2; /* >= lo, < hi */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3940 if (blocks[mid].start <= ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3941 lo = mid + 1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3942 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3943 hi = mid; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3944 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3945 return hi; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3946 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3947 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3948 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3949 output_blocks (const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3950 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3951 const char *filename = "unictype/blocks.h"; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3952 const unsigned int shift = 8; /* bits to shift away for array access */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3953 const unsigned int threshold = 0x30000; /* cut-off table here to save space */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3954 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3955 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3956 unsigned int i1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3957 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3958 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3959 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3960 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3961 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3962 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3963 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3964 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3965 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3966 fprintf (stream, "/* Unicode blocks. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3967 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3968 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3969 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3970 fprintf (stream, "static const uc_block_t blocks[] =\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3971 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3972 for (i = 0; i < numblocks; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3973 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3974 fprintf (stream, " { 0x%04X, 0x%04X, \"%s\" }", blocks[i].start, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3975 blocks[i].end, blocks[i].name); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3976 if (i+1 < numblocks) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3977 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3978 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3979 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3980 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3981 fprintf (stream, "#define blocks_level1_shift %d\n", shift); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3982 fprintf (stream, "#define blocks_level1_threshold 0x%04X\n", threshold); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3983 fprintf (stream, "static const uint8_t blocks_level1[%d * 2] =\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3984 threshold >> shift); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3985 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3986 for (i1 = 0; i1 < (threshold >> shift); i1++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3987 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3988 unsigned int first_index = block_first_index (i1 << shift); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3989 unsigned int last_index = block_last_index (((i1 + 1) << shift) - 1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3990 fprintf (stream, " %3d, %3d", first_index, last_index); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3991 if (i1+1 < (threshold >> shift)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3992 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3993 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3994 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3995 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3996 fprintf (stream, "#define blocks_upper_first_index %d\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3997 block_first_index (threshold)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3998 fprintf (stream, "#define blocks_upper_last_index %d\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3999 block_last_index (0x10FFFF)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4000 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4001 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4002 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4003 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4004 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4005 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4006 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4007 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4008 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4009 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4010 /* C and Java syntax. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4011 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4012 enum |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4013 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4014 UC_IDENTIFIER_START, /* valid as first or subsequent character */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4015 UC_IDENTIFIER_VALID, /* valid as subsequent character only */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4016 UC_IDENTIFIER_INVALID, /* not valid */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4017 UC_IDENTIFIER_IGNORABLE /* ignorable (Java only) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4018 }; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4019 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4020 /* ISO C 99 section 6.4.(3). */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4021 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4022 is_c_whitespace (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4023 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4024 return (ch == ' ' /* space */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4025 || ch == '\t' /* horizontal tab */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4026 || ch == '\n' || ch == '\r' /* new-line */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4027 || ch == '\v' /* vertical tab */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4028 || ch == '\f'); /* form-feed */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4029 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4030 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4031 /* ISO C 99 section 6.4.2.1 and appendix D. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4032 static int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4033 c_ident_category (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4034 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4035 /* Section 6.4.2.1. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4036 if (ch >= '0' && ch <= '9') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4037 return UC_IDENTIFIER_VALID; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4038 if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || ch == '_') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4039 return UC_IDENTIFIER_START; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4040 /* Appendix D. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4041 if (0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4042 /* Latin */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4043 || (ch == 0x00AA) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4044 || (ch == 0x00BA) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4045 || (ch >= 0x00C0 && ch <= 0x00D6) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4046 || (ch >= 0x00D8 && ch <= 0x00F6) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4047 || (ch >= 0x00F8 && ch <= 0x01F5) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4048 || (ch >= 0x01FA && ch <= 0x0217) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4049 || (ch >= 0x0250 && ch <= 0x02A8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4050 || (ch >= 0x1E00 && ch <= 0x1E9B) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4051 || (ch >= 0x1EA0 && ch <= 0x1EF9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4052 || (ch == 0x207F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4053 /* Greek */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4054 || (ch == 0x0386) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4055 || (ch >= 0x0388 && ch <= 0x038A) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4056 || (ch == 0x038C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4057 || (ch >= 0x038E && ch <= 0x03A1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4058 || (ch >= 0x03A3 && ch <= 0x03CE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4059 || (ch >= 0x03D0 && ch <= 0x03D6) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4060 || (ch == 0x03DA) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4061 || (ch == 0x03DC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4062 || (ch == 0x03DE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4063 || (ch == 0x03E0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4064 || (ch >= 0x03E2 && ch <= 0x03F3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4065 || (ch >= 0x1F00 && ch <= 0x1F15) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4066 || (ch >= 0x1F18 && ch <= 0x1F1D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4067 || (ch >= 0x1F20 && ch <= 0x1F45) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4068 || (ch >= 0x1F48 && ch <= 0x1F4D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4069 || (ch >= 0x1F50 && ch <= 0x1F57) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4070 || (ch == 0x1F59) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4071 || (ch == 0x1F5B) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4072 || (ch == 0x1F5D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4073 || (ch >= 0x1F5F && ch <= 0x1F7D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4074 || (ch >= 0x1F80 && ch <= 0x1FB4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4075 || (ch >= 0x1FB6 && ch <= 0x1FBC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4076 || (ch >= 0x1FC2 && ch <= 0x1FC4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4077 || (ch >= 0x1FC6 && ch <= 0x1FCC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4078 || (ch >= 0x1FD0 && ch <= 0x1FD3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4079 || (ch >= 0x1FD6 && ch <= 0x1FDB) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4080 || (ch >= 0x1FE0 && ch <= 0x1FEC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4081 || (ch >= 0x1FF2 && ch <= 0x1FF4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4082 || (ch >= 0x1FF6 && ch <= 0x1FFC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4083 /* Cyrillic */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4084 || (ch >= 0x0401 && ch <= 0x040C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4085 || (ch >= 0x040E && ch <= 0x044F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4086 || (ch >= 0x0451 && ch <= 0x045C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4087 || (ch >= 0x045E && ch <= 0x0481) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4088 || (ch >= 0x0490 && ch <= 0x04C4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4089 || (ch >= 0x04C7 && ch <= 0x04C8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4090 || (ch >= 0x04CB && ch <= 0x04CC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4091 || (ch >= 0x04D0 && ch <= 0x04EB) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4092 || (ch >= 0x04EE && ch <= 0x04F5) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4093 || (ch >= 0x04F8 && ch <= 0x04F9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4094 /* Armenian */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4095 || (ch >= 0x0531 && ch <= 0x0556) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4096 || (ch >= 0x0561 && ch <= 0x0587) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4097 /* Hebrew */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4098 || (ch >= 0x05B0 && ch <= 0x05B9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4099 || (ch >= 0x05BB && ch <= 0x05BD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4100 || (ch == 0x05BF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4101 || (ch >= 0x05C1 && ch <= 0x05C2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4102 || (ch >= 0x05D0 && ch <= 0x05EA) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4103 || (ch >= 0x05F0 && ch <= 0x05F2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4104 /* Arabic */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4105 || (ch >= 0x0621 && ch <= 0x063A) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4106 || (ch >= 0x0640 && ch <= 0x0652) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4107 || (ch >= 0x0670 && ch <= 0x06B7) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4108 || (ch >= 0x06BA && ch <= 0x06BE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4109 || (ch >= 0x06C0 && ch <= 0x06CE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4110 || (ch >= 0x06D0 && ch <= 0x06DC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4111 || (ch >= 0x06E5 && ch <= 0x06E8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4112 || (ch >= 0x06EA && ch <= 0x06ED) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4113 /* Devanagari */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4114 || (ch >= 0x0901 && ch <= 0x0903) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4115 || (ch >= 0x0905 && ch <= 0x0939) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4116 || (ch >= 0x093E && ch <= 0x094D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4117 || (ch >= 0x0950 && ch <= 0x0952) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4118 || (ch >= 0x0958 && ch <= 0x0963) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4119 /* Bengali */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4120 || (ch >= 0x0981 && ch <= 0x0983) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4121 || (ch >= 0x0985 && ch <= 0x098C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4122 || (ch >= 0x098F && ch <= 0x0990) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4123 || (ch >= 0x0993 && ch <= 0x09A8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4124 || (ch >= 0x09AA && ch <= 0x09B0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4125 || (ch == 0x09B2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4126 || (ch >= 0x09B6 && ch <= 0x09B9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4127 || (ch >= 0x09BE && ch <= 0x09C4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4128 || (ch >= 0x09C7 && ch <= 0x09C8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4129 || (ch >= 0x09CB && ch <= 0x09CD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4130 || (ch >= 0x09DC && ch <= 0x09DD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4131 || (ch >= 0x09DF && ch <= 0x09E3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4132 || (ch >= 0x09F0 && ch <= 0x09F1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4133 /* Gurmukhi */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4134 || (ch == 0x0A02) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4135 || (ch >= 0x0A05 && ch <= 0x0A0A) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4136 || (ch >= 0x0A0F && ch <= 0x0A10) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4137 || (ch >= 0x0A13 && ch <= 0x0A28) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4138 || (ch >= 0x0A2A && ch <= 0x0A30) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4139 || (ch >= 0x0A32 && ch <= 0x0A33) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4140 || (ch >= 0x0A35 && ch <= 0x0A36) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4141 || (ch >= 0x0A38 && ch <= 0x0A39) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4142 || (ch >= 0x0A3E && ch <= 0x0A42) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4143 || (ch >= 0x0A47 && ch <= 0x0A48) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4144 || (ch >= 0x0A4B && ch <= 0x0A4D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4145 || (ch >= 0x0A59 && ch <= 0x0A5C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4146 || (ch == 0x0A5E) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4147 || (ch == 0x0A74) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4148 /* Gujarati */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4149 || (ch >= 0x0A81 && ch <= 0x0A83) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4150 || (ch >= 0x0A85 && ch <= 0x0A8B) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4151 || (ch == 0x0A8D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4152 || (ch >= 0x0A8F && ch <= 0x0A91) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4153 || (ch >= 0x0A93 && ch <= 0x0AA8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4154 || (ch >= 0x0AAA && ch <= 0x0AB0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4155 || (ch >= 0x0AB2 && ch <= 0x0AB3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4156 || (ch >= 0x0AB5 && ch <= 0x0AB9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4157 || (ch >= 0x0ABD && ch <= 0x0AC5) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4158 || (ch >= 0x0AC7 && ch <= 0x0AC9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4159 || (ch >= 0x0ACB && ch <= 0x0ACD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4160 || (ch == 0x0AD0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4161 || (ch == 0x0AE0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4162 /* Oriya */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4163 || (ch >= 0x0B01 && ch <= 0x0B03) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4164 || (ch >= 0x0B05 && ch <= 0x0B0C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4165 || (ch >= 0x0B0F && ch <= 0x0B10) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4166 || (ch >= 0x0B13 && ch <= 0x0B28) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4167 || (ch >= 0x0B2A && ch <= 0x0B30) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4168 || (ch >= 0x0B32 && ch <= 0x0B33) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4169 || (ch >= 0x0B36 && ch <= 0x0B39) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4170 || (ch >= 0x0B3E && ch <= 0x0B43) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4171 || (ch >= 0x0B47 && ch <= 0x0B48) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4172 || (ch >= 0x0B4B && ch <= 0x0B4D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4173 || (ch >= 0x0B5C && ch <= 0x0B5D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4174 || (ch >= 0x0B5F && ch <= 0x0B61) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4175 /* Tamil */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4176 || (ch >= 0x0B82 && ch <= 0x0B83) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4177 || (ch >= 0x0B85 && ch <= 0x0B8A) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4178 || (ch >= 0x0B8E && ch <= 0x0B90) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4179 || (ch >= 0x0B92 && ch <= 0x0B95) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4180 || (ch >= 0x0B99 && ch <= 0x0B9A) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4181 || (ch == 0x0B9C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4182 || (ch >= 0x0B9E && ch <= 0x0B9F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4183 || (ch >= 0x0BA3 && ch <= 0x0BA4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4184 || (ch >= 0x0BA8 && ch <= 0x0BAA) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4185 || (ch >= 0x0BAE && ch <= 0x0BB5) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4186 || (ch >= 0x0BB7 && ch <= 0x0BB9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4187 || (ch >= 0x0BBE && ch <= 0x0BC2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4188 || (ch >= 0x0BC6 && ch <= 0x0BC8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4189 || (ch >= 0x0BCA && ch <= 0x0BCD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4190 /* Telugu */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4191 || (ch >= 0x0C01 && ch <= 0x0C03) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4192 || (ch >= 0x0C05 && ch <= 0x0C0C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4193 || (ch >= 0x0C0E && ch <= 0x0C10) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4194 || (ch >= 0x0C12 && ch <= 0x0C28) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4195 || (ch >= 0x0C2A && ch <= 0x0C33) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4196 || (ch >= 0x0C35 && ch <= 0x0C39) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4197 || (ch >= 0x0C3E && ch <= 0x0C44) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4198 || (ch >= 0x0C46 && ch <= 0x0C48) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4199 || (ch >= 0x0C4A && ch <= 0x0C4D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4200 || (ch >= 0x0C60 && ch <= 0x0C61) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4201 /* Kannada */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4202 || (ch >= 0x0C82 && ch <= 0x0C83) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4203 || (ch >= 0x0C85 && ch <= 0x0C8C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4204 || (ch >= 0x0C8E && ch <= 0x0C90) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4205 || (ch >= 0x0C92 && ch <= 0x0CA8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4206 || (ch >= 0x0CAA && ch <= 0x0CB3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4207 || (ch >= 0x0CB5 && ch <= 0x0CB9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4208 || (ch >= 0x0CBE && ch <= 0x0CC4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4209 || (ch >= 0x0CC6 && ch <= 0x0CC8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4210 || (ch >= 0x0CCA && ch <= 0x0CCD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4211 || (ch == 0x0CDE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4212 || (ch >= 0x0CE0 && ch <= 0x0CE1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4213 /* Malayalam */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4214 || (ch >= 0x0D02 && ch <= 0x0D03) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4215 || (ch >= 0x0D05 && ch <= 0x0D0C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4216 || (ch >= 0x0D0E && ch <= 0x0D10) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4217 || (ch >= 0x0D12 && ch <= 0x0D28) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4218 || (ch >= 0x0D2A && ch <= 0x0D39) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4219 || (ch >= 0x0D3E && ch <= 0x0D43) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4220 || (ch >= 0x0D46 && ch <= 0x0D48) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4221 || (ch >= 0x0D4A && ch <= 0x0D4D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4222 || (ch >= 0x0D60 && ch <= 0x0D61) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4223 /* Thai */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4224 || (ch >= 0x0E01 && ch <= 0x0E3A) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4225 || (ch >= 0x0E40 && ch <= 0x0E5B) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4226 /* Lao */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4227 || (ch >= 0x0E81 && ch <= 0x0E82) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4228 || (ch == 0x0E84) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4229 || (ch >= 0x0E87 && ch <= 0x0E88) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4230 || (ch == 0x0E8A) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4231 || (ch == 0x0E8D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4232 || (ch >= 0x0E94 && ch <= 0x0E97) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4233 || (ch >= 0x0E99 && ch <= 0x0E9F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4234 || (ch >= 0x0EA1 && ch <= 0x0EA3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4235 || (ch == 0x0EA5) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4236 || (ch == 0x0EA7) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4237 || (ch >= 0x0EAA && ch <= 0x0EAB) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4238 || (ch >= 0x0EAD && ch <= 0x0EAE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4239 || (ch >= 0x0EB0 && ch <= 0x0EB9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4240 || (ch >= 0x0EBB && ch <= 0x0EBD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4241 || (ch >= 0x0EC0 && ch <= 0x0EC4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4242 || (ch == 0x0EC6) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4243 || (ch >= 0x0EC8 && ch <= 0x0ECD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4244 || (ch >= 0x0EDC && ch <= 0x0EDD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4245 /* Tibetan */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4246 || (ch == 0x0F00) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4247 || (ch >= 0x0F18 && ch <= 0x0F19) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4248 || (ch == 0x0F35) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4249 || (ch == 0x0F37) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4250 || (ch == 0x0F39) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4251 || (ch >= 0x0F3E && ch <= 0x0F47) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4252 || (ch >= 0x0F49 && ch <= 0x0F69) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4253 || (ch >= 0x0F71 && ch <= 0x0F84) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4254 || (ch >= 0x0F86 && ch <= 0x0F8B) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4255 || (ch >= 0x0F90 && ch <= 0x0F95) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4256 || (ch == 0x0F97) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4257 || (ch >= 0x0F99 && ch <= 0x0FAD) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4258 || (ch >= 0x0FB1 && ch <= 0x0FB7) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4259 || (ch == 0x0FB9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4260 /* Georgian */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4261 || (ch >= 0x10A0 && ch <= 0x10C5) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4262 || (ch >= 0x10D0 && ch <= 0x10F6) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4263 /* Hiragana */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4264 || (ch >= 0x3041 && ch <= 0x3093) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4265 || (ch >= 0x309B && ch <= 0x309C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4266 /* Katakana */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4267 || (ch >= 0x30A1 && ch <= 0x30F6) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4268 || (ch >= 0x30FB && ch <= 0x30FC) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4269 /* Bopomofo */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4270 || (ch >= 0x3105 && ch <= 0x312C) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4271 /* CJK Unified Ideographs */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4272 || (ch >= 0x4E00 && ch <= 0x9FA5) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4273 /* Hangul */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4274 || (ch >= 0xAC00 && ch <= 0xD7A3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4275 /* Digits */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4276 || (ch >= 0x0660 && ch <= 0x0669) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4277 || (ch >= 0x06F0 && ch <= 0x06F9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4278 || (ch >= 0x0966 && ch <= 0x096F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4279 || (ch >= 0x09E6 && ch <= 0x09EF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4280 || (ch >= 0x0A66 && ch <= 0x0A6F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4281 || (ch >= 0x0AE6 && ch <= 0x0AEF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4282 || (ch >= 0x0B66 && ch <= 0x0B6F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4283 || (ch >= 0x0BE7 && ch <= 0x0BEF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4284 || (ch >= 0x0C66 && ch <= 0x0C6F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4285 || (ch >= 0x0CE6 && ch <= 0x0CEF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4286 || (ch >= 0x0D66 && ch <= 0x0D6F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4287 || (ch >= 0x0E50 && ch <= 0x0E59) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4288 || (ch >= 0x0ED0 && ch <= 0x0ED9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4289 || (ch >= 0x0F20 && ch <= 0x0F33) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4290 /* Special characters */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4291 || (ch == 0x00B5) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4292 || (ch == 0x00B7) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4293 || (ch >= 0x02B0 && ch <= 0x02B8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4294 || (ch == 0x02BB) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4295 || (ch >= 0x02BD && ch <= 0x02C1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4296 || (ch >= 0x02D0 && ch <= 0x02D1) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4297 || (ch >= 0x02E0 && ch <= 0x02E4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4298 || (ch == 0x037A) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4299 || (ch == 0x0559) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4300 || (ch == 0x093D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4301 || (ch == 0x0B3D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4302 || (ch == 0x1FBE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4303 || (ch >= 0x203F && ch <= 0x2040) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4304 || (ch == 0x2102) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4305 || (ch == 0x2107) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4306 || (ch >= 0x210A && ch <= 0x2113) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4307 || (ch == 0x2115) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4308 || (ch >= 0x2118 && ch <= 0x211D) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4309 || (ch == 0x2124) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4310 || (ch == 0x2126) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4311 || (ch == 0x2128) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4312 || (ch >= 0x212A && ch <= 0x2131) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4313 || (ch >= 0x2133 && ch <= 0x2138) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4314 || (ch >= 0x2160 && ch <= 0x2182) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4315 || (ch >= 0x3005 && ch <= 0x3007) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4316 || (ch >= 0x3021 && ch <= 0x3029) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4317 ) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4318 return UC_IDENTIFIER_START; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4319 return UC_IDENTIFIER_INVALID; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4320 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4321 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4322 /* The Java Language Specification, 3rd edition, §3.6. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4323 http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#95710 */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4324 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4325 is_java_whitespace (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4326 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4327 return (ch == ' ' || ch == '\t' || ch == '\f' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4328 || ch == '\n' || ch == '\r'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4329 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4330 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4331 /* The Java Language Specification, 3rd edition, §3.8. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4332 http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#40625 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4333 and Character.isJavaIdentifierStart and Character.isJavaIdentifierPart */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4334 static int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4335 java_ident_category (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4336 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4337 /* FIXME: Check this against Sun's JDK implementation. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4338 if (is_category_L (ch) /* = Character.isLetter(ch) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4339 || is_category_Nl (ch) /* = Character.getType(ch)==LETTER_NUMBER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4340 || is_category_Sc (ch) /* currency symbol */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4341 || is_category_Pc (ch) /* connector punctuation */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4342 ) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4343 return UC_IDENTIFIER_START; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4344 if (is_category_Nd (ch) /* digit */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4345 || is_category_Mc (ch) /* combining mark */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4346 || is_category_Mn (ch) /* non-spacing mark */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4347 ) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4348 return UC_IDENTIFIER_VALID; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4349 if ((ch >= 0x0000 && ch <= 0x0008) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4350 || (ch >= 0x000E && ch <= 0x001B) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4351 || (ch >= 0x007F && ch <= 0x009F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4352 || is_category_Cf (ch) /* = Character.getType(ch)==FORMAT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4353 ) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4354 return UC_IDENTIFIER_IGNORABLE; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4355 return UC_IDENTIFIER_INVALID; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4356 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4357 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4358 /* Construction of sparse 3-level tables. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4359 #define TABLE identsyntax_table |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4360 #define ELEMENT uint8_t |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4361 #define DEFAULT UC_IDENTIFIER_INVALID |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4362 #define xmalloc malloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4363 #define xrealloc realloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4364 #include "3level.h" |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4365 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4366 /* Output an identifier syntax categorization in a three-level bitmap. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4367 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4368 output_ident_category (const char *filename, int (*predicate) (unsigned int), const char *name, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4369 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4370 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4371 unsigned int ch, i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4372 struct identsyntax_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4373 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4374 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4375 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4376 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4377 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4378 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4379 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4380 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4381 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4382 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4383 fprintf (stream, "/* Language syntax properties of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4384 fprintf (stream, "/* Generated automatically by gen-ctype.c for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4385 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4386 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4387 t.p = 7; /* or 8 */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4388 t.q = 5; /* or 4 */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4389 identsyntax_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4390 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4391 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4392 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4393 int syntaxcode = predicate (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4394 if (syntaxcode != UC_IDENTIFIER_INVALID) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4395 identsyntax_table_add (&t, ch, syntaxcode); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4396 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4397 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4398 identsyntax_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4399 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4400 /* Offsets in t.result, in memory of this process. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4401 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4402 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4403 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4404 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4405 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4406 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4407 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4408 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4409 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4410 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4411 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4412 fprintf (stream, "#define identsyntax_header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4413 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4414 fprintf (stream, "static const\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4415 fprintf (stream, "struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4416 fprintf (stream, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4417 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4418 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4419 fprintf (stream, " unsigned short level3[%zu * %d];\n", t.level3_size, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4420 (1 << t.p) * 2 / 16); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4421 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4422 fprintf (stream, "%s =\n", name); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4423 fprintf (stream, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4424 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4425 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4426 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4427 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4428 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4429 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4430 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4431 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4432 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4433 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4434 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4435 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
4436 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4437 (offset - level2_offset) / sizeof (uint32_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4438 if (i+1 < t.level1_size) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4439 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4440 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4441 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4442 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4443 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4444 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4445 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4446 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4447 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4448 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4449 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4450 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4451 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4452 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4453 if (offset == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4454 fprintf (stream, " %5d", -1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4455 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
4456 fprintf (stream, " %5zu", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4457 (offset - level3_offset) / sizeof (uint8_t)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4458 if (i+1 < t.level2_size << t.q) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4459 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4460 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4461 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4462 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4463 fprintf (stream, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4464 /* Pack the level3 array. Each entry needs 2 bits only. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4465 fprintf (stream, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4466 if ((t.level3_size << t.p) * 2 / 16 > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4467 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4468 for (i = 0; i < (t.level3_size << t.p) * 2 / 16; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4469 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4470 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4471 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4472 fprintf (stream, " 0x%04x", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4473 (((uint8_t *) (t.result + level3_offset))[8 * i] << 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4474 | (((uint8_t *) (t.result + level3_offset))[8 * i + 1] << 2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4475 | (((uint8_t *) (t.result + level3_offset))[8 * i + 2] << 4) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4476 | (((uint8_t *) (t.result + level3_offset))[8 * i + 3] << 6) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4477 | (((uint8_t *) (t.result + level3_offset))[8 * i + 4] << 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4478 | (((uint8_t *) (t.result + level3_offset))[8 * i + 5] << 10) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4479 | (((uint8_t *) (t.result + level3_offset))[8 * i + 6] << 12) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4480 | (((uint8_t *) (t.result + level3_offset))[8 * i + 7] << 14)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4481 if (i+1 < (t.level3_size << t.p) * 2 / 16) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4482 fprintf (stream, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4483 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4484 if ((t.level3_size << t.p) * 2 / 16 > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4485 fprintf (stream, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4486 fprintf (stream, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4487 fprintf (stream, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4488 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4489 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4490 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4491 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4492 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4493 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4494 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4495 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4496 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4497 output_ident_properties (const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4498 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4499 #define PROPERTY(P) \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4500 debug_output_predicate ("unictype/sy_" #P ".txt", is_ ## P); \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4501 output_predicate_test ("../tests/unictype/test-sy_" #P ".c", is_ ## P, "uc_is_" #P " (c)"); \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4502 output_predicate ("unictype/sy_" #P ".h", is_ ## P, "u_" #P, "Language syntax properties", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4503 PROPERTY(c_whitespace) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4504 PROPERTY(java_whitespace) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4505 #undef PROPERTY |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4506 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4507 output_ident_category ("unictype/sy_c_ident.h", c_ident_category, "u_c_ident", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4508 output_ident_category ("unictype/sy_java_ident.h", java_ident_category, "u_java_ident", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4509 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4510 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4511 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4512 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4513 /* Like ISO C <ctype.h> and <wctype.h>. Compatible to glibc's |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4514 glibc/localedata/locales/i18n file, generated by |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4515 glibc/localedata/gen-unicode-ctype.c. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4516 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4517 /* Character mappings. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4518 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4519 static unsigned int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4520 to_upper (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4521 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4522 if (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4523 && unicode_attributes[ch].upper != NONE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4524 return unicode_attributes[ch].upper; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4525 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4526 return ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4527 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4528 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4529 static unsigned int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4530 to_lower (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4531 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4532 if (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4533 && unicode_attributes[ch].lower != NONE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4534 return unicode_attributes[ch].lower; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4535 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4536 return ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4537 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4538 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4539 static unsigned int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4540 to_title (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4541 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4542 if (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4543 && unicode_attributes[ch].title != NONE) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4544 return unicode_attributes[ch].title; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4545 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4546 return ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4547 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4548 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4549 /* Character class properties. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4550 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4551 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4552 is_upper (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4553 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4554 return (to_lower (ch) != ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4555 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4556 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4557 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4558 is_lower (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4559 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4560 return (to_upper (ch) != ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4561 /* <U00DF> is lowercase, but without simple to_upper mapping. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4562 || (ch == 0x00DF); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4563 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4564 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4565 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4566 is_alpha (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4567 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4568 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4569 && ((unicode_attributes[ch].category[0] == 'L' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4570 /* Theppitak Karoonboonyanan <thep@links.nectec.or.th> says |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4571 <U0E2F>, <U0E46> should belong to is_punct. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4572 && (ch != 0x0E2F) && (ch != 0x0E46)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4573 /* Theppitak Karoonboonyanan <thep@links.nectec.or.th> says |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4574 <U0E31>, <U0E34>..<U0E3A>, <U0E47>..<U0E4E> are is_alpha. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4575 || (ch == 0x0E31) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4576 || (ch >= 0x0E34 && ch <= 0x0E3A) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4577 || (ch >= 0x0E47 && ch <= 0x0E4E) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4578 /* Avoid warning for <U0345>. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4579 || (ch == 0x0345) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4580 /* Avoid warnings for <U2160>..<U217F>. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4581 || (unicode_attributes[ch].category[0] == 'N' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4582 && unicode_attributes[ch].category[1] == 'l') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4583 /* Avoid warnings for <U24B6>..<U24E9>. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4584 || (unicode_attributes[ch].category[0] == 'S' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4585 && unicode_attributes[ch].category[1] == 'o' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4586 && strstr (unicode_attributes[ch].name, " LETTER ") |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4587 != NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4588 /* Consider all the non-ASCII digits as alphabetic. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4589 ISO C 99 forbids us to have them in category "digit", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4590 but we want iswalnum to return true on them. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4591 || (unicode_attributes[ch].category[0] == 'N' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4592 && unicode_attributes[ch].category[1] == 'd' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4593 && !(ch >= 0x0030 && ch <= 0x0039)))); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4594 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4595 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4596 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4597 is_digit (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4598 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4599 #if 0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4600 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4601 && unicode_attributes[ch].category[0] == 'N' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4602 && unicode_attributes[ch].category[1] == 'd'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4603 /* Note: U+0BE7..U+0BEF and U+1369..U+1371 are digit systems without |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4604 a zero. Must add <0> in front of them by hand. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4605 #else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4606 /* SUSV2 gives us some freedom for the "digit" category, but ISO C 99 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4607 takes it away: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4608 7.25.2.1.5: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4609 The iswdigit function tests for any wide character that corresponds |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4610 to a decimal-digit character (as defined in 5.2.1). |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4611 5.2.1: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4612 the 10 decimal digits 0 1 2 3 4 5 6 7 8 9 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4613 */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4614 return (ch >= 0x0030 && ch <= 0x0039); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4615 #endif |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4616 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4617 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4618 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4619 is_outdigit (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4620 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4621 return (ch >= 0x0030 && ch <= 0x0039); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4622 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4623 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4624 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4625 is_alnum (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4626 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4627 return is_alpha (ch) || is_digit (ch); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4628 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4629 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4630 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4631 is_blank (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4632 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4633 return (ch == 0x0009 /* '\t' */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4634 /* Category Zs without mention of "<noBreak>" */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4635 || (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4636 && unicode_attributes[ch].category[0] == 'Z' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4637 && unicode_attributes[ch].category[1] == 's' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4638 && !strstr (unicode_attributes[ch].decomposition, "<noBreak>"))); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4639 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4640 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4641 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4642 is_space (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4643 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4644 /* Don't make U+00A0 a space. Non-breaking space means that all programs |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4645 should treat it like a punctuation character, not like a space. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4646 return (ch == 0x0020 /* ' ' */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4647 || ch == 0x000C /* '\f' */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4648 || ch == 0x000A /* '\n' */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4649 || ch == 0x000D /* '\r' */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4650 || ch == 0x0009 /* '\t' */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4651 || ch == 0x000B /* '\v' */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4652 /* Categories Zl, Zp, and Zs without mention of "<noBreak>" */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4653 || (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4654 && unicode_attributes[ch].category[0] == 'Z' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4655 && (unicode_attributes[ch].category[1] == 'l' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4656 || unicode_attributes[ch].category[1] == 'p' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4657 || (unicode_attributes[ch].category[1] == 's' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4658 && !strstr (unicode_attributes[ch].decomposition, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4659 "<noBreak>"))))); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4660 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4661 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4662 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4663 is_cntrl (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4664 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4665 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4666 && (strcmp (unicode_attributes[ch].name, "<control>") == 0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4667 /* Categories Zl and Zp */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4668 || (unicode_attributes[ch].category[0] == 'Z' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4669 && (unicode_attributes[ch].category[1] == 'l' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4670 || unicode_attributes[ch].category[1] == 'p')))); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4671 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4672 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4673 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4674 is_xdigit (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4675 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4676 #if 0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4677 return is_digit (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4678 || (ch >= 0x0041 && ch <= 0x0046) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4679 || (ch >= 0x0061 && ch <= 0x0066); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4680 #else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4681 /* SUSV2 gives us some freedom for the "xdigit" category, but ISO C 99 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4682 takes it away: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4683 7.25.2.1.12: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4684 The iswxdigit function tests for any wide character that corresponds |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4685 to a hexadecimal-digit character (as defined in 6.4.4.1). |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4686 6.4.4.1: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4687 hexadecimal-digit: one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4688 */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4689 return (ch >= 0x0030 && ch <= 0x0039) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4690 || (ch >= 0x0041 && ch <= 0x0046) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4691 || (ch >= 0x0061 && ch <= 0x0066); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4692 #endif |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4693 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4694 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4695 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4696 is_graph (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4697 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4698 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4699 && strcmp (unicode_attributes[ch].name, "<control>") |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4700 && !is_space (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4701 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4702 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4703 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4704 is_print (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4705 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4706 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4707 && strcmp (unicode_attributes[ch].name, "<control>") |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4708 /* Categories Zl and Zp */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4709 && !(unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4710 && unicode_attributes[ch].category[0] == 'Z' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4711 && (unicode_attributes[ch].category[1] == 'l' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4712 || unicode_attributes[ch].category[1] == 'p'))); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4713 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4714 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4715 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4716 is_punct (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4717 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4718 #if 0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4719 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4720 && unicode_attributes[ch].category[0] == 'P'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4721 #else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4722 /* The traditional POSIX definition of punctuation is every graphic, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4723 non-alphanumeric character. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4724 return (is_graph (ch) && !is_alpha (ch) && !is_digit (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4725 #endif |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4726 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4727 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4728 /* Output all properties. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4729 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4730 output_old_ctype (const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4731 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4732 #define PROPERTY(P) \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4733 debug_output_predicate ("unictype/ctype_" #P ".txt", is_ ## P); \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4734 output_predicate_test ("../tests/unictype/test-ctype_" #P ".c", is_ ## P, "uc_is_" #P " (c)"); \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4735 output_predicate ("unictype/ctype_" #P ".h", is_ ## P, "u_is_" #P, "ISO C <ctype.h> like properties", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4736 PROPERTY(alnum) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4737 PROPERTY(alpha) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4738 PROPERTY(cntrl) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4739 PROPERTY(digit) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4740 PROPERTY(graph) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4741 PROPERTY(lower) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4742 PROPERTY(print) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4743 PROPERTY(punct) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4744 PROPERTY(space) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4745 PROPERTY(upper) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4746 PROPERTY(xdigit) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4747 PROPERTY(blank) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4748 #undef PROPERTY |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4749 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4750 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4751 #if 0 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4752 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4753 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4754 is_combining (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4755 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4756 /* Up to Unicode 3.0.1 we took the Combining property from the PropList.txt |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4757 file. In 3.0.1 it was identical to the union of the general categories |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4758 "Mn", "Mc", "Me". In Unicode 3.1 this property has been dropped from the |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4759 PropList.txt file, so we take the latter definition. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4760 return (unicode_attributes[ch].name != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4761 && unicode_attributes[ch].category[0] == 'M' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4762 && (unicode_attributes[ch].category[1] == 'n' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4763 || unicode_attributes[ch].category[1] == 'c' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4764 || unicode_attributes[ch].category[1] == 'e')); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4765 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4766 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4767 static bool |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4768 is_combining_level3 (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4769 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4770 return is_combining (ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4771 && !(unicode_attributes[ch].combining[0] != '\0' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4772 && unicode_attributes[ch].combining[0] != '0' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4773 && strtoul (unicode_attributes[ch].combining, NULL, 10) >= 200); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4774 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4775 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4776 /* Return the UCS symbol string for a Unicode character. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4777 static const char * |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4778 ucs_symbol (unsigned int i) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4779 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4780 static char buf[11+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4781 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4782 sprintf (buf, (i < 0x10000 ? "<U%04X>" : "<U%08X>"), i); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4783 return buf; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4784 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4785 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4786 /* Return the UCS symbol range string for a Unicode characters interval. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4787 static const char * |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4788 ucs_symbol_range (unsigned int low, unsigned int high) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4789 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4790 static char buf[24+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4791 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4792 strcpy (buf, ucs_symbol (low)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4793 strcat (buf, ".."); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4794 strcat (buf, ucs_symbol (high)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4795 return buf; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4796 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4797 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4798 /* Output a character class (= property) table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4799 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4800 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4801 output_charclass (FILE *stream, const char *classname, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4802 bool (*func) (unsigned int)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4803 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4804 char table[0x110000]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4805 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4806 bool need_semicolon; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4807 const int max_column = 75; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4808 int column; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4809 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4810 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4811 table[i] = (int) func (i); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4812 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4813 fprintf (stream, "%s ", classname); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4814 need_semicolon = false; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4815 column = 1000; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4816 for (i = 0; i < 0x110000; ) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4817 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4818 if (!table[i]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4819 i++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4820 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4821 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4822 unsigned int low, high; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4823 char buf[25]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4824 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4825 low = i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4826 do |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4827 i++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4828 while (i < 0x110000 && table[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4829 high = i - 1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4830 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4831 if (low == high) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4832 strcpy (buf, ucs_symbol (low)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4833 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4834 strcpy (buf, ucs_symbol_range (low, high)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4835 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4836 if (need_semicolon) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4837 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4838 fprintf (stream, ";"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4839 column++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4840 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4841 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4842 if (column + strlen (buf) > max_column) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4843 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4844 fprintf (stream, "/\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4845 column = 3; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4846 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4847 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4848 fprintf (stream, "%s", buf); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4849 column += strlen (buf); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4850 need_semicolon = true; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4851 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4852 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4853 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4854 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4855 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4856 /* Output a character mapping table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4857 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4858 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4859 output_charmap (FILE *stream, const char *mapname, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4860 unsigned int (*func) (unsigned int)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4861 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4862 char table[0x110000]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4863 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4864 bool need_semicolon; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4865 const int max_column = 75; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4866 int column; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4867 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4868 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4869 table[i] = (func (i) != i); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4870 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4871 fprintf (stream, "%s ", mapname); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4872 need_semicolon = false; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4873 column = 1000; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4874 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4875 if (table[i]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4876 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4877 char buf[25+1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4878 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4879 strcpy (buf, "("); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4880 strcat (buf, ucs_symbol (i)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4881 strcat (buf, ","); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4882 strcat (buf, ucs_symbol (func (i))); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4883 strcat (buf, ")"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4884 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4885 if (need_semicolon) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4886 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4887 fprintf (stream, ";"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4888 column++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4889 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4890 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4891 if (column + strlen (buf) > max_column) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4892 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4893 fprintf (stream, "/\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4894 column = 3; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4895 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4896 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4897 fprintf (stream, "%s", buf); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4898 column += strlen (buf); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4899 need_semicolon = true; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4900 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4901 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4902 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4903 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4904 /* Output the width table. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4905 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4906 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4907 output_widthmap (FILE *stream) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4908 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4909 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4910 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4911 /* Output the tables to the given file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4912 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4913 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4914 output_tables (const char *filename, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4915 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4916 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4917 unsigned int ch; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4918 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4919 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4920 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4921 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4922 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4923 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4924 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4925 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4926 fprintf (stream, "escape_char /\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4927 fprintf (stream, "comment_char %%\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4928 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4929 fprintf (stream, "%% Generated automatically by gen-unicode-ctype for Unicode %s.\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4930 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4931 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4932 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4933 fprintf (stream, "LC_IDENTIFICATION\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4934 fprintf (stream, "title \"Unicode %s FDCC-set\"\n", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4935 fprintf (stream, "source \"UnicodeData.txt, PropList.txt\"\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4936 fprintf (stream, "address \"\"\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4937 fprintf (stream, "contact \"\"\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4938 fprintf (stream, "email \"bug-glibc@gnu.org\"\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4939 fprintf (stream, "tel \"\"\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4940 fprintf (stream, "fax \"\"\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4941 fprintf (stream, "language \"\"\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4942 fprintf (stream, "territory \"Earth\"\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4943 fprintf (stream, "revision \"%s\"\n", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4944 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4945 time_t now; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4946 char date[11]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4947 now = time (NULL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4948 strftime (date, sizeof (date), "%Y-%m-%d", gmtime (&now)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4949 fprintf (stream, "date \"%s\"\n", date); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4950 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4951 fprintf (stream, "category \"unicode:2001\";LC_CTYPE\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4952 fprintf (stream, "END LC_IDENTIFICATION\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4953 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4954 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4955 /* Verifications. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4956 for (ch = 0; ch < 0x110000; ch++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4957 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4958 /* toupper restriction: "Only characters specified for the keywords |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4959 lower and upper shall be specified. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4960 if (to_upper (ch) != ch && !(is_lower (ch) || is_upper (ch))) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4961 fprintf (stderr, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4962 "%s is not upper|lower but toupper(0x%04X) = 0x%04X\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4963 ucs_symbol (ch), ch, to_upper (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4964 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4965 /* tolower restriction: "Only characters specified for the keywords |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4966 lower and upper shall be specified. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4967 if (to_lower (ch) != ch && !(is_lower (ch) || is_upper (ch))) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4968 fprintf (stderr, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4969 "%s is not upper|lower but tolower(0x%04X) = 0x%04X\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4970 ucs_symbol (ch), ch, to_lower (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4971 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4972 /* alpha restriction: "Characters classified as either upper or lower |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4973 shall automatically belong to this class. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4974 if ((is_lower (ch) || is_upper (ch)) && !is_alpha (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4975 fprintf (stderr, "%s is upper|lower but not alpha\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4976 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4977 /* alpha restriction: "No character specified for the keywords cntrl, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4978 digit, punct or space shall be specified." */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4979 if (is_alpha (ch) && is_cntrl (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4980 fprintf (stderr, "%s is alpha and cntrl\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4981 if (is_alpha (ch) && is_digit (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4982 fprintf (stderr, "%s is alpha and digit\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4983 if (is_alpha (ch) && is_punct (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4984 fprintf (stderr, "%s is alpha and punct\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4985 if (is_alpha (ch) && is_space (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4986 fprintf (stderr, "%s is alpha and space\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4987 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4988 /* space restriction: "No character specified for the keywords upper, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4989 lower, alpha, digit, graph or xdigit shall be specified." |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4990 upper, lower, alpha already checked above. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4991 if (is_space (ch) && is_digit (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4992 fprintf (stderr, "%s is space and digit\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4993 if (is_space (ch) && is_graph (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4994 fprintf (stderr, "%s is space and graph\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4995 if (is_space (ch) && is_xdigit (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4996 fprintf (stderr, "%s is space and xdigit\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4997 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4998 /* cntrl restriction: "No character specified for the keywords upper, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4999 lower, alpha, digit, punct, graph, print or xdigit shall be |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5000 specified." upper, lower, alpha already checked above. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5001 if (is_cntrl (ch) && is_digit (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5002 fprintf (stderr, "%s is cntrl and digit\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5003 if (is_cntrl (ch) && is_punct (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5004 fprintf (stderr, "%s is cntrl and punct\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5005 if (is_cntrl (ch) && is_graph (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5006 fprintf (stderr, "%s is cntrl and graph\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5007 if (is_cntrl (ch) && is_print (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5008 fprintf (stderr, "%s is cntrl and print\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5009 if (is_cntrl (ch) && is_xdigit (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5010 fprintf (stderr, "%s is cntrl and xdigit\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5011 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5012 /* punct restriction: "No character specified for the keywords upper, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5013 lower, alpha, digit, cntrl, xdigit or as the <space> character shall |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5014 be specified." upper, lower, alpha, cntrl already checked above. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5015 if (is_punct (ch) && is_digit (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5016 fprintf (stderr, "%s is punct and digit\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5017 if (is_punct (ch) && is_xdigit (ch)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5018 fprintf (stderr, "%s is punct and xdigit\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5019 if (is_punct (ch) && (ch == 0x0020)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5020 fprintf (stderr, "%s is punct\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5021 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5022 /* graph restriction: "No character specified for the keyword cntrl |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5023 shall be specified." Already checked above. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5024 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5025 /* print restriction: "No character specified for the keyword cntrl |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5026 shall be specified." Already checked above. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5027 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5028 /* graph - print relation: differ only in the <space> character. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5029 How is this possible if there are more than one space character?! |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5030 I think susv2/xbd/locale.html should speak of "space characters", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5031 not "space character". */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5032 if (is_print (ch) && !(is_graph (ch) || /* ch == 0x0020 */ is_space (ch))) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5033 fprintf (stderr, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5034 "%s is print but not graph|<space>\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5035 if (!is_print (ch) && (is_graph (ch) || ch == 0x0020)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5036 fprintf (stderr, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5037 "%s is graph|<space> but not print\n", ucs_symbol (ch)); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5038 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5039 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5040 fprintf (stream, "LC_CTYPE\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5041 output_charclass (stream, "upper", is_upper); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5042 output_charclass (stream, "lower", is_lower); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5043 output_charclass (stream, "alpha", is_alpha); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5044 output_charclass (stream, "digit", is_digit); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5045 output_charclass (stream, "outdigit", is_outdigit); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5046 output_charclass (stream, "blank", is_blank); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5047 output_charclass (stream, "space", is_space); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5048 output_charclass (stream, "cntrl", is_cntrl); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5049 output_charclass (stream, "punct", is_punct); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5050 output_charclass (stream, "xdigit", is_xdigit); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5051 output_charclass (stream, "graph", is_graph); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5052 output_charclass (stream, "print", is_print); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5053 output_charclass (stream, "class \"combining\";", is_combining); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5054 output_charclass (stream, "class \"combining_level3\";", is_combining_level3); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5055 output_charmap (stream, "toupper", to_upper); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5056 output_charmap (stream, "tolower", to_lower); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5057 output_charmap (stream, "map \"totitle\";", to_title); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5058 output_widthmap (stream); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5059 fprintf (stream, "END LC_CTYPE\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5060 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5061 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5062 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5063 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5064 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5065 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5066 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5067 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5068 #endif |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5069 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5070 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5071 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5072 /* The width property from the EastAsianWidth.txt file. |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5073 Each is NULL (unassigned) or "N", "A", "H", "W", "F", "Na". */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5074 const char * unicode_width[0x110000]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5075 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5076 /* Stores in unicode_width[] the width property from the EastAsianWidth.txt |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5077 file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5078 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5079 fill_width (const char *width_filename) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5080 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5081 unsigned int i, j; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5082 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5083 char field0[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5084 char field1[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5085 char field2[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5086 int lineno = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5087 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5088 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5089 unicode_width[i] = (unicode_attributes[i].name != NULL ? "N" : NULL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5090 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5091 stream = fopen (width_filename, "r"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5092 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5093 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5094 fprintf (stderr, "error during fopen of '%s'\n", width_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5095 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5096 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5097 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5098 for (;;) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5099 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5100 int n; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5101 int c; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5102 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5103 lineno++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5104 c = getc (stream); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5105 if (c == EOF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5106 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5107 if (c == '#') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5108 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5109 do c = getc (stream); while (c != EOF && c != '\n'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5110 continue; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5111 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5112 ungetc (c, stream); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5113 n = getfield (stream, field0, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5114 n += getfield (stream, field1, ' '); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5115 n += getfield (stream, field2, '\n'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5116 if (n == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5117 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5118 if (n != 3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5119 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5120 fprintf (stderr, "short line in '%s':%d\n", width_filename, lineno); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5121 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5122 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5123 i = strtoul (field0, NULL, 16); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5124 if (strstr (field0, "..") != NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5125 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5126 /* Deal with a range. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5127 j = strtoul (strstr (field0, "..") + 2, NULL, 16); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5128 for (; i <= j; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5129 unicode_width[i] = strdup (field1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5130 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5131 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5132 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5133 /* Single character line. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5134 unicode_width[i] = strdup (field1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5135 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5136 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5137 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5138 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5139 fprintf (stderr, "error reading from '%s'\n", width_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5140 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5141 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5142 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5143 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5144 /* Line breaking classification. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5145 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5146 enum |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5147 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5148 /* Values >= 24 are resolved at run time. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5149 LBP_BK = 24, /* mandatory break */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5150 /*LBP_CR, carriage return - not used here because it's a DOSism */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5151 /*LBP_LF, line feed - not used here because it's a DOSism */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5152 LBP_CM = 25, /* attached characters and combining marks */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5153 /*LBP_NL, next line - not used here because it's equivalent to LBP_BK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5154 /*LBP_SG, surrogates - not used here because they are not characters */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5155 LBP_WJ = 0, /* word joiner */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5156 LBP_ZW = 26, /* zero width space */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5157 LBP_GL = 1, /* non-breaking (glue) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5158 LBP_SP = 27, /* space */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5159 LBP_B2 = 2, /* break opportunity before and after */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5160 LBP_BA = 3, /* break opportunity after */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5161 LBP_BB = 4, /* break opportunity before */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5162 LBP_HY = 5, /* hyphen */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5163 LBP_CB = 28, /* contingent break opportunity */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5164 LBP_CL = 6, /* closing punctuation */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5165 LBP_EX = 7, /* exclamation/interrogation */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5166 LBP_IN = 8, /* inseparable */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5167 LBP_NS = 9, /* non starter */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5168 LBP_OP = 10, /* opening punctuation */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5169 LBP_QU = 11, /* ambiguous quotation */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5170 LBP_IS = 12, /* infix separator (numeric) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5171 LBP_NU = 13, /* numeric */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5172 LBP_PO = 14, /* postfix (numeric) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5173 LBP_PR = 15, /* prefix (numeric) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5174 LBP_SY = 16, /* symbols allowing breaks */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5175 LBP_AI = 29, /* ambiguous (alphabetic or ideograph) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5176 LBP_AL = 17, /* ordinary alphabetic and symbol characters */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5177 LBP_H2 = 18, /* Hangul LV syllable */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5178 LBP_H3 = 19, /* Hangul LVT syllable */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5179 LBP_ID = 20, /* ideographic */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5180 LBP_JL = 21, /* Hangul L Jamo */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5181 LBP_JV = 22, /* Hangul V Jamo */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5182 LBP_JT = 23, /* Hangul T Jamo */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5183 LBP_SA = 30, /* complex context (South East Asian) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5184 LBP_XX = 31 /* unknown */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5185 }; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5186 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5187 /* Returns the line breaking classification for ch, as a bit mask. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5188 static int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5189 get_lbp (unsigned int ch) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5190 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5191 int attr = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5192 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5193 if (unicode_attributes[ch].name != NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5194 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5195 /* mandatory break */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5196 if (ch == 0x000A || ch == 0x000D || ch == 0x0085 /* newline */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5197 || ch == 0x000C /* form feed */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5198 || ch == 0x000B /* line tabulation */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5199 || ch == 0x2028 /* LINE SEPARATOR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5200 || ch == 0x2029 /* PARAGRAPH SEPARATOR */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5201 attr |= 1 << LBP_BK; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5202 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5203 if (ch == 0x2060 /* WORD JOINER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5204 || ch == 0xFEFF /* ZERO WIDTH NO-BREAK SPACE */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5205 attr |= 1 << LBP_WJ; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5206 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5207 /* zero width space */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5208 if (ch == 0x200B /* ZERO WIDTH SPACE */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5209 attr |= 1 << LBP_ZW; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5210 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5211 /* non-breaking (glue) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5212 if (ch == 0x00A0 /* NO-BREAK SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5213 || ch == 0x202F /* NARROW NO-BREAK SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5214 || ch == 0x180E /* MONGOLIAN VOWEL SEPARATOR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5215 || ch == 0x034F /* COMBINING GRAPHEME JOINER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5216 || ch == 0x2007 /* FIGURE SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5217 || ch == 0x2011 /* NON-BREAKING HYPHEN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5218 || ch == 0x0F08 /* TIBETAN MARK SBRUL SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5219 || ch == 0x0F0C /* TIBETAN MARK DELIMITER TSHEG BSTAR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5220 || ch == 0x0F12 /* TIBETAN MARK RGYA GRAM SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5221 || (ch >= 0x035C && ch <= 0x0362) /* COMBINING DOUBLE ... */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5222 attr |= 1 << LBP_GL; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5223 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5224 /* space */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5225 if (ch == 0x0020 /* SPACE */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5226 attr |= 1 << LBP_SP; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5227 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5228 /* break opportunity before and after */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5229 if (ch == 0x2014 /* EM DASH */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5230 attr |= 1 << LBP_B2; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5231 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5232 /* break opportunity after */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5233 if (ch == 0x1680 /* OGHAM SPACE MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5234 || ch == 0x2000 /* EN QUAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5235 || ch == 0x2001 /* EM QUAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5236 || ch == 0x2002 /* EN SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5237 || ch == 0x2003 /* EM SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5238 || ch == 0x2004 /* THREE-PER-EM SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5239 || ch == 0x2005 /* FOUR-PER-EM SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5240 || ch == 0x2006 /* SIX-PER-EM SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5241 || ch == 0x2008 /* PUNCTUATION SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5242 || ch == 0x2009 /* THIN SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5243 || ch == 0x200A /* HAIR SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5244 || ch == 0x205F /* MEDIUM MATHEMATICAL SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5245 || ch == 0x0009 /* tab */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5246 || ch == 0x00AD /* SOFT HYPHEN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5247 || ch == 0x058A /* ARMENIAN HYPHEN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5248 || ch == 0x2010 /* HYPHEN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5249 || ch == 0x2012 /* FIGURE DASH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5250 || ch == 0x2013 /* EN DASH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5251 || ch == 0x05BE /* HEBREW PUNCTUATION MAQAF */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5252 || ch == 0x0F0B /* TIBETAN MARK INTERSYLLABIC TSHEG */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5253 || ch == 0x1361 /* ETHIOPIC WORDSPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5254 || ch == 0x17D8 /* KHMER SIGN BEYYAL */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5255 || ch == 0x17DA /* KHMER SIGN KOOMUUT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5256 || ch == 0x2027 /* HYPHENATION POINT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5257 || ch == 0x007C /* VERTICAL LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5258 || ch == 0x16EB /* RUNIC SINGLE PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5259 || ch == 0x16EC /* RUNIC MULTIPLE PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5260 || ch == 0x16ED /* RUNIC CROSS PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5261 || ch == 0x2056 /* THREE DOT PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5262 || ch == 0x2058 /* FOUR DOT PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5263 || ch == 0x2059 /* FIVE DOT PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5264 || ch == 0x205A /* TWO DOT PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5265 || ch == 0x205B /* FOUR DOT MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5266 || ch == 0x205D /* TRICOLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5267 || ch == 0x205E /* VERTICAL FOUR DOTS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5268 || ch == 0x2E19 /* PALM BRANCH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5269 || ch == 0x2E2A /* TWO DOTS OVER ONE DOT PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5270 || ch == 0x2E2B /* ONE DOT OVER TWO DOTS PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5271 || ch == 0x2E2C /* SQUARED FOUR DOT PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5272 || ch == 0x2E2D /* FIVE DOT PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5273 || ch == 0x2E30 /* RING POINT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5274 || ch == 0x10100 /* AEGEAN WORD SEPARATOR LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5275 || ch == 0x10101 /* AEGEAN WORD SEPARATOR DOT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5276 || ch == 0x10102 /* AEGEAN CHECK MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5277 || ch == 0x1039F /* UGARITIC WORD DIVIDER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5278 || ch == 0x103D0 /* OLD PERSIAN WORD DIVIDER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5279 || ch == 0x1091F /* PHOENICIAN WORD SEPARATOR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5280 || ch == 0x12470 /* CUNEIFORM PUNCTUATION SIGN OLD ASSYRIAN WORD DIVIDER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5281 || ch == 0x0964 /* DEVANAGARI DANDA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5282 || ch == 0x0965 /* DEVANAGARI DOUBLE DANDA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5283 || ch == 0x0E5A /* THAI CHARACTER ANGKHANKHU */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5284 || ch == 0x0E5B /* THAI CHARACTER KHOMUT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5285 || ch == 0x104A /* MYANMAR SIGN LITTLE SECTION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5286 || ch == 0x104B /* MYANMAR SIGN SECTION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5287 || ch == 0x1735 /* PHILIPPINE SINGLE PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5288 || ch == 0x1736 /* PHILIPPINE DOUBLE PUNCTUATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5289 || ch == 0x17D4 /* KHMER SIGN KHAN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5290 || ch == 0x17D5 /* KHMER SIGN BARIYOOSAN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5291 || ch == 0x1B5E /* BALINESE CARIK SIKI */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5292 || ch == 0x1B5F /* BALINESE CARIK PAREREN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5293 || ch == 0xA8CE /* SAURASHTRA DANDA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5294 || ch == 0xA8CF /* SAURASHTRA DOUBLE DANDA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5295 || ch == 0xAA5D /* CHAM PUNCTUATION DANDA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5296 || ch == 0xAA5E /* CHAM PUNCTUATION DOUBLE DANDA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5297 || ch == 0xAA5F /* CHAM PUNCTUATION TRIPLE DANDA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5298 || ch == 0x10A56 /* KHAROSHTHI PUNCTUATION DANDA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5299 || ch == 0x10A57 /* KHAROSHTHI PUNCTUATION DOUBLE DANDA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5300 || ch == 0x0F34 /* TIBETAN MARK BSDUS RTAGS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5301 || ch == 0x0F7F /* TIBETAN SIGN RNAM BCAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5302 || ch == 0x0F85 /* TIBETAN MARK PALUTA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5303 || ch == 0x0FBE /* TIBETAN KU RU KHA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5304 || ch == 0x0FBF /* TIBETAN KU RU KHA BZHI MIG CAN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5305 || ch == 0x0FD2 /* TIBETAN MARK NYIS TSHEG */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5306 || ch == 0x1804 /* MONGOLIAN COLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5307 || ch == 0x1805 /* MONGOLIAN FOUR DOTS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5308 || ch == 0x1B5A /* BALINESE PANTI */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5309 || ch == 0x1B5B /* BALINESE PAMADA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5310 || ch == 0x1B5C /* BALINESE WINDU */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5311 || ch == 0x1B5D /* BALINESE CARIK PAMUNGKAH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5312 || ch == 0x1B60 /* BALINESE PAMENENG */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5313 || ch == 0x1C3B /* LEPCHA PUNCTUATION TA-ROL */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5314 || ch == 0x1C3C /* LEPCHA PUNCTUATION NYET THYOOM TA-ROL */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5315 || ch == 0x1C3D /* LEPCHA PUNCTUATION CER-WA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5316 || ch == 0x1C3E /* LEPCHA PUNCTUATION TSHOOK CER-WA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5317 || ch == 0x1C3F /* LEPCHA PUNCTUATION TSHOOK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5318 || ch == 0x1C7E /* OL CHIKI PUNCTUATION MUCAAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5319 || ch == 0x1C7F /* OL CHIKI PUNCTUATION DOUBLE MUCAAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5320 || ch == 0x2CFA /* COPTIC OLD NUBIAN DIRECT QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5321 || ch == 0x2CFB /* COPTIC OLD NUBIAN INDIRECT QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5322 || ch == 0x2CFC /* COPTIC OLD NUBIAN VERSE DIVIDER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5323 || ch == 0x2CFF /* COPTIC MORPHOLOGICAL DIVIDER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5324 || (ch >= 0x2E0E && ch <= 0x2E15) /* EDITORIAL CORONIS .. UPWARDS ANCORA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5325 || ch == 0x2E17 /* DOUBLE OBLIQUE HYPHEN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5326 || ch == 0xA60D /* VAI COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5327 || ch == 0xA60F /* VAI QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5328 || ch == 0xA92E /* KAYAH LI SIGN CWI */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5329 || ch == 0xA92F /* KAYAH LI SIGN SHYA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5330 || ch == 0x10A50 /* KHAROSHTHI PUNCTUATION DOT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5331 || ch == 0x10A51 /* KHAROSHTHI PUNCTUATION SMALL CIRCLE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5332 || ch == 0x10A52 /* KHAROSHTHI PUNCTUATION CIRCLE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5333 || ch == 0x10A53 /* KHAROSHTHI PUNCTUATION CRESCENT BAR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5334 || ch == 0x10A54 /* KHAROSHTHI PUNCTUATION MANGALAM */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5335 || ch == 0x10A55 /* KHAROSHTHI PUNCTUATION LOTUS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5336 /* Extra characters for compatibility with Unicode LineBreak.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5337 || ch == 0x12471 /* CUNEIFORM PUNCTUATION SIGN VERTICAL COLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5338 || ch == 0x12472 /* CUNEIFORM PUNCTUATION SIGN DIAGONAL COLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5339 || ch == 0x12473 /* CUNEIFORM PUNCTUATION SIGN DIAGONAL TRICOLON */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5340 attr |= 1 << LBP_BA; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5341 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5342 /* break opportunity before */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5343 if (ch == 0x00B4 /* ACUTE ACCENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5344 || ch == 0x1FFD /* GREEK OXIA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5345 || ch == 0x02DF /* MODIFIER LETTER CROSS ACCENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5346 || ch == 0x02C8 /* MODIFIER LETTER VERTICAL LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5347 || ch == 0x02CC /* MODIFIER LETTER LOW VERTICAL LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5348 || ch == 0x0F01 /* TIBETAN MARK GTER YIG MGO TRUNCATED A */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5349 || ch == 0x0F02 /* TIBETAN MARK GTER YIG MGO -UM RNAM BCAD MA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5350 || ch == 0x0F03 /* TIBETAN MARK GTER YIG MGO -UM GTER TSHEG MA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5351 || ch == 0x0F04 /* TIBETAN MARK INITIAL YIG MGO MDUN MA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5352 || ch == 0x0F06 /* TIBETAN MARK CARET YIG MGO PHUR SHAD MA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5353 || ch == 0x0F07 /* TIBETAN MARK YIG MGO TSHEG SHAD MA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5354 || ch == 0x0F09 /* TIBETAN MARK BSKUR YIG MGO */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5355 || ch == 0x0F0A /* TIBETAN MARK BKA- SHOG YIG MGO */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5356 || ch == 0x0FD0 /* TIBETAN MARK BSKA- SHOG GI MGO RGYAN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5357 || ch == 0x0FD1 /* TIBETAN MARK MNYAM YIG GI MGO RGYAN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5358 || ch == 0x0FD3 /* TIBETAN MARK INITIAL BRDA RNYING YIG MGO MDUN MA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5359 || ch == 0xA874 /* PHAGS-PA SINGLE HEAD MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5360 || ch == 0xA875 /* PHAGS-PA DOUBLE HEAD MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5361 || ch == 0x1806 /* MONGOLIAN TODO SOFT HYPHEN */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5362 attr |= 1 << LBP_BB; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5363 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5364 /* hyphen */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5365 if (ch == 0x002D /* HYPHEN-MINUS */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5366 attr |= 1 << LBP_HY; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5367 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5368 /* contingent break opportunity */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5369 if (ch == 0xFFFC /* OBJECT REPLACEMENT CHARACTER */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5370 attr |= 1 << LBP_CB; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5371 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5372 /* closing punctuation */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5373 if ((unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5374 && unicode_attributes[ch].category[1] == 'e') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5375 || ch == 0x3001 /* IDEOGRAPHIC COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5376 || ch == 0x3002 /* IDEOGRAPHIC FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5377 || ch == 0xFE11 /* PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5378 || ch == 0xFE12 /* PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5379 || ch == 0xFE50 /* SMALL COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5380 || ch == 0xFE52 /* SMALL FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5381 || ch == 0xFF0C /* FULLWIDTH COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5382 || ch == 0xFF0E /* FULLWIDTH FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5383 || ch == 0xFF61 /* HALFWIDTH IDEOGRAPHIC FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5384 || ch == 0xFF64 /* HALFWIDTH IDEOGRAPHIC COMMA */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5385 attr |= 1 << LBP_CL; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5386 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5387 /* exclamation/interrogation */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5388 if (ch == 0x0021 /* EXCLAMATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5389 || ch == 0x003F /* QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5390 || ch == 0x05C6 /* HEBREW PUNCTUATION NUN HAFUKHA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5391 || ch == 0x061B /* ARABIC SEMICOLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5392 || ch == 0x061E /* ARABIC TRIPLE DOT PUNCTUATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5393 || ch == 0x061F /* ARABIC QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5394 || ch == 0x06D4 /* ARABIC FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5395 || ch == 0x07F9 /* NKO EXCLAMATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5396 || ch == 0x0F0D /* TIBETAN MARK SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5397 || ch == 0x0F0E /* TIBETAN MARK NYIS SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5398 || ch == 0x0F0F /* TIBETAN MARK TSHEG SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5399 || ch == 0x0F10 /* TIBETAN MARK NYIS TSHEG SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5400 || ch == 0x0F11 /* TIBETAN MARK RIN CHEN SPUNGS SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5401 || ch == 0x0F14 /* TIBETAN MARK GTER TSHEG */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5402 || ch == 0x1802 /* MONGOLIAN COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5403 || ch == 0x1803 /* MONGOLIAN FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5404 || ch == 0x1808 /* MONGOLIAN MANCHU COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5405 || ch == 0x1809 /* MONGOLIAN MANCHU FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5406 || ch == 0x1944 /* LIMBU EXCLAMATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5407 || ch == 0x1945 /* LIMBU QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5408 || ch == 0x2762 /* HEAVY EXCLAMATION MARK ORNAMENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5409 || ch == 0x2763 /* HEAVY HEART EXCLAMATION MARK ORNAMENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5410 || ch == 0x2CF9 /* COPTIC OLD NUBIAN FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5411 || ch == 0x2CFE /* COPTIC FULL STOP */ |
11129 | 5412 || ch == 0x2E2E /* REVERSED QUESTION MARK */ |
5413 #if REVISION_22 | |
5414 || ch == 0xA60C /* VAI SYLLABLE LENGTHENER */ | |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5415 #endif |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5416 || ch == 0xA60E /* VAI FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5417 || ch == 0xA876 /* PHAGS-PA MARK SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5418 || ch == 0xA877 /* PHAGS-PA MARK DOUBLE SHAD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5419 || ch == 0xFE15 /* PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5420 || ch == 0xFE16 /* PRESENTATION FORM FOR VERTICAL QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5421 || ch == 0xFE56 /* SMALL QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5422 || ch == 0xFE57 /* SMALL EXCLAMATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5423 || ch == 0xFF01 /* FULLWIDTH EXCLAMATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5424 || ch == 0xFF1F /* FULLWIDTH QUESTION MARK */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5425 attr |= 1 << LBP_EX; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5426 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5427 /* inseparable */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5428 if (ch == 0x2024 /* ONE DOT LEADER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5429 || ch == 0x2025 /* TWO DOT LEADER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5430 || ch == 0x2026 /* HORIZONTAL ELLIPSIS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5431 || ch == 0xFE19 /* PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5432 attr |= 1 << LBP_IN; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5433 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5434 /* non starter */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5435 if (ch == 0x17D6 /* KHMER SIGN CAMNUC PII KUUH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5436 || ch == 0x203C /* DOUBLE EXCLAMATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5437 || ch == 0x203D /* INTERROBANG */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5438 || ch == 0x2047 /* DOUBLE QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5439 || ch == 0x2048 /* QUESTION EXCLAMATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5440 || ch == 0x2049 /* EXCLAMATION QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5441 || ch == 0x3005 /* IDEOGRAPHIC ITERATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5442 || ch == 0x301C /* WAVE DASH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5443 || ch == 0x303C /* MASU MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5444 || ch == 0x303B /* VERTICAL IDEOGRAPHIC ITERATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5445 || ch == 0x309B /* KATAKANA-HIRAGANA VOICED SOUND MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5446 || ch == 0x309C /* KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5447 || ch == 0x309D /* HIRAGANA ITERATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5448 || ch == 0x309E /* HIRAGANA VOICED ITERATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5449 || ch == 0x30A0 /* KATAKANA-HIRAGANA DOUBLE HYPHEN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5450 || ch == 0x30FB /* KATAKANA MIDDLE DOT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5451 || ch == 0x30FC /* KATAKANA-HIRAGANA PROLONGED SOUND MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5452 || ch == 0x30FD /* KATAKANA ITERATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5453 || ch == 0x30FE /* KATAKANA VOICED ITERATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5454 || ch == 0xA015 /* YI SYLLABLE WU */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5455 || ch == 0xFE54 /* SMALL SEMICOLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5456 || ch == 0xFE55 /* SMALL COLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5457 || ch == 0xFF1A /* FULLWIDTH COLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5458 || ch == 0xFF1B /* FULLWIDTH SEMICOLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5459 || ch == 0xFF65 /* HALFWIDTH KATAKANA MIDDLE DOT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5460 || ch == 0xFF70 /* HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5461 || ch == 0xFF9E /* HALFWIDTH KATAKANA VOICED SOUND MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5462 || ch == 0xFF9F /* HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5463 || strstr (unicode_attributes[ch].name, "HIRAGANA LETTER SMALL ") != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5464 || strstr (unicode_attributes[ch].name, "KATAKANA LETTER SMALL ") != NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5465 attr |= 1 << LBP_NS; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5466 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5467 /* opening punctuation */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5468 if ((unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5469 && unicode_attributes[ch].category[1] == 's') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5470 || ch == 0x00A1 /* INVERTED EXCLAMATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5471 || ch == 0x00BF /* INVERTED QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5472 || ch == 0x2E18 /* INVERTED INTERROBANG */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5473 attr |= 1 << LBP_OP; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5474 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5475 /* ambiguous quotation */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5476 if ((unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5477 && (unicode_attributes[ch].category[1] == 'f' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5478 || unicode_attributes[ch].category[1] == 'i')) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5479 || ch == 0x0022 /* QUOTATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5480 || ch == 0x0027 /* APOSTROPHE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5481 || ch == 0x275B /* HEAVY SINGLE TURNED COMMA QUOTATION MARK ORNAMENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5482 || ch == 0x275C /* HEAVY SINGLE COMMA QUOTATION MARK ORNAMENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5483 || ch == 0x275D /* HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5484 || ch == 0x275E /* HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5485 || ch == 0x2E00 /* RIGHT ANGLE SUBSTITUTION MARKER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5486 || ch == 0x2E01 /* RIGHT ANGLE DOTTED SUBSTITUTION MARKER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5487 || ch == 0x2E06 /* RAISED INTERPOLATION MARKER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5488 || ch == 0x2E07 /* RAISED DOTTED INTERPOLATION MARKER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5489 || ch == 0x2E08 /* DOTTED TRANSPOSITION MARKER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5490 || ch == 0x2E0B /* RAISED SQUARE */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5491 attr |= 1 << LBP_QU; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5492 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5493 /* infix separator (numeric) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5494 if (ch == 0x002C /* COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5495 || ch == 0x002E /* FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5496 || ch == 0x003A /* COLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5497 || ch == 0x003B /* SEMICOLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5498 || ch == 0x037E /* GREEK QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5499 || ch == 0x0589 /* ARMENIAN FULL STOP */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5500 || ch == 0x060C /* ARABIC COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5501 || ch == 0x060D /* ARABIC DATE SEPARATOR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5502 || ch == 0x07F8 /* NKO COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5503 || ch == 0x2044 /* FRACTION SLASH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5504 || ch == 0xFE10 /* PRESENTATION FORM FOR VERTICAL COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5505 || ch == 0xFE13 /* PRESENTATION FORM FOR VERTICAL COLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5506 || ch == 0xFE14 /* PRESENTATION FORM FOR VERTICAL SEMICOLON */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5507 attr |= 1 << LBP_IS; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5508 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5509 /* numeric */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5510 if ((unicode_attributes[ch].category[0] == 'N' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5511 && unicode_attributes[ch].category[1] == 'd' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5512 && strstr (unicode_attributes[ch].name, "FULLWIDTH") == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5513 || ch == 0x066B /* ARABIC DECIMAL SEPARATOR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5514 || ch == 0x066C /* ARABIC THOUSANDS SEPARATOR */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5515 attr |= 1 << LBP_NU; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5516 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5517 /* postfix (numeric) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5518 if (ch == 0x0025 /* PERCENT SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5519 || ch == 0x00A2 /* CENT SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5520 || ch == 0x00B0 /* DEGREE SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5521 || ch == 0x060B /* AFGHANI SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5522 || ch == 0x066A /* ARABIC PERCENT SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5523 || ch == 0x2030 /* PER MILLE SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5524 || ch == 0x2031 /* PER TEN THOUSAND SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5525 || ch == 0x2032 /* PRIME */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5526 || ch == 0x2033 /* DOUBLE PRIME */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5527 || ch == 0x2034 /* TRIPLE PRIME */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5528 || ch == 0x2035 /* REVERSED PRIME */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5529 || ch == 0x2036 /* REVERSED DOUBLE PRIME */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5530 || ch == 0x2037 /* REVERSED TRIPLE PRIME */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5531 || ch == 0x20A7 /* PESETA SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5532 || ch == 0x2103 /* DEGREE CELSIUS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5533 || ch == 0x2109 /* DEGREE FAHRENHEIT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5534 || ch == 0xFDFC /* RIAL SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5535 || ch == 0xFE6A /* SMALL PERCENT SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5536 || ch == 0xFF05 /* FULLWIDTH PERCENT SIGN */ |
11129 | 5537 || ch == 0xFFE0 /* FULLWIDTH DIGIT ZERO */ |
5538 /* Extra characters for compatibility with Unicode LineBreak.txt. */ | |
5539 || ch == 0x0609 /* ARABIC-INDIC PER MILLE SIGN */ | |
5540 || ch == 0x060A /* ARABIC-INDIC PER TEN THOUSAND SIGN */ | |
5541 || ch == 0x0D79 /* MALAYALAM DATE MARK */) | |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5542 attr |= 1 << LBP_PO; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5543 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5544 /* prefix (numeric) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5545 if ((unicode_attributes[ch].category[0] == 'S' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5546 && unicode_attributes[ch].category[1] == 'c') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5547 || ch == 0x002B /* PLUS SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5548 || ch == 0x005C /* REVERSE SOLIDUS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5549 || ch == 0x00B1 /* PLUS-MINUS SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5550 || ch == 0x2116 /* NUMERO SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5551 || ch == 0x2212 /* MINUS SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5552 || ch == 0x2213 /* MINUS-OR-PLUS SIGN */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5553 if (!(attr & (1 << LBP_PO))) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5554 attr |= 1 << LBP_PR; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5555 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5556 /* symbols allowing breaks */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5557 if (ch == 0x002F /* SOLIDUS */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5558 attr |= 1 << LBP_SY; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5559 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5560 if (ch >= 0xAC00 && ch <= 0xD7A3 && ((ch - 0xAC00) % 28) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5561 attr |= 1 << LBP_H2; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5562 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5563 if (ch >= 0xAC00 && ch <= 0xD7A3 && ((ch - 0xAC00) % 28) != 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5564 attr |= 1 << LBP_H3; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5565 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5566 if ((ch >= 0x1100 && ch <= 0x1159) || ch == 0x115F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5567 attr |= 1 << LBP_JL; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5568 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5569 if (ch >= 0x1160 && ch <= 0x11A2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5570 attr |= 1 << LBP_JV; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5571 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5572 if (ch >= 0x11A8 && ch <= 0x11F9) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5573 attr |= 1 << LBP_JT; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5574 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5575 /* complex context (South East Asian) */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5576 if (((unicode_attributes[ch].category[0] == 'C' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5577 && unicode_attributes[ch].category[1] == 'f') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5578 || (unicode_attributes[ch].category[0] == 'L' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5579 && (unicode_attributes[ch].category[1] == 'm' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5580 || unicode_attributes[ch].category[1] == 'o')) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5581 || (unicode_attributes[ch].category[0] == 'M' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5582 && (unicode_attributes[ch].category[1] == 'c' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5583 || unicode_attributes[ch].category[1] == 'n')) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5584 /* Extra characters for compatibility with Unicode LineBreak.txt. */ |
11129 | 5585 || ch == 0x109E /* MYANMAR SYMBOL SHAN ONE */ |
5586 || ch == 0x109F /* MYANMAR SYMBOL SHAN EXCLAMATION */ | |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5587 || ch == 0x19DE /* NEW TAI LUE SIGN LAE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5588 || ch == 0x19DF /* NEW TAI LUE SIGN LAEV */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5589 && ((ch >= 0x0E00 && ch <= 0x0EFF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5590 || (ch >= 0x1000 && ch <= 0x109F) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5591 || (ch >= 0x1780 && ch <= 0x17FF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5592 || (ch >= 0x1950 && ch <= 0x19DF))) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5593 attr |= 1 << LBP_SA; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5594 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5595 /* attached characters and combining marks */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5596 if ((unicode_attributes[ch].category[0] == 'M' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5597 && (unicode_attributes[ch].category[1] == 'c' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5598 || unicode_attributes[ch].category[1] == 'e' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5599 || unicode_attributes[ch].category[1] == 'n')) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5600 || (unicode_attributes[ch].category[0] == 'C' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5601 && (unicode_attributes[ch].category[1] == 'c' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5602 || unicode_attributes[ch].category[1] == 'f'))) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5603 if (!(attr & ((1 << LBP_BK) | (1 << LBP_BA) | (1 << LBP_GL) | (1 << LBP_SA) | (1 << LBP_WJ) | (1 << LBP_ZW)))) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5604 attr |= 1 << LBP_CM; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5605 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5606 /* ideographic */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5607 if ((ch >= 0x2E80 && ch <= 0x2FFF) /* CJK RADICAL, KANGXI RADICAL, IDEOGRAPHIC DESCRIPTION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5608 || ch == 0x3000 /* IDEOGRAPHIC SPACE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5609 || (ch >= 0x3040 && ch <= 0x309F) /* HIRAGANA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5610 || (ch >= 0x30A0 && ch <= 0x30FF) /* KATAKANA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5611 || (ch >= 0x3400 && ch <= 0x4DB5) /* CJK Ideograph Extension A */ |
11129 | 5612 || (ch >= 0x4E00 && ch <= 0x9FC3) /* CJK Ideograph */ |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5613 || (ch >= 0xF900 && ch <= 0xFAD9) /* CJK COMPATIBILITY IDEOGRAPH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5614 || (ch >= 0xA000 && ch <= 0xA48F) /* YI SYLLABLE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5615 || (ch >= 0xA490 && ch <= 0xA4CF) /* YI RADICAL */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5616 || ch == 0xFE62 /* SMALL PLUS SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5617 || ch == 0xFE63 /* SMALL HYPHEN-MINUS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5618 || ch == 0xFE64 /* SMALL LESS-THAN SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5619 || ch == 0xFE65 /* SMALL GREATER-THAN SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5620 || ch == 0xFE66 /* SMALL EQUALS SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5621 || (ch >= 0xFF10 && ch <= 0xFF19) /* FULLWIDTH DIGIT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5622 || (ch >= 0x20000 && ch <= 0x2A6D6) /* CJK Ideograph Extension B */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5623 || (ch >= 0x2F800 && ch <= 0x2FA1D) /* CJK COMPATIBILITY IDEOGRAPH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5624 || strstr (unicode_attributes[ch].name, "FULLWIDTH LATIN ") != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5625 || (ch >= 0x3000 && ch <= 0x33FF |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5626 && !(attr & ((1 << LBP_CM) | (1 << LBP_NS) | (1 << LBP_OP) | (1 << LBP_CL)))) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5627 /* Extra characters for compatibility with Unicode LineBreak.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5628 || ch == 0xFE30 /* PRESENTATION FORM FOR VERTICAL TWO DOT LEADER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5629 || ch == 0xFE31 /* PRESENTATION FORM FOR VERTICAL EM DASH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5630 || ch == 0xFE32 /* PRESENTATION FORM FOR VERTICAL EN DASH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5631 || ch == 0xFE33 /* PRESENTATION FORM FOR VERTICAL LOW LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5632 || ch == 0xFE34 /* PRESENTATION FORM FOR VERTICAL WAVY LOW LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5633 || ch == 0xFE45 /* SESAME DOT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5634 || ch == 0xFE46 /* WHITE SESAME DOT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5635 || ch == 0xFE49 /* DASHED OVERLINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5636 || ch == 0xFE4A /* CENTRELINE OVERLINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5637 || ch == 0xFE4B /* WAVY OVERLINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5638 || ch == 0xFE4C /* DOUBLE WAVY OVERLINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5639 || ch == 0xFE4D /* DASHED LOW LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5640 || ch == 0xFE4E /* CENTRELINE LOW LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5641 || ch == 0xFE4F /* WAVY LOW LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5642 || ch == 0xFE51 /* SMALL IDEOGRAPHIC COMMA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5643 || ch == 0xFE58 /* SMALL EM DASH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5644 || ch == 0xFE5F /* SMALL NUMBER SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5645 || ch == 0xFE60 /* SMALL AMPERSAND */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5646 || ch == 0xFE61 /* SMALL ASTERISK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5647 || ch == 0xFE68 /* SMALL REVERSE SOLIDUS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5648 || ch == 0xFE6B /* SMALL COMMERCIAL AT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5649 || ch == 0xFF02 /* FULLWIDTH QUOTATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5650 || ch == 0xFF03 /* FULLWIDTH NUMBER SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5651 || ch == 0xFF06 /* FULLWIDTH AMPERSAND */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5652 || ch == 0xFF07 /* FULLWIDTH APOSTROPHE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5653 || ch == 0xFF0A /* FULLWIDTH ASTERISK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5654 || ch == 0xFF0B /* FULLWIDTH PLUS SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5655 || ch == 0xFF0D /* FULLWIDTH HYPHEN-MINUS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5656 || ch == 0xFF0F /* FULLWIDTH SOLIDUS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5657 || ch == 0xFF1C /* FULLWIDTH LESS-THAN SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5658 || ch == 0xFF1D /* FULLWIDTH EQUALS SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5659 || ch == 0xFF1E /* FULLWIDTH GREATER-THAN SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5660 || ch == 0xFF20 /* FULLWIDTH COMMERCIAL AT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5661 || ch == 0xFF3C /* FULLWIDTH REVERSE SOLIDUS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5662 || ch == 0xFF3E /* FULLWIDTH CIRCUMFLEX ACCENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5663 || ch == 0xFF3F /* FULLWIDTH LOW LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5664 || ch == 0xFF40 /* FULLWIDTH GRAVE ACCENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5665 || ch == 0xFF5C /* FULLWIDTH VERTICAL LINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5666 || ch == 0xFF5E /* FULLWIDTH TILDE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5667 || ch == 0xFFE2 /* FULLWIDTH NOT SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5668 || ch == 0xFFE3 /* FULLWIDTH MACRON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5669 || ch == 0xFFE4 /* FULLWIDTH BROKEN BAR */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5670 if (!(attr & ((1 << LBP_NS) | (1 << LBP_CM)))) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5671 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5672 /* ambiguous (ideograph) ? */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5673 if ((unicode_width[ch] != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5674 && unicode_width[ch][0] == 'A' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5675 && ch >= 0x2000) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5676 || ch == 0x24EA /* CIRCLED DIGIT ZERO */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5677 || (ch >= 0x2780 && ch <= 0x2793) /* DINGBAT ... CIRCLED DIGIT ... */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5678 attr |= 1 << LBP_AI; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5679 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5680 attr |= 1 << LBP_ID; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5681 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5682 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5683 /* ordinary alphabetic and symbol characters */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5684 if ((unicode_attributes[ch].category[0] == 'L' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5685 && (unicode_attributes[ch].category[1] == 'u' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5686 || unicode_attributes[ch].category[1] == 'l' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5687 || unicode_attributes[ch].category[1] == 't' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5688 || unicode_attributes[ch].category[1] == 'm' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5689 || unicode_attributes[ch].category[1] == 'o')) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5690 || (unicode_attributes[ch].category[0] == 'S' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5691 && (unicode_attributes[ch].category[1] == 'm' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5692 || unicode_attributes[ch].category[1] == 'k' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5693 || unicode_attributes[ch].category[1] == 'o')) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5694 || (unicode_attributes[ch].category[0] == 'N' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5695 && (unicode_attributes[ch].category[1] == 'l' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5696 || unicode_attributes[ch].category[1] == 'o')) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5697 || (unicode_attributes[ch].category[0] == 'P' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5698 && (unicode_attributes[ch].category[1] == 'c' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5699 || unicode_attributes[ch].category[1] == 'd' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5700 || unicode_attributes[ch].category[1] == 'o')) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5701 || ch == 0x0600 /* ARABIC NUMBER SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5702 || ch == 0x0601 /* ARABIC SIGN SANAH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5703 || ch == 0x0602 /* ARABIC FOOTNOTE MARKER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5704 || ch == 0x0603 /* ARABIC SIGN SAFHA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5705 || ch == 0x06DD /* ARABIC END OF AYAH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5706 || ch == 0x070F /* SYRIAC ABBREVIATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5707 || ch == 0x2061 /* FUNCTION APPLICATION */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5708 || ch == 0x2062 /* INVISIBLE TIMES */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5709 || ch == 0x2063 /* INVISIBLE SEPARATOR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5710 || ch == 0x2064 /* INVISIBLE PLUS */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5711 if (!(attr & ((1 << LBP_GL) | (1 << LBP_B2) | (1 << LBP_BA) | (1 << LBP_BB) | (1 << LBP_HY) | (1 << LBP_CB) | (1 << LBP_CL) | (1 << LBP_EX) | (1 << LBP_IN) | (1 << LBP_NS) | (1 << LBP_OP) | (1 << LBP_QU) | (1 << LBP_IS) | (1 << LBP_NU) | (1 << LBP_PO) | (1 << LBP_PR) | (1 << LBP_SY) | (1 << LBP_H2) | (1 << LBP_H3) | (1 << LBP_JL) | (1 << LBP_JV) | (1 << LBP_JT) | (1 << LBP_SA) | (1 << LBP_ID)))) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5712 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5713 /* ambiguous (alphabetic) ? */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5714 if ((unicode_width[ch] != NULL |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5715 && unicode_width[ch][0] == 'A' |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5716 && ch >= 0x2000 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5717 /* Extra exceptions for compatibility with Unicode LineBreak.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5718 && ch != 0x2022 /* BULLET */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5719 && ch != 0x203E /* OVERLINE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5720 && ch != 0x2126 /* OHM SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5721 && ch != 0x2153 /* VULGAR FRACTION ONE THIRD */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5722 && ch != 0x215C /* VULGAR FRACTION THREE EIGHTHS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5723 && ch != 0x215D /* VULGAR FRACTION FIVE EIGHTHS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5724 && ch != 0x21B8 /* NORTH WEST ARROW TO LONG BAR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5725 && ch != 0x21B9 /* LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5726 && ch != 0x21E7 /* UPWARDS WHITE ARROW */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5727 && ch != 0x24FF /* NEGATIVE CIRCLED DIGIT ZERO */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5728 && ch != 0x273D /* HEAVY TEARDROP-SPOKED ASTERISK */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5729 #if !REVISION_22 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5730 || ch == 0x00A1 /* INVERTED EXCLAMATION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5731 || ch == 0x00A7 /* SECTION SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5732 || ch == 0x00A8 /* DIAERESIS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5733 || ch == 0x00AA /* FEMININE ORDINAL INDICATOR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5734 || ch == 0x00B2 /* SUPERSCRIPT TWO */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5735 || ch == 0x00B3 /* SUPERSCRIPT THREE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5736 || ch == 0x00B6 /* PILCROW SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5737 || ch == 0x00B7 /* MIDDLE DOT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5738 || ch == 0x00B8 /* CEDILLA */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5739 || ch == 0x00B9 /* SUPERSCRIPT ONE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5740 || ch == 0x00BA /* MASCULINE ORDINAL INDICATOR */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5741 || ch == 0x00BC /* VULGAR FRACTION ONE QUARTER */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5742 || ch == 0x00BD /* VULGAR FRACTION ONE HALF */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5743 || ch == 0x00BE /* VULGAR FRACTION THREE QUARTERS */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5744 || ch == 0x00BF /* INVERTED QUESTION MARK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5745 || ch == 0x00D7 /* MULTIPLICATION SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5746 || ch == 0x00F7 /* DIVISION SIGN */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5747 || ch == 0x02C7 /* CARON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5748 || ch == 0x02C9 /* MODIFIER LETTER MACRON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5749 || ch == 0x02CA /* MODIFIER LETTER ACUTE ACCENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5750 || ch == 0x02CB /* MODIFIER LETTER GRAVE ACCENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5751 || ch == 0x02CD /* MODIFIER LETTER LOW MACRON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5752 || ch == 0x02D0 /* MODIFIER LETTER TRIANGULAR COLON */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5753 || ch == 0x02D8 /* BREVE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5754 || ch == 0x02D9 /* DOT ABOVE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5755 || ch == 0x02DA /* RING ABOVE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5756 || ch == 0x02DB /* OGONEK */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5757 || ch == 0x02DD /* DOUBLE ACUTE ACCENT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5758 #endif |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5759 || ch == 0x24EA /* CIRCLED DIGIT ZERO */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5760 || (ch >= 0x2780 && ch <= 0x2793) /* DINGBAT ... CIRCLED DIGIT ... */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5761 /* Extra characters for compatibility with Unicode LineBreak.txt. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5762 || ch == 0x2155 /* VULGAR FRACTION ONE FIFTH */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5763 || ch == 0x2574 /* BOX DRAWINGS LIGHT LEFT */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5764 || ch == 0x2616 /* WHITE SHOGI PIECE */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5765 || ch == 0x2617 /* BLACK SHOGI PIECE */) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5766 attr |= 1 << LBP_AI; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5767 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5768 attr |= 1 << LBP_AL; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5769 attr &= ~(1 << LBP_CM); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5770 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5771 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5772 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5773 if (attr == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5774 /* unknown */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5775 attr |= 1 << LBP_XX; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5776 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5777 return attr; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5778 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5779 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5780 /* Output the line breaking properties in a human readable format. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5781 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5782 debug_output_lbp (FILE *stream) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5783 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5784 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5785 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5786 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5787 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5788 int attr = get_lbp (i); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5789 if (attr != 1 << LBP_XX) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5790 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5791 fprintf (stream, "0x%04X", i); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5792 #define PRINT_BIT(attr,bit) \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5793 if (attr & (1 << bit)) fprintf (stream, " " #bit); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5794 PRINT_BIT(attr,LBP_BK); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5795 PRINT_BIT(attr,LBP_CM); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5796 PRINT_BIT(attr,LBP_WJ); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5797 PRINT_BIT(attr,LBP_ZW); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5798 PRINT_BIT(attr,LBP_GL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5799 PRINT_BIT(attr,LBP_SP); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5800 PRINT_BIT(attr,LBP_B2); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5801 PRINT_BIT(attr,LBP_BA); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5802 PRINT_BIT(attr,LBP_BB); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5803 PRINT_BIT(attr,LBP_HY); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5804 PRINT_BIT(attr,LBP_CB); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5805 PRINT_BIT(attr,LBP_CL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5806 PRINT_BIT(attr,LBP_EX); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5807 PRINT_BIT(attr,LBP_IN); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5808 PRINT_BIT(attr,LBP_NS); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5809 PRINT_BIT(attr,LBP_OP); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5810 PRINT_BIT(attr,LBP_QU); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5811 PRINT_BIT(attr,LBP_IS); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5812 PRINT_BIT(attr,LBP_NU); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5813 PRINT_BIT(attr,LBP_PO); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5814 PRINT_BIT(attr,LBP_PR); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5815 PRINT_BIT(attr,LBP_SY); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5816 PRINT_BIT(attr,LBP_AI); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5817 PRINT_BIT(attr,LBP_AL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5818 PRINT_BIT(attr,LBP_H2); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5819 PRINT_BIT(attr,LBP_H3); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5820 PRINT_BIT(attr,LBP_ID); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5821 PRINT_BIT(attr,LBP_JL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5822 PRINT_BIT(attr,LBP_JV); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5823 PRINT_BIT(attr,LBP_JT); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5824 PRINT_BIT(attr,LBP_SA); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5825 PRINT_BIT(attr,LBP_XX); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5826 #undef PRINT_BIT |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5827 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5828 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5829 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5830 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5831 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5832 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5833 debug_output_lbrk_tables (const char *filename) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5834 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5835 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5836 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5837 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5838 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5839 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5840 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5841 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5842 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5843 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5844 debug_output_lbp (stream); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5845 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5846 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5847 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5848 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5849 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5850 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5851 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5852 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5853 /* The line breaking property from the LineBreak.txt file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5854 int unicode_org_lbp[0x110000]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5855 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5856 /* Stores in unicode_org_lbp[] the line breaking property from the |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5857 LineBreak.txt file. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5858 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5859 fill_org_lbp (const char *linebreak_filename) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5860 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5861 unsigned int i, j; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5862 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5863 char field0[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5864 char field1[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5865 char field2[FIELDLEN]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5866 int lineno = 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5867 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5868 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5869 unicode_org_lbp[i] = LBP_XX; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5870 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5871 stream = fopen (linebreak_filename, "r"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5872 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5873 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5874 fprintf (stderr, "error during fopen of '%s'\n", linebreak_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5875 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5876 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5877 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5878 for (;;) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5879 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5880 int n; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5881 int c; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5882 int value; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5883 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5884 lineno++; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5885 c = getc (stream); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5886 if (c == EOF) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5887 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5888 if (c == '#') |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5889 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5890 do c = getc (stream); while (c != EOF && c != '\n'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5891 continue; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5892 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5893 ungetc (c, stream); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5894 n = getfield (stream, field0, ';'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5895 n += getfield (stream, field1, ' '); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5896 n += getfield (stream, field2, '\n'); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5897 if (n == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5898 break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5899 if (n != 3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5900 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5901 fprintf (stderr, "short line in '%s':%d\n", linebreak_filename, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5902 lineno); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5903 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5904 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5905 #define TRY(bit) else if (strcmp (field1, #bit + 4) == 0) value = bit; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5906 if (false) {} |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5907 TRY(LBP_BK) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5908 TRY(LBP_CM) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5909 TRY(LBP_WJ) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5910 TRY(LBP_ZW) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5911 TRY(LBP_GL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5912 TRY(LBP_SP) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5913 TRY(LBP_B2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5914 TRY(LBP_BA) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5915 TRY(LBP_BB) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5916 TRY(LBP_HY) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5917 TRY(LBP_CB) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5918 TRY(LBP_CL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5919 TRY(LBP_EX) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5920 TRY(LBP_IN) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5921 TRY(LBP_NS) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5922 TRY(LBP_OP) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5923 TRY(LBP_QU) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5924 TRY(LBP_IS) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5925 TRY(LBP_NU) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5926 TRY(LBP_PO) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5927 TRY(LBP_PR) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5928 TRY(LBP_SY) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5929 TRY(LBP_AI) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5930 TRY(LBP_AL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5931 TRY(LBP_H2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5932 TRY(LBP_H3) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5933 TRY(LBP_ID) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5934 TRY(LBP_JL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5935 TRY(LBP_JV) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5936 TRY(LBP_JT) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5937 TRY(LBP_SA) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5938 TRY(LBP_XX) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5939 #undef TRY |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5940 else if (strcmp (field1, "LF") == 0) value = LBP_BK; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5941 else if (strcmp (field1, "CR") == 0) value = LBP_BK; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5942 else if (strcmp (field1, "NL") == 0) value = LBP_BK; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5943 else if (strcmp (field1, "SG") == 0) value = LBP_XX; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5944 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5945 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5946 fprintf (stderr, "unknown property value \"%s\" in '%s':%d\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5947 field1, linebreak_filename, lineno); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5948 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5949 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5950 i = strtoul (field0, NULL, 16); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5951 if (strstr (field0, "..") != NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5952 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5953 /* Deal with a range. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5954 j = strtoul (strstr (field0, "..") + 2, NULL, 16); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5955 for (; i <= j; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5956 unicode_org_lbp[i] = value; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5957 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5958 else |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5959 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5960 /* Single character line. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5961 unicode_org_lbp[i] = value; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5962 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5963 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5964 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5965 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5966 fprintf (stderr, "error reading from '%s'\n", linebreak_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5967 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5968 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5969 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5970 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5971 /* Output the line breaking properties in a human readable format. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5972 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5973 debug_output_org_lbp (FILE *stream) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5974 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5975 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5976 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5977 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5978 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5979 int attr = unicode_org_lbp[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5980 if (attr != LBP_XX) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5981 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5982 fprintf (stream, "0x%04X", i); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5983 #define PRINT_BIT(attr,bit) \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5984 if (attr == bit) fprintf (stream, " " #bit); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5985 PRINT_BIT(attr,LBP_BK); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5986 PRINT_BIT(attr,LBP_CM); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5987 PRINT_BIT(attr,LBP_WJ); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5988 PRINT_BIT(attr,LBP_ZW); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5989 PRINT_BIT(attr,LBP_GL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5990 PRINT_BIT(attr,LBP_SP); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5991 PRINT_BIT(attr,LBP_B2); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5992 PRINT_BIT(attr,LBP_BA); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5993 PRINT_BIT(attr,LBP_BB); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5994 PRINT_BIT(attr,LBP_HY); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5995 PRINT_BIT(attr,LBP_CB); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5996 PRINT_BIT(attr,LBP_CL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5997 PRINT_BIT(attr,LBP_EX); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5998 PRINT_BIT(attr,LBP_IN); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5999 PRINT_BIT(attr,LBP_NS); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6000 PRINT_BIT(attr,LBP_OP); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6001 PRINT_BIT(attr,LBP_QU); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6002 PRINT_BIT(attr,LBP_IS); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6003 PRINT_BIT(attr,LBP_NU); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6004 PRINT_BIT(attr,LBP_PO); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6005 PRINT_BIT(attr,LBP_PR); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6006 PRINT_BIT(attr,LBP_SY); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6007 PRINT_BIT(attr,LBP_AI); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6008 PRINT_BIT(attr,LBP_AL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6009 PRINT_BIT(attr,LBP_H2); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6010 PRINT_BIT(attr,LBP_H3); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6011 PRINT_BIT(attr,LBP_ID); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6012 PRINT_BIT(attr,LBP_JL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6013 PRINT_BIT(attr,LBP_JV); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6014 PRINT_BIT(attr,LBP_JT); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6015 PRINT_BIT(attr,LBP_SA); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6016 PRINT_BIT(attr,LBP_XX); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6017 #undef PRINT_BIT |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6018 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6019 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6020 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6021 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6022 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6023 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6024 debug_output_org_lbrk_tables (const char *filename) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6025 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6026 FILE *stream; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6027 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6028 stream = fopen (filename, "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6029 if (stream == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6030 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6031 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6032 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6033 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6034 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6035 debug_output_org_lbp (stream); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6036 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6037 if (ferror (stream) || fclose (stream)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6038 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6039 fprintf (stderr, "error writing to '%s'\n", filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6040 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6041 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6042 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6043 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6044 /* Construction of sparse 3-level tables. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6045 #define TABLE lbp_table |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6046 #define ELEMENT unsigned char |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6047 #define DEFAULT LBP_XX |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6048 #define xmalloc malloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6049 #define xrealloc realloc |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6050 #include "3level.h" |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6051 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6052 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6053 output_lbp (FILE *stream1, FILE *stream2) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6054 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6055 unsigned int i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6056 struct lbp_table t; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6057 unsigned int level1_offset, level2_offset, level3_offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6058 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6059 t.p = 7; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6060 t.q = 9; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6061 lbp_table_init (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6062 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6063 for (i = 0; i < 0x110000; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6064 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6065 int attr = get_lbp (i); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6066 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6067 /* Now attr should contain exactly one bit. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6068 if (attr == 0 || ((attr & (attr - 1)) != 0)) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6069 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6070 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6071 if (attr != 1 << LBP_XX) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6072 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6073 unsigned int log2_attr; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6074 for (log2_attr = 0; attr > 1; attr >>= 1, log2_attr++); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6075 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6076 lbp_table_add (&t, i, log2_attr); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6077 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6078 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6079 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6080 lbp_table_finalize (&t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6081 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6082 level1_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6083 5 * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6084 level2_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6085 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6086 + t.level1_size * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6087 level3_offset = |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6088 5 * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6089 + t.level1_size * sizeof (uint32_t) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6090 + (t.level2_size << t.q) * sizeof (uint32_t); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6091 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6092 for (i = 0; i < 5; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6093 fprintf (stream1, "#define lbrkprop_header_%d %d\n", i, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6094 ((uint32_t *) t.result)[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6095 fprintf (stream1, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6096 fprintf (stream1, "typedef struct\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6097 fprintf (stream1, " {\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6098 fprintf (stream1, " int level1[%zu];\n", t.level1_size); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6099 fprintf (stream1, " int level2[%zu << %d];\n", t.level2_size, t.q); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6100 fprintf (stream1, " unsigned char level3[%zu << %d];\n", t.level3_size, t.p); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6101 fprintf (stream1, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6102 fprintf (stream1, "lbrkprop_t;\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6103 fprintf (stream1, "extern const lbrkprop_t unilbrkprop;\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6104 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6105 fprintf (stream2, "const lbrkprop_t unilbrkprop =\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6106 fprintf (stream2, "{\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6107 fprintf (stream2, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6108 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6109 fprintf (stream2, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6110 for (i = 0; i < t.level1_size; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6111 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6112 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6113 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6114 fprintf (stream2, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6115 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6116 if (offset == 0) |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6117 fprintf (stream2, " %5d", -1); |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6118 else |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6119 fprintf (stream2, " %5zu", |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6120 (offset - level2_offset) / sizeof (uint32_t)); |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6121 if (i+1 < t.level1_size) |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6122 fprintf (stream2, ","); |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6123 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6124 if (t.level1_size > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6125 fprintf (stream2, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6126 fprintf (stream2, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6127 fprintf (stream2, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6128 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6129 fprintf (stream2, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6130 for (i = 0; i < t.level2_size << t.q; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6131 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6132 uint32_t offset; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6133 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6134 fprintf (stream2, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6135 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6136 if (offset == 0) |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6137 fprintf (stream2, " %5d", -1); |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6138 else |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6139 fprintf (stream2, " %5zu", |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6140 (offset - level3_offset) / sizeof (unsigned char)); |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6141 if (i+1 < t.level2_size << t.q) |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6142 fprintf (stream2, ","); |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6143 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6144 if (t.level2_size << t.q > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6145 fprintf (stream2, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6146 fprintf (stream2, " },\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6147 fprintf (stream2, " {"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6148 if (t.level3_size << t.p > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6149 fprintf (stream2, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6150 for (i = 0; i < t.level3_size << t.p; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6151 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6152 unsigned char value = ((unsigned char *) (t.result + level3_offset))[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6153 const char *value_string; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6154 switch (value) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6155 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6156 #define CASE(x) case x: value_string = #x; break; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6157 CASE(LBP_BK); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6158 CASE(LBP_CM); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6159 CASE(LBP_WJ); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6160 CASE(LBP_ZW); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6161 CASE(LBP_GL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6162 CASE(LBP_SP); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6163 CASE(LBP_B2); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6164 CASE(LBP_BA); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6165 CASE(LBP_BB); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6166 CASE(LBP_HY); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6167 CASE(LBP_CB); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6168 CASE(LBP_CL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6169 CASE(LBP_EX); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6170 CASE(LBP_IN); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6171 CASE(LBP_NS); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6172 CASE(LBP_OP); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6173 CASE(LBP_QU); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6174 CASE(LBP_IS); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6175 CASE(LBP_NU); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6176 CASE(LBP_PO); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6177 CASE(LBP_PR); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6178 CASE(LBP_SY); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6179 CASE(LBP_AI); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6180 CASE(LBP_AL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6181 CASE(LBP_H2); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6182 CASE(LBP_H3); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6183 CASE(LBP_ID); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6184 CASE(LBP_JL); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6185 CASE(LBP_JV); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6186 CASE(LBP_JT); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6187 CASE(LBP_SA); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6188 CASE(LBP_XX); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6189 #undef CASE |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6190 default: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6191 abort (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6192 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6193 if (i > 0 && (i % 8) == 0) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6194 fprintf (stream2, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6195 fprintf (stream2, " %s%s", value_string, |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6196 (i+1 < t.level3_size << t.p ? "," : "")); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6197 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6198 if (t.level3_size << t.p > 8) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6199 fprintf (stream2, "\n "); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6200 fprintf (stream2, " }\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6201 fprintf (stream2, "};\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6202 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6203 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6204 static void |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6205 output_lbrk_tables (const char *filename1, const char *filename2, const char *version) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6206 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6207 const char *filenames[2]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6208 FILE *streams[2]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6209 size_t i; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6210 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6211 filenames[0] = filename1; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6212 filenames[1] = filename2; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6213 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6214 for (i = 0; i < 2; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6215 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6216 streams[i] = fopen (filenames[i], "w"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6217 if (streams[i] == NULL) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6218 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6219 fprintf (stderr, "cannot open '%s' for writing\n", filenames[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6220 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6221 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6222 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6223 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6224 for (i = 0; i < 2; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6225 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6226 FILE *stream = streams[i]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6227 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6228 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6229 fprintf (stream, "/* Line breaking properties of Unicode characters. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6230 fprintf (stream, "/* Generated automatically by gen-lbrk for Unicode %s. */\n", |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6231 version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6232 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6233 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6234 /* Put a GPL header on it. The gnulib module is under LGPL (although it |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6235 still carries the GPL header), and it's gnulib-tool which replaces the |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6236 GPL header with an LGPL header. */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6237 fprintf (stream, "/* Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc.\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6238 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6239 fprintf (stream, " This program is free software: you can redistribute it and/or modify\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6240 fprintf (stream, " it under the terms of the GNU General Public License as published by\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6241 fprintf (stream, " the Free Software Foundation; either version 3 of the License, or\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6242 fprintf (stream, " (at your option) any later version.\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6243 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6244 fprintf (stream, " This program is distributed in the hope that it will be useful,\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6245 fprintf (stream, " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6246 fprintf (stream, " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6247 fprintf (stream, " GNU General Public License for more details.\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6248 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6249 fprintf (stream, " You should have received a copy of the GNU General Public License\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6250 fprintf (stream, " along with this program. If not, see <http://www.gnu.org/licenses/>. */\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6251 fprintf (stream, "\n"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6252 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6253 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6254 output_lbp (streams[0], streams[1]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6255 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6256 for (i = 0; i < 2; i++) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6257 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6258 if (ferror (streams[i]) || fclose (streams[i])) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6259 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6260 fprintf (stderr, "error writing to '%s'\n", filenames[i]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6261 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6262 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6263 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6264 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6265 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6266 /* ========================================================================= */ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6267 |
11132
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6268 /* Word break property. */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6269 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6270 /* Possible values of the Word_Break property. */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6271 enum |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6272 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6273 WBP_OTHER = 0, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6274 WBP_CR = 11, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6275 WBP_LF = 12, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6276 WBP_NEWLINE = 10, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6277 WBP_EXTEND = 8, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6278 WBP_FORMAT = 9, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6279 WBP_KATAKANA = 1, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6280 WBP_ALETTER = 2, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6281 WBP_MIDNUMLET = 3, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6282 WBP_MIDLETTER = 4, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6283 WBP_MIDNUM = 5, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6284 WBP_NUMERIC = 6, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6285 WBP_EXTENDNUMLET = 7 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6286 }; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6287 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6288 /* Returns the word breaking property for ch, as a bit mask. */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6289 static int |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6290 get_wbp (unsigned int ch) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6291 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6292 int attr = 0; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6293 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6294 if (unicode_attributes[ch].name != NULL) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6295 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6296 if (ch == 0x000D) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6297 attr |= 1 << WBP_CR; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6298 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6299 if (ch == 0x000A) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6300 attr |= 1 << WBP_LF; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6301 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6302 if (ch == 0x000B || ch == 0x000C |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6303 || ch == 0x0085 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6304 || ch == 0x2028 || ch == 0x2029) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6305 attr |= 1 << WBP_NEWLINE; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6306 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6307 if (((unicode_properties[ch] >> PROP_GRAPHEME_EXTEND) & 1) != 0 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6308 || (unicode_attributes[ch].category != NULL |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6309 && strcmp (unicode_attributes[ch].category, "Mc") == 0)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6310 attr |= 1 << WBP_EXTEND; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6311 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6312 if (unicode_attributes[ch].category != NULL |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6313 && strcmp (unicode_attributes[ch].category, "Cf") == 0 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6314 && ch != 0x200C && ch != 0x200D) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6315 attr |= 1 << WBP_FORMAT; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6316 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6317 if ((unicode_scripts[ch] < numscripts |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6318 && strcmp (scripts[unicode_scripts[ch]], "Katakana") == 0) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6319 || (ch >= 0x3031 && ch <= 0x3035) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6320 || ch == 0x309B || ch == 0x309C || ch == 0x30A0 || ch == 0x30FC |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6321 || ch == 0xFF70) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6322 attr |= 1 << WBP_KATAKANA; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6323 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6324 if ((((unicode_properties[ch] >> PROP_ALPHABETIC) & 1) != 0 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6325 || ch == 0x05F3) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6326 && ((unicode_properties[ch] >> PROP_IDEOGRAPHIC) & 1) == 0 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6327 && (attr & (1 << WBP_KATAKANA)) == 0 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6328 && ((get_lbp (ch) >> LBP_SA) & 1) == 0 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6329 && !(unicode_scripts[ch] < numscripts |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6330 && strcmp (scripts[unicode_scripts[ch]], "Hiragana") == 0) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6331 && (attr & (1 << WBP_EXTEND)) == 0) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6332 attr |= 1 << WBP_ALETTER; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6333 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6334 if (ch == 0x0027 || ch == 0x002E || ch == 0x2018 || ch == 0x2019 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6335 || ch == 0x2024 || ch == 0xFE52 || ch == 0xFF07 || ch == 0xFF0E) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6336 attr |= 1 << WBP_MIDNUMLET; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6337 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6338 if (ch == 0x00B7 || ch == 0x05F4 || ch == 0x2027 || ch == 0x003A |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6339 || ch == 0x0387 || ch == 0xFE13 || ch == 0xFE55 || ch == 0xFF1A) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6340 attr |= 1 << WBP_MIDLETTER; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6341 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6342 if ((((get_lbp (ch) >> LBP_IS) & 1) != 0 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6343 || ch == 0x066C || ch == 0xFE50 || ch == 0xFE54 || ch == 0xFF0C |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6344 || ch == 0xFF1B) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6345 && ch != 0x003A && ch != 0xFE13 && ch != 0x002E) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6346 attr |= 1 << WBP_MIDNUM; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6347 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6348 if (((get_lbp (ch) >> LBP_NU) & 1) != 0 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6349 && ch != 0x066C) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6350 attr |= 1 << WBP_NUMERIC; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6351 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6352 if (unicode_attributes[ch].category != NULL |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6353 && strcmp (unicode_attributes[ch].category, "Pc") == 0) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6354 attr |= 1 << WBP_EXTENDNUMLET; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6355 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6356 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6357 if (attr == 0) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6358 /* other */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6359 attr |= 1 << WBP_OTHER; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6360 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6361 return attr; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6362 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6363 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6364 /* Output the word break property in a human readable format. */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6365 static void |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6366 debug_output_wbp (FILE *stream) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6367 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6368 unsigned int i; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6369 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6370 for (i = 0; i < 0x110000; i++) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6371 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6372 int attr = get_wbp (i); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6373 if (attr != 1 << WBP_OTHER) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6374 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6375 fprintf (stream, "0x%04X", i); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6376 if (attr & (1 << WBP_CR)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6377 fprintf (stream, " CR"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6378 if (attr & (1 << WBP_LF)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6379 fprintf (stream, " LF"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6380 if (attr & (1 << WBP_NEWLINE)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6381 fprintf (stream, " Newline"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6382 if (attr & (1 << WBP_EXTEND)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6383 fprintf (stream, " Extend"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6384 if (attr & (1 << WBP_FORMAT)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6385 fprintf (stream, " Format"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6386 if (attr & (1 << WBP_KATAKANA)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6387 fprintf (stream, " Katakana"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6388 if (attr & (1 << WBP_ALETTER)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6389 fprintf (stream, " ALetter"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6390 if (attr & (1 << WBP_MIDNUMLET)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6391 fprintf (stream, " MidNumLet"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6392 if (attr & (1 << WBP_MIDLETTER)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6393 fprintf (stream, " MidLetter"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6394 if (attr & (1 << WBP_MIDNUM)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6395 fprintf (stream, " MidNum"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6396 if (attr & (1 << WBP_NUMERIC)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6397 fprintf (stream, " Numeric"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6398 if (attr & (1 << WBP_EXTENDNUMLET)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6399 fprintf (stream, " ExtendNumLet"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6400 fprintf (stream, "\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6401 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6402 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6403 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6404 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6405 static void |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6406 debug_output_wbrk_tables (const char *filename) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6407 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6408 FILE *stream; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6409 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6410 stream = fopen (filename, "w"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6411 if (stream == NULL) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6412 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6413 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6414 exit (1); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6415 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6416 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6417 debug_output_wbp (stream); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6418 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6419 if (ferror (stream) || fclose (stream)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6420 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6421 fprintf (stderr, "error writing to '%s'\n", filename); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6422 exit (1); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6423 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6424 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6425 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6426 /* The word break property from the WordBreakProperty.txt file. */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6427 int unicode_org_wbp[0x110000]; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6428 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6429 /* Stores in unicode_org_wbp[] the word break property from the |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6430 WordBreakProperty.txt file. */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6431 static void |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6432 fill_org_wbp (const char *wordbreakproperty_filename) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6433 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6434 unsigned int i; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6435 FILE *stream; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6436 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6437 for (i = 0; i < 0x110000; i++) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6438 unicode_org_wbp[i] = WBP_OTHER; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6439 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6440 stream = fopen (wordbreakproperty_filename, "r"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6441 if (stream == NULL) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6442 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6443 fprintf (stderr, "error during fopen of '%s'\n", wordbreakproperty_filename); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6444 exit (1); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6445 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6446 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6447 for (;;) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6448 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6449 char buf[200+1]; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6450 unsigned int i1, i2; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6451 char padding[200+1]; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6452 char propname[200+1]; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6453 int propvalue; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6454 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6455 if (fscanf (stream, "%200[^\n]\n", buf) < 1) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6456 break; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6457 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6458 if (buf[0] == '\0' || buf[0] == '#') |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6459 continue; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6460 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6461 if (sscanf (buf, "%X..%X%[ ;]%[^ ]", &i1, &i2, padding, propname) != 4) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6462 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6463 if (sscanf (buf, "%X%[ ;]%[^ ]", &i1, padding, propname) != 3) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6464 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6465 fprintf (stderr, "parse error in '%s'\n", |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6466 wordbreakproperty_filename); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6467 exit (1); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6468 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6469 i2 = i1; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6470 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6471 #define PROP(name,value) \ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6472 if (strcmp (propname, name) == 0) propvalue = value; else |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6473 PROP ("CR", WBP_CR) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6474 PROP ("LF", WBP_LF) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6475 PROP ("Newline", WBP_NEWLINE) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6476 PROP ("Extend", WBP_EXTEND) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6477 PROP ("Format", WBP_FORMAT) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6478 PROP ("Katakana", WBP_KATAKANA) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6479 PROP ("ALetter", WBP_ALETTER) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6480 PROP ("MidNumLet", WBP_MIDNUMLET) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6481 PROP ("MidLetter", WBP_MIDLETTER) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6482 PROP ("MidNum", WBP_MIDNUM) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6483 PROP ("Numeric", WBP_NUMERIC) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6484 PROP ("ExtendNumLet", WBP_EXTENDNUMLET) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6485 #undef PROP |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6486 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6487 fprintf (stderr, "unknown property value '%s' in '%s'\n", propname, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6488 wordbreakproperty_filename); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6489 exit (1); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6490 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6491 if (!(i1 <= i2 && i2 < 0x110000)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6492 abort (); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6493 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6494 for (i = i1; i <= i2; i++) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6495 unicode_org_wbp[i] = propvalue; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6496 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6497 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6498 if (ferror (stream) || fclose (stream)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6499 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6500 fprintf (stderr, "error reading from '%s'\n", wordbreakproperty_filename); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6501 exit (1); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6502 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6503 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6504 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6505 /* Output the word break property in a human readable format. */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6506 static void |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6507 debug_output_org_wbp (FILE *stream) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6508 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6509 unsigned int i; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6510 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6511 for (i = 0; i < 0x110000; i++) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6512 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6513 int propvalue = unicode_org_wbp[i]; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6514 if (propvalue != WBP_OTHER) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6515 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6516 fprintf (stream, "0x%04X", i); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6517 #define PROP(name,value) \ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6518 if (propvalue == value) fprintf (stream, " " name); else |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6519 PROP ("CR", WBP_CR) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6520 PROP ("LF", WBP_LF) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6521 PROP ("Newline", WBP_NEWLINE) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6522 PROP ("Extend", WBP_EXTEND) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6523 PROP ("Format", WBP_FORMAT) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6524 PROP ("Katakana", WBP_KATAKANA) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6525 PROP ("ALetter", WBP_ALETTER) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6526 PROP ("MidNumLet", WBP_MIDNUMLET) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6527 PROP ("MidLetter", WBP_MIDLETTER) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6528 PROP ("MidNum", WBP_MIDNUM) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6529 PROP ("Numeric", WBP_NUMERIC) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6530 PROP ("ExtendNumLet", WBP_EXTENDNUMLET) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6531 #undef PROP |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6532 fprintf (stream, " ??"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6533 fprintf (stream, "\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6534 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6535 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6536 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6537 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6538 static void |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6539 debug_output_org_wbrk_tables (const char *filename) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6540 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6541 FILE *stream; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6542 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6543 stream = fopen (filename, "w"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6544 if (stream == NULL) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6545 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6546 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6547 exit (1); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6548 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6549 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6550 debug_output_org_wbp (stream); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6551 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6552 if (ferror (stream) || fclose (stream)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6553 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6554 fprintf (stderr, "error writing to '%s'\n", filename); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6555 exit (1); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6556 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6557 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6558 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6559 /* Construction of sparse 3-level tables. */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6560 #define TABLE wbp_table |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6561 #define ELEMENT unsigned char |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6562 #define DEFAULT WBP_OTHER |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6563 #define xmalloc malloc |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6564 #define xrealloc realloc |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6565 #include "3level.h" |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6566 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6567 static void |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6568 output_wbp (FILE *stream) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6569 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6570 unsigned int i; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6571 struct wbp_table t; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6572 unsigned int level1_offset, level2_offset, level3_offset; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6573 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6574 t.p = 7; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6575 t.q = 9; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6576 wbp_table_init (&t); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6577 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6578 for (i = 0; i < 0x110000; i++) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6579 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6580 int attr = get_wbp (i); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6581 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6582 /* Now attr should contain exactly one bit. */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6583 if (attr == 0 || ((attr & (attr - 1)) != 0)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6584 abort (); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6585 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6586 if (attr != 1 << WBP_OTHER) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6587 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6588 unsigned int log2_attr; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6589 for (log2_attr = 0; attr > 1; attr >>= 1, log2_attr++); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6590 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6591 wbp_table_add (&t, i, log2_attr); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6592 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6593 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6594 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6595 wbp_table_finalize (&t); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6596 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6597 level1_offset = |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6598 5 * sizeof (uint32_t); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6599 level2_offset = |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6600 5 * sizeof (uint32_t) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6601 + t.level1_size * sizeof (uint32_t); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6602 level3_offset = |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6603 5 * sizeof (uint32_t) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6604 + t.level1_size * sizeof (uint32_t) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6605 + (t.level2_size << t.q) * sizeof (uint32_t); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6606 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6607 for (i = 0; i < 5; i++) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6608 fprintf (stream, "#define wbrkprop_header_%d %d\n", i, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6609 ((uint32_t *) t.result)[i]); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6610 fprintf (stream, "\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6611 fprintf (stream, "typedef struct\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6612 fprintf (stream, " {\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6613 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6614 fprintf (stream, " int level2[%zu << %d];\n", t.level2_size, t.q); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6615 fprintf (stream, " unsigned char level3[%zu << %d];\n", t.level3_size, t.p); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6616 fprintf (stream, " }\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6617 fprintf (stream, "wbrkprop_t;\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6618 fprintf (stream, "static const wbrkprop_t uniwbrkprop =\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6619 fprintf (stream, "{\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6620 fprintf (stream, " {"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6621 if (t.level1_size > 8) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6622 fprintf (stream, "\n "); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6623 for (i = 0; i < t.level1_size; i++) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6624 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6625 uint32_t offset; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6626 if (i > 0 && (i % 8) == 0) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6627 fprintf (stream, "\n "); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6628 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6629 if (offset == 0) |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6630 fprintf (stream, " %5d", -1); |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6631 else |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6632 fprintf (stream, " %5zu", |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6633 (offset - level2_offset) / sizeof (uint32_t)); |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6634 if (i+1 < t.level1_size) |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6635 fprintf (stream, ","); |
11132
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6636 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6637 if (t.level1_size > 8) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6638 fprintf (stream, "\n "); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6639 fprintf (stream, " },\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6640 fprintf (stream, " {"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6641 if (t.level2_size << t.q > 8) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6642 fprintf (stream, "\n "); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6643 for (i = 0; i < t.level2_size << t.q; i++) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6644 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6645 uint32_t offset; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6646 if (i > 0 && (i % 8) == 0) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6647 fprintf (stream, "\n "); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6648 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6649 if (offset == 0) |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6650 fprintf (stream, " %5d", -1); |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6651 else |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6652 fprintf (stream, " %5zu", |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6653 (offset - level3_offset) / sizeof (unsigned char)); |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6654 if (i+1 < t.level2_size << t.q) |
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
6655 fprintf (stream, ","); |
11132
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6656 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6657 if (t.level2_size << t.q > 8) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6658 fprintf (stream, "\n "); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6659 fprintf (stream, " },\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6660 fprintf (stream, " {"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6661 if (t.level3_size << t.p > 4) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6662 fprintf (stream, "\n "); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6663 for (i = 0; i < t.level3_size << t.p; i++) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6664 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6665 unsigned char value = ((unsigned char *) (t.result + level3_offset))[i]; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6666 const char *value_string; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6667 switch (value) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6668 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6669 #define CASE(x) case x: value_string = #x; break; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6670 CASE(WBP_OTHER); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6671 CASE(WBP_CR); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6672 CASE(WBP_LF); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6673 CASE(WBP_NEWLINE); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6674 CASE(WBP_EXTEND); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6675 CASE(WBP_FORMAT); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6676 CASE(WBP_KATAKANA); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6677 CASE(WBP_ALETTER); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6678 CASE(WBP_MIDNUMLET); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6679 CASE(WBP_MIDLETTER); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6680 CASE(WBP_MIDNUM); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6681 CASE(WBP_NUMERIC); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6682 CASE(WBP_EXTENDNUMLET); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6683 #undef CASE |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6684 default: |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6685 abort (); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6686 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6687 if (i > 0 && (i % 4) == 0) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6688 fprintf (stream, "\n "); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6689 fprintf (stream, " %s%s", value_string, |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6690 (i+1 < t.level3_size << t.p ? "," : "")); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6691 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6692 if (t.level3_size << t.p > 4) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6693 fprintf (stream, "\n "); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6694 fprintf (stream, " }\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6695 fprintf (stream, "};\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6696 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6697 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6698 static void |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6699 output_wbrk_tables (const char *filename, const char *version) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6700 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6701 FILE *stream; |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6702 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6703 stream = fopen (filename, "w"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6704 if (stream == NULL) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6705 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6706 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6707 exit (1); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6708 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6709 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6710 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6711 fprintf (stream, "/* Line breaking properties of Unicode characters. */\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6712 fprintf (stream, "/* Generated automatically by gen-uni-tables for Unicode %s. */\n", |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6713 version); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6714 fprintf (stream, "\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6715 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6716 /* Put a GPL header on it. The gnulib module is under LGPL (although it |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6717 still carries the GPL header), and it's gnulib-tool which replaces the |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6718 GPL header with an LGPL header. */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6719 fprintf (stream, "/* Copyright (C) 2000-2002, 2004, 2007-2009 Free Software Foundation, Inc.\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6720 fprintf (stream, "\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6721 fprintf (stream, " This program is free software: you can redistribute it and/or modify\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6722 fprintf (stream, " it under the terms of the GNU General Public License as published by\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6723 fprintf (stream, " the Free Software Foundation; either version 3 of the License, or\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6724 fprintf (stream, " (at your option) any later version.\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6725 fprintf (stream, "\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6726 fprintf (stream, " This program is distributed in the hope that it will be useful,\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6727 fprintf (stream, " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6728 fprintf (stream, " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6729 fprintf (stream, " GNU General Public License for more details.\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6730 fprintf (stream, "\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6731 fprintf (stream, " You should have received a copy of the GNU General Public License\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6732 fprintf (stream, " along with this program. If not, see <http://www.gnu.org/licenses/>. */\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6733 fprintf (stream, "\n"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6734 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6735 output_wbp (stream); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6736 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6737 if (ferror (stream) || fclose (stream)) |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6738 { |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6739 fprintf (stderr, "error writing to '%s'\n", filename); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6740 exit (1); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6741 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6742 } |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6743 |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6744 /* ========================================================================= */ |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
6745 |
11176
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6746 /* Maximum number of characters into which a single Unicode character can be |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6747 decomposed. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6748 #define MAX_DECOMP_LENGTH 18 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6749 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6750 enum |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6751 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6752 UC_DECOMP_CANONICAL,/* Canonical decomposition. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6753 UC_DECOMP_FONT, /* <font> A font variant (e.g. a blackletter form). */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6754 UC_DECOMP_NOBREAK, /* <noBreak> A no-break version of a space or hyphen. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6755 UC_DECOMP_INITIAL, /* <initial> An initial presentation form (Arabic). */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6756 UC_DECOMP_MEDIAL, /* <medial> A medial presentation form (Arabic). */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6757 UC_DECOMP_FINAL, /* <final> A final presentation form (Arabic). */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6758 UC_DECOMP_ISOLATED,/* <isolated> An isolated presentation form (Arabic). */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6759 UC_DECOMP_CIRCLE, /* <circle> An encircled form. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6760 UC_DECOMP_SUPER, /* <super> A superscript form. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6761 UC_DECOMP_SUB, /* <sub> A subscript form. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6762 UC_DECOMP_VERTICAL,/* <vertical> A vertical layout presentation form. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6763 UC_DECOMP_WIDE, /* <wide> A wide (or zenkaku) compatibility character. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6764 UC_DECOMP_NARROW, /* <narrow> A narrow (or hankaku) compatibility character. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6765 UC_DECOMP_SMALL, /* <small> A small variant form (CNS compatibility). */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6766 UC_DECOMP_SQUARE, /* <square> A CJK squared font variant. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6767 UC_DECOMP_FRACTION,/* <fraction> A vulgar fraction form. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6768 UC_DECOMP_COMPAT /* <compat> Otherwise unspecified compatibility character. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6769 }; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6770 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6771 /* Return the decomposition for a Unicode character (ignoring Hangul Jamo |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6772 decompositions). Return the type, or -1 for none. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6773 static int |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6774 get_decomposition (unsigned int ch, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6775 unsigned int *lengthp, unsigned int decomposed[MAX_DECOMP_LENGTH]) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6776 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6777 const char *decomposition = unicode_attributes[ch].decomposition; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6778 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6779 if (decomposition != NULL && decomposition[0] != '\0') |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6780 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6781 int type = UC_DECOMP_CANONICAL; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6782 unsigned int length; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6783 char *endptr; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6784 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6785 if (decomposition[0] == '<') |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6786 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6787 const char *rangle; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6788 size_t typelen; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6789 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6790 rangle = strchr (decomposition + 1, '>'); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6791 if (rangle == NULL) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6792 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6793 typelen = rangle + 1 - decomposition; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6794 #define TYPE(t1,t2) \ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6795 if (typelen == (sizeof (t1) - 1) && memcmp (decomposition, t1, typelen) == 0) \ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6796 type = t2; \ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6797 else |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6798 TYPE ("<font>", UC_DECOMP_FONT) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6799 TYPE ("<noBreak>", UC_DECOMP_NOBREAK) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6800 TYPE ("<initial>", UC_DECOMP_INITIAL) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6801 TYPE ("<medial>", UC_DECOMP_MEDIAL) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6802 TYPE ("<final>", UC_DECOMP_FINAL) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6803 TYPE ("<isolated>", UC_DECOMP_ISOLATED) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6804 TYPE ("<circle>", UC_DECOMP_CIRCLE) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6805 TYPE ("<super>", UC_DECOMP_SUPER) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6806 TYPE ("<sub>", UC_DECOMP_SUB) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6807 TYPE ("<vertical>", UC_DECOMP_VERTICAL) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6808 TYPE ("<wide>", UC_DECOMP_WIDE) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6809 TYPE ("<narrow>", UC_DECOMP_NARROW) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6810 TYPE ("<small>", UC_DECOMP_SMALL) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6811 TYPE ("<square>", UC_DECOMP_SQUARE) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6812 TYPE ("<fraction>", UC_DECOMP_FRACTION) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6813 TYPE ("<compat>", UC_DECOMP_COMPAT) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6814 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6815 fprintf (stderr, "unknown decomposition type %*s\n", (int)typelen, decomposition); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6816 exit (1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6817 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6818 #undef TYPE |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6819 decomposition = rangle + 1; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6820 if (decomposition[0] == ' ') |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6821 decomposition++; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6822 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6823 for (length = 0; length < MAX_DECOMP_LENGTH; length++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6824 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6825 decomposed[length] = strtoul (decomposition, &endptr, 16); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6826 if (endptr == decomposition) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6827 break; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6828 decomposition = endptr; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6829 if (decomposition[0] == ' ') |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6830 decomposition++; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6831 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6832 if (*decomposition != '\0') |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6833 /* MAX_DECOMP_LENGTH is too small. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6834 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6835 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6836 *lengthp = length; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6837 return type; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6838 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6839 else |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6840 return -1; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6841 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6842 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6843 /* Construction of sparse 3-level tables. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6844 #define TABLE decomp_table |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6845 #define ELEMENT uint16_t |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6846 #define DEFAULT (uint16_t)(-1) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6847 #define xmalloc malloc |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6848 #define xrealloc realloc |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6849 #include "3level.h" |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6850 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6851 static void |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6852 output_decomposition (FILE *stream1, FILE *stream2) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6853 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6854 struct decomp_table t; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6855 unsigned int level1_offset, level2_offset, level3_offset; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6856 unsigned int offset; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6857 unsigned int ch; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6858 unsigned int i; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6859 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6860 t.p = 5; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6861 t.q = 5; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6862 decomp_table_init (&t); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6863 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6864 fprintf (stream1, "extern const unsigned char gl_uninorm_decomp_chars_table[];\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6865 fprintf (stream1, "\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6866 fprintf (stream2, "const unsigned char gl_uninorm_decomp_chars_table[] =\n{"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6867 offset = 0; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6868 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6869 for (ch = 0; ch < 0x110000; ch++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6870 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6871 unsigned int length; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6872 unsigned int decomposed[MAX_DECOMP_LENGTH]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6873 int type = get_decomposition (ch, &length, decomposed); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6874 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6875 if (type >= 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6876 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6877 if (!(offset < (1 << 15))) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6878 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6879 decomp_table_add (&t, ch, ((type == UC_DECOMP_CANONICAL ? 0 : 1) << 15) | offset); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6880 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6881 /* Produce length 3-bytes entries. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6882 if (length == 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6883 /* We would need a special representation of zero-length entries. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6884 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6885 for (i = 0; i < length; i++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6886 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6887 if (offset > 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6888 fprintf (stream2, ","); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6889 if ((offset % 4) == 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6890 fprintf (stream2, "\n "); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6891 if (!(decomposed[i] < (1 << 18))) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6892 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6893 fprintf (stream2, " 0x%02X, 0x%02X, 0x%02X", |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6894 (((i+1 < length ? (1 << 23) : 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6895 | (i == 0 ? (type << 18) : 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6896 | decomposed[i]) >> 16) & 0xff, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6897 (decomposed[i] >> 8) & 0xff, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6898 decomposed[i] & 0xff); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6899 offset++; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6900 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6901 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6902 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6903 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6904 fprintf (stream2, "\n};\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6905 fprintf (stream2, "\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6906 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6907 decomp_table_finalize (&t); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6908 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6909 level1_offset = |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6910 5 * sizeof (uint32_t); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6911 level2_offset = |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6912 5 * sizeof (uint32_t) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6913 + t.level1_size * sizeof (uint32_t); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6914 level3_offset = |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6915 5 * sizeof (uint32_t) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6916 + t.level1_size * sizeof (uint32_t) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6917 + (t.level2_size << t.q) * sizeof (uint32_t); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6918 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6919 for (i = 0; i < 5; i++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6920 fprintf (stream1, "#define decomp_header_%d %d\n", i, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6921 ((uint32_t *) t.result)[i]); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6922 fprintf (stream1, "\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6923 fprintf (stream1, "typedef struct\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6924 fprintf (stream1, " {\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6925 fprintf (stream1, " int level1[%zu];\n", t.level1_size); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6926 fprintf (stream1, " int level2[%zu << %d];\n", t.level2_size, t.q); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6927 fprintf (stream1, " unsigned short level3[%zu << %d];\n", t.level3_size, t.p); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6928 fprintf (stream1, " }\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6929 fprintf (stream1, "decomp_index_table_t;\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6930 fprintf (stream1, "extern const decomp_index_table_t gl_uninorm_decomp_index_table;\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6931 fprintf (stream2, "const decomp_index_table_t gl_uninorm_decomp_index_table =\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6932 fprintf (stream2, "{\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6933 fprintf (stream2, " {"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6934 if (t.level1_size > 8) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6935 fprintf (stream2, "\n "); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6936 for (i = 0; i < t.level1_size; i++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6937 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6938 uint32_t offset; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6939 if (i > 0 && (i % 8) == 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6940 fprintf (stream2, "\n "); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6941 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6942 if (offset == 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6943 fprintf (stream2, " %5d", -1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6944 else |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6945 fprintf (stream2, " %5zu", |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6946 (offset - level2_offset) / sizeof (uint32_t)); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6947 if (i+1 < t.level1_size) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6948 fprintf (stream2, ","); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6949 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6950 if (t.level1_size > 8) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6951 fprintf (stream2, "\n "); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6952 fprintf (stream2, " },\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6953 fprintf (stream2, " {"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6954 if (t.level2_size << t.q > 8) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6955 fprintf (stream2, "\n "); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6956 for (i = 0; i < t.level2_size << t.q; i++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6957 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6958 uint32_t offset; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6959 if (i > 0 && (i % 8) == 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6960 fprintf (stream2, "\n "); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6961 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6962 if (offset == 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6963 fprintf (stream2, " %5d", -1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6964 else |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6965 fprintf (stream2, " %5zu", |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6966 (offset - level3_offset) / sizeof (uint16_t)); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6967 if (i+1 < t.level2_size << t.q) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6968 fprintf (stream2, ","); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6969 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6970 if (t.level2_size << t.q > 8) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6971 fprintf (stream2, "\n "); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6972 fprintf (stream2, " },\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6973 fprintf (stream2, " {"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6974 if (t.level3_size << t.p > 8) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6975 fprintf (stream2, "\n "); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6976 for (i = 0; i < t.level3_size << t.p; i++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6977 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6978 uint16_t value = ((uint16_t *) (t.result + level3_offset))[i]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6979 if (i > 0 && (i % 8) == 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6980 fprintf (stream2, "\n "); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6981 fprintf (stream2, " %5d", value == (uint16_t)(-1) ? -1 : value); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6982 if (i+1 < t.level3_size << t.p) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6983 fprintf (stream2, ","); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6984 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6985 if (t.level3_size << t.p > 8) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6986 fprintf (stream2, "\n "); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6987 fprintf (stream2, " }\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6988 fprintf (stream2, "};\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6989 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6990 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6991 static void |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6992 output_decomposition_tables (const char *filename1, const char *filename2, const char *version) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6993 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6994 const char *filenames[2]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6995 FILE *streams[2]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6996 size_t i; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6997 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6998 filenames[0] = filename1; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
6999 filenames[1] = filename2; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7000 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7001 for (i = 0; i < 2; i++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7002 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7003 streams[i] = fopen (filenames[i], "w"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7004 if (streams[i] == NULL) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7005 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7006 fprintf (stderr, "cannot open '%s' for writing\n", filenames[i]); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7007 exit (1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7008 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7009 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7010 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7011 for (i = 0; i < 2; i++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7012 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7013 FILE *stream = streams[i]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7014 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7015 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7016 fprintf (stream, "/* Decomposition of Unicode characters. */\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7017 fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s. */\n", |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7018 version); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7019 fprintf (stream, "\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7020 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7021 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7022 output_decomposition (streams[0], streams[1]); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7023 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7024 for (i = 0; i < 2; i++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7025 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7026 if (ferror (streams[i]) || fclose (streams[i])) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7027 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7028 fprintf (stderr, "error writing to '%s'\n", filenames[i]); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7029 exit (1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7030 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7031 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7032 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7033 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7034 /* The "excluded from composition" property from the CompositionExclusions.txt file. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7035 char unicode_composition_exclusions[0x110000]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7036 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7037 static void |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7038 fill_composition_exclusions (const char *compositionexclusions_filename) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7039 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7040 FILE *stream; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7041 unsigned int i; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7042 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7043 stream = fopen (compositionexclusions_filename, "r"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7044 if (stream == NULL) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7045 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7046 fprintf (stderr, "error during fopen of '%s'\n", compositionexclusions_filename); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7047 exit (1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7048 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7049 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7050 for (i = 0; i < 0x110000; i++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7051 unicode_composition_exclusions[i] = 0; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7052 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7053 for (;;) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7054 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7055 char buf[200+1]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7056 unsigned int i; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7057 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7058 if (fscanf (stream, "%200[^\n]\n", buf) < 1) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7059 break; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7060 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7061 if (buf[0] == '\0' || buf[0] == '#') |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7062 continue; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7063 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7064 if (sscanf (buf, "%X", &i) != 1) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7065 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7066 fprintf (stderr, "parse error in '%s'\n", compositionexclusions_filename); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7067 exit (1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7068 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7069 if (!(i < 0x110000)) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7070 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7071 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7072 unicode_composition_exclusions[i] = 1; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7073 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7074 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7075 if (ferror (stream) || fclose (stream)) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7076 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7077 fprintf (stderr, "error reading from '%s'\n", compositionexclusions_filename); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7078 exit (1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7079 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7080 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7081 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7082 static void |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7083 debug_output_composition_tables (const char *filename) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7084 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7085 FILE *stream; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7086 unsigned int ch; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7087 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7088 stream = fopen (filename, "w"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7089 if (stream == NULL) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7090 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7091 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7092 exit (1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7093 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7094 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7095 for (ch = 0; ch < 0x110000; ch++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7096 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7097 unsigned int length; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7098 unsigned int decomposed[MAX_DECOMP_LENGTH]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7099 int type = get_decomposition (ch, &length, decomposed); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7100 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7101 if (type == UC_DECOMP_CANONICAL |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7102 /* Consider only binary decompositions. |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7103 Exclude singleton decompositions. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7104 && length == 2) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7105 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7106 unsigned int code1 = decomposed[0]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7107 unsigned int code2 = decomposed[1]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7108 unsigned int combined = ch; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7109 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7110 /* Exclude decompositions where the first part is not a starter, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7111 i.e. is not of canonical combining class 0. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7112 if (strcmp (unicode_attributes[code1].combining, "0") == 0 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7113 /* Exclude characters listed in CompositionExclusions.txt. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7114 && !unicode_composition_exclusions[combined]) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7115 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7116 /* The combined character must now also be a starter. |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7117 Verify this. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7118 if (strcmp (unicode_attributes[combined].combining, "0") != 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7119 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7120 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7121 fprintf (stream, "0x%04X\t0x%04X\t0x%04X\t%s\n", |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7122 code1, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7123 code2, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7124 combined, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7125 unicode_attributes[code2].combining); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7126 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7127 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7128 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7129 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7130 if (ferror (stream) || fclose (stream)) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7131 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7132 fprintf (stderr, "error writing to '%s'\n", filename); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7133 exit (1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7134 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7135 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7136 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7137 static void |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7138 output_composition_tables (const char *filename, const char *version) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7139 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7140 FILE *stream; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7141 unsigned int ch; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7142 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7143 stream = fopen (filename, "w"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7144 if (stream == NULL) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7145 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7146 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7147 exit (1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7148 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7149 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7150 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7151 fprintf (stream, "/* Canonical composition of Unicode characters. */\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7152 fprintf (stream, "/* Generated automatically by gen-uni-tables for Unicode %s. */\n", |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7153 version); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7154 fprintf (stream, "\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7155 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7156 /* Put a GPL header on it. The gnulib module is under LGPL (although it |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7157 still carries the GPL header), and it's gnulib-tool which replaces the |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7158 GPL header with an LGPL header. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7159 fprintf (stream, "/* Copyright (C) 2009 Free Software Foundation, Inc.\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7160 fprintf (stream, "\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7161 fprintf (stream, " This program is free software: you can redistribute it and/or modify\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7162 fprintf (stream, " it under the terms of the GNU General Public License as published by\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7163 fprintf (stream, " the Free Software Foundation; either version 3 of the License, or\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7164 fprintf (stream, " (at your option) any later version.\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7165 fprintf (stream, "\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7166 fprintf (stream, " This program is distributed in the hope that it will be useful,\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7167 fprintf (stream, " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7168 fprintf (stream, " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7169 fprintf (stream, " GNU General Public License for more details.\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7170 fprintf (stream, "\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7171 fprintf (stream, " You should have received a copy of the GNU General Public License\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7172 fprintf (stream, " along with this program. If not, see <http://www.gnu.org/licenses/>. */\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7173 fprintf (stream, "\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7174 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7175 /* The composition table is a set of mappings (code1, code2) -> combined, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7176 with 928 entries, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7177 367 values for code1 (from 0x003C to 0x30FD), |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7178 54 values for code2 (from 0x0300 to 0x309A). |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7179 For a fixed code1, there are from 1 to 19 possible values for code2. |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7180 For a fixed code2, there are from 1 to 117 possible values for code1. |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7181 This is a very sparse matrix. |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7182 |
11177
4eaf6d56360f
Remove old, dead code in last commit.
Bruno Haible <bruno@clisp.org>
parents:
11176
diff
changeset
|
7183 We want an O(1) hash lookup. |
4eaf6d56360f
Remove old, dead code in last commit.
Bruno Haible <bruno@clisp.org>
parents:
11176
diff
changeset
|
7184 |
4eaf6d56360f
Remove old, dead code in last commit.
Bruno Haible <bruno@clisp.org>
parents:
11176
diff
changeset
|
7185 We could implement the hash lookup by mapping (code1, code2) to a linear |
11176
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7186 combination mul1*code1 + mul2*code2, which is then used as an index into |
11177
4eaf6d56360f
Remove old, dead code in last commit.
Bruno Haible <bruno@clisp.org>
parents:
11176
diff
changeset
|
7187 a 3-level table. But this leads to a table of size 37 KB. |
4eaf6d56360f
Remove old, dead code in last commit.
Bruno Haible <bruno@clisp.org>
parents:
11176
diff
changeset
|
7188 |
4eaf6d56360f
Remove old, dead code in last commit.
Bruno Haible <bruno@clisp.org>
parents:
11176
diff
changeset
|
7189 We use gperf to implement the hash lookup, giving it the 928 sets of |
11176
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7190 4 bytes (code1, code2) as input. gperf generates a hash table of size |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7191 1527, which is quite good (60% filled). It requires an auxiliary table |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7192 lookup in a table of size 0.5 KB. The total tables size is 11 KB. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7193 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7194 fprintf (stream, "struct composition_rule { char codes[4]; };\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7195 fprintf (stream, "%%struct-type\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7196 fprintf (stream, "%%language=ANSI-C\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7197 fprintf (stream, "%%define slot-name codes\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7198 fprintf (stream, "%%define hash-function-name gl_uninorm_compose_hash\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7199 fprintf (stream, "%%define lookup-function-name gl_uninorm_compose_lookup\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7200 fprintf (stream, "%%compare-lengths\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7201 fprintf (stream, "%%compare-strncmp\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7202 fprintf (stream, "%%readonly-tables\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7203 fprintf (stream, "%%omit-struct-type\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7204 fprintf (stream, "%%%%\n"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7205 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7206 for (ch = 0; ch < 0x110000; ch++) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7207 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7208 unsigned int length; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7209 unsigned int decomposed[MAX_DECOMP_LENGTH]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7210 int type = get_decomposition (ch, &length, decomposed); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7211 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7212 if (type == UC_DECOMP_CANONICAL |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7213 /* Consider only binary decompositions. |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7214 Exclude singleton decompositions. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7215 && length == 2) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7216 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7217 unsigned int code1 = decomposed[0]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7218 unsigned int code2 = decomposed[1]; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7219 unsigned int combined = ch; |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7220 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7221 /* Exclude decompositions where the first part is not a starter, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7222 i.e. is not of canonical combining class 0. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7223 if (strcmp (unicode_attributes[code1].combining, "0") == 0 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7224 /* Exclude characters listed in CompositionExclusions.txt. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7225 && !unicode_composition_exclusions[combined]) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7226 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7227 /* The combined character must now also be a starter. |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7228 Verify this. */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7229 if (strcmp (unicode_attributes[combined].combining, "0") != 0) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7230 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7231 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7232 if (!(code1 < 0x10000)) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7233 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7234 if (!(code2 < 0x10000)) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7235 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7236 if (!(combined < 0x10000)) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7237 abort (); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7238 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7239 fprintf (stream, "\"\\x%02x\\x%02x\\x%02x\\x%02x\", 0x%04x\n", |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7240 (code1 >> 8) & 0xff, code1 & 0xff, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7241 (code2 >> 8) & 0xff, code2 & 0xff, |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7242 combined); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7243 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7244 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7245 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7246 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7247 if (ferror (stream) || fclose (stream)) |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7248 { |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7249 fprintf (stderr, "error writing to '%s'\n", filename); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7250 exit (1); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7251 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7252 } |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7253 |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7254 /* ========================================================================= */ |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
7255 |
11141
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7256 /* Output the test for a simple character mapping table to the given file. */ |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7257 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7258 static void |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7259 output_simple_mapping_test (const char *filename, |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7260 const char *function_name, |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7261 unsigned int (*func) (unsigned int), |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7262 const char *version) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7263 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7264 FILE *stream; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7265 bool need_comma; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7266 unsigned int ch; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7267 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7268 stream = fopen (filename, "w"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7269 if (stream == NULL) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7270 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7271 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7272 exit (1); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7273 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7274 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7275 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7276 fprintf (stream, "/* Test the Unicode character mapping functions.\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7277 fprintf (stream, " Copyright (C) 2009 Free Software Foundation, Inc.\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7278 fprintf (stream, "\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7279 fprintf (stream, " This program is free software: you can redistribute it and/or modify\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7280 fprintf (stream, " it under the terms of the GNU General Public License as published by\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7281 fprintf (stream, " the Free Software Foundation; either version 3 of the License, or\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7282 fprintf (stream, " (at your option) any later version.\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7283 fprintf (stream, "\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7284 fprintf (stream, " This program is distributed in the hope that it will be useful,\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7285 fprintf (stream, " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7286 fprintf (stream, " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7287 fprintf (stream, " GNU General Public License for more details.\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7288 fprintf (stream, "\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7289 fprintf (stream, " You should have received a copy of the GNU General Public License\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7290 fprintf (stream, " along with this program. If not, see <http://www.gnu.org/licenses/>. */\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7291 fprintf (stream, "\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7292 fprintf (stream, "/* Generated automatically by gen-case.c for Unicode %s. */\n", |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7293 version); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7294 fprintf (stream, "\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7295 fprintf (stream, "#include \"test-mapping-part1.h\"\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7296 fprintf (stream, "\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7297 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7298 need_comma = false; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7299 for (ch = 0; ch < 0x110000; ch++) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7300 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7301 unsigned int value = func (ch); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7302 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7303 if (value != ch) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7304 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7305 if (need_comma) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7306 fprintf (stream, ",\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7307 fprintf (stream, " { 0x%04X, 0x%04X }", ch, value); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7308 need_comma = true; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7309 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7310 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7311 if (need_comma) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7312 fprintf (stream, "\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7313 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7314 fprintf (stream, "\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7315 fprintf (stream, "#define MAP(c) %s (c)\n", function_name); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7316 fprintf (stream, "#include \"test-mapping-part2.h\"\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7317 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7318 if (ferror (stream) || fclose (stream)) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7319 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7320 fprintf (stderr, "error writing to '%s'\n", filename); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7321 exit (1); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7322 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7323 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7324 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7325 /* Construction of sparse 3-level tables. */ |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7326 #define TABLE mapping_table |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7327 #define ELEMENT int32_t |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7328 #define DEFAULT 0 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7329 #define xmalloc malloc |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7330 #define xrealloc realloc |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7331 #include "3level.h" |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7332 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7333 /* Output a simple character mapping table to the given file. */ |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7334 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7335 static void |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7336 output_simple_mapping (const char *filename, |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7337 unsigned int (*func) (unsigned int), |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7338 const char *version) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7339 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7340 FILE *stream; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7341 unsigned int ch, i; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7342 struct mapping_table t; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7343 unsigned int level1_offset, level2_offset, level3_offset; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7344 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7345 stream = fopen (filename, "w"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7346 if (stream == NULL) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7347 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7348 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7349 exit (1); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7350 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7351 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7352 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7353 fprintf (stream, "/* Simple character mapping of Unicode characters. */\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7354 fprintf (stream, "/* Generated automatically by gen-case.c for Unicode %s. */\n", |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7355 version); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7356 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7357 t.p = 7; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7358 t.q = 9; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7359 mapping_table_init (&t); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7360 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7361 for (ch = 0; ch < 0x110000; ch++) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7362 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7363 int value = (int) func (ch) - (int) ch; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7364 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7365 mapping_table_add (&t, ch, value); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7366 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7367 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7368 mapping_table_finalize (&t); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7369 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7370 /* Offsets in t.result, in memory of this process. */ |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7371 level1_offset = |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7372 5 * sizeof (uint32_t); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7373 level2_offset = |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7374 5 * sizeof (uint32_t) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7375 + t.level1_size * sizeof (uint32_t); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7376 level3_offset = |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7377 5 * sizeof (uint32_t) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7378 + t.level1_size * sizeof (uint32_t) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7379 + (t.level2_size << t.q) * sizeof (uint32_t); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7380 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7381 for (i = 0; i < 5; i++) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7382 fprintf (stream, "#define mapping_header_%d %d\n", i, |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7383 ((uint32_t *) t.result)[i]); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7384 fprintf (stream, "static const\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7385 fprintf (stream, "struct\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7386 fprintf (stream, " {\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7387 fprintf (stream, " int level1[%zu];\n", t.level1_size); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7388 fprintf (stream, " short level2[%zu << %d];\n", t.level2_size, t.q); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7389 fprintf (stream, " int level3[%zu << %d];\n", t.level3_size, t.p); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7390 fprintf (stream, " }\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7391 fprintf (stream, "u_mapping =\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7392 fprintf (stream, "{\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7393 fprintf (stream, " {"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7394 if (t.level1_size > 8) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7395 fprintf (stream, "\n "); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7396 for (i = 0; i < t.level1_size; i++) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7397 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7398 uint32_t offset; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7399 if (i > 0 && (i % 8) == 0) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7400 fprintf (stream, "\n "); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7401 offset = ((uint32_t *) (t.result + level1_offset))[i]; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7402 if (offset == 0) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7403 fprintf (stream, " %5d", -1); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7404 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
7405 fprintf (stream, " %5zu", |
11141
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7406 (offset - level2_offset) / sizeof (uint32_t)); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7407 if (i+1 < t.level1_size) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7408 fprintf (stream, ","); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7409 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7410 if (t.level1_size > 8) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7411 fprintf (stream, "\n "); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7412 fprintf (stream, " },\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7413 fprintf (stream, " {"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7414 if (t.level2_size << t.q > 8) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7415 fprintf (stream, "\n "); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7416 for (i = 0; i < t.level2_size << t.q; i++) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7417 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7418 uint32_t offset; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7419 if (i > 0 && (i % 8) == 0) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7420 fprintf (stream, "\n "); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7421 offset = ((uint32_t *) (t.result + level2_offset))[i]; |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7422 if (offset == 0) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7423 fprintf (stream, " %5d", -1); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7424 else |
11166
66432f187008
Fix 2009-02-07 commit of format strings.
Bruno Haible <bruno@clisp.org>
parents:
11141
diff
changeset
|
7425 fprintf (stream, " %5zu", |
11141
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7426 (offset - level3_offset) / sizeof (int32_t)); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7427 if (i+1 < t.level2_size << t.q) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7428 fprintf (stream, ","); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7429 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7430 if (t.level2_size << t.q > 8) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7431 fprintf (stream, "\n "); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7432 fprintf (stream, " },\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7433 fprintf (stream, " {"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7434 if (t.level3_size << t.p > 8) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7435 fprintf (stream, "\n "); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7436 for (i = 0; i < t.level3_size << t.p; i++) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7437 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7438 if (i > 0 && (i % 8) == 0) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7439 fprintf (stream, "\n "); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7440 fprintf (stream, " %5d", ((int32_t *) (t.result + level3_offset))[i]); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7441 if (i+1 < t.level3_size << t.p) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7442 fprintf (stream, ","); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7443 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7444 if (t.level3_size << t.p > 8) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7445 fprintf (stream, "\n "); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7446 fprintf (stream, " }\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7447 fprintf (stream, "};\n"); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7448 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7449 if (ferror (stream) || fclose (stream)) |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7450 { |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7451 fprintf (stderr, "error writing to '%s'\n", filename); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7452 exit (1); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7453 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7454 } |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7455 |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7456 /* ========================================================================= */ |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
7457 |
11303
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7458 /* A special casing context. |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7459 A context is negated through x -> -x. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7460 enum |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7461 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7462 SCC_ALWAYS = 0, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7463 SCC_FINAL_SIGMA, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7464 SCC_AFTER_SOFT_DOTTED, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7465 SCC_MORE_ABOVE, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7466 SCC_BEFORE_DOT, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7467 SCC_AFTER_I |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7468 }; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7469 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7470 /* A special casing rule. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7471 struct special_casing_rule |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7472 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7473 unsigned int code; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7474 unsigned int lower_mapping[3]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7475 unsigned int title_mapping[3]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7476 unsigned int upper_mapping[3]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7477 unsigned int casefold_mapping[3]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7478 const char *language; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7479 int context; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7480 }; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7481 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7482 /* The special casing rules. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7483 struct special_casing_rule **casing_rules; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7484 unsigned int num_casing_rules; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7485 unsigned int allocated_casing_rules; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7486 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7487 static void |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7488 add_casing_rule (struct special_casing_rule *new_rule) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7489 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7490 if (num_casing_rules == allocated_casing_rules) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7491 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7492 allocated_casing_rules = 2 * allocated_casing_rules; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7493 if (allocated_casing_rules < 16) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7494 allocated_casing_rules = 16; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7495 casing_rules = |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7496 (struct special_casing_rule **) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7497 realloc (casing_rules, allocated_casing_rules * sizeof (struct special_casing_rule *)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7498 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7499 casing_rules[num_casing_rules++] = new_rule; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7500 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7501 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7502 /* Stores in casing_rules the special casing rules found in |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7503 specialcasing_filename. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7504 static void |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7505 fill_casing_rules (const char *specialcasing_filename) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7506 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7507 FILE *stream; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7508 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7509 stream = fopen (specialcasing_filename, "r"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7510 if (stream == NULL) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7511 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7512 fprintf (stderr, "error during fopen of '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7513 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7514 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7515 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7516 casing_rules = NULL; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7517 num_casing_rules = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7518 allocated_casing_rules = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7519 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7520 for (;;) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7521 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7522 char buf[200+1]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7523 char *scanptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7524 char *endptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7525 int i; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7526 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7527 unsigned int code; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7528 unsigned int lower_mapping[3]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7529 unsigned int title_mapping[3]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7530 unsigned int upper_mapping[3]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7531 char *language; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7532 int context; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7533 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7534 if (fscanf (stream, "%200[^\n]\n", buf) < 1) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7535 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7536 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7537 if (buf[0] == '\0' || buf[0] == '#') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7538 continue; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7539 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7540 /* Scan code. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7541 scanptr = buf; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7542 code = strtoul (scanptr, &endptr, 16); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7543 if (endptr == scanptr) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7544 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7545 fprintf (stderr, "parse error in '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7546 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7547 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7548 scanptr = endptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7549 if (*scanptr != ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7550 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7551 fprintf (stderr, "parse error in '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7552 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7553 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7554 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7555 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7556 /* Scan lower mapping. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7557 for (i = 0; i < 3; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7558 lower_mapping[i] = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7559 for (i = 0; i < 3; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7560 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7561 while (*scanptr == ' ') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7562 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7563 if (*scanptr == ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7564 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7565 lower_mapping[i] = strtoul (scanptr, &endptr, 16); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7566 if (endptr == scanptr) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7567 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7568 fprintf (stderr, "parse error in '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7569 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7570 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7571 scanptr = endptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7572 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7573 if (*scanptr != ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7574 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7575 fprintf (stderr, "parse error in '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7576 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7577 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7578 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7579 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7580 /* Scan title mapping. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7581 for (i = 0; i < 3; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7582 title_mapping[i] = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7583 for (i = 0; i < 3; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7584 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7585 while (*scanptr == ' ') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7586 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7587 if (*scanptr == ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7588 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7589 title_mapping[i] = strtoul (scanptr, &endptr, 16); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7590 if (endptr == scanptr) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7591 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7592 fprintf (stderr, "parse error in '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7593 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7594 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7595 scanptr = endptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7596 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7597 if (*scanptr != ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7598 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7599 fprintf (stderr, "parse error in '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7600 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7601 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7602 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7603 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7604 /* Scan upper mapping. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7605 for (i = 0; i < 3; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7606 upper_mapping[i] = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7607 for (i = 0; i < 3; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7608 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7609 while (*scanptr == ' ') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7610 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7611 if (*scanptr == ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7612 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7613 upper_mapping[i] = strtoul (scanptr, &endptr, 16); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7614 if (endptr == scanptr) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7615 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7616 fprintf (stderr, "parse error in '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7617 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7618 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7619 scanptr = endptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7620 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7621 if (*scanptr != ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7622 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7623 fprintf (stderr, "parse error in '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7624 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7625 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7626 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7627 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7628 /* Scan language and context. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7629 language = NULL; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7630 context = SCC_ALWAYS; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7631 while (*scanptr == ' ') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7632 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7633 if (*scanptr != '\0' && *scanptr != '#') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7634 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7635 const char *word_begin = scanptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7636 const char *word_end; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7637 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7638 while (*scanptr != '\0' && *scanptr != '#' && *scanptr != ';' && *scanptr != ' ') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7639 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7640 word_end = scanptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7641 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7642 while (*scanptr == ' ') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7643 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7644 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7645 if (word_end - word_begin == 2) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7646 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7647 language = (char *) malloc ((word_end - word_begin) + 1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7648 memcpy (language, word_begin, 2); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7649 language[word_end - word_begin] = '\0'; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7650 word_begin = word_end = NULL; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7651 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7652 if (*scanptr != '\0' && *scanptr != '#' && *scanptr != ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7653 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7654 word_begin = scanptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7655 while (*scanptr != '\0' && *scanptr != '#' && *scanptr != ';' && *scanptr != ' ') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7656 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7657 word_end = scanptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7658 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7659 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7660 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7661 if (word_end > word_begin) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7662 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7663 bool negate = false; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7664 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7665 if (word_end - word_begin >= 4 && memcmp (word_begin, "Not_", 4) == 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7666 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7667 word_begin += 4; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7668 negate = true; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7669 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7670 if (word_end - word_begin == 11 && memcmp (word_begin, "Final_Sigma", 11) == 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7671 context = SCC_FINAL_SIGMA; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7672 else if (word_end - word_begin == 17 && memcmp (word_begin, "After_Soft_Dotted", 17) == 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7673 context = SCC_AFTER_SOFT_DOTTED; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7674 else if (word_end - word_begin == 10 && memcmp (word_begin, "More_Above", 10) == 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7675 context = SCC_MORE_ABOVE; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7676 else if (word_end - word_begin == 10 && memcmp (word_begin, "Before_Dot", 10) == 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7677 context = SCC_BEFORE_DOT; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7678 else if (word_end - word_begin == 7 && memcmp (word_begin, "After_I", 7) == 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7679 context = SCC_AFTER_I; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7680 else |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7681 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7682 fprintf (stderr, "unknown context type in '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7683 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7684 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7685 if (negate) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7686 context = - context; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7687 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7688 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7689 if (*scanptr != '\0' && *scanptr != '#' && *scanptr != ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7690 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7691 fprintf (stderr, "parse error in '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7692 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7693 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7694 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7695 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7696 /* Store the rule. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7697 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7698 struct special_casing_rule *new_rule = |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7699 (struct special_casing_rule *) malloc (sizeof (struct special_casing_rule)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7700 new_rule->code = code; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7701 new_rule->language = language; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7702 new_rule->context = context; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7703 memcpy (new_rule->lower_mapping, lower_mapping, sizeof (new_rule->lower_mapping)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7704 memcpy (new_rule->title_mapping, title_mapping, sizeof (new_rule->title_mapping)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7705 memcpy (new_rule->upper_mapping, upper_mapping, sizeof (new_rule->upper_mapping)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7706 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7707 add_casing_rule (new_rule); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7708 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7709 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7710 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7711 if (ferror (stream) || fclose (stream)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7712 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7713 fprintf (stderr, "error reading from '%s'\n", specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7714 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7715 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7716 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7717 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7718 /* A casefolding rule. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7719 struct casefold_rule |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7720 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7721 unsigned int code; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7722 unsigned int mapping[3]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7723 const char *language; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7724 }; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7725 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7726 /* The casefolding rules. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7727 struct casefold_rule **casefolding_rules; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7728 unsigned int num_casefolding_rules; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7729 unsigned int allocated_casefolding_rules; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7730 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7731 /* Stores in casefolding_rules the case folding rules found in |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7732 casefolding_filename. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7733 static void |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7734 fill_casefolding_rules (const char *casefolding_filename) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7735 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7736 FILE *stream; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7737 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7738 stream = fopen (casefolding_filename, "r"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7739 if (stream == NULL) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7740 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7741 fprintf (stderr, "error during fopen of '%s'\n", casefolding_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7742 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7743 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7744 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7745 casefolding_rules = NULL; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7746 num_casefolding_rules = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7747 allocated_casefolding_rules = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7748 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7749 for (;;) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7750 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7751 char buf[200+1]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7752 char *scanptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7753 char *endptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7754 int i; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7755 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7756 unsigned int code; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7757 char type; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7758 unsigned int mapping[3]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7759 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7760 if (fscanf (stream, "%200[^\n]\n", buf) < 1) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7761 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7762 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7763 if (buf[0] == '\0' || buf[0] == '#') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7764 continue; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7765 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7766 /* Scan code. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7767 scanptr = buf; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7768 code = strtoul (scanptr, &endptr, 16); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7769 if (endptr == scanptr) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7770 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7771 fprintf (stderr, "parse error in '%s'\n", casefolding_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7772 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7773 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7774 scanptr = endptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7775 if (*scanptr != ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7776 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7777 fprintf (stderr, "parse error in '%s'\n", casefolding_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7778 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7779 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7780 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7781 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7782 /* Scan type. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7783 while (*scanptr == ' ') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7784 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7785 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7786 switch (*scanptr) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7787 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7788 case 'C': case 'F': case 'S': case 'T': |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7789 type = *scanptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7790 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7791 default: |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7792 fprintf (stderr, "parse error in '%s'\n", casefolding_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7793 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7794 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7795 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7796 if (*scanptr != ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7797 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7798 fprintf (stderr, "parse error in '%s'\n", casefolding_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7799 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7800 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7801 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7802 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7803 /* Scan casefold mapping. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7804 for (i = 0; i < 3; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7805 mapping[i] = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7806 for (i = 0; i < 3; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7807 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7808 while (*scanptr == ' ') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7809 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7810 if (*scanptr == ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7811 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7812 mapping[i] = strtoul (scanptr, &endptr, 16); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7813 if (endptr == scanptr) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7814 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7815 fprintf (stderr, "parse error in '%s'\n", casefolding_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7816 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7817 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7818 scanptr = endptr; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7819 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7820 if (*scanptr != ';') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7821 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7822 fprintf (stderr, "parse error in '%s'\n", casefolding_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7823 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7824 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7825 scanptr++; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7826 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7827 /* Ignore rules of type 'S'; we use the rules of type 'F' instead. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7828 if (type != 'S') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7829 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7830 const char * const *languages; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7831 unsigned int languages_count; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7832 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7833 /* Type 'T' indicates that the rule is applicable to Turkish |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7834 languages only. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7835 if (type == 'T') |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7836 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7837 static const char * const turkish_languages[] = { "tr", "az" }; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7838 languages = turkish_languages; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7839 languages_count = 2; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7840 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7841 else |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7842 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7843 static const char * const all_languages[] = { NULL }; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7844 languages = all_languages; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7845 languages_count = 1; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7846 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7847 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7848 for (i = 0; i < languages_count; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7849 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7850 /* Store a new rule. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7851 struct casefold_rule *new_rule = |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7852 (struct casefold_rule *) malloc (sizeof (struct casefold_rule)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7853 new_rule->code = code; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7854 memcpy (new_rule->mapping, mapping, sizeof (new_rule->mapping)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7855 new_rule->language = languages[i]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7856 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7857 if (num_casefolding_rules == allocated_casefolding_rules) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7858 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7859 allocated_casefolding_rules = 2 * allocated_casefolding_rules; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7860 if (allocated_casefolding_rules < 16) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7861 allocated_casefolding_rules = 16; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7862 casefolding_rules = |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7863 (struct casefold_rule **) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7864 realloc (casefolding_rules, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7865 allocated_casefolding_rules * sizeof (struct casefold_rule *)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7866 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7867 casefolding_rules[num_casefolding_rules++] = new_rule; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7868 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7869 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7870 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7871 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7872 if (ferror (stream) || fclose (stream)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7873 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7874 fprintf (stderr, "error reading from '%s'\n", casefolding_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7875 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7876 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7877 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7878 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7879 /* Casefold mapping, when it maps to a single character. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7880 unsigned int unicode_casefold[0x110000]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7881 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7882 static unsigned int |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7883 to_casefold (unsigned int ch) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7884 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7885 return unicode_casefold[ch]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7886 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7887 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7888 /* Redistribute the casefolding_rules: |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7889 - Rules that map to a single character, language independently, are stored |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7890 in unicode_casefold. |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7891 - Other rules are merged into casing_rules. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7892 static void |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7893 redistribute_casefolding_rules (void) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7894 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7895 unsigned int ch, i, j; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7896 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7897 /* Fill unicode_casefold[]. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7898 for (ch = 0; ch < 0x110000; ch++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7899 unicode_casefold[ch] = ch; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7900 for (i = 0; i < num_casefolding_rules; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7901 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7902 struct casefold_rule *cfrule = casefolding_rules[i]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7903 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7904 if (cfrule->language == NULL && cfrule->mapping[1] == 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7905 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7906 ch = cfrule->code; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7907 if (!(ch < 0x110000)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7908 abort (); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7909 unicode_casefold[ch] = cfrule->mapping[0]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7910 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7911 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7912 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7913 /* Extend the special casing rules by filling in their casefold_mapping[] |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7914 field. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7915 for (j = 0; j < num_casing_rules; j++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7916 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7917 struct special_casing_rule *rule = casing_rules[j]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7918 unsigned int k; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7919 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7920 rule->casefold_mapping[0] = to_casefold (rule->code); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7921 for (k = 1; k < 3; k++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7922 rule->casefold_mapping[k] = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7923 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7924 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7925 /* Now merge the other casefolding rules into casing_rules. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7926 for (i = 0; i < num_casefolding_rules; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7927 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7928 struct casefold_rule *cfrule = casefolding_rules[i]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7929 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7930 if (!(cfrule->language == NULL && cfrule->mapping[1] == 0)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7931 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7932 /* Find a rule that applies to the same code, same language, and it |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7933 has context SCC_ALWAYS. At the same time, update all rules that |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7934 have the same code and same or more specific language. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7935 struct special_casing_rule *found_rule = NULL; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7936 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7937 for (j = 0; j < num_casing_rules; j++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7938 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7939 struct special_casing_rule *rule = casing_rules[j]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7940 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7941 if (rule->code == cfrule->code |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7942 && (cfrule->language == NULL |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7943 || (rule->language != NULL |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7944 && strcmp (rule->language, cfrule->language) == 0))) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7945 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7946 memcpy (rule->casefold_mapping, cfrule->mapping, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7947 sizeof (rule->casefold_mapping)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7948 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7949 if ((cfrule->language == NULL |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7950 ? rule->language == NULL |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7951 : rule->language != NULL |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7952 && strcmp (rule->language, cfrule->language) == 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7953 && rule->context == SCC_ALWAYS) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7954 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7955 /* Found it. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7956 found_rule = rule; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7957 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7958 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7959 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7960 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7961 if (found_rule == NULL) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7962 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7963 /* Create a new rule. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7964 struct special_casing_rule *new_rule = |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7965 (struct special_casing_rule *) malloc (sizeof (struct special_casing_rule)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7966 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7967 /* Try to find a rule that applies to the same code, no language |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7968 restriction, and with context SCC_ALWAYS. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7969 for (j = 0; j < num_casing_rules; j++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7970 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7971 struct special_casing_rule *rule = casing_rules[j]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7972 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7973 if (rule->code == cfrule->code |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7974 && rule->context == SCC_ALWAYS |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7975 && rule->language == NULL) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7976 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7977 /* Found it. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7978 found_rule = rule; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7979 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7980 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7981 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7982 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7983 new_rule->code = cfrule->code; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7984 new_rule->language = cfrule->language; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7985 new_rule->context = SCC_ALWAYS; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7986 if (found_rule != NULL) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7987 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7988 memcpy (new_rule->lower_mapping, found_rule->lower_mapping, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7989 sizeof (new_rule->lower_mapping)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7990 memcpy (new_rule->title_mapping, found_rule->title_mapping, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7991 sizeof (new_rule->title_mapping)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7992 memcpy (new_rule->upper_mapping, found_rule->upper_mapping, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7993 sizeof (new_rule->upper_mapping)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7994 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7995 else |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7996 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7997 unsigned int k; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7998 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
7999 new_rule->lower_mapping[0] = to_lower (cfrule->code); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8000 for (k = 1; k < 3; k++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8001 new_rule->lower_mapping[k] = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8002 new_rule->title_mapping[0] = to_title (cfrule->code); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8003 for (k = 1; k < 3; k++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8004 new_rule->title_mapping[k] = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8005 new_rule->upper_mapping[0] = to_upper (cfrule->code); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8006 for (k = 1; k < 3; k++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8007 new_rule->upper_mapping[k] = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8008 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8009 memcpy (new_rule->casefold_mapping, cfrule->mapping, |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8010 sizeof (new_rule->casefold_mapping)); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8011 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8012 add_casing_rule (new_rule); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8013 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8014 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8015 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8016 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8017 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8018 static int |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8019 compare_casing_rules (const void *a, const void *b) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8020 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8021 struct special_casing_rule *a_rule = *(struct special_casing_rule **) a; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8022 struct special_casing_rule *b_rule = *(struct special_casing_rule **) b; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8023 unsigned int a_code = a_rule->code; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8024 unsigned int b_code = b_rule->code; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8025 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8026 if (a_code < b_code) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8027 return -1; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8028 if (a_code > b_code) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8029 return 1; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8030 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8031 /* Sort the more specific rules before the more general ones. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8032 return (- ((a_rule->language != NULL ? 1 : 0) + (a_rule->context != SCC_ALWAYS ? 1 : 0)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8033 + ((b_rule->language != NULL ? 1 : 0) + (b_rule->context != SCC_ALWAYS ? 1 : 0))); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8034 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8035 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8036 static void |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8037 sort_casing_rules (void) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8038 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8039 /* Sort the rules 1. by code, 2. by specificity. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8040 if (num_casing_rules > 1) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8041 qsort (casing_rules, num_casing_rules, sizeof (struct special_casing_rule *), |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8042 compare_casing_rules); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8043 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8044 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8045 /* Output the special casing rules. */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8046 static void |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8047 output_casing_rules (const char *filename, const char *version) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8048 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8049 FILE *stream; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8050 unsigned int i, j; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8051 unsigned int minor; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8052 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8053 stream = fopen (filename, "w"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8054 if (stream == NULL) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8055 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8056 fprintf (stderr, "cannot open '%s' for writing\n", filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8057 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8058 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8059 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8060 fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8061 fprintf (stream, "/* Special casing rules of Unicode characters. */\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8062 fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s. */\n", |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8063 version); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8064 fprintf (stream, "struct special_casing_rule { char code[3]; };\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8065 fprintf (stream, "%%struct-type\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8066 fprintf (stream, "%%language=ANSI-C\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8067 fprintf (stream, "%%define slot-name code\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8068 fprintf (stream, "%%define hash-function-name gl_unicase_special_hash\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8069 fprintf (stream, "%%define lookup-function-name gl_unicase_special_lookup\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8070 fprintf (stream, "%%compare-lengths\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8071 fprintf (stream, "%%compare-strncmp\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8072 fprintf (stream, "%%readonly-tables\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8073 fprintf (stream, "%%omit-struct-type\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8074 fprintf (stream, "%%%%\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8075 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8076 minor = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8077 for (i = 0; i < num_casing_rules; i++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8078 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8079 struct special_casing_rule *rule = casing_rules[i]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8080 int context; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8081 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8082 if (i > 0 && rule->code == casing_rules[i - 1]->code) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8083 minor += 1; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8084 else |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8085 minor = 0; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8086 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8087 if (!(rule->code < 0x10000)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8088 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8089 fprintf (stderr, "special rule #%u: code %u out of range\n", i, rule->code); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8090 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8091 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8092 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8093 fprintf (stream, "\"\\x%02x\\x%02x\\x%02x\", ", |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8094 (rule->code >> 8) & 0xff, rule->code & 0xff, minor); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8095 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8096 fprintf (stream, "%d, ", |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8097 i + 1 < num_casing_rules && casing_rules[i + 1]->code == rule->code ? 1 : 0); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8098 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8099 context = rule->context; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8100 if (context < 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8101 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8102 fprintf (stream, "-"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8103 context = - context; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8104 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8105 else |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8106 fprintf (stream, " "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8107 switch (context) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8108 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8109 case SCC_ALWAYS: |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8110 fprintf (stream, "SCC_ALWAYS "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8111 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8112 case SCC_FINAL_SIGMA: |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8113 fprintf (stream, "SCC_FINAL_SIGMA "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8114 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8115 case SCC_AFTER_SOFT_DOTTED: |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8116 fprintf (stream, "SCC_AFTER_SOFT_DOTTED"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8117 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8118 case SCC_MORE_ABOVE: |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8119 fprintf (stream, "SCC_MORE_ABOVE "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8120 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8121 case SCC_BEFORE_DOT: |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8122 fprintf (stream, "SCC_BEFORE_DOT "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8123 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8124 case SCC_AFTER_I: |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8125 fprintf (stream, "SCC_AFTER_I "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8126 break; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8127 default: |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8128 abort (); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8129 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8130 fprintf (stream, ", "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8131 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8132 if (rule->language != NULL) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8133 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8134 if (strlen (rule->language) != 2) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8135 abort (); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8136 fprintf (stream, "{ '%c', '%c' }, ", rule->language[0], rule->language[1]); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8137 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8138 else |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8139 fprintf (stream, "{ '\\0', '\\0' }, "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8140 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8141 fprintf (stream, "{ "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8142 for (j = 0; j < 3; j++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8143 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8144 if (j > 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8145 fprintf (stream, ", "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8146 if (!(rule->upper_mapping[j] < 0x10000)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8147 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8148 fprintf (stderr, "special rule #%u: upper mapping of code %u out of range\n", i, rule->code); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8149 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8150 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8151 if (rule->upper_mapping[j] != 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8152 fprintf (stream, "0x%04X", rule->upper_mapping[j]); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8153 else |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8154 fprintf (stream, " 0"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8155 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8156 fprintf (stream, " }, { "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8157 for (j = 0; j < 3; j++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8158 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8159 if (j > 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8160 fprintf (stream, ", "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8161 if (!(rule->lower_mapping[j] < 0x10000)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8162 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8163 fprintf (stderr, "special rule #%u: lower mapping of code %u out of range\n", i, rule->code); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8164 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8165 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8166 if (rule->lower_mapping[j] != 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8167 fprintf (stream, "0x%04X", rule->lower_mapping[j]); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8168 else |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8169 fprintf (stream, " 0"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8170 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8171 fprintf (stream, " }, { "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8172 for (j = 0; j < 3; j++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8173 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8174 if (j > 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8175 fprintf (stream, ", "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8176 if (!(rule->title_mapping[j] < 0x10000)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8177 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8178 fprintf (stderr, "special rule #%u: title mapping of code %u out of range\n", i, rule->code); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8179 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8180 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8181 if (rule->title_mapping[j] != 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8182 fprintf (stream, "0x%04X", rule->title_mapping[j]); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8183 else |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8184 fprintf (stream, " 0"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8185 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8186 fprintf (stream, " }, { "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8187 for (j = 0; j < 3; j++) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8188 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8189 if (j > 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8190 fprintf (stream, ", "); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8191 if (!(rule->casefold_mapping[j] < 0x10000)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8192 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8193 fprintf (stderr, "special rule #%u: casefold mapping of code %u out of range\n", i, rule->code); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8194 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8195 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8196 if (rule->casefold_mapping[j] != 0) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8197 fprintf (stream, "0x%04X", rule->casefold_mapping[j]); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8198 else |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8199 fprintf (stream, " 0"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8200 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8201 fprintf (stream, " }\n"); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8202 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8203 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8204 if (ferror (stream) || fclose (stream)) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8205 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8206 fprintf (stderr, "error writing to '%s'\n", filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8207 exit (1); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8208 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8209 } |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8210 |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8211 /* ========================================================================= */ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8212 |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8213 int |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8214 main (int argc, char * argv[]) |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8215 { |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8216 const char *unicodedata_filename; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8217 const char *proplist_filename; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8218 const char *derivedproplist_filename; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8219 const char *scripts_filename; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8220 const char *blocks_filename; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8221 const char *proplist30_filename; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8222 const char *eastasianwidth_filename; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8223 const char *linebreak_filename; |
11132
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
8224 const char *wordbreakproperty_filename; |
11176
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
8225 const char *compositionexclusions_filename; |
11303
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8226 const char *specialcasing_filename; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8227 const char *casefolding_filename; |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8228 const char *version; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8229 |
11303
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8230 if (argc != 14) |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8231 { |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8232 fprintf (stderr, "Usage: %s UnicodeData.txt PropList.txt DerivedCoreProperties.txt Scripts.txt Blocks.txt PropList-3.0.1.txt EastAsianWidth.txt LineBreak.txt WordBreakProperty.txt CompositionExclusions.txt SpecialCasing.txt CaseFolding.txt version\n", |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8233 argv[0]); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8234 exit (1); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8235 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8236 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8237 unicodedata_filename = argv[1]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8238 proplist_filename = argv[2]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8239 derivedproplist_filename = argv[3]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8240 scripts_filename = argv[4]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8241 blocks_filename = argv[5]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8242 proplist30_filename = argv[6]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8243 eastasianwidth_filename = argv[7]; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8244 linebreak_filename = argv[8]; |
11132
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
8245 wordbreakproperty_filename = argv[9]; |
11176
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
8246 compositionexclusions_filename = argv[10]; |
11303
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8247 specialcasing_filename = argv[11]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8248 casefolding_filename = argv[12]; |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8249 version = argv[13]; |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8250 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8251 fill_attributes (unicodedata_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8252 clear_properties (); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8253 fill_properties (proplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8254 fill_properties (derivedproplist_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8255 fill_properties30 (proplist30_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8256 fill_scripts (scripts_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8257 fill_blocks (blocks_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8258 fill_width (eastasianwidth_filename); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8259 fill_org_lbp (linebreak_filename); |
11132
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
8260 fill_org_wbp (wordbreakproperty_filename); |
11176
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
8261 fill_composition_exclusions (compositionexclusions_filename); |
11303
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8262 fill_casing_rules (specialcasing_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8263 fill_casefolding_rules (casefolding_filename); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8264 redistribute_casefolding_rules (); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8265 sort_casing_rules (); |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8266 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8267 output_categories (version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8268 output_category ("unictype/categ_of.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8269 output_combclass ("unictype/combining.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8270 output_bidi_category ("unictype/bidi_of.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8271 output_decimal_digit_test ("../tests/unictype/test-decdigit.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8272 output_decimal_digit ("unictype/decdigit.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8273 output_digit_test ("../tests/unictype/test-digit.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8274 output_digit ("unictype/digit.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8275 output_numeric_test ("../tests/unictype/test-numeric.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8276 output_numeric ("unictype/numeric.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8277 output_mirror ("unictype/mirror.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8278 output_properties (version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8279 output_scripts (version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8280 output_scripts_byname (version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8281 output_blocks (version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8282 output_ident_properties (version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8283 output_old_ctype (version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8284 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8285 debug_output_lbrk_tables ("unilbrk/lbrkprop.txt"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8286 debug_output_org_lbrk_tables ("unilbrk/lbrkprop_org.txt"); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8287 output_lbrk_tables ("unilbrk/lbrkprop1.h", "unilbrk/lbrkprop2.h", version); |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8288 |
11132
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
8289 debug_output_wbrk_tables ("uniwbrk/wbrkprop.txt"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
8290 debug_output_org_wbrk_tables ("uniwbrk/wbrkprop_org.txt"); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
8291 output_wbrk_tables ("uniwbrk/wbrkprop.h", version); |
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
8292 |
11176
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
8293 output_decomposition_tables ("uninorm/decomposition-table1.h", "uninorm/decomposition-table2.h", version); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
8294 debug_output_composition_tables ("uninorm/composition.txt"); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
8295 output_composition_tables ("uninorm/composition-table.gperf", version); |
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
8296 |
11141
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
8297 output_simple_mapping_test ("../tests/unicase/test-uc_toupper.c", "uc_toupper", to_upper, version); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
8298 output_simple_mapping_test ("../tests/unicase/test-uc_tolower.c", "uc_tolower", to_lower, version); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
8299 output_simple_mapping_test ("../tests/unicase/test-uc_totitle.c", "uc_totitle", to_title, version); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
8300 output_simple_mapping ("unicase/toupper.h", to_upper, version); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
8301 output_simple_mapping ("unicase/tolower.h", to_lower, version); |
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
8302 output_simple_mapping ("unicase/totitle.h", to_title, version); |
11303
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8303 output_simple_mapping ("unicase/tocasefold.h", to_casefold, version); |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8304 output_casing_rules ("unicase/special-casing-table.gperf", version); |
11141
a1028ec4039e
Generate also simple case mapping tables.
Bruno Haible <bruno@clisp.org>
parents:
11132
diff
changeset
|
8305 |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8306 return 0; |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8307 } |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8308 |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8309 /* |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8310 * For Emacs M-x compile |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8311 * Local Variables: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8312 * compile-command: " |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8313 gcc -O -Wall gen-uni-tables.c -Iunictype -o gen-uni-tables && \ |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8314 ./gen-uni-tables \ |
11127 | 8315 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/UnicodeData.txt \ |
8316 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/PropList.txt \ | |
8317 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/DerivedCoreProperties.txt \ | |
8318 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/Scripts.txt \ | |
8319 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/Blocks.txt \ | |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8320 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/3.0.1/PropList-3.0.1.txt \ |
11127 | 8321 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/EastAsianWidth.txt \ |
8322 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/LineBreak.txt \ | |
11132
b21747aefd8a
Generate table with word break data.
Bruno Haible <bruno@clisp.org>
parents:
11129
diff
changeset
|
8323 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/auxiliary/WordBreakProperty.txt \ |
11176
439fd66b6abf
Emit decomposition and composition tables.
Bruno Haible <bruno@clisp.org>
parents:
11166
diff
changeset
|
8324 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/CompositionExclusions.txt \ |
11303
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8325 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/SpecialCasing.txt \ |
1688f282d648
Generate more tables for case conversion and case folding.
Bruno Haible <bruno@clisp.org>
parents:
11177
diff
changeset
|
8326 /gfs/petix/Volumes/ExtData/www-archive/software/i18n/unicode/ftp.unicode.org/ArchiveVersions/5.1.0/ucd/CaseFolding.txt \ |
11127 | 8327 5.1.0 |
11123
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8328 " |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8329 * End: |
5d788dc1f758
Merge gen-ctype and gen-lbrk into gen-uni-tables.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8330 */ |