groff-commit
[Top][All Lists]
Advanced

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

[groff] 35/41: [troff]: Trivially refactor.


From: G. Branden Robinson
Subject: [groff] 35/41: [troff]: Trivially refactor.
Date: Fri, 18 Mar 2022 00:41:32 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 2d708afa7a3314f62865c98c07659572be7f04d3
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Mar 17 11:38:43 2022 +1100

    [troff]: Trivially refactor.
    
    * src/roff/troff/input.cpp: Rename global variable `have_string_arg` to
      `have_multiple_params` and demote it from an integer to a Boolean.
      Assign Boolean literals to it.
    
      (read_long_escape_parameters, get_copy, token::next): Do it.
---
 ChangeLog                |  9 +++++++++
 src/roff/troff/input.cpp | 16 ++++++++--------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a81ff80d..b756a645 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-03-17  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [troff]: Trivially refactor.
+
+       * src/roff/troff/input.cpp: Rename global variable
+       `have_string_arg` to `have_multiple_params` and demote it from
+       an integer to a Boolean.  Assign Boolean literals to it.
+       (read_long_escape_parameters, get_copy, token::next): Do it.
+
 2022-03-16  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [tbl]: Fix Savannah #62191.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 97c609d4..493d1633 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -113,7 +113,7 @@ int old_have_input = 0;             // value of have_input 
right before \n
 bool device_has_tcommand = false;      // 't' ouput command supported
 int unsafe_flag = 0;           // safer by default
 
-int have_string_arg = 0;       // whether we have \*[foo bar...]
+bool have_multiple_params = false;     // e.g., \[e aa], \*[foo bar]
 
 double spread_limit = -3.0 - 1.0;      // negative means deactivated
 
@@ -897,7 +897,7 @@ static symbol read_long_escape_parameters(read_mode mode)
   }
   buf[i] = 0;
   if (c == ' ')
-    have_string_arg = 1;
+    have_multiple_params = true;
   if (buf == abuf) {
     if (i == 0) {
       if (mode != ALLOW_EMPTY)
@@ -1026,8 +1026,8 @@ static int get_copy(node **nd, bool is_defining, bool 
handle_escape_E)
        (void)input_stack::get(0);
        symbol s = read_escape_parameter(WITH_ARGS);
        if (!(s.is_null() || s.is_empty())) {
-         if (have_string_arg) {
-           have_string_arg = 0;
+         if (have_multiple_params) {
+           have_multiple_params = false;
            interpolate_string_with_args(s);
          }
          else
@@ -1989,8 +1989,8 @@ void token::next()
        {
          symbol s = read_escape_parameter(WITH_ARGS);
          if (!(s.is_null() || s.is_empty())) {
-           if (have_string_arg) {
-             have_string_arg = 0;
+           if (have_multiple_params) {
+             have_multiple_params = false;
              interpolate_string_with_args(s);
            }
            else
@@ -2259,8 +2259,8 @@ void token::next()
          symbol s = read_long_escape_parameters(WITH_ARGS);
          if (s.is_null() || s.is_empty())
            break;
-         if (have_string_arg) {
-           have_string_arg = 0;
+         if (have_multiple_params) {
+           have_multiple_params = false;
            nm = composite_glyph_name(s);
          }
          else {



reply via email to

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