Debian Codegraph @

src/lat1asci.c

raw symbols SCIP
1 /* Conversion of files between different charsets and surfaces.
2 Copyright © 1990-2018 Free Software Foundation, Inc.
3 Contributed by François Pinard <[email protected]>, 1988.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License
7 as published by the Free Software Foundation; either version 3 of the
8 License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be
11 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the Recode Library; see the file `COPYING.LIB'.
17 If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 #include "config.h"
21 #include "common.h"
22 #include "decsteps.h"
23
24 static const char *const translation_table[128] =
25 {
26 NULL, /* 128 */
27 NULL, /* 129 */
28 NULL, /* 130 */
29 NULL, /* 131 */
30 NULL, /* 132 */
31 NULL, /* 133 */
32 NULL, /* 134 */
33 NULL, /* 135 */
34 NULL, /* 136 */
35 NULL, /* 137 */
36 NULL, /* 138 */
37 NULL, /* 139 */
38 NULL, /* 140 */
39 NULL, /* 141 */
40 NULL, /* 142 */
41 NULL, /* 143 */
42 NULL, /* 144 */
43 NULL, /* 145 */
44 NULL, /* 146 */
45 NULL, /* 147 */
46 NULL, /* 148 */
47 NULL, /* 149 */
48 NULL, /* 150 */
49 NULL, /* 151 */
50 NULL, /* 152 */
51 NULL, /* 153 */
52 NULL, /* 154 */
53 NULL, /* 155 */
54 NULL, /* 156 */
55 NULL, /* 157 */
56 NULL, /* 158 */
57 NULL, /* 159 */
58
59 " ", /* 160 no-break space */
60 NULL, /* 161 inverted exclamation mark */
61 NULL, /* 162 cent sign */
62 NULL, /* 163 pound sign */
63 NULL, /* 164 currency sign */
64 NULL, /* 165 yen sign */
65 NULL, /* 166 broken bar */
66 NULL, /* 167 paragraph sign, section sign */
67 NULL, /* 168 diaeresis */
68 NULL, /* 169 copyright sign */
69 NULL, /* 170 feminine ordinal indicator */
70 "<\b\"", /* 171 left angle quotation mark */
71 NULL, /* 172 not sign */
72 NULL, /* 173 soft hyphen */
73 NULL, /* 174 registered trade mark sign */
74 NULL, /* 175 macron */
75 NULL, /* 176 degree sign */
76 NULL, /* 177 plus-minus sign */
77 NULL, /* 178 superscript two */
78 NULL, /* 179 superscript three */
79 NULL, /* 180 acute accent */
80 NULL, /* 181 small greek mu, micro sign */
81 NULL, /* 182 pilcrow sign */
82 NULL, /* 183 middle dot */
83 NULL, /* 184 cedilla */
84 NULL, /* 185 superscript one */
85 NULL, /* 186 masculine ordinal indicator */
86 ">\b\"", /* 187 right angle quotation mark */
87 NULL, /* 188 vulgar fraction one quarter */
88 NULL, /* 189 vulgar fraction one half */
89 NULL, /* 190 vulgar fraction three quarters */
90 NULL, /* 191 inverted question mark */
91 "`\bA", /* 192 capital A with grave accent */
92 "'\bA", /* 193 capital A with acute accent */
93 "^\bA", /* 194 capital A with circumflex accent */
94 "~\bA", /* 195 capital A with tilde */
95 "\"\bA", /* 196 capital A diaeresis */
96 NULL, /* 197 capital A with ring above */
97 NULL, /* 198 capital diphthong A with E */
98 ",\bC", /* 199 capital C with cedilla */
99 "`\bE", /* 200 capital E with grave accent */
100 "'\bE", /* 201 capital E with acute accent */
101 "^\bE", /* 202 capital E with circumflex accent */
102 "\"\bE", /* 203 capital E with diaeresis */
103 "`\bI", /* 204 capital I with grave accent */
104 "'\bI", /* 205 capital I with acute accent */
105 "^\bI", /* 206 capital I with circumflex accent */
106 "\"\bI", /* 207 capital I with diaeresis */
107 NULL, /* 208 capital icelandic ETH */
108 "~\bN", /* 209 capital N with tilde */
109 "`\bO", /* 210 capital O with grave accent */
110 "'\bO", /* 211 capital O with acute accent */
111 "^\bO", /* 212 capital O with circumflex accent */
112 "~\bO", /* 213 capital O with tilde */
113 "\"\bO", /* 214 capital O with diaeresis */
114 NULL, /* 215 multiplication sign */
115 "/\bO", /* 216 capital O with oblique stroke */
116 "`\bU", /* 217 capital U with grave accent */
117 "'\bU", /* 218 capital U with acute accent */
118 "^\bU", /* 219 capital U with circumflex accent */
119 "\"\bU", /* 220 capital U with diaeresis */
120 "'\bY", /* 221 capital Y with acute accent */
121 NULL, /* 222 capital icelandic THORN */
122 "\"\bs", /* 223 small german sharp s */
123 "`\ba", /* 224 small a with grave accent */
124 "'\ba", /* 225 small a with acute accent */
125 "^\ba", /* 226 small a with circumflex accent */
126 "~\ba", /* 227 small a with tilde */
127 "\"\ba", /* 228 small a with diaeresis */
128 NULL, /* 229 small a with ring above */
129 NULL, /* 230 small diphthong a with e */
130 ",\bc", /* 231 small c with cedilla */
131 "`\be", /* 232 small e with grave accent */
132 "'\be", /* 233 small e with acute accent */
133 "^\be", /* 234 small e with circumflex accent */
134 "\"\be", /* 235 small e with diaeresis */
135 "`\bi", /* 236 small i with grave accent */
136 "'\bi", /* 237 small i with acute accent */
137 "^\bi", /* 238 small i with circumflex accent */
138 "\"\bi", /* 239 small i with diaeresis */
139 NULL, /* 240 small icelandic eth */
140 "~\bn", /* 241 small n with tilde */
141 "`\bo", /* 242 small o with grave accent */
142 "'\bo", /* 243 small o with acute accent */
143 "^\bo", /* 244 small o with circumflex accent */
144 "~\bo", /* 245 small o with tilde */
145 "\"\bo", /* 246 small o with diaeresis */
146 NULL, /* 247 division sign */
147 "/\bo", /* 248 small o with oblique stroke */
148 "`\bu", /* 249 small u with grave accent */
149 "'\bu", /* 250 small u with acute accent */
150 "^\bu", /* 251 small u with circumflex accent */
151 "\"\bu", /* 252 small u with diaeresis */
152 "'\by", /* 253 small y with acute accent */
153 NULL, /* 254 small icelandic thorn */
154 "\"\by", /* 255 small y with diaeresis */
155 };
156
157 static bool
158 init_latin1_ascii (RECODE_STEP step,
159 RECODE_CONST_REQUEST request,
160 RECODE_CONST_OPTION_LIST before_options,
161 RECODE_CONST_OPTION_LIST after_options)
162 {
163 RECODE_OUTER outer = request->outer;
164
165 const char **table;
166 char *pool;
167 unsigned counter;
168
169 if (before_options || after_options)
170 return false;
171
172 if (!ALLOC_SIZE (table, 256 * sizeof (char *) + 256, const char *))
173 return false;
174 pool = (char *) (table + 256);
175
176 for (counter = 0; counter < 128; counter++)
177 {
178 table[counter] = pool;
179 *pool++ = counter;
180 *pool++ = NUL;
181 }
182 for (; counter < 256; counter++)
183 table[counter] = translation_table[counter - 128];
184
185 step->step_type = RECODE_BYTE_TO_STRING;
186 step->step_table = table;
187 step->step_table_term_routine = free;
188 return true;
189 }
190
191 bool
192 module_latin1_ascii (RECODE_OUTER outer)
193 {
194 if (!recode_declare_single (outer, "Latin-1", "ASCII-BS",
195 outer->quality_byte_to_variable,
196 init_latin1_ascii, recode_transform_byte_to_variable))
197 return false;
198
199 return true;
200 }
201
202 void
203 delmodule_latin1_ascii (_GL_UNUSED RECODE_OUTER outer)
204 {
205 }