[groff] 14/16: [troff]: Drop `phcode` request.

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

commit 881a436e9ee00e131031b59b1471d715176bf634
Author: G. Branden Robinson 
AuthorDate: Tue Feb 4 05:53:31 2025 -0600

[troff]: Drop `phcode` request.

...introduced on 4 November.  The experimental new `pchar` request
handles that job and more.

* src/roff/troff/input.cpp (report_hyphenation_codes): Drop request
  handler.

  (init_input_requests): Unwire `phcode` request from handler.

* src/utils/grog/grog.pl (interpret_line): Unrecognize `phcode` as a GNU
  troff request.

* NEWS: Drop item.
* doc/groff.texi.in (Manipulating Hyphenation, Debugging):
* man/groff.7.man (Request short reference, Debugging):
* man/groff_diff.7.man (New requests, Debugging): Replace documentation
  of `phcode` with terse documentation of `pchar`, noting its
  experimental status.
---
 ChangeLog| 19 +++
 NEWS |  3 ---
 doc/groff.texi.in| 17 +
 man/groff.7.man  | 18 +-
 man/groff_diff.7.man | 28 +---
 src/roff/troff/input.cpp | 38 --
 src/utils/grog/grog.pl   |  2 +-
 7 files changed, 51 insertions(+), 74 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ddb08d0de..e0be30d76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2025-02-04  G. Branden Robinson 
+
+   Drop `phcode` request introduced on 4 November.  The
+   experimental new `pchar` request handles that job and more.
+
+   * src/roff/troff/input.cpp (report_hyphenation_codes): Drop
+   request handler.
+   (init_input_requests): Unwire `phcode` request from handler.
+
+   * src/utils/grog/grog.pl (interpret_line): Unrecognize `phcode`
+   as a GNU troff request.
+
+   * NEWS: Drop item.
+   * doc/groff.texi.in (Manipulating Hyphenation, Debugging):
+   * man/groff.7.man (Request short reference, Debugging):
+   * man/groff_diff.7.man (New requests, Debugging): Replace
+   documentation of `phcode` with terse documentation of `pchar`,
+   noting its experimental status.
+
 2025-02-04  G. Branden Robinson 
 
[troff]: Add experimental charinfo dump feature.
diff --git a/NEWS b/NEWS
index bf71f3a35..d9efeb4d5 100644
--- a/NEWS
+++ b/NEWS
@@ -174,9 +174,6 @@ troff
 *  A new request, `pcomposite`, reports to the standard error stream the
list of defined composite characters.
 
-*  A new request, `phcode`, reports to the standard error stream the
-   hyphenation code of each ordinary or special character argument.
-
 *  A new request, `phw`, reports to the standard error stream the
list of hyphenation exceptions associated with the current
hyphenation language.
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 38c594d93..07e38da05 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -9084,8 +9084,8 @@ with a hyphenation code value of zero to it.  For 
example, @samp{.hcode
 � $} removes the hyphenation code from @samp{�} (unless @samp{$} has
 already been assigned a different one).
 
-The @code{phcode} request may be helpful to troubleshoot hyphenation
-code assignments.  @xref{Debugging}.
+The experimental @code{pchar} request may be helpful to troubleshoot
+hyphenation code assignments.  @xref{Debugging}.
 @endDefreq
 
 @Defreq {hpfcode, a b [c d] @dots{}}
@@ -17458,6 +17458,13 @@ If you know in advance that there are many errors and 
no useful output,
 or are interested @emph{only} in diagnostic output, you can suppress GNU
 @code{troff}'s formatted output with its @option{-z} option.
 
+@Defreq {pchar, c @r{@dots{}}}
+Report,
+to the standard error stream,
+information about each ordinary or special
+character@tie{}@var{c}.
+@endDefreq
+
 @Defreq {pcolor, [@Var{col} @r{@dots{}}]}
 @cindex dumping defined colors (@code{pcolor})
 @cindex defined colors, dumping (@code{pcolor})
@@ -17486,12 +17493,6 @@ Report the state of the current environment followed 
by that of all
 other environments to the standard error stream.
 @endDefreq
 
-@Defreq {phcode, c @r{@dots{}}}
-Report, to the standard error stream, the hyphenation code of each
-ordinary or special character@tie{}@var{c}.  Special characters are
-listed in bracketed syntax using the default escape character.
-@endDefreq
-
 @Defreq {phw, }
 @cindex dumping hyphenation exceptions (@code{phw})
 @cindex hyphenation exceptions, dumping (@code{phw})
diff --git a/man/groff.7.man b/man/groff.7.man
index 76f2f356a..2ac7e67ca 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -4035,6 +4035,13 @@ Change the page number character used in titles
 .RI to\~ c .
 .
 .TPx
+.REQ .pchar "c \fR\&.\|.\|.\&\fP"
+Report,
+to the standard error stream,
+information about each ordinary or special
+.RI character\~ c .
+.
+.TPx
 .REQ .pcolor
 Report,
 to the standard error stream,
@@ -4071,13 +4078,6 @@ Report the state of the current environment f

[groff] 07/16: doc/groff.texi.in: Drop extraneous word.

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

commit af04d5aeba6464209edfddc62d746ba28abe13e6
Author: G. Branden Robinson 
AuthorDate: Thu Jan 30 08:15:40 2025 -0600

doc/groff.texi.in: Drop extraneous word.
---
 doc/groff.texi.in | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index c993e3357..105b719eb 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -17924,7 +17924,6 @@ Some syntactical and behavioral differences between GNU 
and
 are thought too important to neglect;
 GNU
 @command{troff} @c GNU
-@code{groff}
 therefore makes available a
 @dfn{compatibility mode}
 in an effort to keep documents prepared for AT&T

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


[groff] 10/16: [troff]: Improve diagnostic messages.

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

commit 31144d6d0ef60464f84de22b64055841e5b0c1bc
Author: G. Branden Robinson 
AuthorDate: Tue Feb 4 04:31:31 2025 -0600

[troff]: Improve diagnostic messages.

* src/roff/troff/input.cpp (token::description): When describing special
  character, include its identifier.
---
 ChangeLog|  5 +
 src/roff/troff/input.cpp | 13 +++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b87a39d04..e1116e1a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-02-02  G. Branden Robinson 
+
+   * src/roff/troff/input.cpp (token::description): When describing
+   special character, include its identifier.
+
 2025-01-28  G. Branden Robinson 
 
* src/roff/troff/input.cpp (is_char_usable_as_delimiter):
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 9f82c2a84..d0a3e916f 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2686,7 +2686,11 @@ bool token::is_usable_as_delimiter(bool report_error)
 
 const char *token::description()
 {
-  const size_t bufsz = sizeof "character code XXX (U+)" + 1;
+  // Reserve a buffer large enough to handle the two lengthiest cases.
+  //   "character code XXX (U+)"
+  //   "special character 'bracketrighttp'"
+  const size_t maxstr = sizeof "special character 'bracketrighttp'";
+  const size_t bufsz = maxstr + 2; // for trailing '"' and null
   static char buf[bufsz];
   (void) memset(buf, 0, bufsz);
   switch (type) {
@@ -2734,7 +2738,12 @@ const char *token::description()
   case TOKEN_SPACE:
 return "a space";
   case TOKEN_SPECIAL_CHAR:
-return "a special character";
+// TODO: This truncates the names of impractically long special
+// character names.  Do something about that.  (The truncation is
+// visually indicated by the absence of a closing quotation mark.)
+(void) snprintf(buf, maxstr, "special character \"%s\"",
+   nm.contents());
+return buf;
   case TOKEN_SPREAD:
 return "an escaped 'p'";
   case TOKEN_STRETCHABLE_SPACE:

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


[groff] 13/16: [troff]: Add experimental charinfo dump feature.

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

commit d84dd6ddc7b14fe2d79d1e4542b294e2fbcfa065
Author: G. Branden Robinson 
AuthorDate: Tue Feb 4 05:36:08 2025 -0600

[troff]: Add experimental charinfo dump feature.

* src/roff/troff/charinfo.h (class charinfo): Declare `dump()` member
  function, taking and returning no arguments.

* src/roff/troff/input.cpp (charinfo::dump): Implement it.

  (report_character_request): Add request handler that iterates each
  ordinary or special character in the argument and calls `dump()` on
  it.

  (init_input_requests): Wire up `pchar` request to handler.
---
 ChangeLog | 13 
 src/roff/troff/charinfo.h |  1 +
 src/roff/troff/input.cpp  | 53 +++
 3 files changed, 67 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index f1fcffd2f..ddb08d0de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2025-02-04  G. Branden Robinson 
+
+   [troff]: Add experimental charinfo dump feature.
+
+   * src/roff/troff/charinfo.h (class charinfo): Declare `dump()`
+   member function, taking and returning no arguments.
+
+   * src/roff/troff/input.cpp (charinfo::dump): Implement it.
+   (report_character_request): Add request handler that iterates
+   each ordinary or special character in the argument and calls
+   `dump()` on it.
+   (init_input_requests): Wire up `pchar` request to handler.
+
 2025-02-04  G. Branden Robinson 
 
* src/roff/troff/input.cpp (define_character): Refactor and
diff --git a/src/roff/troff/charinfo.h b/src/roff/troff/charinfo.h
index b44a53f40..fecd10347 100644
--- a/src/roff/troff/charinfo.h
+++ b/src/roff/troff/charinfo.h
@@ -111,6 +111,7 @@ public:
   bool contains(int, bool = false);
   bool contains(symbol, bool = false);
   bool contains(charinfo *, bool = false);
+  void dump();
 };
 
 charinfo *get_charinfo(symbol);
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index f9406fd50..5c350101f 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -4680,6 +4680,29 @@ static void define_special_character_request()
   define_character(CHAR_SPECIAL_FALLBACK);
 }
 
