2 /* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
3 Written by James Clark (jjc@jclark.com)
5 This file is part of groff.
7 groff is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License along
18 with groff; see the file COPYING. If not, write to the Free Software
19 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
24 unsigned char breakable
;
25 unsigned char hyphenation_code
;
27 hyphen_list(unsigned char code
, hyphen_list
*p
= 0);
30 void hyphenate(hyphen_list
*, unsigned);
32 enum hyphenation_type
{ HYPHEN_MIDDLE
, HYPHEN_BOUNDARY
, HYPHEN_INHIBIT
};
34 class ascii_output_file
;
42 class troff_output_file
;
47 class diverted_space_node
;
54 node
*add_char(charinfo
*c
, environment
*, hunits
*widthp
);
57 virtual node
*copy() = 0;
58 virtual hunits
width();
59 virtual hunits
subscript_correction();
60 virtual hunits
italic_correction();
61 virtual hunits
left_italic_correction();
62 virtual hunits
skew();
63 virtual int nspaces();
64 virtual int merge_space(hunits
);
65 virtual vunits
vertical_width();
66 virtual node
*last_char_node();
67 virtual void vertical_extent(vunits
*min
, vunits
*max
);
68 virtual int character_type();
69 virtual void set_vertical_size(vertical_size
*);
70 virtual int ends_sentence();
71 virtual node
*merge_self(node
*);
72 virtual node
*add_discretionary_hyphen();
73 virtual node
*add_self(node
*, hyphen_list
**);
74 virtual hyphen_list
*get_hyphen_list(hyphen_list
*s
= 0);
75 virtual void ascii_print(ascii_output_file
*);
76 virtual void asciify(macro
*);
77 virtual int discardable();
78 virtual void spread_space(int *, hunits
*);
79 virtual void freeze_space();
80 virtual breakpoint
*get_breakpoints(hunits width
, int nspaces
,
83 virtual int nbreaks();
84 virtual void split(int, node
**, node
**);
85 virtual hyphenation_type
get_hyphenation_type();
86 virtual int reread(int *);
87 virtual token_node
*get_token_node();
88 virtual int overlaps_vertically();
89 virtual int overlaps_horizontally();
91 virtual int interpret(macro
*);
93 virtual node
*merge_glyph_node(glyph_node
*);
94 virtual tfont
*get_tfont();
95 virtual void tprint(troff_output_file
*);
96 virtual void zero_width_tprint(troff_output_file
*);
98 node
*add_italic_correction(hunits
*);
100 virtual int same(node
*) = 0;
101 virtual const char *type() = 0;
104 inline node::node() : next(0)
108 inline node::node(node
*n
) : next(n
)
116 // 0 means it doesn't, 1 means it does, 2 means it's transparent
118 int node_list_ends_sentence(node
*);
129 class line_start_node
: public node
{
132 node
*copy() { return new line_start_node
; }
135 void asciify(macro
*);
138 class space_node
: public node
{
141 enum { BLOCK
= 1024 };
142 static space_node
*free_list
;
143 void operator delete(void *);
148 space_node(hunits
, int, node
* = 0);
150 space_node(hunits d
, node
*p
= 0);
153 void *operator new(size_t);
159 int merge_space(hunits
);
161 void spread_space(int*, hunits
*);
162 void tprint(troff_output_file
*);
163 breakpoint
*get_breakpoints(hunits width
, int nspaces
, breakpoint
*rest
= 0,
166 void split(int, node
**, node
**);
167 void ascii_print(ascii_output_file
*);
172 class word_space_node
: public space_node
{
174 word_space_node(hunits
, int, node
* = 0);
176 word_space_node(hunits
, node
* = 0);
178 void tprint(troff_output_file
*);
183 class unbreakable_space_node
: public word_space_node
{
184 unbreakable_space_node(hunits
, int, node
* = 0);
186 unbreakable_space_node(hunits
, node
* = 0);
190 breakpoint
*get_breakpoints(hunits width
, int nspaces
, breakpoint
*rest
= 0,
193 void split(int, node
**, node
**);
194 int merge_space(hunits
);
197 class diverted_space_node
: public node
{
200 diverted_space_node(vunits d
, node
*p
= 0);
207 class diverted_copy_file_node
: public node
{
211 diverted_copy_file_node(symbol s
, node
*p
= 0);
218 class extra_size_node
: public node
{
221 extra_size_node(vunits i
) : n(i
) {}
222 void set_vertical_size(vertical_size
*);
228 class vertical_size_node
: public node
{
231 vertical_size_node(vunits i
) : n(i
) {}
232 void set_vertical_size(vertical_size
*);
233 void asciify(macro
*);
239 class hmotion_node
: public node
{
243 hmotion_node(hunits i
, node
*next
= 0) : node(next
), n(i
) {}
245 void tprint(troff_output_file
*);
247 void ascii_print(ascii_output_file
*);
252 class space_char_hmotion_node
: public hmotion_node
{
254 space_char_hmotion_node(hunits i
, node
*next
= 0);
256 void ascii_print(ascii_output_file
*);
257 void asciify(macro
*);
262 class vmotion_node
: public node
{
265 vmotion_node(vunits i
) : n(i
) {}
266 void tprint(troff_output_file
*);
268 vunits
vertical_width();
274 class hline_node
: public node
{
278 hline_node(hunits i
, node
*c
, node
*next
= 0) : node(next
), x(i
), n(c
) {}
282 void tprint(troff_output_file
*);
287 class vline_node
: public node
{
291 vline_node(vunits i
, node
*c
, node
*next
= 0) : node(next
), x(i
), n(c
) {}
294 void tprint(troff_output_file
*);
296 vunits
vertical_width();
297 void vertical_extent(vunits
*, vunits
*);
303 class dummy_node
: public node
{
305 dummy_node(node
*nd
= 0) : node(nd
) {}
309 hyphenation_type
get_hyphenation_type();
312 class transparent_dummy_node
: public node
{
314 transparent_dummy_node() {}
319 hyphenation_type
get_hyphenation_type();
322 class zero_width_node
: public node
{
325 zero_width_node(node
*gn
);
328 void tprint(troff_output_file
*);
332 int character_type();
333 void vertical_extent(vunits
*min
, vunits
*max
);
336 class left_italic_corrected_node
: public node
{
340 left_italic_corrected_node(node
* = 0);
341 ~left_italic_corrected_node();
342 void tprint(troff_output_file
*);
343 void ascii_print(ascii_output_file
*);
344 void asciify(macro
*);
349 node
*last_char_node();
350 void vertical_extent(vunits
*, vunits
*);
352 int overlaps_horizontally();
353 int overlaps_vertically();
354 hyphenation_type
get_hyphenation_type();
356 int character_type();
358 hunits
italic_correction();
359 hunits
subscript_correction();
360 hyphen_list
*get_hyphen_list(hyphen_list
*ss
= 0);
361 node
*add_self(node
*, hyphen_list
**);
362 node
*merge_glyph_node(glyph_node
*);
365 class overstrike_node
: public node
{
372 void tprint(troff_output_file
*);
373 void overstrike(node
*); // add another node to be overstruck
379 class bracket_node
: public node
{
386 void tprint(troff_output_file
*);
387 void bracket(node
*); // add another node to be overstruck
393 class special_node
: public node
{
395 void tprint_start(troff_output_file
*);
396 void tprint_char(troff_output_file
*, unsigned char);
397 void tprint_end(troff_output_file
*);
399 special_node(const macro
&);
401 void tprint(troff_output_file
*);
414 class draw_node
: public node
{
420 draw_node(char, hvpair
*, int, font_size
);
423 vunits
vertical_width();
425 void tprint(troff_output_file
*);
431 node
*make_node(charinfo
*ci
, environment
*);
432 int character_exists(charinfo
*, environment
*);
434 int same_node_list(node
*n1
, node
*n2
);
435 node
*reverse_node_list(node
*n
);
436 void delete_node_list(node
*);
437 node
*copy_node_list(node
*);
439 int get_bold_fontno(int f
);
441 inline hyphen_list::hyphen_list(unsigned char code
, hyphen_list
*p
)
442 : hyphenation_code(code
), next(p
), hyphen(0), breakable(0)
446 extern void read_desc();
447 extern int mount_font(int n
, symbol
, symbol
= NULL_SYMBOL
);
448 extern void mount_style(int n
, symbol
);
449 extern int is_good_fontno(int n
);
450 extern int symbol_fontno(symbol
);
451 extern int next_available_font_position();
452 extern void init_size_table(int *);
453 extern int get_underline_fontno();
456 char make_g_plus_plus_shut_up
;
459 virtual ~output_file();
460 virtual void flush() = 0;
461 virtual void transparent_char(unsigned char) = 0;
462 virtual void print_line(hunits x
, vunits y
, node
*n
,
463 vunits before
, vunits after
) = 0;
464 virtual void begin_page(int pageno
, vunits page_length
) = 0;
465 virtual void copy_file(hunits x
, vunits y
, const char *filename
) = 0;
466 virtual int is_printing() = 0;
468 virtual void vjustify(vunits
, symbol
);
472 extern char *pipe_command
;
474 extern output_file
*the_output
;
475 extern void init_output();
476 int in_output_page_list(int n
);
478 static void invalidate_fontno(int);
489 friend void invalidate_fontno(int);
492 font_family
*lookup_family(symbol
);