groff-commit
[Top][All Lists]
Advanced

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

[groff] 05/35: tmac/pdfpic.tmac: Slightly refactor.


From: G. Branden Robinson
Subject: [groff] 05/35: tmac/pdfpic.tmac: Slightly refactor.
Date: Mon, 21 Feb 2022 06:15:49 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 38da9fee2c00a60abd7282b29db757cd30594099
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Feb 15 17:22:30 2022 +1100

    tmac/pdfpic.tmac: Slightly refactor.
    
    * tmac/pdfpic.tmac: Slightly refactor.
    
      (pdfpic@cleanup, PDFPIC): Rename `pdfpic*file-name` to
      `pdfpic*file-name-base` since it is not used as a complete file name
      (but rather a basis for an ".eps" extension).
    
      (PDFPIC): When testing PDF file extension, include the "."; a file
      name like "mxyzptlkpdf" is too dubious to accept.  Also explicitly
      compare `systat` register as equal or not equal to zero, since its
      truth value is inverted from the expectations of *roff expressions.
---
 ChangeLog        | 12 ++++++++++++
 tmac/pdfpic.tmac | 12 ++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4f5ab82f..ac836b91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-02-15  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/pdfpic.tmac: Slightly refactor.
+       (pdfpic@cleanup, PDFPIC): Rename `pdfpic*file-name` to
+       `pdfpic*file-name-base` since it is not used as a complete file
+       name (but rather a basis for an ".eps" extension).
+       (PDFPIC): When testing PDF file extension, include the "."; a
+       file name like "mxyzptlkpdf" is too dubious to accept.  Also
+       explicitly compare `systat` register as equal or not equal to
+       zero, since its truth value is inverted from the expectations of
+       *roff expressions.
+
 2022-02-15  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/pdfpic.tmac (PDFPIC): Refactor PDFPIC_NOSPACE handling.
diff --git a/tmac/pdfpic.tmac b/tmac/pdfpic.tmac
index 96fa7f6b..3d0ff1d8 100644
--- a/tmac/pdfpic.tmac
+++ b/tmac/pdfpic.tmac
@@ -24,7 +24,7 @@
 .de pdfpic@cleanup
 .  rm pdfpic*pspic-args
 .  rm pdfpic*file-extension
-.  rm pdfpic*file-name
+.  rm pdfpic*file-name-base
 .  rr pdfpic*do-conversion
 .  rr pdfpic*offset-mode
 .  rr pdfpic*indentation
@@ -86,9 +86,9 @@
 .  br
 .
 .  ds pdfpic*file-extension \\$1\"
-.  substring pdfpic*file-extension -3
+.  substring pdfpic*file-extension -4
 .  stringdown pdfpic*file-extension
-.  if !'\\*[pdfpic*file-extension]'pdf' \{\
+.  if !'\\*[pdfpic*file-extension]'.pdf' \{\
 .    pdfpic@error '\\$1' lacks a '.pdf' extension; skipping
 .    return
 .  \}
@@ -99,15 +99,15 @@
 .  \" attack (or a simple race with a concurrent `rm` command, for
 .  \" instance).
 .  sy test -r \\$1
-.  if \\n[systat] \{\
+.  if \\n[systat]!=0 \{\
 .    pdfpic@error '\\$1' does not exist or is not readable; skipping
 .    return
 .  \}
 .
 .  \" if driver is not gropdf, convert image to .eps
 .  if \\n[pdfpic*do-conversion] \{\
-.    ds pdfpic*file-name \\$1
-.    substring pdfpic*file-name 0 -5
+.    ds pdfpic*file-name-base \\$1
+.    substring pdfpic*file-name-base 0 -5
 .
 .    sy pdftops -eps \\$1
 .    shift



reply via email to

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