Initial import from FreeBSD RELENG_4:
[games.git] / contrib / groff / src / roff / troff / request.h
1 // -*- C++ -*-
2 /* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002
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 2, or (at your option) any later
11 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 along
19 with groff; see the file COPYING.  If not, write to the Free Software
20 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21
22 typedef void (*REQUEST_FUNCP)();
23
24 class macro;
25
26 class request_or_macro : public object {
27 public:
28   request_or_macro();
29   virtual void invoke(symbol s) = 0;
30   virtual macro *to_macro();
31 };
32
33 class request : public request_or_macro {
34   REQUEST_FUNCP p;
35 public:
36   void invoke(symbol);
37   request(REQUEST_FUNCP);
38 };
39
40 void delete_request_or_macro(request_or_macro *);
41
42 extern object_dictionary request_dictionary;
43
44 struct macro_header;
45 struct node;
46
47 class macro : public request_or_macro {
48   macro_header *p;
49   const char *filename;         // where was it defined?
50   int lineno;
51   int len;
52   int empty_macro;
53 public:
54   macro();
55   ~macro();
56   macro(const macro &);
57   macro &operator=(const macro &);
58   void append(unsigned char);
59   void append(node *);
60   void append_unsigned(unsigned int i);
61   void append_int(int i);
62   void append_str(const char *);
63   void set(unsigned char, int);
64   unsigned char get(int);
65   int length();
66   void invoke(symbol);
67   macro *to_macro();
68   void print_size();
69   int empty();
70   friend class string_iterator;
71   friend void chop_macro();
72   friend void substring_request();
73   friend int operator==(const macro &, const macro &);
74 };
75
76 extern void init_input_requests();
77 extern void init_markup_requests();
78 extern void init_div_requests();
79 extern void init_node_requests();
80 extern void init_reg_requests();
81 extern void init_env_requests();
82 extern void init_hyphen_requests();
83 extern void init_request(const char *s, REQUEST_FUNCP f);
84
85 class charinfo;
86 class environment;
87
88 node *charinfo_to_node_list(charinfo *, const environment *);