Debian Codegraph @

modules/gcide/webchr.c

raw
1 /* This file is part of GNU Dico.
2 Copyright (C) 2012-2024 Sergey Poznyakoff
3
4 GNU Dico is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 GNU Dico is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with GNU Dico. If not, see <http://www.gnu.org/licenses/>. */
16
17 #include <config.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include "gcide.h"
21
22 char gcide_webchr[256][4] = {
23 /* 00 */ "",
24 /* 01 */ "",
25 /* 02 */ "",
26 /* 03 */ "",
27 /* 04 */ "",
28 /* 05 */ "",
29 /* 06 */ "",
30 /* 07 */ "",
31 /* 08 */ "",
32 /* 09 */ "",
33 /* 0a */ "",
34 /* 0b */ "",
35 /* 0c */ "",
36 /* 0d */ "",
37 /* 0e */ "",
38 /* 0f */ "",
39 /* 10 */ "",
40 /* 11 */ "",
41 /* 12 */ "",
42 /* 13 */ "",
43 /* 14 */ "",
44 /* 15 */ "",
45 /* 16 */ "",
46 /* 17 */ "",
47 /* 18 */ "",
48 /* 19 */ "",
49 /* 1a */ "",
50 /* 1b */ "",
51 /* 1c */ "",
52 /* 1d */ "",
53 /* 1e */ "",
54 /* 1f */ "",
55 /* 20 */ "",
56 /* 21 */ "",
57 /* 22 */ "",
58 /* 23 */ "",
59 /* 24 */ "",
60 /* 25 */ "",
61 /* 26 */ "",
62 /* 27 */ "",
63 /* 28 */ "",
64 /* 29 */ "",
65 /* 2a */ "",
66 /* 2b */ "",
67 /* 2c */ "",
68 /* 2d */ "",
69 /* 2e */ "",
70 /* 2f */ "",
71 /* 30 */ "",
72 /* 31 */ "",
73 /* 32 */ "",
74 /* 33 */ "",
75 /* 34 */ "",
76 /* 35 */ "",
77 /* 36 */ "",
78 /* 37 */ "",
79 /* 38 */ "",
80 /* 39 */ "",
81 /* 3a */ "",
82 /* 3b */ "",
83 /* 3c */ "<",
84 /* 3d */ "",
85 /* 3e */ ">",
86 /* 3f */ "",
87 /* 40 */ "",
88 /* 41 */ "",
89 /* 42 */ "",
90 /* 43 */ "",
91 /* 44 */ "",
92 /* 45 */ "",
93 /* 46 */ "",
94 /* 47 */ "",
95 /* 48 */ "",
96 /* 49 */ "",
97 /* 4a */ "",
98 /* 4b */ "",
99 /* 4c */ "",
100 /* 4d */ "",
101 /* 4e */ "",
102 /* 4f */ "",
103 /* 50 */ "",
104 /* 51 */ "",
105 /* 52 */ "",
106 /* 53 */ "",
107 /* 54 */ "",
108 /* 55 */ "",
109 /* 56 */ "",
110 /* 57 */ "",
111 /* 58 */ "",
112 /* 59 */ "",
113 /* 5a */ "",
114 /* 5b */ "",
115 /* 5c */ "",
116 /* 5d */ "",
117 /* 5e */ "",
118 /* 5f */ "",
119 /* 60 */ "",
120 /* 61 */ "",
121 /* 62 */ "",
122 /* 63 */ "",
123 /* 64 */ "",
124 /* 65 */ "",
125 /* 66 */ "",
126 /* 67 */ "",
127 /* 68 */ "",
128 /* 69 */ "",
129 /* 6a */ "",
130 /* 6b */ "",
131 /* 6c */ "",
132 /* 6d */ "",
133 /* 6e */ "",
134 /* 6f */ "",
135 /* 70 */ "",
136 /* 71 */ "",
137 /* 72 */ "",
138 /* 73 */ "",
139 /* 74 */ "",
140 /* 75 */ "",
141 /* 76 */ "",
142 /* 77 */ "",
143 /* 78 */ "",
144 /* 79 */ "",
145 /* 7a */ "",
146 /* 7b */ "",
147 /* 7c */ "",
148 /* 7d */ "",
149 /* 7e */ "",
150 /* 7f */ "",
151 /* 80 */ "Ç",
152 /* 81 */ "ü",
153 /* 82 */ "é",
154 /* 83 */ "â",
155 /* 84 */ "ä",
156 /* 85 */ "à",
157 /* 86 */ "å",
158 /* 87 */ "ç",
159 /* 88 */ "ê",
160 /* 89 */ "ë",
161 /* 8a */ "è",
162 /* 8b */ "ï",
163 /* 8c */ "î",
164 /* 8d */ "ì",
165 /* 8e */ "Ä",
166 /* 8f */ "Å",
167 /* 90 */ "È",
168 /* 91 */ "æ",
169 /* 92 */ "Æ",
170 /* 93 */ "ô",
171 /* 94 */ "ö",
172 /* 95 */ "ò",
173 /* 96 */ "û",
174 /* 97 */ "ù",
175 /* 98 */ "ÿ",
176 /* 99 */ "Ö",
177 /* 9a */ "Ü",
178 /* 9b */ "£",
179 /* 9c */ "",
180 /* 9d */ "",
181 /* 9e */ "",
182 /* 9f */ "",
183 /* a0 */ "á",
184 /* a1 */ "í",
185 /* a2 */ "ó",
186 /* a3 */ "ú",
187 /* a4 */ "ñ",
188 /* a5 */ "Ñ",
189 /* a6 */ "⅔",
190 /* a7 */ "⅓",
191 /* a8 */ "",
192 /* a9 */ "˝",
193 /* aa */ "",
194 /* ab */ "½",
195 /* ac */ "¼",
196 /* ad */ "",
197 /* ae */ "",
198 /* af */ "",
199 /* b0 */ "<?>", /* Place-holder for unknown or illegible character. */
200 /* b1 */ "",
201 /* b2 */ "",
202 /* b3 */ "",
203 /* b4 */ "↑",
204 /* b5 */ "☞", /* pointing hand (printer's "fist") */
205 /* b6 */ "˝", /* bold accent */
206 /* b7 */ "´", /* light accent */
207 /* b8 */ "”",
208 /* b9 */ "",
209 /* ba */ "‖",
210 /* bb */ "",
211 /* bc */ "§",
212 /* bd */ "“",
213 /* be */ "ā",
214 /* bf */ "‘",
215 /* c0 */ "ṉ", /* "n sub-macron" */
216 /* c1 */ "♯",
217 /* c2 */ "♭",
218 /* c3 */ "–",
219 /* c4 */ "―",
220 /* c5 */ "t", /* First part of th ligature */
221 /* c6 */ "ī",
222 /* c7 */ "ē",
223 /* c8 */ "ḍ", /* Sanskrit/Tamil d dot */
224 /* c9 */ "ṇ", /* Sanskrit/Tamil n dot */
225 /* ca */ "ṭ", /* Sanskrit/Tamil t dot */
226 /* cb */ "ĕ",
227 /* cc */ "ĭ",
228 /* cd */ "",
229 /* ce */ "ŏ",
230 /* cf */ "‐", /* short dash */
231 /* d0 */ "—",
232 /* d1 */ "Œ",
233 /* d2 */ "œ",
234 /* d3 */ "ō",
235 /* d4 */ "ū",
236 /* d5 */ "ǒ",
237 /* d6 */ "ǣ",
238 /* d7 */ "ōē", /* FIXME: oe ligature with macron */
239 /* d8 */ "‖",
240 /* d9 */ "",
241 /* da */ "",
242 /* db */ "",
243 /* dc */ "ŭ",
244 /* dd */ "ă",
245 /* de */ "˘", /* FIXME: crescent: 1F319? */
246 /* df */ "ȳ",
247 /* e0 */ "a", /* FIXME: a "semilong" (has a macron above with a short */
248 /* vertical bar on top the center of the macron) */
249 /* e1 */ "e", /* FIXME: e "semilong" */
250 /* e2 */ "i", /* FIXME: i "semilong" */
251 /* e3 */ "o", /* FIXME: o "semilong" */
252 /* e4 */ "u", /* FIXME: u "semilong" */
253 /* e5 */ "ȧ", /* a with dot above */
254 /* e6 */ "μ",
255 /* e7 */ "h", /* second part of th ligature */
256 /* e8 */ "",
257 /* e9 */ "",
258 /* ea */ "",
259 /* eb */ "ð",
260 /* ec */ "",
261 /* ed */ "þ",
262 /* ee */ "ã",
263 /* ef */ "ṅ",
264 /* f0 */ "ṛ",
265 /* f1 */ "",
266 /* f2 */ "",
267 /* f3 */ "",
268 /* f4 */ "ȝ",
269 /* f5 */ "—",
270 /* f6 */ "÷",
271 /* f7 */ "≈",
272 /* f8 */ "°",
273 /* f9 */ "•",
274 /* fa */ "·",
275 /* fb */ "√",
276 /* fc */ "",
277 /* fd */ "",
278 /* fe */ "",
279 /* ff */ "",
280 };
281
282 static char xdig[] = "0123456789abcdef";
283 #define xnum(c) (strchr(xdig, (c)) - xdig)
284
285 char const *
286 gcide_escape_to_utf8(const char *esc)
287 {
288 char const *s = gcide_webchr[xnum(esc[0]) * 16 + xnum(esc[1])];
289 return s[0] ? s : NULL;
290 }
291
292
293 /* Local Variables: */
294 /* mode: c */
295 /* eval: (setq buffer-file-coding-system (if window-system 'utf-8 'raw-text-unix)) */
296 /* End: */