man/l_roff-char.7.in: fix Bernd Warken (Dave Kemper, Werner Lemberg)..
[s-roff.git] / include / symbol.h
blobc3e8bff390fe66e27ae35369aa9a6bac11e1988a
1 /*@
2 * Copyright (c) 2014 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
4 * Copyright (C) 1989 - 1992, 2002, 2004
5 * Free Software Foundation, Inc.
6 * Written by James Clark (jjc@jclark.com)
8 * This is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2, or (at your option) any later
11 * version.
13 * This is distributed in the hope that it will be useful, but WITHOUT ANY
14 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with groff; see the file COPYING. If not, write to the Free Software
20 * Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef _SYMBOL_H
23 #define _SYMBOL_H
25 #include "config.h"
27 #define DONT_STORE 1
28 #define MUST_ALREADY_EXIST 2
30 class symbol
32 static const char **table;
33 static int table_used;
34 static int table_size;
35 static char *block;
36 static int block_size;
38 const char *s;
40 public:
41 symbol(const char *p, int how = 0);
42 symbol();
43 unsigned long hash() const;
44 int operator ==(symbol) const;
45 int operator !=(symbol) const;
46 const char *contents() const;
47 int is_null() const;
48 int is_empty() const;
51 extern const symbol NULL_SYMBOL;
52 extern const symbol EMPTY_SYMBOL;
54 inline symbol::symbol() : s(0)
58 inline int symbol::operator==(symbol p) const
60 return s == p.s;
63 inline int symbol::operator!=(symbol p) const
65 return s != p.s;
68 inline unsigned long symbol::hash() const
70 return (unsigned long)s;
73 inline const char *symbol::contents() const
75 return s;
78 inline int symbol::is_null() const
80 return s == 0;
83 inline int symbol::is_empty() const
85 return s != 0 && *s == 0;
88 symbol concat(symbol, symbol);
90 extern symbol default_symbol;
92 #endif // _SYMBOL_H
93 // s-it2-mode