groff-commit
[Top][All Lists]
Advanced

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

[groff] 12/23: [hdtbl]: Make `-wall` clean.


From: G. Branden Robinson
Subject: [groff] 12/23: [hdtbl]: Make `-wall` clean.
Date: Thu, 21 Nov 2024 14:47:48 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit d82af36a7b86f2a92d178801f25a3921f661a839
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Nov 20 21:45:20 2024 -0600

    [hdtbl]: Make `-wall` clean.
    
    * contrib/hdtbl/hdmisc.tmac (t*index): Fix "range" warning: clamp
      substring extraction at length of string.
    
      (t*DI): Fix "tab" warnings: precede tab characters in macro calls with
      comment character.
    
    * contrib/hdtbl/hdtbl.tmac (ETC): Fix "range" warning: clamp line length
      at horizontal motion quantum the desired value is less.
    
    * contrib/hdtbl/hdtbl.am (HDTBLGROFF): Run groff with `-b` and `-wall`
      options.
    
    * contrib/hdtbl/examples/color_transitions.roff (ctab): When
      incrementing color channel value, cap it at "1f" to avoid "range"
      warning.
    
    * contrib/hdtbl/examples/common.roff (d2x): Fix "range" warning: clamp
      substring extraction at length of string.
---
 contrib/hdtbl/ChangeLog                       | 15 +++++++++++++++
 contrib/hdtbl/examples/color_transitions.roff |  7 ++++++-
 contrib/hdtbl/examples/common.roff            |  4 +++-
 contrib/hdtbl/hdmisc.tmac                     | 12 ++++++------
 contrib/hdtbl/hdtbl.am                        |  2 +-
 contrib/hdtbl/hdtbl.tmac                      |  6 +++---
 6 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/contrib/hdtbl/ChangeLog b/contrib/hdtbl/ChangeLog
index a3ce638c8..f639ee695 100644
--- a/contrib/hdtbl/ChangeLog
+++ b/contrib/hdtbl/ChangeLog
@@ -1,3 +1,18 @@
+2024-11-21  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * hdmisc.tmac (t*index): Fix "range" warning: clamp substring
+       extraction at length of string.
+       (t*DI): Fix "tab" warnings: precede tab characters in macro
+       calls with comment character.
+       * hdtbl.tmac (ETC): Fix "range" warning: clamp line length at
+       horizontal motion quantum the desired value is less.
+       * hdtbl.am (HDTBLGROFF): Run groff with `-b` and `-wall`
+       options.
+       * examples/color_transitions.roff (ctab): When incrementing
+       color channel value, cap it at "1f" to avoid "range" warning.
+       * examples/common.roff (d2x): Fix "range" warning: clamp
+       substring extraction at length of string.
+
 2024-11-20  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * examples/fonts_n.in:
diff --git a/contrib/hdtbl/examples/color_transitions.roff 
b/contrib/hdtbl/examples/color_transitions.roff
index 5a91bbbae..d465864de 100644
--- a/contrib/hdtbl/examples/color_transitions.roff
+++ b/contrib/hdtbl/examples/color_transitions.roff
@@ -31,7 +31,12 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .
 .de ctab
 .nr #cc 0
