1 /* $NetBSD: html.h,v 1.1.1.1 2016/01/13 18:41:49 christos Exp $ */
2
3 // -*- C++ -*-
4 /* Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
5 Written by James Clark (jjc@jclark.com)
6
7 This file is part of groff.
8
9 groff is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2, or (at your option) any later
12 version.
13
14 groff is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 for more details.
18
19 You should have received a copy of the GNU General Public License along
20 with groff; see the file COPYING. If not, write to the Free Software
21 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
22
23 #if !defined(HTML_H)
24 # define HTML_H
25
26 /*
27 * class and structure needed to buffer words
28 */
29
30 struct word {
31 char *s;
32 word *next;
33
34 word (const char *w, int n);
35 ~word ();
36 };
37
38 class word_list {
39 public:
40 word_list ();
41 int flush (FILE *f);
42 void add_word (const char *s, int n);
43 int get_length (void);
44
45 private:
46 int length;
47 word *head;
48 word *tail;
49 };
50
51 class simple_output {
52 public:
53 simple_output(FILE *, int max_line_length);
54 simple_output &put_string(const char *, int);
55 simple_output &put_string(const char *s);
56 simple_output &put_string(const string &s);
57 simple_output &put_troffps_char (const char *s);
58 simple_output &put_translated_string(const char *s);
59 simple_output &put_number(int);
60 simple_output &put_float(double);
61 simple_output &put_symbol(const char *);
62 simple_output &put_literal_symbol(const char *);
63 simple_output &set_fixed_point(int);
64 simple_output &simple_comment(const char *);
65 simple_output &begin_comment(const char *);
66 simple_output &comment_arg(const char *);
67 simple_output &end_comment();
68 simple_output &set_file(FILE *);
69 simple_output &include_file(FILE *);
70 simple_output ©_file(FILE *);
71 simple_output &end_line();
72 simple_output &put_raw_char(char);
73 simple_output &special(const char *);
74 simple_output &enable_newlines(int);
75 simple_output &check_newline(int n);
76 simple_output &nl(void);
77 simple_output &force_nl(void);
78 simple_output &space_or_newline (void);
79 simple_output &begin_tag (void);
80 FILE *get_file();
81 private:
82 FILE *fp;
83 int max_line_length; // not including newline
84 int col;
85 int fixed_point;
86 int newlines; // can we issue newlines automatically?
87 word_list last_word;
88
89 void flush_last_word (void);
90 int check_space (const char *s, int n);
91 };
92
get_file()93 inline FILE *simple_output::get_file()
94 {
95 return fp;
96 }
97
98 #endif
99