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 8This file is part of groff. 9 10groff is free software; you can redistribute it and/or modify it under 11the terms of the GNU General Public License as published by the Free 12Software Foundation; either version 2, or (at your option) any later 13version. 14 15groff is distributed in the hope that it will be useful, but WITHOUT ANY 16WARRANTY; without even the implied warranty of MERCHANTABILITY or 17FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18for more details. 19 20You should have received a copy of the GNU General Public License along 21with groff; see the file COPYING. If not, write to the Free Software 22Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ 23 24typedef void (*REQUEST_FUNCP)(); 25 26class macro; 27 28class request_or_macro : public object { 29public: 30 request_or_macro(); 31 virtual void invoke(symbol s) = 0; 32 virtual macro *to_macro(); 33}; 34 35class request : public request_or_macro { 36 REQUEST_FUNCP p; 37public: 38 void invoke(symbol); 39 request(REQUEST_FUNCP); 40}; 41 42void delete_request_or_macro(request_or_macro *); 43 44extern object_dictionary request_dictionary; 45 46class macro_header; 47struct node; 48 49class 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; 55public: 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 81extern void init_input_requests(); 82extern void init_markup_requests(); 83extern void init_div_requests(); 84extern void init_node_requests(); 85extern void init_reg_requests(); 86extern void init_env_requests(); 87extern void init_hyphen_requests(); 88extern void init_request(const char *s, REQUEST_FUNCP f); 89 90class charinfo; 91class environment; 92 93node *charinfo_to_node_list(charinfo *, const environment *); 94