update nearly all FSF copyright year lists to include 2009
[pspp] / lib / diacrit.c
1 /* Diacritics processing for a few character codes.
2
3    Copyright (C) 1990-1993, 2000, 2006, 2009 Free Software Foundation, Inc.
4
5    François Pinard <pinard@iro.umontreal.ca>, 1988.
6
7    All this file is a temporary hack, waiting for locales in GNU.
8
9    This program is free software: you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
22 #include <config.h>
23
24 #include "diacrit.h"
25
26 /* ISO 8859-1 Latin-1 code is used as the underlying character set.  If
27    MSDOS is defined, IBM-PC's character set code is used instead.  */
28
29 /*--------------------------------------------------------------------.
30 | For each alphabetic character, returns what it would be without its |
31 | possible diacritic symbol.                                          |
32 `--------------------------------------------------------------------*/
33
34 const char diacrit_base[256] =
35 {
36   0,      0,      0,      0,      0,      0,      0,      0,
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,      'A',    'B',    'C',    'D',    'E',    'F',    'G',
45   'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
46   'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
47   'X',    'Y',    'Z',    0,      0,      0,      0,      0,
48   0,      'a',    'b',    'c',    'd',    'e',    'f',    'g',
49   'h',    'i',    'j',    'k',    'l',    'm',    'n',    'o',
50   'p',    'q',    'r',    's',    't',    'u',    'v',    'w',
51   'x',    'y',    'z',    0,      0,      0,      0,      0,
52
53 #ifdef __MSDOS__
54
55   'C',    'u',    'e',    'a',    'a',    'a',    'a',    'c',
56   'e',    'e',    'e',    'i',    'i',    'i',    'A',    'A',
57   'E',    'e',    'E',    'o',    'o',    'o',    'u',    'u',
58   'y',    'O',    'U',    0,      0,      0,      0,      0,
59   'a',    'i',    'o',    'u',    'n',    'N',    0,      0,
60   0,      0,      0,      0,      0,      0,      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
72 #else
73
74   0,      0,      0,      0,      0,      0,      0,      0,
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   'A',    'A',    'A',    'A',    'A',    'A',    'A',    'C',
83   'E',    'E',    'E',    'E',    'I',    'I',    'I',    'I',
84   0,      'N',    'O',    'O',    'O',    'O',    'O',    0,
85   'O',    'U',    'U',    'U',    'U',    'Y',    0,      0,
86   'a',    'a',    'a',    'a',    'a',    'a',    'a',    'c',
87   'e',    'e',    'e',    'e',    'i',    'i',    'i',    'i',
88   0,      'n',    'o',    'o',    'o',    'o',    'o',    0,
89   'o',    'u',    'u',    'u',    'u',    'y',    0,      'y',
90
91 #endif
92 };
93
94 /*------------------------------------------------------------------------.
95 | For each alphabetic character, returns a code of what its diacritic is, |
96 | according to the following codes: 1 (eE) over aA for latin diphtongs; 2 |
97 | (') acute accent; 3 (`) grave accent; 4 (^) circumflex accent; 5 (")    |
98 | umlaut or diaraesis; 6 (~) tilda; 7 (,) cedilla; 8 (o) covering degree  |
99 | symbol; 9 (|) slashed character.                                        |
100 `------------------------------------------------------------------------*/
101
102 const char diacrit_diac[256] =
103 {
104   0,      0,      0,      0,      0,      0,      0,      0,
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,      4,      0,
116   3,      0,      0,      0,      0,      0,      0,      0,
117   0,      0,      0,      0,      0,      0,      0,      0,
118   0,      0,      0,      0,      0,      0,      0,      0,
119   0,      0,      0,      0,      0,      0,      6,      0,
120
121 #ifdef __MSDOS__
122
123   7,      5,      2,      4,      5,      3,      8,      7,
124   4,      5,      3,      5,      4,      3,      5,      8,
125   2,      1,      1,      4,      5,      3,      4,      3,
126   5,      5,      5,      0,      0,      0,      0,      0,
127   2,      2,      2,      2,      6,      6,      0,      0,
128   0,      0,      0,      0,      0,      0,      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
140 #else
141
142   0,      0,      0,      0,      0,      0,      0,      0,
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   3,      2,      4,      6,      5,      8,      1,      7,
151   3,      2,      4,      5,      3,      2,      4,      5,
152   0,      6,      3,      2,      4,      6,      5,      0,
153   9,      3,      2,      4,      5,      2,      0,      0,
154   3,      2,      4,      6,      5,      8,      1,      7,
155   3,      2,      4,      5,      3,      2,      4,      5,
156   0,      6,      3,      2,      4,      6,      5,      0,
157   9,      3,      2,      4,      5,      2,      0,      0,
158
159 #endif
160 };