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