[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #64061] pdfpic.tmac requires non-standard sed feature
From: |
Dave |
Subject: |
[bug #64061] pdfpic.tmac requires non-standard sed feature |
Date: |
Sat, 22 Apr 2023 09:24:20 -0400 (EDT) |
Follow-up Comment #7, bug #64061 (project groff):
[comment #5 comment #5:]
> Dave, can you give this a crack on your Mac OS X 10.11.6 host?
I _think_ I got it to work?
You'll have to check my work, because I appear to be missing a step. I took
the pdfpic*system macro from the file "64061.diff" attached to
http://lists.gnu.org/r/groff/2023-04/msg00190.html, but the patch in comment
#5 is not against the same version of that macro; there appears to be an
intermediate revision I'm missing. So I interpolated, hopefully correctly.
First, I set up a small input file that is basically the "64061.diff" version
of pdfpic*system with a couple edits to (a) call your fake-pdfinfo script from
comment #6, rather than pdfinfo itself, so that we know exactly what data
we're working with, and (b) hard-code a path in place of
\*[pdfpic*temporary-file]. All the test file does is define the macro and
then invoke it:
$ cat pdfpic.test
.eo
.de pdfpic*system
. ds pdfpic*command ./fake-pdfinfo
. eo
. as pdfpic*command " | tr -d '\\000'
. as pdfpic*command " | sed -n -e '/Page *size:/
. as pdfpic*command s/Page *size: *\\([0-9.]*\\) *x *\([0-9.]*\\).*$/
. as pdfpic*command .nr pdfpic*width (p;\\1)\\n
. as pdfpic*command .nr pdfpic*height (p;\\2)/'
. as pdfpic*command " -e tprint -e b -e :print -e p
. ec
. as pdfpic*command " > /tmp/pdfpic-temporary-file
. sy \*[pdfpic*command]
. rm pdfpic*command
..
.ec
.
. pdfpic*system
$ groff -U pdfpic.test
$ cat /tmp/pdfpic-temporary-file
.nr pdfpic*width (p;612)n.nr pdfpic*height (p;792)
That didn't work and we knew it wouldn't, so no surprises there.
Now's where I had to do a little guesswork to apply the patch. Here's how my
version of pdfpic.patched.test differs from the original test:
$ diff -u pdfpic.test pdfpic.patched.test
--- pdfpic.test 2023-04-22 07:41:13.000000000 -0500
+++ pdfpic.patched.test 2023-04-22 07:43:54.000000000 -0500
@@ -5,9 +5,9 @@
. as pdfpic*command " | tr -d '\\000'
. as pdfpic*command " | sed -n -e '/Page *size:/
. as pdfpic*command s/Page *size: *\\([0-9.]*\\) *x *\([0-9.]*\\).*$/
-. as pdfpic*command .nr pdfpic*width (p;\\1)\\n
-. as pdfpic*command .nr pdfpic*height (p;\\2)/'
-. as pdfpic*command " -e tprint -e b -e :print -e p
+. as pdfpic*command . \\\\R@pdfpic*width (p;\\1)@
+. as pdfpic*command " \\\\R@pdfpic*height (p;\\2)@
+. as pdfpic*command /p'
. ec
. as pdfpic*command " > /tmp/pdfpic-temporary-file
. sy \*[pdfpic*command]
$ groff -U pdfpic.patched.test
$ cat /tmp/pdfpic-temporary-file
. \R@pdfpic*width (p;612)@ \R@pdfpic*height (p;792)@
So, presuming that
1. my patch is functionally equivalent to yours, and
2. the contents of the temp file are what you expected
then it looks like we have a winner!
pdfpic.patched.test generates an identical temp file on my Linux box, so
that's an encouraging sign.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?64061>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #64061] pdfpic.tmac uses sed badly and non-portably, G. Branden Robinson, 2023/04/17
- [bug #64061] pdfpic.tmac uses sed badly and non-portably, Dave, 2023/04/17
- [bug #64061] pdfpic.tmac uses sed badly and non-portably, G. Branden Robinson, 2023/04/17
- [bug #64061] pdfpic.tmac uses sed badly and non-portably, G. Branden Robinson, 2023/04/17
- [bug #64061] pdfpic.tmac resorts to undocumented magic, G. Branden Robinson, 2023/04/19
- [bug #64061] pdfpic.tmac resorts to undocumented magic, G. Branden Robinson, 2023/04/21
- [bug #64061] pdfpic.tmac resorts to undocumented magic, G. Branden Robinson, 2023/04/21
- [bug #64061] pdfpic.tmac requires non-standard sed feature, G. Branden Robinson, 2023/04/21
- [bug #64061] pdfpic.tmac requires non-standard sed feature,
Dave <=
- [bug #64061] pdfpic.tmac requires non-standard sed feature, Dave, 2023/04/22
- [bug #64061] pdfpic.tmac requires non-standard sed feature, G. Branden Robinson, 2023/04/22
- [bug #64061] pdfpic.tmac requires non-standard sed feature, G. Branden Robinson, 2023/04/22
- [bug #64061] pdfpic.tmac requires non-standard sed feature, Dave, 2023/04/23
- [bug #64061] pdfpic.tmac requires non-standard sed feature, Dave, 2023/04/23
- [bug #64061] pdfpic.tmac requires non-standard sed feature, G. Branden Robinson, 2023/04/23
- [bug #64061] pdfpic.tmac requires non-standard sed feature, G. Branden Robinson, 2023/04/23
- [bug #64061] pdfpic.tmac requires non-standard sed feature, G. Branden Robinson, 2023/04/28