Source-Changes-HG archive

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

[src/trunk]: src Prefix ctype bitmask macros with _CTYPE



details:   https://anonhg.NetBSD.org/src/rev/d20de1ae48be
branches:  trunk
changeset: 759633:d20de1ae48be
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Dec 14 02:28:57 2010 +0000

description:
Prefix ctype bitmask macros with _CTYPE

diffstat:

 gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h |  22 +++---
 lib/libc/gen/ctype_.c                                        |  13 +++-
 lib/libc/gen/isctype.c                                       |  26 +++---
 lib/libc/locale/runetype_misc.h                              |  43 ++++++-----
 sys/sys/ctype_bits.h                                         |  18 ++--
 sys/sys/ctype_inline.h                                       |  24 +++---
 usr.sbin/chrtbl/chrtbl.c                                     |  34 ++++----
 7 files changed, 95 insertions(+), 85 deletions(-)

diffs (truncated from 327 to 300 lines):

diff -r 1b26222fd65b -r d20de1ae48be gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
--- a/gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h      Tue Dec 14 01:28:18 2010 +0000
+++ b/gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h      Tue Dec 14 02:28:57 2010 +0000
@@ -44,15 +44,15 @@
     // 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;
-    static const mask upper            = _U;
-    static const mask lower    = _L;
-    static const mask alpha    = _U | _L;
-    static const mask digit    = _N;
-    static const mask xdigit   = _N | _X;
-    static const mask space    = _S;
-    static const mask print    = _P | _U | _L | _N | _B;
-    static const mask graph    = _P | _U | _L | _N;
-    static const mask cntrl    = _C;
-    static const mask punct    = _P;
-    static const mask alnum    = _U | _L | _N;
+    static const mask upper            = _CTYPE_U;
+    static const mask lower    = _CTYPE_L;
+    static const mask alpha    = _CTYPE_U | _CTYPE_L;
+    static const mask digit    = _CTYPE_N;
+    static const mask xdigit   = _CTYPE_N | _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 cntrl    = _CTYPE_C;
+    static const mask punct    = _CTYPE_P;
+    static const mask alnum    = _CTYPE_U | _CTYPE_L | _CTYPE_N;
   };
diff -r 1b26222fd65b -r d20de1ae48be lib/libc/gen/ctype_.c
--- a/lib/libc/gen/ctype_.c     Tue Dec 14 01:28:18 2010 +0000
+++ b/lib/libc/gen/ctype_.c     Tue Dec 14 02:28:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ctype_.c,v 1.18 2010/06/01 13:52:08 tnozaki Exp $      */
+/*     $NetBSD: ctype_.c,v 1.19 2010/12/14 02:28:57 joerg Exp $        */
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -39,7 +39,7 @@
 #if 0
 /*static char *sccsid = "from: @(#)ctype_.c    5.6 (Berkeley) 6/1/90";*/
 #else
