home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 22 gnu
/
22-gnu.zip
/
gnurecod.zip
/
lat1html.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-03-19
|
4KB
|
143 lines
/* Conversion of files between different charsets and usages.
Copyright (C) 1990, 1993 Free Software Foundation, Inc.
Francois Pinard <pinard@iro.umontreal.ca>, 1988.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "recode.h"
struct translation
{
int code; /* code being translated */
const char *string; /* translation string */
};
static struct translation diacritic_translations [] =
{
{192, "À"},
{193, "Á"},
{194, "Âu;"},
{195, "Ã"},
{196, "&Adiaer;"},
{197, "Å"},
{198, "&AE;"},
{199, "Ç"},
{200, "È"},
{201, "É"},
{202, "Êu;"},
{203, "&Ediaer;"},
{204, "Ì"},
{205, "Í"},
{206, "Îu;"},
{207, "&Idiaer;"},
{208, "Ð"},
{209, "Ñ"},
{210, "Ò"},
{211, "Ó"},
{212, "Ôu;"},
{213, "Õ"},
{214, "&Odiaer;"},
{215, "&MULT;"},
{216, "&Ostroke;"},
{217, "Ù"},
{218, "Ú"},
{219, "Ûu;"},
{220, "&Udiaer;"},
{221, "Ý"},
{222, "Þ"},
{223, "&ssharp;"},
{224, "à"},
{225, "á"},
{226, "âu;"},
{227, "ã"},
{228, "&adiaer;"},
{229, "å"},
{230, "&ae;"},
{231, "ç"},
{232, "è"},
{233, "é"},
{234, "êu;"},
{235, "&ediaer;"},
{236, "ì"},
{237, "í"},
{238, "îu;"},
{239, "&idiaer;"},
{240, "ð"},
{241, "ñ"},
{242, "ò"},
{243, "ó"},
{244, "ôu;"},
{245, "õ"},
{246, "&odiaer;"},
{247, "&DIVIS;"},
{248, "&ostroke;"},
{249, "ù"},
{250, "ú"},
{251, "ûu;"},
{252, "&udiaer;"},
{253, "ý"},
{254, "þ"},
{255, "&ydiaer;"},
{0, NULL}
};
static struct translation const other_translations [] =
{
{38, "&"},
{60, "<"},
{62, ">"},
{0, NULL}
};
static void
init_latin1_html (STEP *step)
{
char *pool;
const char **table;
int counter;
struct translation const *cursor;
table = (const char **) xmalloc (256 * sizeof (char *) + 256);
pool = (char *) (table + 256);
for (counter = 0; counter < 128; counter++)
{
pool[2 * counter] = counter;
pool[2 * counter + 1] = '\0';
table[counter] = pool + 2 * counter;
}
for (counter = 128; counter < 256; counter++)
table[counter] = NULL;
for (cursor = diacritic_translations; cursor->code; cursor++)
table[cursor->code] = cursor->string;
if (!diacritics_only)
for (cursor = other_translations; cursor->code; cursor++)
table[cursor->code] = cursor->string;
step->one_to_many = table;
}
void
module_latin1_html (void)
{
declare_step ("latin1", "HTML", ONE_TO_MANY, init_latin1_html,
file_one_to_many);
declare_alias ("WWW", "HTML");
declare_alias ("w3", "HTML");
}