Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
2002-04-18  Bruno Haible  <bruno@clisp.org>

	* iconvdata/euc-jisx0213.c (EMIT_SHIFT_TO_INIT, BODY for
	FROM_DIRECTION): Make the FROM direction stateless.
	* iconvdata/shift_jisx0213.c (EMIT_SHIFT_TO_INIT, BODY for
	FROM_DIRECTION): Likewise.

	* iconvdata/cvs11643l1.c: Update comments.
	* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list: Likewise.
  • Loading branch information
Ulrich Drepper committed Apr 20, 2002
1 parent 93a568a commit 02779ea
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 236 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
2002-04-18 Bruno Haible <bruno@clisp.org>

* iconvdata/euc-jisx0213.c (EMIT_SHIFT_TO_INIT, BODY for
FROM_DIRECTION): Make the FROM direction stateless.
* iconvdata/shift_jisx0213.c (EMIT_SHIFT_TO_INIT, BODY for
FROM_DIRECTION): Likewise.

2002-04-15 Bruno Haible <bruno@clisp.org>

* iconvdata/JISX0213.TXT: New file.
Expand Down Expand Up @@ -45,6 +52,7 @@
(__cns11643l2*_to_ucs4_tab, __cns11643_from_ucs4p0_tab,
__cns11643_from_ucs4p2_tab): Regenerated.
(__cns11643_from_ucs4p2c_tab): New array.
* iconvdata/cvs11643l1.c: Update comments.
* iconvdata/EUC-TW.irreversible: Remove two entries.

2002-04-15 Bruno Haible <bruno@clisp.org>
Expand Down Expand Up @@ -96,6 +104,7 @@
* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.

Expand Down
3 changes: 3 additions & 0 deletions NEWS
Expand Up @@ -28,6 +28,9 @@ Version 2.3

* Isamu Hasegawa contributed a completely new and POSIX conforming
implementation of regex.

* Bruno Haible upgraded the iconv and locale implementation to support
Unicode 3.2.

Version 2.2.5

Expand Down
2 changes: 2 additions & 0 deletions iconvdata/SHIFT_JISX0213.irreversible
@@ -0,0 +1,2 @@
0x5C 0x005C
0x7E 0x007E
6 changes: 3 additions & 3 deletions iconvdata/cns11643l1.c
@@ -1,5 +1,5 @@
/* Mapping tables for CNS 11643, plane 1 handling.
Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
Expand All @@ -20,9 +20,9 @@

#include <stdint.h>

/* To generate a Unicode 3.1 CNS11643.TXT, take
/* To generate a Unicode 3.2 CNS11643.TXT, take
http://www.unicode.org/Public/Mappings/EASTASIA/OTHER/CNS11643.TXT
and add the following lines (see Unicode 3.1 UNIHAN.TXT):
and add the following lines (see Unicode 3.2 UNIHAN.TXT):
0x12728 0x4EA0 # <CJK Ideograph>
0x1272F 0x51AB # <CJK Ideograph>
0x12734 0x52F9 # <CJK Ideograph>
Expand Down
204 changes: 93 additions & 111 deletions iconvdata/euc-jisx0213.c
Expand Up @@ -62,9 +62,7 @@
*statep = saved_state


/* During EUC-JISX0213 to UCS-4 conversion, the COUNT element of the state
contains the last UCS-4 character, shifted by 3 bits.
During UCS-4 to EUC-JISX0213 conversion, the COUNT element of the state
/* During UCS-4 to EUC-JISX0213 conversion, the COUNT element of the state
contains the last two bytes to be output, shifted by 3 bits. */

