From 2926a57424946281a78b9cc5b8098b1cff39e45a Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 17 Jan 2001 13:10:28 +0000 Subject: [PATCH] Exported conversions between internal character codes and UCS. --- charset/charconv.c | 22 ++++++++++++++++++++-- charset/charconv.h | 11 +++++++++-- charset/setnames.c | 4 ++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/charset/charconv.c b/charset/charconv.c index 7cae7492..c5d3717b 100644 --- a/charset/charconv.c +++ b/charset/charconv.c @@ -1,7 +1,7 @@ /* - * Character Set Conversion Library 1.0 + * Character Set Conversion Library 1.1 * - * (c) 1998 Martin Mares + * (c) 1998--2001 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU General Public License. @@ -258,3 +258,21 @@ conv_set_charset(struct conv_context *c, int src, int dest) } c->state = 0; } + +unsigned int +conv_x_to_ucs(unsigned int x) +{ + return x_to_uni[x]; +} + +unsigned int +conv_ucs_to_x(unsigned int ucs) +{ + return uni_to_x[ucs >> 8U][ucs & 0xff]; +} + +unsigned int +conv_x_count(void) +{ + return sizeof(x_to_uni) / sizeof(x_to_uni[0]); +} diff --git a/charset/charconv.h b/charset/charconv.h index 14fee079..a235025e 100644 --- a/charset/charconv.h +++ b/charset/charconv.h @@ -1,7 +1,7 @@ /* - * Character Set Conversion Library 1.0 + * Character Set Conversion Library 1.1 * - * (c) 1998 Martin Mares + * (c) 1998--2001 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU General Public License. See file COPYING in any of the GNU packages. @@ -39,5 +39,12 @@ void conv_set_charset(struct conv_context *, int, int); #define CONV_CHARSET_UTF8 8 #define CONV_NUM_CHARSETS 9 +/* For those brave ones who want to mess with charconv internals */ +unsigned int conv_x_to_ucs(unsigned int x); +unsigned int conv_ucs_to_x(unsigned int ucs); +unsigned int conv_x_count(void); + +/* Charset names */ + int find_charset_by_name(char *); char *charset_name(int); diff --git a/charset/setnames.c b/charset/setnames.c index e9665971..38606436 100644 --- a/charset/setnames.c +++ b/charset/setnames.c @@ -1,7 +1,7 @@ /* * Character Set Conversion Library 1.0 -- Character Set Names * - * (c) 1998 Martin Mares + * (c) 1998--2001 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU General Public License. @@ -12,7 +12,7 @@ #include -char *cs_names[] = { +static char *cs_names[] = { "US-ASCII", "ISO-8859-1", "ISO-8859-2", -- 2.39.2