1// -*- C++ -*-
2/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
3     Written by James Clark (jjc@jclark.com)
4
5This file is part of groff.
6
7groff is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
11
12groff is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License along
18with groff; see the file COPYING.  If not, write to the Free Software
19Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
20
21#ifdef HAVE_CC_LIMITS_H
22#include <limits.h>
23#else /* not HAVE_CC_LIMITS_H */
24#ifndef UCHAR_MAX
25#define UCHAR_MAX 255
26#endif
27#endif /* not HAVE_CC_LIMITS_H */
28
29enum cset_builtin { CSET_BUILTIN };
30
31class cset {
32public:
33  cset();
34  cset(cset_builtin);
35  cset(const char *);
36  cset(const unsigned char *);
37  int operator()(unsigned char) const;
38
39  cset &operator|=(const cset &);
40  cset &operator|=(unsigned char);
41
42  friend class cset_init;
43private:
44  char v[UCHAR_MAX+1];
45  void clear();
46};
47
48inline int cset::operator()(unsigned char c) const
49{
50  return v[c];
51}
52
53inline cset &cset::operator|=(unsigned char c)
54{
55  v[c] = 1;
56  return *this;
57}
58
59extern cset csalpha;
60extern cset csupper;
61extern cset cslower;
62extern cset csdigit;
63extern cset csxdigit;
64extern cset csspace;
65extern cset cspunct;
66extern cset csalnum;
67extern cset csprint;
68extern cset csgraph;
69extern cset cscntrl;
70
71static class cset_init {
72  static int initialised;
73public:
74  cset_init();
75} _cset_init;
76