diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-08-02 22:33:57 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-08-02 22:33:57 +0000 |
commit | 5d32be9a0a5489d9274de87b3657b1e16e27ef3f (patch) | |
tree | 3548f254c276ead1792229961bfc3306fb98ac1c /iconvdata/iso-2022-jp-3.c | |
parent | f95bb511f47cf3e35f1aa7b4621cabb150d40ae4 (diff) | |
download | glibc-5d32be9a0a5489d9274de87b3657b1e16e27ef3f.zip glibc-5d32be9a0a5489d9274de87b3657b1e16e27ef3f.tar.gz glibc-5d32be9a0a5489d9274de87b3657b1e16e27ef3f.tar.bz2 |
Update.
2004-08-02 Jakub Jelinek <jakub@redhat.com>
* iconvdata/ibm932.c (BODY): Avoid binary search for ch >= 0xffff.
Always treat high as highest number in range + 1.
* iconvdata/ibm943.c (BODY): Likewise.
2004-07-31 Bruno Haible <bruno@clisp.org>
* iconvdata/JISX0213.TXT: Updated to JISX0213 plane 1 version 2004.
* iconvdata/jisx0213.c (__jisx0213_to_ucs_main,
__jisx0213_to_ucs_pagestart, __jisx0213_from_ucs_level1,
__jisx0213_from_ucs_level2): Regenerated.
* iconvdata/jisx0213.h (jisx0213_added_in_2004_p): New function.
* iconvdata/iso-2022-jp-3.c (JISX0213_1_2000_set): Renamed from
JISX0213_1_set.
(JISX0213_1_2004_set): New enum value.
(BODY for FROM_LOOP): Treat ESC $ ( Q like ESC $ ( O.
(BODY for TO_LOOP): For JISX 0213 plane 1 characters, emit ESC $ ( O
when possible, ESC $ ( Q when needed.
* iconvdata/testdata/EUC-JISX0213: Add the 10 new characters.
* iconvdata/testdata/EUC-JISX0213..UTF8: Update.
* iconvdata/testdata/SHIFT_JISX0213: Add the 10 new characters.
* iconvdata/testdata/SHIFT_JISX0213..UTF8: Update.
* iconvdata/testdata/ISO-2022-JP-3: Add the 10 new JISX0213 characters.
* iconvdata/testdata/ISO-2022-JP-3..UTF8: Update.
2004-07-22 Bruno Haible <bruno@clisp.org>
* iconvdata/gconv-modules (ISO-8859-7): Add alias ISO_8859-7:2003.
Diffstat (limited to 'iconvdata/iso-2022-jp-3.c')
-rw-r--r-- | iconvdata/iso-2022-jp-3.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/iconvdata/iso-2022-jp-3.c b/iconvdata/iso-2022-jp-3.c index 2704a17..bbccc2e 100644 --- a/iconvdata/iso-2022-jp-3.c +++ b/iconvdata/iso-2022-jp-3.c @@ -1,5 +1,5 @@ /* Conversion module for ISO-2022-JP-3. - Copyright (C) 1998-1999, 2000-2002 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2000-2002, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998, and Bruno Haible <bruno@clisp.org>, 2002. @@ -61,8 +61,9 @@ enum JISX0208_1983_set = 2 << 3, /* Esc $ B */ JISX0201_Roman_set = 3 << 3, /* Esc ( J */ JISX0201_Kana_set = 4 << 3, /* Esc ( I */ - JISX0213_1_set = 5 << 3, /* Esc $ ( O */ + JISX0213_1_2000_set = 5 << 3, /* Esc $ ( O */ JISX0213_2_set = 6 << 3, /* Esc $ ( P */ + JISX0213_1_2004_set = 7 << 3, /* Esc $ ( Q */ CURRENT_SEL_MASK = 7 << 3 }; @@ -211,10 +212,12 @@ enum } \ else if (inptr[2] == '(') \ { \ - if (inptr[3] == 'O') \ + if (inptr[3] == 'O' || inptr[3] == 'Q') \ { \ /* JIS X 0213 plane 1 selected. */ \ - set = JISX0213_1_set; \ + /* In this direction we don't need to distinguish the \ + versions from 2000 and 2004. */ \ + set = JISX0213_1_2004_set; \ inptr += 4; \ continue; \ } \ @@ -274,7 +277,7 @@ enum STANDARD_FROM_LOOP_ERR_HANDLER (1); \ } \ } \ - else /* (set == JISX0213_1_set || set == JISX0213_2_set) */ \ + else /* (set == JISX0213_1_2004_set || set == JISX0213_2_set) */ \ { \ if (__builtin_expect (inptr + 1 >= inend, 0)) \ { \ @@ -282,8 +285,9 @@ enum break; \ } \ \ - ch = jisx0213_to_ucs4 (((set - JISX0213_1_set + (1 << 3)) << 5) + ch, \ - inptr[1]); \ + ch = jisx0213_to_ucs4 ( \ + ((JISX0213_1_2004_set - set + (1 << 3)) << 5) + ch, \ + inptr[1]); \ if (ch == 0) \ STANDARD_FROM_LOOP_ERR_HANDLER (1); \ \ @@ -408,7 +412,10 @@ static const struct /* We know the combined character is in JISX0213 plane 1, \ but the buffered character may have been in JISX0208 or in \ JISX0213 plane 1. */ \ - size_t need = (lasttwo >> 16 || set != JISX0213_1_set ? 4 : 0); \ + size_t need = \ + (lasttwo >> 16 \ + || (set != JISX0213_1_2000_set && set != JISX0213_1_2004_set) \ + ? 4 : 0); \ \ if (__builtin_expect (outptr + need + 2 > outend, 0)) \ { \ @@ -422,7 +429,7 @@ static const struct *outptr++ = '$'; \ *outptr++ = '('; \ *outptr++ = 'O'; \ - set = JISX0213_1_set; \ + set = JISX0213_1_2000_set; \ } \ lasttwo = comp_table_data[idx].composed; \ *outptr++ = (lasttwo >> 8) & 0xff; \ @@ -529,11 +536,16 @@ static const struct } \ else \ { \ - /* (set == JISX0213_1_set || set == JISX0213_2_set) */ \ + /* (set == JISX0213_1_2000_set || set == JISX0213_1_2004_set \ + || set == JISX0213_2_set) */ \ uint32_t jch = ucs4_to_jisx0213 (ch); \ \ if (jch != 0 \ - && (set == (jch & 0x8000 ? JISX0213_2_set : JISX0213_1_set))) \ + && (jch & 0x8000 \ + ? set == JISX0213_2_set \ + : (set == JISX0213_1_2004_set \ + || (set == JISX0213_1_2000_set \ + && !jisx0213_added_in_2004_p (jch))))) \ { \ if (jch & 0x0080) \ { \ @@ -658,7 +670,11 @@ static const struct if (jch != 0) \ { \ int new_set = \ - (jch & 0x8000 ? JISX0213_2_set : JISX0213_1_set); \ + (jch & 0x8000 \ + ? JISX0213_2_set \ + : jisx0213_added_in_2004_p (jch) \ + ? JISX0213_1_2004_set \ + : JISX0213_1_2000_set); \ \ if (set != new_set) \ { \ @@ -670,7 +686,8 @@ static const struct *outptr++ = ESC; \ *outptr++ = '$'; \ *outptr++ = '('; \ - *outptr++ = ((new_set - JISX0213_1_set) >> 3) + 'O'; \ + *outptr++ = \ + ((new_set - JISX0213_1_2000_set) >> 3) + 'O'; \ set = new_set; \ } \ \ |