| Commit | Line | Data |
|---|---|---|
| 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 | ||
| 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 | |
| 4d3e9548 JL |
11 | Software Foundation, either version 3 of the License, or |
| 12 | (at your option) any later version. | |
| 92d0a6a6 JR |
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 | ||
| 4d3e9548 JL |
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/>. */ | |
| 92d0a6a6 JR |
21 | |
| 22 | typedef void (*REQUEST_FUNCP)(); | |
| 23 | ||
| 24 | class macro; | |
| 25 | ||
| 26 | class request_or_macro : public object { | |
| 27 | public: | |
| 28 | request_or_macro(); | |
| 4d3e9548 | 29 | virtual void invoke(symbol, int) = 0; |
| 92d0a6a6 JR |
30 | virtual macro *to_macro(); |
| 31 | }; | |
| 32 | ||
| 33 | class request : public request_or_macro { | |
| 34 | REQUEST_FUNCP p; | |
| 35 | public: | |
| 4d3e9548 | 36 | void invoke(symbol, int); |
| 92d0a6a6 JR |
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 { | |
| 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 | 54 | public: |
| 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 | ||
| 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(); | |
| 4d3e9548 | 89 | extern void init_request(const char *, REQUEST_FUNCP); |
| 92d0a6a6 JR |
90 | |
| 91 | class charinfo; | |
| 92 | class environment; | |
| 93 | ||
| 94 | node *charinfo_to_node_list(charinfo *, const environment *); |