xref: /netbsd-src/external/gpl2/groff/dist/src/roff/troff/request.h (revision 89a07cf815a29524268025a1139fac4c5190f765)
1 /*	$NetBSD: request.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, 2002, 2004
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 typedef void (*REQUEST_FUNCP)();
25 
26 class macro;
27 
28 class request_or_macro : public object {
29 public:
30   request_or_macro();
31   virtual void invoke(symbol s) = 0;
32   virtual macro *to_macro();
33 };
34 
35 class request : public request_or_macro {
36   REQUEST_FUNCP p;
37 public:
38   void invoke(symbol);
39   request(REQUEST_FUNCP);
40 };
41 
42 void delete_request_or_macro(request_or_macro *);
43 
44 extern object_dictionary request_dictionary;
45 
46 class macro_header;
47 struct node;
48 
49 class macro : public request_or_macro {
50   const char *filename;		// where was it defined?
51   int lineno;
52   int len;
53   int empty_macro;
54   int is_a_diversion;
55 public:
56   macro_header *p;
57   macro();
58   ~macro();
59   macro(const macro &);
60   macro(int);
61   macro &operator=(const macro &);
62   void append(unsigned char);
63   void append(node *);
64   void append_unsigned(unsigned int i);
65   void append_int(int i);
66   void append_str(const char *);
67   void set(unsigned char, int);
68   unsigned char get(int);
69   int length();
70   void invoke(symbol);
71   macro *to_macro();
72   void print_size();
73   int empty();
74   int is_diversion();
75   friend class string_iterator;
76   friend void chop_macro();
77   friend void substring_request();
78   friend int operator==(const macro &, const macro &);
79 };
80 
81 extern void init_input_requests();
82 extern void init_markup_requests();
83 extern void init_div_requests();
84 extern void init_node_requests();
85 extern void init_reg_requests();
86 extern void init_env_requests();
87 extern void init_hyphen_requests();
88 extern void init_request(const char *s, REQUEST_FUNCP f);
89 
90 class charinfo;
91 class environment;
92 
93 node *charinfo_to_node_list(charinfo *, const environment *);
94