gbranden pushed a commit to branch master in repository groff. commit bc834eca0fcc0e4c0b27b0eeeb94d9a85a5af40a Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Tue Feb 4 04:53:47 2025 -0600
[troff]: Refactor. * src/roff/troff/input.cpp: Refactor. (define_character): Break out character mode description logic from here... (character_mode_description): ...into this new function, since a forthcoming change will also require it. --- ChangeLog | 8 ++++++++ src/roff/troff/input.cpp | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1116e1a3..20936512b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-02-04 G. Branden Robinson <g.branden.robin...@gmail.com> + + * src/roff/troff/input.cpp: Refactor. + (define_character): Break out character mode description logic + from here... + (character_mode_description): ...into this new function, since a + forthcoming change will also require it. + 2025-02-02 G. Branden Robinson <g.branden.robin...@gmail.com> * src/roff/troff/input.cpp (token::description): When describing diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index d0a3e916f..32b158ffb 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -4569,10 +4569,10 @@ void append_nocomp_string() do_define_string(DEFINE_APPEND, COMP_DISABLE); } -void define_character(char_mode mode, const char *font_name) +static const char *character_mode_description(char_mode mode) { // C++11: There may be a better way to do this with an enum class; - // we could then store these constants inside `char_mode`. + // we could then store these string literals inside `char_mode`. const char *modestr = 0 /* nullptr */; switch (mode) { case CHAR_NORMAL: @@ -4591,6 +4591,12 @@ void define_character(char_mode mode, const char *font_name) assert(0 == "unhandled case of character mode"); break; } + return modestr; +} + +void define_character(char_mode mode, const char *font_name) +{ + const char *modestr = character_mode_description(mode); node *n = 0 /* nullptr */; int c; tok.skip(); _______________________________________________ groff-commit mailing list groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit