[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 25/28: [troff]: Tweak argumentful `pnr` output.
From: |
G. Branden Robinson |
Subject: |
[groff] 25/28: [troff]: Tweak argumentful `pnr` output. |
Date: |
Sat, 7 Sep 2024 21:36:49 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 97b08fa3ee30f29064b8a0fedf8c7fee95f0bd9e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Sep 7 08:35:00 2024 -0500
[troff]: Tweak argumentful `pnr` output.
* src/roff/troff/reg.cpp (dump_register): Report assigned format of
register only if it is not string-valued.
* doc/groff.texi.in (Debugging):
* man/groff.7.man (Request short reference):
* man/groff_diff.7.man (New requests):
* NEWS: Update documentation.
Continues commit 13866fdf0b, 3 September.
---
ChangeLog | 10 ++++++++++
NEWS | 2 +-
doc/groff.texi.in | 6 +++---
man/groff.7.man | 13 +++++++------
man/groff_diff.7.man | 6 +++---
src/roff/troff/reg.cpp | 18 ++++++++++++------
6 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index dddffd3c9..8571e50b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-09-07 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ * src/roff/troff/reg.cpp (dump_register): Report assigned format
+ of register only if it is not string-valued.
+
+ * doc/groff.texi.in (Debugging):
+ * man/groff.7.man (Request short reference):
+ * man/groff_diff.7.man (New requests):
+ * NEWS: Update documentation.
+
2024-09-02 Sven Schober <sv3sch@gmail.com>
[man]: Handle discrepant `pdf{images,totext}`.
diff --git a/NEWS b/NEWS
index 68c873f56..ad48ba133 100644
--- a/NEWS
+++ b/NEWS
@@ -54,7 +54,7 @@ o GNU troff now implements saturating rather than wrapping
integer
the formatter now emits a warning diagnostic in the "range" category.
o The `pnr` request now additionally reports the interpolation format of
- each register.
+ each register (if it is not string-valued).
o The formatter no longer reports warnings in the "el" category. There
was only one; it threw a warning diagnostic if enabled (which it was
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 156e86412..e5ff08a13 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -17207,9 +17207,9 @@ strings, and diversions with their sizes in bytes.
@Defreq {pnr, [@Var{reg} @r{@dots{}}]}
@cindex dumping registers (@code{pnr})
@cindex registers, dumping (@code{pnr})
-Report the name, value, and assigned format of each register @var{reg},
-or, without arguments, those of all defined registers, to the standard
-error stream.
+Report the name and value and, if the value is numeric, the assigned
+format of each register @var{reg}, or, without arguments, those of all
+defined registers, to the standard error stream.
@endDefreq
@Defreq {ptr, }
diff --git a/man/groff.7.man b/man/groff.7.man
index cea8e1466..fe88646cb 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -4042,15 +4042,16 @@ Set next page number.
.REQ .pnr
Report the names,
contents,
-and assigned formats
-of all defined registers to the standard error stream.
+and
+(as applicable)
+assigned formats of all defined registers to the standard error stream.
.
.TPx
.REQ .pnr "reg \fR\&.\|.\|.\&\fP"
-Report the name,
-value,
-and assigned format of each register
-.I reg
+Report the name and value and,
+if the value is numeric,
+the assigned format of each register
+.IR reg ,
to the standard error stream.
.
.TPx
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index c67a8da3f..4d99c3eb9 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -3326,9 +3326,9 @@ The list is empty if there are none.
.TP
.BR .pnr \~[\c
.IR reg \~.\|.\|.]
-Report the name,
-value,
-and assigned format of each register
+Report the name and value and,
+if the value is numeric,
+the assigned format of each register
.IR reg ,
or,
without arguments,
diff --git a/src/roff/troff/reg.cpp b/src/roff/troff/reg.cpp
index 045a5d8a3..e4d66c490 100644
--- a/src/roff/troff/reg.cpp
+++ b/src/roff/troff/reg.cpp
@@ -507,13 +507,19 @@ void rename_register_request()
static void dump_register(symbol *id, reg *r)
{
+ int n;
errprint("%1\t", id->contents());
- const char *value = r->get_string();
- if (value)
- errprint("%1", value);
- const char *format = r->get_format();
- if (format)
- errprint("\t\%1", format);
+ if (r->get_value(&n)) {
+ errprint("%1", n);
+ const char *f = r->get_format();
+ assert(f != 0 /* nullptr */);
+ if (f != 0 /* nullptr*/)
+ errprint("\t\%1", f);
+ }
+ else {
+ const char *s = r->get_string();
+ errprint("%1", s);
+ }
errprint("\n");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 25/28: [troff]: Tweak argumentful `pnr` output.,
G. Branden Robinson <=