1123988Smtm// Locale support -*- C++ -*-
2123988Smtm
3123988Smtm// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
4123988Smtm//
5123988Smtm// This file is part of the GNU ISO C++ Library.  This library is free
6123988Smtm// software; you can redistribute it and/or modify it under the
7123988Smtm// terms of the GNU General Public License as published by the
8123988Smtm// Free Software Foundation; either version 2, or (at your option)
9123988Smtm// any later version.
10123988Smtm
11123988Smtm// This library is distributed in the hope that it will be useful,
12123988Smtm// but WITHOUT ANY WARRANTY; without even the implied warranty of
13123988Smtm// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14123988Smtm// GNU General Public License for more details.
15123988Smtm
16123988Smtm// You should have received a copy of the GNU General Public License along
17123988Smtm// with this library; see the file COPYING.  If not, write to the Free
18123988Smtm// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19123988Smtm// USA.
20123988Smtm
21123988Smtm// As a special exception, you may use this file as part of a free software
22123988Smtm// library without restriction.  Specifically, if other files instantiate
23123988Smtm// templates or use macros or inline functions from this file, or you compile
24123988Smtm// this file and link it with other files to produce an executable, this
25123988Smtm// file does not by itself cause the resulting executable to be covered by
26123988Smtm// the GNU General Public License.  This exception does not however
27123988Smtm// invalidate any other reasons why the executable file might be covered by
28123988Smtm// the GNU General Public License.
29123988Smtm
30123988Smtm/** @file ctype_noninline.h
31123988Smtm *  This is an internal header file, included by other library headers.
32123988Smtm *  You should not attempt to use it directly.
33123988Smtm */
34124532Sru
35123988Smtm//
36123988Smtm// ISO C++ 14882: 22.1  Locales
37123988Smtm//
38123988Smtm
39123988Smtm// Information as gleaned from /usr/include/ctype.h
40123988Smtm
41123988Smtm  const ctype_base::mask*
42123988Smtm  ctype<char>::classic_table() throw()
43123988Smtm  { return 0; }
44123988Smtm
45123988Smtm  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
46123988Smtm		     size_t __refs)
47123988Smtm  : facet(__refs), _M_del(__table != 0 && __del),
48123988Smtm  _M_toupper(NULL), _M_tolower(NULL),
49123988Smtm  _M_table(__table ? __table : classic_table())
50123988Smtm  {
51123988Smtm    memset(_M_widen, 0, sizeof(_M_widen));
52123988Smtm    _M_widen_ok = 0;
53123988Smtm    memset(_M_narrow, 0, sizeof(_M_narrow));
54123988Smtm    _M_narrow_ok = 0;
55123988Smtm  }
56123988Smtm
57123988Smtm  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
58123988Smtm  : facet(__refs), _M_del(__table != 0 && __del),
59123988Smtm  _M_toupper(NULL), _M_tolower(NULL),
60123988Smtm  _M_table(__table ? __table : classic_table())
61123988Smtm  {
62123988Smtm    memset(_M_widen, 0, sizeof(_M_widen));
63123988Smtm    _M_widen_ok = 0;
64123988Smtm    memset(_M_narrow, 0, sizeof(_M_narrow));
65123988Smtm    _M_narrow_ok = 0;
66123988Smtm  }
67123988Smtm
68123988Smtm  char
69123988Smtm  ctype<char>::do_toupper(char __c) const
70123988Smtm  { return ::toupper((int) __c); }
71123988Smtm
72123988Smtm  const char*
73123988Smtm  ctype<char>::do_toupper(char* __low, const char* __high) const
74123988Smtm  {
75123988Smtm    while (__low < __high)
76123988Smtm      {
77123988Smtm	*__low = ::toupper((int) *__low);
78123988Smtm	++__low;
79123988Smtm      }
80123988Smtm    return __high;
81123988Smtm  }
82123988Smtm
83123988Smtm  char
84123988Smtm  ctype<char>::do_tolower(char __c) const
85123988Smtm  { return ::tolower((int) __c); }
86123988Smtm
87123988Smtm  const char*
88123988Smtm  ctype<char>::do_tolower(char* __low, const char* __high) const
89123988Smtm  {
90123988Smtm    while (__low < __high)
91123988Smtm      {
92123988Smtm	*__low = ::tolower((int) *__low);
93123988Smtm	++__low;
94123988Smtm      }
95123988Smtm    return __high;
96123988Smtm  }
97123988Smtm