diff options
author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2024-01-05 02:07:33 -0600 |
---|---|---|
committer | G. Branden Robinson <g.branden.robinson@gmail.com> | 2024-01-05 02:07:33 -0600 |
commit | f4edc5e91e2a629047241f71c2313e2f3a8b76e0 (patch) | |
tree | be7b9a6b9414c0b718584ef73edb03e113bb0ff8 | |
parent | 6d26ead916112858beeb7bf613e5fea5a0056615 (diff) |
[troff]: Trivially refactor.
* src/roff/troff/input.cpp
(class non_interpreted_char_node)
(class token_node)
(class non_interpreted_node):
Rename `same()` member function to `is_same_as()`. Demote
`is_same_as()` and `is_tag()` member function from `int` to `bool`.
(non_interpreted_char_node::same):
(token_node::same):
(non_interpreted_node::same): Rename these...
(non_interpreted_char_node::is_same_as):
(token_node::is_same_as):
(non_interpreted_node::is_same_as): ...to these. Demote return type
from `int` to `bool`.
(non_interpreted_char_node::is_tag):
(operator==):
Demote return type from `int` to `bool`.
(operator==):
Return Boolean instead of integer literal. Rename local variable
`are_same` to `same` for brevity and demote it from `int` to `bool`.
* src/roff/troff/node.cpp
(class glyph_node)
(class ligature_node)
(class kern_pair_node)
(class dbreak_node)
(class hyphen_inhibitor_node):
(class italic_corrected_node):
(class break_char_node):
(class composite_node):
Rename `same()` member function to `is_same_as()`. Demote
`is_same_as()` and `is_tag()` member function from `int` to `bool`.
(hyphen_inhibitor_node::same):
(special_node::same):
(suppress_node::same):
(tag_node::same):
(draw_node::same):
(extra_size_node::same):
(vertical_size_node::same):
(hmotion_node::same):
(space_char_hmotion_node::same):
(vmotion_node::same):
(hline_node::same):
(vline_node::same):
(dummy_node::same):
(transparent_dummy_node::same):
(zero_width_node::same):
(italic_corrected_node::same):
(left_italic_corrected_node::same):
(overstrike_node::same):
(bracket_node::same):
(composite_node::same):
(glyph_node::same):
(ligature_node::same):
(kern_pair_node::same):
(dbreak_node::same):
(break_char_node::same):
(line_start_node::same):
(space_node::same):
(word_space_node::same):
(unbreakable_space_node::same):
(diverted_space_node::same):
(diverted_copy_file_node::same): Rename these...
(hyphen_inhibitor_node::is_same_as):
(special_node::is_same_as):
(suppress_node::is_same_as):
(tag_node::is_same_as):
(draw_node::is_same_as):
(extra_size_node::is_same_as):
(vertical_size_node::is_same_as):
(hmotion_node::is_same_as):
(space_char_hmotion_node::is_same_as):
(vmotion_node::is_same_as):
(hline_node::is_same_as):
(vline_node::is_same_as):
(dummy_node::is_same_as):
(transparent_dummy_node::is_same_as):
(zero_width_node::is_same_as):
(italic_corrected_node::is_same_as):
(left_italic_corrected_node::is_same_as):
(overstrike_node::is_same_as):
(bracket_node::is_same_as):
(composite_node::is_same_as):
(glyph_node::is_same_as):
(ligature_node::is_same_as):
(kern_pair_node::is_same_as):
(dbreak_node::is_same_as):
(break_char_node::is_same_as):
(line_start_node::is_same_as):
(space_node::is_same_as):
(word_space_node::is_same_as):
(unbreakable_space_node::is_same_as):
(diverted_space_node::is_same_as):
(diverted_copy_file_node::is_same_as): ...to these. Demote return
type from `int` to `bool`.
(hyphen_inhibitor_node::is_tag):
(node::is_tag):
(space_node::is_tag):
(special_node::is_tag):
(tag_node::is_tag):
(suppress_node::is_tag):
(unbreakable_space_node::is_tag):
(draw_node::is_tag):
(extra_size_node::is_tag):
(hmotion_node::is_tag):
(space_char_hmotion_node::is_tag):
(vmotion_node::is_tag):
(hline_node::is_tag):
(vline_node::is_tag):
(dummy_node::is_tag):
(transparent_dummy_node::is_tag):
(zero_width_node::is_tag):
(italic_corrected_node::is_tag):
(left_italic_corrected_node::is_tag):
(overstrike_node::is_tag):
(bracket_node::is_tag):
(glyph_node::is_tag):
(ligature_node::is_tag):
(kern_pair_node::is_tag):
(dbreak_node::is_tag):
(break_char_node::is_tag):
(line_start_node::is_tag):
(word_space_node::is_tag):
(diverted_space_node::is_tag):
(diverted_copy_file_node::is_tag):
Demote return type from `int` to `bool`.
(hyphen_inhibitor_node::is_tag):
(node::is_tag):
(space_node::is_tag):
(special_node::is_tag):
(tag_node::is_tag):
(unbreakable_space_node::is_tag):
(draw_node::is_tag):
(vertical_size_node::is_tag):
(hmotion_node::is_tag):
(space_char_hmotion_node::is_tag):
(vmotion_node::is_tag):
(hline_node::is_tag):
(vline_node::is_tag):
(dummy_node::is_same_as):
(dummy_node::is_tag):
(transparent_dummy_node::is_same_as):
(zero_width_node::is_tag):
(italic_corrected_node::is_tag):
(left_italic_corrected_node::is_tag):
(overstrike_node::is_tag):
(bracket_node::is_tag):
(glyph_node::is_tag):
(ligature_node::is_tag):
(kern_pair_node::is_tag):
(dbreak_node::is_tag):
(break_char_node::is_tag):
(line_start_node::is_same_as):
(line_start_node::is_tag):
(word_space_node::is_tag):
(diverted_space_node::is_tag):
(diverted_copy_file_node::is_tag):
(same_node, same_node_list):
Return Boolean instead of integer literal.
(make_glyph_node, same_node): Make explicit comparisons of pointer
types to null pointer literals.
* src/roff/troff/node.h (struct node): Demote member variable
`is_special` from `int` to `bool`. Demote pure virtual member
function `is_tag`'s return type from `int` to `bool`. Rename pure
virtual member function from `same` to `is_same_as` and demote its
return type from `int` to `bool`.
(node::node): Use Boolean instead of integer literal in overloaded
`is_special` initializers.
(class line_start_node):
(class space_node):
(class word_space_node):
(class unbreakable_space_node):
(class diverted_space_node):
(class diverted_copy_file_node):
(class extra_size_node):
(class vertical_size_node):
(class hmotion_node):
(class space_char_hmotion_node):
(class vmotion_node):
(class hline_node):
(class vline_node):
(class dummy_node):
(class transparent_dummy_node):
(class zero_width_node):
(class left_italic_corrected_node):
(class overstrike_node):
(class bracket_node):
(class special_node):
(class suppress_node):
(class tag_node):
(class draw_node):
Rename member function `same` to `is_same_as`. Demote member
functions `is_same_as` and `is_tag` from `int` to `bool`.
* src/roff/troff/request.h (class macro): Demote friend function
`operator==` from `int` to `bool`.
Also:
Annotate null pointers with `nullptr` comment to ease any future
transition to C++11, which defines it as a keyword. Wrap long input
lines. Drop annotations of names of unused single parameters to member
functions in definitions. Update editor aid comments; drop old-style
Emacs file-local variable setting.
-rw-r--r-- | ChangeLog | 217 | ||||
-rw-r--r-- | src/roff/troff/input.cpp | 43 | ||||
-rw-r--r-- | src/roff/troff/node.cpp | 255 | ||||
-rw-r--r-- | src/roff/troff/node.h | 198 | ||||
-rw-r--r-- | src/roff/troff/request.h | 2 |
5 files changed, 481 insertions, 234 deletions
@@ -1,5 +1,222 @@ 2024-01-04 G. Branden Robinson <g.branden.robinson@gmail.com> + [troff]: Trivially refactor. + + * src/roff/troff/input.cpp + (class non_interpreted_char_node) + (class token_node) + (class non_interpreted_node): + Rename `same()` member function to `is_same_as()`. Demote + `is_same_as()` and `is_tag()` member function from `int` to + `bool`. + + (non_interpreted_char_node::same): + (token_node::same): + (non_interpreted_node::same): Rename these... + (non_interpreted_char_node::is_same_as): + (token_node::is_same_as): + (non_interpreted_node::is_same_as): ...to these. Demote return + type from `int` to `bool`. + + (non_interpreted_char_node::is_tag): + (operator==): + Demote return type from `int` to `bool`. + + (operator==): + Return Boolean instead of integer literal. Rename local + variable `are_same` to `same` for brevity and demote it from + `int` to `bool`. + + * src/roff/troff/node.cpp + (class glyph_node) + (class ligature_node) + (class kern_pair_node) + (class dbreak_node) + (class hyphen_inhibitor_node): + (class italic_corrected_node): + (class break_char_node): + (class composite_node): + Rename `same()` member function to `is_same_as()`. Demote + `is_same_as()` and `is_tag()` member function from `int` to + `bool`. + + (hyphen_inhibitor_node::same): + (special_node::same): + (suppress_node::same): + (tag_node::same): + (draw_node::same): + (extra_size_node::same): + (vertical_size_node::same): + (hmotion_node::same): + (space_char_hmotion_node::same): + (vmotion_node::same): + (hline_node::same): + (vline_node::same): + (dummy_node::same): + (transparent_dummy_node::same): + (zero_width_node::same): + (italic_corrected_node::same): + (left_italic_corrected_node::same): + (overstrike_node::same): + (bracket_node::same): + (composite_node::same): + (glyph_node::same): + (ligature_node::same): + (kern_pair_node::same): + (dbreak_node::same): + (break_char_node::same): + (line_start_node::same): + (space_node::same): + (word_space_node::same): + (unbreakable_space_node::same): + (diverted_space_node::same): + (diverted_copy_file_node::same): + Rename these... + (hyphen_inhibitor_node::is_same_as): + (special_node::is_same_as): + (suppress_node::is_same_as): + (tag_node::is_same_as): + (draw_node::is_same_as): + (extra_size_node::is_same_as): + (vertical_size_node::is_same_as): + (hmotion_node::is_same_as): + (space_char_hmotion_node::is_same_as): + (vmotion_node::is_same_as): + (hline_node::is_same_as): + (vline_node::is_same_as): + (dummy_node::is_same_as): + (transparent_dummy_node::is_same_as): + (zero_width_node::is_same_as): + (italic_corrected_node::is_same_as): + (left_italic_corrected_node::is_same_as): + (overstrike_node::is_same_as): + (bracket_node::is_same_as): + (composite_node::is_same_as): + (glyph_node::is_same_as): + (ligature_node::is_same_as): + (kern_pair_node::is_same_as): + (dbreak_node::is_same_as): + (break_char_node::is_same_as): + (line_start_node::is_same_as): + (space_node::is_same_as): + (word_space_node::is_same_as): + (unbreakable_space_node::is_same_as): + (diverted_space_node::is_same_as): + (diverted_copy_file_node::is_same_as): + ...to these. Demote return type from `int` to `bool`. + + (hyphen_inhibitor_node::is_tag): + (node::is_tag): + (space_node::is_tag): + (special_node::is_tag): + (tag_node::is_tag): + (suppress_node::is_tag): + (unbreakable_space_node::is_tag): + (draw_node::is_tag): + (extra_size_node::is_tag): + (hmotion_node::is_tag): + (space_char_hmotion_node::is_tag): + (vmotion_node::is_tag): + (hline_node::is_tag): + (vline_node::is_tag): + (dummy_node::is_tag): + (transparent_dummy_node::is_tag): + (zero_width_node::is_tag): + (italic_corrected_node::is_tag): + (left_italic_corrected_node::is_tag): + (overstrike_node::is_tag): + (bracket_node::is_tag): + (glyph_node::is_tag): + (ligature_node::is_tag): + (kern_pair_node::is_tag): + (dbreak_node::is_tag): + (break_char_node::is_tag): + (line_start_node::is_tag): + (word_space_node::is_tag): + (diverted_space_node::is_tag): + (diverted_copy_file_node::is_tag): + Demote return type from `int` to `bool`. + + (hyphen_inhibitor_node::is_tag): + (node::is_tag): + (space_node::is_tag): + (special_node::is_tag): + (tag_node::is_tag): + (unbreakable_space_node::is_tag): + (draw_node::is_tag): + (vertical_size_node::is_tag): + (hmotion_node::is_tag): + (space_char_hmotion_node::is_tag): + (vmotion_node::is_tag): + (hline_node::is_tag): + (vline_node::is_tag): + (dummy_node::is_same_as): + (dummy_node::is_tag): + (transparent_dummy_node::is_same_as): + (zero_width_node::is_tag): + (italic_corrected_node::is_tag): + (left_italic_corrected_node::is_tag): + (overstrike_node::is_tag): + (bracket_node::is_tag): + (glyph_node::is_tag): + (ligature_node::is_tag): + (kern_pair_node::is_tag): + (dbreak_node::is_tag): + (break_char_node::is_tag): + (line_start_node::is_same_as): + (line_start_node::is_tag): + (word_space_node::is_tag): + (diverted_space_node::is_tag): + (diverted_copy_file_node::is_tag): + (same_node, same_node_list): + Return Boolean instead of integer literal. + + (make_glyph_node, same_node): Make explicit comparisons of + pointer types to null pointer literals. + + * src/roff/troff/node.h (struct node): Demote member variable + `is_special` from `int` to `bool`. Demote pure virtual member + function `is_tag`'s return type from `int` to `bool`. Rename + pure virtual member function from `same` to `is_same_as` and + demote its return type from `int` to `bool`. + (node::node): Use Boolean instead of integer literal in + overloaded `is_special` initializers. + (class line_start_node): + (class space_node): + (class word_space_node): + (class unbreakable_space_node): + (class diverted_space_node): + (class diverted_copy_file_node): + (class extra_size_node): + (class vertical_size_node): + (class hmotion_node): + (class space_char_hmotion_node): + (class vmotion_node): + (class hline_node): + (class vline_node): + (class dummy_node): + (class transparent_dummy_node): + (class zero_width_node): + (class left_italic_corrected_node): + (class overstrike_node): + (class bracket_node): + (class special_node): + (class suppress_node): + (class tag_node): + (class draw_node): + Rename member function `same` to + `is_same_as`. Demote member functions `is_same_as` and `is_tag` + from `int` to `bool`. + + * src/roff/troff/request.h (class macro): Demote friend function + `operator==` from `int` to `bool`. + +Annotate nullptr. Wrap long input lines. Drop annotations of names of +unused single parameters to member functions in definitions. Emacs +file-local variable thing. + +2024-01-04 G. Branden Robinson <g.branden.robinson@gmail.com> + * src/roff/troff/node.cpp (make_glyph_node): Trivially refactor; Boolify local variable. diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index 54037e04f..296d3b5d0 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -1253,13 +1253,13 @@ public: non_interpreted_char_node(unsigned char); node *copy(); int interpret(macro *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; -int non_interpreted_char_node::same(node *nd) +bool non_interpreted_char_node::is_same_as(node *nd) { return c == ((non_interpreted_char_node *)nd)->c; } @@ -1274,9 +1274,9 @@ int non_interpreted_char_node::force_tprint() return 0; } -int non_interpreted_char_node::is_tag() +bool non_interpreted_char_node::is_tag() { - return 0; + return false; } non_interpreted_char_node::non_interpreted_char_node(unsigned char n) : c(n) @@ -1760,10 +1760,10 @@ public: token_node(const token &t); node *copy(); token_node *get_token_node(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; token_node::token_node(const token &t) : tk(t) @@ -1780,7 +1780,7 @@ token_node *token_node::get_token_node() return this; } -int token_node::same(node *nd) +bool token_node::is_same_as(node *nd) { return tk == ((token_node *)nd)->tk; } @@ -1795,9 +1795,9 @@ int token_node::force_tprint() return 0; } -int token_node::is_tag() +bool token_node::is_tag() { - return 0; + return false; } token::token() : nd(0), type(TOKEN_EMPTY) @@ -3890,10 +3890,10 @@ void macro_iterator::shift(int n) // This gets used by, e.g., .if '\?xxx\?''. -int operator==(const macro &m1, const macro &m2) +bool operator==(const macro &m1, const macro &m2) { if (m1.len != m2.len) - return 0; + return false; string_iterator iter1(m1); string_iterator iter2(m2); int n = m1.len; @@ -3909,19 +3909,18 @@ int operator==(const macro &m1, const macro &m2) delete nd1; else if (c2 == 0) delete nd2; - return 0; + return false; } if (c1 == 0) { assert(nd1 != 0); assert(nd2 != 0); - int are_same = nd1->type() == nd2->type() && nd1->same(nd2); + bool same = nd1->type() == nd2->type() && nd1->is_same_as(nd2); delete nd1; delete nd2; - if (!are_same) - return 0; + return same; } } - return 1; + return true; } static void interpolate_macro(symbol nm, bool do_not_want_next_token) @@ -5483,10 +5482,10 @@ public: int interpret(macro *); node *copy(); int ends_sentence(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; non_interpreted_node::non_interpreted_node(const macro &m) : mac(m) @@ -5498,7 +5497,7 @@ int non_interpreted_node::ends_sentence() return 2; } -int non_interpreted_node::same(node *nd) +bool non_interpreted_node::is_same_as(node *nd) { return mac == ((non_interpreted_node *)nd)->mac; } @@ -5513,9 +5512,9 @@ int non_interpreted_node::force_tprint() return 0; } -int non_interpreted_node::is_tag() +bool non_interpreted_node::is_tag() { - return 0; + return false; } node *non_interpreted_node::copy() diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index e645fe2f9..719bb2f3a 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -1894,10 +1894,10 @@ public: void ascii_print(ascii_output_file *); void asciify(macro *); int character_type(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); void debug_node(); }; @@ -1919,10 +1919,10 @@ public: hyphen_list *get_hyphen_list(hyphen_list *, int *); void ascii_print(ascii_output_file *); void asciify(macro *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; class kern_pair_node : public node { @@ -1946,10 +1946,10 @@ public: int ends_sentence(); void ascii_print(ascii_output_file *); void asciify(macro *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); void vertical_extent(vunits *, vunits *); }; @@ -1976,10 +1976,10 @@ public: hyphenation_type get_hyphenation_type(); void ascii_print(ascii_output_file *); void asciify(macro *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; void *ligature_node::operator new(size_t n) @@ -2408,10 +2408,10 @@ class hyphen_inhibitor_node : public node { public: hyphen_inhibitor_node(node * = 0); node *copy(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); hyphenation_type get_hyphenation_type(); }; @@ -2424,9 +2424,9 @@ node *hyphen_inhibitor_node::copy() return new hyphen_inhibitor_node; } -int hyphen_inhibitor_node::same(node *) +bool hyphen_inhibitor_node::is_same_as(node *) { - return 1; + return true; } const char *hyphen_inhibitor_node::type() @@ -2439,9 +2439,9 @@ int hyphen_inhibitor_node::force_tprint() return 0; } -int hyphen_inhibitor_node::is_tag() +bool hyphen_inhibitor_node::is_tag() { - return 0; + return false; } hyphenation_type hyphen_inhibitor_node::get_hyphenation_type() @@ -2518,9 +2518,9 @@ int node::force_tprint() return 0; } -int node::is_tag() +bool node::is_tag() { - return 0; + return false; } int node::get_break_code() @@ -2617,7 +2617,7 @@ public: int ends_sentence(); int overlaps_horizontally(); int overlaps_vertically(); - int same(node *); + bool is_same_as(node *); hyphenation_type get_hyphenation_type(); tfont *get_tfont(); hyphen_list *get_hyphen_list(hyphen_list *, int *); @@ -2628,7 +2628,7 @@ public: node *add_self(node *, hyphen_list **); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; node *node::add_italic_correction(hunits *wd) @@ -2769,10 +2769,10 @@ public: int overlaps_horizontally(); units size(); tfont *get_tfont(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); int get_break_code(); }; @@ -3206,9 +3206,9 @@ int space_node::force_tprint() return 0; } -int space_node::is_tag() +bool space_node::is_tag() { - return 0; + return false; } int space_node::nspaces() @@ -3865,7 +3865,7 @@ special_node::special_node(const macro &m, tfont *t, is_special = 1; } -int special_node::same(node *n) +bool special_node::is_same_as(node *n) { return mac == ((special_node *)n)->mac && tf == ((special_node *)n)->tf @@ -3889,9 +3889,9 @@ int special_node::force_tprint() return 0; } -int special_node::is_tag() +bool special_node::is_tag() { - return 0; + return false; } node *special_node::copy() @@ -3942,7 +3942,7 @@ suppress_node::suppress_node(int issue_limits, int on_or_off, { } -int suppress_node::same(node *n) +bool suppress_node::is_same_as(node *n) { return ((is_on == ((suppress_node *)n)->is_on) && (emit_limits == ((suppress_node *)n)->emit_limits) @@ -3995,7 +3995,7 @@ void tag_node::tprint(troff_output_file *out) out->state.add_tag(out->fp, tag_string); } -int tag_node::same(node *nd) +bool tag_node::is_same_as(node *nd) { return tag_string == ((tag_node *)nd)->tag_string && delayed == ((tag_node *)nd)->delayed; @@ -4011,7 +4011,7 @@ int tag_node::force_tprint() return !delayed; } -int tag_node::is_tag() +bool tag_node::is_tag() { return !delayed; } @@ -4210,7 +4210,7 @@ int suppress_node::force_tprint() return is_on; } -int suppress_node::is_tag() +bool suppress_node::is_tag() { return is_on; } @@ -4226,7 +4226,8 @@ class composite_node : public charinfo_node { node *n; tfont *tf; public: - composite_node(node *, charinfo *, tfont *, statem *, int, node * = 0); + composite_node(node *, charinfo *, tfont *, statem *, int, + node * = 0 /* nullptr */); ~composite_node(); node *copy(); hunits width(); @@ -4239,10 +4240,10 @@ public: hyphen_list *get_hyphen_list(hyphen_list *, int *); node *add_self(node *, hyphen_list **); tfont *get_tfont(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); void vertical_extent(vunits *, vunits *); vunits vertical_width(); }; @@ -4460,9 +4461,9 @@ int unbreakable_space_node::force_tprint() return 0; } -int unbreakable_space_node::is_tag() +bool unbreakable_space_node::is_tag() { - return 0; + return false; } breakpoint *unbreakable_space_node::get_breakpoints(hunits, int, @@ -4508,7 +4509,7 @@ draw_node::draw_node(char c, hvpair *p, int np, font_size s, point[i] = p[i]; } -int draw_node::same(node *n) +bool draw_node::is_same_as(node *n) { draw_node *nd = (draw_node *)n; if (code != nd->code || npoints != nd->npoints || sz != nd->sz @@ -4530,9 +4531,9 @@ int draw_node::force_tprint() return 0; } -int draw_node::is_tag() +bool draw_node::is_tag() { - return 0; + return false; } draw_node::~draw_node() @@ -4914,7 +4915,7 @@ static node *make_glyph_node(charinfo *s, environment *env, bool found = font_table[fontno]->contains(s); if (!found) { macro *mac = s->get_macro(); - if (mac && s->is_fallback()) + if ((mac != 0 /* nullptr */) && s->is_fallback()) return make_composite_node(s, env); if (s->numbered()) { if (want_warnings) @@ -4923,7 +4924,7 @@ static node *make_glyph_node(charinfo *s, environment *env, return 0 /* nullptr */; } special_font_list *sf = font_table[fontno]->sf; - while (sf != 0 && !found) { + while ((sf != 0 /* nullptr */) && !found) { fn = sf->n; if (font_table[fn]) found = font_table[fn]->contains(s); @@ -4941,7 +4942,7 @@ static node *make_glyph_node(charinfo *s, environment *env, } if (!found) { sf = global_special_fonts; - while (sf != 0 && !found) { + while ((sf != 0 /* nullptr */) && !found) { fn = sf->n; if (font_table[fn]) found = font_table[fn]->contains(s); @@ -5121,11 +5122,11 @@ inline #endif int same_node(node *n1, node *n2) { - if (n1 != 0) { - if (n2 != 0) - return n1->type() == n2->type() && n1->same(n2); + if (n1 != 0 /* nullptr */) { + if (n2 != 0 /* nullptr */) + return n1->type() == n2->type() && n1->is_same_as(n2); else - return 0; + return false; } else return n2 == 0; @@ -5133,8 +5134,8 @@ int same_node(node *n1, node *n2) int same_node_list(node *n1, node *n2) { - while (n1 && n2) { - if (n1->type() != n2->type() || !n1->same(n2)) + while ((n1 != 0 /* nullptr */) && (n2 != 0 /* nullptr */)) { + if (n1->type() != n2->type() || !n1->is_same_as(n2)) return 0; n1 = n1->next; n2 = n2->next; @@ -5142,7 +5143,7 @@ int same_node_list(node *n1, node *n2) return !n1 && !n2; } -int extra_size_node::same(node *nd) +bool extra_size_node::is_same_as(node *nd) { return n == ((extra_size_node *)nd)->n; } @@ -5157,12 +5158,12 @@ int extra_size_node::force_tprint() return 0; } -int extra_size_node::is_tag() +bool extra_size_node::is_tag() { - return 0; + return false; } -int vertical_size_node::same(node *nd) +bool vertical_size_node::is_same_as(node *nd) { return n == ((vertical_size_node *)nd)->n; } @@ -5182,12 +5183,12 @@ int vertical_size_node::force_tprint() return 0; } -int vertical_size_node::is_tag() +bool vertical_size_node::is_tag() { - return 0; + return false; } -int hmotion_node::same(node *nd) +bool hmotion_node::is_same_as(node *nd) { return n == ((hmotion_node *)nd)->n && col == ((hmotion_node *)nd)->col; @@ -5209,9 +5210,9 @@ int hmotion_node::force_tprint() return 0; } -int hmotion_node::is_tag() +bool hmotion_node::is_tag() { - return 0; + return false; } node *hmotion_node::add_self(node *nd, hyphen_list **p) @@ -5228,7 +5229,7 @@ hyphen_list *hmotion_node::get_hyphen_list(hyphen_list *tail, int *) return new hyphen_list(0, tail); } -int space_char_hmotion_node::same(node *nd) +bool space_char_hmotion_node::is_same_as(node *nd) { return n == ((space_char_hmotion_node *)nd)->n && col == ((space_char_hmotion_node *)nd)->col; @@ -5244,9 +5245,9 @@ int space_char_hmotion_node::force_tprint() return 0; } -int space_char_hmotion_node::is_tag() +bool space_char_hmotion_node::is_tag() { - return 0; + return false; } node *space_char_hmotion_node::add_self(node *nd, hyphen_list **p) @@ -5264,7 +5265,7 @@ hyphen_list *space_char_hmotion_node::get_hyphen_list(hyphen_list *tail, return new hyphen_list(0, tail); } -int vmotion_node::same(node *nd) +bool vmotion_node::is_same_as(node *nd) { return n == ((vmotion_node *)nd)->n && col == ((vmotion_node *)nd)->col; @@ -5280,14 +5281,15 @@ int vmotion_node::force_tprint() return 0; } -int vmotion_node::is_tag() +bool vmotion_node::is_tag() { - return 0; + return false; } -int hline_node::same(node *nd) +bool hline_node::is_same_as(node *nd) { - return x == ((hline_node *)nd)->x && same_node(n, ((hline_node *)nd)->n); + return x == ((hline_node *)nd)->x + && same_node(n, ((hline_node *)nd)->n); } const char *hline_node::type() @@ -5300,14 +5302,15 @@ int hline_node::force_tprint() return 0; } -int hline_node::is_tag() +bool hline_node::is_tag() { - return 0; + return false; } -int vline_node::same(node *nd) +bool vline_node::is_same_as(node *nd) { - return x == ((vline_node *)nd)->x && same_node(n, ((vline_node *)nd)->n); + return x == ((vline_node *)nd)->x + && same_node(n, ((vline_node *)nd)->n); } const char *vline_node::type() @@ -5320,14 +5323,14 @@ int vline_node::force_tprint() return 0; } -int vline_node::is_tag() +bool vline_node::is_tag() { - return 0; + return false; } -int dummy_node::same(node * /*nd*/) +bool dummy_node::is_same_as(node *) { - return 1; + return true; } const char *dummy_node::type() @@ -5340,14 +5343,14 @@ int dummy_node::force_tprint() return 0; } -int dummy_node::is_tag() +bool dummy_node::is_tag() { - return 0; + return false; } -int transparent_dummy_node::same(node * /*nd*/) +bool transparent_dummy_node::is_same_as(node *) { - return 1; + return true; } const char *transparent_dummy_node::type() @@ -5360,9 +5363,9 @@ int transparent_dummy_node::force_tprint() return 0; } -int transparent_dummy_node::is_tag() +bool transparent_dummy_node::is_tag() { - return 0; + return false; } int transparent_dummy_node::ends_sentence() @@ -5370,7 +5373,7 @@ int transparent_dummy_node::ends_sentence() return 2; } -int zero_width_node::same(node *nd) +bool zero_width_node::is_same_as(node *nd) { return same_node_list(n, ((zero_width_node *)nd)->n); } @@ -5385,12 +5388,12 @@ int zero_width_node::force_tprint() return 0; } -int zero_width_node::is_tag() +bool zero_width_node::is_tag() { - return 0; + return false; } -int italic_corrected_node::same(node *nd) +bool italic_corrected_node::is_same_as(node *nd) { return (x == ((italic_corrected_node *)nd)->x && same_node(n, ((italic_corrected_node *)nd)->n)); @@ -5406,9 +5409,9 @@ int italic_corrected_node::force_tprint() return 0; } -int italic_corrected_node::is_tag() +bool italic_corrected_node::is_tag() { - return 0; + return false; } left_italic_corrected_node::left_italic_corrected_node(node *xx) @@ -5477,12 +5480,12 @@ int left_italic_corrected_node::force_tprint() return 0; } -int left_italic_corrected_node::is_tag() +bool left_italic_corrected_node::is_tag() { - return 0; + return false; } -int left_italic_corrected_node::same(node *nd) +bool left_italic_corrected_node::is_same_as(node *nd) { return (x == ((left_italic_corrected_node *)nd)->x && same_node(n, ((left_italic_corrected_node *)nd)->n)); @@ -5582,7 +5585,7 @@ int left_italic_corrected_node::character_type() return n ? n->character_type() : 0; } -int overstrike_node::same(node *nd) +bool overstrike_node::is_same_as(node *nd) { return same_node_list(list, ((overstrike_node *)nd)->list); } @@ -5597,9 +5600,9 @@ int overstrike_node::force_tprint() return 0; } -int overstrike_node::is_tag() +bool overstrike_node::is_tag() { - return 0; + return false; } node *overstrike_node::add_self(node *n, hyphen_list **p) @@ -5616,7 +5619,7 @@ hyphen_list *overstrike_node::get_hyphen_list(hyphen_list *tail, int *) return new hyphen_list(0, tail); } -int bracket_node::same(node *nd) +bool bracket_node::is_same_as(node *nd) { return same_node_list(list, ((bracket_node *)nd)->list); } @@ -5631,12 +5634,12 @@ int bracket_node::force_tprint() return 0; } -int bracket_node::is_tag() +bool bracket_node::is_tag() { - return 0; + return false; } -int composite_node::same(node *nd) +bool composite_node::is_same_as(node *nd) { return ci == ((composite_node *)nd)->ci && same_node_list(n, ((composite_node *)nd)->n); @@ -5652,12 +5655,12 @@ int composite_node::force_tprint() return 0; } -int composite_node::is_tag() +bool composite_node::is_tag() { - return 0; + return false; } -int glyph_node::same(node *nd) +bool glyph_node::is_same_as(node *nd) { return ci == ((glyph_node *)nd)->ci && tf == ((glyph_node *)nd)->tf @@ -5675,16 +5678,16 @@ int glyph_node::force_tprint() return 0; } -int glyph_node::is_tag() +bool glyph_node::is_tag() { - return 0; + return false; } -int ligature_node::same(node *nd) +bool ligature_node::is_same_as(node *nd) { return (same_node(n1, ((ligature_node *)nd)->n1) && same_node(n2, ((ligature_node *)nd)->n2) - && glyph_node::same(nd)); + && glyph_node::is_same_as(nd)); } const char *ligature_node::type() @@ -5697,12 +5700,12 @@ int ligature_node::force_tprint() return 0; } -int ligature_node::is_tag() +bool ligature_node::is_tag() { - return 0; + return false; } -int kern_pair_node::same(node *nd) +bool kern_pair_node::is_same_as(node *nd) { return (amount == ((kern_pair_node *)nd)->amount && same_node(n1, ((kern_pair_node *)nd)->n1) @@ -5719,12 +5722,12 @@ int kern_pair_node::force_tprint() return 0; } -int kern_pair_node::is_tag() +bool kern_pair_node::is_tag() { - return 0; + return false; } -int dbreak_node::same(node *nd) +bool dbreak_node::is_same_as(node *nd) { return (same_node_list(none, ((dbreak_node *)nd)->none) && same_node_list(pre, ((dbreak_node *)nd)->pre) @@ -5741,12 +5744,12 @@ int dbreak_node::force_tprint() return 0; } -int dbreak_node::is_tag() +bool dbreak_node::is_tag() { - return 0; + return false; } -int break_char_node::same(node *nd) +bool break_char_node::is_same_as(node *nd) { return break_code == ((break_char_node *)nd)->break_code && col == ((break_char_node *)nd)->col @@ -5763,9 +5766,9 @@ int break_char_node::force_tprint() return 0; } -int break_char_node::is_tag() +bool break_char_node::is_tag() { - return 0; + return false; } int break_char_node::get_break_code() @@ -5773,9 +5776,9 @@ int break_char_node::get_break_code() return break_code; } -int line_start_node::same(node * /*nd*/) +bool line_start_node::is_same_as(node *) { - return 1; + return true; } const char *line_start_node::type() @@ -5788,12 +5791,12 @@ int line_start_node::force_tprint() return 0; } -int line_start_node::is_tag() +bool line_start_node::is_tag() { - return 0; + return false; } -int space_node::same(node *nd) +bool space_node::is_same_as(node *nd) { return n == ((space_node *)nd)->n && set == ((space_node *)nd)->set @@ -5805,7 +5808,7 @@ const char *space_node::type() return "space_node"; } -int word_space_node::same(node *nd) +bool word_space_node::is_same_as(node *nd) { return n == ((word_space_node *)nd)->n && set == ((word_space_node *)nd)->set @@ -5822,9 +5825,9 @@ int word_space_node::force_tprint() return 0; } -int word_space_node::is_tag() +bool word_space_node::is_tag() { - return 0; + return false; } void unbreakable_space_node::tprint(troff_output_file *out) @@ -5842,7 +5845,7 @@ void unbreakable_space_node::tprint(troff_output_file *out) out->right(n); } -int unbreakable_space_node::same(node *nd) +bool unbreakable_space_node::is_same_as(node *nd) { return n == ((unbreakable_space_node *)nd)->n && set == ((unbreakable_space_node *)nd)->set @@ -5868,7 +5871,7 @@ hyphen_list *unbreakable_space_node::get_hyphen_list(hyphen_list *tail, int *) return new hyphen_list(0, tail); } -int diverted_space_node::same(node *nd) +bool diverted_space_node::is_same_as(node *nd) { return n == ((diverted_space_node *)nd)->n; } @@ -5883,12 +5886,12 @@ int diverted_space_node::force_tprint() return 0; } -int diverted_space_node::is_tag() +bool diverted_space_node::is_tag() { - return 0; + return false; } -int diverted_copy_file_node::same(node *nd) +bool diverted_copy_file_node::is_same_as(node *nd) { return filename == ((diverted_copy_file_node *)nd)->filename; } @@ -5903,9 +5906,9 @@ int diverted_copy_file_node::force_tprint() return 0; } -int diverted_copy_file_node::is_tag() +bool diverted_copy_file_node::is_tag() { - return 0; + return false; } // Grow the font_table so that its size is > n. diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h index 6be250da5..b7610f8b7 100644 --- a/src/roff/troff/node.h +++ b/src/roff/troff/node.h @@ -1,4 +1,3 @@ -// -*- C++ -*- /* Copyright (C) 1989-2020 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -27,7 +26,11 @@ struct hyphen_list { void hyphenate(hyphen_list *, unsigned); -enum hyphenation_type { HYPHEN_MIDDLE, HYPHEN_BOUNDARY, HYPHEN_INHIBIT }; +enum hyphenation_type { + HYPHEN_MIDDLE, + HYPHEN_BOUNDARY, + HYPHEN_INHIBIT +}; class ascii_output_file; @@ -51,17 +54,18 @@ struct node { statem *state; statem *push_state; int div_nest_level; - int is_special; + bool is_special; node(); node(node *); node(node *, statem *, int); - node *add_char(charinfo *, environment *, hunits *, int *, node ** = 0); + node *add_char(charinfo *, environment *, hunits *, int *, + node ** = 0 /* nullptr */); virtual ~node(); virtual node *copy() = 0; virtual int set_unformat_flag(); virtual int force_tprint() = 0; - virtual int is_tag() = 0; + virtual bool is_tag() = 0; virtual int get_break_code(); virtual hunits width(); virtual hunits subscript_correction(); @@ -86,7 +90,9 @@ struct node { virtual void spread_space(int *, hunits *); virtual void freeze_space(); virtual void is_escape_colon(); - virtual breakpoint *get_breakpoints(hunits, int, breakpoint * = 0, int = 0); + virtual breakpoint *get_breakpoints(hunits, int, + breakpoint * = 0 /* nullptr */, + int = 0); virtual int nbreaks(); virtual void split(int, node **, node **); virtual hyphenation_type get_hyphenation_type(); @@ -106,24 +112,27 @@ struct node { node *add_italic_correction(hunits *); - virtual int same(node *) = 0; + virtual bool is_same_as(node *) = 0; virtual const char *type() = 0; virtual void debug_node(); virtual void debug_node_list(); }; inline node::node() -: next(0), last(0), state(0), push_state(0), div_nest_level(0), is_special(0) +: next(0), last(0), state(0), push_state(0), div_nest_level(0), + is_special(false) { } inline node::node(node *n) -: next(n), last(0), state(0), push_state(0), div_nest_level(0), is_special(0) +: next(n), last(0), state(0), push_state(0), div_nest_level(0), + is_special(false) { } inline node::node(node *n, statem *s, int divlevel) -: next(n), last(0), push_state(0), div_nest_level(divlevel), is_special(0) +: next(n), last(0), push_state(0), div_nest_level(divlevel), + is_special(false) { if (s) state = new statem(s); @@ -156,9 +165,9 @@ class line_start_node : public node { public: line_start_node() {} node *copy() { return new line_start_node; } - int same(node *); + bool is_same_as(node *); int force_tprint(); - int is_tag(); + bool is_tag(); const char *type(); void asciify(macro *); }; @@ -170,9 +179,10 @@ protected: char set; char was_escape_colon; color *col; /* for grotty */ - space_node(hunits, int, int, color *, statem *, int, node * = 0); + space_node(hunits, int, int, color *, statem *, int, + node * = 0 /* nullptr */); public: - space_node(hunits, color *, node * = 0); + space_node(hunits, color *, node * = 0 /* nullptr */); node *copy(); int nspaces(); hunits width(); @@ -182,15 +192,17 @@ public: void is_escape_colon(); void spread_space(int *, hunits *); void tprint(troff_output_file *); - breakpoint *get_breakpoints(hunits, int, breakpoint * = 0, int = 0); + breakpoint *get_breakpoints(hunits, int, + breakpoint * = 0 /* nullptr */, + int = 0); int nbreaks(); void split(int, node **, node **); void ascii_print(ascii_output_file *); - int same(node *); + bool is_same_as(node *); void asciify(macro *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); hyphenation_type get_hyphenation_type(); }; @@ -206,36 +218,40 @@ class word_space_node : public space_node { protected: width_list *orig_width; unsigned char unformat; - word_space_node(hunits, int, color *, width_list *, int, statem *, int, - node * = 0); + word_space_node(hunits, int, color *, width_list *, int, statem *, + int, node * = 0 /* nullptr */); public: - word_space_node(hunits, color *, width_list *, node * = 0); + word_space_node(hunits, color *, width_list *, + node * = 0 /* nullptr */); ~word_space_node(); node *copy(); int reread(int *); int set_unformat_flag(); void tprint(troff_output_file *); - int same(node *); + bool is_same_as(node *); void asciify(macro *); const char *type(); int merge_space(hunits, hunits, hunits); int force_tprint(); - int is_tag(); + bool is_tag(); }; class unbreakable_space_node : public word_space_node { - unbreakable_space_node(hunits, int, color *, statem *, int, node * = 0); + unbreakable_space_node(hunits, int, color *, statem *, int, + node * = 0 /* nullptr */); public: - unbreakable_space_node(hunits, color *, node * = 0); + unbreakable_space_node(hunits, color *, node * = 0 /* nullptr */); node *copy(); int reread(int *); void tprint(troff_output_file *); - int same(node *); + bool is_same_as(node *); void asciify(macro *); const char *type(); int force_tprint(); - int is_tag(); - breakpoint *get_breakpoints(hunits, int, breakpoint * = 0, int = 0); + bool is_tag(); + breakpoint *get_breakpoints(hunits, int, + breakpoint * = 0 /* nullptr */, + int = 0); int nbreaks(); void split(int, node **, node **); int merge_space(hunits, hunits, hunits); @@ -247,28 +263,29 @@ public: class diverted_space_node : public node { public: vunits n; - diverted_space_node(vunits, node * = 0); - diverted_space_node(vunits, statem *, int, node * = 0); + diverted_space_node(vunits, node * = 0 /* nullptr */); + diverted_space_node(vunits, statem *, int, node * = 0 /* nullptr */); node *copy(); int reread(int *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; class diverted_copy_file_node : public node { symbol filename; public: vunits n; - diverted_copy_file_node(symbol, node * = 0); - diverted_copy_file_node(symbol, statem *, int, node * = 0); + diverted_copy_file_node(symbol, node * = 0 /* nullptr */); + diverted_copy_file_node(symbol, statem *, int, + node * = 0 /* nullptr */); node *copy(); int reread(int *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; class extra_size_node : public node { @@ -278,10 +295,10 @@ public: extra_size_node(vunits, statem *, int); void set_vertical_size(vertical_size *); node *copy(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; class vertical_size_node : public node { @@ -293,10 +310,10 @@ public: void asciify(macro *); node *copy(); int set_unformat_flag(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; class hmotion_node : public node { @@ -308,13 +325,15 @@ 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 *nxt = 0) + hmotion_node(hunits i, color *c, statem *s, int divlevel, + node *nxt = 0 /* nullptr */) : node(nxt, 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 *nxt = 0) + int divlevel, node *nxt = 0 /* nullptr */) : node(nxt, s, divlevel), n(i), was_tab(flag1), unformat(flag2), col(c) {} - hmotion_node(hunits i, int flag1, int flag2, color *c, node *nxt = 0) + hmotion_node(hunits i, int flag1, int flag2, color *c, + node *nxt = 0 /* nullptr */) : node(nxt), n(i), was_tab(flag1), unformat(flag2), col(c) {} node *copy(); int reread(int *); @@ -323,10 +342,10 @@ public: void tprint(troff_output_file *); hunits width(); void ascii_print(ascii_output_file *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); node *add_self(node *, hyphen_list **); hyphen_list *get_hyphen_list(hyphen_list *, int *); hyphenation_type get_hyphenation_type(); @@ -334,16 +353,17 @@ 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); + space_char_hmotion_node(hunits, color *, node * = 0 /* nullptr */); + space_char_hmotion_node(hunits, color *, statem *, int, + node * = 0 /* nullptr */); node *copy(); void ascii_print(ascii_output_file *); void asciify(macro *); void tprint(troff_output_file *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); node *add_self(node *, hyphen_list **); hyphen_list *get_hyphen_list(hyphen_list *, int *); hyphenation_type get_hyphenation_type(); @@ -358,54 +378,54 @@ public: void tprint(troff_output_file *); node *copy(); vunits vertical_width(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; class hline_node : public node { hunits x; node *n; public: - hline_node(hunits, node *, node * = 0); - hline_node(hunits, node *, statem *, int, node * = 0); + hline_node(hunits, node *, node * = 0 /* nullptr */); + hline_node(hunits, node *, statem *, int, node * = 0 /* nullptr */); ~hline_node(); node *copy(); hunits width(); void tprint(troff_output_file *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; class vline_node : public node { vunits x; node *n; public: - vline_node(vunits, node *, node * = 0); - vline_node(vunits, node *, statem *, int, node * = 0); + vline_node(vunits, node *, node * = 0 /* nullptr */); + vline_node(vunits, node *, statem *, int, node * = 0 /* nullptr */); ~vline_node(); node *copy(); void tprint(troff_output_file *); hunits width(); vunits vertical_width(); void vertical_extent(vunits *, vunits *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; class dummy_node : public node { public: dummy_node(node *nd = 0) : node(nd) {} node *copy(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); hyphenation_type get_hyphenation_type(); }; @@ -413,10 +433,10 @@ class transparent_dummy_node : public node { public: transparent_dummy_node(node *nd = 0) : node(nd) {} node *copy(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); int ends_sentence(); hyphenation_type get_hyphenation_type(); }; @@ -429,10 +449,10 @@ public: ~zero_width_node(); node *copy(); void tprint(troff_output_file *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); void append(node *); int character_type(); void vertical_extent(vunits *, vunits *); @@ -442,17 +462,17 @@ class left_italic_corrected_node : public node { node *n; hunits x; public: - left_italic_corrected_node(node * = 0); - left_italic_corrected_node(statem *, int, node * = 0); + left_italic_corrected_node(node * = 0 /* nullptr */); + left_italic_corrected_node(statem *, int, node * = 0 /* nullptr */); ~left_italic_corrected_node(); void tprint(troff_output_file *); void ascii_print(ascii_output_file *); void asciify(macro *); node *copy(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); hunits width(); node *last_char_node(); void vertical_extent(vunits *, vunits *); @@ -481,10 +501,10 @@ public: void tprint(troff_output_file *); void overstrike(node *); // add another node to be overstruck hunits width(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); node *add_self(node *, hyphen_list **); hyphen_list *get_hyphen_list(hyphen_list *, int *); hyphenation_type get_hyphenation_type(); @@ -501,10 +521,10 @@ public: void tprint(troff_output_file *); void bracket(node *); // add another node to be overstruck hunits width(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; class special_node : public node { @@ -522,17 +542,17 @@ public: int = 0); node *copy(); void tprint(troff_output_file *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); int ends_sentence(); tfont *get_tfont(); }; class suppress_node : public node { int is_on; - int emit_limits; // must we issue the extent of the area written out? + int emit_limits; // must we issue extent of the area written out? symbol filename; char position; int image_id; @@ -544,10 +564,10 @@ public: node *copy(); void tprint(troff_output_file *); hunits width(); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); private: void put(troff_output_file *, const char *); }; @@ -555,17 +575,17 @@ private: class tag_node : public node { public: string tag_string; - int delayed; + bool delayed; tag_node(); tag_node(string, int); tag_node(string, statem *, int, int); node *copy(); void tprint(troff_output_file *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); - int ends_sentence(); + bool is_tag(); + int ends_sentence(); // tri-state }; struct hvpair { @@ -583,16 +603,17 @@ 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(char, hvpair *, int, font_size, color *, color *, statem *, + int); ~draw_node(); hunits width(); vunits vertical_width(); node *copy(); void tprint(troff_output_file *); - int same(node *); + bool is_same_as(node *); const char *type(); int force_tprint(); - int is_tag(); + bool is_tag(); }; class charinfo; @@ -632,7 +653,8 @@ public: virtual void flush() = 0; virtual void transparent_char(unsigned char) = 0; virtual void print_line(hunits x, vunits y, node *n, - vunits before, vunits after, hunits width) = 0; + vunits before, vunits after, + hunits width) = 0; virtual void begin_page(int pageno, vunits page_length) = 0; virtual void copy_file(hunits x, vunits y, const char *filename) = 0; virtual int is_printing() = 0; @@ -666,3 +688,9 @@ font_family *lookup_family(symbol); symbol get_font_name(int, environment *); symbol get_style_name(int); extern search_path include_search_path; + +// Local Variables: +// fill-column: 72 +// mode: C++ +// End: +// vim: set cindent noexpandtab shiftwidth=2 textwidth=72: diff --git a/src/roff/troff/request.h b/src/roff/troff/request.h index 0991e4912..1511f5230 100644 --- a/src/roff/troff/request.h +++ b/src/roff/troff/request.h @@ -73,7 +73,7 @@ public: friend class string_iterator; friend void chop_macro(); friend void substring_request(); - friend int operator==(const macro &, const macro &); + friend bool operator==(const macro &, const macro &); }; extern void init_input_requests(); |