ctype_noninline.h revision 169692
1214501Srpaulo// Locale support -*- C++ -*-
2214501Srpaulo
3281806Srpaulo// Copyright (C) 1997, 1998, 1999, 2001, 2002
4214501Srpaulo//  Free Software Foundation, Inc.
5252726Srpaulo//
6252726Srpaulo// This file is part of the GNU ISO C++ Library.  This library is free
7214501Srpaulo// software; you can redistribute it and/or modify it under the
8214501Srpaulo// terms of the GNU General Public License as published by the
9214501Srpaulo// Free Software Foundation; either version 2, or (at your option)
10214501Srpaulo// any later version.
11214501Srpaulo
12214501Srpaulo// This library is distributed in the hope that it will be useful,
13214501Srpaulo// but WITHOUT ANY WARRANTY; without even the implied warranty of
14214501Srpaulo// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15214501Srpaulo// GNU General Public License for more details.
16214501Srpaulo
17214501Srpaulo// You should have received a copy of the GNU General Public License along
18281806Srpaulo// with this library; see the file COPYING.  If not, write to the Free
19214501Srpaulo// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20214501Srpaulo// USA.
21214501Srpaulo
22214501Srpaulo// As a special exception, you may use this file as part of a free software
23214501Srpaulo// library without restriction.  Specifically, if other files instantiate
24214501Srpaulo// templates or use macros or inline functions from this file, or you compile
25214501Srpaulo// this file and link it with other files to produce an executable, this
26214501Srpaulo// file does not by itself cause the resulting executable to be covered by
27214501Srpaulo// the GNU General Public License.  This exception does not however
28214501Srpaulo// invalidate any other reasons why the executable file might be covered by
29214501Srpaulo// the GNU General Public License.
30214501Srpaulo
31214501Srpaulo/** @file ctype_noninline.h
32214501Srpaulo *  This is an internal header file, included by other library headers.
33214501Srpaulo *  You should not attempt to use it directly.
34214501Srpaulo */
35214501Srpaulo
36214501Srpaulo//
37214501Srpaulo// ISO C++ 14882: 22.1  Locales
38214501Srpaulo//
39214501Srpaulo
40214501Srpaulo// Information as gleaned from /usr/include/ctype.h
41214501Srpaulo
42214501Srpaulo  const ctype_base::mask*
43214501Srpaulo  ctype<char>::classic_table() throw()
44214501Srpaulo  { return __ctype + 1; }
45214501Srpaulo
46214501Srpaulo  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
47214501Srpaulo		     size_t __refs)
48281806Srpaulo  : facet(__refs), _M_del(__table != 0 && __del),
49281806Srpaulo  _M_toupper(NULL), _M_tolower(NULL),
50281806Srpaulo  _M_table(!__table ? classic_table() : __table)
51281806Srpaulo  {
52281806Srpaulo    memset(_M_widen, 0, sizeof(_M_widen));
53281806Srpaulo    _M_widen_ok = 0;
54281806Srpaulo    memset(_M_narrow, 0, sizeof(_M_narrow));
55281806Srpaulo    _M_narrow_ok = 0;
56281806Srpaulo  }
57281806Srpaulo
58281806Srpaulo  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
59281806Srpaulo  : facet(__refs), _M_del(__table != 0 && __del),
60281806Srpaulo  _M_toupper(NULL), _M_tolower(NULL),
61281806Srpaulo  _M_table(!__table ? classic_table() : __table)
62281806Srpaulo  {
63281806Srpaulo    memset(_M_widen, 0, sizeof(_M_widen));
64281806Srpaulo    _M_widen_ok = 0;
65281806Srpaulo    memset(_M_narrow, 0, sizeof(_M_narrow));
66281806Srpaulo    _M_narrow_ok = 0;
67281806Srpaulo  }
68281806Srpaulo
69281806Srpaulo  char
70281806Srpaulo  ctype<char>::do_toupper(char __c) const
71281806Srpaulo  { return _toupper(__c); }
72281806Srpaulo
73281806Srpaulo  const char*
74281806Srpaulo  ctype<char>::do_toupper(char* __low, const char* __high) const
75281806Srpaulo  {
76281806Srpaulo    while (__low < __high)
77281806Srpaulo      {
78281806Srpaulo	*__low = do_toupper(*__low);
79281806Srpaulo	++__low;
80281806Srpaulo      }
81281806Srpaulo    return __high;
82281806Srpaulo  }
83281806Srpaulo
84281806Srpaulo  char
85281806Srpaulo  ctype<char>::do_tolower(char __c) const
86281806Srpaulo  { return _tolower(__c); }
87281806Srpaulo
88281806Srpaulo  const char*
89281806Srpaulo  ctype<char>::do_tolower(char* __low, const char* __high) const
90281806Srpaulo  {
91281806Srpaulo    while (__low < __high)
92281806Srpaulo      {
93281806Srpaulo	*__low = do_tolower(*__low);
94281806Srpaulo	++__low;
95281806Srpaulo      }
96281806Srpaulo    return __high;
97281806Srpaulo  }
98281806Srpaulo
99289549Srpaulo