tech-userlevel archive

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

16bit ctype table



Hi all,
any objection to the attached patch? It extends the ctype table to 16bit
and proper masks for the various types. ABI compatibility is preserved.

Joerg
Index: external/gpl3/gcc/dist/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
===================================================================
RCS file: 
/home/joerg/repo/netbsd/src/external/gpl3/gcc/dist/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h,v
retrieving revision 1.2
diff -u -p -r1.2 ctype_base.h
--- external/gpl3/gcc/dist/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h       
21 Jun 2011 02:41:39 -0000      1.2
+++ external/gpl3/gcc/dist/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h       
19 Aug 2012 18:13:45 -0000
@@ -41,18 +41,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
     // NB: Offsets into ctype<char>::_M_table force a particular size
     // on the mask type. Because of this, we don't use an enum.
-    typedef unsigned char              mask;
+    typedef unsigned short     mask;
     static const mask upper            = _CTYPE_U;
     static const mask lower    = _CTYPE_L;
-    static const mask alpha    = _CTYPE_U | _CTYPE_L;
+    static const mask alpha    = _CTYPE_A;
     static const mask digit    = _CTYPE_N;
-    static const mask xdigit   = _CTYPE_N | _CTYPE_X;
+    static const mask xdigit   = _CTYPE_X;
     static const mask space    = _CTYPE_S;
-    static const mask print    = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N | 
_CTYPE_B;
-    static const mask graph    = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N;
+    static const mask print    = _CTYPE_R;
+    static const mask graph    = _CTYPE_G;
     static const mask cntrl    = _CTYPE_C;
     static const mask punct    = _CTYPE_P;
-    static const mask alnum    = _CTYPE_U | _CTYPE_L | _CTYPE_N;
+    static const mask alnum    = _CTYPE_A | _CTYPE_N;
   };
 
 _GLIBCXX_END_NAMESPACE
Index: 
external/gpl3/gcc/dist/libstdc++-v3/config/os/bsd/netbsd/ctype_noninline.h
===================================================================
RCS file: 
/home/joerg/repo/netbsd/src/external/gpl3/gcc/dist/libstdc++-v3/config/os/bsd/netbsd/ctype_noninline.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 ctype_noninline.h
--- external/gpl3/gcc/dist/libstdc++-v3/config/os/bsd/netbsd/ctype_noninline.h  
21 Jun 2011 01:24:50 -0000      1.1.1.1
+++ external/gpl3/gcc/dist/libstdc++-v3/config/os/bsd/netbsd/ctype_noninline.h  
19 Aug 2012 19:44:18 -0000
@@ -33,11 +33,11 @@
   
 // Information as gleaned from /usr/include/ctype.h
 
-  extern "C" const u_int8_t _C_ctype_[];
+  extern "C" const unsigned short _C_ctype2_[];
 
   const ctype_base::mask*
   ctype<char>::classic_table() throw()
-  { return _C_ctype_ + 1; }
+  { return _C_ctype2_ + 1; }
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
Index: gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
===================================================================
RCS file: 
/home/joerg/repo/netbsd/src/gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h,v
retrieving revision 1.2
diff -u -p -r1.2 ctype_base.h
--- gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h        14 Dec 
2010 02:28:57 -0000      1.2
+++ gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h        19 Aug 
2012 18:15:52 -0000
@@ -43,16 +43,16 @@
 
     // NB: Offsets into ctype<char>::_M_table force a particular size
     // on the mask type. Because of this, we don't use an enum.
-    typedef unsigned char              mask;
+    typedef unsigned short     mask;
     static const mask upper            = _CTYPE_U;
     static const mask lower    = _CTYPE_L;
-    static const mask alpha    = _CTYPE_U | _CTYPE_L;
+    static const mask alpha    = _CTYPE_A;
     static const mask digit    = _CTYPE_N;
-    static const mask xdigit   = _CTYPE_N | _CTYPE_X;
+    static const mask xdigit   = _CTYPE_X;
     static const mask space    = _CTYPE_S;
-    static const mask print    = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N | 
_CTYPE_B;
-    static const mask graph    = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N;
+    static const mask print    = _CTYPE_R;
+    static const mask graph    = _CTYPE_P;
     static const mask cntrl    = _CTYPE_C;
     static const mask punct    = _CTYPE_P;
-    static const mask alnum    = _CTYPE_U | _CTYPE_L | _CTYPE_N;
+    static const mask alnum    = _CTYPE_A | _CTYPE_N;
   };
