Another try to update getopt files. This time we add a dummy
[s-roff.git] / src / preproc / eqn / box.h
blob94842077039a4b162d07134d410d769ed4742bcb
1 // -*- C++ -*-
2 /* Copyright (C) 1989, 1990, 1991, 1992, 2004, 2005
3 Free Software Foundation, Inc.
4 Written by James Clark (jjc@jclark.com)
6 This file is part of groff.
8 groff is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
13 groff is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License along
19 with groff; see the file COPYING. If not, write to the Free Software
20 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
22 class list_box;
24 class box {
25 private:
26 static int next_uid;
27 public:
28 int spacing_type;
29 const int uid;
30 box();
31 virtual void debug_print() = 0;
32 virtual ~box();
33 void top_level();
34 virtual int compute_metrics(int);
35 virtual void compute_subscript_kern();
36 virtual void compute_skew();
37 virtual void output();
38 void extra_space();
39 virtual list_box *to_list_box();
40 virtual int is_simple();
41 virtual int is_char();
42 virtual int left_is_italic();
43 virtual int right_is_italic();
44 virtual void handle_char_type(int, int);
45 enum { FOUND_NOTHING = 0, FOUND_MARK = 1, FOUND_LINEUP = 2 };
46 void set_spacing_type(char *type);
47 virtual void hint(unsigned);
48 virtual void check_tabs(int);
51 class box_list {
52 private:
53 int maxlen;
54 public:
55 box **p;
56 int len;
58 box_list(box *);
59 ~box_list();
60 void append(box *);
61 void list_check_tabs(int);
62 void list_debug_print(const char *sep);
63 friend class list_box;
66 // declarations to avoid friend name injection problems
67 box *make_script_box(box *, box *, box *);
68 box *make_mark_box(box *);
69 box *make_lineup_box(box *);
71 class list_box : public box {
72 int is_script;
73 box_list list;
74 int sty;
75 public:
76 list_box(box *);
77 void debug_print();
78 int compute_metrics(int);
79 void compute_subscript_kern();
80 void output();
81 void check_tabs(int);
82 void append(box *);
83 list_box *to_list_box();
84 void handle_char_type(int, int);
85 void compute_sublist_width(int n);
86 friend box *make_script_box(box *, box *, box *);
87 friend box *make_mark_box(box *);
88 friend box *make_lineup_box(box *);
91 enum alignment { LEFT_ALIGN, RIGHT_ALIGN, CENTER_ALIGN };
93 class column : public box_list {
94 alignment align;
95 int space;
96 public:
97 column(box *);
98 void set_alignment(alignment);
99 void set_space(int);
100 void debug_print(const char *);
102 friend class matrix_box;
103 friend class pile_box;
106 class pile_box : public box {
107 column col;
108 public:
109 pile_box(box *);
110 int compute_metrics(int);
111 void output();
112 void debug_print();
113 void check_tabs(int);
114 void set_alignment(alignment a) { col.set_alignment(a); }
115 void set_space(int n) { col.set_space(n); }
116 void append(box *p) { col.append(p); }
119 class matrix_box : public box {
120 private:
121 int len;
122 int maxlen;
123 column **p;
124 public:
125 matrix_box(column *);
126 ~matrix_box();
127 void append(column *);
128 int compute_metrics(int);
129 void output();
130 void check_tabs(int);
131 void debug_print();
134 class pointer_box : public box {
135 protected:
136 box *p;
137 public:
138 pointer_box(box *);
139 ~pointer_box();
140 int compute_metrics(int);
141 void compute_subscript_kern();
142 void compute_skew();
143 void debug_print() = 0;
144 void check_tabs(int);
147 class vcenter_box : public pointer_box {
148 public:
149 vcenter_box(box *);
150 int compute_metrics(int);
151 void output();
152 void debug_print();
155 class simple_box : public box {
156 public:
157 int compute_metrics(int);
158 void compute_subscript_kern();
159 void compute_skew();
160 void output() = 0;
161 void debug_print() = 0;
162 int is_simple();
165 class quoted_text_box : public simple_box {
166 char *text;
167 public:
168 quoted_text_box(char *);
169 ~quoted_text_box();
170 void debug_print();
171 void output();
174 class half_space_box : public simple_box {
175 public:
176 half_space_box();
177 void output();
178 void debug_print();
181 class space_box : public simple_box {
182 public:
183 space_box();
184 void output();
185 void debug_print();
188 class tab_box : public box {
189 int disabled;
190 public:
191 tab_box();
192 void output();
193 void debug_print();
194 void check_tabs(int);
197 class size_box : public pointer_box {
198 private:
199 char *size;
200 public:
201 size_box(char *, box *);
202 ~size_box();
203 int compute_metrics(int);
204 void output();
205 void debug_print();
208 class font_box : public pointer_box {
209 private:
210 char *f;
211 public:
212 font_box(char *, box *);
213 ~font_box();
214 int compute_metrics(int);
215 void output();
216 void debug_print();
219 class fat_box : public pointer_box {
220 public:
221 fat_box(box *);
222 int compute_metrics(int);
223 void output();
224 void debug_print();
227 class vmotion_box : public pointer_box {
228 private:
229 int n; // up is >= 0
230 public:
231 vmotion_box(int, box *);
232 int compute_metrics(int);
233 void output();
234 void debug_print();
237 class hmotion_box : public pointer_box {
238 int n;
239 public:
240 hmotion_box(int, box *);
241 int compute_metrics(int);
242 void output();
243 void debug_print();
246 box *split_text(char *);
247 box *make_delim_box(char *, box *, char *);
248 box *make_sqrt_box(box *);
249 box *make_prime_box(box *);
250 box *make_over_box(box *, box *);
251 box *make_small_over_box(box *, box *);
252 box *make_limit_box(box *, box *, box *);
253 box *make_accent_box(box *, box *);
254 box *make_uaccent_box(box *, box *);
255 box *make_overline_box(box *);
256 box *make_underline_box(box *);
257 box *make_special_box(char *, box *);
259 void set_space(int);
260 int set_gsize(const char *);
261 void set_gfont(const char *);
262 void set_grfont(const char *);
263 void set_gbfont(const char *);
264 const char *get_gfont();
265 const char *get_grfont();
266 const char *get_gbfont();
267 void start_string();
268 void output_string();
269 void do_text(const char *);
270 void restore_compatibility();
271 void set_script_reduction(int n);
272 void set_minimum_size(int n);
273 void set_param(const char *name, int value);
275 void set_char_type(const char *type, char *ch);
277 void init_char_table();
278 void init_extensible();
279 void define_extensible(const char *name, const char *ext, const char *top = 0,
280 const char *mid = 0, const char *bot = 0);