1132720Skan// Locale support -*- C++ -*-
2132720Skan
3132720Skan// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
4132720Skan// Free Software Foundation, Inc.
5132720Skan//
6132720Skan// This file is part of the GNU ISO C++ Library.  This library is free
7132720Skan// software; you can redistribute it and/or modify it under the
8132720Skan// terms of the GNU General Public License as published by the
9132720Skan// Free Software Foundation; either version 2, or (at your option)
10132720Skan// any later version.
11132720Skan
12132720Skan// This library is distributed in the hope that it will be useful,
13132720Skan// but WITHOUT ANY WARRANTY; without even the implied warranty of
14132720Skan// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15132720Skan// GNU General Public License for more details.
16132720Skan
17132720Skan// You should have received a copy of the GNU General Public License along
18132720Skan// with this library; see the file COPYING.  If not, write to the Free
19169691Skan// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20132720Skan// USA.
21132720Skan
22132720Skan// As a special exception, you may use this file as part of a free software
23132720Skan// library without restriction.  Specifically, if other files instantiate
24132720Skan// templates or use macros or inline functions from this file, or you compile
25132720Skan// this file and link it with other files to produce an executable, this
26132720Skan// file does not by itself cause the resulting executable to be covered by
27132720Skan// the GNU General Public License.  This exception does not however
28132720Skan// invalidate any other reasons why the executable file might be covered by
29132720Skan// the GNU General Public License.
30132720Skan
31169691Skan/** @file ctype_noninline.h
32169691Skan *  This is an internal header file, included by other library headers.
33169691Skan *  You should not attempt to use it directly.
34169691Skan */
35169691Skan
36132720Skan//
37132720Skan// ISO C++ 14882: 22.1  Locales
38132720Skan//
39169691Skan
40132720Skan// Information as gleaned from target/h/ctype.h
41132720Skan
42132720Skan  const ctype_base::mask*
43132720Skan  ctype<char>::classic_table() throw()
44132720Skan  { return __ctype; }
45132720Skan
46132720Skan  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
47132720Skan		     size_t __refs)
48132720Skan  : facet(__refs), _M_del(__table != 0 && __del),
49132720Skan  _M_toupper(NULL), _M_tolower(NULL),
50132720Skan  _M_table(__table ? __table : classic_table())
51132720Skan  {
52132720Skan    memset(_M_widen, 0, sizeof(_M_widen));
53132720Skan    _M_widen_ok = 0;
54132720Skan    memset(_M_narrow, 0, sizeof(_M_narrow));
55132720Skan    _M_narrow_ok = 0;
56132720Skan  }
57132720Skan
58132720Skan  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
59132720Skan  : facet(__refs), _M_del(__table != 0 && __del),
60132720Skan  _M_toupper(NULL), _M_tolower(NULL),
61132720Skan  _M_table(__table ? __table : classic_table())
62132720Skan  {
63132720Skan    memset(_M_widen, 0, sizeof(_M_widen));
64132720Skan    _M_widen_ok = 0;
65132720Skan    memset(_M_narrow, 0, sizeof(_M_narrow));
66132720Skan    _M_narrow_ok = 0;
67132720Skan  }
68132720Skan
69132720Skan  char
70132720Skan  ctype<char>::do_toupper(char __c) const
71132720Skan  { return __toupper(__c); }
72132720Skan
73132720Skan  const char*
74132720Skan  ctype<char>::do_toupper(char* __low, const char* __high) const
75132720Skan  {
76132720Skan    while (__low < __high)
77132720Skan      {
78132720Skan	*__low = __toupper(*__low);
79132720Skan	++__low;
80132720Skan      }
81132720Skan    return __high;
82132720Skan  }
83132720Skan
84132720Skan  char
85132720Skan  ctype<char>::do_tolower(char __c) const
86132720Skan  { return __tolower(__c); }
87132720Skan
88132720Skan  const char*
89132720Skan  ctype<char>::do_tolower(char* __low, const char* __high) const
90132720Skan  {
91132720Skan    while (__low < __high)
92132720Skan      {
93132720Skan	*__low = __tolower(*__low);
94132720Skan	++__low;
95132720Skan      }
96132720Skan    return __high;
97132720Skan  }
98