2003-04-14 Andreas Tobler Benjamin Kosnik * config/os/generic/ctype_inline.h: Fix. Index: config/os/generic/ctype_inline.h =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/config/os/generic/ctype_inline.h,v retrieving revision 1.1 diff -c -p -r1.1 ctype_inline.h *** config/os/generic/ctype_inline.h 24 Jun 2002 05:49:14 -0000 1.1 --- config/os/generic/ctype_inline.h 15 Apr 2003 05:45:38 -0000 *************** *** 1,6 **** // Locale support -*- C++ -*- ! // Copyright (C) 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the --- 1,6 ---- // Locale support -*- C++ -*- ! // Copyright (C) 2000, 2003 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the *************** *** 39,107 **** // functionality should be added for the native os in question: see // the config/os/bits/ctype_*.h files. bool ctype:: is(mask __m, char __c) const { ! bool __ret; ! switch (__m) { ! case space: ! __ret = isspace(__c); ! break; ! case print: ! __ret = isprint(__c); ! break; ! case cntrl: ! __ret = iscntrl(__c); ! break; ! case upper: ! __ret = isupper(__c); ! break; ! case lower: ! __ret = islower(__c); ! break; ! case alpha: ! __ret = isalpha(__c); ! break; ! case digit: ! __ret = isdigit(__c); ! break; ! case punct: ! __ret = ispunct(__c); ! break; ! case xdigit: ! __ret = isxdigit(__c); ! break; ! case alnum: ! __ret = isalnum(__c); ! break; ! case graph: ! __ret = isgraph(__c); ! break; ! default: ! __ret = false; ! break; } - return __ret; } const char* ctype:: is(const char* __low, const char* __high, mask* __vec) const { ! const int __bitmasksize = 11; // Highest bitmask in ctype_base == 10 ! for (;__low < __high; ++__vec, ++__low) { ! mask __m = 0; ! int __i = 0; // Lowest bitmask in ctype_base == 0 ! for (;__i < __bitmasksize; ++__i) { ! mask __bit = static_cast(1 << __i); ! if (this->is(__bit, *__low)) ! __m |= __bit; } - *__vec = __m; } return __high; } --- 39,133 ---- // functionality should be added for the native os in question: see // the config/os/bits/ctype_*.h files. + // Constructing a synthetic "C" table should be seriously considered... + bool ctype:: is(mask __m, char __c) const { ! if (_M_table) ! return _M_table[static_cast(__c)] & __m; ! else { ! bool __ret = true; ! const int __bitmasksize = 11; ! int __bitcur = 0; // Lowest bitmask in ctype_base == 0 ! for (;__ret && __bitcur < __bitmasksize; ++__bitcur) ! { ! mask __bit = static_cast(1 << __bitcur); ! if (__m & __bit) ! { ! bool __testis; ! switch (__bit) ! { ! case space: ! __testis = isspace(__c); ! break; ! case print: ! __testis = isprint(__c); ! break; ! case cntrl: ! __testis = iscntrl(__c); ! break; ! case upper: ! __testis = isupper(__c); ! break; ! case lower: ! __testis = islower(__c); ! break; ! case alpha: ! __testis = isalpha(__c); ! break; ! case digit: ! __testis = isdigit(__c); ! break; ! case punct: ! __testis = ispunct(__c); ! break; ! case xdigit: ! __testis = isxdigit(__c); ! break; ! case alnum: ! __testis = isalnum(__c); ! break; ! case graph: ! __testis = isgraph(__c); ! break; ! default: ! __testis = false; ! break; ! } ! __ret &= __testis; ! } ! } ! return __ret; } } const char* ctype:: is(const char* __low, const char* __high, mask* __vec) const { ! if (_M_table) ! while (__low < __high) ! *__vec++ = _M_table[static_cast(*__low++)]; ! else { ! // Highest bitmask in ctype_base == 10. ! const int __bitmasksize = 11; ! for (;__low < __high; ++__vec, ++__low) { ! mask __m = 0; ! // Lowest bitmask in ctype_base == 0 ! int __i = 0; ! for (;__i < __bitmasksize; ++__i) ! { ! mask __bit = static_cast(1 << __i); ! if (this->is(__bit, *__low)) ! __m |= __bit; ! } ! *__vec = __m; } } return __high; } *************** *** 110,117 **** ctype:: scan_is(mask __m, const char* __low, const char* __high) const { ! while (__low < __high && !this->is(__m, *__low)) ! ++__low; return __low; } --- 136,148 ---- ctype:: scan_is(mask __m, const char* __low, const char* __high) const { ! if (_M_table) ! while (__low < __high ! && !(_M_table[static_cast(*__low)] & __m)) ! ++__low; ! else ! while (__low < __high && !this->is(__m, *__low)) ! ++__low; return __low; } *************** *** 119,125 **** ctype:: scan_not(mask __m, const char* __low, const char* __high) const { ! while (__low < __high && this->is(__m, *__low) != 0) ! ++__low; return __low; } --- 150,161 ---- ctype:: scan_not(mask __m, const char* __low, const char* __high) const { ! if (_M_table) ! while (__low < __high ! && (_M_table[static_cast(*__low)] & __m) != 0) ! ++__low; ! else ! while (__low < __high && this->is(__m, *__low) != 0) ! ++__low; return __low; }