groff-commit
[Top][All Lists]
Advanced

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

[groff] 108/115: [troff]: Use lines in nroff-mode output warnings.


From: G. Branden Robinson
Subject: [groff] 108/115: [troff]: Use lines in nroff-mode output warnings.
Date: Thu, 1 Jun 2023 10:46:18 -0400 (EDT)

gbranden pushed a commit to branch branden-2022-06-01
in repository groff.

commit 9fd38f57e20cdca466b1a4027ac7de1970b3e228
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue May 23 16:08:12 2023 -0500

    [troff]: Use lines in nroff-mode output warnings.
    
    * src/roff/troff/input.cpp (do_error): Describe vertical page locations
      in output warning diagnostics in terms of lines on nroff devices.
    
    * doc/groff.texi (Debugging) <warnscale>:
    * man/groff.7.man (Request short reference) <warnscale>: Document this
      change.
    
    * NEWS: Add item.
    
    This commit omits an indentation update, to clarify the change.
---
 ChangeLog                | 10 ++++++++++
 NEWS                     |  8 ++++++++
 doc/groff.texi           |  4 +++-
 man/groff.7.man          |  4 ++++
 src/roff/troff/input.cpp | 17 ++++++++++++++++-
 5 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ee3abc65d..b456bbbcf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-05-23  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/input.cpp (do_error): Describe vertical page
+       locations in output warning diagnostics in terms of lines on
+       nroff devices.
+       * doc/groff.texi (Debugging) <warnscale>:
+       * man/groff.7.man (Request short reference) <warnscale>:
+       Document this change.
+       * NEWS: Add item.
+
 2023-05-19  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [tbl]: Refactor handling of type size and vertical spacing.
diff --git a/NEWS b/NEWS
index 0fc6ac325..0f3f07825 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,14 @@ not described.  There are more details in the man and info 
pages.
 VERSION next
 ============
 
+troff
+-----
+o In nroff mode (in other words, when producing output for terminal
+  devices), the formatter now reports warning diagnostics regarding
+  certain output problems using units of lines instead of inches (or the
+  unit configured with the `warnscale` request) to describe the vertical
+  drawing position where the problem occurred.
+
 eqn
 ---
 
diff --git a/doc/groff.texi b/doc/groff.texi
index 5a6939182..f3783cb28 100644
--- a/doc/groff.texi
+++ b/doc/groff.texi
@@ -16809,7 +16809,9 @@ exhausted.  The default is 1,000.
 @Defreq {warnscale, su}
 Set the scaling unit used in certain warnings @c `output_warning()`
 to @var{su}, which can take the values @samp{u}, @samp{i}, @samp{c},
-@samp{p}, and @samp{P}.  The default is @samp{i}.
+@samp{p}, and @samp{P}.  The default is @samp{i}.  Ignored on
+@code{nroff}-mode output devices, for which these diagnostics report the
+vertical page location in lines.
 @endDefreq
 
 @Defreq {spreadwarn, [@Var{limit}]}
diff --git a/man/groff.7.man b/man/groff.7.man
index e2f586bc3..5545b84ce 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -4409,6 +4409,10 @@ or
 default:
 .BR i ).
 .
+Ignored in
+.B nroff
+mode.
+.
 .
 .TPx
 .REQ .wh vertical-position
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 70eb8ecf5..66d983e3c 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8928,7 +8928,21 @@ static void do_error(error_type type,
     fputs("debug: ", stderr);
     break;
   case OUTPUT_WARNING:
-    double fromtop = topdiv->get_vertical_position().to_units() \
+    if (nroff_mode) {
+      int fromtop = topdiv->get_vertical_position().to_units()
+                   / vresolution;
+      fprintf(stderr, "warning [page %d, line %d",
+             topdiv->get_page_number(), fromtop);
+      if (topdiv != curdiv) {
+       int fromdivtop = curdiv->get_vertical_position().to_units()
+                        / vresolution;
+       fprintf(stderr, ", diversion '%s', line %d",
+               curdiv->get_diversion_name(), fromdivtop);
+      }
+      fprintf(stderr, "]: ");
+    }
+    else {
+    double fromtop = topdiv->get_vertical_position().to_units()
                     / warn_scale;
     fprintf(stderr, "warning [page %d, %.1f%c",
            topdiv->get_page_number(), fromtop, warn_scaling_unit);
@@ -8940,6 +8954,7 @@ static void do_error(error_type type,
              warn_scaling_unit);
     }
     fprintf(stderr, "]: ");
+    }
     break;
   }
   errprint(format, arg1, arg2, arg3);



reply via email to

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