groff-commit
[Top][All Lists]
Advanced

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

[groff] 04/12: Revert "[troff]: Refactor."


From: G. Branden Robinson
Subject: [groff] 04/12: Revert "[troff]: Refactor."
Date: Thu, 19 Dec 2024 15:21:31 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 8b311d3298bdafae24cd576dba058f6ad5203a3b
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Dec 17 10:38:27 2024 -0600

    Revert "[troff]: Refactor."
    
    This reverts commit f865d4ac91e2b07ee4becfd3f8313cf56ed57863.
    
    Thanks to Peter Schaffter for the reproducer and Deri James for
    assistance with the root-cause analysis.
    
    Fixes <https://savannah.gnu.org/bugs/?66587>.
---
 ChangeLog                 |  14 -----
 src/roff/troff/node.cpp   |  12 ++---
 tmac/tests/an_MR-works.sh | 132 ++++------------------------------------------
 3 files changed, 16 insertions(+), 142 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d4eef4d05..68e406e86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3410,20 +3410,6 @@
        which cannot be negative.  Explicitly discard return value of
        sprintf(3).
 
-2024-09-08  G. Branden Robinson <g.branden.robinson@gmail.com>
-
-       * src/roff/troff/node.cpp (class troff_output_file):
-       Drop `tf` and `gcol` arguments from declaration, because...
-       (troff_output_file::start_device_extension): Cease output of
-       commands to update the font, stroke color, and drawing position.
-       Drop now-unused `tf` and `gcol` arguments.
-       (device_extension_node::tprint_start): Drop `tf` and `gcol`
-       arguments from call site.
-
-       * tmac/tests/an_MR-works.sh: Update test expectations.  The
-       expected commands shift location by two lines, but the output
-       still behaves as desired.
-
 2024-09-08  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/node.cpp
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 704a42826..5b7ac8cf6 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -827,7 +827,8 @@ public:
   void right(hunits);
   void down(vunits);
   void moveto(hunits, vunits);
-  void start_device_extension(color * /* fcol */,
+  void start_device_extension(tfont * /* tf */,
+                             color * /* gcol */, color * /* fcol */,
                              bool /* omit_command_prefix */ = false);
   void start_device_extension();
   void write_device_extension_char(unsigned char c);
@@ -887,18 +888,15 @@ inline void troff_output_file::put(unsigned int i)
   put_string(ui_to_a(i), fp);
 }
 
-void troff_output_file::start_device_extension(color *fcol,
+void troff_output_file::start_device_extension(tfont *tf, color *gcol,
+                                              color *fcol,
                                               bool omit_command_prefix)
 {
   flush_tbuf();
-#if 0
   set_font(tf);
   stroke_color(gcol);
-#endif
   fill_color(fcol);
-#if 0
   do_motion();
-#endif
   if (!omit_command_prefix)
     put("x X ");
 }
@@ -3978,7 +3976,7 @@ node *device_extension_node::copy()
 
 void device_extension_node::tprint_start(troff_output_file *out)
 {
-  out->start_device_extension(fcol, lacks_command_prefix);
+  out->start_device_extension(tf, gcol, fcol, lacks_command_prefix);
 }
 
 void device_extension_node::tprint_char(troff_output_file *out,
diff --git a/tmac/tests/an_MR-works.sh b/tmac/tests/an_MR-works.sh
index faba09f24..77a8a9850 100755
--- a/tmac/tests/an_MR-works.sh
+++ b/tmac/tests/an_MR-works.sh
@@ -41,131 +41,21 @@ output=$(echo "$input" | "$groff" -Tascii -rU1 -man -Z | 
nl)
 echo "$output"
 
 # Expected:
-#      1  x T ascii
-#      2  x res 240 24 40
-#      3  x init
-#      4  p1
-#      5  x font 2 I
-#      6  f2
-#      7  s10
-#      8  V40
-#      9  H0
-#     10  md
-#     11  DFd
-#     12  tfoo
-#     13  x font 1 R
-#     14  f1
-#     15  t(1)
-#     16  h552
-#     17  tGeneral
-#     18  wh24
-#     19  tCommands
-#     20  wh24
-#     21  tManual
-#     22  f2
-#     23  h528
-#     24  tfoo
-#     25  f1
-#     26  t(1)
-#     27  n40 0
-#     28  V120
-#     29  H0
-#     30  x X devtag:.NH 1
-#     31  x font 3 B
-#     32  f3
-#     33  V120
-#     34  H0
-#     35  tName
-#     36  wh24
-#     37  x X devtag:.eo.h
-#     38  V120
-#     39  H120
-#     40  n40 0
-#     41  f1
-#     42  V160
-#     43  H120
-#     44  tfoo
-#     45  wh24
-#     46  C\-
-#     47  wh48
-#     48  ta
-#     49  wh24
-#     50  tcommand
-#     51  wh24
-#     52  twith
-#     53  wh24
-#     54  ta
-#     55  wh24
-#     56  tvery
-#     57  wh24
-#     58  tshort
-#     59  wh24
-#     60  tname
-#     61  n40 0
-#     62  V240
-#     63  H0
-#     64  x X devtag:.NH 1
-#     65  f3
-#     66  V240
-#     67  H0
-#     68  tDescription
-#     69  wh24
-#     70  x X devtag:.eo.h
-#     71  V240
-#     72  H288
-#     73  n40 0
-#     74  f1
-#     75  V280
-#     76  H120
-#     77  tThe
-#     78  wh24
-#     79  treal
-#     80  wh24
-#     81  twork
-#     82  wh24
-#     83  tis
-#     84  wh24
-#     85  tdone
-#     86  wh24
-#     87  tby
-#     88  wh24
-#     89  x X tty: link man:bar(1)
-#     90  f2
-#     91  V280
-#     92  H720
-#     93  tbar
-#     94  f1
-#     95  t(1)
-#     96  x X tty: link
-#     97  V280
-#     98  H864
-#     99  t.
-#    100  n40 0
-#    101  V360
-#    102  H0
-#    103  tgroff
-#    104  wh24
-#    105  ttest
-#    106  wh24
-#    107  tsuite
-#    108  h456
-#    109  t2021-10-06
-#    110  f2
-#    111  h696
-#    112  tfoo
-#    113  f1
-#    114  t(1)
-#    115  n40 0
-#    116  x trailer
-#    117  V360
-#    118  x stop
+#   91  x X tty: link man:bar(1)
+#   92  f2
+#   93  tbar
+#   94  f1
+#   95  t(1)
+#   96  V280
+#   97  H912
+#   98  x X tty: link
 
 echo "checking for opening 'link' device extension command" >&2
-echo "$output" | grep -Eq '89[[:space:]]+x X tty: link man:bar\(1\)$' \
+echo "$output" | grep -Eq '91[[:space:]]+x X tty: link man:bar\(1\)$' \
     || wail
 
 echo "checking for correct man page title font style" >&2
-echo "$output" | grep -Eq '90[[:space:]]+f2' \
+echo "$output" | grep -Eq '92[[:space:]]+f2' \
     || wail
 echo "$output" | grep -Eq '93[[:space:]]+tbar' \
     || wail
@@ -177,7 +67,7 @@ echo "$output" | grep -Eq '95[[:space:]]+t\(1\)' \
     || wail
 
 echo "checking for closing 'link' device extension command" >&2
-echo "$output" | grep -Eq '96[[:space:]]+x X tty: link$' \
+echo "$output" | grep -Eq '98[[:space:]]+x X tty: link$' \
     || wail
 
 output=$(echo "$input" | "$groff" -man -Thtml)



reply via email to

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