49e4b775e96cc1bcc11ea0ab13647f230c47c560
[platform/upstream/groff.git] / src / roff / troff / reg.h
1 // -*- C++ -*-
2 /* Copyright (C) 1989-2014  Free Software Foundation, Inc.
3      Written by James Clark (jjc@jclark.com)
4
5 This file is part of groff.
6
7 groff is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20
21 class reg : public object {
22 public:
23   virtual const char *get_string() = 0;
24   virtual int get_value(units *);
25   virtual void increment();
26   virtual void decrement();
27   virtual void set_increment(units);
28   virtual void alter_format(char f, int w = 0);
29   virtual const char *get_format();
30   virtual void set_value(units);
31 };
32
33 class constant_int_reg : public reg {
34   int *p;
35 public:
36   constant_int_reg(int *);
37   const char *get_string();
38 };
39
40 class general_reg : public reg {
41   char format;
42   int width;
43   int inc;
44 public:
45   general_reg();
46   const char *get_string();
47   void increment();
48   void decrement();
49   void alter_format(char f, int w = 0);
50   void set_increment(units);
51   const char *get_format();
52   void add_value(units);
53
54   void set_value(units) = 0;
55   int get_value(units *) = 0;
56 };
57
58 class variable_reg : public general_reg {
59   units *ptr;
60 public:
61   variable_reg(int *);
62   void set_value(units);
63   int get_value(units *);
64 };
65
66 extern object_dictionary number_reg_dictionary;
67 extern void set_number_reg(symbol nm, units n);
68 extern void check_output_limits(int x, int y);
69 extern void reset_output_registers();
70
71 reg *lookup_number_reg(symbol);
72 #if 0
73 void inline_define_reg();
74 #endif