Tizen 2.0 Release
[external/tizen-coreutils.git] / lib / diacrit.c
1 /* Diacritics processing for a few character codes.
2
3    Copyright (C) 1990, 1991, 1992, 1993, 2000, 2006 Free Software
4    Foundation, Inc.
5
6    François Pinard <pinard@iro.umontreal.ca>, 1988.
7
8    All this file is a temporary hack, waiting for locales in GNU.
9
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 2, or (at your option)
13    any later version.
14
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; see the file COPYING.
22    If not, write to the Free Software Foundation,
23    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
24
25 #include <config.h>
26
27 #include "diacrit.h"
28
29 /* ISO 8859-1 Latin-1 code is used as the underlying character set.  If
30    MSDOS is defined, IBM-PC's character set code is used instead.  */
31
32 /*--------------------------------------------------------------------.
33 | For each alphabetic character, returns what it would be without its |
34 | possible diacritic symbol.                                          |
35 `--------------------------------------------------------------------*/
36
37 const char diacrit_base[256] =
38 {
39   0,      0,      0,      0,      0,      0,      0,      0,
40   0,      0,      0,      0,      0,      0,      0,      0,
41   0,      0,      0,      0,      0,      0,      0,      0,
42   0,      0,      0,      0,      0,      0,      0,      0,
43   0,      0,      0,      0,      0,      0,      0,      0,
44   0,      0,      0,      0,      0,      0,      0,      0,
45   0,      0,      0,      0,      0,      0,      0,      0,
46   0,      0,      0,      0,      0,      0,      0,      0,
47   0,      'A',    'B',    'C',    'D',    'E',    'F',    'G',
48   'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
49   'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
50   'X',    'Y',    'Z',    0,      0,      0,      0,      0,
51   0,      'a',    'b',    'c',    'd',    'e',    'f',    'g',
52   'h',    'i',    'j',    'k',    'l',    'm',    'n',    'o',
53   'p',    'q',    'r',    's',    't',    'u',    'v',    'w',
54   'x',    'y',    'z',    0,      0,      0,      0,      0,
55
56 #ifdef __MSDOS__
57
58   'C',    'u',    'e',    'a',    'a',    'a',    'a',    'c',
59   'e',    'e',    'e',    'i',    'i',    'i',    'A',    'A',
60   'E',    'e',    'E',    'o',    'o',    'o',    'u',    'u',
61   'y',    'O',    'U',    0,      0,      0,      0,      0,
62   'a',    'i',    'o',    'u',    'n',    'N',    0,      0,
63   0,      0,      0,      0,      0,      0,      0,      0,
64   0,      0,      0,      0,      0,      0,      0,      0,
65   0,      0,      0,      0,      0,      0,      0,      0,
66   0,      0,      0,      0,      0,      0,      0,      0,
67   0,      0,      0,      0,      0,      0,      0,      0,
68   0,      0,      0,      0,      0,      0,      0,      0,
69   0,      0,      0,      0,      0,      0,      0,      0,
70   0,      0,      0,      0,      0,      0,      0,      0,
71   0,      0,      0,      0,      0,      0,      0,      0,
72   0,      0,      0,      0,      0,      0,      0,      0,
73   0,      0,      0,      0,      0,      0,      0,      0,
74
75 #else
76
77   0,      0,      0,      0,      0,      0,      0,      0,
78   0,      0,      0,      0,      0,      0,      0,      0,
79   0,      0,      0,      0,      0,      0,      0,      0,
80   0,      0,      0,      0,      0,      0,      0,      0,
81   0,      0,      0,      0,      0,      0,      0,      0,
82   0,      0,      0,      0,      0,      0,      0,      0,
83   0,      0,      0,      0,      0,      0,      0,      0,
84   0,      0,      0,      0,      0,      0,      0,      0,
85   'A',    'A',    'A',    'A',    'A',    'A',    'A',    'C',
86   'E',    'E',    'E',    'E',    'I',    'I',    'I',    'I',
87   0,      'N',    'O',    'O',    'O',    'O',    'O',    0,
88   'O',    'U',    'U',    'U',    'U',    'Y',    0,      0,
89   'a',    'a',    'a',    'a',    'a',    'a',    'a',    'c',
90   'e',    'e',    'e',    'e',    'i',    'i',    'i',    'i',
91   0,      'n',    'o',    'o',    'o',    'o',    'o',    0,
92   'o',    'u',    'u',    'u',    'u',    'y',    0,      'y',
93
94 #endif
95 };
96
97 /*------------------------------------------------------------------------.
98 | For each alphabetic character, returns a code of what its diacritic is, |
99 | according to the following codes: 1 (eE) over aA for latin diphtongs; 2 |
100 | (') acute accent; 3 (`) grave accent; 4 (^) circumflex accent; 5 (")    |
101 | umlaut or diaraesis; 6 (~) tilda; 7 (,) cedilla; 8 (o) covering degree  |
102 | symbol; 9 (|) slashed character.                                        |
103 `------------------------------------------------------------------------*/
104
105 const char diacrit_diac[256] =
106 {
107   0,      0,      0,      0,      0,      0,      0,      0,
108   0,      0,      0,      0,      0,      0,      0,      0,
109   0,      0,      0,      0,      0,      0,      0,      0,
110   0,      0,      0,      0,      0,      0,      0,      0,
111   0,      0,      0,      0,      0,      0,      0,      0,
112   0,      0,      0,      0,      0,      0,      0,      0,
113   0,      0,      0,      0,      0,      0,      0,      0,
114   0,      0,      0,      0,      0,      0,      0,      0,
115   0,      0,      0,      0,      0,      0,      0,      0,
116   0,      0,      0,      0,      0,      0,      0,      0,
117   0,      0,      0,      0,      0,      0,      0,      0,
118   0,      0,      0,      0,      0,      0,      4,      0,
119   3,      0,      0,      0,      0,      0,      0,      0,
120   0,      0,      0,      0,      0,      0,      0,      0,
121   0,      0,      0,      0,      0,      0,      0,      0,
122   0,      0,      0,      0,      0,      0,      6,      0,
123
124 #ifdef __MSDOS__
125
126   7,      5,      2,      4,      5,      3,      8,      7,
127   4,      5,      3,      5,      4,      3,      5,      8,
128   2,      1,      1,      4,      5,      3,      4,      3,
129   5,      5,      5,      0,      0,      0,      0,      0,
130   2,      2,      2,      2,      6,      6,      0,      0,
131   0,      0,      0,      0,      0,      0,      0,      0,
132   0,      0,      0,      0,      0,      0,      0,      0,
133   0,      0,      0,      0,      0,      0,      0,      0,
134   0,      0,      0,      0,      0,      0,      0,      0,
135   0,      0,      0,      0,      0,      0,      0,      0,
136   0,      0,      0,      0,      0,      0,      0,      0,
137   0,      0,      0,      0,      0,      0,      0,      0,
138   0,      0,      0,      0,      0,      0,      0,      0,
139   0,      0,      0,      0,      0,      0,      0,      0,
140   0,      0,      0,      0,      0,      0,      0,      0,
141   0,      0,      0,      0,      0,      0,      0,      0,
142
143 #else
144
145   0,      0,      0,      0,      0,      0,      0,      0,
146   0,      0,      0,      0,      0,      0,      0,      0,
147   0,      0,      0,      0,      0,      0,      0,      0,
148   0,      0,      0,      0,      0,      0,      0,      0,
149   0,      0,      0,      0,      0,      0,      0,      0,
150   0,      0,      0,      0,      0,      0,      0,      0,
151   0,      0,      0,      0,      0,      0,      0,      0,
152   0,      0,      0,      0,      0,      0,      0,      0,
153   3,      2,      4,      6,      5,      8,      1,      7,
154   3,      2,      4,      5,      3,      2,      4,      5,
155   0,      6,      3,      2,      4,      6,      5,      0,
156   9,      3,      2,      4,      5,      2,      0,      0,
157   3,      2,      4,      6,      5,      8,      1,      7,
158   3,      2,      4,      5,      3,      2,      4,      5,
159   0,      6,      3,      2,      4,      6,      5,      0,
160   9,      3,      2,      4,      5,      2,      0,      0,
161
162 #endif
163 };