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