-.PN 21 ".nr #cc +.05f" ".defcolor \En[t*#] rgb \\$1 \\$2 \\$3" ".TBL border= 
csp=0 cpd=.5n bgc=\\\\n[t*#] bc=" .TR .TD
+.PN 21 ".nr #cc +.05f" \
+       ".nr #cc (1f<?\En[#cc])" \
+       ".defcolor \En[t*#] rgb \\$1 \\$2 \\$3" \
+       ".TBL border= csp=0 cpd=.5n bgc=\\\\n[t*#] bc=" \
+       .TR \
+       .TD
 .PN 21 .ETB
 ..
 .PN 30 Before table.
diff --git a/contrib/hdtbl/examples/common.roff 
b/contrib/hdtbl/examples/common.roff
index 633d4dae3..047754386 100644
--- a/contrib/hdtbl/examples/common.roff
+++ b/contrib/hdtbl/examples/common.roff
@@ -147,8 +147,10 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .  \" strip leading zero, if any
 .  ds * \\*[hex#]\"
 .  substring * 0 0
-.  if "\\*[*]"0" \
+.  length len# \\*[hex#]
+.  if \\n[len#]>1 .if "\\*[*]"0" \
 .    substring hex# 1 -1
+.  rr len#
 .
 .  if (\\$1 < 0) \
 .    ds hex# -\\*[hex#]\"
diff --git a/contrib/hdtbl/hdmisc.tmac b/contrib/hdtbl/hdmisc.tmac
index a05b0a1ac..298bc8cc0 100644
--- a/contrib/hdtbl/hdmisc.tmac
+++ b/contrib/hdtbl/hdmisc.tmac
@@ -154,7 +154,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .
 .  while (\\n+[*] < \\n[**]) \{\
 .    ds * \\$1\"
-.    substring * \\n[*] (\\n[*] + \\n[$2] - 1)
+.    substring * \\n[*] (\\n[*] <? (\\n[*] + \\n[$2] - 1))
 .    \" The surrounding \? escapes emulate string comparison.
 .    if "\?\\*[*]\?"\?\\$2\?" \
 .      break
@@ -273,7 +273,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .    nr \\$2 \\$4
 .
 .  ds $3 \\$3\"                        remember stackname
-.  shift 4             \"      shift four args
+.  shift 4\"                   shift four args
 .
 .  ds \\*[$3] "\\$@\"          fill stack with remaining elements
 ..
@@ -291,11 +291,11 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .\"    ******************************************************************
 .de t*DI
 .  nr * \\n[.u]
-.  nf          \"      diversion is already formatted - output it unchanged
-.  \\$1                \"      output the diversion ...
-.  rm \\$1     \"      ... and remove it
+.  nf\"                diversion is already formatted - output it unchanged
+.  \\$1\"      output the diversion ...
+.  rm \\$1\"   ... and remove it
 .  if \\n[*] \
-.    fi                \"      reactivate formatting
+.    fi\"      reactivate formatting
 ..
 .
 .\"    ******************************************************************
diff --git a/contrib/hdtbl/hdtbl.am b/contrib/hdtbl/hdtbl.am
index eef8e8ce6..850dda5e8 100644
--- a/contrib/hdtbl/hdtbl.am
+++ b/contrib/hdtbl/hdtbl.am
@@ -30,7 +30,7 @@ HDTBLGROFF = \
     -dfontpath=$(top_srcdir)/font \
     -dsopath=$(hdtbl_srcdir)/ \
     -I $(doc_builddir) -I $(doc_srcdir) \
-     $(MFLAG) -M$(hdtbl_srcdir) -mhdtbl -t -p -e -U
+     $(MFLAG) -M$(hdtbl_srcdir) -mhdtbl -t -p -e -U -b -wall
 
 HDTBLTMACFILES = \
   contrib/hdtbl/hdtbl.tmac \
diff --git a/contrib/hdtbl/hdtbl.tmac b/contrib/hdtbl/hdtbl.tmac
index 2ab769758..af2f224f9 100644
--- a/contrib/hdtbl/hdtbl.tmac
+++ b/contrib/hdtbl/hdtbl.tmac
@@ -451,9 +451,9 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .  t*cptn\\n[t*#]
 .  nr t*# -1
 .
-.  ll \\n[*cl\\n[t*#]]u          \"    restore ll outside this table
-.  in 0                          \"    reset indent
-.  gcolor \\*[t*m\\n[t*#]]       \"    reset previous fgc
+.  ll (u;\\n[.H]>?\\n[*cl\\n[t*#]]) \" restore ll outside this table
+.  in 0                             \" reset indent
+.  gcolor \\*[t*m\\n[t*#]]          \" reset previous fgc
 .
 .  t*getarg hold \\$@
 .  if !\\n[t*#] \{\



reply via email to

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