-__RCSID("$NetBSD: ctype_.c,v 1.18 2010/06/01 13:52:08 tnozaki Exp $");
+__RCSID("$NetBSD: ctype_.c,v 1.19 2010/12/14 02:28:57 joerg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -51,6 +51,15 @@
 #error "EOF != -1"
 #endif
 
+#define        _U      _CTYPE_U
+#define        _L      _CTYPE_L
+#define        _N      _CTYPE_N
+#define        _S      _CTYPE_S
+#define        _P      _CTYPE_P
+#define        _C      _CTYPE_C
+#define        _X      _CTYPE_X
+#define        _B      _CTYPE_B
+
 const unsigned char _C_ctype_[1 + _CTYPE_NUM_CHARS] = {
        0,
        _C,     _C,     _C,     _C,     _C,     _C,     _C,     _C,
diff -r 1b26222fd65b -r d20de1ae48be lib/libc/gen/isctype.c
--- a/lib/libc/gen/isctype.c    Tue Dec 14 01:28:18 2010 +0000
+++ b/lib/libc/gen/isctype.c    Tue Dec 14 02:28:57 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isctype.c,v 1.20 2010/06/01 13:52:08 tnozaki Exp $ */
+/* $NetBSD: isctype.c,v 1.21 2010/12/14 02:28:57 joerg Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: isctype.c,v 1.20 2010/06/01 13:52:08 tnozaki Exp $");
+__RCSID("$NetBSD: isctype.c,v 1.21 2010/12/14 02:28:57 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -55,17 +55,17 @@
        return (int)(_CTYPE_TAB(ctype_tab, c) & (bit)); \
 }
 
-_ISCTYPE_FUNC(alnum,  _U|_L|_N      )
-_ISCTYPE_FUNC(alpha,  _U|_L         )
-_ISCTYPE_FUNC(cntrl,  _C            )
-_ISCTYPE_FUNC(digit,  _N            )
-_ISCTYPE_FUNC(graph,  _P|_U|_L|_N   )
-_ISCTYPE_FUNC(lower,  _L            )
-_ISCTYPE_FUNC(print,  _P|_U|_L|_N|_B)
-_ISCTYPE_FUNC(punct,  _P            )
-_ISCTYPE_FUNC(space,  _S            )
-_ISCTYPE_FUNC(upper,  _U            )
-_ISCTYPE_FUNC(xdigit, _N|_X         )
+_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)
diff -r 1b26222fd65b -r d20de1ae48be lib/libc/locale/runetype_misc.h
--- a/lib/libc/locale/runetype_misc.h   Tue Dec 14 01:28:18 2010 +0000
+++ b/lib/libc/locale/runetype_misc.h   Tue Dec 14 02:28:57 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: runetype_misc.h,v 1.1 2010/06/20 02:23:15 tnozaki Exp $ */
+/* $NetBSD: runetype_misc.h,v 1.2 2010/12/14 02:28:57 joerg Exp $ */
 
 /*-
  * Copyright (c) 1993
@@ -49,19 +49,19 @@
                return 0;
        ret = 0;
        if (bits & _RUNETYPE_U)
-               ret |= _U;
+               ret |= _CTYPE_U;
        if (bits & _RUNETYPE_L)
-               ret |= _L;
+               ret |= _CTYPE_L;
        if (bits & _RUNETYPE_D)
-               ret |= _N;
+               ret |= _CTYPE_N;
        if (bits & _RUNETYPE_S)
-               ret |= _S;
+               ret |= _CTYPE_S;
        if (bits & _RUNETYPE_P)
-               ret |= _P;
+               ret |= _CTYPE_P;
        if (bits & _RUNETYPE_C)
-               ret |= _C;
+               ret |= _CTYPE_C;
        if (bits & _RUNETYPE_X)
-               ret |= _X;
+               ret |= _CTYPE_X;
        /*
         * TWEAK!  _B has been used incorrectly (or with older
         * declaration) in ctype.h isprint() macro.
@@ -71,10 +71,10 @@
         */
 #if 1
        if ((bits & (_RUNETYPE_R | _RUNETYPE_G)) == _RUNETYPE_R)
-               ret |= _B;
+               ret |= _CTYPE_B;
 #else
        if (bits & _RUNETYPE_B)
-               ret |= _B;
+               ret |= _CTYPE_B;
 #endif
        return ret;
 }
@@ -97,29 +97,30 @@
         */
 
        ret = (_RuneType)0;
-       if (bits & _U)
+       if (bits & _CTYPE_U)
                ret |= _RUNETYPE_U;
-       if (bits & _L)
+       if (bits & _CTYPE_L)
                ret |= _RUNETYPE_L;
-       if (bits & _N)
+       if (bits & _CTYPE_N)
                ret |= _RUNETYPE_D;
-       if (bits & _S)
+       if (bits & _CTYPE_S)
                ret |= _RUNETYPE_S;
-       if (bits & _P)
+       if (bits & _CTYPE_P)
                ret |= _RUNETYPE_P;
-       if (bits & _C)
+       if (bits & _CTYPE_C)
                ret |= _RUNETYPE_C;
        /* derived flag bits, duplicate of ctype.h */
-       if (bits & (_U|_L))
+       if (bits & (_CTYPE_U|_CTYPE_L))
                ret |= _RUNETYPE_A;
-       if (bits & (_N|_X))
+       if (bits & (_CTYPE_N|_CTYPE_X))
                ret |= _RUNETYPE_X;
-       if (bits & (_P|_U|_L|_N))
+       if (bits & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N))
                ret |= _RUNETYPE_G;
        /* we don't really trust _B in the file.  see above. */
-       if (bits & _B)
+       if (bits & _CTYPE_B)
                ret |= _RUNETYPE_B;
-       if ((bits & (_P|_U|_L|_N|_B)) || ch == ' ')
+       if ((bits & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B)) ||
+           ch == ' ')
                ret |= (_RUNETYPE_R | _RUNETYPE_SW1);
        if (ch == ' ' || ch == '\t')
                ret |= _RUNETYPE_B;