Index: gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_noninline.h
===================================================================
RCS file: 
/home/joerg/repo/netbsd/src/gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_noninline.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 ctype_noninline.h
--- gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_noninline.h   20 Apr 
2006 10:16:24 -0000      1.1.1.1
+++ gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_noninline.h   19 Aug 
2012 19:43:19 -0000
@@ -33,11 +33,11 @@
   
 // Information as gleaned from /usr/include/ctype.h
 
-  extern "C" const u_int8_t _C_ctype_[];
+  extern "C" const unsigned short _C_ctype2_[];
 
   const ctype_base::mask*
   ctype<char>::classic_table() throw()
-  { return _C_ctype_ + 1; }
+  { return _C_ctype2_ + 1; }
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
Index: lib/libc/shlib_version
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/shlib_version,v
retrieving revision 1.234
diff -u -p -r1.234 shlib_version
--- lib/libc/shlib_version      17 Jul 2012 05:41:30 -0000      1.234
+++ lib/libc/shlib_version      19 Aug 2012 17:58:18 -0000
@@ -25,9 +25,7 @@
 #   for example in assembler code.
 # - kill sigcontext: never request version 0 or 1 signal trampoline.
 #   always request version 2 trampoline. (on vax, 3).
-# - change _ctype_ table in ctype.h and gen/ctype_.c 8bit -> 16 or 32bit.
-#   it's insufficient bitwidth to implement all ctype class.
-#   see isblank's comment in ctype.h.
+# - drop _ctype_ table, rename back _ctype2_ to _ctype_.
 # - remove gets(); it is finally dead in c11.
 # - make __cerror (spelled CERROR) hidden again
 # - remove ruserok() and friends to libcompat (or entirely)
