ctype_noninline.h revision 169691
1218893Sdim// Locale support -*- C++ -*-
2193323Sed
3193323Sed// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
4193323Sed// Free Software Foundation, Inc.
5193323Sed//
6193323Sed// This file is part of the GNU ISO C++ Library.  This library is free
7193323Sed// software; you can redistribute it and/or modify it under the
8193323Sed// terms of the GNU General Public License as published by the
9193323Sed// Free Software Foundation; either version 2, or (at your option)
10218893Sdim// any later version.
11218893Sdim
12218893Sdim// This library is distributed in the hope that it will be useful,
13193323Sed// but WITHOUT ANY WARRANTY; without even the implied warranty of
14193323Sed// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15193323Sed// GNU General Public License for more details.
16193323Sed
17193323Sed// You should have received a copy of the GNU General Public License along
18193323Sed// with this library; see the file COPYING.  If not, write to the Free
19193323Sed// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20193323Sed// USA.
21212904Sdim
22193323Sed// As a special exception, you may use this file as part of a free software
23193323Sed// library without restriction.  Specifically, if other files instantiate
24193323Sed// templates or use macros or inline functions from this file, or you compile
25218893Sdim// this file and link it with other files to produce an executable, this
26198090Srdivacky// file does not by itself cause the resulting executable to be covered by
27193323Sed// the GNU General Public License.  This exception does not however
28199989Srdivacky// invalidate any other reasons why the executable file might be covered by
29199989Srdivacky// the GNU General Public License.
30218893Sdim
31199989Srdivacky/** @file ctype_noninline.h
32193323Sed *  This is an internal header file, included by other library headers.
33199989Srdivacky *  You should not attempt to use it directly.
34193323Sed */
35198090Srdivacky
36212904Sdim//
37193323Sed// ISO C++ 14882: 22.1  Locales
38193323Sed//
39193323Sed
40193323Sed// Information as gleaned from /usr/include/ctype.h
41193323Sed
42193323Sed  const ctype_base::mask*
43193323Sed  ctype<char>::classic_table() throw()
44193323Sed  { return __SB_masks; }
45193323Sed
46193323Sed  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
47193323Sed		     size_t __refs)
48193323Sed  : facet(__refs), _M_del(__table != 0 && __del),
49193323Sed  _M_toupper(NULL), _M_tolower(NULL),
50193323Sed  _M_table(__table ? __table : (const mask *) __SB_masks)
51193323Sed  {
52193323Sed    memset(_M_widen, 0, sizeof(_M_widen));
53193323Sed    _M_widen_ok = 0;
54193323Sed    memset(_M_narrow, 0, sizeof(_M_narrow));
55193323Sed    _M_narrow_ok = 0;
56193323Sed  }
57193323Sed
58193323Sed  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
59193323Sed  : facet(__refs), _M_del(__table != 0 && __del),
60193323Sed  _M_toupper(NULL), _M_tolower(NULL),
61193323Sed  _M_table(__table ? __table : (const mask *) __SB_masks)
62193323Sed  {
63193323Sed    memset(_M_widen, 0, sizeof(_M_widen));
64198892Srdivacky    _M_widen_ok = 0;
65199989Srdivacky    memset(_M_narrow, 0, sizeof(_M_narrow));
66199989Srdivacky    _M_narrow_ok = 0;
67199989Srdivacky  }
68199989Srdivacky
69199989Srdivacky  char
70199989Srdivacky  ctype<char>::do_toupper(char __c) const
71193323Sed  { return ::toupper((int) __c); }
72193323Sed
73193323Sed  const char*
74193323Sed  ctype<char>::do_toupper(char* __low, const char* __high) const
75193323Sed  {
76193323Sed    while (__low < __high)
77193323Sed      {
78193323Sed	*__low = ::toupper((int) *__low);
79193323Sed	++__low;
80199989Srdivacky      }
81193323Sed    return __high;
82193323Sed  }
83193323Sed
84193323Sed  char
85210299Sed  ctype<char>::do_tolower(char __c) const
86210299Sed  { return ::tolower((int) __c); }
87210299Sed
88210299Sed  const char*
89210299Sed  ctype<char>::do_tolower(char* __low, const char* __high) const
90193323Sed  {
91210299Sed    while (__low < __high)
92210299Sed      {
93210299Sed	*__low = ::tolower((int) *__low);
94210299Sed	++__low;
95210299Sed      }
96210299Sed    return __high;
97210299Sed  }
98210299Sed