/* Since this is a stateful encoding we have to provide code which resets
Expand All @@ -74,17 +72,8 @@
if (data->__statep->__count != 0) \
{ \
if (FROM_DIRECTION) \
{ \
if (__builtin_expect (outbuf + 4 <= outend, 1)) \
{ \
/* Write out the last character. */ \
*((uint32_t *) outbuf)++ = data->__statep->__count >> 3; \
data->__statep->__count = 0; \
} \
else \
/* We don't have enough room in the output buffer. */ \
status = __GCONV_FULL_OUTPUT; \
} \
/* We don't use shift states in the FROM_DIRECTION. */ \
data->__statep->__count = 0; \
else \
{ \
if (__builtin_expect (outbuf + 2 <= outend, 1)) \
Expand All @@ -109,33 +98,44 @@
#define LOOPFCT FROM_LOOP
#define BODY \
{ \
uint32_t ch; \
uint32_t ch = *inptr; \
\
/* Determine whether there is a buffered character pending. */ \
ch = *statep >> 3; \
if (__builtin_expect (ch == 0, 1)) \
if (ch < 0x80) \
/* Plain ASCII character. */ \
++inptr; \
else if ((ch >= 0xa1 && ch <= 0xfe) || ch == 0x8e || ch == 0x8f) \
{ \
/* No - so look at the next input byte. */ \
ch = *inptr; \
if (ch < 0x80) \
/* Plain ASCII character. */ \
++inptr; \
else if ((ch >= 0xa1 && ch <= 0xfe) || ch == 0x8e || ch == 0x8f) \
/* Two or three byte character. */ \
uint32_t ch2; \
\
if (__builtin_expect (inptr + 1 >= inend, 0)) \
{ \
/* Two or three byte character. */ \
uint32_t ch2; \
/* The second byte is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
\
ch2 = inptr[1]; \
\
if (__builtin_expect (inptr + 1 >= inend, 0)) \
/* The second byte must be >= 0xa1 and <= 0xfe. */ \
if (__builtin_expect (ch2 < 0xa1 || ch2 > 0xfe, 0)) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
{ \
/* The second byte is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
result = __GCONV_ILLEGAL_INPUT; \
break; \
} \
\
ch2 = inptr[1]; \
++inptr; \
++*irreversible; \
break; \
} \
\
/* The second byte must be >= 0xa1 and <= 0xfe. */ \
if (__builtin_expect (ch2 < 0xa1 || ch2 > 0xfe, 0)) \
if (ch == 0x8e) \
{ \
/* Half-width katakana. */ \
if (__builtin_expect (ch2 > 0xdf, 0)) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
Expand All @@ -149,107 +149,89 @@
break; \
} \
\
if (ch == 0x8e) \
ch = ch2 + 0xfec0; \
inptr += 2; \
} \
else \
{ \
const unsigned char *endp; \
\
if (ch == 0x8f) \
{ \
/* Half-width katakana. */ \
if (__builtin_expect (ch2 > 0xdf, 0)) \
/* JISX 0213 plane 2. */ \
uint32_t ch3; \
\
if (__builtin_expect (inptr + 2 >= inend, 0)) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
{ \
result = __GCONV_ILLEGAL_INPUT; \
break; \
} \
\
++inptr; \
++*irreversible; \
/* The third byte is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
\
ch = ch2 + 0xfec0; \
inptr += 2; \
ch3 = inptr[2]; \
endp = inptr + 3; \
\
ch = jisx0213_to_ucs4 (0x200 - 0x80 + ch2, ch3 ^ 0x80); \
} \
else \
{ \
const unsigned char *endp; \
/* JISX 0213 plane 1. */ \
endp = inptr + 2; \
\
if (ch == 0x8f) \
{ \
/* JISX 0213 plane 2. */ \
uint32_t ch3; \
ch = jisx0213_to_ucs4 (0x100 - 0x80 + ch, ch2 ^ 0x80); \
} \
\
if (__builtin_expect (inptr + 2 >= inend, 0)) \
{ \
/* The third byte is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
if (ch == 0) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
{ \
result = __GCONV_ILLEGAL_INPUT; \
break; \
} \
\
ch3 = inptr[2]; \
endp = inptr + 3; \
++inptr; \
++*irreversible; \
break; \
} \
\
ch = jisx0213_to_ucs4 (0x200 - 0x80 + ch2, ch3 ^ 0x80); \
} \
else \
{ \
/* JISX 0213 plane 1. */ \
endp = inptr + 2; \
inptr = endp; \
\
ch = jisx0213_to_ucs4 (0x100 - 0x80 + ch, ch2 ^ 0x80); \
} \
if (ch < 0x80) \
{ \
/* It's a combining character. */ \
uint32_t u1 = __jisx0213_to_ucs_combining[ch - 1][0]; \
uint32_t u2 = __jisx0213_to_ucs_combining[ch - 1][1]; \
\
if (ch == 0) \
/* See whether we have room for two characters. */ \
if (outptr + 8 <= outend) \
{ \
/* This is an illegal character. */ \
if (! ignore_errors_p ()) \
{ \
result = __GCONV_ILLEGAL_INPUT; \
break; \
} \
\
++inptr; \
++*irreversible; \
break; \
put32 (outptr, u1); \
outptr += 4; \
put32 (outptr, u2); \
outptr += 4; \
continue; \
} \
\
inptr = endp; \
\
if (ch < 0x80) \
else \
{ \
/* It's a combining character. */ \
uint32_t u1 = __jisx0213_to_ucs_combining[ch - 1][0]; \
uint32_t u2 = __jisx0213_to_ucs_combining[ch - 1][1]; \
\
/* See whether we have room for two characters. */ \
if (outptr + 8 <= outend) \
{ \
put32 (outptr, u1); \
outptr += 4; \
put32 (outptr, u2); \
outptr += 4; \
continue; \
} \
\
/* Otherwise store only the first character now, and \
put the second one into the queue. */ \
ch = u1; \
*statep = u2 << 3; \
result = __GCONV_FULL_OUTPUT; \
break; \
} \
} \
} \
else \
} \
else \
{ \
/* This is illegal. */ \
if (! ignore_errors_p ()) \
{ \
/* This is illegal. */ \
if (! ignore_errors_p ()) \
{ \
result = __GCONV_ILLEGAL_INPUT; \
break; \
} \
\
++inptr; \
++*irreversible; \
continue; \
result = __GCONV_ILLEGAL_INPUT; \
break; \
} \
\
++inptr; \
++*irreversible; \
continue; \
} \
\
put32 (outptr, ch); \
Expand Down

0 comments on commit 02779ea

Please sign in to comment.