ctype_noninline.h revision 132720
1117397Skan// Locale support -*- C++ -*- 2117397Skan 3117397Skan// Copyright (C) 2001, 2002 Free Software Foundation, Inc. 4117397Skan// 5117397Skan// This file is part of the GNU ISO C++ Library. This library is free 6117397Skan// software; you can redistribute it and/or modify it under the 7117397Skan// terms of the GNU General Public License as published by the 8117397Skan// Free Software Foundation; either version 2, or (at your option) 9117397Skan// any later version. 10117397Skan 11117397Skan// This library is distributed in the hope that it will be useful, 12117397Skan// but WITHOUT ANY WARRANTY; without even the implied warranty of 13117397Skan// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14117397Skan// GNU General Public License for more details. 15117397Skan 16117397Skan// You should have received a copy of the GNU General Public License along 17117397Skan// with this library; see the file COPYING. If not, write to the Free 18117397Skan// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 19117397Skan// USA. 20117397Skan 21117397Skan// As a special exception, you may use this file as part of a free software 22117397Skan// library without restriction. Specifically, if other files instantiate 23117397Skan// templates or use macros or inline functions from this file, or you compile 24117397Skan// this file and link it with other files to produce an executable, this 25117397Skan// file does not by itself cause the resulting executable to be covered by 26117397Skan// the GNU General Public License. This exception does not however 27117397Skan// invalidate any other reasons why the executable file might be covered by 28117397Skan// the GNU General Public License. 29117397Skan 30117397Skan// 31117397Skan// ISO C++ 14882: 22.1 Locales 32117397Skan// 33117397Skan 34117397Skan// Information as gleaned from DJGPP <ctype.h> 35117397Skan 36117397Skan const ctype_base::mask* 37117397Skan ctype<char>::classic_table() throw() 38117397Skan { return 0; } 39117397Skan 40117397Skan ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 41117397Skan size_t __refs) 42132720Skan : facet(__refs), _M_del(__table != 0 && __del), 43117397Skan _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower), 44117397Skan _M_table(__table ? __table : __dj_ctype_flags) 45132720Skan { 46132720Skan memset(_M_widen, 0, sizeof(_M_widen)); 47132720Skan _M_widen_ok = 0; 48132720Skan memset(_M_narrow, 0, sizeof(_M_narrow)); 49132720Skan _M_narrow_ok = 0; 50132720Skan } 51117397Skan 52117397Skan ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 53132720Skan : facet(__refs), _M_del(__table != 0 && __del), 54117397Skan _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower), 55117397Skan _M_table(__table ? __table : __dj_ctype_flags) 56132720Skan { 57132720Skan memset(_M_widen, 0, sizeof(_M_widen)); 58132720Skan _M_widen_ok = 0; 59132720Skan memset(_M_narrow, 0, sizeof(_M_narrow)); 60132720Skan _M_narrow_ok = 0; 61132720Skan } 62117397Skan 63117397Skan char 64117397Skan ctype<char>::do_toupper(char __c) const 65117397Skan { return _M_toupper[static_cast<int>(__c)+1]; } 66117397Skan 67117397Skan const char* 68117397Skan ctype<char>::do_toupper(char* __low, const char* __high) const 69117397Skan { 70117397Skan while (__low < __high) 71117397Skan { 72117397Skan *__low = ::toupper(static_cast<int> (*__low)); 73117397Skan ++__low; 74117397Skan } 75117397Skan return __high; 76117397Skan } 77117397Skan 78117397Skan char 79117397Skan ctype<char>::do_tolower(char __c) const 80117397Skan { return _M_tolower[static_cast<int>(__c)+1]; } 81117397Skan 82117397Skan const char* 83117397Skan ctype<char>::do_tolower(char* __low, const char* __high) const 84117397Skan { 85117397Skan while (__low < __high) 86117397Skan { 87117397Skan *__low = ::tolower(static_cast<int> (*__low)); 88117397Skan ++__low; 89117397Skan } 90117397Skan return __high; 91117397Skan } 92