1117397Skan// Locale support -*- C++ -*-
2117397Skan
3117397Skan// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
4117397Skan// Free Software Foundation, Inc.
5117397Skan//
6117397Skan// This file is part of the GNU ISO C++ Library.  This library is free
7117397Skan// software; you can redistribute it and/or modify it under the
8117397Skan// terms of the GNU General Public License as published by the
9117397Skan// Free Software Foundation; either version 2, or (at your option)
10117397Skan// any later version.
11117397Skan
12117397Skan// This library is distributed in the hope that it will be useful,
13117397Skan// but WITHOUT ANY WARRANTY; without even the implied warranty of
14117397Skan// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15117397Skan// GNU General Public License for more details.
16117397Skan
17117397Skan// You should have received a copy of the GNU General Public License along
18117397Skan// 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,
20117397Skan// USA.
21117397Skan
22117397Skan// As a special exception, you may use this file as part of a free software
23117397Skan// library without restriction.  Specifically, if other files instantiate
24117397Skan// templates or use macros or inline functions from this file, or you compile
25117397Skan// this file and link it with other files to produce an executable, this
26117397Skan// file does not by itself cause the resulting executable to be covered by
27117397Skan// the GNU General Public License.  This exception does not however
28117397Skan// invalidate any other reasons why the executable file might be covered by
29117397Skan// the GNU General Public License.
30117397Skan
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
36117397Skan//
37117397Skan// ISO C++ 14882: 22.1  Locales
38117397Skan//
39117397Skan
40117397Skan// Information as gleaned from /usr/include/ctype.h
41117397Skan
42117397Skan  const ctype_base::mask*
43117397Skan  ctype<char>::classic_table() throw()
44117397Skan  { return __SB_masks; }
45117397Skan
46117397Skan  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
47117397Skan		     size_t __refs)
48132720Skan  : facet(__refs), _M_del(__table != 0 && __del),
49117397Skan  _M_toupper(NULL), _M_tolower(NULL),
50117397Skan  _M_table(__table ? __table : (const mask *) __SB_masks)
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  }
57117397Skan
58117397Skan  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
59132720Skan  : facet(__refs), _M_del(__table != 0 && __del),
60117397Skan  _M_toupper(NULL), _M_tolower(NULL),
61117397Skan  _M_table(__table ? __table : (const mask *) __SB_masks)
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  }
68117397Skan
69117397Skan  char
70117397Skan  ctype<char>::do_toupper(char __c) const
71117397Skan  { return ::toupper((int) __c); }
72117397Skan
73117397Skan  const char*
74117397Skan  ctype<char>::do_toupper(char* __low, const char* __high) const
75117397Skan  {
76117397Skan    while (__low < __high)
77117397Skan      {
78117397Skan	*__low = ::toupper((int) *__low);
79117397Skan	++__low;
80117397Skan      }
81117397Skan    return __high;
82117397Skan  }
83117397Skan
84117397Skan  char
85117397Skan  ctype<char>::do_tolower(char __c) const
86117397Skan  { return ::tolower((int) __c); }
87117397Skan
88117397Skan  const char*
89117397Skan  ctype<char>::do_tolower(char* __low, const char* __high) const
90117397Skan  {
91117397Skan    while (__low < __high)
92117397Skan      {
93117397Skan	*__low = ::tolower((int) *__low);
94117397Skan	++__low;
95117397Skan      }
96117397Skan    return __high;
97117397Skan  }
98