From 3588bd1eb600b365abc764fa53a93d1024a94463 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Sat, 17 Sep 2005 14:39:44 +0000 Subject: [PATCH] Too many windhills in the third party software world to fight them all. Maybe programmers learn once not to mess with namespaces, but capitulate for now and prefix the ctype masks with _CTYPEMASK. --- gnu/lib/gcc34/libstdc++/ctype_base.h.patch | 40 +++++++++--------- include/ctype.h | 48 +++++++++++----------- lib/libc/gen/ctype.c | 14 ++++++- lib/libc/gen/isctype.c | 26 ++++++------ lib/libc/locale/runeglue.c | 24 +++++------ 5 files changed, 82 insertions(+), 70 deletions(-) diff --git a/gnu/lib/gcc34/libstdc++/ctype_base.h.patch b/gnu/lib/gcc34/libstdc++/ctype_base.h.patch index 874f8393ff..f856263bc3 100644 --- a/gnu/lib/gcc34/libstdc++/ctype_base.h.patch +++ b/gnu/lib/gcc34/libstdc++/ctype_base.h.patch @@ -1,33 +1,33 @@ -$DragonFly: src/gnu/lib/gcc34/libstdc++/ctype_base.h.patch,v 1.2 2005/05/08 16:10:37 joerg Exp $ +$DragonFly: src/gnu/lib/gcc34/libstdc++/ctype_base.h.patch,v 1.3 2005/09/17 14:39:44 joerg Exp $ -Index: ctype_base.h -=================================================================== -RCS file: /cvs/src/contrib/gcc-3.4/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h,v -retrieving revision 1.3 -diff -u -r1.3 ctype_base.h ---- config/os/bsd/netbsd/ctype_base.h 2 Mar 2005 00:56:21 -0000 1.3 -+++ config/os/bsd/netbsd/ctype_base.h 7 Mar 2005 17:38:44 -0000 +--- ctype_base.h.orig 2005-03-02 01:56:21.000000000 +0100 ++++ ctype_base.h 2005-09-16 20:02:33.000000000 +0200 @@ -43,16 +43,16 @@ // NB: Offsets into ctype::_M_table force a particular size // on the mask type. Because of this, we don't use an enum. - typedef unsigned char mask; -+ typedef uint16_t mask; - static const mask upper = _U; - static const mask lower = _L; +- 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 alpha = _A; -+ static const mask digit = _D; -+ static const mask xdigit = _X; - static const mask space = _S; +- 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 print = _R; -+ static const mask graph = _G; - static const mask cntrl = _C; - static const mask punct = _P; +- static const mask cntrl = _C; +- static const mask punct = _P; - static const mask alnum = _U | _L | _N; -+ static const mask alnum = _A | _D; ++ typedef uint16_t mask; ++ static const mask upper = _CTYPEMASK_U; ++ static const mask lower = _CTYPEMASK_L; ++ static const mask alpha = _CTYPEMASK_A; ++ static const mask digit = _CTYPEMASK_D; ++ static const mask xdigit = _CTYPEMASK_X; ++ static const mask space = _CTYPEMASK_S; ++ static const mask print = _CTYPEMASK_R; ++ static const mask graph = _CTYPEMASK_G; ++ static const mask cntrl = _CTYPEMASK_C; ++ static const mask punct = _CTYPEMASK_P; ++ static const mask alnum = _CTYPEMASK_A | _CTYPEMASK_D; }; diff --git a/include/ctype.h b/include/ctype.h index 6fc467329f..4461341cba 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -33,7 +33,7 @@ * * @(#)ctype.h 5.3 (Berkeley) 4/3/91 * $NetBSD: src/include/ctype.h,v 1.25 2003/10/22 15:51:18 kleink Exp $ - * $DragonFly: src/include/ctype.h,v 1.15 2005/07/07 07:20:11 dillon Exp $ + * $DragonFly: src/include/ctype.h,v 1.16 2005/09/17 14:39:44 joerg Exp $ */ #ifndef _CTYPE_H_ @@ -42,17 +42,17 @@ #include #include -#define _U 0x0001 -#define _L 0x0002 -#define _D 0x0004 -#define _S 0x0008 -#define _P 0x0010 -#define _C 0x0020 -#define _X 0x0040 -#define _B 0x0080 -#define _A 0x0100 -#define _G 0x0200 -#define _R 0x0400 +#define _CTYPEMASK_U 0x0001 +#define _CTYPEMASK_L 0x0002 +#define _CTYPEMASK_D 0x0004 +#define _CTYPEMASK_S 0x0008 +#define _CTYPEMASK_P 0x0010 +#define _CTYPEMASK_C 0x0020 +#define _CTYPEMASK_X 0x0040 +#define _CTYPEMASK_B 0x0080 +#define _CTYPEMASK_A 0x0100 +#define _CTYPEMASK_G 0x0200 +#define _CTYPEMASK_R 0x0400 extern const __uint16_t *__libc_ctype_; extern const __int16_t *__libc_tolower_tab_; @@ -120,17 +120,17 @@ __libc_ctype_convert(const __int16_t *array, int c) #undef _CTYPE_NUM_CHARS #endif -#define isdigit(c) __libc_ctype_index(_D, c) -#define islower(c) __libc_ctype_index(_L, c) -#define isspace(c) __libc_ctype_index(_S, c) -#define ispunct(c) __libc_ctype_index(_P, c) -#define isupper(c) __libc_ctype_index(_U, c) -#define isalpha(c) __libc_ctype_index(_A, c) -#define isxdigit(c) __libc_ctype_index(_X, c) -#define isalnum(c) __libc_ctype_index(_A|_D, c) -#define isprint(c) __libc_ctype_index(_R, c) -#define isgraph(c) __libc_ctype_index(_G, c) -#define iscntrl(c) __libc_ctype_index(_C, c) +#define isdigit(c) __libc_ctype_index(_CTYPEMASK_D, c) +#define islower(c) __libc_ctype_index(_CTYPEMASK_L, c) +#define isspace(c) __libc_ctype_index(_CTYPEMASK_S, c) +#define ispunct(c) __libc_ctype_index(_CTYPEMASK_P, c) +#define isupper(c) __libc_ctype_index(_CTYPEMASK_U, c) +#define isalpha(c) __libc_ctype_index(_CTYPEMASK_A, c) +#define isxdigit(c) __libc_ctype_index(_CTYPEMASK_X, c) +#define isalnum(c) __libc_ctype_index(_CTYPEMASK_A|_CTYPEMASK_D, c) +#define isprint(c) __libc_ctype_index(_CTYPEMASK_R, c) +#define isgraph(c) __libc_ctype_index(_CTYPEMASK_G, c) +#define iscntrl(c) __libc_ctype_index(_CTYPEMASK_C, c) #define tolower(c) __libc_ctype_convert(__libc_tolower_tab_, c) #define toupper(c) __libc_ctype_convert(__libc_toupper_tab_, c) @@ -143,7 +143,7 @@ __libc_ctype_convert(const __int16_t *array, int c) #if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 200112L || \ __XSI_VISIBLE >= 600 -#define isblank(c) __libc_ctype_index(_B, c) +#define isblank(c) __libc_ctype_index(_CTYPEMASK_B, c) #endif #endif /* !_CTYPE_H_DISABLE_MACROS_ */ diff --git a/lib/libc/gen/ctype.c b/lib/libc/gen/ctype.c index 2ee7f841ae..72a12a428b 100644 --- a/lib/libc/gen/ctype.c +++ b/lib/libc/gen/ctype.c @@ -1,5 +1,5 @@ /* $NetBSD: src/lib/libc/gen/ctype_.c,v 1.16 2003/08/07 16:42:46 agc Exp $ */ -/* $DragonFly: src/lib/libc/gen/ctype.c,v 1.4 2005/05/09 16:05:54 joerg Exp $ */ +/* $DragonFly: src/lib/libc/gen/ctype.c,v 1.5 2005/09/17 14:39:44 joerg Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -41,6 +41,18 @@ #include #include +#define _U _CTYPEMASK_U +#define _L _CTYPEMASK_L +#define _D _CTYPEMASK_D +#define _S _CTYPEMASK_S +#define _P _CTYPEMASK_P +#define _C _CTYPEMASK_C +#define _X _CTYPEMASK_X +#define _B _CTYPEMASK_B +#define _A _CTYPEMASK_A +#define _G _CTYPEMASK_G +#define _R _CTYPEMASK_R + const uint16_t __libc_C_ctype_[1 + _CTYPE_NUM_CHARS] = { 0, /*00*/ _C, _C, _C, _C, diff --git a/lib/libc/gen/isctype.c b/lib/libc/gen/isctype.c index 640d272b9a..14b3882a13 100644 --- a/lib/libc/gen/isctype.c +++ b/lib/libc/gen/isctype.c @@ -1,5 +1,5 @@ /* $NetBSD: src/lib/libc/gen/isctype.c,v 1.16 2003/08/07 16:42:52 agc Exp $ */ -/* $DragonFly: src/lib/libc/gen/isctype.c,v 1.5 2005/07/07 07:17:47 dillon Exp $ */ +/* $DragonFly: src/lib/libc/gen/isctype.c,v 1.6 2005/09/17 14:39:44 joerg Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -42,84 +42,84 @@ int isalnum(int c) { - return(__libc_ctype_index(_A|_D, c)); + return(__libc_ctype_index(_CTYPEMASK_A | _CTYPEMASK_D, c)); } #undef isalpha int isalpha(int c) { - return(__libc_ctype_index(_A, c)); + return(__libc_ctype_index(_CTYPEMASK_A, c)); } #undef isblank int isblank(int c) { - return(__libc_ctype_index(_B, c)); + return(__libc_ctype_index(_CTYPEMASK_B, c)); } #undef iscntrl int iscntrl(int c) { - return(__libc_ctype_index(_C, c)); + return(__libc_ctype_index(_CTYPEMASK_C, c)); } #undef isdigit int isdigit(int c) { - return(__libc_ctype_index(_D, c)); + return(__libc_ctype_index(_CTYPEMASK_D, c)); } #undef isgraph int isgraph(int c) { - return(__libc_ctype_index(_G, c)); + return(__libc_ctype_index(_CTYPEMASK_G, c)); } #undef islower int islower(int c) { - return(__libc_ctype_index(_L, c)); + return(__libc_ctype_index(_CTYPEMASK_L, c)); } #undef isprint int isprint(int c) { - return(__libc_ctype_index(_R, c)); + return(__libc_ctype_index(_CTYPEMASK_R, c)); } #undef ispunct int ispunct(int c) { - return(__libc_ctype_index(_P, c)); + return(__libc_ctype_index(_CTYPEMASK_P, c)); } #undef isspace int isspace(int c) { - return(__libc_ctype_index(_S, c)); + return(__libc_ctype_index(_CTYPEMASK_S, c)); } #undef isupper int isupper(int c) { - return(__libc_ctype_index(_U, c)); + return(__libc_ctype_index(_CTYPEMASK_U, c)); } #undef isxdigit int isxdigit(int c) { - return(__libc_ctype_index(_X, c)); + return(__libc_ctype_index(_CTYPEMASK_X, c)); } #undef _toupper diff --git a/lib/libc/locale/runeglue.c b/lib/libc/locale/runeglue.c index 0d0bb1914d..7dd75c03b0 100644 --- a/lib/libc/locale/runeglue.c +++ b/lib/libc/locale/runeglue.c @@ -1,5 +1,5 @@ /* $NetBSD: src/lib/libc/locale/runeglue.c,v 1.10 2003/03/10 21:18:49 tshiozak Exp $ */ -/* $DragonFly: src/lib/libc/locale/runeglue.c,v 1.2 2005/05/08 15:52:05 joerg Exp $ */ +/* $DragonFly: src/lib/libc/locale/runeglue.c,v 1.3 2005/09/17 14:39:44 joerg Exp $ */ /*- * Copyright (c)1999 Citrus Project, @@ -108,27 +108,27 @@ __runetable_to_netbsd_ctype(const char *locale) for (i = 0; i < _CTYPE_NUM_CHARS; i++) { new_ctype[i + 1] = 0; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_U) - new_ctype[i + 1] |= _U; + new_ctype[i + 1] |= _CTYPEMASK_U; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_L) - new_ctype[i + 1] |= _L; + new_ctype[i + 1] |= _CTYPEMASK_L; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_D) - new_ctype[i + 1] |= _D; + new_ctype[i + 1] |= _CTYPEMASK_D; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_S) - new_ctype[i + 1] |= _S; + new_ctype[i + 1] |= _CTYPEMASK_S; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_P) - new_ctype[i + 1] |= _P; + new_ctype[i + 1] |= _CTYPEMASK_P; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_C) - new_ctype[i + 1] |= _C; + new_ctype[i + 1] |= _CTYPEMASK_C; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_X) - new_ctype[i + 1] |= _X; + new_ctype[i + 1] |= _CTYPEMASK_X; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_B) - new_ctype[i + 1] |= _B; + new_ctype[i + 1] |= _CTYPEMASK_B; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_A) - new_ctype[i + 1] |= _A; + new_ctype[i + 1] |= _CTYPEMASK_A; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_G) - new_ctype[i + 1] |= _G; + new_ctype[i + 1] |= _CTYPEMASK_G; if (_CurrentRuneLocale->rl_runetype[i] & _CTYPE_R) - new_ctype[i + 1] |= _R; + new_ctype[i + 1] |= _CTYPEMASK_R; new_toupper[i + 1] = (int16_t)_CurrentRuneLocale->rl_mapupper[i]; new_tolower[i + 1] = (int16_t)_CurrentRuneLocale->rl_maplower[i]; -- 2.41.0