gbranden pushed a commit to branch master in repository groff. commit ad0705ba562175b00cfcd621f923e52df036aab8 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Sat Apr 27 03:20:46 2024 -0500
[troff]: Slightly refactor `do_underline`. [troff]: Demote parameter of global `do_underline` function from `int` to `bool`. * src/roff/troff/env.h: Do it. * src/roff/troff/env.cpp (do_underline): Do it. Rename paramter from `underline_spaces` to `want_spaces_underlined`. * src/roff/troff/env.h (class environment): Update friend access. * src/roff/troff/env.cpp (continuous_underline, underline): Call it with Boolean, not integer, literals. --- ChangeLog | 15 +++++++++++++++ src/roff/troff/env.cpp | 10 +++++----- src/roff/troff/env.h | 4 ++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 115be45de..7fab0c369 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2024-04-27 G. Branden Robinson <g.branden.robin...@gmail.com> + + [troff]: Demote parameter of global `do_underline` function from + `int` to `bool`. + + * src/roff/troff/env.h: Do it. + * src/roff/troff/env.cpp (do_underline): Do it. Rename paramter + from `underline_spaces` to `want_spaces_underlined`. + + * src/roff/troff/env.h (class environment): Update friend + access. + + * src/roff/troff/env.cpp (continuous_underline, underline): Call + it with Boolean, not integer, literals. + 2024-04-27 G. Branden Robinson <g.branden.robin...@gmail.com> [troff]: Boolify `suppress_push` global variable, and declare it diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp index c2e018708..b4fb2c480 100644 --- a/src/roff/troff/env.cpp +++ b/src/roff/troff/env.cpp @@ -1579,7 +1579,7 @@ void temporary_indent() tok.next(); } -void do_underline(int underline_spaces) +void do_underline(bool want_spaces_underlined) { int n; if (!has_arg() || !get_integer(&n)) @@ -1588,7 +1588,7 @@ void do_underline(int underline_spaces) if (curenv->underline_lines > 0) { curenv->prev_fontno = curenv->fontno; curenv->fontno = curenv->pre_underline_fontno; - if (underline_spaces) { + if (want_spaces_underlined) { curenv->underline_spaces = false; curenv->add_node(do_underline_special(false)); } @@ -1599,7 +1599,7 @@ void do_underline(int underline_spaces) curenv->underline_lines = n; curenv->pre_underline_fontno = curenv->fontno; curenv->fontno = get_underline_fontno(); - if (underline_spaces) { + if (want_spaces_underlined) { curenv->underline_spaces = true; curenv->add_node(do_underline_special(true)); } @@ -1609,12 +1609,12 @@ void do_underline(int underline_spaces) void continuous_underline() { - do_underline(1); + do_underline(true /* want spaces underlined */); } void underline() { - do_underline(0); + do_underline(false /* want spaces underlined */); } void margin_character() diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h index 928734249..319348de4 100644 --- a/src/roff/troff/env.h +++ b/src/roff/troff/env.h @@ -115,7 +115,7 @@ void line_spacing(); void line_length(); void indent(); void temporary_indent(); -void do_underline(int); +void do_underline(bool); void do_input_trap(bool); void set_tabs(); void margin_character(); @@ -385,7 +385,7 @@ public: friend void line_length(); friend void indent(); friend void temporary_indent(); - friend void do_underline(int); + friend void do_underline(bool); friend void do_input_trap(bool); friend void set_tabs(); friend void margin_character(); _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit