Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 15 May 1998 21:17:11 +0000 (21:17 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 15 May 1998 21:17:11 +0000 (21:17 +0000)
1998-05-15 21:07  Ulrich Drepper  <drepper@cygnus.com>

* iconv/gconv.h (gconv_step_data): Add new fields invocation_counter
and internal_use.
* iconv/gconv_open.c (__gconv_open): Initialize invocation_counter
and internal_use.
* iconv/skeleton.c: Increment invocation_counter.
* iconvdata/iso-2022-kr.c: When used in iconv() emit designator
sequence first.

* iconv/skeleton.c (FROM_DIRECTION): Completely embrace expression.
* iconvdata/iso-2022-jp.c: Likewise.
* iconvdata/iso646.c: Likewise.

* iconvdata/Makefile: Correct rpath definition for ISO-2022-KR.

ChangeLog
iconv/gconv.h
iconv/gconv_open.c
iconv/skeleton.c
iconvdata/Makefile
iconvdata/iso-2022-jp.c
iconvdata/iso-2022-kr.c
iconvdata/iso646.c

index e264b02..89f4625 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+1998-05-15 21:07  Ulrich Drepper  <drepper@cygnus.com>
+
+       * iconv/gconv.h (gconv_step_data): Add new fields invocation_counter
+       and internal_use.
+       * iconv/gconv_open.c (__gconv_open): Initialize invocation_counter
+       and internal_use.
+       * iconv/skeleton.c: Increment invocation_counter.
+       * iconvdata/iso-2022-kr.c: When used in iconv() emit designator
+       sequence first.
+
+       * iconv/skeleton.c (FROM_DIRECTION): Completely embrace expression.
+       * iconvdata/iso-2022-jp.c: Likewise.
+       * iconvdata/iso646.c: Likewise.
+
+       * iconvdata/Makefile: Correct rpath definition for ISO-2022-KR.
+
 1998-05-15  Ulrich Drepper  <drepper@cygnus.com>
 
        * iconv/gconv_db.c (derivation_lookup): Use __tfind correctly.
index b359c92..1e19c96 100644 (file)
@@ -100,8 +100,17 @@ struct gconv_step_data
   char *outbuf;                /* Output buffer for this step.  */
   char *outbufend;     /* Address of first byte after the output buffer.  */
 
+  /* Is this the last module in the chain.  */
   int is_last;
 
+  /* Counter for number of invocations of the module function for this
+     desriptor.  */
+  int invocation_counter;
+
+  /* Flag whether this is an internal use of the module (in the mb*towc*
+     and wc*tomb* functions) or regular with iconv(3).  */
+  int internal_use;
+
   mbstate_t *statep;
   mbstate_t __state;   /* This element should not be used directly by
                           any module; always use STATEP!  */
index d7e0191..fb5f88b 100644 (file)
@@ -65,6 +65,12 @@ __gconv_open (const char *toset, const char *fromset, gconv_t *handle)
                     buffer.  */
                  data[cnt].is_last = cnt == nsteps - 1;
 
+                 /* Reset the counter.  */
+                 data[cnt].invocation_counter = 0;
+
+                 /* It's a regular use.  */
+                 data[cnt].internal_use = 0;
+
                  /* We use the `mbstate_t' member in DATA.  */
                  data[cnt].statep = &data[cnt].__state;
 
index f0445f1..418247f 100644 (file)
@@ -90,7 +90,7 @@ static int from_object;
 static int to_object;
 
 # ifndef FROM_DIRECTION
-#  define FROM_DIRECTION step->data == &from_object
+#  define FROM_DIRECTION (step->data == &from_object)
 # endif
 #else
 # ifndef FROM_DIRECTION
@@ -346,6 +346,9 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
 #ifdef END_LOOP
       END_LOOP
 #endif
+
+      /* We finished one use of this step.  */
+      ++data->invocation_counter;
     }
 
   return status;
index 8d5ace8..f438b3d 100644 (file)
@@ -165,8 +165,8 @@ $(objpfx)EUC-TW.so: $(objpfx)libCNS.so
 LDFLAGS-ISO-2022-JP.so = -Wl,-rpath,$(gconvdir)
 $(objpfx)ISO-2022-JP.so: $(objpfx)libJIS.so $(objpfx)libGB.so \
                         $(objpfx)libCNS.so $(objpfx)libKSC.so
-LDFLAGS-ISO-2022-JP.so = -Wl,-rpath,$(gconvdir)
-$(objpfx)ISO-2022-JP.so: $(objpfx)libKSC.so
+LDFLAGS-ISO-2022-KR.so = -Wl,-rpath,$(gconvdir)
+$(objpfx)ISO-2022-KR.so: $(objpfx)libKSC.so
 
 LDFLAGS-libJIS.so = -Wl,-soname,$(@F)
 LDFLAGS-libKSC.so = -Wl,-soname,$(@F)
index 2c0f701..900c733 100644 (file)
@@ -50,7 +50,7 @@ struct gap
 #define MAX_NEEDED_FROM                4
 #define MIN_NEEDED_TO          4
 #define MAX_NEEDED_TO          4
-#define FROM_DIRECTION         dir == from_iso2022jp
+#define FROM_DIRECTION         (dir == from_iso2022jp)
 #define PREPARE_LOOP \
   enum direction dir = ((struct iso2022jp_data *) step->data)->dir;          \
   enum variant var = ((struct iso2022jp_data *) step->data)->var;            \
index 69a1f5f..cb02cc9 100644 (file)
 #define MAX_NEEDED_TO          4
 #define PREPARE_LOOP \
   int save_set;                                                                      \
-  int set = data->statep->count;
+  int set = data->statep->count;                                             \
+  if (!FROM_DIRECTION && !data->internal_use && data->invocation_counter == 0)\
+    {                                                                        \
+      /* Emit the designator sequence.  */                                   \
+      if (outptr + 4 > outend)                                               \
+       return GCONV_FULL_OUTPUT;                                             \
+                                                                             \
+      *outptr++ = '\x1b';                                                    \
+      *outptr++ = '\x24';                                                    \
+      *outptr++ = '\x29';                                                    \
+      *outptr++ = '\x43';                                                    \
+    }
 #define EXTRA_LOOP_ARGS                , set
 
 
index 29a452d..af1479a 100644 (file)
@@ -42,7 +42,7 @@
 #define DEFINE_FINI            0
 #define MIN_NEEDED_FROM                1
 #define MIN_NEEDED_TO          4
-#define FROM_DIRECTION         dir == from_iso646
+#define FROM_DIRECTION         (dir == from_iso646)
 #define PREPARE_LOOP \
   enum direction dir = ((struct iso646_data *) step->data)->dir;             \
   enum variant var = ((struct iso646_data *) step->data)->var;