gbranden pushed a commit to branch master
in repository groff.

commit 3a5491342e8cd9c5626bb376c3ac844376f951fc
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Mar 27 19:45:30 2026 -0500

    [libdriver]: Rename `do_file()`.
    
    ...to `interpret_troff_output_file()`.  There are several `do_file()`
    functions in the groff code base; each does something different.
    
    * src/include/driver.h: Update declaration.
    * src/libs/libdriver/input.cpp (do_file): Rename this...
      (interpret_troff_output_file): ...to this.
    
    * src/devices/grodvi/dvi.cpp (main):
    * src/devices/grohtml/post-html.cpp (main):
    * src/devices/grolbp/lbp.cpp (main):
    * src/devices/grolj4/lj4.cpp (main):
    * src/devices/grops/ps.cpp (main):
    * src/devices/grotty/tty.cpp (main): Update call sites.
---
 ChangeLog                         | 16 ++++++++++++++++
 src/devices/grodvi/dvi.cpp        |  6 +++---
 src/devices/grohtml/post-html.cpp |  6 +++---
 src/devices/grolbp/lbp.cpp        |  6 +++---
 src/devices/grolj4/lj4.cpp        |  6 +++---
 src/devices/grops/ps.cpp          |  6 +++---
 src/devices/grotty/tty.cpp        |  6 +++---
 src/include/driver.h              |  2 +-
 src/include/printer.h             |  4 ++--
 src/libs/libdriver/input.cpp      | 33 ++++++++++++++++-----------------
 10 files changed, 53 insertions(+), 38 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6cec018cb..12d95cd6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2026-03-27  G. Branden Robinson <[email protected]>
+
+       [libdriver]: Rename `do_file()` to
+       `interpret_troff_output_file()`.  There are several `do_file()`
+       functions in the groff code base; each does something different.
+
+       * src/include/driver.h: Update declaration.
+       * src/libs/libdriver/input.cpp (do_file): Rename this...
+       (interpret_troff_output_file): ...to this.
+       * src/devices/grodvi/dvi.cpp (main):
+       * src/devices/grohtml/post-html.cpp (main):
+       * src/devices/grolbp/lbp.cpp (main):
+       * src/devices/grolj4/lj4.cpp (main):
+       * src/devices/grops/ps.cpp (main):
+       * src/devices/grotty/tty.cpp (main): Update call sites.
+
 2026-03-27  G. Branden Robinson <[email protected]>
 
        Rationalize header file inclusions.  To illuminate inter-module
diff --git a/src/devices/grodvi/dvi.cpp b/src/devices/grodvi/dvi.cpp
index a5c6ee2bd..348fa9501 100644
--- a/src/devices/grodvi/dvi.cpp
+++ b/src/devices/grodvi/dvi.cpp
@@ -42,7 +42,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #include "geometry.h" // adjust_arc_center()
 
 // libdriver
-#include "driver.h" // do_file()
+#include "driver.h" // interpret_troff_output_file()
 #include "printer.h" // environment, printer
 
 extern "C" const char *Version_string;
@@ -1012,10 +1012,10 @@ int main(int argc, char **argv)
     }
   SET_BINARY(fileno(stdout));
   if (optind >= argc)
-    do_file("-");
+    interpret_troff_output_file("-");
   else {
     for (int i = optind; i < argc; i++)
-      do_file(argv[i]);
+      interpret_troff_output_file(argv[i]);
   }
   return 0;
 }
diff --git a/src/devices/grohtml/post-html.cpp 
b/src/devices/grohtml/post-html.cpp
index d1496df37..3a2542061 100644
--- a/src/devices/grohtml/post-html.cpp
+++ b/src/devices/grohtml/post-html.cpp
@@ -46,7 +46,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #include "unicode.h"
 
 // libdriver
-#include "driver.h" // do_file()
+#include "driver.h" // interpret_troff_output_file()
 #include "printer.h" // environment, printer
 
 // grohtml
