[NTG-pdftex] [Dev-luatex] \primitive\pdfoutput cannot be queried
Heiko Oberdiek
oberdiek at uni-freiburg.de
Wed Apr 15 19:13:46 CEST 2009
Hello Taco,
On Sat, Apr 11, 2009 at 04:18:41PM +0200, Taco Hoekwater wrote:
> Taco Hoekwater wrote:
> >Heiko Oberdiek wrote:
> >>
> >>AFAIK, an expression with \primitive will become expandable
> >>if and only if the primitive is expandable.
> >>(pdfTeX: \pdfprimitive)
> >
> >I am thinking about this bug.
>
> Please look at the attached patch against pdftex trunk. I have a similar
> patch in luatex now, and it works ok for your example file as well as
> some other stuff I tried.
Yes, many thanks.
> The patch makes scan_something_internal (for \number and the other
> convert commands) and scan_int (other places where numbers are needed)
> skip over the unexpandable version of \primitive so that it looks at
> the next token, and if that token is a primitive, it uses this instead.
>
> If the next token is not a primitive at all, then a frozen \relax is
> inserted, as that is probably the best thing to do. I have considered
> reporting an error, but that is too unpredictable for my taste (and a
> "Missing number" error will likely follow anyway).
>
> Please check against any other tests you may have.
If the next token is not a primitive, then it vanishes:
\def\sx{\immediate\write16{[\meaning\x]}}
% ok:
\edef\x{\pdfprimitive\pdfoutput}
\sx % [macro:->\pdfprimitive \pdfoutput ]
% token vanishes in the next cases:
\edef\x{\pdfprimitive0}
\sx % [macro:->]
\edef\x{\pdfprimitive123}
\sx % [macro:->23]
\expandafter\def\expandafter\x\expandafter{\pdfprimitive0}
\sx % [macro:->]
\edef\x{\pdfprimitive\Undefined}
\sx % [macro:->]
\edef\x{\pdfprimitive $}
\sx % [macro:->]
[\pdfprimitive 0] % []
% An error message I could trigger by:
\chardef\a=10 %
\pdfprimitive\a X
! Missing control sequence inserted.
<inserted text>
\inaccessible
<to be read again>
X
l.70 \pdfprimitive\a X
Yours sincerely
Heiko <oberdiek at uni-freiburg.de>
--
More information about the ntg-pdftex
mailing list