* src/roff/troff/input.cpp: Trivially refactor. Rename functions to use more idiomatic computer science terminology.
(begin_alternative): Rename this... (take_branch): ...to this. (skip_alternative): Rename this... (skip_branch): ...to this. (do_if_request, else_request): Update call sites. --- ChangeLog | 10 ++++++++++ src/roff/troff/input.cpp | 26 +++++++++++++------------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71688c2e9..62d54b5c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2024-04-05 G. Branden Robinson <g.branden.robin...@gmail.com> + + * src/roff/troff/input.cpp: Trivially refactor. Rename + functions to use more idiomatic computer science terminology. + (begin_alternative): Rename this... + (take_branch): ...to this. + (skip_alternative): Rename this... + (skip_branch): ...to this. + (do_if_request, else_request): Update call sites. + 2024-04-04 G. Branden Robinson <g.branden.robin...@gmail.com> * src/roff/troff/input.cpp: Refactor. Replace bespoke class diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index 2d5dc4980..cac51d1a6 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -5878,7 +5878,7 @@ static void troff_request() skip_line(); } -static void skip_alternative() +static void skip_branch() { int level = 0; // ensure that ".if 0\{" works as expected @@ -5920,7 +5920,7 @@ static void skip_alternative() tok.next(); } -static void begin_alternative() +static void take_branch() { while (tok.is_space() || tok.is_left_brace()) tok.next(); @@ -5984,7 +5984,7 @@ static bool do_if_request() tok.next(); symbol nm = get_name(true /* required */); if (nm.is_null()) { - skip_alternative(); + skip_branch(); return 0; } result = (c == 'd' @@ -5995,7 +5995,7 @@ static bool do_if_request() tok.next(); symbol nm = get_long_name(true /* required */); if (nm.is_null()) { - skip_alternative(); + skip_branch(); return 0; } result = (nm == default_symbol @@ -6006,7 +6006,7 @@ static bool do_if_request() tok.skip(); charinfo *ci = tok.get_char(true /* required */); if (ci == 0) { - skip_alternative(); + skip_branch(); return 0; } result = character_exists(ci, curenv); @@ -6016,7 +6016,7 @@ static bool do_if_request() tok.next(); symbol nm = get_long_name(true /* required */); if (nm.is_null()) { - skip_alternative(); + skip_branch(); return 0; } result = is_font_name(curenv->get_family()->nm, nm); @@ -6025,7 +6025,7 @@ static bool do_if_request() tok.next(); symbol nm = get_long_name(true /* required */); if (nm.is_null()) { - skip_alternative(); + skip_branch(); return 0; } result = is_abstract_style(nm); @@ -6070,7 +6070,7 @@ static bool do_if_request() else { units n; if (!get_number(&n, 'u')) { - skip_alternative(); + skip_branch(); return 0; } else @@ -6079,9 +6079,9 @@ static bool do_if_request() if (want_test_sense_inverted) result = !result; if (result) - begin_alternative(); + take_branch(); else - skip_alternative(); + skip_branch(); return result; } @@ -6109,15 +6109,15 @@ static void else_request() { if (if_else_stack.empty()) { warning(WARN_EL, "unbalanced 'el' request"); - skip_alternative(); + skip_branch(); } else { bool predicate = if_else_stack.top(); if_else_stack.pop(); if (predicate) - skip_alternative(); + skip_branch(); else - begin_alternative(); + take_branch(); } } -- 2.30.2
signature.asc
Description: PGP signature