175584Sru// -*- C++ -*- 2151497Sru/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2004 375584Sru Free Software Foundation, Inc. 475584Sru Written by James Clark (jjc@jclark.com) 575584Sru 675584SruThis file is part of groff. 775584Sru 875584Srugroff is free software; you can redistribute it and/or modify it under 975584Sruthe terms of the GNU General Public License as published by the Free 1075584SruSoftware Foundation; either version 2, or (at your option) any later 1175584Sruversion. 1275584Sru 1375584Srugroff is distributed in the hope that it will be useful, but WITHOUT ANY 1475584SruWARRANTY; without even the implied warranty of MERCHANTABILITY or 1575584SruFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1675584Srufor more details. 1775584Sru 1875584SruYou should have received a copy of the GNU General Public License along 1975584Sruwith groff; see the file COPYING. If not, write to the Free Software 20151497SruFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ 2175584Sru 2275584Srutypedef void (*REQUEST_FUNCP)(); 2375584Sru 2475584Sruclass macro; 2575584Sru 2675584Sruclass request_or_macro : public object { 2775584Srupublic: 2875584Sru request_or_macro(); 2975584Sru virtual void invoke(symbol s) = 0; 3075584Sru virtual macro *to_macro(); 3175584Sru}; 3275584Sru 3375584Sruclass request : public request_or_macro { 3475584Sru REQUEST_FUNCP p; 3575584Srupublic: 3675584Sru void invoke(symbol); 3775584Sru request(REQUEST_FUNCP); 3875584Sru}; 3975584Sru 4075584Sruvoid delete_request_or_macro(request_or_macro *); 4175584Sru 4275584Sruextern object_dictionary request_dictionary; 4375584Sru 44151497Sruclass macro_header; 4575584Srustruct node; 4675584Sru 4775584Sruclass macro : public request_or_macro { 4875584Sru const char *filename; // where was it defined? 4975584Sru int lineno; 50104862Sru int len; 51104862Sru int empty_macro; 52151497Sru int is_a_diversion; 5375584Srupublic: 54151497Sru macro_header *p; 5575584Sru macro(); 5675584Sru ~macro(); 5775584Sru macro(const macro &); 58151497Sru macro(int); 5975584Sru macro &operator=(const macro &); 6075584Sru void append(unsigned char); 6175584Sru void append(node *); 6275584Sru void append_unsigned(unsigned int i); 6375584Sru void append_int(int i); 6475584Sru void append_str(const char *); 65104862Sru void set(unsigned char, int); 66104862Sru unsigned char get(int); 67104862Sru int length(); 6875584Sru void invoke(symbol); 6975584Sru macro *to_macro(); 7075584Sru void print_size(); 7175584Sru int empty(); 72151497Sru int is_diversion(); 7375584Sru friend class string_iterator; 7475584Sru friend void chop_macro(); 75104862Sru friend void substring_request(); 7675584Sru friend int operator==(const macro &, const macro &); 7775584Sru}; 7875584Sru 7975584Sruextern void init_input_requests(); 8075584Sruextern void init_markup_requests(); 8175584Sruextern void init_div_requests(); 8275584Sruextern void init_node_requests(); 8375584Sruextern void init_reg_requests(); 8475584Sruextern void init_env_requests(); 8575584Sruextern void init_hyphen_requests(); 8675584Sruextern void init_request(const char *s, REQUEST_FUNCP f); 8775584Sru 8875584Sruclass charinfo; 8975584Sruclass environment; 9075584Sru 9175584Srunode *charinfo_to_node_list(charinfo *, const environment *); 92