de.dante.extex.interpreter.primitives.typesetter.mark
Class AbstractMarksCode

java.lang.Object
  extended byde.dante.extex.interpreter.type.AbstractCode
      extended byde.dante.extex.interpreter.primitives.typesetter.mark.AbstractMarksCode
All Implemented Interfaces:
Code, ExpandableCode, Localizable, java.io.Serializable, TokensConvertible
Direct Known Subclasses:
Botmarks, Firstmarks, Splitbotmarks, Splitfirstmarks, Topmarks

public abstract class AbstractMarksCode
extends AbstractCode
implements ExpandableCode, TokensConvertible

Thus abstract base class for marks primitives provides the common features.

Version:
$Revision: 1.9 $
Author:
Gerd Neugebauer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class de.dante.extex.interpreter.type.AbstractCode
serialVersionUID
 
Constructor Summary
AbstractMarksCode(java.lang.String name)
          Creates a new object.
 
Method Summary
 Tokens convertTokens(Context context, TokenSource source, Typesetter typesetter)
          This method converts a register into tokens.
 void execute(Flags prefix, Context context, TokenSource source, Typesetter typesetter)
          This method takes the first token and executes it.
 void expand(Flags prefix, Context context, TokenSource source, Typesetter typesetter)
          This method takes the first token and expands it.
protected  java.lang.String getKey(Context context, TokenSource source, Typesetter typesetter)
          Get the key for this mark.
protected abstract  Tokens getValue(Context context, java.lang.String key)
          Get the value for this mark.
 
Methods inherited from class de.dante.extex.interpreter.type.AbstractCode
enableLocalization, getLocalizer, getName, isIf, isOuter, printable, printableControlSequence, readResolve, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractMarksCode

public AbstractMarksCode(java.lang.String name)
Creates a new object.

Parameters:
name - the name of the primitive
Method Detail

convertTokens

public Tokens convertTokens(Context context,
                            TokenSource source,
                            Typesetter typesetter)
                     throws InterpreterException
Description copied from interface: TokensConvertible
This method converts a register into tokens. It might be necessary to read further tokens to determine which value to use. For instance an additional register number might be required. In this case the additional arguments Context and TokenSource can be used.

Specified by:
convertTokens in interface TokensConvertible
Parameters:
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter to use for conversion
Returns:
the converted value
Throws:
InterpreterException - in case of an error
See Also:
TokensConvertible.convertTokens( de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.extex.typesetter.Typesetter)

execute

public void execute(Flags prefix,
                    Context context,
                    TokenSource source,
                    Typesetter typesetter)
             throws InterpreterException
Description copied from interface: Code
This method takes the first token and executes it. The result is placed on the stack. This operation might have side effects. To execute a token it might be necessary to consume further tokens.

Specified by:
execute in interface Code
Overrides:
execute in class AbstractCode
Throws:
InterpreterException
See Also:
AbstractCode.execute( de.dante.extex.interpreter.Flags, de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.extex.typesetter.Typesetter)

expand

public void expand(Flags prefix,
                   Context context,
                   TokenSource source,
                   Typesetter typesetter)
            throws InterpreterException
Description copied from interface: ExpandableCode
This method takes the first token and expands it. The result is placed on the stack. This means that expandable code does one step of expansion and puts the result on the stack. To expand a token it might be necessary to consume further tokens.

Specified by:
expand in interface ExpandableCode
Parameters:
prefix - the prefix flags controlling the expansion
context - the interpreter context
source - the token source
typesetter - the typesetter
Throws:
InterpreterException - in case of an error
See Also:
ExpandableCode.expand( de.dante.extex.interpreter.Flags, de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.extex.typesetter.Typesetter)

getKey

protected java.lang.String getKey(Context context,
                                  TokenSource source,
                                  Typesetter typesetter)
                           throws InterpreterException
Get the key for this mark.

A Mark Name

A mark name determines under which key a mark can be addressed. In TeX this used to be a positive number only. This has been extended to allow also a token list in braces. Детальное описание window washing здесь.

The alternative is controlled by the count register \register.max. The following interpretation of the value of this count is used:

  • If the value of this count register is negative then a arbitrary non-negative number is allowed as register name as well as any list of tokens enclosed in braces.
  • If the value of this count register is not-negative then a only a non-negative number is allowed as register name which does not exceed the value of the count register.

The value of the count register \register.max is set differently for various configurations of ExTeX:

  • TeX uses the value 255.
  • eTeX uses the value 32767.
  • Omega uses the value 65536.
  • ExTeX uses the value -1.

Note that the register name \register.max contains a period. Thus it can normally not be entered easily since the catcode of the period is OTHER but needs to be LETTER. Thus you have to use a temporarily reassigned category code (see \catcode) or use {@link de.dante.extex.interpreter.primitives.macro.Csname \csname}.

Syntax

   ⟨register name⟩
       → {@linkplain
        de.dante.extex.interpreter.TokenSource#scanTokens(Context,boolean,boolean,String)
        ⟨tokens⟩}
        | {@linkplain de.dante.extex.interpreter.TokenSource#scanNumber(Context)
        ⟨number⟩}  

Examples

  123
  {abc
 

Parameters:
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
Returns:
the key for the mark primitive
Throws:
InterpreterException - in case of an error

getValue

protected abstract Tokens getValue(Context context,
                                   java.lang.String key)
                            throws InterpreterException
Get the value for this mark.

Parameters:
context - the interpreter context
key - the key
Returns:
the value
Throws:
InterpreterException - in case of an exception