groff-commit
[Top][All Lists]
Advanced

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

[groff] 10/21: [troff]: Trivially refactor (`ascii_output_flag`).


From: G. Branden Robinson
Subject: [groff] 10/21: [troff]: Trivially refactor (`ascii_output_flag`).
Date: Sat, 16 Sep 2023 18:39:38 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit bc9af043e56c213342a554bdadb5034ba99f3685
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Sep 14 23:50:13 2023 -0500

    [troff]: Trivially refactor (`ascii_output_flag`).
    
    Rename `ascii_output_flag` to `want_abstract_output`.
    
    * src/roff/troff/input.cpp (main, init_registers):
    * src/roff/troff/node.cpp (init_output):
    * src/roff/troff/troff.h: Do it.
    
    We document this feature as producing "a sort of abstract preview".
    There's no reason to tie our own hands with the term "ASCII".
---
 ChangeLog                | 9 +++++++++
 src/roff/troff/input.cpp | 6 +++---
 src/roff/troff/node.cpp  | 2 +-
 src/roff/troff/troff.h   | 2 +-
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3376e7e62..ad3448154 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-09-14  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [troff]: Trivially refactor.  Rename `ascii_output_flag` to
+       `want_abstract_output`.
+
+       * src/roff/troff/input.cpp (main, init_registers):
+       * src/roff/troff/node.cpp (init_output):
+       * src/roff/troff/troff.h: Do it.
+
 2023-09-14  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp: Trivially refactor.  Rename
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 02d78053b..9d6070328 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -99,7 +99,7 @@ static symbol blank_line_macro_name;
 static symbol leading_spaces_macro_name;
 static int compatible_flag = 0;
 static int do_old_compatible_flag = -1;        // for .do request
-int ascii_output_flag = 0;
+bool want_abstract_output = false;
 int suppress_output_flag = 0;
 int is_html = 0;
 int suppression_level = 0;     // depth of nested \O escapes
@@ -8257,7 +8257,7 @@ int main(int argc, char **argv)
       backtrace_flag = 1;
       break;
     case 'a':
-      ascii_output_flag = 1;
+      want_abstract_output = true;
       break;
     case 'z':
       suppress_output_flag = 1;
@@ -8430,7 +8430,7 @@ static void init_registers()
   set_register("yr", int(t->tm_year));
   set_register("$$", getpid());
   register_dictionary.define(".A",
-      new readonly_text_register(ascii_output_flag ? "1" : "0"));
+      new readonly_text_register(want_abstract_output ? "1" : "0"));
 }
 
 /*
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 1153174fb..8c0a0723e 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6648,7 +6648,7 @@ void init_output()
 {
   if (suppress_output_flag)
     the_output = new suppress_output_file;
-  else if (ascii_output_flag)
+  else if (want_abstract_output)
     the_output = new ascii_output_file;
   else
     the_output = new troff_output_file;
diff --git a/src/roff/troff/troff.h b/src/roff/troff/troff.h
index 8cef74460..af5ca11bf 100644
--- a/src/roff/troff/troff.h
+++ b/src/roff/troff/troff.h
@@ -37,7 +37,7 @@ extern units scale(units n, units x, units y); // scale n by 
x/y
 
 extern units units_per_inch;
 
-extern int ascii_output_flag;
+extern bool want_abstract_output;
 extern int suppress_output_flag;
 extern int color_flag;
 extern int is_html;



reply via email to

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