175584Sru// -*- C++ -*-
2151497Sru/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004
375584Sru   Free Software Foundation, Inc.
475584Sru     Written by James Clark (jjc@jclark.com)
575584Sru
675584SruThis file is part of groff.
775584Sru
875584Srugroff is free software; you can redistribute it and/or modify it under
975584Sruthe terms of the GNU General Public License as published by the Free
1075584SruSoftware Foundation; either version 2, or (at your option) any later
1175584Sruversion.
1275584Sru
1375584Srugroff is distributed in the hope that it will be useful, but WITHOUT ANY
1475584SruWARRANTY; without even the implied warranty of MERCHANTABILITY or
1575584SruFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1675584Srufor more details.
1775584Sru
1875584SruYou should have received a copy of the GNU General Public License along
1975584Sruwith groff; see the file COPYING.  If not, write to the Free Software
20151497SruFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
2175584Sru
2275584Srustruct hyphen_list {
2375584Sru  unsigned char hyphen;
2475584Sru  unsigned char breakable;
2575584Sru  unsigned char hyphenation_code;
2675584Sru  hyphen_list *next;
2775584Sru  hyphen_list(unsigned char code, hyphen_list *p = 0);
2875584Sru};
2975584Sru
3075584Sruvoid hyphenate(hyphen_list *, unsigned);
3175584Sru
3275584Sruenum hyphenation_type { HYPHEN_MIDDLE, HYPHEN_BOUNDARY, HYPHEN_INHIBIT };
3375584Sru
3475584Sruclass ascii_output_file;
3575584Sru
3675584Srustruct breakpoint;
3775584Srustruct vertical_size;
38151497Sruclass charinfo;
3975584Sru
4075584Sruclass macro;
4175584Sru
4275584Sruclass troff_output_file;
4375584Sruclass tfont;
4475584Sruclass environment;
4575584Sru
4675584Sruclass glyph_node;
4775584Sruclass diverted_space_node;
4875584Sruclass token_node;
4975584Sru
5075584Srustruct node {
5175584Sru  node *next;
5275584Sru  node *last;
53151497Sru  statem *state;
54151497Sru  statem *push_state;
55151497Sru  int div_nest_level;
56151497Sru  int is_special;
5775584Sru  node();
58151497Sru  node(node *);
59151497Sru  node(node *, statem *, int);
60151497Sru  node *add_char(charinfo *, environment *, hunits *, int *, node ** = 0);
6175584Sru
6275584Sru  virtual ~node();
6375584Sru  virtual node *copy() = 0;
6475584Sru  virtual int set_unformat_flag();
6575584Sru  virtual int force_tprint() = 0;
66151497Sru  virtual int is_tag() = 0;
6775584Sru  virtual hunits width();
6875584Sru  virtual hunits subscript_correction();
6975584Sru  virtual hunits italic_correction();
7075584Sru  virtual hunits left_italic_correction();
7175584Sru  virtual hunits skew();
7275584Sru  virtual int nspaces();
7375584Sru  virtual int merge_space(hunits, hunits, hunits);
7475584Sru  virtual vunits vertical_width();
7575584Sru  virtual node *last_char_node();
76151497Sru  virtual void vertical_extent(vunits *, vunits *);
7775584Sru  virtual int character_type();
7875584Sru  virtual void set_vertical_size(vertical_size *);
7975584Sru  virtual int ends_sentence();
8075584Sru  virtual node *merge_self(node *);
8175584Sru  virtual node *add_discretionary_hyphen();
8275584Sru  virtual node *add_self(node *, hyphen_list **);
83114402Sru  virtual hyphen_list *get_hyphen_list(hyphen_list *, int *);
8475584Sru  virtual void ascii_print(ascii_output_file *);
8575584Sru  virtual void asciify(macro *);
8675584Sru  virtual int discardable();
8775584Sru  virtual void spread_space(int *, hunits *);
8875584Sru  virtual void freeze_space();
8975584Sru  virtual void is_escape_colon();
90151497Sru  virtual breakpoint *get_breakpoints(hunits, int, breakpoint * = 0, int = 0);
9175584Sru  virtual int nbreaks();
9275584Sru  virtual void split(int, node **, node **);
9375584Sru  virtual hyphenation_type get_hyphenation_type();
9475584Sru  virtual int reread(int *);
9575584Sru  virtual token_node *get_token_node();
9675584Sru  virtual int overlaps_vertically();
9775584Sru  virtual int overlaps_horizontally();
9875584Sru  virtual units size();
9975584Sru  virtual int interpret(macro *);
10075584Sru
10175584Sru  virtual node *merge_glyph_node(glyph_node *);
10275584Sru  virtual tfont *get_tfont();
103104862Sru  virtual color *get_glyph_color();
104104862Sru  virtual color *get_fill_color();
10575584Sru  virtual void tprint(troff_output_file *);
10675584Sru  virtual void zero_width_tprint(troff_output_file *);
10775584Sru
10875584Sru  node *add_italic_correction(hunits *);
10975584Sru
11075584Sru  virtual int same(node *) = 0;
11175584Sru  virtual const char *type() = 0;
112151497Sru  virtual void debug_node();
113151497Sru  virtual void debug_node_list();
11475584Sru};
11575584Sru
116104862Sruinline node::node()
117151497Sru: next(0), last(0), state(0), push_state(0), div_nest_level(0), is_special(0)
11875584Sru{
11975584Sru}
12075584Sru
121104862Sruinline node::node(node *n)
122151497Sru: next(n), last(0), state(0), push_state(0), div_nest_level(0), is_special(0)
12375584Sru{
12475584Sru}
12575584Sru
126151497Sruinline node::node(node *n, statem *s, int divlevel)
127151497Sru: next(n), last(0), push_state(0), div_nest_level(divlevel), is_special(0)
128151497Sru{
129151497Sru  if (s)
130151497Sru    state = new statem(s);
131151497Sru  else
132151497Sru    state = 0;
133151497Sru}
134151497Sru
13575584Sruinline node::~node()
13675584Sru{
13775584Sru}
13875584Sru
13975584Sru// 0 means it doesn't, 1 means it does, 2 means it's transparent
14075584Sru
14175584Sruint node_list_ends_sentence(node *);
14275584Sru
14375584Srustruct breakpoint {
14475584Sru  breakpoint *next;
14575584Sru  hunits width;
14675584Sru  int nspaces;
14775584Sru  node *nd;
14875584Sru  int index;
14975584Sru  char hyphenated;
15075584Sru};
15175584Sru
15275584Sruclass line_start_node : public node {
15375584Srupublic:
15475584Sru  line_start_node() {}
15575584Sru  node *copy() { return new line_start_node; }
15675584Sru  int same(node *);
15775584Sru  int force_tprint();
158151497Sru  int is_tag();
15975584Sru  const char *type();
16075584Sru  void asciify(macro *);
16175584Sru};
16275584Sru
16375584Sruclass space_node : public node {
16475584Sruprivate:
16575584Sru#if 0
16675584Sru  enum { BLOCK = 1024 };
16775584Sru  static space_node *free_list;
16875584Sru  void operator delete(void *);
16975584Sru#endif
17075584Sruprotected:
17175584Sru  hunits n;
17275584Sru  char set;
17375584Sru  char was_escape_colon;
174104862Sru  color *col;			/* for grotty */
175151497Sru  space_node(hunits, int, int, color *, statem *, int, node * = 0);
17675584Srupublic:
177151497Sru  space_node(hunits, color *, statem *, int, node * = 0);
178104862Sru  space_node(hunits, color *, node * = 0);
17975584Sru#if 0
18075584Sru  ~space_node();
18175584Sru  void *operator new(size_t);
18275584Sru#endif
18375584Sru  node *copy();
18475584Sru  int nspaces();
18575584Sru  hunits width();
18675584Sru  int discardable();
18775584Sru  int merge_space(hunits, hunits, hunits);
18875584Sru  void freeze_space();
18975584Sru  void is_escape_colon();
19075584Sru  void spread_space(int *, hunits *);
19175584Sru  void tprint(troff_output_file *);
192151497Sru  breakpoint *get_breakpoints(hunits, int, breakpoint * = 0, int = 0);
19375584Sru  int nbreaks();
19475584Sru  void split(int, node **, node **);
19575584Sru  void ascii_print(ascii_output_file *);
19675584Sru  int same(node *);
19775584Sru  void asciify(macro *);
19875584Sru  const char *type();
19975584Sru  int force_tprint();
200151497Sru  int is_tag();
20175584Sru  hyphenation_type get_hyphenation_type();
20275584Sru};
20375584Sru
20475584Srustruct width_list {
20575584Sru  hunits width;
20675584Sru  hunits sentence_width;
20779543Sru  width_list *next;
20875584Sru  width_list(hunits, hunits);
20975584Sru  width_list(width_list *);
21075584Sru};
21175584Sru
21275584Sruclass word_space_node : public space_node {
21375584Sruprotected:
21475584Sru  width_list *orig_width;
21575584Sru  unsigned char unformat;
216151497Sru  word_space_node(hunits, int, color *, width_list *, int, statem *, int,
217151497Sru		  node * = 0);
21875584Srupublic:
219104862Sru  word_space_node(hunits, color *, width_list *, node * = 0);
22075584Sru  ~word_space_node();
22175584Sru  node *copy();
22275584Sru  int reread(int *);
22375584Sru  int set_unformat_flag();
22475584Sru  void tprint(troff_output_file *);
22575584Sru  int same(node *);
22675584Sru  void asciify(macro *);
22775584Sru  const char *type();
22875584Sru  int merge_space(hunits, hunits, hunits);
22975584Sru  int force_tprint();
230151497Sru  int is_tag();
23175584Sru};
23275584Sru
23375584Sruclass unbreakable_space_node : public word_space_node {
234151497Sru  unbreakable_space_node(hunits, int, color *, statem *, int, node * = 0);
23575584Srupublic:
236104862Sru  unbreakable_space_node(hunits, color *, node * = 0);
23775584Sru  node *copy();
23875584Sru  int reread(int *);
239114402Sru  void tprint(troff_output_file *);
24075584Sru  int same(node *);
24175584Sru  void asciify(macro *);
24275584Sru  const char *type();
24375584Sru  int force_tprint();
244151497Sru  int is_tag();
245151497Sru  breakpoint *get_breakpoints(hunits, int, breakpoint * = 0, int = 0);
24675584Sru  int nbreaks();
24775584Sru  void split(int, node **, node **);
24875584Sru  int merge_space(hunits, hunits, hunits);
24975584Sru  node *add_self(node *, hyphen_list **);
250114402Sru  hyphen_list *get_hyphen_list(hyphen_list *, int *);
25175584Sru  hyphenation_type get_hyphenation_type();
25275584Sru};
25375584Sru
25475584Sruclass diverted_space_node : public node {
25575584Srupublic:
25675584Sru  vunits n;
257151497Sru  diverted_space_node(vunits, node * = 0);
258151497Sru  diverted_space_node(vunits, statem *, int, node * = 0);
25975584Sru  node *copy();
26075584Sru  int reread(int *);
26175584Sru  int same(node *);
26275584Sru  const char *type();
26375584Sru  int force_tprint();
264151497Sru  int is_tag();
26575584Sru};
26675584Sru
26775584Sruclass diverted_copy_file_node : public node {
26875584Sru  symbol filename;
26975584Srupublic:
27075584Sru  vunits n;
271151497Sru  diverted_copy_file_node(symbol, node * = 0);
272151497Sru  diverted_copy_file_node(symbol, statem *, int, node * = 0);
27375584Sru  node *copy();
27475584Sru  int reread(int *);
27575584Sru  int same(node *);
27675584Sru  const char *type();
27775584Sru  int force_tprint();
278151497Sru  int is_tag();
27975584Sru};
28075584Sru
28175584Sruclass extra_size_node : public node {
28275584Sru  vunits n;
28375584Srupublic:
284151497Sru  extra_size_node(vunits);
285151497Sru  extra_size_node(vunits, statem *, int);
28675584Sru  void set_vertical_size(vertical_size *);
28775584Sru  node *copy();
28875584Sru  int same(node *);
28975584Sru  const char *type();
29075584Sru  int force_tprint();
291151497Sru  int is_tag();
29275584Sru};
29375584Sru
29475584Sruclass vertical_size_node : public node {
29575584Sru  vunits n;
29675584Srupublic:
297151497Sru  vertical_size_node(vunits, statem *, int);
298151497Sru  vertical_size_node(vunits);
29975584Sru  void set_vertical_size(vertical_size *);
30075584Sru  void asciify(macro *);
30175584Sru  node *copy();
30275584Sru  int set_unformat_flag();
30375584Sru  int same(node *);
30475584Sru  const char *type();
30575584Sru  int force_tprint();
306151497Sru  int is_tag();
30775584Sru};
30875584Sru
30975584Sruclass hmotion_node : public node {
31075584Sruprotected:
31175584Sru  hunits n;
31275584Sru  unsigned char was_tab;
31375584Sru  unsigned char unformat;
314104862Sru  color *col;			/* for grotty */
31575584Srupublic:
316151497Sru  hmotion_node(hunits i, color *c, node *nxt = 0)
317151497Sru    : node(nxt), n(i), was_tab(0), unformat(0), col(c) {}
318151497Sru  hmotion_node(hunits i, color *c, statem *s, int divlevel, node *nxt = 0)
319151497Sru    : node(nxt, s, divlevel), n(i), was_tab(0), unformat(0), col(c) {}
320151497Sru  hmotion_node(hunits i, int flag1, int flag2, color *c, statem *s,
321151497Sru	       int divlevel, node *nxt = 0)
322151497Sru    : node(nxt, s, divlevel), n(i), was_tab(flag1), unformat(flag2),
323151497Sru      col(c) {}
324151497Sru  hmotion_node(hunits i, int flag1, int flag2, color *c, node *nxt = 0)
325151497Sru    : node(nxt), n(i), was_tab(flag1), unformat(flag2), col(c) {}
32675584Sru  node *copy();
32775584Sru  int reread(int *);
32875584Sru  int set_unformat_flag();
32975584Sru  void asciify(macro *);
33075584Sru  void tprint(troff_output_file *);
33175584Sru  hunits width();
33275584Sru  void ascii_print(ascii_output_file *);
33375584Sru  int same(node *);
33475584Sru  const char *type();
33575584Sru  int force_tprint();
336151497Sru  int is_tag();
33775584Sru  node *add_self(node *, hyphen_list **);
338114402Sru  hyphen_list *get_hyphen_list(hyphen_list *, int *);
33975584Sru  hyphenation_type get_hyphenation_type();
34075584Sru};
34175584Sru
34275584Sruclass space_char_hmotion_node : public hmotion_node {
34375584Srupublic:
344104862Sru  space_char_hmotion_node(hunits, color *, node * = 0);
345151497Sru  space_char_hmotion_node(hunits, color *, statem *, int, node * = 0);
34675584Sru  node *copy();
34775584Sru  void ascii_print(ascii_output_file *);
34875584Sru  void asciify(macro *);
349114402Sru  void tprint(troff_output_file *);
35075584Sru  int same(node *);
35175584Sru  const char *type();
35275584Sru  int force_tprint();
353151497Sru  int is_tag();
35475584Sru  node *add_self(node *, hyphen_list **);
355114402Sru  hyphen_list *get_hyphen_list(hyphen_list *, int *);
35675584Sru  hyphenation_type get_hyphenation_type();
35775584Sru};
35875584Sru
35975584Sruclass vmotion_node : public node {
36075584Sru  vunits n;
361104862Sru  color *col;			/* for grotty */
36275584Srupublic:
363151497Sru  vmotion_node(vunits, color *);
364151497Sru  vmotion_node(vunits, color *, statem *, int);
36575584Sru  void tprint(troff_output_file *);
36675584Sru  node *copy();
36775584Sru  vunits vertical_width();
36875584Sru  int same(node *);
36975584Sru  const char *type();
37075584Sru  int force_tprint();
371151497Sru  int is_tag();
37275584Sru};
37375584Sru
37475584Sruclass hline_node : public node {
37575584Sru  hunits x;
37675584Sru  node *n;
37775584Srupublic:
378151497Sru  hline_node(hunits, node *, node * = 0);
379151497Sru  hline_node(hunits, node *, statem *, int, node * = 0);
38075584Sru  ~hline_node();
38175584Sru  node *copy();
38275584Sru  hunits width();
38375584Sru  void tprint(troff_output_file *);
38475584Sru  int same(node *);
38575584Sru  const char *type();
38675584Sru  int force_tprint();
387151497Sru  int is_tag();
38875584Sru};
38975584Sru
39075584Sruclass vline_node : public node {
39175584Sru  vunits x;
39275584Sru  node *n;
39375584Srupublic:
394151497Sru  vline_node(vunits, node *, node * = 0);
395151497Sru  vline_node(vunits, node *, statem *, int, node * = 0);
39675584Sru  ~vline_node();
39775584Sru  node *copy();
39875584Sru  void tprint(troff_output_file *);
39975584Sru  hunits width();
40075584Sru  vunits vertical_width();
40175584Sru  void vertical_extent(vunits *, vunits *);
40275584Sru  int same(node *);
40375584Sru  const char *type();
40475584Sru  int force_tprint();
405151497Sru  int is_tag();
40675584Sru};
40775584Sru
40875584Sruclass dummy_node : public node {
40975584Srupublic:
41075584Sru  dummy_node(node *nd = 0) : node(nd) {}
41175584Sru  node *copy();
41275584Sru  int same(node *);
41375584Sru  const char *type();
41475584Sru  int force_tprint();
415151497Sru  int is_tag();
41675584Sru  hyphenation_type get_hyphenation_type();
41775584Sru};
41875584Sru
41975584Sruclass transparent_dummy_node : public node {
42075584Srupublic:
42175584Sru  transparent_dummy_node(node *nd = 0) : node(nd) {}
42275584Sru  node *copy();
42375584Sru  int same(node *);
42475584Sru  const char *type();
42575584Sru  int force_tprint();
426151497Sru  int is_tag();
42775584Sru  int ends_sentence();
42875584Sru  hyphenation_type get_hyphenation_type();
42975584Sru};
43075584Sru
43175584Sruclass zero_width_node : public node {
43275584Sru  node *n;
43375584Srupublic:
434151497Sru  zero_width_node(node *);
435151497Sru  zero_width_node(node *, statem *, int);
43675584Sru  ~zero_width_node();
43775584Sru  node *copy();
43875584Sru  void tprint(troff_output_file *);
43975584Sru  int same(node *);
44075584Sru  const char *type();
44175584Sru  int force_tprint();
442151497Sru  int is_tag();
44375584Sru  void append(node *);
44475584Sru  int character_type();
445151497Sru  void vertical_extent(vunits *, vunits *);
44675584Sru};
44775584Sru
44875584Sruclass left_italic_corrected_node : public node {
44975584Sru  node *n;
45075584Sru  hunits x;
45175584Srupublic:
45275584Sru  left_italic_corrected_node(node * = 0);
453151497Sru  left_italic_corrected_node(statem *, int, node * = 0);
45475584Sru  ~left_italic_corrected_node();
45575584Sru  void tprint(troff_output_file *);
45675584Sru  void ascii_print(ascii_output_file *);
45775584Sru  void asciify(macro *);
45875584Sru  node *copy();
45975584Sru  int same(node *);
46075584Sru  const char *type();
46175584Sru  int force_tprint();
462151497Sru  int is_tag();
46375584Sru  hunits width();
46475584Sru  node *last_char_node();
46575584Sru  void vertical_extent(vunits *, vunits *);
46675584Sru  int ends_sentence();
46775584Sru  int overlaps_horizontally();
46875584Sru  int overlaps_vertically();
46975584Sru  hyphenation_type get_hyphenation_type();
47075584Sru  tfont *get_tfont();
47175584Sru  int character_type();
47275584Sru  hunits skew();
47375584Sru  hunits italic_correction();
47475584Sru  hunits subscript_correction();
475114402Sru  hyphen_list *get_hyphen_list(hyphen_list *, int *);
47675584Sru  node *add_self(node *, hyphen_list **);
47775584Sru  node *merge_glyph_node(glyph_node *);
47875584Sru};
47975584Sru
48075584Sruclass overstrike_node : public node {
48175584Sru  node *list;
48275584Sru  hunits max_width;
48375584Srupublic:
48475584Sru  overstrike_node();
485151497Sru  overstrike_node(statem *, int);
48675584Sru  ~overstrike_node();
48775584Sru  node *copy();
48875584Sru  void tprint(troff_output_file *);
48975584Sru  void overstrike(node *);	// add another node to be overstruck
49075584Sru  hunits width();
49175584Sru  int same(node *);
49275584Sru  const char *type();
49375584Sru  int force_tprint();
494151497Sru  int is_tag();
49575584Sru  node *add_self(node *, hyphen_list **);
496114402Sru  hyphen_list *get_hyphen_list(hyphen_list *, int *);
49775584Sru  hyphenation_type get_hyphenation_type();
49875584Sru};
49975584Sru
50075584Sruclass bracket_node : public node {
50175584Sru  node *list;
50275584Sru  hunits max_width;
50375584Srupublic:
50475584Sru  bracket_node();
505151497Sru  bracket_node(statem *, int);
50675584Sru  ~bracket_node();
50775584Sru  node *copy();
50875584Sru  void tprint(troff_output_file *);
50975584Sru  void bracket(node *);	// add another node to be overstruck
51075584Sru  hunits width();
51175584Sru  int same(node *);
51275584Sru  const char *type();
51375584Sru  int force_tprint();
514151497Sru  int is_tag();
51575584Sru};
51675584Sru
51775584Sruclass special_node : public node {
51875584Sru  macro mac;
51975584Sru  tfont *tf;
520104862Sru  color *gcol;
521104862Sru  color *fcol;
52275584Sru  int no_init_string;
52375584Sru  void tprint_start(troff_output_file *);
52475584Sru  void tprint_char(troff_output_file *, unsigned char);
52575584Sru  void tprint_end(troff_output_file *);
52675584Srupublic:
52775584Sru  special_node(const macro &, int = 0);
528151497Sru  special_node(const macro &, tfont *, color *, color *, statem *, int,
529151497Sru	       int = 0);
53075584Sru  node *copy();
53175584Sru  void tprint(troff_output_file *);
53275584Sru  int same(node *);
53375584Sru  const char *type();
53475584Sru  int force_tprint();
535151497Sru  int is_tag();
53675584Sru  int ends_sentence();
53775584Sru  tfont *get_tfont();
53875584Sru};
53975584Sru
54075584Sruclass suppress_node : public node {
54175584Sru  int is_on;
54275584Sru  int emit_limits;	// must we issue the extent of the area written out?
54375584Sru  symbol filename;
54475584Sru  char position;
545104862Sru  int  image_id;
54675584Srupublic:
54775584Sru  suppress_node(int, int);
548151497Sru  suppress_node(symbol, char, int);
549151497Sru  suppress_node(int, int, symbol, char, int, statem *, int);
550151497Sru  suppress_node(int, int, symbol, char, int);
55175584Sru  node *copy();
55275584Sru  void tprint(troff_output_file *);
55375584Sru  hunits width();
55475584Sru  int same(node *);
55575584Sru  const char *type();
55675584Sru  int force_tprint();
557151497Sru  int is_tag();
55875584Sruprivate:
559151497Sru  void put(troff_output_file *, const char *);
56075584Sru};
56175584Sru
562151497Sruclass tag_node : public node {
563151497Srupublic:
564151497Sru  string tag_string;
565151497Sru  int delayed;
566151497Sru  tag_node();
567151497Sru  tag_node(string, int);
568151497Sru  tag_node(string, statem *, int, int);
569151497Sru  node *copy();
570151497Sru  void tprint(troff_output_file *);
571151497Sru  int same(node *);
572151497Sru  const char *type();
573151497Sru  int force_tprint();
574151497Sru  int is_tag();
575151497Sru  int ends_sentence();
576151497Sru};
577151497Sru
57875584Srustruct hvpair {
57975584Sru  hunits h;
58075584Sru  vunits v;
58175584Sru  hvpair();
58275584Sru};
58375584Sru
58475584Sruclass draw_node : public node {
58575584Sru  int npoints;
58675584Sru  font_size sz;
587104862Sru  color *gcol;
588104862Sru  color *fcol;
58975584Sru  char code;
59075584Sru  hvpair *point;
59175584Srupublic:
592104862Sru  draw_node(char, hvpair *, int, font_size, color *, color *);
593151497Sru  draw_node(char, hvpair *, int, font_size, color *, color *, statem *, int);
59475584Sru  ~draw_node();
59575584Sru  hunits width();
59675584Sru  vunits vertical_width();
59775584Sru  node *copy();
59875584Sru  void tprint(troff_output_file *);
59975584Sru  int same(node *);
60075584Sru  const char *type();
60175584Sru  int force_tprint();
602151497Sru  int is_tag();
60375584Sru};
60475584Sru
60575584Sruclass charinfo;
606151497Srunode *make_node(charinfo *, environment *);
60775584Sruint character_exists(charinfo *, environment *);
60875584Sru
609151497Sruint same_node_list(node *, node *);
610151497Srunode *reverse_node_list(node *);
61175584Sruvoid delete_node_list(node *);
61275584Srunode *copy_node_list(node *);
61375584Sru
614151497Sruint get_bold_fontno(int);
61575584Sru
61675584Sruinline hyphen_list::hyphen_list(unsigned char code, hyphen_list *p)
61775584Sru: hyphen(0), breakable(0), hyphenation_code(code), next(p)
61875584Sru{
61975584Sru}
62075584Sru
62175584Sruextern void read_desc();
622151497Sruextern int mount_font(int, symbol, symbol = NULL_SYMBOL);
623151497Sruextern int check_font(symbol, symbol);
624151497Sruextern int check_style(symbol);
625151497Sruextern void mount_style(int, symbol);
626151497Sruextern int is_good_fontno(int);
62775584Sruextern int symbol_fontno(symbol);
62875584Sruextern int next_available_font_position();
62975584Sruextern void init_size_table(int *);
63075584Sruextern int get_underline_fontno();
63175584Sru
63275584Sruclass output_file {
63375584Sru  char make_g_plus_plus_shut_up;
63475584Srupublic:
63575584Sru  output_file();
63675584Sru  virtual ~output_file();
637151497Sru  virtual void trailer(vunits);
63875584Sru  virtual void flush() = 0;
63975584Sru  virtual void transparent_char(unsigned char) = 0;
64075584Sru  virtual void print_line(hunits x, vunits y, node *n,
64175584Sru			  vunits before, vunits after, hunits width) = 0;
64275584Sru  virtual void begin_page(int pageno, vunits page_length) = 0;
64375584Sru  virtual void copy_file(hunits x, vunits y, const char *filename) = 0;
64475584Sru  virtual int is_printing() = 0;
645151497Sru  virtual void put_filename(const char *);
64675584Sru  virtual void on();
64775584Sru  virtual void off();
64875584Sru#ifdef COLUMN
64975584Sru  virtual void vjustify(vunits, symbol);
65075584Sru#endif /* COLUMN */
651151497Sru  mtsm state;
65275584Sru};
65375584Sru
65475584Sru#ifndef POPEN_MISSING
65575584Sruextern char *pipe_command;
65675584Sru#endif
65775584Sru
65875584Sruextern output_file *the_output;
65975584Sruextern void init_output();
660151497Sruint in_output_page_list(int);
66175584Sru
66275584Sruclass font_family {
66375584Sru  int *map;
66475584Sru  int map_size;
66575584Srupublic:
66675584Sru  const symbol nm;
66775584Sru  font_family(symbol);
66875584Sru  ~font_family();
66975584Sru  int make_definite(int);
67075584Sru  static void invalidate_fontno(int);
67175584Sru};
67275584Sru
67375584Srufont_family *lookup_family(symbol);
674104862Srusymbol get_font_name(int, environment *);
675151497Srusymbol get_style_name(int);
676151497Sruextern search_path include_search_path;
677