Make read_utf8(), like read_sbcs(), accessible to the rest of the library,
authorben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sun, 18 Sep 2005 12:49:44 +0000 (12:49 +0000)
committerben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sun, 18 Sep 2005 12:49:44 +0000 (12:49 +0000)
so it can be used directly in iso2022.c.

git-svn-id: svn://svn.tartarus.org/sgt/charset@6326 cda61777-01e9-0310-a592-d414129be87e

internal.h
iso2022.c
utf8.c

index df5996f..e7ed8da 100644 (file)
@@ -94,6 +94,10 @@ int write_sbcs(charset_spec const *charset, long int input_chr,
 long int sbcs_to_unicode(const struct sbcs_data *sd, long int input_chr);
 long int sbcs_from_unicode(const struct sbcs_data *sd, long int input_chr);
 
+void read_utf8(charset_spec const *charset, long int input_chr,
+              charset_state *state,
+              void (*emit)(void *ctx, long int output), void *emitctx);
+
 long int big5_to_unicode(int r, int c);
 int unicode_to_big5(long int unicode, int *r, int *c);
 long int cp949_to_unicode(int r, int c);
index 87317b5..642475c 100644 (file)
--- a/iso2022.c
+++ b/iso2022.c
@@ -144,8 +144,7 @@ static void do_utf8(long int input_chr,
 
     ustate.s1 = 0;
     ustate.s0 = state->s0 & 0x03ffffffL;
-    utf8 = charset_find_spec(CS_UTF8);
-    utf8->read(utf8, input_chr, &ustate, emit, emitctx);
+    read_utf8(NULL, input_chr, &ustate, emit, emitctx);
     state->s0 = (state->s0 & ~0x03ffffffL) | (ustate.s0 & 0x03ffffffL);
 }
 
diff --git a/utf8.c b/utf8.c
index 90856e9..c9a9685 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -11,9 +11,9 @@
  * UTF-8 has no associated data, so `charset' may be ignored.
  */
 
-static void read_utf8(charset_spec const *charset, long int input_chr,
-                     charset_state *state,
-                     void (*emit)(void *ctx, long int output), void *emitctx)
+void read_utf8(charset_spec const *charset, long int input_chr,
+              charset_state *state,
+              void (*emit)(void *ctx, long int output), void *emitctx)
 {
     UNUSEDARG(charset);