@@ -5996,10 +5996,10 @@ int main(int argc, char **argv)
       assert(0 == "unhandled getopt_long return value");
     }
   if (optind >= argc) {
-    do_file("-");
+    interpret_troff_output_file("-");
   } else {
     for (int i = optind; i < argc; i++)
-      do_file(argv[i]);
+      interpret_troff_output_file(argv[i]);
   }
   return 0;
 }
diff --git a/src/devices/grolbp/lbp.cpp b/src/devices/grolbp/lbp.cpp
index 0efd21095..acf35baa3 100644
--- a/src/devices/grolbp/lbp.cpp
+++ b/src/devices/grolbp/lbp.cpp
@@ -50,7 +50,7 @@ TODO
 #include "lib.h" // strsave()
 
 // libdriver
-#include "driver.h" // do_file()
+#include "driver.h" // interpret_troff_output_file()
 #include "printer.h" // environment, printer
 
 // grolbp
@@ -765,9 +765,9 @@ int main(int argc, char **argv)
       assert(0 == "unhandled getopt_long return value");
     }
   if (optind >= argc)
-    do_file("-");
+    interpret_troff_output_file("-");
   while (optind < argc)
-    do_file(argv[optind++]);
+    interpret_troff_output_file(argv[optind++]);
   if (lbpoutput)
     lbpputs("\033c\033<");
   return 0;
diff --git a/src/devices/grolj4/lj4.cpp b/src/devices/grolj4/lj4.cpp
index 7cf8b4b2a..f45f5867b 100644
--- a/src/devices/grolj4/lj4.cpp
+++ b/src/devices/grolj4/lj4.cpp
@@ -60,7 +60,7 @@ X command to include bitmap graphics
 #include "lib.h" // PI
 
 // libdriver
-#include "driver.h" // do_file()
+#include "driver.h" // interpret_troff_output_file()
 #include "printer.h" // environment, printer
 
 extern "C" const char *Version_string;
@@ -746,10 +746,10 @@ int main(int argc, char **argv)
     }
   SET_BINARY(fileno(stdout));
   if (optind >= argc)
-    do_file("-");
+    interpret_troff_output_file("-");
   else {
     for (int i = optind; i < argc; i++)
-      do_file(argv[i]);
+      interpret_troff_output_file(argv[i]);
   }
   return 0;
 }
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index 2308a996a..b51b2de2c 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.cpp
@@ -59,7 +59,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #include "stringclass.h"
 
 // libdriver
-#include "driver.h" // do_file()
+#include "driver.h" // interpret_troff_output_file()
 #include "printer.h" // environment, printer
 
 // grops
@@ -1957,10 +1957,10 @@ int main(int argc, char **argv)
   font::set_unknown_desc_command_handler(handle_unknown_desc_command);
   SET_BINARY(fileno(stdout));
   if (optind >= argc)
-    do_file("-");
+    interpret_troff_output_file("-");
   else {
     for (int i = optind; i < argc; i++)
-      do_file(argv[i]);
+      interpret_troff_output_file(argv[i]);
   }
   return 0;
 }
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index 89a2a217b..088b8ec4b 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -38,7 +38,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #include "ptable.h"
 
 // libdriver
-#include "driver.h"
+#include "driver.h" // interpret_troff_output_file()
 #include "printer.h" // environment, printer
 
 typedef signed char schar;
@@ -1090,10 +1090,10 @@ int main(int argc, char **argv)
     }
   update_options();
   if (optind >= argc)
-    do_file("-");
+    interpret_troff_output_file("-");
   else {
     for (int i = optind; i < argc; i++)
-      do_file(argv[i]);
+      interpret_troff_output_file(argv[i]);
   }
   return 0;
 }
diff --git a/src/include/driver.h b/src/include/driver.h
index 26e48d593..d539d86c2 100644
--- a/src/include/driver.h
+++ b/src/include/driver.h
@@ -20,7 +20,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 #include "error.h"
 #include "font.h"
 
-void do_file(const char *);
+void interpret_troff_output_file(const char *);
 
 // Local Variables:
 // fill-column: 72
diff --git a/src/include/printer.h b/src/include/printer.h
index 6b73c8e88..ee783e54c 100644
--- a/src/include/printer.h
+++ b/src/include/printer.h
@@ -22,8 +22,8 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
    The class 'printer' performs the postprocessing.  Each postprocessor
    only needs to implement a derived class of 'printer' and a suitable
    function 'make_printer' for the device-dependent tasks.  Then the
-   methods of class 'printer' are called automatically by 'do_file()' in
-   'input.cpp'.
+   methods of class 'printer' are called automatically by
+   'interpret_troff_output_file()' in "input.cpp".
 */
 
 struct environment {
diff --git a/src/libs/libdriver/input.cpp b/src/libs/libdriver/input.cpp
index 6373946eb..8660dc82e 100644
--- a/src/libs/libdriver/input.cpp
+++ b/src/libs/libdriver/input.cpp
@@ -21,17 +21,14 @@ with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 
 /* Description
 
-   This file implements the parser for the intermediate groff output,
-   see groff_out(5), and does the printout for the given device.
+   This file implements a parser for the output of a device-independent
+   troff (see groff_out(5)), and produces device-specific output.
 
-   All parsed information is processed within the function do_file().
-   A device postprocessor just needs to fill in the methods for the class
-   'printer' (or rather a derived class) without having to worry about
-   the syntax of the intermediate output format.  Consequently, the
-   programming of groff postprocessors is similar to the development of
-   device drivers.
+   A postprocessor calls `interpret_troff_output_file()` and specializes
+   the class `printer`.  It need not concern itself with the syntax of
+   device-independent troff output.
 
-   The prototyping for this file is done in driver.h (and error.h).
+   See driver.h and error.h for an overview of the interface.
 */
 
 /* Changes of the 2001 rewrite of this file.
@@ -151,6 +148,8 @@ with this program.  If not, see 
<http://www.gnu.org/licenses/>.
     'README' file in this directory.
 */
 
+// do_file() is now known as `interpret_troff_output_file()` --GBR, 2026
+
 /*
   Discussion of the positioning by drawing commands
 
@@ -249,7 +248,7 @@ with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #include "device.h"
 
 // libdriver
-#include "driver.h" // do_file()
+#include "driver.h" // interpret_troff_output_file()
 #include "printer.h" // environment, printer
 
 
@@ -372,7 +371,8 @@ COLORARG_MAX = (ColorArg) 65536U; // == 0xFFFF + 1 == 
0x10000
 const IntArg
 INTARG_MAX = (IntArg) 0x7FFFFFFF; // maximal signed 32 bits number
 
-// parser environment, created and deleted by each run of do_file()
+// parser environment, created and deleted by each activation of
+// `interpret_troff_output_file()`
 environment *current_env = 0;
 
 #ifdef USE_ENV_STACK
@@ -1313,8 +1313,7 @@ parse_color_command(color *col)
 /*
    Parse the subcommands of graphical command D.
 
-   This is the part of the do_file() parser that scans the graphical
-   subcommands.
+   This is the part of the parser that scans the graphical subcommands.
    - Error on lacking or wrong arguments.
    - Warning on too many arguments.
    - Line is always skipped.
@@ -1437,8 +1436,8 @@ parse_D_command()
 /*
    Parse subcommands of the device control command x.
 
-   This is the part of the do_file() parser that scans the device
-   controlling commands.
+   This is the part of the parser that scans the device controlling
+   commands.
    - Error on duplicate prologue commands.
    - Error on wrong or lacking arguments.
    - Warning on too many arguments.
@@ -1547,12 +1546,12 @@ parse_x_command(void)
 
 ////////////////////////////////////////////////////////////////////////
 /*
-   Parse and postprocess groff intermediate output.
+   Interpret the output of a device-independent troff.
 
    filename: "-" for standard input, normal file name otherwise
 */
 void
-do_file(const char *filename)
+interpret_troff_output_file(const char *filename)
 {
   Char command;
   bool stopped = false;                // terminating condition

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

Reply via email to