[NTG-pdftex] \ifprimitive and \ifinternal/\iffeature (design proposal)

Martin Schröder martin at oneiros.de
Mon Jul 4 12:53:39 CEST 2005


On 2005-07-04 12:30:47 +0200, Taco Hoekwater wrote:
> As promised, some proposals for the symbol table. No code yet,
> because careful thinking is needed first, to avoid unexplainable
> side-effects.

Hrm. The problem I see is that Karl is breathing down my neck
because he wants a code freeze for TL2005 this week. :-{

But deadlines in TL are always flexible, so I think we have at
least another month...

> Let me propose two rather straightforward new primitives first
> (please imagine the \ptex prefix yourself):
> 
>   \ifprimitive <csname>
> 
>     True if the <csname> has the same meaning as it would in initex,
>     (but gives an error if <csname> is currently undefined).
> 
>   \executeprimitive <csname>
> 
>     Executes the primitive that would be known as <csname> in initex,
>     even if the <csname> is currently undefined or defined to mean
>     something else. Raises an error if there is no matching internal
>     command (of course).
> 
> These are quite straightforward, and I do not assume this needs
> much discussion. But the next ones are related to "if feature ...",
> and those are bit harder to define.
> 
> I propose to make it possible to 'predefine' primitives in the
> executable. All program code is completely ready, except that the
> hash table entry is never created, making it impossible to use
> that primitive in initex without extra work.
> 
>   \ifinternal <csname>
> 
>     True if there is code in the pdtex executable to implement the
>     internal command <csname>, regardless of whether or not it is
>     currently reachable from macros.
> 
>   \executeinternal <csname>
> 
>     Executes the internal that is registered as <csname>, even
>     if that internal is currently obscured (disable) or the <csname>
>     is defined to mean something else. Raises an error if there is
>     no matching internal command.
> 
>   \exposeinternal <csname>
> 
>     This does the final step of the primitive() function: it creates
>     a hash entry for <csname> that maps it to its primitive meaning.
>     An error is raised if the <csname> is currently defined.
>     (perhaps this primitive should accept the \global prefix?)
> 
>   \obscureinternal <csname>
> 
>     The inverse of \exposeinternal, this 'undefines' the primitive
>     related to <csname>. If <csname> is currently a macro, nothing
>     needs to be done. Control sequences that are \let to the meaning
>     of this csname are left as is.
>     (perhaps this primitive should accept the \global prefix?)

I suggest \hideinternal instead; we don't want to be obscure. :-)

> WDYT?

Great!

Best
    Martin
-- 
                    http://www.tm.oneiros.de


More information about the ntg-pdftex mailing list