ctype_noninline.h revision 256281
1139825Simp// Locale support -*- C++ -*- 286231Stmm 3117119Stmm// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 4167308Smarius// 586231Stmm// This file is part of the GNU ISO C++ Library. This library is free 686231Stmm// software; you can redistribute it and/or modify it under the 786231Stmm// terms of the GNU General Public License as published by the 886231Stmm// Free Software Foundation; either version 2, or (at your option) 986231Stmm// any later version. 1086231Stmm 1186231Stmm// This library is distributed in the hope that it will be useful, 1286231Stmm// but WITHOUT ANY WARRANTY; without even the implied warranty of 1386231Stmm// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1486231Stmm// GNU General Public License for more details. 1586231Stmm 1686231Stmm// You should have received a copy of the GNU General Public License along 1786231Stmm// with this library; see the file COPYING. If not, write to the Free 1886231Stmm// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 1986231Stmm// USA. 2086231Stmm 2186231Stmm// As a special exception, you may use this file as part of a free software 2286231Stmm// library without restriction. Specifically, if other files instantiate 2386231Stmm// templates or use macros or inline functions from this file, or you compile 2486231Stmm// this file and link it with other files to produce an executable, this 2586231Stmm// file does not by itself cause the resulting executable to be covered by 2686231Stmm// the GNU General Public License. This exception does not however 2786231Stmm// invalidate any other reasons why the executable file might be covered by 2886231Stmm// the GNU General Public License. 2986231Stmm 3090617Stmm/** @file ctype_noninline.h 3186231Stmm * This is an internal header file, included by other library headers. 3286231Stmm * You should not attempt to use it directly. 33152696Smarius */ 34152696Smarius 35152696Smarius// 3686231Stmm// ISO C++ 14882: 22.1 Locales 37153052Smarius// 38153052Smarius 3986231Stmm// Information as gleaned from DJGPP <ctype.h> 4086231Stmm 41117119Stmm const ctype_base::mask* 4286231Stmm ctype<char>::classic_table() throw() 4386231Stmm { return __dj_ctype_flags+1; } 4486231Stmm 4586231Stmm ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 4686231Stmm size_t __refs) 47174117Smarius : facet(__refs), _M_del(__table != 0 && __del), 48131949Smarcel _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower), 4986231Stmm _M_table(__table ? __table : classic_table()) 50170851Smarius { 51167308Smarius memset(_M_widen, 0, sizeof(_M_widen)); 52130068Sphk _M_widen_ok = 0; 53170851Smarius memset(_M_narrow, 0, sizeof(_M_narrow)); 54107477Stmm _M_narrow_ok = 0; 55153055Smarius } 56171730Smarius 57247600Smarius ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 5886231Stmm : facet(__refs), _M_del(__table != 0 && __del), 59133589Smarius _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower), 60119338Simp _M_table(__table ? __table : classic_table()) 6186231Stmm { 6286231Stmm memset(_M_widen, 0, sizeof(_M_widen)); 63167308Smarius _M_widen_ok = 0; 64116541Stmm memset(_M_narrow, 0, sizeof(_M_narrow)); 6586231Stmm _M_narrow_ok = 0; 66167308Smarius } 6786231Stmm 68152698Smarius char 6986231Stmm ctype<char>::do_toupper(char __c) const 70165886Smarius { return _M_toupper[static_cast<unsigned char>(__c)]; } 71119291Simp 7286231Stmm const char* 7386231Stmm ctype<char>::do_toupper(char* __low, const char* __high) const 7486231Stmm { 7586231Stmm while (__low < __high) 7686231Stmm { 7786231Stmm *__low = _M_toupper[static_cast<unsigned char>(*__low)]; 7886231Stmm ++__low; 79152696Smarius } 80152696Smarius return __high; 81167308Smarius } 82172066Smarius 83247620Smarius char 84172066Smarius ctype<char>::do_tolower(char __c) const 8590617Stmm { return _M_tolower[static_cast<unsigned char>(__c)]; } 86220039Smarius 87220039Smarius const char* 88172066Smarius ctype<char>::do_tolower(char* __low, const char* __high) const 89172066Smarius { 90178443Smarius while (__low < __high) 91178443Smarius { 9286231Stmm *__low = _M_tolower[static_cast<unsigned char>(*__low)]; 9386231Stmm ++__low; 94167308Smarius } 95167308Smarius return __high; 96167308Smarius } 97247600Smarius