aboutsummaryrefslogtreecommitdiff
path: root/iconvdata
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-12-02 22:39:58 +0000
committerUlrich Drepper <drepper@redhat.com>2002-12-02 22:39:58 +0000
commitf9ad060c7acbfd46d0a207c2da40999f8e6d4420 (patch)
tree6806c7540ab407d418a0d6d9650c9b818b24e32f /iconvdata
parentbfa934e76ae3cac505610447071984b4bc4c49f5 (diff)
downloadglibc-f9ad060c7acbfd46d0a207c2da40999f8e6d4420.tar.xz
glibc-f9ad060c7acbfd46d0a207c2da40999f8e6d4420.zip
Update.
2002-11-30 Bruno Haible <bruno@clisp.org> * iconv/gconv.h (__gconv_btowc_fct): New typedef. (struct __gconv_step): New field __btowc_fct. * wcsmbs/btowc.c (__btowc): Use the __btowc_fct shortcut if possible. * iconv/gconv_int.h (__BUILTIN_TRANSFORM): Renamed from __BUILTIN_TRANS. (__gconv_btwoc_ascii): New declaration. * iconv/gconv_simple.c (BUILTIN_TRANSFORMATION): Add BtowcFct argument. (__gconv_btwoc_ascii): New function. * iconv/gconv_builtin.h: Add BtowcFct argument to all BUILTIN_TRANSFORMATION invocations. * iconv/gconv_conf.c (BUILTIN_TRANSFORMATION): Add BtowcFct argument. * iconv/iconvconfig.c (BUILTIN_TRANSFORMATION): Likewise. * iconv/gconv_builtin.c (map): New field btowc_fct. (BUILTIN_TRANSFORMATION): Add BtowcFct argument. Use it to initialize btowc_fct field. (__gconv_get_builtin_trans): Initialize __btowc_fct field. * iconv/gconv_cache.c (find_module): Initialize __btowc_fct field. * iconv/gconv_db.c (gen_steps, increment_counter): Likewise. * wcsmbs/wcsmbsload.c (to_wc, to_mb): Likewise. * iconv/skeleton.c: Document STORE_REST and FROM_ONEBYTE. (gconv_init): Initialize __btowc_fct field. Undefine EXTRA_LOOP_ARGS and FROM_ONEBYTE at the end. * iconv/loop.c: Document ONEBYTE_BODY. (gconv_btowc, FROM_ONEBYTE): Define if ONEBYTE_BODY is defined. Undefine ONEBYTE_BODY at the end. * iconvdata/8bit-generic.c (ONEBYTE_BODY): New macro. * iconvdata/8bit-gap.c (NONNUL): New macro. (BODY for FROM_LOOP): Use it. (ONEBYTE_BODY): New macro. * iconvdata/isiri-3342.c (HAS_HOLES): Set to 1. (NONNUL): New macro. * iconvdata/ansi_x3.110.c (ONEBYTE_BODY): New macro. * iconvdata/armscii-8.c (ONEBYTE_BODY): New macro. * iconvdata/cp1255.c (ONEBYTE_BODY): New macro. * iconvdata/cp1258.c (ONEBYTE_BODY): New macro. * iconvdata/tcvn5712-1.c (ONEBYTE_BODY): New macro. * iconvdata/big5.c (ONEBYTE_BODY): New macro. * iconvdata/big5hkscs.c (ONEBYTE_BODY): New macro. * iconvdata/euc-cn.c (ONEBYTE_BODY): New macro. * iconvdata/euc-jp.c (ONEBYTE_BODY): New macro. * iconvdata/euc-jisx0213.c (ONEBYTE_BODY): New macro. * iconvdata/euc-kr.c (ONEBYTE_BODY): New macro. * iconvdata/euc-tw.c (ONEBYTE_BODY): New macro. * iconvdata/gbk.c (ONEBYTE_BODY): New macro. * iconvdata/gb18030.c (ONEBYTE_BODY): New macro. * iconvdata/ibm932.c: Include <stdbool.h>. (TRUE, FALSE): Remove macros. (BODY for FROM_LOOP): Remove unused variable rp1. (ONEBYTE_BODY): New macro. (BODY for TO_LOOP): Use bool. * iconvdata/ibm932.h (__ibm932sb_to_ucs4_idx): Remove array. * iconvdata/ibm943.c: Include <stdbool.h>. (TRUE, FALSE): Remove macros. (BODY for FROM_LOOP): Remove unused variable rp1. (ONEBYTE_BODY): New macro. (BODY for TO_LOOP): Use bool. * iconvdata/ibm943.h (__ibm943sb_to_ucs4_idx): Remove array. * iconvdata/iso8859-1.c (ONEBYTE_BODY): New macro. * iconvdata/iso_6937-2.c (ONEBYTE_BODY): New macro. * iconvdata/iso_6937.c (ONEBYTE_BODY): New macro. * iconvdata/johab.c (ONEBYTE_BODY): New macro. * iconvdata/sjis.c (ONEBYTE_BODY): New macro. * iconvdata/shift_jisx0213.c (ONEBYTE_BODY): New macro. * iconvdata/t.61.c (ONEBYTE_BODY): New macro. * iconvdata/uhc.c (ONEBYTE_BODY): New macro. * iconvdata/gbbig5.c: Tweak comment.
Diffstat (limited to 'iconvdata')
-rw-r--r--iconvdata/8bit-gap.c15
-rw-r--r--iconvdata/8bit-generic.c9
-rw-r--r--iconvdata/ansi_x3.110.c11
-rw-r--r--iconvdata/armscii-8.c11
-rw-r--r--iconvdata/big5.c9
-rw-r--r--iconvdata/big5hkscs.c9
-rw-r--r--iconvdata/cp1255.c9
-rw-r--r--iconvdata/cp1258.c16
-rw-r--r--iconvdata/euc-cn.c9
-rw-r--r--iconvdata/euc-jisx0213.c7
-rw-r--r--iconvdata/euc-jp.c7
-rw-r--r--iconvdata/euc-kr.c9
-rw-r--r--iconvdata/euc-tw.c7
-rw-r--r--iconvdata/gb18030.c7
-rw-r--r--iconvdata/gbbig5.c4
-rw-r--r--iconvdata/gbk.c9
-rw-r--r--iconvdata/ibm932.c59
-rw-r--r--iconvdata/ibm932.h8
-rw-r--r--iconvdata/ibm943.c60
-rw-r--r--iconvdata/ibm943.h8
-rw-r--r--iconvdata/isiri-3342.c7
-rw-r--r--iconvdata/iso8859-1.c4
-rw-r--r--iconvdata/iso_6937-2.c9
-rw-r--r--iconvdata/iso_6937.c9
-rw-r--r--iconvdata/johab.c7
-rw-r--r--iconvdata/shift_jisx0213.c14
-rw-r--r--iconvdata/sjis.c14
-rw-r--r--iconvdata/t.61.c9
-rw-r--r--iconvdata/tcvn5712-1.c14
-rw-r--r--iconvdata/uhc.c9
30 files changed, 292 insertions, 87 deletions
diff --git a/iconvdata/8bit-gap.c b/iconvdata/8bit-gap.c
index 2ddc49eb64..9d48d170ba 100644
--- a/iconvdata/8bit-gap.c
+++ b/iconvdata/8bit-gap.c
@@ -32,6 +32,10 @@ struct gap
/* Now we can include the tables. */
#include TABLES
+#ifndef NONNUL
+# define NONNUL(c) ((c) != '\0')
+#endif
+
#define FROM_LOOP from_gap
#define TO_LOOP to_gap
@@ -49,7 +53,7 @@ struct gap
{ \
uint32_t ch = to_ucs4[*inptr]; \
\
- if (HAS_HOLES && __builtin_expect (ch, L'\1') == L'\0' && *inptr != '\0') \
+ if (HAS_HOLES && __builtin_expect (ch == L'\0', 0) && NONNUL (*inptr)) \
{ \
/* This is an illegal character. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
@@ -63,6 +67,15 @@ struct gap
++inptr; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ uint32_t ch = to_ucs4[c]; \
+ \
+ if (HAS_HOLES && __builtin_expect (ch == L'\0', 0) && NONNUL (c)) \
+ return WEOF; \
+ else \
+ return ch; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/8bit-generic.c b/iconvdata/8bit-generic.c
index 6ed5532693..373289f84d 100644
--- a/iconvdata/8bit-generic.c
+++ b/iconvdata/8bit-generic.c
@@ -47,6 +47,15 @@
++inptr; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ uint32_t ch = to_ucs4[c]; \
+ \
+ if (HAS_HOLES && __builtin_expect (ch == L'\0', 0) && c != '\0') \
+ return WEOF; \
+ else \
+ return ch; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/ansi_x3.110.c b/iconvdata/ansi_x3.110.c
index 08746cf5f7..b20e12a79c 100644
--- a/iconvdata/ansi_x3.110.c
+++ b/iconvdata/ansi_x3.110.c
@@ -404,7 +404,7 @@ static const char from_ucs4[][2] =
\
if (__builtin_expect (ch >= 0xc1, 0) && ch <= 0xcf) \
{ \
- /* Composed character. First test whether the next character \
+ /* Composed character. First test whether the next byte \
is also available. */ \
uint32_t ch2; \
\
@@ -449,6 +449,15 @@ static const char from_ucs4[][2] =
inptr += incr; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ uint32_t ch = to_ucs4[c]; \
+ \
+ if (__builtin_expect (ch == 0, 0) && c != '\0') \
+ return WEOF; \
+ else \
+ return ch; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/armscii-8.c b/iconvdata/armscii-8.c
index b3db9a99a8..dbaf8be2ee 100644
--- a/iconvdata/armscii-8.c
+++ b/iconvdata/armscii-8.c
@@ -71,6 +71,17 @@ static const uint16_t map_from_armscii_8[0xfe - 0xa2 + 1] =
++inptr; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ if (c <= 0xa0) \
+ /* Upto and including 0xa0 the ARMSCII-8 corresponds to Unicode. */ \
+ return c; \
+ else if (c >= 0xa2 && c <= 0xfe) \
+ /* Use the table. */ \
+ return map_from_armscii_8[c - 0xa2]; \
+ else \
+ return WEOF; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/big5.c b/iconvdata/big5.c
index 22c3ab6ddd..cdf8a76c5d 100644
--- a/iconvdata/big5.c
+++ b/iconvdata/big5.c
@@ -8397,7 +8397,7 @@ static const char from_ucs4_tab15[][2] =
\
if (ch >= 0xa1 && ch <= 0xf9) \
{ \
- /* Two-byte character. First test whether the next character \
+ /* Two-byte character. First test whether the next byte \
is also available. */ \
uint32_t ch2; \
int idx; \
@@ -8447,6 +8447,13 @@ static const char from_ucs4_tab15[][2] =
outptr += 4; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ if (c <= 0x80) \
+ return c; \
+ else \
+ return WEOF; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/big5hkscs.c b/iconvdata/big5hkscs.c
index 0903968669..b1aedd171b 100644
--- a/iconvdata/big5hkscs.c
+++ b/iconvdata/big5hkscs.c
@@ -16817,7 +16817,7 @@ static struct
\
if (ch >= 0x81 && ch <= 0xfe) \
{ \
- /* Two-byte character. First test whether the next character \
+ /* Two-byte character. First test whether the next byte \
is also available. */ \
uint32_t ch2; \
int idx; \
@@ -16852,6 +16852,13 @@ static struct
outptr += 4; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ if (c <= 0x80) \
+ return c; \
+ else \
+ return WEOF; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/cp1255.c b/iconvdata/cp1255.c
index 19edb27a66..6cccf526e6 100644
--- a/iconvdata/cp1255.c
+++ b/iconvdata/cp1255.c
@@ -321,6 +321,15 @@ static const struct { unsigned int idx; unsigned int len; } comp_table[8] = {
}
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS , int *statep
+#define ONEBYTE_BODY \
+ { \
+ if (c < 0x80) \
+ return c; \
+ uint32_t ch = to_ucs4[c - 0x80]; \
+ if (ch == L'\0' || (ch >= 0x05d0 && ch <= 0x05f2)) \
+ return WEOF; \
+ return ch; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/cp1258.c b/iconvdata/cp1258.c
index 853ef63531..553d50b443 100644
--- a/iconvdata/cp1258.c
+++ b/iconvdata/cp1258.c
@@ -480,6 +480,22 @@ static const struct
}
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS , int *statep
+#define ONEBYTE_BODY \
+ { \
+ uint32_t ch; \
+ \
+ if (c < 0x80) \
+ ch = c; \
+ else \
+ { \
+ ch = to_ucs4[c - 0x80]; \
+ if (ch == L'\0') \
+ return WEOF; \
+ } \
+ if (ch >= 0x0041 && ch <= 0x01b0) \
+ return WEOF; \
+ return ch; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/euc-cn.c b/iconvdata/euc-cn.c
index c1bcadb35b..f912317876 100644
--- a/iconvdata/euc-cn.c
+++ b/iconvdata/euc-cn.c
@@ -54,7 +54,7 @@
else \
{ \
/* Two or more byte character. First test whether the \
- next character is also available. */ \
+ next byte is also available. */ \
const unsigned char *endp; \
\
if (__builtin_expect (inptr + 1 >= inend, 0)) \
@@ -88,6 +88,13 @@
outptr += 4; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ if (c < 0x80) \
+ return c; \
+ else \
+ return WEOF; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/euc-jisx0213.c b/iconvdata/euc-jisx0213.c
index 733cbc15ee..dc6ccfd0cc 100644
--- a/iconvdata/euc-jisx0213.c
+++ b/iconvdata/euc-jisx0213.c
@@ -230,6 +230,13 @@
}
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS , int *statep
+#define ONEBYTE_BODY \
+ { \
+ if (c < 0x80) \
+ return c; \
+ else \
+ return WEOF; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/euc-jp.c b/iconvdata/euc-jp.c
index 7faa080322..9cb6a47040 100644
--- a/iconvdata/euc-jp.c
+++ b/iconvdata/euc-jp.c
@@ -117,6 +117,13 @@
put32 (outptr, ch); \
outptr += 4; \
}
+#define ONEBYTE_BODY \
+ { \
+ if (c < 0x8e || (c >= 0x90 && c <= 0x9f)) \
+ return c; \
+ else \
+ return WEOF; \
+ }
#define LOOP_NEED_FLAGS
#include <iconv/loop.c>
diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c
index 37ed71fd60..7774720bd6 100644
--- a/iconvdata/euc-kr.c
+++ b/iconvdata/euc-kr.c
@@ -90,7 +90,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
} \
else \
{ \
- /* Two-byte character. First test whether the next character \
+ /* Two-byte character. First test whether the next byte \
is also available. */ \
ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0x80); \
if (__builtin_expect (ch == 0, 0)) \
@@ -108,6 +108,13 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
outptr += 4; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ if (c <= 0x9f) \
+ return c; \
+ else \
+ return WEOF; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/euc-tw.c b/iconvdata/euc-tw.c
index 8d3b1aa1b5..6674dad397 100644
--- a/iconvdata/euc-tw.c
+++ b/iconvdata/euc-tw.c
@@ -112,6 +112,13 @@
outptr += 4; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ if (c < 0x80) \
+ return c; \
+ else \
+ return WEOF; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/gb18030.c b/iconvdata/gb18030.c
index f6b3576416..31f3c20939 100644
--- a/iconvdata/gb18030.c
+++ b/iconvdata/gb18030.c
@@ -25772,6 +25772,13 @@ static const unsigned char __ucs_to_gb18030_tab2[8192][2] =
*((uint32_t *) outptr)++ = ch; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ if (c < 0x80) \
+ return c; \
+ else \
+ return WEOF; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/gbbig5.c b/iconvdata/gbbig5.c
index 695ffb2c07..b2b4743e24 100644
--- a/iconvdata/gbbig5.c
+++ b/iconvdata/gbbig5.c
@@ -4802,7 +4802,7 @@ const char __from_big5_to_gb2312 [13973][2] =
else if (ch >= 0xa1 && ch <= 0xf7) \
{ \
/* Two-byte character. First test whether the \
- next character is also available. */ \
+ next byte is also available. */ \
const char *cp; \
int idx; \
\
@@ -4891,7 +4891,7 @@ const char __from_big5_to_gb2312 [13973][2] =
else if (ch >= 0xa1 && ch <= 0xf9) \
{ \
/* Two byte character. First test whether the \
- next character is also available. */ \
+ next byte is also available. */ \
const char *cp; \
int idx; \
\
diff --git a/iconvdata/gbk.c b/iconvdata/gbk.c
index a738a9eb9d..ad8a37412a 100644
--- a/iconvdata/gbk.c
+++ b/iconvdata/gbk.c
@@ -13154,7 +13154,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
else \
{ \
/* Two or more byte character. First test whether the \
- next character is also available. */ \
+ next byte is also available. */ \
uint32_t ch2; \
int idx; \
\
@@ -13195,6 +13195,13 @@ static const char __gbk_from_ucs4_tab12[][2] =
outptr += 4; \
}
#define LOOP_NEED_FLAGS
+#define ONEBYTE_BODY \
+ { \
+ if (c < 0x80) \
+ return c; \
+ else \
+ return WEOF; \
+ }
#include <iconv/loop.c>
diff --git a/iconvdata/ibm932.c b/iconvdata/ibm932.c
index 1e87067fef..420b19ab80 100644
--- a/iconvdata/ibm932.c
+++ b/iconvdata/ibm932.c
@@ -20,13 +20,9 @@
#include <dlfcn.h>
#include <stdint.h>
+#include <stdbool.h>
#include "ibm932.h"
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
#define FROM 0
#define TO 1
@@ -50,38 +46,24 @@
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
- const struct gap *rp1 = __ibm932sb_to_ucs4_idx; \
const struct gap *rp2 = __ibm932db_to_ucs4_idx; \
uint32_t ch = *inptr; \
uint32_t res; \
\
- if (__builtin_expect (ch >= 0xffff, 0)) \
- { \
- rp1 = NULL; \