groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 22/63: [troff]: Fix Savannah #63587 (\n[.R] := INT_MAX).


From: G. Branden Robinson
Subject: [groff] 22/63: [troff]: Fix Savannah #63587 (\n[.R] := INT_MAX).
Date: Mon, 19 Aug 2024 20:06:26 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 4b39065871599553a508cba28c97638b21c7354a
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Aug 17 20:26:56 2024 -0500

    [troff]: Fix Savannah #63587 (\n[.R] := INT_MAX).
    
    * src/roff/troff/input.cpp (init_input_requests): Initialize `.R`
      read-only register to `INT_MAX` instead of 10000.
    
    * doc/groff.texi.in (Built-in Registers):
    * man/groff.7.man (Read-only registers):
    * man/groff_diff.7.man (Altered registers): Document it.
    
    * doc/groff.texi.in (Manipulating Filling and Adjustment)
      (End-of-input Traps): Apply it to examples.
    
    Fixes <https://savannah.gnu.org/bugs/?63587>.
---
 ChangeLog                | 14 ++++++++++++++
 doc/groff.texi.in        | 18 +++++++++++-------
 man/groff.7.man          |  3 +--
 man/groff_diff.7.man     | 18 ++++++++++++++++++
 src/roff/troff/input.cpp |  2 +-
 5 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1fdf90661..8be28e9ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-08-17  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/input.cpp (init_input_requests): Initialize
+       `.R` read-only register to `INT_MAX` instead of 10000.
+
+       * doc/groff.texi.in (Built-in Registers):
+       * man/groff.7.man (Read-only registers):
+       * man/groff_diff.7.man (Altered registers): Document it.
+
+       * doc/groff.texi.in (Manipulating Filling and Adjustment)
+       (End-of-input Traps): Apply it to examples.
+
+       Fixes <https://savannah.gnu.org/bugs/?63587>.
+
 2024-08-17  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp: Support construction of read-only
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 93e2dd501..019bdc28a 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -7958,9 +7958,11 @@ Output page selection status (Boolean-valued); see 
@command{groff}
 @cindex number of available registers register (@code{.R})
 @cindex registers, available number of, register (@code{.R})
 @vindex .R
-Count of available unused registers; always 10,000 in GNU
-@code{troff}.@footnote{GNU @code{troff} dynamically allocates memory for
-as many registers as required.}
+Count of available unused registers; in GNU @command{troff} this
+register always interprets 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.
 
 @item \n[.T]
 @vindex .T
@@ -8397,7 +8399,7 @@ This is a small text fragment that shows the differences
 between the `.ce' and the `.ad c' requests.
 ..
 .ll 4i
-.ce 1000
+.ce \n(.R
 .FR
 .ce 0
 
@@ -8415,8 +8417,10 @@ between the `.ce' and the `.ad c' requests.
 @endExample
 
 The previous example illustrates a common idiom of turning centering on
-for a quantity of lines far in excess of what is required, and off again
-after the text to be centered.  This technique relieves humans of
+for a quantity of lines far in excess of what is required,@footnote{The
+@code{.R} register interpolates the largest value that GNU
+@command{troff} can work with.  @xref{Built-in Registers}.} and off
+again after the text to be centered.  This technique relieves humans of
 counting lines for requests that take a count of input lines as an
 argument.
 @endDefreq
@@ -15408,7 +15412,7 @@ text has been output.
 ..
 .
 .de single-page-mode
-.  pl 99999
+.  pl \n[.R]u
 .  em adjust-page-length
 ..
 .
diff --git a/man/groff.7.man b/man/groff.7.man
index ef834539a..7284990b2 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -6438,8 +6438,7 @@ Post-vertical line spacing.
 .
 .TP
 .REG .R
-Count of available unused registers;
-always 10,000 in GNU
+Maximum representable integer in GNU
 .IR troff . \" GNU
 .
 .TP
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index 43392cd5c..7fb2c64bb 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -4109,6 +4109,24 @@ and so on.
 .
 .
 .\" ====================================================================
+.SS "Altered registers"
+.\" ====================================================================
+.
+.TP
+.B \[rs]n[.R]
+Because GNU
+.I troff \" GNU
+dynamically manages register storage,
+it repurposes the
+.B .R
+register
+to interpolate the maximum integer representable in the formatter.
+.
+Favor its use over numeric literals with many zeros or nines
+to indicate an arbitrary large quantity.
+.
+.
+.\" ====================================================================
 .SS "New registers"
 .\" ====================================================================
 .
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 58c1a8dcc..6b29898cd 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8818,7 +8818,7 @@ void init_input_requests()
   register_dictionary.define(".F", new filename_reg);
   register_dictionary.define(".g", new readonly_text_register(1));
   register_dictionary.define(".H", new readonly_register(&hresolution));
-  register_dictionary.define(".R", new readonly_text_register(10000));
+  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));
   register_dictionary.define(".warn", new readonly_register(&warning_mask));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]