1// -*- C++ -*- 2/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2004 3 Free Software Foundation, Inc. 4 Written by James Clark (jjc@jclark.com) 5 6This file is part of groff. 7 8groff is free software; you can redistribute it and/or modify it under 9the terms of the GNU General Public License as published by the Free 10Software Foundation; either version 2, or (at your option) any later 11version. 12 13groff is distributed in the hope that it will be useful, but WITHOUT ANY 14WARRANTY; without even the implied warranty of MERCHANTABILITY or 15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16for more details. 17 18You should have received a copy of the GNU General Public License along 19with groff; see the file COPYING. If not, write to the Free Software 20Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ 21 22typedef void (*REQUEST_FUNCP)(); 23 24class macro; 25 26class request_or_macro : public object { 27public: 28 request_or_macro(); 29 virtual void invoke(symbol s) = 0; 30 virtual macro *to_macro(); 31}; 32 33class request : public request_or_macro { 34 REQUEST_FUNCP p; 35public: 36 void invoke(symbol); 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 { 48 const char *filename; // where was it defined? 49 int lineno; 50 int len; 51 int empty_macro; 52 int is_a_diversion; 53public: 54 macro_header *p; 55 macro(); 56 ~macro(); 57 macro(const macro &); 58 macro(int); 59 macro &operator=(const macro &); 60 void append(unsigned char); 61 void append(node *); 62 void append_unsigned(unsigned int i); 63 void append_int(int i); 64 void append_str(const char *); 65 void set(unsigned char, int); 66 unsigned char get(int); 67 int length(); 68 void invoke(symbol); 69 macro *to_macro(); 70 void print_size(); 71 int empty(); 72 int is_diversion(); 73 friend class string_iterator; 74 friend void chop_macro(); 75 friend void substring_request(); 76 friend int operator==(const macro &, const macro &); 77}; 78 79extern void init_input_requests(); 80extern void init_markup_requests(); 81extern void init_div_requests(); 82extern void init_node_requests(); 83extern void init_reg_requests(); 84extern void init_env_requests(); 85extern void init_hyphen_requests(); 86extern void init_request(const char *s, REQUEST_FUNCP f); 87 88class charinfo; 89class environment; 90 91node *charinfo_to_node_list(charinfo *, const environment *); 92