Index: lib/libc/citrus/citrus_lc_ctype.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/citrus/citrus_lc_ctype.c,v
retrieving revision 1.10
diff -u -p -r1.10 citrus_lc_ctype.c
--- lib/libc/citrus/citrus_lc_ctype.c   4 Mar 2012 21:14:55 -0000       1.10
+++ lib/libc/citrus/citrus_lc_ctype.c   19 Aug 2012 18:03:43 -0000
@@ -104,6 +104,7 @@ _PREFIX(build_cache)(struct _locale_cach
        _DIAGASSERT(data != NULL);
 
        cache->ctype_tab = data->rl_ctype_tab;
+       cache->ctype2_tab = data->rl_ctype2_tab;
        cache->tolower_tab = data->rl_tolower_tab;
        cache->toupper_tab = data->rl_toupper_tab;
        cache->mb_cur_max = _citrus_ctype_get_mb_cur_max(data->rl_citrus_ctype);
@@ -117,6 +118,7 @@ _PREFIX(fixup)(_RuneLocale *data)
 
        __mb_cur_max = _citrus_ctype_get_mb_cur_max(data->rl_citrus_ctype);
        _ctype_ = data->rl_ctype_tab;
+       _ctype2_ = data->rl_ctype2_tab;
        _tolower_tab_ = data->rl_tolower_tab;
        _toupper_tab_ = data->rl_toupper_tab;
        _CurrentRuneLocale = data;
Index: lib/libc/gen/ctype_.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/gen/ctype_.c,v
retrieving revision 1.19
diff -u -p -r1.19 ctype_.c
--- lib/libc/gen/ctype_.c       14 Dec 2010 02:28:57 -0000      1.19
+++ lib/libc/gen/ctype_.c       19 Aug 2012 20:06:02 -0000
@@ -58,8 +58,9 @@ __RCSID("$NetBSD: ctype_.c,v 1.19 2010/1
 #define        _P      _CTYPE_P
 #define        _C      _CTYPE_C
 #define        _X      _CTYPE_X
-#define        _B      _CTYPE_B
+#define        _B      _CTYPE_BL
 
+/* Note: this uses _B as printable and not graph, not as blank! */
 const unsigned char _C_ctype_[1 + _CTYPE_NUM_CHARS] = {
        0,
        _C,     _C,     _C,     _C,     _C,     _C,     _C,     _C,
@@ -81,3 +82,45 @@ const unsigned char _C_ctype_[1 + _CTYPE
 };
 
 const unsigned char *_ctype_ = &_C_ctype_[0];
+
+#define        _R      _CTYPE_R
+#define        _G      _CTYPE_G
+#define        _A      _CTYPE_A
+
+const unsigned short _C_ctype2_[1 + _CTYPE_NUM_CHARS] = {
+       0,
+       _C,               _C,               _C,               _C,
+       _C,               _C,               _C,               _C,
+       _C,               _S|_P|_C|_B,      _S|_P|_C,         _S|_P|_C,
+       _S|_P|_C,         _S|_P|_C,         _C,               _C,
+       _C,               _C,               _C,               _C,
+       _C,               _C,               _C,               _C,
+       _C,               _C,               _C,               _C,
+       _C,               _C,               _C,               _C,
+       _S|_P|_B|_R,      _G|_R,            _G|_R,            _G|_R,
+       _G|_R,            _G|_R,            _G|_R,            _G|_R,
+       _G|_R,            _G|_R,            _G|_R,            _G|_R,
+       _G|_R,            _G|_R,            _G|_R,            _G|_R,
+       _N|_X|_G|_R,      _N|_X|_G|_R,      _N|_X|_G|_R,      _N|_X|_G|_R,
+       _N|_X|_G|_R,      _N|_X|_G|_R,      _N|_X|_G|_R,      _N|_X|_G|_R,
+       _N|_X|_G|_R,      _N|_X|_G|_R,      _G|_R,            _G|_R,
+       _G|_R,            _G|_R,            _G|_R,            _G|_R,
+       _G|_R,            _U|_X|_A|_G|_R,   _U|_X|_A|_G|_R,   _U|_X|_A|_G|_R,
+       _U|_X|_A|_G|_R,   _U|_X|_A|_G|_R,   _U|_X|_A|_G|_R,   _U|_A|_G|_R,
+       _U|_A|_G|_R,      _U|_A|_G|_R,      _U|_A|_G|_R,      _U|_A|_G|_R,
+       _U|_A|_G|_R,      _U|_A|_G|_R,      _U|_A|_G|_R,      _U|_A|_G|_R,
+       _U|_A|_G|_R,      _U|_A|_G|_R,      _U|_A|_G|_R,      _U|_A|_G|_R,
+       _U|_A|_G|_R,      _U|_A|_G|_R,      _U|_A|_G|_R,      _U|_A|_G|_R,
+       _U|_A|_G|_R,      _U|_A|_G|_R,      _U|_A|_G|_R,      _G|_R,
+       _G|_R,            _G|_R,            _G|_R,            _G|_R,
+       _G|_R,            _L|_X|_A|_G|_R,   _L|_X|_A|_G|_R,   _L|_X|_A|_G|_R,
+       _L|_X|_A|_G|_R,   _L|_X|_A|_G|_R,   _L|_X|_A|_G|_R,   _L|_A|_G|_R,
+       _L|_A|_G|_R,      _L|_A|_G|_R,      _L|_A|_G|_R,      _L|_A|_G|_R,
+       _L|_A|_G|_R,      _L|_A|_G|_R,      _L|_A|_G|_R,      _L|_A|_G|_R,
+       _L|_A|_G|_R,      _L|_A|_G|_R,      _L|_A|_G|_R,      _L|_A|_G|_R,
+       _L|_A|_G|_R,      _L|_A|_G|_R,      _L|_A|_G|_R,      _L|_A|_G|_R,
+       _L|_A|_G|_R,      _L|_A|_G|_R,      _L|_A|_G|_R,      _G|_R,
+       _G|_R,            _G|_R,            _G|_R,            _C,
+};
+
+const unsigned short *_ctype2_ = &_C_ctype2_[0];
Index: lib/libc/gen/isctype.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/gen/isctype.c,v
retrieving revision 1.21
diff -u -p -r1.21 isctype.c
--- lib/libc/gen/isctype.c      14 Dec 2010 02:28:57 -0000      1.21
+++ lib/libc/gen/isctype.c      19 Aug 2012 20:06:14 -0000
@@ -52,27 +52,21 @@ __RCSID("$NetBSD: isctype.c,v 1.21 2010/
 int \
 is##name(int c) \
 { \
-       return (int)(_CTYPE_TAB(ctype_tab, c) & (bit)); \
+       return (int)(_CTYPE_TAB(ctype2_tab, c) & (bit)); \
 }
 
-_ISCTYPE_FUNC(alnum,  _CTYPE_U|_CTYPE_L|_CTYPE_N      )
-_ISCTYPE_FUNC(alpha,  _CTYPE_U|_CTYPE_L         )
-_ISCTYPE_FUNC(cntrl,  _CTYPE_C            )
-_ISCTYPE_FUNC(digit,  _CTYPE_N            )
-_ISCTYPE_FUNC(graph,  _CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N   )
-_ISCTYPE_FUNC(lower,  _CTYPE_L            )
-_ISCTYPE_FUNC(print,  _CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B)
-_ISCTYPE_FUNC(punct,  _CTYPE_P            )
-_ISCTYPE_FUNC(space,  _CTYPE_S            )
-_ISCTYPE_FUNC(upper,  _CTYPE_U            )
-_ISCTYPE_FUNC(xdigit, _CTYPE_N|_CTYPE_X         )
-
-int
-isblank(int c)
-{
-       /* XXX: FIXME */
-        return c == ' ' || c == '\t';
-}
+_ISCTYPE_FUNC(alnum,  _CTYPE_A|_CTYPE_N)
+_ISCTYPE_FUNC(alpha,  _CTYPE_A         )
+_ISCTYPE_FUNC(blank,  _CTYPE_BL        )
+_ISCTYPE_FUNC(cntrl,  _CTYPE_C         )
+_ISCTYPE_FUNC(digit,  _CTYPE_N         )
+_ISCTYPE_FUNC(graph,  _CTYPE_G         )
+_ISCTYPE_FUNC(lower,  _CTYPE_L         )
+_ISCTYPE_FUNC(print,  _CTYPE_R         )
+_ISCTYPE_FUNC(punct,  _CTYPE_P         )
+_ISCTYPE_FUNC(space,  _CTYPE_S         )
+_ISCTYPE_FUNC(upper,  _CTYPE_U         )
+_ISCTYPE_FUNC(xdigit, _CTYPE_X         )
 
 int
 toupper(int c)
Index: lib/libc/locale/ctype_local.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/locale/ctype_local.h,v
retrieving revision 1.4
diff -u -p -r1.4 ctype_local.h
--- lib/libc/locale/ctype_local.h       13 Jun 2010 04:14:57 -0000      1.4
+++ lib/libc/locale/ctype_local.h       19 Aug 2012 18:27:09 -0000
@@ -34,6 +34,7 @@
 #define _CTYPE_CACHE_SIZE      (1 << 8)
 
 extern const unsigned char _C_ctype_[];
+extern const unsigned short _C_ctype2_[];
 extern const short _C_toupper_[];
 extern const short _C_tolower_[];
 
Index: lib/libc/locale/global_locale.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/locale/global_locale.c,v
retrieving revision 1.13
diff -u -p -r1.13 global_locale.c
--- lib/libc/locale/global_locale.c     21 Mar 2012 14:11:24 -0000      1.13
+++ lib/libc/locale/global_locale.c     19 Aug 2012 18:19:30 -0000
@@ -136,6 +136,7 @@ static const char *_global_items[(size_t
 
 static struct _locale_cache_t _global_cache = {
     .ctype_tab   = (const unsigned char *)&_C_ctype_[0],
+    .ctype2_tab   = (const unsigned short *)&_C_ctype2_[0],
     .tolower_tab = (const short *)&_C_tolower_[0],
     .toupper_tab = (const short *)&_C_toupper_[0],
     .mb_cur_max = (size_t)1,
Index: lib/libc/locale/rune.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/locale/rune.c,v
retrieving revision 1.45
diff -u -p -r1.45 rune.c
--- lib/libc/locale/rune.c      8 Aug 2012 20:16:50 -0000       1.45
+++ lib/libc/locale/rune.c      19 Aug 2012 20:06:22 -0000
@@ -55,6 +55,7 @@
 typedef struct {
        _RuneLocale rl;
        unsigned char   rlp_ctype_tab  [_CTYPE_NUM_CHARS + 1];
+       unsigned short  rlp_ctype2_tab  [_CTYPE_NUM_CHARS + 1];
        short           rlp_tolower_tab[_CTYPE_NUM_CHARS + 1];
        short           rlp_toupper_tab[_CTYPE_NUM_CHARS + 1];
        char            rlp_codeset[33]; /* XXX */
@@ -86,15 +87,18 @@ _rune_init_priv(_RuneLocalePriv *rlp)
 
        for (i = _CTYPE_CACHE_SIZE; i < _CTYPE_NUM_CHARS; ++i) {
                rlp->rlp_ctype_tab  [i + 1] = 0;
+               rlp->rlp_ctype2_tab  [i + 1] = 0;
                rlp->rlp_tolower_tab[i + 1] = i;
                rlp->rlp_toupper_tab[i + 1] = i;
        }
 #endif
        rlp->rlp_ctype_tab  [0] = 0;
+       rlp->rlp_ctype2_tab  [0] = 0;
        rlp->rlp_tolower_tab[0] = EOF;
        rlp->rlp_toupper_tab[0] = EOF;
 
        rlp->rl.rl_ctype_tab   = (const unsigned char *)&rlp->rlp_ctype_tab[0];
+       rlp->rl.rl_ctype2_tab  = (const unsigned short 
*)&rlp->rlp_ctype2_tab[0];
        rlp->rl.rl_tolower_tab = (const short *)&rlp->rlp_tolower_tab[0];
        rlp->rl.rl_toupper_tab = (const short *)&rlp->rlp_toupper_tab[0];
        rlp->rl.rl_codeset     = (const char *)&rlp->rlp_codeset[0];
@@ -248,11 +252,23 @@ do {                                                      
                \
                        goto err;
                if (wc == WEOF) {
                        rlp->rlp_ctype_tab[i + 1] = 0;
+                       rlp->rlp_ctype2_tab[i + 1] = 0;
                        rlp->rlp_tolower_tab[i + 1] = i;
                        rlp->rlp_toupper_tab[i + 1] = i;
                } else {
-                       rlp->rlp_ctype_tab[i + 1] = (unsigned char)
+                       rlp->rlp_ctype2_tab[i + 1] = (unsigned short)
                            _runetype_to_ctype(_runetype_priv(rl, wc));
+                       rlp->rlp_ctype_tab[i + 1] = (unsigned 
char)rlp->rlp_ctype2_tab[i + 1];
+                       /* old meaning of _CTYPE_X: hex digit, but not digit */
+                       if ((rlp->rlp_ctype2_tab[i + 1] & (_CTYPE_X|_CTYPE_N))
+                           == (_CTYPE_X|_CTYPE_N))
+                               rlp->rlp_ctype_tab[i + 1] &= ~_CTYPE_X;
+                       /* Old meaning of _CTYPE_BL: printable and not graph */
+                       if ((rlp->rlp_ctype2_tab[i + 1] & (_CTYPE_P&_CTYPE_G))
+                           == _CTYPE_P)
+                               rlp->rlp_ctype_tab[i + 1] |= _CTYPE_BL;
+                       else
+                               rlp->rlp_ctype_tab[i + 1] &= ~_CTYPE_BL;
 
 #define CONVERT_MAP(name)                                              \
 do {                                                                   \
Index: lib/libc/locale/runetable.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/locale/runetable.c,v
retrieving revision 1.27
diff -u -p -r1.27 runetable.c
--- lib/libc/locale/runetable.c 19 Jun 2010 13:26:52 -0000      1.27
+++ lib/libc/locale/runetable.c 19 Aug 2012 18:30:07 -0000
@@ -344,6 +344,7 @@ const _RuneLocale _DefaultRuneLocale = {
            { "xdigit", _RUNETYPE_X },
     },
     _C_ctype_,
+    _C_ctype2_,
     _C_tolower_,
     _C_toupper_
 };
Index: lib/libc/locale/runetype_local.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/locale/runetype_local.h,v
retrieving revision 1.12
diff -u -p -r1.12 runetype_local.h
--- lib/libc/locale/runetype_local.h    20 Jun 2010 02:23:15 -0000      1.12
+++ lib/libc/locale/runetype_local.h    19 Aug 2012 18:04:47 -0000
@@ -124,6 +124,7 @@ typedef struct _RuneLocale {
        _WCTypeEntry                    rl_wctype[_WCTYPE_NINDEXES];
 
        const unsigned char             *rl_ctype_tab;
+       const unsigned short            *rl_ctype2_tab;
        const short                     *rl_tolower_tab;
        const short                     *rl_toupper_tab;
 } _RuneLocale;
Index: lib/libc/locale/runetype_misc.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/locale/runetype_misc.h,v
retrieving revision 1.3
diff -u -p -r1.3 runetype_misc.h
--- lib/libc/locale/runetype_misc.h     18 Jan 2012 14:22:27 -0000      1.3
+++ lib/libc/locale/runetype_misc.h     19 Aug 2012 20:07:46 -0000
@@ -62,20 +62,12 @@ _runetype_to_ctype(_RuneType bits)
                ret |= _CTYPE_C;
        if (bits & _RUNETYPE_X)
                ret |= _CTYPE_X;
-       /*
-        * TWEAK!  _B has been used incorrectly (or with older
-        * declaration) in ctype.h isprint() macro.
-        * _B does not mean isblank, it means "isprint && !isgraph".
-        * the following is okay since isblank() was hardcoded in
-        * function (i.e. isblank() is inherently locale unfriendly).
-        */
-#if 1
-       if ((bits & (_RUNETYPE_R | _RUNETYPE_G)) == _RUNETYPE_R)
-               ret |= _CTYPE_B;
-#else
        if (bits & _RUNETYPE_B)
-               ret |= _CTYPE_B;
-#endif
+               ret |= _CTYPE_BL;
+       if (bits & _RUNETYPE_G)
+               ret |= _CTYPE_G;
+       if (bits & _RUNETYPE_R)
+               ret |= _CTYPE_R;
        return ret;
 }
 
Index: lib/libc/locale/setlocale_local.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libc/locale/setlocale_local.h,v
retrieving revision 1.8
diff -u -p -r1.8 setlocale_local.h
--- lib/libc/locale/setlocale_local.h   4 Mar 2012 21:14:57 -0000       1.8
+++ lib/libc/locale/setlocale_local.h   19 Aug 2012 18:19:02 -0000
@@ -41,6 +41,7 @@ typedef void *_locale_part_t;
 
 struct _locale_cache_t {
        const unsigned char *ctype_tab;
+       const unsigned short *ctype2_tab;
        const short *tolower_tab;
        const short *toupper_tab;
        size_t mb_cur_max;
Index: libexec/ld.elf_so/rtld.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/libexec/ld.elf_so/rtld.c,v
retrieving revision 1.158
diff -u -p -r1.158 rtld.c
--- libexec/ld.elf_so/rtld.c    15 Aug 2012 03:46:06 -0000      1.158
+++ libexec/ld.elf_so/rtld.c    19 Aug 2012 17:57:50 -0000
@@ -447,7 +447,7 @@ _rtld(Elf_Addr *sp, Elf_Addr relocbase)
        dbg(("got is at %p, dynamic is at %p", _GLOBAL_OFFSET_TABLE_,
            &_DYNAMIC));
 #endif
-       dbg(("_ctype_ is %p", _ctype_));
+       dbg(("_ctype2_ is %p", _ctype2_));
 #endif
 
        sp += 2;                /* skip over return argument space */
Index: sys/sys/ctype_bits.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/sys/ctype_bits.h,v
retrieving revision 1.2
diff -u -p -r1.2 ctype_bits.h
--- sys/sys/ctype_bits.h        14 Dec 2010 02:28:57 -0000      1.2
+++ sys/sys/ctype_bits.h        19 Aug 2012 20:05:53 -0000
@@ -40,16 +40,20 @@
 #ifndef _SYS_CTYPE_BITS_H_
 #define _SYS_CTYPE_BITS_H_
 
-#define        _CTYPE_U        0x01
-#define        _CTYPE_L        0x02
-#define        _CTYPE_N        0x04
-#define        _CTYPE_S        0x08
-#define        _CTYPE_P        0x10
-#define        _CTYPE_C        0x20
-#define        _CTYPE_X        0x40
-#define        _CTYPE_B        0x80
+#define        _CTYPE_U        0x0001  /* Upper */
+#define        _CTYPE_L        0x0002  /* Lower */
+#define        _CTYPE_N        0x0004  /* Digit */
+#define        _CTYPE_S        0x0008  /* Space */
+#define        _CTYPE_P        0x0010  /* Punct */
+#define        _CTYPE_C        0x0020  /* Control */
+#define        _CTYPE_X        0x0040  /* X digit */
+#define        _CTYPE_BL       0x0080  /* Blank */
+#define        _CTYPE_A        0x0100  /* Alpha */
+#define        _CTYPE_G        0x0200  /* Graph */
+#define        _CTYPE_R        0x0400  /* Print */
 
 extern const unsigned char     *_ctype_;
+extern const unsigned short    *_ctype2_;
 extern const short     *_tolower_tab_;
 extern const short     *_toupper_tab_;
 
Index: sys/sys/ctype_inline.h
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/sys/ctype_inline.h,v
retrieving revision 1.2
diff -u -p -r1.2 ctype_inline.h
--- sys/sys/ctype_inline.h      14 Dec 2010 02:28:57 -0000      1.2
+++ sys/sys/ctype_inline.h      19 Aug 2012 20:05:58 -0000
@@ -45,20 +45,25 @@
 
 #include <sys/ctype_bits.h>
 
-#define        isdigit(c)      ((int)((_ctype_ + 1)[(c)] & _CTYPE_N))
-#define        islower(c)      ((int)((_ctype_ + 1)[(c)] & _CTYPE_L))
-#define        isspace(c)      ((int)((_ctype_ + 1)[(c)] & _CTYPE_S))
-#define        ispunct(c)      ((int)((_ctype_ + 1)[(c)] & _CTYPE_P))
-#define        isupper(c)      ((int)((_ctype_ + 1)[(c)] & _CTYPE_U))
-#define        isalpha(c)      ((int)((_ctype_ + 1)[(c)] & 
(_CTYPE_U|_CTYPE_L)))
-#define        isxdigit(c)     ((int)((_ctype_ + 1)[(c)] & 
(_CTYPE_N|_CTYPE_X)))
-#define        isalnum(c)      ((int)((_ctype_ + 1)[(c)] & 
(_CTYPE_U|_CTYPE_L|_CTYPE_N)))
-#define        isprint(c)      ((int)((_ctype_ + 1)[(c)] & 
(_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B)))
-#define        isgraph(c)      ((int)((_ctype_ + 1)[(c)] & 
(_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N)))
-#define        iscntrl(c)      ((int)((_ctype_ + 1)[(c)] & _CTYPE_C))
+#define        isdigit(c)      ((int)((_ctype2_ + 1)[(c)] & _CTYPE_N))
+#define        islower(c)      ((int)((_ctype2_ + 1)[(c)] & _CTYPE_L))
+#define        isspace(c)      ((int)((_ctype2_ + 1)[(c)] & _CTYPE_S))
+#define        ispunct(c)      ((int)((_ctype2_ + 1)[(c)] & _CTYPE_P))
+#define        isupper(c)      ((int)((_ctype2_ + 1)[(c)] & _CTYPE_U))
+#define        isalpha(c)      ((int)((_ctype2_ + 1)[(c)] & _CTYPE_A))
+#define        isxdigit(c)     ((int)((_ctype2_ + 1)[(c)] & _CTYPE_X))
+#define        isalnum(c)      ((int)((_ctype2_ + 1)[(c)] & 
(_CTYPE_A|_CTYPE_N)))
+#define        isprint(c)      ((int)((_ctype2_ + 1)[(c)] & _CTYPE_R))
+#define        isgraph(c)      ((int)((_ctype2_ + 1)[(c)] & _CTYPE_G))
+#define        iscntrl(c)      ((int)((_ctype2_ + 1)[(c)] & _CTYPE_C))
 #define        tolower(c)      ((int)((_tolower_tab_ + 1)[(c)]))
 #define        toupper(c)      ((int)((_toupper_tab_ + 1)[(c)]))
 
+#if defined(_ISO_C99_SOURCE) || (_POSIX_C_SOURCE - 0) > 200112L || \
+    (_XOPEN_SOURCE - 0) > 600 || defined(_NETBSD_SOURCE)
+#define isblank(c)     ((int)((_ctype2_ + 1)[(c)] & _CTYPE_BL))
+#endif
+
 #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
 #define        isascii(c)      ((unsigned)(c) <= 0177)
 #define        toascii(c)      ((c) & 0177)
@@ -66,17 +71,4 @@
 #define _toupper(c)    ((c) - 'a' + 'A')
 #endif
 
-#if defined(_ISO_C99_SOURCE) || (_POSIX_C_SOURCE - 0) > 200112L || \
-    (_XOPEN_SOURCE - 0) > 600 || defined(_NETBSD_SOURCE)
-
-/*
- * isblank() is implemented as C function, due to insufficient bitwidth in
- * _ctype_.  Note that _B does not mean isblank - it means isprint && !isgraph.
- */
-#if 0
-#define isblank(c)     ((int)((_ctype_ + 1)[(c)] & _B))
-#endif
-
-#endif
-
 #endif /* !_CTYPE_INLINE_H_ */


Home | Main Index | Thread Index | Old Index