Debian Codegraph @

src/lat1iso5426.c

raw symbols SCIP
1 /* Conversion of files between different charsets and usages.
2 Copyright (C) 1990-2018 Free Software Foundation, Inc.
3 Francois Pinard <[email protected]>, 1988.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 /*
21 * Copyright (c) 1998, Wolfram Schneider <[email protected]>
22 * Konrad Zuse Zentrum für Informationstechnik Berlin.
23 * All rights reserved.
24 *
25 * Read the file iso5426lat1.l for more information about iso5426.
26 *
27 */
28
29
30 #include "config.h"
31 #include "common.h"
32 #include "decsteps.h"
33
34 struct translation
35 {
36 int code; /* code being translated */
37 const char *string; /* translation string */
38 };
39
40 static struct translation diacritic_translations [] =
41 {
42 #include "lat1iso5426.h"
43 {0, NULL},
44 };
45
46 static bool
47 init_latin1_iso5426 (RECODE_STEP step,
48 const struct recode_request *request,
49 RECODE_CONST_OPTION_LIST before_options _GL_UNUSED,
50 RECODE_CONST_OPTION_LIST after_options _GL_UNUSED)
51 {
52 RECODE_OUTER outer = request->outer;
53
54 char *pool;
55 const char **table;
56 unsigned counter;
57 struct translation const *cursor;
58
59 if (!ALLOC_SIZE (table, 256 * sizeof (char *) + 256, const char *))
60 return false;
61 pool = (char *) (table + 256);
62
63 for (counter = 0; counter < 128; counter++)
64 {
65 pool[2 * counter] = counter;
66 pool[2 * counter + 1] = '\0';
67 table[counter] = pool + 2 * counter;
68 }
69 for (counter = 128; counter < 256; counter++)
70 table[counter] = NULL;
71 for (cursor = diacritic_translations; cursor->code; cursor++)
72 table[cursor->code] = cursor->string;
73
74 step->step_table = table;
75 step->step_table_term_routine = free;
76
77 return true;
78 }
79
80 bool
81 module_latin1_iso5426 (RECODE_OUTER outer)
82 {
83 return recode_declare_single (outer, "Latin-1", "ISO_5426:1983-DB-MAB2",
84 outer->quality_variable_to_byte, init_latin1_iso5426,
85 recode_transform_byte_to_variable);
86 }
87
88 void
89 delmodule_latin1_iso5426 (_GL_UNUSED RECODE_OUTER outer)
90 {
91 }