175584Sru// -*- C++ -*- 2151497Sru/* Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc. 375584Sru Written by James Clark (jjc@jclark.com) 475584Sru 575584SruThis file is part of groff. 675584Sru 775584Srugroff is free software; you can redistribute it and/or modify it under 875584Sruthe terms of the GNU General Public License as published by the Free 975584SruSoftware Foundation; either version 2, or (at your option) any later 1075584Sruversion. 1175584Sru 1275584Srugroff is distributed in the hope that it will be useful, but WITHOUT ANY 1375584SruWARRANTY; without even the implied warranty of MERCHANTABILITY or 1475584SruFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1575584Srufor more details. 1675584Sru 1775584SruYou should have received a copy of the GNU General Public License along 1875584Sruwith groff; see the file COPYING. If not, write to the Free Software 19151497SruFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ 2075584Sru 2175584Sru#if !defined(HTML_H) 2275584Sru# define HTML_H 2375584Sru 2475584Sru/* 2575584Sru * class and structure needed to buffer words 2675584Sru */ 2775584Sru 2875584Srustruct word { 2975584Sru char *s; 3075584Sru word *next; 3175584Sru 3275584Sru word (const char *w, int n); 3375584Sru ~word (); 3475584Sru}; 3575584Sru 3675584Sruclass word_list { 3775584Srupublic: 3875584Sru word_list (); 3975584Sru int flush (FILE *f); 4075584Sru void add_word (const char *s, int n); 4175584Sru int get_length (void); 4275584Sru 4375584Sruprivate: 4475584Sru int length; 4575584Sru word *head; 4675584Sru word *tail; 4775584Sru}; 4875584Sru 4975584Sruclass simple_output { 5075584Srupublic: 5175584Sru simple_output(FILE *, int max_line_length); 5275584Sru simple_output &put_string(const char *, int); 5375584Sru simple_output &put_string(const char *s); 54104862Sru simple_output &put_string(const string &s); 5575584Sru simple_output &put_troffps_char (const char *s); 5675584Sru simple_output &put_translated_string(const char *s); 5775584Sru simple_output &put_number(int); 5875584Sru simple_output &put_float(double); 5975584Sru simple_output &put_symbol(const char *); 6075584Sru simple_output &put_literal_symbol(const char *); 6175584Sru simple_output &set_fixed_point(int); 6275584Sru simple_output &simple_comment(const char *); 6375584Sru simple_output &begin_comment(const char *); 6475584Sru simple_output &comment_arg(const char *); 6575584Sru simple_output &end_comment(); 6675584Sru simple_output &set_file(FILE *); 6775584Sru simple_output &include_file(FILE *); 6875584Sru simple_output ©_file(FILE *); 6975584Sru simple_output &end_line(); 7075584Sru simple_output &put_raw_char(char); 7175584Sru simple_output &special(const char *); 7275584Sru simple_output &enable_newlines(int); 7375584Sru simple_output &check_newline(int n); 7475584Sru simple_output &nl(void); 75151497Sru simple_output &force_nl(void); 7675584Sru simple_output &space_or_newline (void); 7775584Sru simple_output &begin_tag (void); 7875584Sru FILE *get_file(); 7975584Sruprivate: 8075584Sru FILE *fp; 8175584Sru int max_line_length; // not including newline 8275584Sru int col; 8375584Sru int fixed_point; 8475584Sru int newlines; // can we issue newlines automatically? 8575584Sru word_list last_word; 8675584Sru 8775584Sru void flush_last_word (void); 8875584Sru int check_space (const char *s, int n); 8975584Sru}; 9075584Sru 9175584Sruinline FILE *simple_output::get_file() 9275584Sru{ 9375584Sru return fp; 9475584Sru} 9575584Sru 9675584Sru#endif 97