gbranden pushed a commit to branch master
in repository groff.

commit 071f266af84a5b193d0111e3b8be3d5e24038be9
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Oct 21 23:10:21 2026 -0500

    [troff]: Implement new `.pi` register.
    
    ...for orthogonality and to make the output filtration pipeline readily
    inspectable.
    
    * src/roff/troff/input.cpp (pipe_command_reg): New file-local class
      handles dynamically computed data.  (The class `readonly_text_reg` is
      not appropriate because it has _static_ contents that are computed
      once only, at formatter startup.  The global `pipe_command` is
      populated, and can be updated, by the input stream--until output
      commences.)
    
      (pipe_command_reg::get_string): Member function returns `pipe_command`
      (a C string).
    
    * doc/groff.texi.in (Host System Service Access):
    * man/groff.7.man.in (Read-only registers):
    * man/groff_diff.7.man (New register): Document it.
    
    NEWS: Add item.
---
 ChangeLog                | 18 ++++++++++++++++++
 NEWS                     |  3 +++
 doc/groff.texi.in        | 13 +++++++------
 man/groff.7.man.in       |  6 ++++++
 man/groff_diff.7.man     |  7 +++++++
 src/roff/troff/input.cpp | 11 +++++++++++
 6 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 992156ae1..147922bc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2026-10-21  G. Branden Robinson <[email protected]>
+
+       [troff]: Implement `.pi` register for orthogonality and to make
+       the output filtration pipeline readily inspectable.
+
+       * src/roff/troff/input.cpp (pipe_command_reg): New file-local
+       class handles dynamically computed data.  (The class
+       `readonly_text_reg` is not appropriate because it has _static_
+       contents that are computed once only, at formatter startup.  The
+       global `pipe_command` is populated, and can be updated, by the
+       input stream--until output commences.)
+       (pipe_command_reg::get_string): Member function returns
+       `pipe_command` (a C string).
+
+       * doc/groff.texi.in (Host System Service Access):
+       * man/groff.7.man.in (Read-only registers):
+       * man/groff_diff.7.man (New register): Document it.
+
 2026-10-21  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp (init_input_requests): Trivially
diff --git a/NEWS b/NEWS
index a83e6cd1e..16225d143 100644
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,9 @@ troff
    character codes less than decimal 32 (except 10, the line feed) and
    greater than decimal 127.
 
+*  A new read-only, string-valued register `.pi` reports the output
+   pipeline constructed by one or more `pi` requests.
+
 *  A new read-only register `.ul` reports the count of productive input
    lines remaining to be underlined in the environment (as configured
    by either the `cu` or `ul` requests).
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 6d64dde5a..0ab7be4af 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -22150,7 +22150,8 @@ Dear Mr. Adollar,
 .ex
 @endExample
 
-@Defreq {pi, [@code{"}]@Var{command}}
+@DefreqList {pi, [@code{"}]@Var{command}}
+@DefregListEndx {.pi}
 Use
 the formatter's device-independent output
 as the input to the commands specified in
@@ -22167,17 +22168,17 @@ Multiple
 @code{pi}
 requests construct a multi-stage pipeline
 in the same order as the formatter encounters the requests.
-Thus,
+The read-only register
+@code{.pi}
+interpolates the configured pipeline.
 
 @Example
 .pi foo
 .pi bar
+.pnr .pi
+    @error{} .pi     foo|bar
 @endExample
 
-@noindent
-is the same as
-@w{@samp{.pi foo | bar}}.
-
 @code{pi}
 must be invoked before
 GNU
diff --git a/man/groff.7.man.in b/man/groff.7.man.in
index aa5be873f..9d80bc727 100644
--- a/man/groff.7.man.in
+++ b/man/groff.7.man.in
@@ -8016,6 +8016,12 @@ option.
 Page ejection is in progress (Boolean-valued).
 .
 .TP
+.REG .pi
+Pipeline configured by
+.B pi
+requests.
+.
+.TP
 .REG .pn
 Number of the next page.
 .
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index ceafada9c..c70020d10 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -5418,6 +5418,13 @@ Interpolate\~1 during page ejection,
 .
 .
 .TP
+.B \[rs]n[.pi]
+Interpolate the pipeline configured by
+.B pi
+requests.
+.
+.
+.TP
 .B \[rs]n[.pn]
 Interpolate next page number
 (either that set by
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 53d27229e..13f6a4558 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -9567,6 +9567,16 @@ const char *enclosing_want_att_compat_reg::get_string()
                : want_att_compat_stack.top());
 }
 
+class pipe_command_reg : public reg {
+public:
+  const char *get_string();
+};
+
+const char *pipe_command_reg::get_string()
+{
+  return pipe_command;
+}
+
 class readonly_text_register : public reg {
   const char *s;
 public:
@@ -10621,6 +10631,7 @@ void init_input_requests()
   register_dictionary.define(".g", new readonly_text_register(1));
   register_dictionary.define(".H", new readonly_register(&hresolution));
   register_dictionary.define(".O", new readonly_register(&suppression_level));
+  register_dictionary.define(".pi", new pipe_command_reg);
   register_dictionary.define(".R", new readonly_text_register(INT_MAX));
   register_dictionary.define(".U", new 
readonly_boolean_register(&want_unsafe_requests));
   register_dictionary.define(".V", new readonly_register(&vresolution));

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to