groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 15/48: [troff]: Boolify env.cpp (6/25).


From: G. Branden Robinson
Subject: [groff] 15/48: [troff]: Boolify env.cpp (6/25).
Date: Sun, 28 Apr 2024 23:06:20 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit b82e8930816b762be1059bb3e7caf87c9124f0c3
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Apr 26 23:08:02 2024 -0500

    [troff]: Boolify env.cpp (6/25).
    
    [troff]: Boolify more `environment` class member variables, member
    function parameters, and local variables.
    
    * src/roff/troff/env.h (class environment) [WIDOW_CONTROL]:
    * src/roff/troff/env.cpp (environment::output)
      (environment::output_pending_lines, widow_control_request)
      (environment::output, environment::environment)
      (environment::copy, environment::print_env) [WIDOW_CONTROL]:
      - Rename `widow_control` to `want_widow_control` and demote it from
        `int` to `bool`.
---
 ChangeLog              |  8 ++++++++
 src/roff/troff/env.cpp | 18 +++++++++---------
 src/roff/troff/env.h   |  2 +-
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c52727909..f7a66aad9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,14 @@
        (pending_output_line::output): Demote parameter `ce` from `int`
        to `bool`.
 
+       * src/roff/troff/env.h (class environment) [WIDOW_CONTROL]:
+       * src/roff/troff/env.cpp (environment::output)
+       (environment::output_pending_lines, widow_control_request)
+       (environment::output, environment::environment)
+       (environment::copy, environment::print_env) [WIDOW_CONTROL]:
+       - Rename `widow_control` to `want_widow_control` and demote it
+         from `int` to `bool`.
+
 2024-04-24  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/env.cpp (tab_stops::to_string)
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 31b18157f..ec4af3093 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -144,7 +144,7 @@ void environment::output(node *nd, bool suppress_filling,
 {
 #ifdef WIDOW_CONTROL
   while (pending_lines) {
-    if (widow_control && !pending_lines->suppress_filling
+    if (want_widow_control && !pending_lines->suppress_filling
        && !pending_lines->next)
       break;
     if (!pending_lines->output())
@@ -158,7 +158,7 @@ void environment::output(node *nd, bool suppress_filling,
 #endif /* WIDOW_CONTROL */
   if (!was_trap_sprung && !pending_lines
 #ifdef WIDOW_CONTROL
-      && (!widow_control || suppress_filling)
+      && (!want_widow_control || suppress_filling)
 #endif /* WIDOW_CONTROL */
       ) {
     curenv->construct_format_state(nd, was_centered, !suppress_filling);
@@ -199,7 +199,7 @@ void environment::output_pending_lines()
 
 void environment::mark_last_line()
 {
-  if (!widow_control || !pending_lines)
+  if (!want_widow_control || !pending_lines)
     return;
   pending_output_line *p;
   for (p = pending_lines; p->next; p = p->next)
@@ -212,9 +212,9 @@ void widow_control_request()
 {
   int n;
   if (has_arg() && get_integer(&n))
-    curenv->widow_control = (n > 0);
+    curenv->want_widow_control = (n > 0);
   else
-    curenv->widow_control = 1;
+    curenv->want_widow_control = true;
   skip_line();
 }
 
@@ -747,7 +747,7 @@ environment::environment(symbol nm)
   composite(0),
   pending_lines(0),
 #ifdef WIDOW_CONTROL
-  widow_control(0),
+  want_widow_control(false),
 #endif /* WIDOW_CONTROL */
   glyph_color(&default_color),
   prev_glyph_color(&default_color),
@@ -841,7 +841,7 @@ environment::environment(const environment *e)
   composite(0),
   pending_lines(0),
 #ifdef WIDOW_CONTROL
-  widow_control(e->widow_control),
+  want_widow_control(e->want_widow_control),
 #endif /* WIDOW_CONTROL */
   glyph_color(e->glyph_color),
   prev_glyph_color(e->prev_glyph_color),
@@ -928,7 +928,7 @@ void environment::copy(const environment *e)
   prev_family = e->prev_family;
   leader_node = 0;
 #ifdef WIDOW_CONTROL
-  widow_control = e->widow_control;
+  want_widow_control = e->want_widow_control;
 #endif /* WIDOW_CONTROL */
   hyphen_line_max = e->hyphen_line_max;
   hyphen_line_count = 0;
@@ -3496,7 +3496,7 @@ void environment::print_env()
   errprint("  hyphenation space: %1u\n", hyphenation_space.to_units());
   errprint("  hyphenation margin: %1u\n", hyphenation_margin.to_units());
 #ifdef WIDOW_CONTROL
-  errprint("  widow control: %1\n", widow_control ? "yes" : "no");
+  errprint("  widow control: %1\n", want_widow_control ? "yes" : "no");
 #endif /* WIDOW_CONTROL */
 }
 
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index 52e487703..f599fe881 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -220,7 +220,7 @@ class environment {
   int composite;               // used for construction of composite char?
   pending_output_line *pending_lines;
 #ifdef WIDOW_CONTROL
-  int widow_control;
+  bool want_widow_control;
 #endif /* WIDOW_CONTROL */
   color *glyph_color;
   color *prev_glyph_color;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]