groff: update vendor branch to v1.20.1
[dragonfly.git] / contrib / groff / src / roff / troff / request.h
1 // -*- C++ -*-
2 /* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2004, 2008,
3                  2009
4    Free Software Foundation, Inc.
5      Written by James Clark (jjc@jclark.com)
6
7 This file is part of groff.
8
9 groff is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 groff is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17 for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
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, int) = 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, int);
37   request(REQUEST_FUNCP);
38 };
39
40 void delete_request_or_macro(request_or_macro *);
41
42 extern object_dictionary request_dictionary;
43
44 class macro_header;
45 struct node;
46
47 class macro : public request_or_macro {
48   const char *filename;         // where was it defined?
49   int lineno;
50   int len;
51   int empty_macro;
52   int is_a_diversion;
53   int is_a_string;              // if it contains no newline
54 public:
55   macro_header *p;
56   macro();
57   ~macro();
58   macro(const macro &);
59   macro(int);
60   macro &operator=(const macro &);
61   void append(unsigned char);
62   void append(node *);
63   void append_unsigned(unsigned int);
64   void append_int(int);
65   void append_str(const char *);
66   void set(unsigned char, int);
67   unsigned char get(int);
68   int length();
69   void invoke(symbol, int);
70   macro *to_macro();
71   void print_size();
72   int empty();
73   int is_diversion();
74   int is_string();
75   void clear_string_flag();
76   friend class string_iterator;
77   friend void chop_macro();
78   friend void substring_request();
79   friend int operator==(const macro &, const macro &);
80 };
81
82 extern void init_input_requests();
83 extern void init_markup_requests();
84 extern void init_div_requests();
85 extern void init_node_requests();
86 extern void init_reg_requests();
87 extern void init_env_requests();
88 extern void init_hyphen_requests();
89 extern void init_request(const char *, REQUEST_FUNCP);
90
91 class charinfo;
92 class environment;
93
94 node *charinfo_to_node_list(charinfo *, const environment *);