175584Sru// -*- C++ -*-
275584Sru/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
375584Sru     Written by James Clark (jjc@jclark.com)
475584Sru
575584SruThis file is part of groff.
675584Sru
775584Srugroff is free software; you can redistribute it and/or modify it under
875584Sruthe terms of the GNU General Public License as published by the Free
975584SruSoftware Foundation; either version 2, or (at your option) any later
1075584Sruversion.
1175584Sru
1275584Srugroff is distributed in the hope that it will be useful, but WITHOUT ANY
1375584SruWARRANTY; without even the implied warranty of MERCHANTABILITY or
1475584SruFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1575584Srufor more details.
1675584Sru
1775584SruYou should have received a copy of the GNU General Public License along
1875584Sruwith groff; see the file COPYING.  If not, write to the Free Software
19151497SruFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
2075584Sru
2175584Sru#ifdef HAVE_CC_LIMITS_H
2275584Sru#include <limits.h>
2375584Sru#else /* not HAVE_CC_LIMITS_H */
2475584Sru#ifndef UCHAR_MAX
2575584Sru#define UCHAR_MAX 255
2675584Sru#endif
2775584Sru#endif /* not HAVE_CC_LIMITS_H */
2875584Sru
2975584Sruenum cset_builtin { CSET_BUILTIN };
3075584Sru
3175584Sruclass cset {
3275584Srupublic:
3375584Sru  cset();
3475584Sru  cset(cset_builtin);
3575584Sru  cset(const char *);
3675584Sru  cset(const unsigned char *);
3775584Sru  int operator()(unsigned char) const;
3875584Sru
3975584Sru  cset &operator|=(const cset &);
4075584Sru  cset &operator|=(unsigned char);
4175584Sru
4275584Sru  friend class cset_init;
4375584Sruprivate:
4475584Sru  char v[UCHAR_MAX+1];
4575584Sru  void clear();
4675584Sru};
4775584Sru
4875584Sruinline int cset::operator()(unsigned char c) const
4975584Sru{
5075584Sru  return v[c];
5175584Sru}
5275584Sru
5375584Sruinline cset &cset::operator|=(unsigned char c)
5475584Sru{
5575584Sru  v[c] = 1;
5675584Sru  return *this;
5775584Sru}
5875584Sru
5975584Sruextern cset csalpha;
6075584Sruextern cset csupper;
6175584Sruextern cset cslower;
6275584Sruextern cset csdigit;
6375584Sruextern cset csxdigit;
6475584Sruextern cset csspace;
6575584Sruextern cset cspunct;
6675584Sruextern cset csalnum;
6775584Sruextern cset csprint;
6875584Sruextern cset csgraph;
6975584Sruextern cset cscntrl;
7075584Sru
7175584Srustatic class cset_init {
7275584Sru  static int initialised;
7375584Srupublic:
7475584Sru  cset_init();
7575584Sru} _cset_init;
76