ctype_noninline.h revision 169691
150027Speter// Locale support -*- C++ -*-
272376Sjake
372376Sjake// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
450027Speter// Free Software Foundation, Inc.
550027Speter//
650027Speter// This file is part of the GNU ISO C++ Library.  This library is free
750027Speter// software; you can redistribute it and/or modify it under the
850027Speter// terms of the GNU General Public License as published by the
950027Speter// Free Software Foundation; either version 2, or (at your option)
1050027Speter// any later version.
1150027Speter
1250027Speter// This library is distributed in the hope that it will be useful,
1350027Speter// but WITHOUT ANY WARRANTY; without even the implied warranty of
1450027Speter// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1550027Speter// GNU General Public License for more details.
1650027Speter
1750027Speter// You should have received a copy of the GNU General Public License along
1850027Speter// with this library; see the file COPYING.  If not, write to the Free
1950027Speter// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2050027Speter// USA.
2150027Speter
2250027Speter// As a special exception, you may use this file as part of a free software
2350027Speter// library without restriction.  Specifically, if other files instantiate
2450027Speter// templates or use macros or inline functions from this file, or you compile
2550027Speter// this file and link it with other files to produce an executable, this
2650027Speter// file does not by itself cause the resulting executable to be covered by
2750027Speter// the GNU General Public License.  This exception does not however
2850027Speter// invalidate any other reasons why the executable file might be covered by
2999072Sjulian// the GNU General Public License.
3099072Sjulian
3199072Sjulian/** @file ctype_noninline.h
3299072Sjulian *  This is an internal header file, included by other library headers.
3399072Sjulian *  You should not attempt to use it directly.
3499072Sjulian */
3599072Sjulian
3699072Sjulian//
3799072Sjulian// ISO C++ 14882: 22.1  Locales
3899072Sjulian//
3999072Sjulian
4099072Sjulian// Information as gleaned from /usr/include/ctype.h
4199072Sjulian
4299072Sjulian  const ctype_base::mask*
4399072Sjulian  ctype<char>::classic_table() throw()
4499072Sjulian  { return __SB_masks; }
4599072Sjulian
4699072Sjulian  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
4799072Sjulian		     size_t __refs)
4899072Sjulian  : facet(__refs), _M_del(__table != 0 && __del),
4999072Sjulian  _M_toupper(NULL), _M_tolower(NULL),
5099072Sjulian  _M_table(__table ? __table : (const mask *) __SB_masks)
5199072Sjulian  {
5299072Sjulian    memset(_M_widen, 0, sizeof(_M_widen));
5399072Sjulian    _M_widen_ok = 0;
5499072Sjulian    memset(_M_narrow, 0, sizeof(_M_narrow));
5599072Sjulian    _M_narrow_ok = 0;
5699072Sjulian  }
5799072Sjulian
5899072Sjulian  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
5999072Sjulian  : facet(__refs), _M_del(__table != 0 && __del),
6099072Sjulian  _M_toupper(NULL), _M_tolower(NULL),
6199072Sjulian  _M_table(__table ? __table : (const mask *) __SB_masks)
6299072Sjulian  {
6399072Sjulian    memset(_M_widen, 0, sizeof(_M_widen));
6499072Sjulian    _M_widen_ok = 0;
6599072Sjulian    memset(_M_narrow, 0, sizeof(_M_narrow));
6699072Sjulian    _M_narrow_ok = 0;
6799072Sjulian  }
6899072Sjulian
6999072Sjulian  char
7099072Sjulian  ctype<char>::do_toupper(char __c) const
7199072Sjulian  { return ::toupper((int) __c); }
7299072Sjulian
7399072Sjulian  const char*
7499072Sjulian  ctype<char>::do_toupper(char* __low, const char* __high) const
7599072Sjulian  {
7699072Sjulian    while (__low < __high)
7799072Sjulian      {
7899072Sjulian	*__low = ::toupper((int) *__low);
7999072Sjulian	++__low;
8099072Sjulian      }
8199072Sjulian    return __high;
8299072Sjulian  }
8399072Sjulian
8499072Sjulian  char
8599072Sjulian  ctype<char>::do_tolower(char __c) const
8699072Sjulian  { return ::tolower((int) __c); }
8799072Sjulian
8899072Sjulian  const char*
8999072Sjulian  ctype<char>::do_tolower(char* __low, const char* __high) const
9099072Sjulian  {
9199072Sjulian    while (__low < __high)
9250027Speter      {
9350027Speter	*__low = ::tolower((int) *__low);
9450027Speter	++__low;
9565557Sjasone      }
9674914Sjhb    return __high;
9767365Sjhb  }
9850027Speter