gbranden pushed a commit to branch master
in repository groff.

commit f22af06d39c230205bbfdfff810f9f50d0d6ffb7
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jan 17 19:56:47 2025 -0600

    [troff]: Trivially refactor.
    
    Rename character-definition request handler functions to end with
    `_request`, and rename the workhorse function to simple
    `define_character`.  Mark them all `static` (except for
    `define_font_specific_character`, which already was) while we're at it.
    
    * src/roff/troff/token.h:
    * src/roff/troff/input.cpp:
    * src/roff/troff/node.cpp: Do it.
    
    * src/roff/troff/input.cpp (define_character_request)
      (define_fallback_character_request)
      (define_special_character_request):
    * src/roff/troff/node.cpp
      (define_font_specific_character_request): Update call sites.
    
    * src/roff/troff/input.cpp (init_input_requests): Update
      coupling of request names to request handler functions.
---
 ChangeLog                | 21 +++++++++++++++++++++
 src/roff/troff/input.cpp | 22 +++++++++++-----------
 src/roff/troff/node.cpp  |  6 +++---
 src/roff/troff/token.h   |  6 +++---
 4 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a4ff6a8a5..64d00bc12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2025-01-17  G. Branden Robinson <[email protected]>
+
+       [troff]: Trivially refactor.  Rename character-definition
+       request handler functions to end with `_request`, and rename the
+       workhorse function to simple `define_character`.  Mark them all
+       `static` (except for `define_font_specific_character`, which
+       already was) while we're at it.
+
+       * src/roff/troff/token.h:
+       * src/roff/troff/input.cpp:
+       * src/roff/troff/node.cpp: Do it.
+
+       * src/roff/troff/input.cpp (define_character_request)
+       (define_fallback_character_request)
+       (define_special_character_request):
+       * src/roff/troff/node.cpp
+       (define_font_specific_character_request): Update call sites.
+
+       * src/roff/troff/input.cpp (init_input_requests): Update
+       coupling of request names to request handler functions.
+
 2025-01-16  G. Branden Robinson <[email protected]>
 
        * NEWS: Add item at top making special note of incompatible
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 2aac8ad51..1ca088a7c 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2025 Free Software Foundation, Inc.
      Written by James Clark ([email protected])
 
 This file is part of groff.
@@ -4536,7 +4536,7 @@ void append_nocomp_string()
   do_define_string(DEFINE_APPEND, COMP_DISABLE);
 }
 
-void do_define_character(char_mode mode, const char *font_name)
+void define_character(char_mode mode, const char *font_name)
 {
   node *n = 0 /* nullptr */;
   int c;
@@ -4583,19 +4583,19 @@ void do_define_character(char_mode mode, const char 
*font_name)
   tok.next();
 }
 
-void define_character()
+static void define_character_request()
 {
-  do_define_character(CHAR_NORMAL);
+  define_character(CHAR_NORMAL);
 }
 
-void define_fallback_character()
+static void define_fallback_character_request()
 {
-  do_define_character(CHAR_FALLBACK);
+  define_character(CHAR_FALLBACK);
 }
 
-void define_special_character()
+static void define_special_character_request()
 {
-  do_define_character(CHAR_SPECIAL);
+  define_character(CHAR_SPECIAL);
 }
 
 static void remove_character()
@@ -9261,7 +9261,7 @@ void init_input_requests()
   init_request("c2", assign_no_break_control_character);
   init_request("cf", copy_file);
   init_request("cflags", set_character_flags);
-  init_request("char", define_character);
+  init_request("char", define_character_request);
   init_request("chop", chop_macro);
   init_request("class", define_class);
   init_request("close", close_request);
@@ -9286,7 +9286,7 @@ void init_input_requests()
   init_request("em", eoi_macro);
   init_request("eo", escape_off);
   init_request("ex", exit_request);
-  init_request("fchar", define_fallback_character);
+  init_request("fchar", define_fallback_character_request);
 #ifdef WIDOW_CONTROL
   init_request("fpl", flush_pending_lines);
 #endif /* WIDOW_CONTROL */
@@ -9320,7 +9320,7 @@ void init_input_requests()
   init_request("return", return_macro_request);
   init_request("rm", remove_macro);
   init_request("rn", rename_macro);
-  init_request("schar", define_special_character);
+  init_request("schar", define_special_character_request);
   init_request("shift", shift);
   init_request("so", source_request);
   init_request("soquiet", source_quietly_request);
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 5b7ac8cf6..05c4f75d1 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2025 Free Software Foundation, Inc.
      Written by James Clark ([email protected])
 
 This file is part of groff.
@@ -6411,13 +6411,13 @@ static void define_font_specific_character()
   if (!has_font(&finfo)) {
     font_lookup_error(finfo, "to define font-specific fallback glyph");
     // Normally we skip the remainder of the line unconditionally at the
-    // end of a request-implementing function, but do_define_character()
+    // end of a request-implementing function, but define_character()
     // will eat the rest of it for us.
     skip_line();
   }
   else {
     symbol f = font_table[finfo.position]->get_name();
-    do_define_character(CHAR_FONT_SPECIAL, f.contents());
+    define_character(CHAR_FONT_SPECIAL, f.contents());
   }
 }
 
diff --git a/src/roff/troff/token.h b/src/roff/troff/token.h
index c057a0538..03f428247 100644
--- a/src/roff/troff/token.h
+++ b/src/roff/troff/token.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2025 Free Software Foundation, Inc.
      Written by James Clark ([email protected])
 
 This file is part of groff.
@@ -118,8 +118,8 @@ enum char_mode {
   CHAR_SPECIAL
 };
 
-extern void do_define_character(char_mode,
-                       const char * /* font_name */ = 0 /* nullptr */);
+extern void define_character(char_mode,
+                            const char * /* font_name */ = 0 /* nullptr */);
 
 class hunits;
 extern void read_title_parts(node **part, hunits *part_width);

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to