groff-commit
[Top][All Lists]
Advanced

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

[groff] 16/17: [output drivers]: Reset line number at end of input.


From: G. Branden Robinson
Subject: [groff] 16/17: [output drivers]: Reset line number at end of input.
Date: Sat, 17 Feb 2024 22:08:44 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit bc35f576b4de41b2d40c30102d5ed5c45661dc0f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Feb 17 19:38:07 2024 -0600

    [output drivers]: Reset line number at end of input.
    
    * src/devices/grodvi/dvi.cpp (dvi_printer::~dvi_printer):
    * src/devices/grohtml/post-html.cpp (html_printer::~html_printer):
    * src/devices/grolbp/lbp.cpp (lbp_printer::~lbp_printer):
    * src/devices/grolj4/lj4.cpp (lj4_printer::~lj4_printer):
    * src/devices/grops/ps.cpp (ps_printer::~ps_printer):
    * src/devices/grotty/tty.cpp (tty_printer::~tty_printer): Clear line
      number when tearing down output writer so that diagnostic messages
      aren't emitted with a misleading (and nonexistent) line number (the
      number of lines in the device-independent output file plus one).  The
      PostScript driver in particular does large amounts of processing at
      this point (like resolving PostScript resources).  The problem is more
      theoretical for other output drivers, but done for consistency.
---
 ChangeLog                         | 19 +++++++++++++++++++
 src/devices/grodvi/dvi.cpp        |  1 +
 src/devices/grohtml/post-html.cpp |  2 ++
 src/devices/grolbp/lbp.cpp        |  1 +
 src/devices/grolj4/lj4.cpp        |  1 +
 src/devices/grops/ps.cpp          |  1 +
 src/devices/grotty/tty.cpp        |  1 +
 7 files changed, 26 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ca1390983..0f3bfbd23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2024-02-17  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [output drivers]: Reset line number at end of input.
+
+       * src/devices/grodvi/dvi.cpp (dvi_printer::~dvi_printer):
+       * src/devices/grohtml/post-html.cpp
+       (html_printer::~html_printer):
+       * src/devices/grolbp/lbp.cpp (lbp_printer::~lbp_printer):
+       * src/devices/grolj4/lj4.cpp (lj4_printer::~lj4_printer):
+       * src/devices/grops/ps.cpp (ps_printer::~ps_printer):
+       * src/devices/grotty/tty.cpp (tty_printer::~tty_printer): Clear
+       line number when tearing down output writer so that diagnostic
+       messages aren't emitted with a misleading (and nonexistent) line
+       number (the number of lines in the device-independent output
+       file plus one).  The PostScript driver in particular does large
+       amounts of processing at this point (like resolving PostScript
+       resources).  The problem is more theoretical for other output
+       drivers, but done for consistency.
+
 2024-02-17  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/libs/libgroff/string.cpp (string::string): When
diff --git a/src/devices/grodvi/dvi.cpp b/src/devices/grodvi/dvi.cpp
index 1dac6d88f..6bdeaa6eb 100644
--- a/src/devices/grodvi/dvi.cpp
+++ b/src/devices/grodvi/dvi.cpp
@@ -216,6 +216,7 @@ dvi_printer::dvi_printer()
 
 dvi_printer::~dvi_printer()
 {
+  current_lineno = 0; // At this point, we've read all the input.
   postamble();
 }
 
diff --git a/src/devices/grohtml/post-html.cpp 
b/src/devices/grohtml/post-html.cpp
index b1e5d275c..fcfb70bed 100644
--- a/src/devices/grohtml/post-html.cpp
+++ b/src/devices/grohtml/post-html.cpp
@@ -5211,6 +5211,8 @@ html_printer::~html_printer()
 {
   struct tm *t;
 
+  current_lineno = 0; // At this point, we've read all the input.
+
   if (current_paragraph)
     current_paragraph->flush_text();
   html.end_line();
diff --git a/src/devices/grolbp/lbp.cpp b/src/devices/grolbp/lbp.cpp
index b37c90055..c27e09709 100644
--- a/src/devices/grolbp/lbp.cpp
+++ b/src/devices/grolbp/lbp.cpp
@@ -194,6 +194,7 @@ lbp_printer::lbp_printer(int ps, double pw, double pl)
 
 lbp_printer::~lbp_printer()
 {
+  current_lineno = 0; // At this point, we've read all the input.
   lbpputs("\033P1y\033\\");
   lbpputs("\033c\033<");
 }
diff --git a/src/devices/grolj4/lj4.cpp b/src/devices/grolj4/lj4.cpp
index 1a238ae4e..507e3ac09 100644
--- a/src/devices/grolj4/lj4.cpp
+++ b/src/devices/grolj4/lj4.cpp
@@ -257,6 +257,7 @@ lj4_printer::lj4_printer(int ps)
 
 lj4_printer::~lj4_printer()
 {
+  current_lineno = 0; // At this point, we've read all the input.
   fputs("\033E", stdout);
 }
 
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index 18fff9065..4e6f415da 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.cpp
@@ -1377,6 +1377,7 @@ font *ps_printer::make_font(const char *nm)
 
 ps_printer::~ps_printer()
 {
+  current_lineno = 0; // At this point, we've read all the input.
   out.simple_comment("Trailer")
      .put_symbol("end")
      .simple_comment("EOF");
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index 326482bd4..c9f386e37 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -279,6 +279,7 @@ tty_printer::tty_printer() : cached_v(0)
 
 tty_printer::~tty_printer()
 {
+  current_lineno = 0; // At this point, we've read all the input.
   delete[] lines;
 }
 



reply via email to

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