Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src - support for the additional code area of zh_CN.GB18030 locale,



details:   https://anonhg.NetBSD.org/src/rev/cca02b9e7393
branches:  trunk
changeset: 545327:cca02b9e7393
user:      tshiozak <tshiozak%NetBSD.org@localhost>
date:      Sun Apr 06 18:33:23 2003 +0000

description:
- support for the additional code area of zh_CN.GB18030 locale,
- make sure that __nbrune_t is unsigned 32bit clean and
- fix wrong copyright notice in the last commit.
this patch is contributed by Takehiko NOZAKI <sigsegv at s25 dot xrea dot com>.

diffstat:

 lib/libc/locale/___runetype_mb.c     |    13 +-
 lib/libc/locale/_wctrans.c           |    13 +-
 lib/libc/locale/_wctrans_local.h     |     5 +-
 lib/libc/locale/iswctype.c           |     7 +-
 lib/libc/locale/runetype.h           |     4 +-
 lib/libc/string/wcscmp.c             |     7 +-
 lib/libc/string/wcsncmp.c            |     9 +-
 lib/libc/string/wmemcmp.c            |     8 +-
 share/locale/ctype/zh_CN.GB18030.src |  8922 ++++++++++++++++++++++++++++++++-
 usr.bin/mklocale/lex.l               |    10 +-
 10 files changed, 8488 insertions(+), 510 deletions(-)

diffs (truncated from 9228 to 300 lines):

diff -r ee91204e7982 -r cca02b9e7393 lib/libc/locale/___runetype_mb.c
--- a/lib/libc/locale/___runetype_mb.c  Sun Apr 06 18:27:52 2003 +0000
+++ b/lib/libc/locale/___runetype_mb.c  Sun Apr 06 18:33:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ___runetype_mb.c,v 1.7 2003/03/04 15:09:54 yamt Exp $  */
+/*     $NetBSD: ___runetype_mb.c,v 1.8 2003/04/06 18:33:23 tshiozak Exp $      */
 
 /*-
  * Copyright (c) 1993
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: ___runetype_mb.c,v 1.7 2003/03/04 15:09:54 yamt Exp $");
+__RCSID("$NetBSD: ___runetype_mb.c,v 1.8 2003/04/06 18:33:23 tshiozak Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <wctype.h>
@@ -53,15 +53,16 @@
        _RuneRange *rr = &_CurrentRuneLocale->rl_runetype_ext;
        _RuneEntry *re = rr->rr_rune_ranges;
 
-       if (c < 0 || c == WEOF)
+       if (c == WEOF)
                return(0U);
 
        for (x = 0; x < rr->rr_nranges; ++x, ++re) {
-               if (c < re->re_min)
+               /* XXX assumes wchar_t = int */
+               if ((__nbrune_t)c < re->re_min)
                        return(0U);
-               if (c <= re->re_max) {
+               if ((__nbrune_t)c <= re->re_max) {
                        if (re->re_rune_types)
-                               return(re->re_rune_types[c - re->re_min]);
+                               return(re->re_rune_types[(__nbrune_t)c - re->re_min]);
                        else
                                return(re->re_map);
                }
diff -r ee91204e7982 -r cca02b9e7393 lib/libc/locale/_wctrans.c
--- a/lib/libc/locale/_wctrans.c        Sun Apr 06 18:27:52 2003 +0000
+++ b/lib/libc/locale/_wctrans.c        Sun Apr 06 18:33:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: _wctrans.c,v 1.3 2003/03/11 17:23:07 tshiozak Exp $    */
+/*     $NetBSD: _wctrans.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $    */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -64,7 +64,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _wctrans.c,v 1.3 2003/03/11 17:23:07 tshiozak Exp $");
+__RCSID("$NetBSD: _wctrans.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -102,14 +102,15 @@
        _RuneRange *rr = te->te_extmap;
        _RuneEntry *re = rr->rr_rune_ranges;
 
-       if (c < 0 || c == WEOF)
+       if (c == WEOF)
                return(c);
 
        for (x = 0; x < rr->rr_nranges; ++x, ++re) {
-               if (c < re->re_min)
+               /* XXX assumes wchar_t = int */
+               if ((__nbrune_t)c < re->re_min)
                        return(c);
-               if (c <= re->re_max)
-                       return(re->re_map + c - re->re_min);
+               if ((__nbrune_t)c <= re->re_max)
+                       return(re->re_map + (__nbrune_t)c - re->re_min);
        }
        return(c);
 }
diff -r ee91204e7982 -r cca02b9e7393 lib/libc/locale/_wctrans_local.h
--- a/lib/libc/locale/_wctrans_local.h  Sun Apr 06 18:27:52 2003 +0000
+++ b/lib/libc/locale/_wctrans_local.h  Sun Apr 06 18:33:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: _wctrans_local.h,v 1.1 2003/03/02 22:18:14 tshiozak Exp $      */
+/*     $NetBSD: _wctrans_local.h,v 1.2 2003/04/06 18:33:23 tshiozak Exp $      */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -35,7 +35,8 @@
 static __inline wint_t
 _towctrans(wint_t c, _WCTransEntry *te)
 {
-       return (_RUNE_ISCACHED(c) ? te->te_cached[c]:_towctrans_ext(c, te));
+       return (_RUNE_ISCACHED(c) ?
+               te->te_cached[(__nbrune_t)c]:_towctrans_ext(c, te));
 }
 
 static __inline struct _WCTransEntry *
diff -r ee91204e7982 -r cca02b9e7393 lib/libc/locale/iswctype.c
--- a/lib/libc/locale/iswctype.c        Sun Apr 06 18:27:52 2003 +0000
+++ b/lib/libc/locale/iswctype.c        Sun Apr 06 18:33:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iswctype.c,v 1.12 2003/03/21 13:48:53 scw Exp $        */
+/*     $NetBSD: iswctype.c,v 1.13 2003/04/06 18:33:23 tshiozak Exp $   */
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: iswctype.c,v 1.12 2003/03/21 13:48:53 scw Exp $");
+__RCSID("$NetBSD: iswctype.c,v 1.13 2003/04/06 18:33:23 tshiozak Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -70,7 +70,8 @@
 {
        _RuneLocale *rl = _CurrentRuneLocale;
 
-       return (_RUNE_ISCACHED(c) ? rl->rl_runetype[c] : ___runetype_mb(c));
+       return (_RUNE_ISCACHED(c) ?
+               rl->rl_runetype[c] : ___runetype_mb(c));
 }
 
 static __inline int
diff -r ee91204e7982 -r cca02b9e7393 lib/libc/locale/runetype.h
--- a/lib/libc/locale/runetype.h        Sun Apr 06 18:27:52 2003 +0000
+++ b/lib/libc/locale/runetype.h        Sun Apr 06 18:33:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: runetype.h,v 1.16 2003/03/11 17:23:07 tshiozak Exp $   */
+/*     $NetBSD: runetype.h,v 1.17 2003/04/06 18:33:23 tshiozak Exp $   */
 
 /*-
  * Copyright (c) 1993
@@ -50,7 +50,7 @@
 #define UINT32_C(c) ((uint32_t)(c##U))
 #endif
 
-typedef int32_t                __nbrune_t;
+typedef uint32_t       __nbrune_t;
 typedef uint64_t       __runepad_t;
 
 #define        _NB_CACHED_RUNES        (1 << 8)        /* Must be a power of 2 */
diff -r ee91204e7982 -r cca02b9e7393 lib/libc/string/wcscmp.c
--- a/lib/libc/string/wcscmp.c  Sun Apr 06 18:27:52 2003 +0000
+++ b/lib/libc/string/wcscmp.c  Sun Apr 06 18:33:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wcscmp.c,v 1.3 2001/01/05 12:13:12 itojun Exp $        */
+/*     $NetBSD: wcscmp.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $      */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -41,12 +41,13 @@
 #if 0
 static char sccsid[] = "@(#)strcmp.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: wcscmp.c,v 1.3 2001/01/05 12:13:12 itojun Exp $");
+__RCSID("$NetBSD: wcscmp.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
 #include <wchar.h>
+#include "locale/runetype.h"
 
 /*
  * Compare strings.
@@ -63,5 +64,5 @@
                if (*s1++ == 0)
                        return (0);
        /* XXX assumes wchar_t = int */
-       return (*(const unsigned int *)s1 - *(const unsigned int *)--s2);
+       return (*(const __nbrune_t *)s1 - *(const __nbrune_t *)--s2);
 }
diff -r ee91204e7982 -r cca02b9e7393 lib/libc/string/wcsncmp.c
--- a/lib/libc/string/wcsncmp.c Sun Apr 06 18:27:52 2003 +0000
+++ b/lib/libc/string/wcsncmp.c Sun Apr 06 18:33:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wcsncmp.c,v 1.3 2001/01/05 12:13:13 itojun Exp $       */
+/*     $NetBSD: wcsncmp.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $     */
 
 /*
  * Copyright (c) 1989, 1993
@@ -38,12 +38,13 @@
 #if 0
 static char sccsid[] = "@(#)strncmp.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: wcsncmp.c,v 1.3 2001/01/05 12:13:13 itojun Exp $");
+__RCSID("$NetBSD: wcsncmp.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
 #include <wchar.h>
+#include "locale/runetype.h"
 
 int
 wcsncmp(s1, s2, n)
@@ -59,8 +60,8 @@
        do {
                if (*s1 != *s2++) {
                        /* XXX assumes wchar_t = int */
-                       return (*(const unsigned int *)s1 -
-                           *(const unsigned int *)--s2);
+                       return (*(const __nbrune_t *)s1 -
+                           *(const __nbrune_t *)--s2);
                }
                if (*s1++ == 0)
                        break;