+static void report_character_request()
+{
+  if (!has_arg()) {
+warning(WARN_MISSING, "character report request expects arguments");
+skip_line();
+return;
+  }
+  charinfo *ci;
+  do {
+ci = tok.get_char();
+if (0 /* nullptr */ == ci)
+  warning(WARN_CHAR, "%1 is not a character", tok.description());
+else {
+  // A charinfo doesn't know the name by which it is accessed.
+  errprint("%1\n", tok.description());
+  fflush(stderr);
+  ci->dump();
+}
+tok.next();
+  } while (!tok.is_newline() && !tok.is_eof());
+  skip_line();
+}
+
 static void remove_character()
 {
   if (!has_arg()) {
@@ -9415,6 +9438,7 @@ void init_input_requests()
   init_request("opena", opena_request);
   init_request("output", output_request);
   init_request("pc", set_page_character);
+  init_request("pchar", report_character_request);
   init_request("pcolor", report_color);
   init_request("pcomposite", report_composite_characters);
   init_request("phcode", report_hyphenation_codes);
@@ -10186,6 +10210,35 @@ bool charinfo::contains(charinfo *, bool)
   return false;
 }
 
+void charinfo::dump()
+{
+  if (translation != 0 /* nullptr */)
+errprint("  is translated\n");
+  else
+errprint("  is not translated\n");
+  if (mac != 0 /* nullptr */)
+errprint("  has a macro\n");
+  else
+errprint("  does not have a macro\n");
+  errprint("  special translation: %1\n",
+  static_cast(special_translation));
+  errprint("  hyphenation code: %1\n",
+  static_cast(hyphenation_code));
+  errprint("  flags: %1\n", flags);
+  errprint("  ASCII code: %1\n", static_cast(ascii_code));
+  errprint("  asciify code: %1\n", static_cast(asciify_code));
+  errprint("  is%1 found\n", is_not_found ? " not" : "");
+  errprint("  is%1 transparently translatable\n",
+  is_transparently_translatable ? "" : " not");
+  errprint("  is%1 translatable as input\n",
+  translatable_as_input ? "" : " not");
+  const char *modestr = character_mode_description(mode);
+  if (strcmp(modestr, "") == 0)
+modestr =" normal";
+  errprint("  mode:%1\n", modestr);
+  fflush(stderr);
+}
+
 symbol UNNAMED_SYMBOL("---");
 
 // For numbered characters not between 0 and 255, we make a symbol out

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


[groff] 09/16: groff_man_style(7): Tweak example code style.

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

commit 8225abb1c23a5fc8ba02648d2729c2dba17eaa27
Author: G. Branden Robinson 
AuthorDate: Sun Feb 2 06:21:37 2025 -0600

groff_man_style(7): Tweak example code style.

Make example string definitions more robust by suffixing them with
comment escape sequences.  This way trailing spaces won't be absorbed
into the definition itself and cause confusion when interpolated.
---
 tmac/groff_man.7.man.in | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tmac/groff_man.7.man.in b/tmac/groff_man.7.man.in
index 4742ac654..2945fe314 100644
--- a/tmac/groff_man.7.man.in
+++ b/tmac/groff_man.7.man.in
@@ -4584,12 +4584,12 @@ call as follows.
 .RS
 .EX
 \&.ie \[rs]n(.g \[rs]{\[rs]
-\&.  ds oq \[rs](oq
-\&.  ds cq \[rs](cq
+\&.  ds oq \[rs](oq\[rs]"
+\&.  ds cq \[rs](cq\[rs]"
 \&.\[rs]}
 \&.el \[rs]{\[rs]
-\&.  ds oq \[ga]
-\&.  ds cq \[aq]
+\&.  ds oq \[ga]\[rs]"
+\&.  ds cq \[aq]\[rs]"
 \&.\[rs]}
 .EE
 .RE

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


[groff] 08/16: [doc,man]: Restore | to forbidden delimiter list.

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

commit ec34f01715bee231e9838b0c5702c76364c633a3
Author: G. Branden Robinson 
AuthorDate: Thu Jan 30 08:17:14 2025 -0600

[doc,man]: Restore | to forbidden delimiter list.

Not really forbidden, but deprecated -- and silently accepted anyway in
compatibility mode.

See Savannah #66686.
---
 doc/groff.texi.in| 2 +-
 man/groff_diff.7.man | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 105b719eb..38c594d93 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -18050,7 +18050,7 @@ accepts several characters as delimiters that it 
ordinarily rejects,
 because they are meaningful in numeric expressions and therefore
 potentially ambiguous to the document maintainer.
 The set of additional delimiters comprises
-@samp{0123456789+-/*%<>=&:().}.
+@samp{0123456789+-/*%<>=&:().|}.
 
 @cindex input level in delimited arguments
 @cindex interpolation depth in delimited arguments
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index 6b1d12f04..dba8367e2 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -5846,7 +5846,7 @@ because they are meaningful in numeric expressions and 
therefore
 potentially ambiguous to the document maintainer.
 .
 The set of additional delimiters comprises
-.RB \[lq] 0123456789+\-/*%<>=&:(). \[rq].
+.RB \[lq] 0123456789+\-/*%<>=&:().| \[rq].
 .
 .
 .\" 

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


[groff] 04/16: [doc,man]: Clarify use of `0` in `\s` escape seqs.

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

commit 9dc97f3dc82b54e34d8f2270efbf57d1aa89d17f
Author: G. Branden Robinson 
AuthorDate: Thu Jan 30 07:22:02 2025 -0600

[doc,man]: Clarify use of `0` in `\s` escape seqs.

More clearly separate the discussion of the `ps` request from the `\s`
escape sequence, _because_ they treat a zero argument differently.
---
 doc/groff.texi.in| 24 ++--
 man/groff.7.man  |  3 +++
 man/groff_diff.7.man |  6 ++
 3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index eda412d9f..6211a415f 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -12195,8 +12195,7 @@ used lead metal (Latin @emph{plumbum}).}
 
 @DefreqList {ps, [@Var{size}]}
 @DefreqItem {ps, @t{+}@Var{size}}
-@DefreqItem {ps, @t{-}@Var{size}}
-@DefescItemx {\\s, , size, }
+@DefreqItemx {ps, @t{-}@Var{size}}
 @DefregListEndx {.s}
 @cindex changing type sizes (@code{ps}, @code{\s})
 @cindex type sizes, changing (@code{ps}, @code{\s})
@@ -12225,8 +12224,14 @@ size in points as a decimal fraction; it is associated 
with the
 environment (@pxref{Environments}).  To obtain the type size in scaled
 points, interpolate the @code{.ps} register instead (@pxref{Using
 Fractional Type Sizes}).
+@endDefreq
 
-The @code{\s} escape sequence supports a variety of syntax forms.
+@Defesc {\\s, , size, }
+The
+@code{\s}
+escape sequence also determines the type size,
+but handles a zero argument differently.
+It supports a variety of syntax forms.
 
 @table @code
 @item \s@var{n}
@@ -12234,6 +12239,7 @@ Set the type size to @var{n}@tie{}scaled points.  
@var{n}@tie{}must be a
 single digit.@footnote{In compatibility mode only, a non-zero @var{n}
 must be in the range 4--39.  @xref{Compatibility Mode}.}
 If @var{n}@tie{}is
+an unsigned
 @samp{0},
 restore the previous size.
 
@@ -12246,6 +12252,7 @@ Increase or decrease the type size by 
@var{n}@tie{}scaled points.
 Set the type size to @var{nn}@tie{}scaled points.  @var{nn} must be
 exactly two digits.
 If @var{n}@tie{}is
+an unsigned
 @samp{00},
 restore the previous size.
 
@@ -12267,7 +12274,7 @@ grin, grin,
 wink, wink, \s+2nudge, nudge,\s+8 say no more!
 .ps 10
 @endExample
-@endDefreq
+@endDefesc
 
 @cindex @code{\s} escape sequence, untokenized on input
 @cindex untokenized escape sequence, @code{\s}
@@ -12508,8 +12515,13 @@ numeric expression with a default scaling unit of 
@samp{z}.
 @itemx \s+'@var{n}'
 @itemx \s-'@var{n}'
 Increase or decrease the type size by @var{n}@tie{}scaled points;
-@var{n}@tie{}is a numeric expression (which may start with a minus sign)
-with a default scaling unit of @samp{z}.
+@var{n}@tie{}is
+a numeric expression with a default scaling unit of
+@samp{z}.
+If @var{n}@tie{}is
+an unsigned
+@samp{0},
+restore the previous size.
 @end table
 
 
diff --git a/man/groff.7.man b/man/groff.7.man
index 3533ee394..76f2f356a 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -5658,6 +5658,7 @@ must be a single digit.
 .
 If
 .IR n \~is
+an unsigned
 \[lq]0\[rq],
 restore the previous size.
 .
@@ -5684,6 +5685,7 @@ is a two-digit number \[>=]1.
 .
 If
 .IR n \~is
+an unsigned
 \[lq]00\[rq],
 restore the previous size.
 .
@@ -5707,6 +5709,7 @@ scaled points.
 .
 If
 .IR n \~is
+an unsigned
 \[lq]0\[rq]
 (with any number of leading zeroes),
 restore the previous size.
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index 8ac178968..6b1d12f04 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -1101,6 +1101,12 @@ or increment or decrement it by,
 .I n
 scaled points.
 .
+If
+.IR n \~is
+an unsigned
+.RB \[lq] 0 \[rq],
+restore the previous size.
+.
 .
 .br
 .ne 5v

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


[groff] 16/16: [groff]: Mark test of Savannah #66387 as XFAIL.

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

commit e64431525d8685bd159321e8c04ea4cf0de89863
Author: G. Branden Robinson 
AuthorDate: Fri Feb 7 18:59:52 2025 -0600

[groff]: Mark test of Savannah #66387 as XFAIL.

* src/roff/groff/groff.am (groff_XFAIL_TESTS): Add
  ".../current-language-and-environment-in-sync.sh".
---
 ChangeLog   | 5 +
 src/roff/groff/groff.am | 1 +
 2 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 24581da80..21599ae0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-02-07  G. Branden Robinson 
+
+   * src/roff/groff/groff.am (groff_XFAIL_TESTS): Add
+   ".../current-language-and-environment-in-sync.sh".
+
 2025-02-04  G. Branden Robinson 
 
Drop `phcode` request introduced on 4 November.  The
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index e8e25f5fb..452007b74 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -112,6 +112,7 @@ EXTRA_DIST += \
   src/roff/groff/tests/artifacts/devascii/README
 
 groff_XFAIL_TESTS = \
+  src/roff/groff/tests/current-language-and-environment-in-sync.sh \
   src/roff/groff/tests/stringup-request-transforms-non-basic-latin.sh
 XFAIL_TESTS += $(groff_XFAIL_TESTS)
 

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


[groff] 15/16: [troff]: Revert most of Savannah #66387 fix.

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

commit 7f643d1f765c53437471207ffbff11d01e38f57e
Author: G. Branden Robinson 
AuthorDate: Fri Feb 7 18:50:18 2025 -0600

[troff]: Revert most of Savannah #66387 fix.

Retain unit test, which fails at this commit.

See Savannah #66392 for background.
---
 ChangeLog  | 39 +++
 src/roff/troff/env.cpp | 45 +++--
 src/roff/troff/env.h   |  4 
 3 files changed, 6 insertions(+), 82 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e0be30d76..24581da80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2602,47 +2602,14 @@
 
 2024-10-31  G. Branden Robinson 
 
-   [troff]: Couple the current hyphenation language more tightly
-   with the environment.  This is to ease maintenance of
-   multilingual documents, and address a curious situation where an
-   environment could bear an automatic hyphenation code that had
-   nothing to do with the selected hyphenation language, because
-   the `hla` request has to date never altered the environment.
-
-   * src/roff/troff/env.h (class environment): Add private member
-   variable `language_code` of type `symbol`.  Declare public
-   member functions `get_language_code()` and
-   `set_language_code()`.  Declare `environment_switch()` as a
-   friend function.
-   * src/roff/troff/env.cpp (environment::environment): Plain
-   constructor initializes `language_code` as empty string.
-   (environment::environment): Copy constructor copies the language
-   code from the source object.
-   (environment::copy): Member function backing `evc` request
-   copies the language code from the source environment.
-   (environment::print_env): Report the hyphenation language code
-   in use by the environment.  Clarify when the automatic
-   hyphenation mode is ignored because no hyphenation language is
-   configured in the environment.
-   (select_hyphenation_language): When the `hla` request is called
-   without an argument, set the current environment's hyphenation
-   language code to the empty string.  With an argument, update the
-   environment's hyphenation to the value of the argument.  Add
-   assertions prior to function return to enforce invariants: (1)
-   the current environment's hyphenation language code must not be
-   null and (2) the `current_language` global variable and the
-   current environment's hyphenation language code must agree.
-   (environment_copy, environment_switch): Set the
-   `current_language` global variable to current environment's
-   hyphenation language code.
-   (environment::get_language_code): Implement accessor.
-   (environment::set_language_code): Implement mutator.
+   Add test of hyphenation language as a global vs. environmental
+   property.
 
* src/roff/groff/tests/\
current-language-and-environment-in-sync.sh: Add unit test.
* src/roff/groff/groff.am (groff_TESTS): Run test.
 
-   Fixes .
+   See .
 
 2024-10-30  G. Branden Robinson 
 
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 0e83cf46a..4abb05f56 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -787,7 +787,6 @@ environment::environment(symbol nm)
   line_number_indent(0),
   line_number_multiple(1),
   no_number_count(0),
-  language_code(""),
   hyphenation_mode(1),
   hyphenation_mode_default(1),
   hyphen_line_count(0),
@@ -882,7 +881,6 @@ environment::environment(const environment *e)
   line_number_indent(e->line_number_indent),
   line_number_multiple(e->line_number_multiple),
   no_number_count(e->no_number_count),
-  language_code(e->language_code),
   hyphenation_mode(e->hyphenation_mode),
   hyphenation_mode_default(e->hyphenation_mode_default),
   hyphen_line_count(0),
@@ -970,7 +968,6 @@ void environment::copy(const environment *e)
   no_number_count = e->no_number_count;
   tab_char = e->tab_char;
   leader_char = e->leader_char;
-  set_language_code(e->language_code.contents());
   hyphenation_mode = e->hyphenation_mode;
   hyphenation_mode_default = e->hyphenation_mode_default;
   fontno = e->fontno;
@@ -3553,10 +3550,6 @@ void environment::print_env()
 errprint("  lines remaining for which to suppress numbering: %1\n",
 no_number_count);
   }
-  const char *hl = language_code.contents();
-  bool is_hyphenation_impossible = language_code.is_empty();
-  errprint("  hyphenation language code: %1\n",
-  is_hyphenation_impossible ? "(none)" : hl);
   string hf = hyphenation_mode ? "on" : "off";
   if (hyphenation_mode & HYPHEN_NOT_LAST_LINE)
 hf += ", not on line before vertical position trap";
@@ -3569,10 +3562,8 @@ void environment::print_env()
   if (hyphenation_mode & HYPHEN_NOT_

[groff] 01/16: ChangeLog: Fix thinko and typo.

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

commit 29dbcf5c5e9bf0f9f87791f51ee2609ec112721b
Author: G. Branden Robinson 
AuthorDate: Wed Jan 29 23:29:22 2025 -0600

ChangeLog: Fix thinko and typo.
---
 ChangeLog | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f76bcfcc9..b87a39d04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,7 +16,7 @@
 
(is_conditional_expression_true): Stop special-casing an
exception for `|` that permitted it to be used as a formatted
-   output comparison operator.  Savannah #66481 complained only
+   output comparison delimiter.  Savannah #66481 complained only
about groff's rejection of `|` to delimit the argument to the
`\w` (width measurement) escape sequence, not in general, and
was seen in some man pages.  The usage Paul Eggert reported
@@ -134,7 +134,7 @@
 
[troff]: Trivially refactor.  Rename character-definition
request handler functions to end with `_request`, and rename the
-   workhorse function to simple `define_character`.  Mark them all
+   workhorse function to simply `define_character`.  Mark them all
`static` (except for `define_font_specific_character`, which
already was) while we're at it.
 

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


[groff] 11/16: [troff]: Refactor.

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

commit bc834eca0fcc0e4c0b27b0eeeb94d9a85a5af40a
Author: G. Branden Robinson 
AuthorDate: Tue Feb 4 04:53:47 2025 -0600

[troff]: Refactor.

* src/roff/troff/input.cpp: Refactor.

  (define_character): Break out character mode description logic from
  here...

  (character_mode_description): ...into this new function, since a
  forthcoming change will also require it.
---
 ChangeLog|  8 
 src/roff/troff/input.cpp | 10 --
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e1116e1a3..20936512b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-02-04  G. Branden Robinson 
+
+   * src/roff/troff/input.cpp: Refactor.
+   (define_character): Break out character mode description logic
+   from here...
+   (character_mode_description): ...into this new function, since a
+   forthcoming change will also require it.
+
 2025-02-02  G. Branden Robinson 
 
* src/roff/troff/input.cpp (token::description): When describing
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index d0a3e916f..32b158ffb 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -4569,10 +4569,10 @@ void append_nocomp_string()
   do_define_string(DEFINE_APPEND, COMP_DISABLE);
 }
 
-void define_character(char_mode mode, const char *font_name)
+static const char *character_mode_description(char_mode mode)
 {
   // C++11: There may be a better way to do this with an enum class;
-  // we could then store these constants inside `char_mode`.
+  // we could then store these string literals inside `char_mode`.
   const char *modestr = 0 /* nullptr */;
   switch (mode) {
 case CHAR_NORMAL:
@@ -4591,6 +4591,12 @@ void define_character(char_mode mode, const char 
*font_name)
   assert(0 == "unhandled case of character mode");
   break;
   }
+  return modestr;
+}
+
+void define_character(char_mode mode, const char *font_name)
+{
+  const char *modestr = character_mode_description(mode);
   node *n = 0 /* nullptr */;
   int c;
   tok.skip();

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


[groff] 03/16: [doc,man]: The plural of "zero" is "zeroes".

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

commit 1df13b8c6d399cab27df6e46345698941c441a91
Author: G. Branden Robinson 
AuthorDate: Thu Jan 30 06:59:20 2025 -0600

[doc,man]: The plural of "zero" is "zeroes".

By analogy with "archipelagoes", "avocadoes", "banjoes", "cargoes",
"echoes", "(ice) floes", "foes", "heroes", "hoes", "(death) throes",
"tomatoes"...you get the idea.  This orthography also helps to mark the
word as not being a loan from classical Greek.
---
 doc/groff.texi.in| 2 +-
 man/groff_diff.7.man | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 6927a8a88..eda412d9f 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -8027,7 +8027,7 @@ Count of available unused registers; in GNU 
@command{troff} this
 register always interpolates the maximum representable
 integer.@footnote{GNU @command{troff} dynamically allocates memory for as
 many registers as required.}  Favor its use over numeric literals with
-many zeros or nines to indicate an arbitrary large quantity.
+many zeroes or nines to indicate an arbitrary large quantity.
 
 @item \n[.T]
 @vindex .T
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index 579479189..8ac178968 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -4338,7 +4338,7 @@ it repurposes the
 register
 to interpolate the maximum integer representable in the formatter.
 .
-Favor its use over numeric literals with many zeros or nines
+Favor its use over numeric literals with many zeroes or nines
 to indicate an arbitrary large quantity.
 .
 .

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


[groff] 05/16: contrib/mm/ChangeLog: Fix notation in old entries.

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

commit 8d437980ef156f51f89b7c3d23e6b3a3832fe6f9
Author: G. Branden Robinson 
AuthorDate: Wed Jan 29 23:26:47 2025 -0600

contrib/mm/ChangeLog: Fix notation in old entries.

...but only those made after the groff 1.23.0 release.
---
 contrib/mm/ChangeLog | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index a78e64401..ce1377061 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -269,7 +269,7 @@
 
 2024-10-12  G. Branden Robinson 
 
-   * m.tmac (initialization): Refactor.  Drop never-interpolated
+   * m.tmac ([initialization]): Refactor.  Drop never-interpolated
register `par*num-counter`.
(par@reset-num): This macro was called in only one place, so
delete it...
@@ -300,7 +300,7 @@
* m.tmac: Support new `Rpfmt` string specifying the `LB` macro
arguments that the package uses to format the items in a
reference list.
-   (initialization): Define it.
+   ([initialization]): Define it.
(ref@start-print): Use it.
 
* groff_mm.7.man (Macros) : Cross reference `Rpfmt` register
@@ -360,8 +360,8 @@
in a document to obtain groff mm's previous mark formatting
behavior.
 
-   * m.tmac (initialization): Assign zero to `Rfstyle`.  Define new
-   `ref*{n,t}roff-{(,)}` strings.  Define `Rf` in terms of new
+   * m.tmac ([initialization]): Assign zero to `Rfstyle`.  Define
+   new `ref*{n,t}roff-{(,)}` strings.  Define `Rf` in terms of new
`ref*(` and `ref*)` strings below.  Call `ref*set-mark-style`.
(ref*set-mark-style): New macro maps a `Rfstyle` to 1
{nroff-style} or 2 {troff-style} as described above and defines
@@ -415,7 +415,7 @@
 
 2024-10-09  G. Branden Robinson 
 
-   * m.tmac (initialization, LB, LI): Trivially refactor.  Rename
+   * m.tmac ([initialization], LB, LI): Trivially refactor.  Rename
internal string `li*mark` to `li*mf`, since it can be _either_
an arbitrary string _or_ an argument to the `af` request.
 
@@ -931,7 +931,7 @@
logical indentation when formatting output.
(cov@print-abstract):  Favor font selection requests over escape
sequences.
-   (initialization): Define several registers to vertically and
+   ([initialization]): Define several registers to vertically and
horizontally arrange the document metadata.  Adjust vertical
spacing around abstract and its caption.  Favor font selection
requests over escape sequences.
@@ -1038,7 +1038,7 @@
auxiliary author information optionally present in `AU` macro
calls.
 
-   * m.tmac (initialization, AV, let@print-head):
+   * m.tmac ([initialization], AV, let@print-head):
* mm/0.MT (cov@print-title, cov@print-authors, cov@print-date):
* mm/5.MT (cov@print-date):
* mm/ms.cov (cov@print-date): Do it.

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


[groff] 06/16: doc/groff.texi.in: Recast type size material.

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

commit da0003c064477018f9b5bf567c020de837f9f5cd
Author: G. Branden Robinson 
AuthorDate: Thu Jan 30 07:32:17 2025 -0600

doc/groff.texi.in: Recast type size material.

* Speak of "the formatter", not "GNU troff", which discussing general
  truths about *roff behavior.
* Stop overusing "thus".
* Break input lines for happier diffing and parallelization with
  (anticipated) man(7)ification.
---
 doc/groff.texi.in | 30 +++---
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 6211a415f..c993e3357 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -12202,10 +12202,12 @@ used lead metal (Latin @emph{plumbum}).}
 @cindex point sizes, changing (@code{ps}, @code{\s})
 Set (increase, decrease) the type size to (by) @var{size} scaled points.
 @code{ps} with no argument restores the previous size.  The @code{ps}
-request's default scaling unit is @samp{z}.  The requested size is
-rounded to the nearest valid size (with ties rounding down) within the
-limits supported by the device.  If the requested size is non-positive,
-it is treated as 1@dmn{u}.
+request's default scaling unit is @samp{z}.
+The formatter rounds the requested size to the nearest valid size
+(with ties rounding down)
+within the limits supported by the device,
+and if the requested size is non-positive,
+treats it as 1@dmn{u}.
 
 @cindex CSTR@tie{}#54 errata
 @cindex CSTR@tie{}#54 erratum, @code{ps} request
@@ -12278,9 +12280,12 @@ wink, wink, \s+2nudge, nudge,\s+8 say no more!
 
 @cindex @code{\s} escape sequence, untokenized on input
 @cindex untokenized escape sequence, @code{\s}
-@code{\s} is not tokenized when GNU @code{troff} reads its input; it
-instead updates the environment.  It thus can be used in requests that
-expect a single-character argument.  We can thus alter the type size
+The formatter does not tokenize
+@code{\s}
+when reading its input;
+it instead updates the environment.
+It thus can be used in requests that expect a single-character argument.
+We might alter the type size
 when writing a margin character as follows (@pxref{Miscellaneous}).
 
 @Example
@@ -12495,10 +12500,13 @@ points, the output driver uses the latter value.
 @cindex changing type sizes (@code{ps}, @code{\s})
 @cindex type sizes, changing (@code{ps}, @code{\s})
 @cindex point sizes, changing (@code{ps}, @code{\s})
-The @code{\s} escape sequence offers the following syntax forms that
-work with fractional type sizes and accept scaling units.  You may of
-course give them integral arguments.  The delimited forms need not use
-the neutral apostrophe; see @ref{Delimiters}.
+The
+@code{\s}
+escape sequence offers the following syntax forms
+that work with fractional type sizes and accept scaling units.
+You may of course give them dimensionless integral arguments.
+The delimited forms need not use the neutral apostrophe;
+see @ref{Delimiters}.
 
 @table @code
 @item \s[@var{n}]

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


[groff] 12/16: [troff]: Refactor and annotate.

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

commit b4532353dcb95a31404e803064c1e6674f2b2f94
Author: G. Branden Robinson 
AuthorDate: Tue Feb 4 05:16:23 2025 -0600

[troff]: Refactor and annotate.

* src/roff/troff/input.cpp (define_character): Declare variables closer
  to their point of use.  Reorder conditional branches to put the more
  common case first.  Use C++ `static_cast` operator instead of C-style
  type cast.
---
 ChangeLog|  7 +++
 src/roff/troff/input.cpp | 13 -
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 20936512b..f1fcffd2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-02-04  G. Branden Robinson 
+
+   * src/roff/troff/input.cpp (define_character): Refactor and
+   annotate.  Declare variables closer to their point of use.
+   Reorder conditional branches to put the more common case first.
+   Use C++ `static_cast` operator instead of C-style type cast.
+
 2025-02-04  G. Branden Robinson 
 
* src/roff/troff/input.cpp: Refactor.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 32b158ffb..f9406fd50 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -4597,8 +4597,6 @@ static const char *character_mode_description(char_mode 
mode)
 void define_character(char_mode mode, const char *font_name)
 {
   const char *modestr = character_mode_description(mode);
-  node *n = 0 /* nullptr */;
-  int c;
   tok.skip();
   charinfo *ci = tok.get_char(true /* required */);
   if (0 /* nullptr */ == ci) {
@@ -4613,6 +4611,8 @@ void define_character(char_mode mode, const char 
*font_name)
 ci = get_charinfo(symbol(s.contents()));
   }
   tok.next();
+  int c;
+  node *n = 0 /* nullptr */;
   if (tok.is_newline())
 c = '\n';
   else if (tok.is_tab())
@@ -4631,13 +4631,16 @@ void define_character(char_mode mode, const char 
*font_name)
   if (c == '"')
 c = get_copy(&n);
   macro *m = new macro;
+  // Construct a macro from input characters; if the input character
+  // code is 0, we've read a node--append that.
   while (c != '\n' && c != EOF) {
-if (c == 0)
-  m->append(n);
+if (c != 0)
+  m->append(static_cast(c));
 else
-  m->append((unsigned char) c);
+  m->append(n);
 c = get_copy(&n);
   }
+  // Assign the macro to the character, discarding any previous macro.
   m = ci->set_macro(m, mode);
   if (m)
 delete m;

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


[groff] 02/16: NEWS: Drop extraneous word.

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

commit 9f4609cb9cee8ac719ed863446eb8d75b590fd49
Author: G. Branden Robinson 
AuthorDate: Thu Jan 30 07:04:27 2025 -0600

NEWS: Drop extraneous word.
---
 NEWS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 621a76397..bf71f3a35 100644
--- a/NEWS
+++ b/NEWS
@@ -638,7 +638,7 @@ Output drivers
containing slashes as a document prolog or resource (such as a font
to be downloaded into the document).  This is a restoration of groff
1.22.4 and earlier behavior; groff's 1.23.0 change of not accepting a
-   file name containing slashes as an encoding or font description files
+   file name containing slashes as an encoding or font description
remains in place.  (We impose this restriction because the output
driver interprets the contents of these files; it does not interpret
the PostScript prolog or resource files.)

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