gbranden pushed a commit to branch master
in repository groff.

commit c57d5cfebbab020ccc45cdae6a01650489fac1fd
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Sep 10 00:00:02 2024 -0500

    [troff]: Boolify `do_divert()` and its call sites.
    
    * src/roff/troff/div.h (do_divert): Boolify function arguments.  Comment
      formal argument names as a compromise with the Stroustrup-style C++
      used in most of groff.
    
    * src/roff/troff/div.h (class diversion):
    * src/roff/troff/env.h (class environment): Update friend declarations.
    
    * src/roff/troff/div.h (class macro_diversion): Similarly boolify and
      rename constructor argument.
    
    * src/roff/troff/div.cpp (do_divert, divert, divert_append, box)
      (box_append): Boolify function arguments.  Rename `append` to
      `appending`, to match the existing `boxing`.
    
      (macro_diversion::macro_diversion): Similarly boolify and rename
      constructor argument.
---
 ChangeLog              | 16 ++++++++++++++++
 src/roff/troff/div.cpp | 16 ++++++++--------
 src/roff/troff/div.h   |  8 ++++----
 src/roff/troff/env.h   |  3 +--
 4 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ed07ea48a..4c50a2b6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2024-09-09  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/div.h (do_divert): Boolify function arguments.
+       Comment formal argument names as a compromise with the
+       Stroustrup-style C++ used in most of groff.
+       * src/roff/troff/div.h (class diversion):
+       * src/roff/troff/env.h (class environment): Update friend
+       declarations.
+       * src/roff/troff/div.h (class macro_diversion): Similarly
+       boolify and rename constructor argument.
+       * src/roff/troff/div.cpp (do_divert, divert, divert_append, box,
+       box_append): Boolify function arguments.  Rename `append` to
+       `appending`, to match the existing `boxing`.
+       (macro_diversion::macro_diversion): Similarly boolify and rename
+       constructor argument.
+
 2024-09-09  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/div.cpp (begin_page): Boolify local variable
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index 9a7940a9c..cbccf9a59 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -93,7 +93,7 @@ top_level_diversion *topdiv;
 
 diversion *curdiv;
 
-void do_divert(int append, int boxing)
+void do_divert(bool appending, bool boxing)
 {
   tok.skip();
   symbol nm = get_name();
@@ -120,7 +120,7 @@ void do_divert(int append, int boxing)
       warning(WARN_DI, "diversion stack underflow");
   }
   else {
-    macro_diversion *md = new macro_diversion(nm, append);
+    macro_diversion *md = new macro_diversion(nm, appending);
     md->prev = curdiv;
     curdiv = md;
     curdiv->saved_seen_break = curenv->seen_break;
@@ -147,22 +147,22 @@ void do_divert(int append, int boxing)
 
 void divert()
 {
-  do_divert(0, 0);
+  do_divert(false /* appending */, false /* boxing */);
 }
 
 void divert_append()
 {
-  do_divert(1, 0);
+  do_divert(true /* appending */, false /* boxing */);
 }
 
 void box()
 {
-  do_divert(0, 1);
+  do_divert(false /* appending */, true /* boxing */);
 }
 
 void box_append()
 {
-  do_divert(1, 1);
+  do_divert(true /* appending */, true /* appending */);
 }
 
 void diversion::need(vunits n)
@@ -175,7 +175,7 @@ void diversion::need(vunits n)
   }
 }
 
-macro_diversion::macro_diversion(symbol s, int append)
+macro_diversion::macro_diversion(symbol s, bool appending)
 : diversion(s), max_width(H0), diversion_trap(0 /* nullptr */),
   diversion_trap_pos(0)
 {
@@ -219,7 +219,7 @@ macro_diversion::macro_diversion(symbol s, int append)
   // the length of the charlist in the macro_header with the length
   // stored in the macro. When we detect this, we copy the contents.
   mac = new macro(true /* is diversion */);
-  if (append) {
+  if (appending) {
     request_or_macro *rm
       = static_cast<request_or_macro *>(request_dictionary.lookup(s));
     if (rm) {
diff --git a/src/roff/troff/div.h b/src/roff/troff/div.h
index 13c1a8f07..ca769b178 100644
--- a/src/roff/troff/div.h
+++ b/src/roff/troff/div.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2024 Free Software Foundation, Inc.
      Written by James Clark ([email protected])
 
 This file is part of groff.
@@ -16,12 +16,12 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
-void do_divert(int append, int boxing);
+void do_divert(bool /* appending */, bool /* boxing */);
 void end_diversions();
 void page_offset();
 
 class diversion {
-  friend void do_divert(int append, int boxing);
+  friend void do_divert(bool /* appending */, bool /* boxing */);
   friend void end_diversions();
   diversion *prev;
   node *saved_line;
@@ -72,7 +72,7 @@ class macro_diversion : public diversion {
   symbol diversion_trap;
   vunits diversion_trap_pos;
 public:
-  macro_diversion(symbol, int);
+  macro_diversion(symbol, bool /* appending */);
   ~macro_diversion();
   void output(node *nd, int retain_size, vunits vs, vunits post_vs,
              hunits width);
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index 350e52dd8..3d53f13c2 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -411,8 +411,7 @@ public:
 #ifdef WIDOW_CONTROL
   friend void widow_control_request();
 #endif /* WIDOW_CONTROL */
-
-  friend void do_divert(int append, int boxing);
+  friend void do_divert(bool /* appending */, bool /* boxing */);
 };
 
 extern environment *curenv;

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

Reply via email to