xref: /netbsd-src/external/gpl2/groff/dist/src/roff/troff/reg.h (revision 89a07cf815a29524268025a1139fac4c5190f765)
1 /*	$NetBSD: reg.h,v 1.1.1.1 2016/01/13 18:41:48 christos Exp $	*/
2 
3 // -*- C++ -*-
4 /* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2003
5    Free Software Foundation, Inc.
6      Written by James Clark (jjc@jclark.com)
7 
8 This file is part of groff.
9 
10 groff is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free
12 Software Foundation; either version 2, or (at your option) any later
13 version.
14 
15 groff is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18 for more details.
19 
20 You should have received a copy of the GNU General Public License along
21 with groff; see the file COPYING.  If not, write to the Free Software
22 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
23 
24 
25 class reg : public object {
26 public:
27   virtual const char *get_string() = 0;
28   virtual int get_value(units *);
29   virtual void increment();
30   virtual void decrement();
31   virtual void set_increment(units);
32   virtual void alter_format(char f, int w = 0);
33   virtual const char *get_format();
34   virtual void set_value(units);
35 };
36 
37 class constant_int_reg : public reg {
38   int *p;
39 public:
40   constant_int_reg(int *);
41   const char *get_string();
42 };
43 
44 class general_reg : public reg {
45   char format;
46   int width;
47   int inc;
48 public:
49   general_reg();
50   const char *get_string();
51   void increment();
52   void decrement();
53   void alter_format(char f, int w = 0);
54   void set_increment(units);
55   const char *get_format();
56   void add_value(units);
57 
58   void set_value(units) = 0;
59   int get_value(units *) = 0;
60 };
61 
62 class variable_reg : public general_reg {
63   units *ptr;
64 public:
65   variable_reg(int *);
66   void set_value(units);
67   int get_value(units *);
68 };
69 
70 extern object_dictionary number_reg_dictionary;
71 extern void set_number_reg(symbol nm, units n);
72 extern void check_output_limits(int x, int y);
73 extern void reset_output_registers();
74 
75 reg *lookup_number_reg(symbol);
76 #if 0
77 void inline_define_reg();
78 #endif
79