Follow-up Comment #9, bug #64061 (project groff): [comment #7 comment #7:] > [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.
Ah, yes, whoops. I forgot to point you to my "private" branch on Savannah. https://git.savannah.gnu.org/cgit/groff.git/commit/?h=branden-2023-04-20&id=4dc2c23f0c2b72517be62e60090f30b214299650 > 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. Your testing approach seems sound to me. > 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 > 0 my patch is functionally equivalent to yours, and > 0 the contents of the temp file are what you expected > then it looks like we have a winner! It _looks_ good; of course one of the the challenges with this sort of cleverness is that it's easy for problems to escape the eyeballs. > pdfpic.patched.test generates an identical temp file on my Linux box, so that's an encouraging sign. Very much so! _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?64061> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