diff -r ee91204e7982 -r cca02b9e7393 lib/libc/string/wmemcmp.c
--- a/lib/libc/string/wmemcmp.c Sun Apr 06 18:27:52 2003 +0000
+++ b/lib/libc/string/wmemcmp.c Sun Apr 06 18:33:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wmemcmp.c,v 1.2 2001/01/03 14:29:37 lukem Exp $        */
+/*     $NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $     */
 
 /*-
  * Copyright (c)1999 Citrus Project,
@@ -30,11 +30,12 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wmemcmp.c,v 1.2 2001/01/03 14:29:37 lukem Exp $");
+__RCSID("$NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
 #include <wchar.h>
+#include "locale/runetype.h"
 
 int
 wmemcmp(s1, s2, n)
@@ -50,7 +51,8 @@
        for (i = 0; i < n; i++) {
                if (*s1 != *s2) {
                        /* wchar might be unsigned */
-                       return *s1 > *s2 ? 1 : -1; 
+                       return *(const __nbrune_t *)s1 >
+                              *(const __nbrune_t *)s2 ? 1 : -1;
                }
                s1++;
                s2++;
diff -r ee91204e7982 -r cca02b9e7393 share/locale/ctype/zh_CN.GB18030.src
--- a/share/locale/ctype/zh_CN.GB18030.src      Sun Apr 06 18:27:52 2003 +0000
+++ b/share/locale/ctype/zh_CN.GB18030.src      Sun Apr 06 18:33:23 2003 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: zh_CN.GB18030.src,v 1.1 2003/03/25 18:26:55 tshiozak Exp $ */
+/* $NetBSD: zh_CN.GB18030.src,v 1.2 2003/04/06 18:33:23 tshiozak Exp $ */
 
 /*-
- * Copyright (c) 1998, Luoqi Chen
+ * Copyright (c)2003 Citrus Project,
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -24,496 +24,8466 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- * NetBSD: zh_CN.eucCN.src,v 1.2 2001/03/26 19:56:37 tshiozak Exp
- * FreeBSD: src/usr.bin/mklocale/data/zh_CN.EUC.src,v 1.2.2.1 1999/08/29 15:31:06 peter Exp
  */
 
 ENCODING       "GBK2K"
 VARIABLE       CODESET=GB18030
 
 /*
- * ASCII
+ * ASCII compatible
  */
-ALPHA          'A' - 'Z' 'a' - 'z'
-CONTROL                0x00 - 0x1f 0x7f
-DIGIT          '0' - '9'
-GRAPH          0x21 - 0x7e
-LOWER          'a' - 'z'
+ALPHA          0x41 - 0x5a 0x61 - 0x7a
+BLANK          0x9 0xb 0x20
+CONTROL                0x0 - 0x1f 0x7f
+DIGIT          0x30 - 0x39
+LOWER          0x61 - 0x7a
+MAPLOWER       < 0x61 - 0x7a : 0x41 >
+MAPUPPER       < 0x41 - 0x5a : 0x61 >
+PRINT          0x20
 PUNCT          0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
-SPACE          0x09 - 0x0d 0x20
-UPPER          'A' - 'Z'
-XDIGIT         '0' - '9' 'a' - 'f' 'A' - 'F'
-BLANK          ' ' '\t'
-PRINT          0x20 - 0x7e
+SPACE          0x9 - 0xd 0x20
 SWIDTH1                0x20 - 0x7e
-
-MAPLOWER       < 'A' - 'Z' : 'a' > < 'a' - 'z' : 'a' >
-MAPUPPER       < 'A' - 'Z' : 'A' > < 'a' - 'z' : 'A' >
-TODIGIT                < '0' - '9' : 0 >
-TODIGIT                < 'A' - 'F' : 10 > < 'a' - 'f' : 10 >
+TODIGIT                < 0x30 - 0x39 : 0x0000 >
+TODIGIT                < 0x41 - 0x46 : 10 >
+TODIGIT                < 0x61 - 0x66 : 10 >
+UPPER          0x41 - 0x5a



Home | Main Index | Thread Index | Old Index