[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 115/127: [troff]: Use lines in nroff-mode output warnings.
From: |
G. Branden Robinson |
Subject: |
[groff] 115/127: [troff]: Use lines in nroff-mode output warnings. |
Date: |
Mon, 10 Jul 2023 04:31:06 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit a04bf6210bbad62b769a08365aa418063a8759fb
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 dba1d342f..b4e033295 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 b3bf86705..0cb1bc7ca 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 dba93044b..2d5841d8c 100644
--- a/doc/groff.texi
+++ b/doc/groff.texi
@@ -16784,7 +16784,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 3d4cad11b..8d8d9bbd0 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -4447,6 +4447,10 @@ or
default:
.BR i ).
.
+Ignored in
+.B nroff
+mode.
+.
.
.TPx
.REQ .wh vpos
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 2e1b4d949..55fa4b497 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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 115/127: [troff]: Use lines in nroff-mode output warnings.,
G. Branden Robinson <=