]> mj.ucw.cz Git - libucw.git/commitdiff
Exported conversions between internal character codes and UCS.
authorMartin Mares <mj@ucw.cz>
Wed, 17 Jan 2001 13:10:28 +0000 (13:10 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 17 Jan 2001 13:10:28 +0000 (13:10 +0000)
charset/charconv.c
charset/charconv.h
charset/setnames.c

index 7cae74929d3be3b570b8c68ca9024e30fec2bb01..c5d3717b65cfa8c62281dc21e765cb077ebf83ad 100644 (file)
@@ -1,7 +1,7 @@
 /*
- *     Character Set Conversion Library 1.0
+ *     Character Set Conversion Library 1.1
  *
- *     (c) 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1998--2001 Martin Mares <mj@ucw.cz>
  *
  *     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]);
+}
index 14fee079ac02fea498c077bffcc55934c4a165e6..a235025e9c628d16a518e17180aaacd6c40c48a4 100644 (file)
@@ -1,7 +1,7 @@
 /*
- *     Character Set Conversion Library 1.0
+ *     Character Set Conversion Library 1.1
  *
- *     (c) 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1998--2001 Martin Mares <mj@ucw.cz>
  *
  *     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);
index e9665971f9422614c2b5707bb727c866c18f06ba..38606436b4bbc293258e6da5e43f89874ee6f935 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     Character Set Conversion Library 1.0 -- Character Set Names
  *
- *     (c) 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 1998--2001 Martin Mares <mj@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU General Public License.
@@ -12,7 +12,7 @@
 
 #include <string.h>
 
-char *cs_names[] = {
+static char *cs_names[] = {
        "US-ASCII",
        "ISO-8859-1",
        "ISO-8859-2",