[groff] 10/18: tmac/fallbacks.tmac: Fix Savannah #66905.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 993213863e2deaed73cd2d14284478e7612c284f
Author: Dave Kemper 
AuthorDate: Thu Mar 13 06:59:57 2025 +

tmac/fallbacks.tmac: Fix Savannah #66905.

* tmac/fallbacks.tmac: Allow recognition of more Unicode characters in
  output formats where Savannah #63332 isn't an issue.

Fixes .
---
 ChangeLog   |  8 
 tmac/fallbacks.tmac | 12 +++-
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 96f3733a3..5e52e81cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-03-13  Dave Kemper 
+
+   * tmac/fallbacks.tmac: Allow recognition of more Unicode
+   characters in output formats where Savannah #63332 isn't an
+   issue.
+
+   Fixes .
+
 2025-03-21  G. Branden Robinson 
 
[tbl]: Fix Savannah #66931.
diff --git a/tmac/fallbacks.tmac b/tmac/fallbacks.tmac
index 63869c8fd..d23fb83bd 100644
--- a/tmac/fallbacks.tmac
+++ b/tmac/fallbacks.tmac
@@ -181,22 +181,24 @@
 .\"fchar \[u2019] \[cq]\" right single quotation mark
 .\"fchar \[u201C] \[lq]\" left double quotation mark
 .\"fchar \[u201D] \[rq]\" right double quotation mark
-.\" XXX: The next two are troublesome; see Savannah #63332.
-.\"fchar \[u2020] \[dg]\" dagger
-.\"fchar \[u2021] \[dd]\" double dagger
+.\" XXX: The next two are troublesome in nroff; see Savannah #63332.
+.if \n[fallbacks*troff-mode] .fchar \[u2020] \[dg]\" dagger
+.if \n[fallbacks*troff-mode] .fchar \[u2021] \[dd]\" double dagger
 .fchar \[u2022] \[bu]\" bullet
 .fchar \[u2024] .\" one dot leader
 .fchar \[u2025] .\|.\" two dot leader
 .fchar \[u2026] .\|.\|.\" horizontal ellipsis
 .fchar \[u2027] \[pc]\" hyphenation point
-.\"fchar \[u2030] \[%0]\" per mille sign \" Savannah #63332 again
+.if \n[fallbacks*troff-mode] \
+.  fchar \[u2030] \[%0]\" per mille sign \" Savannah #63332 again
 .fchar \[u2032] \[fm]\" prime
 .fchar \[u2033] \[sd]\" double prime
 .fchar \[u2039] \[fo]\" left single chevron
 .fchar \[u203A] \[fc]\" right single chevron
 .if \n[fallbacks*troff-mode] \
 .  fchar \[u203D] \o'?!'\" interrobang
-.\"fchar \[u203E] \[rn]\" overline \" Savannah #63332 again
+.if \n[fallbacks*troff-mode] \
+.  fchar \[u203E] \[rn]\" overline \" Savannah #63332 again
 .fchar \[u2044] \[f/]\" fraction slash
 .fchar \[u2052] %\" commercial minus sign
 .fchar \[u2053] \[ti]\" swung dash

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 11/18: [afmtodit]: Initialize scalars properly.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 1b4f95dab08f77cd0e73e593581c2608a14ad26b
Author: G. Branden Robinson 
AuthorDate: Fri Mar 21 19:15:35 2025 -0500

[afmtodit]: Initialize scalars properly.

* src/utils/afmtodit/afmtodit.pl (croak, whine): Fix my misunderstanding
  of uninitialized Perl scalars.  Initialize scalars used as strings to
  explicit empty strings.

Continues commit 658f7afb8e, 2 January.
---
 ChangeLog  | 8 
 src/utils/afmtodit/afmtodit.pl | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5e52e81cd..c53af8b07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-03-21  G. Branden Robinson 
+
+   * src/utils/afmtodit/afmtodit.pl (croak, whine): Fix my
+   misunderstanding of uninitialized Perl scalars.  Initialize
+   scalars used as strings to explicit empty strings.
+
+   Continues commit 658f7afb8e, 2 January.
+
 2025-03-13  Dave Kemper 
 
* tmac/fallbacks.tmac: Allow recognition of more Unicode
diff --git a/src/utils/afmtodit/afmtodit.pl b/src/utils/afmtodit/afmtodit.pl
index 1cdaa40c6..3cb9d3b21 100644
--- a/src/utils/afmtodit/afmtodit.pl
+++ b/src/utils/afmtodit/afmtodit.pl
@@ -62,7 +62,7 @@ if ($opt_v) {
 
 sub croak {
 my $msg = shift;
-my $pos;
+my $pos = "";
 $pos .= "$filename:" if $filename;
 $pos .= "$lineno:" if $lineno;
 print STDERR "$prog:$pos error: $msg\n";
@@ -71,7 +71,7 @@ sub croak {
 
 sub whine {
 my $msg = shift;
-my $pos;
+my $pos = "";
 $pos .= "$filename:" if $filename;
 $pos .= "$lineno:" if $lineno;
 print STDERR "$prog:$pos warning: $msg\n";

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 04/18: src/roff/troff/input.h: Add macro dump lookup aid.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit af7b0f4a468cee55ba2500b6373af2ee63d3bf45
Author: G. Branden Robinson 
AuthorDate: Thu Mar 20 00:07:53 2025 -0500

src/roff/troff/input.h: Add macro dump lookup aid.

Add comments corresponding to JSON-encoded representations of C0 and C1
control code points that GNU troff uses its document/formatter debugging
features, and which are needed for forthcoming `pm` macro/string/
iversion dumping support.  (And existing device extension command
dumping support, when something naughty gets into one.)

This isn't as good as decoding them in the dump output, but their
embedding in JSON string objects makes a good means of doing so
non-obvious to me.
---
 src/roff/troff/input.h | 76 ++
 1 file changed, 39 insertions(+), 37 deletions(-)

diff --git a/src/roff/troff/input.h b/src/roff/troff/input.h
index ca0855991..b351ffaa4 100644
--- a/src/roff/troff/input.h
+++ b/src/roff/troff/input.h
@@ -21,47 +21,49 @@ along with this program.  If not, see 
. */
 //
 // Except for the ones named `INPUT_`, they are not valid as input.
 
-const int ESCAPE_QUESTION = 015;
-const int BEGIN_TRAP = 016;
-const int END_TRAP = 017;
-const int PAGE_EJECTOR = 020;
-const int ESCAPE_NEWLINE = 021;
-const int ESCAPE_AMPERSAND = 022;
-const int ESCAPE_UNDERSCORE = 023;
-const int ESCAPE_BAR = 024;
-const int ESCAPE_CIRCUMFLEX = 025;
-const int ESCAPE_LEFT_BRACE = 026;
-const int ESCAPE_RIGHT_BRACE = 027;
-const int ESCAPE_LEFT_QUOTE = 030;
-const int ESCAPE_RIGHT_QUOTE = 031;
-const int ESCAPE_HYPHEN = 032;
-const int ESCAPE_BANG = 033;
-const int ESCAPE_c = 034;
-const int ESCAPE_e = 035;
-const int ESCAPE_PERCENT = 036;
-const int ESCAPE_SPACE = 037;
+const int ESCAPE_QUESTION = 015;   // \u000d
+const int BEGIN_TRAP = 016;// \u000e
+const int END_TRAP = 017;  // \u000f
+const int PAGE_EJECTOR = 020;  // \u0010
+const int ESCAPE_NEWLINE = 021;// \u0011
+const int ESCAPE_AMPERSAND = 022;  // \u0012
+const int ESCAPE_UNDERSCORE = 023; // \u0013
+const int ESCAPE_BAR = 024;// \u0014
+const int ESCAPE_CIRCUMFLEX = 025; // \u0015
+const int ESCAPE_LEFT_BRACE = 026; // \u0016
+const int ESCAPE_RIGHT_BRACE = 027;// \u0017
+const int ESCAPE_LEFT_QUOTE = 030; // \u0018
+const int ESCAPE_RIGHT_QUOTE = 031;// \u0019
+const int ESCAPE_HYPHEN = 032; // \u001a
+const int ESCAPE_BANG = 033;   // \u001b
+const int ESCAPE_c = 034;  // \u001c
+const int ESCAPE_e = 035;  // \u001d
+const int ESCAPE_PERCENT = 036;// \u001e
+const int ESCAPE_SPACE = 037;  // \u001f
 
-const int INPUT_DELETE = 0177;
+const int INPUT_DELETE = 0177; // \u007f
 
-const int TITLE_REQUEST = 0200;
-const int COPY_FILE_REQUEST = 0201;
-const int TRANSPARENT_FILE_REQUEST = 0202;
+const int TITLE_REQUEST = 0200;// \u0080
+const int COPY_FILE_REQUEST = 0201;// \u0081
+const int TRANSPARENT_FILE_REQUEST = 0202; // \u0082
 #ifdef COLUMN
-const int VJUSTIFY_REQUEST = 0203;
+const int VJUSTIFY_REQUEST = 0203; // \u0083
 #endif /* COLUMN */
-const int ESCAPE_E = 0204;
-const int LAST_PAGE_EJECTOR = 0205;
-const int ESCAPE_RIGHT_PARENTHESIS = 0206;
-const int ESCAPE_TILDE = 0207;
-const int ESCAPE_COLON = 0210;
-const int PUSH_GROFF_MODE = 0211;
-const int PUSH_COMP_MODE = 0212;
-const int POP_GROFFCOMP_MODE = 0213;
-const int BEGIN_QUOTE = 0214;
-const int END_QUOTE = 0215;
-const int DOUBLE_QUOTE = 0216;
-const int INPUT_NO_BREAK_SPACE = 0240;
-const int INPUT_SOFT_HYPHEN= 0255;
+const int ESCAPE_E = 0204; // \u0084
+const int LAST_PAGE_EJECTOR = 0205;// \u0085
+const int ESCAPE_RIGHT_PARENTHESIS = 0206; // \u0086
+const int ESCAPE_TILDE = 0207; // \u0087
+const int ESCAPE_COLON = 0210; // \u0088
+const int PUSH_GROFF_MODE = 0211;  // \u0089
+const int PUSH_COMP_MODE = 0212;   // \u008a
+const int POP_GROFFCOMP_MODE = 0213;   // \u008b
+const int BEGIN_QUOTE = 0214;  // \u008c
+const int END_QUOTE = 0215;// \u008d
+const int DOUBLE_QUOTE = 0216; // \u008e
+
+const int INPUT_NO_BREAK_SPACE = 0240; // \u00a3
+
+const int INPUT_SOFT_HYPHEN = 0255;// \u00ad
 
 extern void do_stroke_color(symbol);
 extern void do_fill_color(symbol);

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 05/18: [troff]: Implement macro/string/diversion dumper.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 52f93e69dddb39bbfbbf7c43e355538e35b8edab
Author: G. Branden Robinson 
AuthorDate: Thu Mar 20 00:24:05 2025 -0500

[troff]: Implement macro/string/diversion dumper.

...made possible by the 60+ themed commits earlier this month.

* src/roff/troff/input.cpp: Do it.  Add inelegant `extern` declaration
  roping in `dump_node_list()` function from "node.cpp".

  (class macro_header): Replace `json_dump()` member function with
  `json_dump_macro()` and `json_dump_diversion()`, since how we dump
  depends on what component objects we contain.

  (macro::json_dump): Call appropriate aforementioned function;
  `json_dump_macro` on macros and strings, `json_dump_diversion` on
  diversions.

  (macro_header::json_dump_diversion): Call `dump_node_list()` on the
  `head` member of this object's `node_list` `struct`.

  (macro::json_dump): Rename this...
  (macro::json_dump_macro): ...to this.  Also use `errprint()` instead
  of `fputc()`.  Also explicitly compare return values of pointer type
  to null pointer literal instead of letting them pun down to Booleans.

  (print_macros): Check for arguments.  If given any, interpret them as
  macro/string/diversion names and dump the contents of each,
  JSON-encoded.  If not, proceed with previously unconditional behavior.

* doc/groff.texi.in (Debugging) :
* man/groff.7.man (Request short reference) :
* man/groff_diff.7.man (Other differences): Document it.

Illustrations:

Here's a string...

$ printf '.ds str \\%%ambi\\%%dextrous\n.pm str\n' \
  | build/test-groff -z 2>&1
{"name": "str", "contents": "\u001Eambi\u001Edextrous"}
$ printf '.ds str \\%%ambi\\%%dextrous\n.pm str\n' \
  | build/test-groff -z 2>&1 | jq
{
  "name": "str",
  "contents": "\u001eambi\u001edextrous"
}

...a macro...

$ printf '.de foo\nhello to $@ from\n.ie t troff\n.el nroff\nand H.\\& 
H.\\& Asquith.\n..\n.pm foo\n' | build/test-groff -z 2>&1
{"name": "foo", "contents": "hello to \\$@ from\n.ie t troff\n.el 
nroff\nand H.\u0012 H.\u0012 Asquith.\n"}
$ printf '.de foo\nhello to $@ from\n.ie t troff\n.el nroff\nand H.\\& 
H.\\& Asquith.\n..\n.pm foo\n' | build/test-groff -z 2>&1 | jq
{
  "name": "foo",
  "contents": "hello to \\$@ from\n.ie t troff\n.el nroff\nand H.\u0012 
H.\u0012 Asquith.\n"
}

...and (strap yourself in) a diversion.

$ printf '.di foo\nABC.\n.sp\nDEF\n.br\n.di\n.pm foo\n' \
  | build/test-groff -z 2>&1
{"name": "foo", "contents": [{"type": "line_start_node", "diversion level": 
0, "is_special_node": false}, {"type": "glyph_node", "diversion level": 0, 
"is_special_node": false, "character": "A"}, {"type": "glyph_node", "diversion 
level": 0, "is_special_node": false, "character": "B"}, {"type": "glyph_node", 
"diversion level": 0, "is_special_node": false, "character": "C"}, {"type": 
"glyph_node", "diversion level": 0, "is_special_node": false, "character": 
"."}, {"type": "vertical_size [...]
$ printf '.di foo\nABC.\n.sp\nDEF\n.br\n.di\n.pm foo\n' \
  | build/test-groff -z 2>&1 | jq
{
  "name": "foo",
  "contents": [
{
  "type": "line_start_node",
  "diversion level": 0,
  "is_special_node": false
},
{
  "type": "glyph_node",
  "diversion level": 0,
  "is_special_node": false,
  "character": "A"
},
{
  "type": "glyph_node",
  "diversion level": 0,
  "is_special_node": false,
  "character": "B"
},
{
  "type": "glyph_node",
  "diversion level": 0,
  "is_special_node": false,
  "character": "C"
},
{
  "type": "glyph_node",
  "diversion level": 0,
  "is_special_node": false,
  "character": "."
},
{
  "type": "vertical_size_node",
  "diversion level": 0,
  "is_special_node": false,
  "vunits": -12000
},
{
  "type": "vertical_size_node",
  "diversion level": 0,
  "is_special_node": false,
  "vunits": 0
},
{
  "type": "diverted_space_node",
  "diversion level": 0,
  "is_special_node": false,
  "vunits": 12000
},
{
  "type": "line_start_node",
  "diversion level": 0,
  "is_special_node": false
},
{
  "type": "glyph_node",
  "diversion level": 0,
  "is_special_node": false,
  "character": "D"
},
{
  "type": "glyph_node",
  "diversion level": 0,
  "is_special_node": false,
  "character": "E"
},
{
  "type": "glyph_node",
  "divers

[groff] 13/18: [libgroff]: Drop tautological assertion.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit f4f36d90158022e6ff6f1bd288c29b2677057d8e
Author: G. Branden Robinson 
AuthorDate: Sat Mar 22 17:26:01 2025 -0500

[libgroff]: Drop tautological assertion.

* src/libs/libgroff/json_encode.cpp (json_encode_char): Kill off
  tautological assertion.

Fixes "-Wtautological-constant-out-of-range-compare" warning from GCC.
---
 ChangeLog | 8 
 src/libs/libgroff/json_encode.cpp | 2 --
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 66dd4f7c7..a3d06273d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-03-22  G. Branden Robinson 
+
+   * src/libs/libgroff/json_encode.cpp (json_encode_char): Kill off
+   tautological assertion.
+
+   Fixes "-Wtautological-constant-out-of-range-compare" warning
+   from GCC.
+
 2025-03-22  G. Branden Robinson 
 
* src/roff/troff/input.cpp (token::next): Stop throwing an error
diff --git a/src/libs/libgroff/json_encode.cpp 
b/src/libs/libgroff/json_encode.cpp
index a119b1936..fa3ab6663 100644
--- a/src/libs/libgroff/json_encode.cpp
+++ b/src/libs/libgroff/json_encode.cpp
@@ -19,7 +19,6 @@ along with this program.  If not, see 
. */
 #include 
 #endif
 
-#include 
 #include  // snprintf()
 
 #include "cset.h" // csprint()
@@ -29,7 +28,6 @@ along with this program.  If not, see 
. */
 // string (without bracketing `"`s).
 json_char json_encode_char(unsigned char c)
 {
-  assert(c < 256);
   json_char jc;
   // These printable characters require escaping.
   if (('"' == c) || ('\\' == c) || ('/' == c)) {

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 14/18: NEWS: Clarify `soelim` item.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 8b14ac5b2bb680a8806db89ce69dbede03378b42
Author: G. Branden Robinson 
AuthorDate: Sat Mar 22 17:28:58 2025 -0500

NEWS: Clarify `soelim` item.
---
 NEWS | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index 26df75731..11a3910b4 100644
--- a/NEWS
+++ b/NEWS
@@ -276,12 +276,12 @@ soelim
 
 *  soelim no longer requires embedded space characters in `so` arguments
to be backslash-escaped.  (It continues to support that syntax, even
-   though neither AT&T nor GNU troff ever has.)  If the argument to a
-   `so` request must contain leading spaces, any such sequence of spaces
-   must now be prefixed with a double quote character ("), which the
-   program then discards.  These changes are to better align this
-   program's parsing rules with the language of the formatter; consider
-   the `ds` and `as` requests.
+   though neither AT&T nor GNU troff ever has.)  You can now embed a
+   sequence of leading spaces in the argument by prefixing it with a
+   with a neutral double quote character ("), which the program then
+   discards.  These changes are to better align this program's parsing
+   rules with the language of the formatter; consider the `ds` and `as`
+   requests.
 
 Macro packages
 --

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 03/18: [doc,man]: Parallelize `pm` request descriptions.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 95b9942dd6cc8a3ee6cf5f0ca35cff6472a0866e
Author: G. Branden Robinson 
AuthorDate: Wed Mar 19 23:43:17 2025 -0500

[doc,man]: Parallelize `pm` request descriptions.
---
 doc/groff.texi.in | 7 +--
 man/groff.7.man   | 7 ++-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 6116219ce..f9b795dd9 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -17763,8 +17763,11 @@ represents an empty list.
 @Defreq {pm, }
 @cindex dumping symbol table (@code{pm})
 @cindex symbol table, dumping (@code{pm})
-Report, to the standard error stream, the names of all defined macros,
-strings, and diversions with their sizes in bytes.
+Report,
+to the standard error stream,
+the names of all defined macros,
+strings,
+and diversions and their sizes in bytes.
 @endDefreq
 
 @Defreq {pnr, [@Var{reg} @r{@dots{}}]}
diff --git a/man/groff.7.man b/man/groff.7.man
index adb04bacb..a11102f4b 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -4216,12 +4216,9 @@ represents an empty list.
 .REQ .pm
 Report,
 to the standard error stream,
-the names and sizes in bytes of
-defined
-macros,
+the names of all defined macros,
 strings,
-and
-diversions.
+and diversions and their sizes in bytes.
 .
 .TPx
 .REQ .pn \[+-]N

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 01/18: ChangeLog: Fix typo.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit b692147de2532a14048ba894e7abfb58f991bbfd
Author: G. Branden Robinson 
AuthorDate: Thu Mar 20 00:23:54 2025 -0500

ChangeLog: Fix typo.
---
 ChangeLog | 29 -
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index a4cce559c..833cfb60f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2025-03-20  G. Branden Robinson 
+
+   [troff]: Implement macro/string/diversion dumper.
+
+   * src/roff/troff/input.cpp: Do it.  Add inelegant `extern`
+   declaration roping in `dump_node_list()` function from
+   "node.cpp".
+   (class macro_header): Replace `json_dump()` member function with
+   `json_dump_macro()` and `json_dump_diversion()`, since how we
+   dump depends on what component objects we contain.
+   (macro::json_dump): Call appropriate aforementioned function;
+   `json_dump_macro` on macros and strings, `json_dump_diversion`
+   on diversions.
+   (macro_header::json_dump_diversion): Call `dump_node_list()` on
+   the `head` member of this object's `node_list` `struct`.
+   (macro::json_dump): Rename this...
+   (macro::json_dump_macro): ...to this.  Also use `errprint()`
+   instead of `fputc()`.
+   (print_macros): Check for arguments.  If given any, interpret
+   them as macro/string/diversion names and dump the contents of
+   each, JSON-encoded.  If not, proceed with previously
+   unconditional behavior.
+
+   * doc/groff.texi.in (Debugging) :
+   * man/groff.7.man (Request short reference) :
+   * man/groff_diff.7.man (Other differences): Document it.
+
 2025-03-17  G. Branden Robinson 
 
[troff]: Add internal facility for writing trout/grout comments
@@ -159,7 +186,7 @@
 
 2025-03-15  G. Branden Robinson 
 
-   * src/roff/troff/input.cpp (macro:json_dump): A `macro` object
+   * src/roff/troff/input.cpp (macro::json_dump): A `macro` object
is not guaranteed to contain a `macro_header`; check for a null
pointer and report an empty JSON string if there's no header.
 

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 08/18: [tbl]: Regression-test Savannah #66931.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 45f6f84a297bc9ad61569f9b4f7ce75ea229b6cd
Author: G. Branden Robinson 
AuthorDate: Fri Mar 21 15:34:04 2025 -0500

[tbl]: Regression-test Savannah #66931.

* src/preproc/tbl/tests/emit-accurate-lf-requests.sh: Do it.
* src/src/preproc/tbl/tbl.am (tbl_TESTS): Run test.

Test fails at this commit.
---
 ChangeLog  |  7 
 src/preproc/tbl/tbl.am |  1 +
 src/preproc/tbl/tests/emit-accurate-lf-requests.sh | 37 ++
 3 files changed, 45 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ab1b997cc..f741fc026 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-03-21  G. Branden Robinson 
+
+   [tbl]: Regression-test Savannah #66931.
+
+   * src/preproc/tbl/tests/emit-accurate-lf-requests.sh: Do it.
+   * src/src/preproc/tbl/tbl.am (tbl_TESTS): Run test.
+
 2025-03-21  G. Branden Robinson 
 
[troff]: Warn on failure to adjust the output line.
diff --git a/src/preproc/tbl/tbl.am b/src/preproc/tbl/tbl.am
index dc7ff08bf..af7ecedaa 100644
--- a/src/preproc/tbl/tbl.am
+++ b/src/preproc/tbl/tbl.am
@@ -36,6 +36,7 @@ tbl_TESTS = \
   src/preproc/tbl/tests/do-not-overlap-bottom-border-in-nroff.sh \
   src/preproc/tbl/tests/do-not-segv-on-invalid-vertical-span-entry.sh \
   src/preproc/tbl/tests/do-not-segv-when-backslash-R-in-text-block.sh \
+  src/preproc/tbl/tests/emit-accurate-lf-requests.sh \
   src/preproc/tbl/tests/expand-region-option-works.sh \
   src/preproc/tbl/tests/format-time-diagnostics-work.sh \
   src/preproc/tbl/tests/horizontal-rules-not-drawn-too-long.sh \
diff --git a/src/preproc/tbl/tests/emit-accurate-lf-requests.sh 
b/src/preproc/tbl/tests/emit-accurate-lf-requests.sh
new file mode 100755
index 0..84fcd4005
--- /dev/null
+++ b/src/preproc/tbl/tests/emit-accurate-lf-requests.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+tbl="${abs_top_builddir:-.}/tbl"
+
+# Regression-test Savannah #66931.
+#
+# When writing out a file name argument to the `lf` request, ensure that
+# the line number isn't always set to "1".
+
+input='.
+.TS
+L.
+foo
+.TE
+.'
+
+echo "$input" | "$tbl" | grep '^\.lf [2-9][0-9]* "..*'
+
+# vim:set ai et sw=4 ts=4 tw=72:

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 17/18: [doc,man]: Fix content and style nits.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit d180bc45c5878df16eddd4f9a57d4523e8727c75
Author: G. Branden Robinson 
AuthorDate: Sat Mar 22 17:37:58 2025 -0500

[doc,man]: Fix content and style nits.

* Clarify that the auto-incrementation applies only to user-defined
  registers.
* Favor active voice over passive.
* Parallelize input line breaks (where possible).
---
 doc/groff.texi.in | 24 
 man/groff.7.man   | 29 ++---
 2 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 03f588f65..510061ac1 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -7775,11 +7775,17 @@ value is interpolated, and a warning in category 
@samp{reg} is emitted.
 @cindex incrementation, automatic, of a register
 @cindex decrementation, automatic, of a register
 
-Registers can also be incremented or decremented by a configured amount
-at the time they are interpolated.  The value of the increment is
-specified with a third argument to the @code{nr} request, and a special
-interpolation syntax is used to alter and then retrieve the register's
-value.  Together, these features are called
+User-defined registers can also be incremented or decremented
+by a configured amount
+at the time they are interpolated.
+The value of the increment is specified with a third argument to the
+@code{nr}
+request,
+and a special interpolation syntax
+@c XXX: Texinfo 5.0 doesn't have a command for the � glyph.
+alters and then retrieves the register's value.
+Together,
+these features are called
 @dfn{auto-increment}.@footnote{A negative auto-increment can be
 considered an ``auto-decrement''.}
 
@@ -7967,9 +7973,11 @@ with the @code{if}, @code{ie}, or @code{while} requests.
 @cindex removing a built-in register
 @cindex register, built-in, removing
 @cindex built-in register, removing
-@strong{Caution:@:} Built-in registers are subject to removal like
-others; once removed, they can be recreated only as normal writable
-registers and will not reflect the configuration of the formatter.
+@strong{Caution:@:}
+Built-in registers are subject to removal like others;
+once removed,
+they can be recreated only as normal writable registers
+and will not otherwise reflect the configuration of the formatter.
 
 A register name is often associated with a request of the same name
 (without the dot).  A complete listing of all built-in registers can be
diff --git a/man/groff.7.man b/man/groff.7.man
index 89bd4cf43..027c1c2e3 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -6468,7 +6468,8 @@ escape sequence.
 .
 .
 .P
-Registers can also be incremented or decremented by a configured amount
+User-defined registers can also be incremented or decremented
+by a configured amount
 at the time they are interpolated.
 .
 The value of the increment is specified with a third argument to the
@@ -6477,8 +6478,7 @@ request,
 and a special interpolation syntax,
 .BI \[rs]n \[+-]\c
 ,
-is used to alter and then retrieve
-the register's value.
+alters and then retrieves the register's value.
 .
 Together,
 these features are called
@@ -6491,24 +6491,23 @@ considered an \[lq]auto-decrement\[rq].)
 .P
 Many predefined registers are available.
 .
-In the following presentation,
-the register interpolation syntax
+The following presentation uses
+register interpolation syntax
 .BI \[rs]n[ name ]
-is used to refer to a register
+to refer to a register
 .I name
 to clearly distinguish it from a string or request
-.IR name .
+.IR name ;
+the symbols
+.B \[rs]n[]
+are
+.I not
+part of the register name.
 .
 The register name space is separate from that used for requests,
 macros,
 strings,
 and diversions.
-.
-The symbols
-.B \[rs]n[]
-are
-.I not
-part of the register name.
 .\" END Keep (roughly) parallel with groff.texi node "Registers".
 .
 .
@@ -6525,8 +6524,8 @@ Many are Boolean-valued.
 .I Caution:
 Built-in registers are subject to removal like others;
 once removed,
-they can be recreated only as normal writable registers and will not
-reflect the configuration of the formatter.
+they can be recreated only as normal writable registers
+and will not otherwise reflect the configuration of the formatter.
 .
 .
 .P

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 07/18: [troff]: Warn on failure to adjust the output line.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit c9d9a4e1e743d84de96ef4f6d2bde6b09bc67b1e
Author: G. Branden Robinson 
AuthorDate: Fri Mar 21 14:50:12 2025 -0500

[troff]: Warn on failure to adjust the output line.

* src/roff/troff/env.cpp (distribute_space): I planted an `assert()`
  land mine for myself back in December and it finally went off.  Remove
  assertion that the amount of `desired_space` for adjustment must be
  nonnegative.  While rare, this can in fact happen with perverse inputs
  such as long, unhyphenable character sequences or short output line
  lengths.  Throw new warnings in category "break" when adjustment is
  desired but impossible: (1) the output line has no adjustable spaces
  on it, or (2) any adjustable spaces would have to be squeezable/
  shrinkable to achieve a fit, and that is not yet implemented in GNU
  troff (see Savannah #44018).  (Even if/when we do implement it, there
  will be a [likely configurable] limit to how narrow an adjustable
  space can become.)

* doc/groff.texi.in (Warnings):
* src/roff/troff/troff.1.man (Warnings): Document additional
  circumstances under which warnings in "break" category are thrown.
  Clarify existing circumstances.

Fixes .

Also annotate places in code that I think will likely need to change
upon tackling Savannah #44018.
---
 ChangeLog  | 25 +
 doc/groff.texi.in  | 11 ---
 src/roff/troff/env.cpp | 16 +++-
 src/roff/troff/troff.1.man |  9 ++---
 4 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 833cfb60f..ab1b997cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2025-03-21  G. Branden Robinson 
+
+   [troff]: Warn on failure to adjust the output line.
+
+   * src/roff/troff/env.cpp (distribute_space): I planted an
+   `assert()` land mine for myself back in December and it finally
+   went off.  Remove assertion that the amount of `desired_space`
+   for adjustment must be nonnegative.  While rare, this can in
+   fact happen with perverse inputs such as long, unhyphenable
+   character sequences or short output line lengths.  Throw new
+   warnings in category "break" when adjustment is desired but
+   impossible: (1) the output line has no adjustable spaces on it,
+   or (2) any adjustable spaces would have to be squeezable/
+   shrinkable to achieve a fit, and that is not yet implemented in
+   GNU troff (see Savannah #44018).  (Even if/when we do implement
+   it, there will be a [likely configurable] limit to how narrow an
+   adjustable space can become.)
+
+   * doc/groff.texi.in (Warnings):
+   * src/roff/troff/troff.1.man (Warnings): Document additional
+   circumstances under which warnings in "break" category are
+   thrown.  Clarify existing circumstances.
+
+   Fixes .
+
 2025-03-20  G. Branden Robinson 
 
[troff]: Implement macro/string/diversion dumper.
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 4ff7c88d5..03f588f65 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -17973,9 +17973,14 @@ by default.
 @itemx 4
 @cindex filling, and @code{break} warnings
 @cindex mode, fill, and @code{break} warnings
-A filled output line could not be broken such that its length was less
-than the output line length @samp{\n[.l]}.  This category is enabled by
-default.
+@cindex adjustment, and @code{break} warnings
+A filled output line could not be
+broken such that its length was less than or equal to,
+or
+adjusted such that its length was exactly equal to,
+the output line length
+@samp{\n[.l]}.
+This category is enabled by default.
 
 @item delim
 @itemx 8
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 37dd7954c..90eea11f2 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -22,6 +22,7 @@ along with this program.  If not, see 
. */
 
 #include  // errno
 #include  // ceil()
+#include  // abs()
 
 #include 
 #include  // find()
@@ -2100,6 +2101,9 @@ breakpoint *environment::choose_breakpoint()
   }
   if (best_bp) {
 if (!best_bp_fits)
+  // TODO: If we implement shrinkable/squeezable adjustable spaces,
+  // this warning could become spurious in cases where we can
+  // achieve the desired adjustment.
   output_warning(WARN_BREAK, "cannot break line");
 return best_bp;
   }
@@ -2189,9 +2193,19 @@ static void distribute_space(node *nd, int nspaces,
 hunits desired_space,
 bool force_reverse_node_list = false)
 {
-  assert(desired_space >= H0);
   if (desired_space.is_zero() || nspaces == 0)
 return;
+  if (desired_space < H0) {
+// TODO: Implement shrinkable/squee

[groff] 18/18: [doc,man]: Update "Debugging" node/section.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 1df28a38fd082e5315c1101d5bcc080992e55746
Author: G. Branden Robinson 
AuthorDate: Sat Mar 22 17:51:08 2025 -0500

[doc,man]: Update "Debugging" node/section.
---
 doc/groff.texi.in | 23 +--
 man/groff.7.man   | 24 +---
 2 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 510061ac1..be234e994 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -17576,12 +17576,23 @@ and related requests can be used to emit customized 
diagnostic messages
 or for instrumentation while troubleshooting.  The @code{ex} and
 @code{ab} requests cause early termination with successful and error
 exit codes respectively, to halt further processing when continuing
-would be fruitless.  Examine the state of the formatter with requests
-that write lists of defined names (macros, strings, and diversions),
-colors, composite characters, environments, hyphenation codes and
-exceptions, registers, open streams, page location traps, and a list of
-output nodes corresponding to the pending input line to the standard
-error stream.
+would be fruitless.
+Examine the state of the formatter with requests that write lists of
+defined names---macros, strings, and diversions---@
+colors,
+composite character mappings,
+environments,
+automatic hyphenation codes
+and exceptions,
+registers,
+open streams,
+and page location traps.
+Other requests disclose
+to the standard error stream
+the internal properties and representations of
+characters,
+macros (and strings and diversions),
+and the list of output nodes corresponding to the pending input line.
 @c END Keep parallel with section "Debugging" of groff(7).
 
 @Defreq {lf, input-line-number [[@code{"}]@Var{file-identifier}]}
diff --git a/man/groff.7.man b/man/groff.7.man
index 027c1c2e3..5903b9455 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -8837,24 +8837,34 @@ strings,
 and
 .RB diversions\[em]( pm );
 characters
-.RB ( pchar "; experimental);
+.RB ( pchar "; experimental);"
 colors
 .RB ( pcolor );
-composite characters
+composite character mappings
 .RB ( pcomposite );
 environments
 .RB ( pev );
-hyphenation codes
+automatic hyphenation codes
+.RB ( pchar )
+and exceptions
 .RB ( phw );
 registers
 .RB ( pnr );
 open streams
 .RB ( pstream );
+and
 page location traps
-.RB ( ptr );
-and a list of output nodes corresponding to the pending input line
-.RB ( pline )
-to the standard error stream.
+.RB ( ptr ).
+.
+Other requests disclose
+to the standard error stream
+the internal properties and representations of
+characters
+.RB ( pchar ),
+macros (and strings and diversions)
+.RB ( pm ),
+and the list of output nodes corresponding to the pending input line
+.RB ( pline ).
 .\" END Keep (roughly) parallel with groff.texi node "Debugging".
 .
 .

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 12/18: [troff]: Fix Savannah #66675 (`char` interps).

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit b4397231a0214b054c40577657e6dbd50fdd31a1
Author: G. Branden Robinson 
AuthorDate: Sat Mar 22 16:32:40 2025 -0500

[troff]: Fix Savannah #66675 (`char` interps).

* src/roff/troff/input.cpp (token::next): Stop throwing an error
  diagnostic and aborting interpretation of a special character
  identifier when it starts with "u" and is of length > 2.  For example,
  `\[unhappy]` is a valid special character interpolation, simply not a
  _Unicode_ special character interpolation.  Also solves the same
  problem when reading special character identifiers from font
  description files.

Fixes .  Thanks to Dave Kemper for
the report.  Problem introduced by me in commit 6bf627403c, 4 September.
---
 ChangeLog| 14 ++
 src/roff/troff/input.cpp |  8 +---
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c53af8b07..66dd4f7c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2025-03-22  G. Branden Robinson 
+
+   * src/roff/troff/input.cpp (token::next): Stop throwing an error
+   diagnostic and aborting interpretation of a special character
+   identifier when it starts with "u" and is of length > 2.  For
+   example, `\[unhappy]` is a valid special character
+   interpolation, simply not a _Unicode_ special character
+   interpolation.  Also solves the same problem when reading
+   special character identifiers from font description files.
+
+   Fixes .  Thanks to Dave
+   Kemper for the report.  Problem introduced by me in commit
+   6bf627403c, 4 September.
+
 2025-03-21  G. Branden Robinson 
 
* src/utils/afmtodit/afmtodit.pl (croak, whine): Fix my
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 1b18403ce..def138e7b 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2564,14 +2564,8 @@ void token::next()
char errbuf[ERRBUFSZ];
const char *sc = s.contents();
const char *gn = 0 /* nullptr */;
-   if ((strlen(sc) > 2) && (sc[0] == 'u')) {
+   if ((strlen(sc) > 2) && (sc[0] == 'u'))
  gn = valid_unicode_code_sequence(sc, errbuf);
- if (0 /* nullptr */ == gn) {
-   error("special character '%1' is invalid: %2", sc,
- errbuf);
-   break;
- }
-   }
if (gn != 0 /* nullptr */) {
  const char *gn_decomposed = decompose_unicode(gn);
  if (gn_decomposed)

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 09/18: [tbl]: Fix Savannah #66931 (wrong `lf` requests).

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 4a2510cb872709ca12a3912208d619424fd5649e
Author: G. Branden Robinson 
AuthorDate: Fri Mar 21 15:28:10 2025 -0500

[tbl]: Fix Savannah #66931 (wrong `lf` requests).

* src/preproc/tbl/table.cpp (set_troff_location): Fix logic error.  When
  writing a *roff `lf` request with a file name argument, write out the
  actual corresponding input file line number instead of "1".

Fixes .  Thanks to Bjarni Ingi
Gislason for the report.  Problem introduced by me in commit 25ef9f6bda,
26 February.
---
 ChangeLog | 13 +
 src/preproc/tbl/table.cpp |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f741fc026..96f3733a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2025-03-21  G. Branden Robinson 
+
+   [tbl]: Fix Savannah #66931.
+
+   * src/preproc/tbl/table.cpp (set_troff_location): Fix logic
+   error.  When writing a *roff `lf` request with a file name
+   argument, write out the actual corresponding input file line
+   number instead of "1".
+
+   Fixes .  Thanks to Bjarni
+   Ingi Gislason for the report.  Problem introduced by me in
+   commit 25ef9f6bda, 26 February.
+
 2025-03-21  G. Branden Robinson 
 
[tbl]: Regression-test Savannah #66931.
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index a6e8d229d..5c7ee13fb 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -3208,8 +3208,8 @@ void set_troff_location(const char *fn, int ln)
 string filename(fn);
 filename += '\0';
 normalize_for_lf(filename);
-printfs(".lf 1 %1%2\n", ('"' == filename[0]) ? "" : "\"",
-   filename.contents());
+printfs(".lf %1 %2%3\n", as_string(ln),
+   ('"' == filename[0]) ? "" : "\"", filename.contents());
 
 last_filename = fn;
 location_force_filename = 0;

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit


[groff] 02/18: [doc,man]: Document new `pchar` behavior.

2025-03-22 Thread G. Branden Robinson
gbranden pushed a commit to branch master
in repository groff.

commit 9dc194c3435649329c22218d5e55f4ba53243722
Author: G. Branden Robinson 
AuthorDate: Wed Mar 19 23:40:08 2025 -0500

[doc,man]: Document new `pchar` behavior.
---
 doc/groff.texi.in| 8 
 man/groff.7.man  | 9 +
 man/groff_diff.7.man | 9 +
 3 files changed, 26 insertions(+)

diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 692f7567b..6116219ce 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -17692,6 +17692,14 @@ information about each ordinary,
 special,
 or indexed
 character@tie{}@var{c}.
+A character defined by a request
+(@code{char},
+@code{fchar},
+@code{fschar},
+or
+@code{schar}),
+reports its contents as a @acronym{JSON}-encoded string,
+but the output is not otherwise in @acronym{JSON} format.
 @endDefreq
 
 @Defreq {pcolor, [@Var{col} @r{@dots{}}]}
diff --git a/man/groff.7.man b/man/groff.7.man
index 0421225ab..adb04bacb 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -4099,6 +4099,15 @@ to the standard error stream,
 information about each ordinary or special
 .RI character\~ c .
 .
+A character defined by a request
+.RB ( char ,
+.BR \%fchar ,
+.BR \%fschar ,
+or
+.BR \%schar ),
+reports its contents as a JSON-encoded string,
+but the output is not otherwise in JSON format.
+.
 .TPx
 .REQ .pcolor
 Report,
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index 516ad4b11..78ecab57e 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -3351,6 +3351,15 @@ special,
 or indexed
 .RI character\~ c .
 .
+A character defined by a request
+.RB ( char ,
+.BR \%fchar ,
+.BR \%fschar ,
+or
+.BR \%schar ),
+reports its contents as a JSON-encoded string,
+but the output is not otherwise in JSON format.
+.
 .
 .TP
 .BR .pcolor \~[\c

___
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit