groff-commit
[Top][All Lists]
Advanced

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

[groff] 15/26: [soelim]: Boolify some globals.


From: G. Branden Robinson
Subject: [groff] 15/26: [soelim]: Boolify some globals.
Date: Thu, 14 Nov 2024 11:54:10 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit cefc27e0dc18a8701995e1a1b945d694078dbddd
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Nov 12 10:03:18 2024 -0600

    [soelim]: Boolify some globals.
    
    * src/preproc/soelim/soelim.cpp: Boolify and rename some global
      variables.
        `compatible_flag` -> `want_att_compat`
        `raw_flag`        -> `want_raw_output`
        `tex_flag`        -> `want_tex_output`
    
      (main, set_location, do_file): Track renames.
---
 ChangeLog                     | 12 +++++++++---
 src/preproc/soelim/soelim.cpp | 20 ++++++++++----------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4cd3466c7..a769960ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,9 +2,15 @@
 
        [soelim]: Fix code style nits.
 
-       * src/preproc/soelim/soelim.cpp (do_so): Boolify and rename
-       local variable, demoting integer `success` to Boolean
-       `is_filename_valid`.  Use Boolean literals for assignments.
+       * src/preproc/soelim/soelim.cpp: Boolify and rename some global
+       variables.
+           `compatible_flag` -> `want_att_compat`
+           `raw_flag`        -> `want_raw_output`
+           `tex_flag`        -> `want_tex_output`
+       (main, set_location, do_file): Track renames.
+       (do_so): Boolify and rename local variable, demoting integer
+       `success` to Boolean `is_filename_valid`.  Use Boolean literals
+       for assignments.
        (do_file): Adjust language of diagnostic message.
 
 2024-11-12  G. Branden Robinson <g.branden.robinson@gmail.com>
diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp
index 2633c12e3..0b7fe8d4c 100644
--- a/src/preproc/soelim/soelim.cpp
+++ b/src/preproc/soelim/soelim.cpp
@@ -37,9 +37,9 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>. */
 // The include search path initially contains only the current directory.
 static search_path include_search_path(0, 0, 0, 1);
 
-int compatible_flag = 0;
-int raw_flag = 0;
-int tex_flag = 0;
+bool want_att_compat = false;
+bool want_raw_output = false;
+bool want_tex_output = false;
 
 extern "C" const char *Version_string;
 
@@ -72,16 +72,16 @@ int main(int argc, char **argv)
       exit(0);
       break;
     case 'C':
-      compatible_flag = 1;
+      want_att_compat = true;
       break;
     case 'I':
       include_search_path.command_line_dir(optarg);
       break;
     case 'r':
-      raw_flag = 1;
+      want_raw_output = true;
       break;
     case 't':
-      tex_flag = 1;
+      want_tex_output = true;
       break;
     case CHAR_MAX + 1: // --help
       usage(stdout);
@@ -108,8 +108,8 @@ int main(int argc, char **argv)
 
 void set_location()
 {
-  if (!raw_flag) {
-    if (!tex_flag)
+  if (!want_raw_output) {
+    if (!want_tex_output)
       printf(".lf %d %s\n", current_lineno, current_filename);
     else
       printf("%% file %s, line %d\n", current_filename, current_lineno);
@@ -237,7 +237,7 @@ int do_file(const char *filename)
       }
       break;
     case HAD_so:
-      if (c == ' ' || c == '\n' || compatible_flag) {
+      if (c == ' ' || c == '\n' || want_att_compat) {
        string line;
        for (; c != EOF && c != '\n'; c = getc(fp))
          line += c;
@@ -269,7 +269,7 @@ int do_file(const char *filename)
       }
       break;
     case HAD_lf:
-      if (c == ' ' || c == '\n' || compatible_flag) {
+      if (c == ' ' || c == '\n' || want_att_compat) {
        string line;
        for (; c != EOF && c != '\n'; c = getc(fp))
          line += c;



reply via email to

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