groff-commit
[Top][All Lists]
Advanced

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

[groff] 38/115: tmac/s.tmac (@EQ): Trivially refactor.


From: G. Branden Robinson
Subject: [groff] 38/115: tmac/s.tmac (@EQ): Trivially refactor.
Date: Thu, 1 Jun 2023 10:46:05 -0400 (EDT)

gbranden pushed a commit to branch branden-2022-06-01
in repository groff.

commit b0e090dc24db8ed337a6c7eb40981e672ec0223c
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Apr 7 20:31:50 2023 -0500

    tmac/s.tmac (@EQ): Trivially refactor.
    
    * tmac/s.tmac (@EQ): Trivially refactor.  Shift valid pseudo-enumeration
      type values from 0..2 to 1..3 so that they more idiomatically test for
      truth values in roff (where zero and negative values are false).
      Simplify a conditional accordingly.
---
 ChangeLog   |  7 +++++++
 tmac/s.tmac | 26 +++++++++++++-------------
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e52fb404c..4eddc884f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-04-07  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/s.tmac (@EQ): Trivially refactor.  Shift valid
+       pseudo-enumeration type values from 0..2 to 1..3 so that they
+       more idiomatically test for truth values in roff (where zero and
+       negative values are false).  Simplify a conditional accordingly.
+
 2023-04-07  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [ms]: Fix Savannah #64013.
diff --git a/tmac/s.tmac b/tmac/s.tmac
index dad2d6371..5abccc567 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -1885,12 +1885,12 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .if \\n[tbl@within-table] \
 .      @error .EQ is not allowed within a .TS/.TE table
 .br
-.nr eqn*type -1
+.nr eqn*type 0
 .ds eqn*num "\\$2
-.if '\\$1'L' .nr eqn*type 0
-.if '\\$1'I' .nr eqn*type 1
-.if '\\$1'C' .nr eqn*type 2
-.if (\\n[eqn*type] < 0) \{\
+.if '\\$1'L' .nr eqn*type 1
+.if '\\$1'I' .nr eqn*type 2
+.if '\\$1'C' .nr eqn*type 3
+.if !\\n[eqn*type] \{\
 .      ds eqn*msg .EQ: unrecognized alignment '\\$1';
 .      ie (\\n[.$] = 1) \{\
 .              if !'\\$1'' \{\
@@ -1913,12 +1913,12 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .      nr eqn*ll \\n[.l]
 .      ll 1000n
 .\}
-.if \\n[eqn*type]=0 .EQN-HTML-IMAGE-LEFT
-.if \\n[eqn*type]=1 \{\
+.if \\n[eqn*type]=1 .EQN-HTML-IMAGE-LEFT
+.if \\n[eqn*type]=2 \{\
 .   if '\*(.T'html' .RS
 .EQN-HTML-IMAGE-INLINE
 .\}
-.if \\n[eqn*type]=2 .EQN-HTML-IMAGE
+.if \\n[eqn*type]=3 .EQN-HTML-IMAGE
 .nf
 ..
 .de @div-end!eqn*div
@@ -1945,12 +1945,12 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .                      ie r ps4html .ds@need \\n[dn]u-1v+\n[.V]u+1i
 .                      el .ds@need \\n[dn]u-1v+\n[.V]u
 .                      chop eqn*div
-.                      ie \\n[eqn*type]=0 \{\
+.                      ie \\n[eqn*type]=1 \{\
 .                              ta (u;\\n[.l]-\\n[.i])R
 \\*[eqn*div]\t\\*[eqn*num]
 .                      \}
 .                      el \{\
-.                              ie \\n[eqn*type]=1 .ta \\n[DI]u \
+.                              ie \\n[eqn*type]=2 .ta \\n[DI]u \
 (u;\\n[.l]-\\n[.i])R
 .                              el .ta (u;\\n[.l]-\\n[.i]/2)C \
 (u;\\n[.l]-\\n[.i])R
@@ -1974,12 +1974,12 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .              if r ps4html    \\*[eqn*div]
 .      \}
 .       if !'\*(.T'html' .fi
-.      if \\n[eqn*type]=0 .EQN-HTML-IMAGE-END
-.      if \\n[eqn*type]=1 \{\
+.      if \\n[eqn*type]=1 .EQN-HTML-IMAGE-END
+.      if \\n[eqn*type]=2 \{\
 .              EQN-HTML-IMAGE-END
 .              if '\*(.T'html' .RE
 .      \}
-.      if \\n[eqn*type]=2 .EQN-HTML-IMAGE-END
+.      if \\n[eqn*type]=3 .EQN-HTML-IMAGE-END
 .      if '\*(.T'html' \
 .              ll \\n[eqn*ll]u
 .\}



reply via email to

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