No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / groff / src / preproc / eqn / box.h
blobe5ccc332a155a79a69f0e38cab027badde374c14
1 /* $NetBSD$ */
3 // -*- C++ -*-
4 /* Copyright (C) 1989, 1990, 1991, 1992, 2004, 2005
5 Free Software Foundation, Inc.
6 Written by James Clark (jjc@jclark.com)
8 This file is part of groff.
10 groff is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free
12 Software Foundation; either version 2, or (at your option) any later
13 version.
15 groff is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 for more details.
20 You should have received a copy of the GNU General Public License along
21 with groff; see the file COPYING. If not, write to the Free Software
22 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
24 class list_box;
26 class box {
27 private:
28 static int next_uid;
29 public:
30 int spacing_type;
31 const int uid;
32 box();
33 virtual void debug_print() = 0;
34 virtual ~box();
35 void top_level();
36 virtual int compute_metrics(int);
37 virtual void compute_subscript_kern();
38 virtual void compute_skew();
39 virtual void output();
40 void extra_space();
41 virtual list_box *to_list_box();
42 virtual int is_simple();
43 virtual int is_char();
44 virtual int left_is_italic();
45 virtual int right_is_italic();
46 virtual void handle_char_type(int, int);
47 enum { FOUND_NOTHING = 0, FOUND_MARK = 1, FOUND_LINEUP = 2 };
48 void set_spacing_type(char *type);
49 virtual void hint(unsigned);
50 virtual void check_tabs(int);
53 class box_list {
54 private:
55 int maxlen;
56 public:
57 box **p;
58 int len;
60 box_list(box *);
61 ~box_list();
62 void append(box *);
63 void list_check_tabs(int);
64 void list_debug_print(const char *sep);
65 friend class list_box;
68 // declarations to avoid friend name injection problems
69 box *make_script_box(box *, box *, box *);
70 box *make_mark_box(box *);
71 box *make_lineup_box(box *);
73 class list_box : public box {
74 int is_script;
75 box_list list;
76 int sty;
77 public:
78 list_box(box *);
79 void debug_print();
80 int compute_metrics(int);
81 void compute_subscript_kern();
82 void output();
83 void check_tabs(int);
84 void append(box *);
85 list_box *to_list_box();
86 void handle_char_type(int, int);
87 void compute_sublist_width(int n);
88 friend box *make_script_box(box *, box *, box *);
89 friend box *make_mark_box(box *);
90 friend box *make_lineup_box(box *);
93 enum alignment { LEFT_ALIGN, RIGHT_ALIGN, CENTER_ALIGN };
95 class column : public box_list {
96 alignment align;
97 int space;
98 public:
99 column(box *);
100 void set_alignment(alignment);
101 void set_space(int);
102 void debug_print(const char *);
104 friend class matrix_box;
105 friend class pile_box;
108 class pile_box : public box {
109 column col;
110 public:
111 pile_box(box *);
112 int compute_metrics(int);
113 void output();
114 void debug_print();
115 void check_tabs(int);
116 void set_alignment(alignment a) { col.set_alignment(a); }
117 void set_space(int n) { col.set_space(n); }
118 void append(box *p) { col.append(p); }
121 class matrix_box : public box {
122 private:
123 int len;
124 int maxlen;
125 column **p;
126 public:
127 matrix_box(column *);
128 ~matrix_box();
129 void append(column *);
130 int compute_metrics(int);
131 void output();
132 void check_tabs(int);
133 void debug_print();
136 class pointer_box : public box {
137 protected:
138 box *p;
139 public:
140 pointer_box(box *);
141 ~pointer_box();
142 int compute_metrics(int);
143 void compute_subscript_kern();
144 void compute_skew();
145 void debug_print() = 0;
146 void check_tabs(int);
149 class vcenter_box : public pointer_box {
150 public:
151 vcenter_box(box *);
152 int compute_metrics(int);
153 void output();
154 void debug_print();
157 class simple_box : public box {
158 public:
159 int compute_metrics(int);
160 void compute_subscript_kern();
161 void compute_skew();
162 void output() = 0;
163 void debug_print() = 0;
164 int is_simple();
167 class quoted_text_box : public simple_box {
168 char *text;
169 public:
170 quoted_text_box(char *);
171 ~quoted_text_box();
172 void debug_print();
173 void output();
176 class half_space_box : public simple_box {
177 public:
178 half_space_box();
179 void output();
180 void debug_print();
183 class space_box : public simple_box {
184 public:
185 space_box();
186 void output();
187 void debug_print();
190 class tab_box : public box {
191 int disabled;
192 public:
193 tab_box();
194 void output();
195 void debug_print();
196 void check_tabs(int);
199 class size_box : public pointer_box {
200 private:
201 char *size;
202 public:
203 size_box(char *, box *);
204 ~size_box();
205 int compute_metrics(int);
206 void output();
207 void debug_print();
210 class font_box : public pointer_box {
211 private:
212 char *f;
213 public:
214 font_box(char *, box *);
215 ~font_box();
216 int compute_metrics(int);
217 void output();
218 void debug_print();
221 class fat_box : public pointer_box {
222 public:
223 fat_box(box *);
224 int compute_metrics(int);
225 void output();
226 void debug_print();
229 class vmotion_box : public pointer_box {
230 private:
231 int n; // up is >= 0
232 public:
233 vmotion_box(int, box *);
234 int compute_metrics(int);
235 void output();
236 void debug_print();
239 class hmotion_box : public pointer_box {
240 int n;
241 public:
242 hmotion_box(int, box *);
243 int compute_metrics(int);
244 void output();
245 void debug_print();
248 box *split_text(char *);
249 box *make_delim_box(char *, box *, char *);
250 box *make_sqrt_box(box *);
251 box *make_prime_box(box *);
252 box *make_over_box(box *, box *);
253 box *make_small_over_box(box *, box *);
254 box *make_limit_box(box *, box *, box *);
255 box *make_accent_box(box *, box *);
256 box *make_uaccent_box(box *, box *);
257 box *make_overline_box(box *);
258 box *make_underline_box(box *);
259 box *make_special_box(char *, box *);
261 void set_space(int);
262 int set_gsize(const char *);
263 void set_gfont(const char *);
264 void set_grfont(const char *);
265 void set_gbfont(const char *);
266 const char *get_gfont();
267 const char *get_grfont();
268 const char *get_gbfont();
269 void start_string();
270 void output_string();
271 void do_text(const char *);
272 void restore_compatibility();
273 void set_script_reduction(int n);
274 void set_minimum_size(int n);
275 void set_param(const char *name, int value);
277 void set_char_type(const char *type, char *ch);
279 void init_char_table();
280 void init_extensible();
281 void define_extensible(const char *name, const char *ext, const char *top = 0,
282 const char *mid = 0, const char *bot = 0);