groff-commit
[Top][All Lists]
Advanced

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

[groff] 09/40: [ms]: Refactor insufficient page length check.


From: G. Branden Robinson
Subject: [groff] 09/40: [ms]: Refactor insufficient page length check.
Date: Sat, 5 Feb 2022 12:58:03 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 2a6b7bb4b0b862dd7a8a3cd1a02b2ed7b1fa7205
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Feb 2 01:29:41 2022 +1100

    [ms]: Refactor insufficient page length check.
    
    * tmac/s.tmac (pg@top): Drop extraneous closing parenthesis from
      numeric expression.  Change operator from '>' to '>='; a page length
      right at the boundary causes a spurious extra page break when a
      paragraphing macro is used to initialize the document.  Condense
      diagnostic emission using the @error macro instead of duplicating it.
      Change indentation to fit the style of the rest of the file (use hard
      tabs).  If aborting, truncate the page length to the current vertical
      position so that we don't uselessly output further vertical space.
---
 ChangeLog   | 14 ++++++++++++++
 tmac/s.tmac | 19 +++++++++----------
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a87ba51f..7af56fa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2022-02-02  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [ms]: Refactor insufficient page length check.
+
+       * tmac/s.tmac (pg@top): Drop extraneous closing parenthesis from
+       numeric expression.  Change operator from '>' to '>='; a page
+       length right at the boundary causes a spurious extra page break
+       when a paragraphing macro is used to initialize the document.
+       Condense diagnostic emission using the @error macro instead of
+       duplicating it.  Change indentation to fit the style of the rest
+       of the file (use hard tabs).  If aborting, truncate the page
+       length to the current vertical position so that we don't
+       uselessly output further vertical space.
+
 2022-02-01  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [ms]: Add test for insufficient page length error.
diff --git a/tmac/s.tmac b/tmac/s.tmac
index 7f146a6c..fae28711 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -567,16 +567,15 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .MC \\n[LL]u
 ..
 .de pg@top
-.\" Invoked by '.wh 0' trap at the top of every page.
-.\" At short page length, recursion may occur; ensure
-.\" that page length is sufficient to avoid it.
-.if (u;\\n[HM]+\\n[FM])+\n[.V]>\\n[.p]) \{\
-.      ds pg*pl-abort-msg] "\*[@s]:\"
-.      if !'\\n[.F]'' .as pg*pl-abort-msg "\\n[.F]:\"
-.      if !'\\n[.c]'0' .as pg*pl-abort-msg "\\n[.c]:\"
-.      as pg*pl-abort-msg " abort: insufficient page length specified\"
-.      ab \\*[pg*pl-abort-msg]
-.   \}
+.\" invoked by '.wh 0' trap at the top of every page
+.\"
+.\" At short page lengths, footers may get truncated or recursion may
+.\" occur; ensure that the page length suffices to avoid these problems.
+.if (u;\\n[HM]+\\n[FM]+\n[.V]>=\\n[.p]) \{\
+.      @error insufficient page length; aborting\"
+.      pl \\n[nl]u
+.      ab
+.\}
 .ch pg*footer -\\n[FM]u/2u
 .nr pg*col-num 0
 .nr pg@fn-bottom-margin 0



reply via email to

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