maint: update copyright
[gnulib.git] / lib / diacrit.c
1 /* Diacritics processing for a few character codes.
2
3    Copyright (C) 1990-1993, 2000, 2006, 2009-2014 Free Software Foundation,
4    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 3 of the License, or
13    (at your option) 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.  If not, see <http://www.gnu.org/licenses/>.  */
22
23 #include <config.h>
24
25 #include "diacrit.h"
26
27 /* ISO 8859-1 Latin-1 code is used as the underlying character set.  If
28    MSDOS is defined, IBM-PC's character set code is used instead.  */
29
30 /*--------------------------------------------------------------------.
31 | For each alphabetic character, returns what it would be without its |
32 | possible diacritic symbol.                                          |
33 `--------------------------------------------------------------------*/
34
35 const char diacrit_base[256] =
36 {
37   0,      0,      0,      0,      0,      0,      0,      0,
38   0,      0,      0,      0,      0,      0,      0,      0,
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,      'A',    'B',    'C',    'D',    'E',    'F',    'G',
46   'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
47   'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
48   'X',    'Y',    'Z',    0,      0,      0,      0,      0,
49   0,      'a',    'b',    'c',    'd',    'e',    'f',    'g',
50   'h',    'i',    'j',    'k',    'l',    'm',    'n',    'o',
51   'p',    'q',    'r',    's',    't',    'u',    'v',    'w',
52   'x',    'y',    'z',    0,      0,      0,      0,      0,
53
54 #ifdef __MSDOS__
55
56   'C',    'u',    'e',    'a',    'a',    'a',    'a',    'c',
57   'e',    'e',    'e',    'i',    'i',    'i',    'A',    'A',
58   'E',    'e',    'E',    'o',    'o',    'o',    'u',    'u',
59   'y',    'O',    'U',    0,      0,      0,      0,      0,
60   'a',    'i',    'o',    'u',    'n',    'N',    0,      0,
61   0,      0,      0,      0,      0,      0,      0,      0,
62   0,      0,      0,      0,      0,      0,      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
73 #else
74
75   0,      0,      0,      0,      0,      0,      0,      0,
76   0,      0,      0,      0,      0,      0,      0,      0,
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   'A',    'A',    'A',    'A',    'A',    'A',    'A',    'C',
84   'E',    'E',    'E',    'E',    'I',    'I',    'I',    'I',
85   0,      'N',    'O',    'O',    'O',    'O',    'O',    0,
86   'O',    'U',    'U',    'U',    'U',    'Y',    0,      0,
87   'a',    'a',    'a',    'a',    'a',    'a',    'a',    'c',
88   'e',    'e',    'e',    'e',    'i',    'i',    'i',    'i',
89   0,      'n',    'o',    'o',    'o',    'o',    'o',    0,
90   'o',    'u',    'u',    'u',    'u',    'y',    0,      'y',
91
92 #endif
93 };
94
95 /*------------------------------------------------------------------------.
96 | For each alphabetic character, returns a code of what its diacritic is, |
97 | according to the following codes: 1 (eE) over aA for latin diphthongs;  |
98 | 2 (') acute accent; 3 (`) grave accent; 4 (^) circumflex accent; 5 (")  |
99 | umlaut or diaeresis; 6 (~) tilda; 7 (,) cedilla; 8 (o) covering degree  |
100 | symbol; 9 (|) slashed character.                                        |
101 `------------------------------------------------------------------------*/
102
103 const char diacrit_diac[256] =
104 {
105   0,      0,      0,      0,      0,      0,      0,      0,
106   0,      0,      0,      0,      0,      0,      0,      0,
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,      4,      0,
117   3,      0,      0,      0,      0,      0,      0,      0,
118   0,      0,      0,      0,      0,      0,      0,      0,
119   0,      0,      0,      0,      0,      0,      0,      0,
120   0,      0,      0,      0,      0,      0,      6,      0,
121
122 #ifdef __MSDOS__
123
124   7,      5,      2,      4,      5,      3,      8,      7,
125   4,      5,      3,      5,      4,      3,      5,      8,
126   2,      1,      1,      4,      5,      3,      4,      3,
127   5,      5,      5,      0,      0,      0,      0,      0,
128   2,      2,      2,      2,      6,      6,      0,      0,
129   0,      0,      0,      0,      0,      0,      0,      0,
130   0,      0,      0,      0,      0,      0,      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
141 #else
142
143   0,      0,      0,      0,      0,      0,      0,      0,
144   0,      0,      0,      0,      0,      0,      0,      0,
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   3,      2,      4,      6,      5,      8,      1,      7,
152   3,      2,      4,      5,      3,      2,      4,      5,
153   0,      6,      3,      2,      4,      6,      5,      0,
154   9,      3,      2,      4,      5,      2,      0,      0,
155   3,      2,      4,      6,      5,      8,      1,      7,
156   3,      2,      4,      5,      3,      2,      4,      5,
157   0,      6,      3,      2,      4,      6,      5,      0,
158   9,      3,      2,      4,      5,      2,      0,      0,
159
160 #endif
161 };