| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
. |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
#include "config.h" |
| 31 |
#include "common.h" |
| 32 |
#include "decsteps.h" |
| 33 |
|
| 34 |
struct translation |
| 35 |
{ |
| 36 |
int code; |
| 37 |
const char *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 |
} |