diff options
author | wl <wl> | 2004-10-12 05:44:51 +0000 |
---|---|---|
committer | wl <wl> | 2004-10-12 05:44:51 +0000 |
commit | 1c031fa40f72f240b119e748ee44c22ca74f621a (patch) | |
tree | 14b9b4ec2d7da4e204f32c46f1dde28c5741c245 /src/roff/troff | |
parent | a858f31b225ed7ddd4fb0ea09fe696601bd0c29f (diff) | |
download | groff-1c031fa40f72f240b119e748ee44c22ca74f621a.tar.gz |
* src/roff/troff/node.cpp: New extern `debug_state'.
Include `stringclass.h' and `mtsm.h'.
Implement new classes and class members from `node.h'.
(real_output_file): Make `fp' public.
(troff_output_file): New variables `cur_div_level' and `tag_list'.
Update constructors.
(troff_output_file::really_print_line): Check whether we should push
the current troff state and use the state at the start of the
invocation of this diversion.
(troff_output_file::add_to_tag_list): New member function.
(node::add_char): Handle `glyph_comp_np'.
* src/roff/troff/node.h: Include `mtsm.h'.
(node): New variables `state', `push_state', `div_nest_level',
`is_special'. Update constructors, all descendants.
Pass additional argument to `add_char' member function.
New virtual member functions `is_tag', `debug_node',
`debug_node_list'. Update all descendants.
(tag_node): New class for handling tags.
(output_file): Add variable `state'.
Diffstat (limited to 'src/roff/troff')
-rw-r--r-- | src/roff/troff/node.cpp | 642 | ||||
-rw-r--r-- | src/roff/troff/node.h | 106 |
2 files changed, 640 insertions, 108 deletions
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index 5a2cf7f6..94485706 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with groff; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +extern int debug_state; + #include "troff.h" #ifdef HAVE_UNISTD_H @@ -37,7 +39,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "input.h" #include "div.h" #include "geometry.h" -#include "stringclass.h" +#include "mtsm.h" #include "nonposix.h" @@ -133,7 +135,7 @@ class font_info { void flush(); public: special_font_list *sf; - font_info(symbol nm, int n, symbol enm, font *f); + font_info(symbol, int, symbol, font *); int contains(charinfo *); void set_bold(hunits); void unbold(); @@ -170,7 +172,7 @@ protected: int height; int slant; public: - tfont_spec(symbol nm, int pos, font *, font_size, int, int); + tfont_spec(symbol, int, font *, font_size, int, int); tfont_spec(const tfont_spec &spec) { *this = spec; } tfont_spec plain(); int operator==(const tfont_spec &); @@ -689,9 +691,8 @@ class real_output_file : public output_file { virtual void really_put_filename(const char *filename); virtual void really_on(); virtual void really_off(); -protected: - FILE *fp; public: + FILE *fp; real_output_file(); ~real_output_file(); void flush(); @@ -759,6 +760,8 @@ class troff_output_file : public real_output_file { int tbuf_len; int tbuf_kern; int begun_page; + int cur_div_level; + string tag_list; void do_motion(); void put(char c); void put(unsigned char c); @@ -795,6 +798,7 @@ public: void fill_color(color *c); int get_hpos() { return hpos; } int get_vpos() { return vpos; } + void add_to_tag_list(string s); friend void space_char_hmotion_node::tprint(troff_output_file *); friend void unbreakable_space_node::tprint(troff_output_file *); }; @@ -872,6 +876,29 @@ void troff_output_file::really_print_line(hunits x, vunits y, node *n, { moveto(x, y); while (n != 0) { + // Check whether we should push the current troff state and use + // the state at the start of the invocation of this diversion. + if (n->div_nest_level > cur_div_level && n->push_state) { + state.push_state(n->push_state); + cur_div_level = n->div_nest_level; + } + // Has the current diversion level decreased? Then we must pop the + // troff state. + while (n->div_nest_level < cur_div_level) { + state.pop_state(); + cur_div_level = n->div_nest_level; + } + // Now check whether the state has changed. + if ((is_on() || n->force_tprint()) + && (state.changed(n->state) || n->is_tag() || n->is_special)) { + flush_tbuf(); + do_motion(); + force_motion = 1; + flush(); + state.flush(fp, n->state, tag_list); + tag_list = string(""); + flush(); + } n->tprint(this); n = n->next; } @@ -1283,6 +1310,16 @@ void troff_output_file::glyph_color(color *col) put('\n'); } +void troff_output_file::add_to_tag_list(string s) +{ + if (tag_list == string("")) + tag_list = s; + else { + tag_list += string("\n"); + tag_list += s; + } +} + // determine_line_limits - works out the smallest box which will contain // the entity, code, built from the point array. void troff_output_file::determine_line_limits(char code, hvpair *point, @@ -1512,7 +1549,8 @@ void troff_output_file::trailer(vunits page_length) troff_output_file::troff_output_file() : current_slant(0), current_height(0), current_fill_color(0), - current_glyph_color(0), nfont_positions(10), tbuf_len(0), begun_page(0) + current_glyph_color(0), nfont_positions(10), tbuf_len(0), begun_page(0), + cur_div_level(0) { font_position = new symbol[nfont_positions]; put("x T "); @@ -1735,14 +1773,14 @@ class charinfo_node : public node { protected: charinfo *ci; public: - charinfo_node(charinfo *, node * = 0); + charinfo_node(charinfo *, statem *, int, node * = 0); int ends_sentence(); int overlaps_vertically(); int overlaps_horizontally(); }; -charinfo_node::charinfo_node(charinfo *c, node *x) -: node(x), ci(c) +charinfo_node::charinfo_node(charinfo *c, statem *s, int pop, node *x) +: node(x, s, pop), ci(c) { } @@ -1774,12 +1812,14 @@ protected: color *fcol; /* this is needed for grotty */ #ifdef STORE_WIDTH hunits wid; - glyph_node(charinfo *, tfont *, color *, color *, hunits, node * = 0); + glyph_node(charinfo *, tfont *, color *, color *, hunits, + statem *, int, node * = 0); #endif public: void *operator new(size_t); void operator delete(void *); - glyph_node(charinfo *, tfont *, color *, color *, node * = 0); + glyph_node(charinfo *, tfont *, color *, color *, + statem *, int, node * = 0); ~glyph_node() {} node *copy(); node *merge_glyph_node(glyph_node *); @@ -1806,6 +1846,8 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); + void debug_node(); }; glyph_node *glyph_node::free_list = 0; @@ -1815,13 +1857,13 @@ class ligature_node : public glyph_node { node *n2; #ifdef STORE_WIDTH ligature_node(charinfo *, tfont *, color *, color *, hunits, - node *, node *, node * = 0); + node *, node *, statem *, int, node * = 0); #endif public: void *operator new(size_t); void operator delete(void *); ligature_node(charinfo *, tfont *, color *, color *, - node *, node *, node * = 0); + node *, node *, statem *, int, node * = 0); ~ligature_node(); node *copy(); node *add_self(node *, hyphen_list **); @@ -1831,6 +1873,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; class kern_pair_node : public node { @@ -1838,7 +1881,7 @@ class kern_pair_node : public node { node *n1; node *n2; public: - kern_pair_node(hunits n, node *first, node *second, node *x = 0); + kern_pair_node(hunits, node *, node *, statem *, int, node * = 0); ~kern_pair_node(); node *copy(); node *merge_glyph_node(glyph_node *); @@ -1857,6 +1900,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); void vertical_extent(vunits *, vunits *); }; @@ -1865,7 +1909,7 @@ class dbreak_node : public node { node *pre; node *post; public: - dbreak_node(node *n, node *p, node *x = 0); + dbreak_node(node *, node *, statem *, int, node * = 0); ~dbreak_node(); node *copy(); node *merge_glyph_node(glyph_node *); @@ -1886,6 +1930,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; void *glyph_node::operator new(size_t n) @@ -1922,8 +1967,9 @@ void ligature_node::operator delete(void *p) delete[] (char *)p; } -glyph_node::glyph_node(charinfo *c, tfont *t, color *gc, color *fc, node *x) -: charinfo_node(c, x), tf(t), gcol(gc), fcol(fc) +glyph_node::glyph_node(charinfo *c, tfont *t, color *gc, color *fc, + statem *s, int pop, node *x) +: charinfo_node(c, s, pop, x), tf(t), gcol(gc), fcol(fc) { #ifdef STORE_WIDTH wid = tf->get_width(ci); @@ -1932,8 +1978,9 @@ glyph_node::glyph_node(charinfo *c, tfont *t, color *gc, color *fc, node *x) #ifdef STORE_WIDTH glyph_node::glyph_node(charinfo *c, tfont *t, - color *gc, color *fc, hunits w, node *x) -: charinfo_node(c, x), tf(t), gcol(gc), fcol(fc), wid(w) + color *gc, color *fc, hunits w, + statem *s, int pop, node *x) +: charinfo_node(c, s, pop, x), tf(t), gcol(gc), fcol(fc), wid(w) { } #endif @@ -1941,9 +1988,9 @@ glyph_node::glyph_node(charinfo *c, tfont *t, node *glyph_node::copy() { #ifdef STORE_WIDTH - return new glyph_node(ci, tf, gcol, fcol, wid); + return new glyph_node(ci, tf, gcol, fcol, wid, state, div_nest_level); #else - return new glyph_node(ci, tf, gcol, fcol); + return new glyph_node(ci, tf, gcol, fcol, state, div_nest_level); #endif } @@ -2027,13 +2074,15 @@ node *glyph_node::merge_glyph_node(glyph_node *gn) if ((lig = tf->get_lig(ci, gn->ci)) != 0) { node *next1 = next; next = 0; - return new ligature_node(lig, tf, gcol, fcol, this, gn, next1); + return new ligature_node(lig, tf, gcol, fcol, this, gn, state, + gn->div_nest_level, next1); } hunits kern; if (tf->get_kern(ci, gn->ci, &kern)) { node *next1 = next; next = 0; - return new kern_pair_node(kern, this, gn, next1); + return new kern_pair_node(kern, this, gn, state, + gn->div_nest_level, next1); } } return 0; @@ -2096,16 +2145,35 @@ void glyph_node::ascii_print(ascii_output_file *ascii) ascii->outs(ci->nm.contents()); } +void glyph_node::debug_node() +{ + unsigned char c = ci->get_ascii_code(); + fprintf(stderr, "{ %s [", type()); + if (c) + fprintf(stderr, "%c", c); + else + fprintf(stderr, ci->nm.contents()); + if (push_state) + fprintf(stderr, " <push_state>"); + if (state) + state->display_state(); + fprintf(stderr, " nest level %d", div_nest_level); + fprintf(stderr, "]}\n"); + fflush(stderr); +} + ligature_node::ligature_node(charinfo *c, tfont *t, color *gc, color *fc, - node *gn1, node *gn2, node *x) -: glyph_node(c, t, gc, fc, x), n1(gn1), n2(gn2) + node *gn1, node *gn2, statem *s, + int pop, node *x) +: glyph_node(c, t, gc, fc, s, pop, x), n1(gn1), n2(gn2) { } #ifdef STORE_WIDTH ligature_node::ligature_node(charinfo *c, tfont *t, color *gc, color *fc, - hunits w, node *gn1, node *gn2, node *x) -: glyph_node(c, t, gc, fc, w, x), n1(gn1), n2(gn2) + hunits w, node *gn1, node *gn2, statem *s, + int pop, node *x) +: glyph_node(c, t, gc, fc, w, s, pop, x), n1(gn1), n2(gn2) { } #endif @@ -2119,9 +2187,11 @@ ligature_node::~ligature_node() node *ligature_node::copy() { #ifdef STORE_WIDTH - return new ligature_node(ci, tf, gcol, fcol, wid, n1->copy(), n2->copy()); + return new ligature_node(ci, tf, gcol, fcol, wid, n1->copy(), n2->copy(), + state, div_nest_level); #else - return new ligature_node(ci, tf, gcol, fcol, n1->copy(), n2->copy()); + return new ligature_node(ci, tf, gcol, fcol, n1->copy(), n2->copy(), + state, div_nest_level); #endif } @@ -2146,13 +2216,14 @@ node *ligature_node::add_self(node *n, hyphen_list **p) return n; } -kern_pair_node::kern_pair_node(hunits n, node *first, node *second, node *x) -: node(x), amount(n), n1(first), n2(second) +kern_pair_node::kern_pair_node(hunits n, node *first, node *second, + statem* s, int pop, node *x) +: node(x, s, pop), amount(n), n1(first), n2(second) { } -dbreak_node::dbreak_node(node *n, node *p, node *x) -: node(x), none(n), pre(p), post(0) +dbreak_node::dbreak_node(node *n, node *p, statem *s, int pop, node *x) +: node(x, s, pop), none(n), pre(p), post(0) { } @@ -2228,13 +2299,14 @@ node *kern_pair_node::add_discretionary_hyphen() node *next1 = next; next = 0; node *n = copy(); - glyph_node *gn = new glyph_node(soft_hyphen_char, tf, gcol, fcol); + glyph_node *gn = new glyph_node(soft_hyphen_char, tf, gcol, fcol, + state, div_nest_level); node *nn = n->merge_glyph_node(gn); if (nn == 0) { gn->next = n; nn = gn; } - return new dbreak_node(this, nn, next1); + return new dbreak_node(this, nn, state, div_nest_level, next1); } } return this; @@ -2257,7 +2329,8 @@ dbreak_node::~dbreak_node() node *kern_pair_node::copy() { - return new kern_pair_node(amount, n1->copy(), n2->copy()); + return new kern_pair_node(amount, n1->copy(), n2->copy(), state, + div_nest_level); } node *copy_node_list(node *n) @@ -2289,7 +2362,8 @@ void delete_node_list(node *n) node *dbreak_node::copy() { - dbreak_node *p = new dbreak_node(copy_node_list(none), copy_node_list(pre)); + dbreak_node *p = new dbreak_node(copy_node_list(none), copy_node_list(pre), + state, div_nest_level); p->post = copy_node_list(post); return p; } @@ -2307,11 +2381,12 @@ hyphen_list *kern_pair_node::get_hyphen_list(hyphen_list *tail, int *count) class hyphen_inhibitor_node : public node { public: - hyphen_inhibitor_node(node *nd = 0); + hyphen_inhibitor_node(node * = 0); node *copy(); int same(node *); const char *type(); int force_tprint(); + int is_tag(); hyphenation_type get_hyphenation_type(); }; @@ -2339,6 +2414,11 @@ int hyphen_inhibitor_node::force_tprint() return 0; } +int hyphen_inhibitor_node::is_tag() +{ + return 0; +} + hyphenation_type hyphen_inhibitor_node::get_hyphenation_type() { return HYPHEN_INHIBIT; @@ -2366,13 +2446,14 @@ node *node::add_discretionary_hyphen() node *next1 = next; next = 0; node *n = copy(); - glyph_node *gn = new glyph_node(soft_hyphen_char, tf, gcol, fcol); + glyph_node *gn = new glyph_node(soft_hyphen_char, tf, gcol, fcol, + state, div_nest_level); node *n1 = n->merge_glyph_node(gn); if (n1 == 0) { gn->next = n; n1 = gn; } - return new dbreak_node(this, n1, next1); + return new dbreak_node(this, n1, state, div_nest_level, next1); } return this; } @@ -2412,6 +2493,11 @@ int node::force_tprint() return 0; } +int node::is_tag() +{ + return 0; +} + hunits hmotion_node::width() { return n; @@ -2422,6 +2508,29 @@ units node::size() return points_to_units(10); } +void node::debug_node() +{ + fprintf(stderr, "{ %s ", type()); + if (push_state) + fprintf(stderr, " <push_state>"); + if (state) + fprintf(stderr, " <state>"); + fprintf(stderr, " nest level %d", div_nest_level); + fprintf(stderr, " }\n"); + fflush(stderr); +} + +void node::debug_node_list() +{ + node *n = next; + + debug_node(); + while (n != 0) { + n->debug_node(); + n = n->next; + } +} + hunits kern_pair_node::width() { return n1->width() + n2->width() + amount; @@ -2467,7 +2576,7 @@ class italic_corrected_node : public node { node *n; hunits x; public: - italic_corrected_node(node *, hunits, node * = 0); + italic_corrected_node(node *, hunits, statem *, int, node * = 0); ~italic_corrected_node(); node *copy(); void ascii_print(ascii_output_file *); @@ -2489,6 +2598,7 @@ public: node *add_self(node *, hyphen_list **); const char *type(); int force_tprint(); + int is_tag(); }; node *node::add_italic_correction(hunits *wd) @@ -2500,12 +2610,13 @@ node *node::add_italic_correction(hunits *wd) node *next1 = next; next = 0; *wd += ic; - return new italic_corrected_node(this, ic, next1); + return new italic_corrected_node(this, ic, state, div_nest_level, next1); } } -italic_corrected_node::italic_corrected_node(node *nn, hunits xx, node *p) -: node(p), n(nn), x(xx) +italic_corrected_node::italic_corrected_node(node *nn, hunits xx, statem *s, + int pop, node *p) +: node(p, s, pop), n(nn), x(xx) { assert(n != 0); } @@ -2517,7 +2628,7 @@ italic_corrected_node::~italic_corrected_node() node *italic_corrected_node::copy() { - return new italic_corrected_node(n->copy(), x); + return new italic_corrected_node(n->copy(), x, state, div_nest_level); } hunits italic_corrected_node::width() @@ -2608,6 +2719,7 @@ class break_char_node : public node { color *col; public: break_char_node(node *, int, color *, node * = 0); + break_char_node(node *, int, color *, statem *, int, node * = 0); ~break_char_node(); node *copy(); hunits width(); @@ -2629,6 +2741,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; break_char_node::break_char_node(node *n, int bc, color *c, node *x) @@ -2636,6 +2749,12 @@ break_char_node::break_char_node(node *n, int bc, color *c, node *x) { } +break_char_node::break_char_node(node *n, int bc, color *c, statem *s, + int pop, node *x) +: node(x, s, pop), ch(n), break_code(bc), col(c) +{ +} + break_char_node::~break_char_node() { delete ch; @@ -2643,7 +2762,8 @@ break_char_node::~break_char_node() node *break_char_node::copy() { - return new break_char_node(ch->copy(), break_code, col); + return new break_char_node(ch->copy(), break_code, col, state, + div_nest_level); } hunits break_char_node::width() @@ -2727,27 +2847,57 @@ tfont *break_char_node::get_tfont() node *extra_size_node::copy() { - return new extra_size_node(n); + return new extra_size_node(n, state, div_nest_level); +} + +extra_size_node::extra_size_node(vunits i, statem *s, int pop) +: node(0, s, pop), n(i) +{ +} + +extra_size_node::extra_size_node(vunits i) +: n(i) +{ } node *vertical_size_node::copy() { - return new vertical_size_node(n); + return new vertical_size_node(n, state, div_nest_level); +} + +vertical_size_node::vertical_size_node(vunits i, statem *s, int pop) +: node(0, s, pop), n(i) +{ +} + +vertical_size_node::vertical_size_node(vunits i) +: n(i) +{ } node *hmotion_node::copy() { - return new hmotion_node(n, was_tab, unformat, col); + return new hmotion_node(n, was_tab, unformat, col, state, div_nest_level); } node *space_char_hmotion_node::copy() { - return new space_char_hmotion_node(n, col); + return new space_char_hmotion_node(n, col, state, div_nest_level); +} + +vmotion_node::vmotion_node(vunits i, color *c) +: n(i), col(c) +{ +} + +vmotion_node::vmotion_node(vunits i, color *c, statem *s, int pop) +: node(0, s, pop), n(i), col(c) +{ } node *vmotion_node::copy() { - return new vmotion_node(n, col); + return new vmotion_node(n, col, state, div_nest_level); } node *dummy_node::copy() @@ -2766,9 +2916,19 @@ hline_node::~hline_node() delete n; } +hline_node::hline_node(hunits i, node *c, node *next) +: node(next), x(i), n(c) +{ +} + +hline_node::hline_node(hunits i, node *c, statem *s, int pop, node *next) +: node(next, s, pop), x(i), n(c) +{ +} + node *hline_node::copy() { - return new hline_node(x, n ? n->copy() : 0); + return new hline_node(x, n ? n->copy() : 0, state, div_nest_level); } hunits hline_node::width() @@ -2776,6 +2936,16 @@ hunits hline_node::width() return x < H0 ? H0 : x; } +vline_node::vline_node(vunits i, node *c, node *next) +: node(next), x(i), n(c) +{ +} + +vline_node::vline_node(vunits i, node *c, statem *s, int pop, node *next) +: node(next, s, pop), x(i), n(c) +{ +} + vline_node::~vline_node() { if (n) @@ -2784,7 +2954,7 @@ vline_node::~vline_node() node *vline_node::copy() { - return new vline_node(x, n ? n->copy() : 0); + return new vline_node(x, n ? n->copy() : 0, state, div_nest_level); } hunits vline_node::width() @@ -2792,7 +2962,13 @@ hunits vline_node::width() return n == 0 ? H0 : n->width(); } -zero_width_node::zero_width_node(node *nd) : n(nd) +zero_width_node::zero_width_node(node *nd, statem *s, int pop) +: n(nd), node(0, s, pop) +{ +} + +zero_width_node::zero_width_node(node *nd) +: n(nd) { } @@ -2803,7 +2979,7 @@ zero_width_node::~zero_width_node() node *zero_width_node::copy() { - return new zero_width_node(copy_node_list(n)); + return new zero_width_node(copy_node_list(n), state, div_nest_level); } int node_list_character_type(node *p) @@ -2842,7 +3018,13 @@ void zero_width_node::vertical_extent(vunits *min, vunits *max) node_list_vertical_extent(n, min, max); } -overstrike_node::overstrike_node() : list(0), max_width(H0) +overstrike_node::overstrike_node() +: list(0), max_width(H0) +{ +} + +overstrike_node::overstrike_node(statem *s, int pop) +: node(0, s, pop), list(0), max_width(H0) { } @@ -2853,7 +3035,7 @@ overstrike_node::~overstrike_node() node *overstrike_node::copy() { - overstrike_node *on = new overstrike_node; + overstrike_node *on = new overstrike_node(state, div_nest_level); for (node *tem = list; tem; tem = tem->next) on->overstrike(tem->copy()); return on; @@ -2878,7 +3060,13 @@ hunits overstrike_node::width() return max_width; } -bracket_node::bracket_node() : list(0), max_width(H0) +bracket_node::bracket_node() +: list(0), max_width(H0) +{ +} + +bracket_node::bracket_node(statem *s, int pop) +: node(0, s, pop), list(0), max_width(H0) { } @@ -2889,7 +3077,7 @@ bracket_node::~bracket_node() node *bracket_node::copy() { - bracket_node *on = new bracket_node; + bracket_node *on = new bracket_node(state, div_nest_level); node *last_node = 0; node *tem; if (list) @@ -2958,12 +3146,18 @@ inline void space_node::operator delete(void *p) #endif space_node::space_node(hunits nn, color *c, node *p) -: node(p), n(nn), set(0), was_escape_colon(0), col(c) +: node(p, 0, 0), n(nn), set(0), was_escape_colon(0), col(c) +{ +} + +space_node::space_node(hunits nn, color *c, statem *s, int pop, node *p) +: node(p, s, pop), n(nn), set(0), was_escape_colon(0), col(c) { } -space_node::space_node(hunits nn, int s, int flag, color *c, node *p) -: node(p), n(nn), set(s), was_escape_colon(flag), col(c) +space_node::space_node(hunits nn, int s, int flag, color *c, statem *st, + int pop, node *p) +: node(p, st, pop), n(nn), set(s), was_escape_colon(flag), col(c) { } @@ -2975,7 +3169,7 @@ space_node::~space_node() node *space_node::copy() { - return new space_node(n, set, was_escape_colon, col); + return new space_node(n, set, was_escape_colon, col, state, div_nest_level); } int space_node::force_tprint() @@ -2983,6 +3177,11 @@ int space_node::force_tprint() return 0; } +int space_node::is_tag() +{ + return 0; +} + int space_node::nspaces() { return set ? 0 : 1; @@ -3039,6 +3238,12 @@ void space_node::is_escape_colon() was_escape_colon = 1; } +diverted_space_node::diverted_space_node(vunits d, statem *s, int pop, + node *p) +: node(p, s, pop), n(d) +{ +} + diverted_space_node::diverted_space_node(vunits d, node *p) : node(p), n(d) { @@ -3046,7 +3251,13 @@ diverted_space_node::diverted_space_node(vunits d, node *p) node *diverted_space_node::copy() { - return new diverted_space_node(n); + return new diverted_space_node(n, state, div_nest_level); +} + +diverted_copy_file_node::diverted_copy_file_node(symbol s, statem *st, + int pop, node *p) +: node(p, st, pop), filename(s) +{ } diverted_copy_file_node::diverted_copy_file_node(symbol s, node *p) @@ -3056,7 +3267,7 @@ diverted_copy_file_node::diverted_copy_file_node(symbol s, node *p) node *diverted_copy_file_node::copy() { - return new diverted_copy_file_node(filename); + return new diverted_copy_file_node(filename, state, div_nest_level); } int node::ends_sentence() @@ -3347,8 +3558,15 @@ void hmotion_node::asciify(macro *m) } space_char_hmotion_node::space_char_hmotion_node(hunits i, color *c, - node *nxt) -: hmotion_node(i, c, nxt) + statem *s, int pop, + node *next) +: hmotion_node(i, c, s, pop, next) +{ +} + +space_char_hmotion_node::space_char_hmotion_node(hunits i, color *c, + node *next) +: hmotion_node(i, c, 0, 0, next) { } @@ -3606,12 +3824,16 @@ special_node::special_node(const macro &m, int n) tf = tf->get_plain(); gcol = curenv->get_glyph_color(); fcol = curenv->get_fill_color(); + is_special = 1; } special_node::special_node(const macro &m, tfont *t, - color *gc, color *fc, int n) -: mac(m), tf(t), gcol(gc), fcol(fc), no_init_string(n) + color *gc, color *fc, + statem *s, int pop, + int n) +: node(0, s, pop), mac(m), tf(t), gcol(gc), fcol(fc), no_init_string(n) { + is_special = 1; } int special_node::same(node *n) @@ -3638,9 +3860,15 @@ int special_node::force_tprint() return 0; } +int special_node::is_tag() +{ + return 0; +} + node *special_node::copy() { - return new special_node(mac, tf, gcol, fcol, no_init_string); + return new special_node(mac, tf, gcol, fcol, state, div_nest_level, + no_init_string); } void special_node::tprint_start(troff_output_file *out) @@ -3666,8 +3894,8 @@ tfont *special_node::get_tfont() /* suppress_node */ suppress_node::suppress_node(int on_or_off, int issue_limits) -: is_on(on_or_off), emit_limits(issue_limits), - filename(0), position(0), image_id(0) +: is_on(on_or_off), emit_limits(issue_limits), filename(0), position(0), + image_id(0) { } @@ -3677,9 +3905,10 @@ suppress_node::suppress_node(symbol f, char p, int id) } suppress_node::suppress_node(int issue_limits, int on_or_off, - symbol f, char p, int id) -: is_on(on_or_off), emit_limits(issue_limits), - filename(f), position(p), image_id(id) + symbol f, char p, int id, + statem *s, int pop) +: node(0, s, pop), is_on(on_or_off), emit_limits(issue_limits), filename(f), + position(p), image_id(id) { } @@ -3699,7 +3928,67 @@ const char *suppress_node::type() node *suppress_node::copy() { - return new suppress_node(emit_limits, is_on, filename, position, image_id); + return new suppress_node(emit_limits, is_on, filename, position, image_id, + state, div_nest_level); +} + +/* tag_node */ + +tag_node::tag_node() +: delayed(0) +{ + is_special = 1; +} + +tag_node::tag_node(string s, int delay) +: tag_string(s), delayed(delay) +{ + is_special = !delay; +} + +tag_node::tag_node(string s, statem *st, int pop, int delay) +: node(0, st, pop), tag_string(s), delayed(delay) +{ + is_special = !delay; +} + +node *tag_node::copy() +{ + return new tag_node(tag_string, state, div_nest_level, delayed); +} + +void tag_node::tprint(troff_output_file *out) +{ + if (delayed) + out->add_to_tag_list(tag_string); + else + out->state.add_tag(out->fp, tag_string); +} + +int tag_node::same(node *nd) +{ + return tag_string == ((tag_node *)nd)->tag_string + && delayed == ((tag_node *)nd)->delayed; +} + +const char *tag_node::type() +{ + return "tag_node"; +} + +int tag_node::force_tprint() +{ + return !delayed; +} + +int tag_node::is_tag() +{ + return !delayed; +} + +int tag_node::ends_sentence() +{ + return 2; } int get_reg_int(const char *p) @@ -3852,6 +4141,11 @@ int suppress_node::force_tprint() return is_on; } +int suppress_node::is_tag() +{ + return is_on; +} + hunits suppress_node::width() { return H0; @@ -3863,7 +4157,7 @@ class composite_node : public charinfo_node { node *n; tfont *tf; public: - composite_node(node *, charinfo *, tfont *, node * = 0); + composite_node(node *, charinfo *, tfont *, statem *, int, node * = 0); ~composite_node(); node *copy(); hunits width(); @@ -3879,12 +4173,14 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); void vertical_extent(vunits *, vunits *); vunits vertical_width(); }; -composite_node::composite_node(node *p, charinfo *c, tfont *t, node *x) -: charinfo_node(c, x), n(p), tf(t) +composite_node::composite_node(node *p, charinfo *c, tfont *t, statem *s, + int pop, node *x) +: charinfo_node(c, s, pop, x), n(p), tf(t) { } @@ -3895,7 +4191,7 @@ composite_node::~composite_node() node *composite_node::copy() { - return new composite_node(copy_node_list(n), ci, tf); + return new composite_node(copy_node_list(n), ci, tf, state, div_nest_level); } hunits composite_node::width() @@ -4018,8 +4314,8 @@ word_space_node::word_space_node(hunits d, color *c, width_list *w, node *x) } word_space_node::word_space_node(hunits d, int s, color *c, width_list *w, - int flag, node *x) -: space_node(d, s, 0, c, x), orig_width(w), unformat(flag) + int flag, statem *st, int pop, node *x) +: space_node(d, s, 0, c, st, pop, x), orig_width(w), unformat(flag) { } @@ -4045,7 +4341,8 @@ node *word_space_node::copy() w_new_curr = w_new_curr->next; w_old_curr = w_old_curr->next; } - return new word_space_node(n, set, col, w_new, unformat); + return new word_space_node(n, set, col, w_new, unformat, state, + div_nest_level); } int word_space_node::set_unformat_flag() @@ -4078,14 +4375,15 @@ unbreakable_space_node::unbreakable_space_node(hunits d, color *c, node *x) } unbreakable_space_node::unbreakable_space_node(hunits d, int s, - color *c, node *x) -: word_space_node(d, s, c, 0, 0, x) + color *c, statem *st, int pop, + node *x) +: word_space_node(d, s, c, 0, 0, st, pop, x) { } node *unbreakable_space_node::copy() { - return new unbreakable_space_node(n, set, col); + return new unbreakable_space_node(n, set, col, state, div_nest_level); } int unbreakable_space_node::force_tprint() @@ -4093,6 +4391,11 @@ int unbreakable_space_node::force_tprint() return 0; } +int unbreakable_space_node::is_tag() +{ + return 0; +} + breakpoint *unbreakable_space_node::get_breakpoints(hunits, int, breakpoint *rest, int) { @@ -4127,6 +4430,15 @@ draw_node::draw_node(char c, hvpair *p, int np, font_size s, point[i] = p[i]; } +draw_node::draw_node(char c, hvpair *p, int np, font_size s, + color *gc, color *fc, statem *st, int pop) +: node(0, st, pop), npoints(np), sz(s), gcol(gc), fcol(fc), code(c) +{ + point = new hvpair[npoints]; + for (int i = 0; i < npoints; i++) + point[i] = p[i]; +} + int draw_node::same(node *n) { draw_node *nd = (draw_node *)n; @@ -4149,6 +4461,11 @@ int draw_node::force_tprint() return 0; } +int draw_node::is_tag() +{ + return 0; +} + draw_node::~draw_node() { if (point) @@ -4175,7 +4492,8 @@ vunits draw_node::vertical_width() node *draw_node::copy() { - return new draw_node(code, point, npoints, sz, gcol, fcol); + return new draw_node(code, point, npoints, sz, gcol, fcol, state, + div_nest_level); } void draw_node::tprint(troff_output_file *out) @@ -4510,7 +4828,7 @@ node *make_composite_node(charinfo *s, environment *env) fontno); if (env->is_composite()) tf = tf->get_plain(); - return new composite_node(n, s, tf); + return new composite_node(n, s, tf, 0, 0, 0); } node *make_glyph_node(charinfo *s, environment *env, int no_error_message = 0) @@ -4596,7 +4914,7 @@ node *make_glyph_node(charinfo *s, environment *env, int no_error_message = 0) tf = tf->get_plain(); color *gcol = env->get_glyph_color(); color *fcol = env->get_fill_color(); - return new glyph_node(s, tf, gcol, fcol); + return new glyph_node(s, tf, gcol, fcol, 0, 0); } node *make_node(charinfo *ci, environment *env) @@ -4642,7 +4960,7 @@ int character_exists(charinfo *ci, environment *env) } node *node::add_char(charinfo *ci, environment *env, - hunits *widthp, int *spacep) + hunits *widthp, int *spacep, node **glyph_comp_np) { node *res; switch (ci->get_special_translation()) { @@ -4672,9 +4990,14 @@ node *node::add_char(charinfo *ci, environment *env, if (res) { res->next = this; *widthp += res->width(); + if (glyph_comp_np) + *glyph_comp_np = res; } - else + else { + if (glyph_comp_np) + *glyph_comp_np = res; return this; + } } else { node *gn = make_glyph_node(ci, env); @@ -4692,6 +5015,8 @@ node *node::add_char(charinfo *ci, environment *env, *widthp += p->width() - old_width; res = p; } + if (glyph_comp_np) + *glyph_comp_np = res; } } int break_code = 0; @@ -4748,6 +5073,11 @@ int extra_size_node::force_tprint() return 0; } +int extra_size_node::is_tag() +{ + return 0; +} + int vertical_size_node::same(node *nd) { return n == ((vertical_size_node *)nd)->n; @@ -4768,6 +5098,11 @@ int vertical_size_node::force_tprint() return 0; } +int vertical_size_node::is_tag() +{ + return 0; +} + int hmotion_node::same(node *nd) { return n == ((hmotion_node *)nd)->n @@ -4790,6 +5125,11 @@ int hmotion_node::force_tprint() return 0; } +int hmotion_node::is_tag() +{ + return 0; +} + node *hmotion_node::add_self(node *nd, hyphen_list **p) { next = nd; @@ -4820,6 +5160,11 @@ int space_char_hmotion_node::force_tprint() return 0; } +int space_char_hmotion_node::is_tag() +{ + return 0; +} + node *space_char_hmotion_node::add_self(node *nd, hyphen_list **p) { next = nd; @@ -4851,6 +5196,11 @@ int vmotion_node::force_tprint() return 0; } +int vmotion_node::is_tag() +{ + return 0; +} + int hline_node::same(node *nd) { return x == ((hline_node *)nd)->x && same_node(n, ((hline_node *)nd)->n); @@ -4866,6 +5216,11 @@ int hline_node::force_tprint() return 0; } +int hline_node::is_tag() +{ + return 0; +} + int vline_node::same(node *nd) { return x == ((vline_node *)nd)->x && same_node(n, ((vline_node *)nd)->n); @@ -4881,6 +5236,11 @@ int vline_node::force_tprint() return 0; } +int vline_node::is_tag() +{ + return 0; +} + int dummy_node::same(node * /*nd*/) { return 1; @@ -4896,6 +5256,11 @@ int dummy_node::force_tprint() return 0; } +int dummy_node::is_tag() +{ + return 0; +} + int transparent_dummy_node::same(node * /*nd*/) { return 1; @@ -4911,6 +5276,11 @@ int transparent_dummy_node::force_tprint() return 0; } +int transparent_dummy_node::is_tag() +{ + return 0; +} + int transparent_dummy_node::ends_sentence() { return 2; @@ -4931,6 +5301,11 @@ int zero_width_node::force_tprint() return 0; } +int zero_width_node::is_tag() +{ + return 0; +} + int italic_corrected_node::same(node *nd) { return (x == ((italic_corrected_node *)nd)->x @@ -4947,8 +5322,19 @@ int italic_corrected_node::force_tprint() return 0; } -left_italic_corrected_node::left_italic_corrected_node(node *xx) -: node(xx), n(0) +int italic_corrected_node::is_tag() +{ + return 0; +} + +left_italic_corrected_node::left_italic_corrected_node(node *x) +: node(x), n(0) +{ +} + +left_italic_corrected_node::left_italic_corrected_node(statem *s, int pop, + node *x) +: node(x, s, pop), n(0) { } @@ -4980,7 +5366,8 @@ node *left_italic_corrected_node::merge_glyph_node(glyph_node *gn) node *left_italic_corrected_node::copy() { - left_italic_corrected_node *nd = new left_italic_corrected_node; + left_italic_corrected_node *nd = + new left_italic_corrected_node(state, div_nest_level); if (n) { nd->n = n->copy(); nd->x = x; @@ -5006,6 +5393,11 @@ int left_italic_corrected_node::force_tprint() return 0; } +int left_italic_corrected_node::is_tag() +{ + return 0; +} + int left_italic_corrected_node::same(node *nd) { return (x == ((left_italic_corrected_node *)nd)->x @@ -5089,7 +5481,7 @@ hyphen_list *left_italic_corrected_node::get_hyphen_list(hyphen_list *tail, node *left_italic_corrected_node::add_self(node *nd, hyphen_list **p) { if (n) { - nd = new left_italic_corrected_node(nd); + nd = new left_italic_corrected_node(state, div_nest_level, nd); nd = n->add_self(nd, p); n = 0; delete this; @@ -5117,6 +5509,11 @@ int overstrike_node::force_tprint() return 0; } +int overstrike_node::is_tag() +{ + return 0; +} + node *overstrike_node::add_self(node *n, hyphen_list **p) { next = n; @@ -5146,6 +5543,11 @@ int bracket_node::force_tprint() return 0; } +int bracket_node::is_tag() +{ + return 0; +} + int composite_node::same(node *nd) { return ci == ((composite_node *)nd)->ci @@ -5162,6 +5564,11 @@ int composite_node::force_tprint() return 0; } +int composite_node::is_tag() +{ + return 0; +} + int glyph_node::same(node *nd) { return ci == ((glyph_node *)nd)->ci @@ -5180,6 +5587,11 @@ int glyph_node::force_tprint() return 0; } +int glyph_node::is_tag() +{ + return 0; +} + int ligature_node::same(node *nd) { return (same_node(n1, ((ligature_node *)nd)->n1) @@ -5197,6 +5609,11 @@ int ligature_node::force_tprint() return 0; } +int ligature_node::is_tag() +{ + return 0; +} + int kern_pair_node::same(node *nd) { return (amount == ((kern_pair_node *)nd)->amount @@ -5214,6 +5631,11 @@ int kern_pair_node::force_tprint() return 0; } +int kern_pair_node::is_tag() +{ + return 0; +} + int dbreak_node::same(node *nd) { return (same_node_list(none, ((dbreak_node *)nd)->none) @@ -5231,6 +5653,11 @@ int dbreak_node::force_tprint() return 0; } +int dbreak_node::is_tag() +{ + return 0; +} + int break_char_node::same(node *nd) { return break_code == ((break_char_node *)nd)->break_code @@ -5248,6 +5675,11 @@ int break_char_node::force_tprint() return 0; } +int break_char_node::is_tag() +{ + return 0; +} + int line_start_node::same(node * /*nd*/) { return 1; @@ -5263,6 +5695,11 @@ int line_start_node::force_tprint() return 0; } +int line_start_node::is_tag() +{ + return 0; +} + int space_node::same(node *nd) { return n == ((space_node *)nd)->n @@ -5292,6 +5729,11 @@ int word_space_node::force_tprint() return 0; } +int word_space_node::is_tag() +{ + return 0; +} + void unbreakable_space_node::tprint(troff_output_file *out) { out->fill_color(col); @@ -5347,6 +5789,11 @@ int diverted_space_node::force_tprint() return 0; } +int diverted_space_node::is_tag() +{ + return 0; +} + int diverted_copy_file_node::same(node *nd) { return filename == ((diverted_copy_file_node *)nd)->filename; @@ -5362,6 +5809,11 @@ int diverted_copy_file_node::force_tprint() return 0; } +int diverted_copy_file_node::is_tag() +{ + return 0; +} + // Grow the font_table so that its size is > n. static void grow_font_table(int n) diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h index 31c58581..e14886f3 100644 --- a/src/roff/troff/node.h +++ b/src/roff/troff/node.h @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with groff; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "mtsm.h" + struct hyphen_list { unsigned char hyphen; unsigned char breakable; @@ -50,14 +52,20 @@ class token_node; struct node { node *next; node *last; + statem *state; + statem *push_state; + int div_nest_level; + int is_special; node(); node(node *); - node *add_char(charinfo *, environment *, hunits *, int *); + node(node *, statem *, int); + node *add_char(charinfo *, environment *, hunits *, int *, node ** = 0); virtual ~node(); virtual node *copy() = 0; virtual int set_unformat_flag(); virtual int force_tprint() = 0; + virtual int is_tag() = 0; virtual hunits width(); virtual hunits subscript_correction(); virtual hunits italic_correction(); @@ -103,16 +111,27 @@ struct node { virtual int same(node *) = 0; virtual const char *type() = 0; + virtual void debug_node(); + virtual void debug_node_list(); }; inline node::node() -: next(0), last(0) +: next(0), last(0), state(0), push_state(0), div_nest_level(0), is_special(0) { } inline node::node(node *n) -: next(n), last(0) +: next(n), last(0), state(0), push_state(0), div_nest_level(0), is_special(0) +{ +} + +inline node::node(node *n, statem *s, int divlevel) +: next(n), last(0), push_state(0), div_nest_level(divlevel), is_special(0) { + if (s) + state = new statem(s); + else + state = 0; } inline node::~node() @@ -138,6 +157,7 @@ public: node *copy() { return new line_start_node; } int same(node *); int force_tprint(); + int is_tag(); const char *type(); void asciify(macro *); }; @@ -154,8 +174,9 @@ protected: char set; char was_escape_colon; color *col; /* for grotty */ - space_node(hunits, int, int, color *, node * = 0); + space_node(hunits, int, int, color *, statem *, int, node * = 0); public: + space_node(hunits, color *, statem *, int, node * = 0); space_node(hunits, color *, node * = 0); #if 0 ~space_node(); @@ -178,6 +199,7 @@ public: void asciify(macro *); const char *type(); int force_tprint(); + int is_tag(); hyphenation_type get_hyphenation_type(); }; @@ -193,7 +215,8 @@ class word_space_node : public space_node { protected: width_list *orig_width; unsigned char unformat; - word_space_node(hunits, int, color *, width_list *, int, node * = 0); + word_space_node(hunits, int, color *, width_list *, int, statem *, int, + node * = 0); public: word_space_node(hunits, color *, width_list *, node * = 0); ~word_space_node(); @@ -206,10 +229,11 @@ public: const char *type(); int merge_space(hunits, hunits, hunits); int force_tprint(); + int is_tag(); }; class unbreakable_space_node : public word_space_node { - unbreakable_space_node(hunits, int, color *, node * = 0); + unbreakable_space_node(hunits, int, color *, statem *, int, node * = 0); public: unbreakable_space_node(hunits, color *, node * = 0); node *copy(); @@ -219,6 +243,7 @@ public: void asciify(macro *); const char *type(); int force_tprint(); + int is_tag(); breakpoint *get_breakpoints(hunits, int, breakpoint * = 0, int = 0); int nbreaks(); void split(int, node **, node **); @@ -232,11 +257,13 @@ class diverted_space_node : public node { public: vunits n; diverted_space_node(vunits, node * = 0); + diverted_space_node(vunits, statem *, int, node * = 0); node *copy(); int reread(int *); int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; class diverted_copy_file_node : public node { @@ -244,28 +271,33 @@ class diverted_copy_file_node : public node { public: vunits n; diverted_copy_file_node(symbol, node * = 0); + diverted_copy_file_node(symbol, statem *, int, node * = 0); node *copy(); int reread(int *); int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; class extra_size_node : public node { vunits n; public: - extra_size_node(vunits i) : n(i) {} + extra_size_node(vunits); + extra_size_node(vunits, statem *, int); void set_vertical_size(vertical_size *); node *copy(); int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; class vertical_size_node : public node { vunits n; public: - vertical_size_node(vunits i) : n(i) {} + vertical_size_node(vunits, statem *, int); + vertical_size_node(vunits); void set_vertical_size(vertical_size *); void asciify(macro *); node *copy(); @@ -273,6 +305,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; class hmotion_node : public node { @@ -284,6 +317,12 @@ protected: public: hmotion_node(hunits i, color *c, node *nxt = 0) : node(nxt), n(i), was_tab(0), unformat(0), col(c) {} + hmotion_node(hunits i, color *c, statem *s, int divlevel, node *next = 0) + : node(next, s, divlevel), n(i), was_tab(0), unformat(0), col(c) {} + hmotion_node(hunits i, int flag1, int flag2, color *c, statem *s, + int divlevel, node *next = 0) + : node(next, s, divlevel), n(i), was_tab(flag1), unformat(flag2), + col(c) {} hmotion_node(hunits i, int flag1, int flag2, color *c, node *nxt = 0) : node(nxt), n(i), was_tab(flag1), unformat(flag2), col(c) {} node *copy(); @@ -296,6 +335,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); node *add_self(node *, hyphen_list **); hyphen_list *get_hyphen_list(hyphen_list *, int *); hyphenation_type get_hyphenation_type(); @@ -304,6 +344,7 @@ public: class space_char_hmotion_node : public hmotion_node { public: space_char_hmotion_node(hunits, color *, node * = 0); + space_char_hmotion_node(hunits, color *, statem *, int, node * = 0); node *copy(); void ascii_print(ascii_output_file *); void asciify(macro *); @@ -311,6 +352,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); node *add_self(node *, hyphen_list **); hyphen_list *get_hyphen_list(hyphen_list *, int *); hyphenation_type get_hyphenation_type(); @@ -320,20 +362,23 @@ class vmotion_node : public node { vunits n; color *col; /* for grotty */ public: - vmotion_node(vunits i, color *c) : n(i), col(c) {} + vmotion_node(vunits, color *); + vmotion_node(vunits, color *, statem *, int); void tprint(troff_output_file *); node *copy(); vunits vertical_width(); int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; class hline_node : public node { hunits x; node *n; public: - hline_node(hunits i, node *c, node *nxt = 0) : node(nxt), x(i), n(c) {} + hline_node(hunits, node *, node * = 0); + hline_node(hunits, node *, statem *, int, node * = 0); ~hline_node(); node *copy(); hunits width(); @@ -341,13 +386,15 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; class vline_node : public node { vunits x; node *n; public: - vline_node(vunits i, node *c, node *nxt = 0) : node(nxt), x(i), n(c) {} + vline_node(vunits, node *, node * = 0); + vline_node(vunits, node *, statem *, int, node * = 0); ~vline_node(); node *copy(); void tprint(troff_output_file *); @@ -357,9 +404,9 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; - class dummy_node : public node { public: dummy_node(node *nd = 0) : node(nd) {} @@ -367,6 +414,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); hyphenation_type get_hyphenation_type(); }; @@ -377,6 +425,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); int ends_sentence(); hyphenation_type get_hyphenation_type(); }; @@ -385,12 +434,14 @@ class zero_width_node : public node { node *n; public: zero_width_node(node *); + zero_width_node(node *, statem *, int); ~zero_width_node(); node *copy(); void tprint(troff_output_file *); int same(node *); const char *type(); int force_tprint(); + int is_tag(); void append(node *); int character_type(); void vertical_extent(vunits *, vunits *); @@ -401,6 +452,7 @@ class left_italic_corrected_node : public node { hunits x; public: left_italic_corrected_node(node * = 0); + left_italic_corrected_node(statem *, int, node * = 0); ~left_italic_corrected_node(); void tprint(troff_output_file *); void ascii_print(ascii_output_file *); @@ -409,6 +461,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); hunits width(); node *last_char_node(); void vertical_extent(vunits *, vunits *); @@ -431,6 +484,7 @@ class overstrike_node : public node { hunits max_width; public: overstrike_node(); + overstrike_node(statem *, int); ~overstrike_node(); node *copy(); void tprint(troff_output_file *); @@ -439,6 +493,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); node *add_self(node *, hyphen_list **); hyphen_list *get_hyphen_list(hyphen_list *, int *); hyphenation_type get_hyphenation_type(); @@ -449,6 +504,7 @@ class bracket_node : public node { hunits max_width; public: bracket_node(); + bracket_node(statem *, int); ~bracket_node(); node *copy(); void tprint(troff_output_file *); @@ -457,6 +513,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; class special_node : public node { @@ -470,12 +527,14 @@ class special_node : public node { void tprint_end(troff_output_file *); public: special_node(const macro &, int = 0); - special_node(const macro &, tfont *, color *, color *, int = 0); + special_node(const macro &, tfont *, color *, color *, statem *, int, + int = 0); node *copy(); void tprint(troff_output_file *); int same(node *); const char *type(); int force_tprint(); + int is_tag(); int ends_sentence(); tfont *get_tfont(); }; @@ -489,6 +548,7 @@ class suppress_node : public node { public: suppress_node(int, int); suppress_node(symbol, char, int); + suppress_node(int, int, symbol, char, int, statem *, int); suppress_node(int, int, symbol, char, int); node *copy(); void tprint(troff_output_file *); @@ -496,10 +556,27 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); private: void put(troff_output_file *, const char *); }; +class tag_node : public node { +public: + string tag_string; + int delayed; + tag_node(); + tag_node(string, int); + tag_node(string, statem *, int, int); + node *copy(); + void tprint(troff_output_file *); + int same(node *); + const char *type(); + int force_tprint(); + int is_tag(); + int ends_sentence(); +}; + struct hvpair { hunits h; vunits v; @@ -515,6 +592,7 @@ class draw_node : public node { hvpair *point; public: draw_node(char, hvpair *, int, font_size, color *, color *); + draw_node(char, hvpair *, int, font_size, color *, color *, statem *, int); ~draw_node(); hunits width(); vunits vertical_width(); @@ -523,6 +601,7 @@ public: int same(node *); const char *type(); int force_tprint(); + int is_tag(); }; class charinfo; @@ -571,6 +650,7 @@ public: #ifdef COLUMN virtual void vjustify(vunits, symbol); #endif /* COLUMN */ + mtsm state; }; #ifndef POPEN_MISSING |