Line data Source code
1 : /* Copyright (C) 1989-2020 Free Software Foundation, Inc. 2 : Written by James Clark (jjc@jclark.com) 3 : 4 : This file is part of groff, the GNU roff typesetting system. 5 : 6 : groff is free software; you can redistribute it and/or modify it under 7 : the terms of the GNU General Public License as published by the Free 8 : Software Foundation, either version 3 of the License, or 9 : (at your option) any later version. 10 : 11 : groff is distributed in the hope that it will be useful, but WITHOUT ANY 12 : WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 : for more details. 15 : 16 : You should have received a copy of the GNU General Public License 17 : along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 : 19 : #ifndef UCHAR_MAX 20 : #define UCHAR_MAX 255 21 : #endif 22 : 23 : enum cmap_builtin { CMAP_BUILTIN }; 24 : 25 : class cmap { 26 : public: 27 : cmap(); 28 : cmap(cmap_builtin); 29 : int operator()(unsigned char) const; 30 : unsigned char &operator[](unsigned char); 31 : 32 : friend class cmap_init; 33 : private: 34 : unsigned char v[UCHAR_MAX+1]; 35 : }; 36 : 37 446853 : inline int cmap::operator()(unsigned char c) const 38 : { 39 446853 : return v[c]; 40 : } 41 : 42 : inline unsigned char &cmap::operator[](unsigned char c) 43 : { 44 : return v[c]; 45 : } 46 : 47 : extern cmap cmlower; 48 : extern cmap cmupper; 49 : 50 : static class cmap_init { 51 : static int initialised; 52 : public: 53 : cmap_init(); 54 : } _cmap_init; 55 : 56 : // Local Variables: 57 : // fill-column: 72 58 : // mode: C++ 59 : // End: 60 : // vim: set cindent noexpandtab shiftwidth=2 textwidth=72: