groff: update vendor branch to v1.20.1
[dragonfly.git] / contrib / groff / src / roff / troff / reg.h
1 // -*- C++ -*-
2 /* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2003, 2009
3    Free Software Foundation, Inc.
4      Written by James Clark (jjc@jclark.com)
5
6 This file is part of groff.
7
8 groff 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 3 of the License, or
11 (at your option) any later version.
12
13 groff 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.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21
22 class reg : public object {
23 public:
24   virtual const char *get_string() = 0;
25   virtual int get_value(units *);
26   virtual void increment();
27   virtual void decrement();
28   virtual void set_increment(units);
29   virtual void alter_format(char f, int w = 0);
30   virtual const char *get_format();
31   virtual void set_value(units);
32 };
33
34 class constant_int_reg : public reg {
35   int *p;
36 public:
37   constant_int_reg(int *);
38   const char *get_string();
39 };
40
41 class general_reg : public reg {
42   char format;
43   int width;
44   int inc;
45 public:
46   general_reg();
47   const char *get_string();
48   void increment();
49   void decrement();
50   void alter_format(char f, int w = 0);
51   void set_increment(units);
52   const char *get_format();
53   void add_value(units);
54
55   void set_value(units) = 0;
56   int get_value(units *) = 0;
57 };
58
59 class variable_reg : public general_reg {
60   units *ptr;
61 public:
62   variable_reg(int *);
63   void set_value(units);
64   int get_value(units *);
65 };
66
67 extern object_dictionary number_reg_dictionary;
68 extern void set_number_reg(symbol nm, units n);
69 extern void check_output_limits(int x, int y);
70 extern void reset_output_registers();
71
72 reg *lookup_number_reg(symbol);
73 #if 0
74 void inline_define_reg();
75 #endif