diff -r 1b26222fd65b -r d20de1ae48be sys/sys/ctype_bits.h
--- a/sys/sys/ctype_bits.h      Tue Dec 14 01:28:18 2010 +0000
+++ b/sys/sys/ctype_bits.h      Tue Dec 14 02:28:57 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ctype_bits.h,v 1.1 2010/06/01 13:52:08 tnozaki Exp $ */
+/* $NetBSD: ctype_bits.h,v 1.2 2010/12/14 02:28:57 joerg Exp $ */
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -40,14 +40,14 @@
 #ifndef _SYS_CTYPE_BITS_H_
 #define _SYS_CTYPE_BITS_H_
 
-#define        _U      0x01
-#define        _L      0x02
-#define        _N      0x04
-#define        _S      0x08
-#define        _P      0x10
-#define        _C      0x20
-#define        _X      0x40
-#define        _B      0x80
+#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
 
 extern const unsigned char     *_ctype_;
 extern const short     *_tolower_tab_;
diff -r 1b26222fd65b -r d20de1ae48be sys/sys/ctype_inline.h
--- a/sys/sys/ctype_inline.h    Tue Dec 14 01:28:18 2010 +0000
+++ b/sys/sys/ctype_inline.h    Tue Dec 14 02:28:57 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ctype_inline.h,v 1.1 2010/06/01 13:52:08 tnozaki Exp $ */
+/* $NetBSD: ctype_inline.h,v 1.2 2010/12/14 02:28:57 joerg Exp $ */
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -45,17 +45,17 @@
 
 #include <sys/ctype_bits.h>
 
-#define        isdigit(c)      ((int)((_ctype_ + 1)[(c)] & _N))
-#define        islower(c)      ((int)((_ctype_ + 1)[(c)] & _L))
-#define        isspace(c)      ((int)((_ctype_ + 1)[(c)] & _S))
-#define        ispunct(c)      ((int)((_ctype_ + 1)[(c)] & _P))
-#define        isupper(c)      ((int)((_ctype_ + 1)[(c)] & _U))
-#define        isalpha(c)      ((int)((_ctype_ + 1)[(c)] & (_U|_L)))
-#define        isxdigit(c)     ((int)((_ctype_ + 1)[(c)] & (_N|_X)))
-#define        isalnum(c)      ((int)((_ctype_ + 1)[(c)] & (_U|_L|_N)))
-#define        isprint(c)      ((int)((_ctype_ + 1)[(c)] & (_P|_U|_L|_N|_B)))
-#define        isgraph(c)      ((int)((_ctype_ + 1)[(c)] & (_P|_U|_L|_N)))
-#define        iscntrl(c)      ((int)((_ctype_ + 1)[(c)] & _C))
+#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        tolower(c)      ((int)((_tolower_tab_ + 1)[(c)]))
 #define        toupper(c)      ((int)((_toupper_tab_ + 1)[(c)]))
 
diff -r 1b26222fd65b -r d20de1ae48be usr.sbin/chrtbl/chrtbl.c
--- a/usr.sbin/chrtbl/chrtbl.c  Tue Dec 14 01:28:18 2010 +0000
+++ b/usr.sbin/chrtbl/chrtbl.c  Tue Dec 14 02:28:57 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chrtbl.c,v 1.12 2009/10/21 01:07:47 snj Exp $  */
+/*     $NetBSD: chrtbl.c,v 1.13 2010/12/14 02:28:58 joerg Exp $        */
 
 /*
  * Copyright (c) 1997 Christos Zoulas.  All rights reserved.
@@ -63,21 +63,21 @@
            char *, size_t lno));
        int       arg;
 } tokens[] = {
-       { "LC_CTYPE",           setfilename,    0       },
-       { "isupper",            addattr,        _U      },
-       { "islower",            addattr,        _L      },
-       { "isdigit",            addattr,        _N      },
-       { "isspace",            addattr,        _S      },
-       { "ispunct",            addattr,        _P      },
-       { "iscntrl",            addattr,        _C      },
-       { "isblank",            addattr,        _B      },
-       { "isxdigit",           addattr,        _X      },
-       { "ul",                 uplow,          0       },
-       { "cswidth",            cswidth,        0       },
-       { "LC_NUMERIC",         setfilename,    1       },
-       { "decimal_point",      numeric,        0       },
-       { "thousands_sep",      numeric,        0       },
-       { NULL,                 NULL,           0       }



Home | Main Index | Thread Index | Old Index