Annotation of embedaddon/libiconv/lib/vietcomb.h, revision 1.1.1.3
1.1 misho 1: /*
1.1.1.2 misho 2: * Copyright (C) 2001, 2004, 2011 Free Software Foundation, Inc.
1.1 misho 3: * This file is part of the GNU LIBICONV Library.
4: *
5: * The GNU LIBICONV Library is free software; you can redistribute it
6: * and/or modify it under the terms of the GNU Library General Public
7: * License as published by the Free Software Foundation; either version 2
8: * of the License, or (at your option) any later version.
9: *
10: * The GNU LIBICONV Library is distributed in the hope that it will be
11: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Library General Public License for more details.
14: *
15: * You should have received a copy of the GNU Library General Public
16: * License along with the GNU LIBICONV Library; see the file COPYING.LIB.
1.1.1.3 ! misho 17: * If not, see <https://www.gnu.org/licenses/>.
1.1 misho 18: */
19:
20: /* Combining characters used in Vietnamese encodings CP1258, TCVN. */
21:
22: #ifndef _VIETCOMB_H
23: #define _VIETCOMB_H
24:
25: /* Relevant combining characters:
26: 0x0300, 0x0301, 0x0303, 0x0309, 0x0323. */
27:
28: /* Composition tables for each of the relevant combining characters. */
29: static const struct { unsigned short base; unsigned short composed; } viet_comp_table_data[] = {
30: #define viet_comp_table0300_idx 0
31: #define viet_comp_table0300_len 31
32: { 0x0041, 0x00C0 },
33: { 0x0045, 0x00C8 },
34: { 0x0049, 0x00CC },
35: { 0x004E, 0x01F8 },
36: { 0x004F, 0x00D2 },
37: { 0x0055, 0x00D9 },
38: { 0x0057, 0x1E80 },
39: { 0x0059, 0x1EF2 },
40: { 0x0061, 0x00E0 },
41: { 0x0065, 0x00E8 },
42: { 0x0069, 0x00EC },
43: { 0x006E, 0x01F9 },
44: { 0x006F, 0x00F2 },
45: { 0x0075, 0x00F9 },
46: { 0x0077, 0x1E81 },
47: { 0x0079, 0x1EF3 },
48: { 0x00A8, 0x1FED },
49: { 0x00C2, 0x1EA6 },
50: { 0x00CA, 0x1EC0 },
51: { 0x00D4, 0x1ED2 },
52: { 0x00DC, 0x01DB },
53: { 0x00E2, 0x1EA7 },
54: { 0x00EA, 0x1EC1 },
55: { 0x00F4, 0x1ED3 },
56: { 0x00FC, 0x01DC },
57: { 0x0102, 0x1EB0 },
58: { 0x0103, 0x1EB1 },
59: /*{ 0x0112, 0x1E14 },*/
60: /*{ 0x0113, 0x1E15 },*/
61: /*{ 0x014C, 0x1E50 },*/
62: /*{ 0x014D, 0x1E51 },*/
63: { 0x01A0, 0x1EDC },
64: { 0x01A1, 0x1EDD },
65: { 0x01AF, 0x1EEA },
66: { 0x01B0, 0x1EEB },
67: #define viet_comp_table0301_idx (viet_comp_table0300_idx+viet_comp_table0300_len)
1.1.1.2 misho 68: #define viet_comp_table0301_len 63
1.1 misho 69: { 0x0041, 0x00C1 },
70: { 0x0043, 0x0106 },
71: { 0x0045, 0x00C9 },
72: { 0x0047, 0x01F4 },
73: { 0x0049, 0x00CD },
74: { 0x004B, 0x1E30 },
75: { 0x004C, 0x0139 },
76: { 0x004D, 0x1E3E },
77: { 0x004E, 0x0143 },
78: { 0x004F, 0x00D3 },
79: { 0x0050, 0x1E54 },
80: { 0x0052, 0x0154 },
81: { 0x0053, 0x015A },
82: { 0x0055, 0x00DA },
83: { 0x0057, 0x1E82 },
84: { 0x0059, 0x00DD },
85: { 0x005A, 0x0179 },
86: { 0x0061, 0x00E1 },
87: { 0x0063, 0x0107 },
88: { 0x0065, 0x00E9 },
89: { 0x0067, 0x01F5 },
90: { 0x0069, 0x00ED },
91: { 0x006B, 0x1E31 },
92: { 0x006C, 0x013A },
93: { 0x006D, 0x1E3F },
94: { 0x006E, 0x0144 },
95: { 0x006F, 0x00F3 },
96: { 0x0070, 0x1E55 },
97: { 0x0072, 0x0155 },
98: { 0x0073, 0x015B },
99: { 0x0075, 0x00FA },
100: { 0x0077, 0x1E83 },
101: { 0x0079, 0x00FD },
102: { 0x007A, 0x017A },
1.1.1.2 misho 103: { 0x00A8, 0x0385 }, /* prefer U+0385 over U+1FEE */
1.1 misho 104: { 0x00C2, 0x1EA4 },
105: { 0x00C5, 0x01FA },
106: { 0x00C6, 0x01FC },
107: { 0x00C7, 0x1E08 },
108: { 0x00CA, 0x1EBE },
109: { 0x00CF, 0x1E2E },
110: { 0x00D4, 0x1ED0 },
111: { 0x00D5, 0x1E4C },
112: { 0x00D8, 0x01FE },
113: { 0x00DC, 0x01D7 },
114: { 0x00E2, 0x1EA5 },
115: { 0x00E5, 0x01FB },
116: { 0x00E6, 0x01FD },
117: { 0x00E7, 0x1E09 },
118: { 0x00EA, 0x1EBF },
119: { 0x00EF, 0x1E2F },
120: { 0x00F4, 0x1ED1 },
121: { 0x00F5, 0x1E4D },
122: { 0x00F8, 0x01FF },
123: { 0x00FC, 0x01D8 },
124: { 0x0102, 0x1EAE },
125: { 0x0103, 0x1EAF },
126: /*{ 0x0112, 0x1E16 },*/
127: /*{ 0x0113, 0x1E17 },*/
128: /*{ 0x014C, 0x1E52 },*/
129: /*{ 0x014D, 0x1E53 },*/
130: { 0x0168, 0x1E78 },
131: { 0x0169, 0x1E79 },
132: { 0x01A0, 0x1EDA },
133: { 0x01A1, 0x1EDB },
134: { 0x01AF, 0x1EE8 },
135: { 0x01B0, 0x1EE9 },
136: #define viet_comp_table0303_idx (viet_comp_table0301_idx+viet_comp_table0301_len)
137: #define viet_comp_table0303_len 34
138: { 0x0041, 0x00C3 },
139: { 0x0045, 0x1EBC },
140: { 0x0049, 0x0128 },
141: { 0x004E, 0x00D1 },
142: { 0x004F, 0x00D5 },
143: { 0x0055, 0x0168 },
144: { 0x0056, 0x1E7C },
145: { 0x0059, 0x1EF8 },
146: { 0x0061, 0x00E3 },
147: { 0x0065, 0x1EBD },
148: { 0x0069, 0x0129 },
149: { 0x006E, 0x00F1 },
150: { 0x006F, 0x00F5 },
151: { 0x0075, 0x0169 },
152: { 0x0076, 0x1E7D },
153: { 0x0079, 0x1EF9 },
154: { 0x00C2, 0x1EAA },
155: { 0x00CA, 0x1EC4 },
156: { 0x00D3, 0x1E4C },
157: { 0x00D4, 0x1ED6 },
158: { 0x00D6, 0x1E4E },
159: { 0x00DA, 0x1E78 },
160: { 0x00E2, 0x1EAB },
161: { 0x00EA, 0x1EC5 },
162: { 0x00F3, 0x1E4D },
163: { 0x00F4, 0x1ED7 },
164: { 0x00F6, 0x1E4F },
165: { 0x00FA, 0x1E79 },
166: { 0x0102, 0x1EB4 },
167: { 0x0103, 0x1EB5 },
168: { 0x01A0, 0x1EE0 },
169: { 0x01A1, 0x1EE1 },
170: { 0x01AF, 0x1EEE },
171: { 0x01B0, 0x1EEF },
172: #define viet_comp_table0309_idx (viet_comp_table0303_idx+viet_comp_table0303_len)
173: #define viet_comp_table0309_len 24
174: { 0x0041, 0x1EA2 },
175: { 0x0045, 0x1EBA },
176: { 0x0049, 0x1EC8 },
177: { 0x004F, 0x1ECE },
178: { 0x0055, 0x1EE6 },
179: { 0x0059, 0x1EF6 },
180: { 0x0061, 0x1EA3 },
181: { 0x0065, 0x1EBB },
182: { 0x0069, 0x1EC9 },
183: { 0x006F, 0x1ECF },
184: { 0x0075, 0x1EE7 },
185: { 0x0079, 0x1EF7 },
186: { 0x00C2, 0x1EA8 },
187: { 0x00CA, 0x1EC2 },
188: { 0x00D4, 0x1ED4 },
189: { 0x00E2, 0x1EA9 },
190: { 0x00EA, 0x1EC3 },
191: { 0x00F4, 0x1ED5 },
192: { 0x0102, 0x1EB2 },
193: { 0x0103, 0x1EB3 },
194: { 0x01A0, 0x1EDE },
195: { 0x01A1, 0x1EDF },
196: { 0x01AF, 0x1EEC },
197: { 0x01B0, 0x1EED },
198: #define viet_comp_table0323_idx (viet_comp_table0309_idx+viet_comp_table0309_len)
199: #define viet_comp_table0323_len 50
200: { 0x0041, 0x1EA0 },
201: { 0x0042, 0x1E04 },
202: { 0x0044, 0x1E0C },
203: { 0x0045, 0x1EB8 },
204: { 0x0048, 0x1E24 },
205: { 0x0049, 0x1ECA },
206: { 0x004B, 0x1E32 },
207: { 0x004C, 0x1E36 },
208: { 0x004D, 0x1E42 },
209: { 0x004E, 0x1E46 },
210: { 0x004F, 0x1ECC },
211: { 0x0052, 0x1E5A },
212: { 0x0053, 0x1E62 },
213: { 0x0054, 0x1E6C },
214: { 0x0055, 0x1EE4 },
215: { 0x0056, 0x1E7E },
216: { 0x0057, 0x1E88 },
217: { 0x0059, 0x1EF4 },
218: { 0x005A, 0x1E92 },
219: { 0x0061, 0x1EA1 },
220: { 0x0062, 0x1E05 },
221: { 0x0064, 0x1E0D },
222: { 0x0065, 0x1EB9 },
223: { 0x0068, 0x1E25 },
224: { 0x0069, 0x1ECB },
225: { 0x006B, 0x1E33 },
226: { 0x006C, 0x1E37 },
227: { 0x006D, 0x1E43 },
228: { 0x006E, 0x1E47 },
229: { 0x006F, 0x1ECD },
230: { 0x0072, 0x1E5B },
231: { 0x0073, 0x1E63 },
232: { 0x0074, 0x1E6D },
233: { 0x0075, 0x1EE5 },
234: { 0x0076, 0x1E7F },
235: { 0x0077, 0x1E89 },
236: { 0x0079, 0x1EF5 },
237: { 0x007A, 0x1E93 },
238: { 0x00C2, 0x1EAC },
239: { 0x00CA, 0x1EC6 },
240: { 0x00D4, 0x1ED8 },
241: { 0x00E2, 0x1EAD },
242: { 0x00EA, 0x1EC7 },
243: { 0x00F4, 0x1ED9 },
244: { 0x0102, 0x1EB6 },
245: { 0x0103, 0x1EB7 },
246: { 0x01A0, 0x1EE2 },
247: { 0x01A1, 0x1EE3 },
248: { 0x01AF, 0x1EF0 },
249: { 0x01B0, 0x1EF1 },
250: };
251: static const struct { unsigned int len; unsigned int idx; } viet_comp_table[] = {
252: { viet_comp_table0300_len, viet_comp_table0300_idx },
253: { viet_comp_table0301_len, viet_comp_table0301_idx },
254: { viet_comp_table0303_len, viet_comp_table0303_idx },
255: { viet_comp_table0309_len, viet_comp_table0309_idx },
256: { viet_comp_table0323_len, viet_comp_table0323_idx },
257: };
258:
259: /* Decomposition table for the relevant Unicode characters. */
260: struct viet_decomp { unsigned short composed; unsigned int base : 12; int comb1 : 4; };
261: static const struct viet_decomp viet_decomp_table[] = {
262: { 0x00B4, 0x0020, 1 }, /* compatibility decomposition - for TCVN only */
263: { 0x00C0, 0x0041, 0 },
264: { 0x00C1, 0x0041, 1 },
265: { 0x00C3, 0x0041, 2 },
266: { 0x00C8, 0x0045, 0 },
267: { 0x00C9, 0x0045, 1 },
268: { 0x00CC, 0x0049, 0 },
269: { 0x00CD, 0x0049, 1 },
270: { 0x00D1, 0x004E, 2 },
271: { 0x00D2, 0x004F, 0 },
272: { 0x00D3, 0x004F, 1 },
273: { 0x00D5, 0x004F, 2 },
274: { 0x00D9, 0x0055, 0 },
275: { 0x00DA, 0x0055, 1 },
276: { 0x00DD, 0x0059, 1 },
277: { 0x00E0, 0x0061, 0 },
278: { 0x00E1, 0x0061, 1 },
279: { 0x00E3, 0x0061, 2 },
280: { 0x00E8, 0x0065, 0 },
281: { 0x00E9, 0x0065, 1 },
282: { 0x00EC, 0x0069, 0 },
283: { 0x00ED, 0x0069, 1 },
284: { 0x00F1, 0x006E, 2 },
285: { 0x00F2, 0x006F, 0 },
286: { 0x00F3, 0x006F, 1 },
287: { 0x00F5, 0x006F, 2 },
288: { 0x00F9, 0x0075, 0 },
289: { 0x00FA, 0x0075, 1 },
290: { 0x00FD, 0x0079, 1 },
291: { 0x0106, 0x0043, 1 },
292: { 0x0107, 0x0063, 1 },
293: { 0x0128, 0x0049, 2 },
294: { 0x0129, 0x0069, 2 },
295: { 0x0139, 0x004C, 1 },
296: { 0x013A, 0x006C, 1 },
297: { 0x0143, 0x004E, 1 },
298: { 0x0144, 0x006E, 1 },
299: { 0x0154, 0x0052, 1 },
300: { 0x0155, 0x0072, 1 },
301: { 0x015A, 0x0053, 1 },
302: { 0x015B, 0x0073, 1 },
303: { 0x0168, 0x0055, 2 },
304: { 0x0169, 0x0075, 2 },
305: { 0x0179, 0x005A, 1 },
306: { 0x017A, 0x007A, 1 },
307: { 0x01D7, 0x00DC, 1 },
308: { 0x01D8, 0x00FC, 1 },
309: { 0x01DB, 0x00DC, 0 },
310: { 0x01DC, 0x00FC, 0 },
311: { 0x01F4, 0x0047, 1 },
312: { 0x01F5, 0x0067, 1 },
313: { 0x01F8, 0x004E, 0 },
314: { 0x01F9, 0x006E, 0 },
315: { 0x01FA, 0x00C5, 1 },
316: { 0x01FB, 0x00E5, 1 },
317: { 0x01FC, 0x00C6, 1 },
318: { 0x01FD, 0x00E6, 1 },
319: { 0x01FE, 0x00D8, 1 },
320: { 0x01FF, 0x00F8, 1 },
321: { 0x02DC, 0x0020, 2 }, /* compatibility decomposition - for TCVN only */
1.1.1.2 misho 322: { 0x0385, 0x00A8, 1 },
1.1 misho 323: { 0x1E04, 0x0042, 4 },
324: { 0x1E05, 0x0062, 4 },
325: { 0x1E08, 0x00C7, 1 },
326: { 0x1E09, 0x00E7, 1 },
327: { 0x1E0C, 0x0044, 4 },
328: { 0x1E0D, 0x0064, 4 },
329: { 0x1E24, 0x0048, 4 },
330: { 0x1E25, 0x0068, 4 },
331: { 0x1E2E, 0x00CF, 1 },
332: { 0x1E2F, 0x00EF, 1 },
333: { 0x1E30, 0x004B, 1 },
334: { 0x1E31, 0x006B, 1 },
335: { 0x1E32, 0x004B, 4 },
336: { 0x1E33, 0x006B, 4 },
337: { 0x1E36, 0x004C, 4 },
338: { 0x1E37, 0x006C, 4 },
339: { 0x1E3E, 0x004D, 1 },
340: { 0x1E3F, 0x006D, 1 },
341: { 0x1E42, 0x004D, 4 },
342: { 0x1E43, 0x006D, 4 },
343: { 0x1E46, 0x004E, 4 },
344: { 0x1E47, 0x006E, 4 },
345: { 0x1E4C, 0x00D3, 2 }, /*{ 0x1E4C, 0x00D5, 1 },*/ /*{ 0x1E4C, 0x004F, 1, 2 },*/
346: { 0x1E4D, 0x00F3, 2 }, /*{ 0x1E4D, 0x00F5, 1 },*/ /*{ 0x1E4D, 0x006F, 1, 2 },*/
347: { 0x1E4E, 0x00D6, 2 },
348: { 0x1E4F, 0x00F6, 2 },
349: { 0x1E54, 0x0050, 1 },
350: { 0x1E55, 0x0070, 1 },
351: { 0x1E5A, 0x0052, 4 },
352: { 0x1E5B, 0x0072, 4 },
353: { 0x1E62, 0x0053, 4 },
354: { 0x1E63, 0x0073, 4 },
355: { 0x1E6C, 0x0054, 4 },
356: { 0x1E6D, 0x0074, 4 },
357: { 0x1E78, 0x00DA, 2 }, /*{ 0x1E78, 0x0168, 1 },*/ /*{ 0x1E78, 0x0055, 1, 2 },*/
358: { 0x1E79, 0x00FA, 2 }, /*{ 0x1E79, 0x0169, 1 },*/ /*{ 0x1E79, 0x0075, 1, 2 },*/
359: { 0x1E7C, 0x0056, 2 },
360: { 0x1E7D, 0x0076, 2 },
361: { 0x1E7E, 0x0056, 4 },
362: { 0x1E7F, 0x0076, 4 },
363: { 0x1E80, 0x0057, 0 },
364: { 0x1E81, 0x0077, 0 },
365: { 0x1E82, 0x0057, 1 },
366: { 0x1E83, 0x0077, 1 },
367: { 0x1E88, 0x0057, 4 },
368: { 0x1E89, 0x0077, 4 },
369: { 0x1E92, 0x005A, 4 },
370: { 0x1E93, 0x007A, 4 },
371: { 0x1EA0, 0x0041, 4 },
372: { 0x1EA1, 0x0061, 4 },
373: { 0x1EA2, 0x0041, 3 },
374: { 0x1EA3, 0x0061, 3 },
375: { 0x1EA4, 0x00C2, 1 },
376: { 0x1EA5, 0x00E2, 1 },
377: { 0x1EA6, 0x00C2, 0 },
378: { 0x1EA7, 0x00E2, 0 },
379: { 0x1EA8, 0x00C2, 3 },
380: { 0x1EA9, 0x00E2, 3 },
381: { 0x1EAA, 0x00C2, 2 },
382: { 0x1EAB, 0x00E2, 2 },
383: { 0x1EAC, 0x00C2, 4 },
384: { 0x1EAD, 0x00E2, 4 },
385: { 0x1EAE, 0x0102, 1 },
386: { 0x1EAF, 0x0103, 1 },
387: { 0x1EB0, 0x0102, 0 },
388: { 0x1EB1, 0x0103, 0 },
389: { 0x1EB2, 0x0102, 3 },
390: { 0x1EB3, 0x0103, 3 },
391: { 0x1EB4, 0x0102, 2 },
392: { 0x1EB5, 0x0103, 2 },
393: { 0x1EB6, 0x0102, 4 },
394: { 0x1EB7, 0x0103, 4 },
395: { 0x1EB8, 0x0045, 4 },
396: { 0x1EB9, 0x0065, 4 },
397: { 0x1EBA, 0x0045, 3 },
398: { 0x1EBB, 0x0065, 3 },
399: { 0x1EBC, 0x0045, 2 },
400: { 0x1EBD, 0x0065, 2 },
401: { 0x1EBE, 0x00CA, 1 },
402: { 0x1EBF, 0x00EA, 1 },
403: { 0x1EC0, 0x00CA, 0 },
404: { 0x1EC1, 0x00EA, 0 },
405: { 0x1EC2, 0x00CA, 3 },
406: { 0x1EC3, 0x00EA, 3 },
407: { 0x1EC4, 0x00CA, 2 },
408: { 0x1EC5, 0x00EA, 2 },
409: { 0x1EC6, 0x00CA, 4 },
410: { 0x1EC7, 0x00EA, 4 },
411: { 0x1EC8, 0x0049, 3 },
412: { 0x1EC9, 0x0069, 3 },
413: { 0x1ECA, 0x0049, 4 },
414: { 0x1ECB, 0x0069, 4 },
415: { 0x1ECC, 0x004F, 4 },
416: { 0x1ECD, 0x006F, 4 },
417: { 0x1ECE, 0x004F, 3 },
418: { 0x1ECF, 0x006F, 3 },
419: { 0x1ED0, 0x00D4, 1 },
420: { 0x1ED1, 0x00F4, 1 },
421: { 0x1ED2, 0x00D4, 0 },
422: { 0x1ED3, 0x00F4, 0 },
423: { 0x1ED4, 0x00D4, 3 },
424: { 0x1ED5, 0x00F4, 3 },
425: { 0x1ED6, 0x00D4, 2 },
426: { 0x1ED7, 0x00F4, 2 },
427: { 0x1ED8, 0x00D4, 4 },
428: { 0x1ED9, 0x00F4, 4 },
429: { 0x1EDA, 0x01A0, 1 },
430: { 0x1EDB, 0x01A1, 1 },
431: { 0x1EDC, 0x01A0, 0 },
432: { 0x1EDD, 0x01A1, 0 },
433: { 0x1EDE, 0x01A0, 3 },
434: { 0x1EDF, 0x01A1, 3 },
435: { 0x1EE0, 0x01A0, 2 },
436: { 0x1EE1, 0x01A1, 2 },
437: { 0x1EE2, 0x01A0, 4 },
438: { 0x1EE3, 0x01A1, 4 },
439: { 0x1EE4, 0x0055, 4 },
440: { 0x1EE5, 0x0075, 4 },
441: { 0x1EE6, 0x0055, 3 },
442: { 0x1EE7, 0x0075, 3 },
443: { 0x1EE8, 0x01AF, 1 },
444: { 0x1EE9, 0x01B0, 1 },
445: { 0x1EEA, 0x01AF, 0 },
446: { 0x1EEB, 0x01B0, 0 },
447: { 0x1EEC, 0x01AF, 3 },
448: { 0x1EED, 0x01B0, 3 },
449: { 0x1EEE, 0x01AF, 2 },
450: { 0x1EEF, 0x01B0, 2 },
451: { 0x1EF0, 0x01AF, 4 },
452: { 0x1EF1, 0x01B0, 4 },
453: { 0x1EF2, 0x0059, 0 },
454: { 0x1EF3, 0x0079, 0 },
455: { 0x1EF4, 0x0059, 4 },
456: { 0x1EF5, 0x0079, 4 },
457: { 0x1EF6, 0x0059, 3 },
458: { 0x1EF7, 0x0079, 3 },
459: { 0x1EF8, 0x0059, 2 },
460: { 0x1EF9, 0x0079, 2 },
461: { 0x1FED, 0x00A8, 0 },
1.1.1.2 misho 462: { 0x1FEE, 0x00A8, 1 }, /* U+1FEE => U+0385 => U+00A8 U+0301 */
1.1 misho 463: };
464:
465: #endif /* _VIETCOMB_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>