Sync-to-go: update copyright for 2015
[s-roff.git] / src / troff / request.h
blob35a0b1126dba09fd5ce09501fbc0fe154190b6dd
1 /*@
2 * Copyright (c) 2014 - 2015 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
4 * Copyright (C) 1989 - 1992, 2000 - 2002, 2004, 2008
5 * Free Software Foundation, Inc.
6 * Written by James Clark (jjc@jclark.com)
8 * This 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.
13 * This 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.
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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef _REQUEST_H
23 #define _REQUEST_H
25 #include "config.h"
26 #include "troff-config.h"
28 typedef void (*REQUEST_FUNCP)();
30 class macro;
32 class request_or_macro
33 : public object
35 public:
36 request_or_macro();
37 virtual void invoke(symbol, int) = 0;
38 virtual macro *to_macro();
41 class request
42 : public request_or_macro
44 REQUEST_FUNCP p;
46 public:
47 void invoke(symbol, int);
48 request(REQUEST_FUNCP);
51 void delete_request_or_macro(request_or_macro *);
53 extern object_dictionary request_dictionary;
55 class macro_header;
56 struct node;
58 class macro
59 : public request_or_macro
61 friend class string_iterator;
62 friend void chop_macro();
63 friend void substring_request();
64 friend int operator==(const macro &, const macro &);
66 const char *filename; // where was it defined?
67 int lineno;
68 int len;
69 int empty_macro;
70 int is_a_diversion;
71 int is_a_string; // if it contains no newline
73 public:
74 macro_header *p;
76 macro();
77 ~macro();
78 macro(const macro &);
79 macro(int);
80 macro &operator=(const macro &);
81 void append(unsigned char);
82 void append(node *);
83 void append_unsigned(unsigned int);
84 void append_int(int);
85 void append_str(const char *);
86 void set(unsigned char, int);
87 unsigned char get(int);
88 int length();
89 void invoke(symbol, int);
90 macro *to_macro();
91 void print_size();
92 int empty();
93 int is_diversion();
94 int is_string();
95 void clear_string_flag();
98 extern void init_input_requests();
99 extern void init_markup_requests();
100 extern void init_div_requests();
101 extern void init_node_requests();
102 extern void init_reg_requests();
103 extern void init_env_requests();
104 extern void init_hyphen_requests();
105 extern void init_request(const char *, REQUEST_FUNCP);
107 class charinfo;
108 class environment;
110 node *charinfo_to_node_list(charinfo *, const environment *);
112 #endif // _REQUEST_H
113 // s-it2-mode