Package de.dante.extex.interpreter.primitives.conditional

This package contains primitives for conditionals.

See:
          Description

Class Summary
AbstractIf This is the abstract base class for all ifs.
Else This class provides an implementation for the primitive \else.
Fi This class provides an implementation for the primitive \fi.
If This class provides an implementation for the primitive \if.
Ifcase This class provides an implementation for the primitive \ifcase.
Ifcase.Tag This is an internal class for type-safe values.
Ifcat This class provides an implementation for the primitive \ifcat.
Ifcsname This class provides an implementation for the primitive \ifcsname.
Ifdefined This class provides an implementation for the primitive \if.
Ifdim This class provides an implementation for the primitive \ifdim.
Ifeof This class provides an implementation for the primitive \ifeof.
Iffalse This class provides an implementation for the primitive \iffalse.
Iffontchar This class provides an implementation for the primitive \iffontchar.
Ifhbox This class provides an implementation for the primitive \ifhbox.
Ifhmode This class provides an implementation for the primitive \ifhmode.
Ifinner This class provides an implementation for the primitive \ifinner.
Ifmmode This class provides an implementation for the primitive \ifvmode.
Ifnum This class provides an implementation for the primitive \ifnum.
Ifodd This class provides an implementation for the primitive \ifodd.
Ifscaled This class provides an implementation for the primitive \ifscaled.
Iftrue This class provides an implementation for the primitive \iftrue.
Ifvbox This class provides an implementation for the primitive \ifvbox.
Ifvmode This class provides an implementation for the primitive \ifvmode.
Ifvoid This class provides an implementation for the primitive \ifvoid.
Ifx This class provides an implementation for the primitive \ifx.
Or This class provides an implementation for the primitive \or.
Unless This class provides an implementation for the primitive \if.
 

Package de.dante.extex.interpreter.primitives.conditional Description

This package contains primitives for conditionals.

Operation

The macro expansion mechanism makes it rather simple to implement a conditional. At the beginning one has to decide whether or not this branch is active. In an if-then-else construction there are at most two branches, whereas in a switch there might be some more.

If the current branch is active then nothing has to be done except the storing of the information where the current conditional has started and its branch. The further expansion is just the same as it the conditional was not there.

If the current branch is not active then we can enter a fast skip over the input tokens. Just those tokens are relevant which are related to conditionals. Opening conditionals and closing conditionals are counted until they balance. In a balanced state the branching macro (\else or \or) or the closing conditional is sought. All other tokens are simply discarted.

Implementation

Conditionals are derived form the class AbstractIf. This class takes care of everything except the conmstruction of an object and the evaluation of the condition. Thus usually it is sufficient for the implementation of a new \if* to define the constructor and the method conditional().