[luatex] tex.enableprimitives producing non-primitives?
Heiko Oberdiek
oberdiek at uni-freiburg.de
Wed Sep 23 15:10:51 CEST 2009
On Wed, Sep 23, 2009 at 09:35:47PM +0900, Dohyun Kim wrote:
> 2009/9/23 Heiko Oberdiek <oberdiek at uni-freiburg.de>:
> >
> > \pdfprimitive does not know about tex.enableprimitives and does
> > not care for the current meaning of \testprefixattribute.
> > \pdfprimitive expects the same name as you use in the second
> > argument of tex.enableprimitives.
> >
>
> But... what about \ifprimitive?
> Please test a file as follows with "luatex -ini":
> neither \attribute nor \testprefixattribute is treated as a primitive.
> This makes \ifprimitive command useless.
> In this respect, I agree with Élie Roux and think that this issue is a
> luatex's bug.
>
> \catcode`\{=1
> \catcode`\}=2
> \ifx\directlua\undefined
> \else
> \directlua{tex.enableprimitives('',{'ifpdfprimitive'})}
> \directlua{tex.enableprimitives('testprefix',{'attribute'})}
> \fi
> \immediate\write17{ !!! attribute is
> \ifpdfprimitive\attribute\else NOT \fi a primitive.}
\attribute is undefined (not yet enabled), thus the result
is "NOT a primitive".
> \immediate\write17{ !!! testprefixattribute is
> \ifpdfprimitive\testprefixattribute\else NOT \fi a primitive.}
\ifpdfprimitive applied to a control sequence that isn't one
of the engine's primitives (see list of tex.enableprimitives)
will never report a positive result.
If you want to check, if a control sequence has the meaning
of a special primitive, then look at package `pdftexcmds':
Stimulated by the current discussion I implemented \pdf at isprimitive:
\input pdftexcmds.sty\relax
\catcode`\@=11 %
\pdf at isprimitive\testprefixattribute\attribute{true}{false}
will report "true" in the above example.
\ifpdfprimitive\cmd is similar to
\pdf at isprimitive\cmd\cmd{\iftrue}{\iffalse}
Update of pdftexcmds is on its way to CTAN, for the impatient
(dtx is attached, and sty can be extracted by running tex):
http://www.informatik.uni-freiburg.de/~oberdiek/tmp/pdftexcmds.pdf
Yours sincerely
Heiko <oberdiek at uni-freiburg.de>
More information about the luatex
mailing list