de.dante.extex.interpreter.primitives.color
Class Colordef

java.lang.Object
  extended byde.dante.extex.interpreter.type.AbstractCode
      extended byde.dante.extex.interpreter.type.AbstractAssignment
          extended byde.dante.extex.interpreter.primitives.color.Colordef
All Implemented Interfaces:
Code, Localizable, java.io.Serializable

public class Colordef
extends AbstractAssignment

This class provides an implementation for the primitive \colordef.

The Primitive \colordef

The primitive \colordef defines a color variable and assigns it to a control sequence. The color is initialized with a given color – either a color constant or a color variable.

The control sequence can later be used wherever a color is expected.

The primitive \colordef constitutes an assignment. Thus the count register \globaldefs and the token register \afterassignment interact with it as for each assignment.

The primitive can be prefixed with the \global flag. In this case the definition is performed globally. Otherwise the control sequence holds the color value in the current group only. It is reset to the previous value when the group is ended.

The color variable can be manipulated by assigning new colors to it. The assignment is accomplished by specifying the new value after an optional equals sign. Note that the assignment can not be prefixed by a \global modifier since the scope has already been specified in the declaration with \colordef.

Syntax

The formal description of this primitive is the following:
    ⟨colordef⟩
      → ⟨optional prefix⟩ \colordef ⟨control sequence⟩ ⟨color⟩

    ⟨optional prefix⟩
      →
       |  \global   

Examples

    \colordef\col alpha .1234 rgb {.2 .3 .4}  

    \global\colordef\col\color  

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

Field Summary
protected static long serialVersionUID
          The field serialVersionUID contains the version number for serialization.
 
Constructor Summary
Colordef(java.lang.String name)
          Creates a new object.
 
Method Summary
 void assign(Flags prefix, Context context, TokenSource source, Typesetter typesetter)
          The method assign is the core of the functionality of execute().
 
Methods inherited from class de.dante.extex.interpreter.type.AbstractAssignment
execute
 
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
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
The field serialVersionUID contains the version number for serialization.

See Also:
Constant Field Values
Constructor Detail

Colordef

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

Parameters:
name - the name of the primitive for tracing
Method Detail

assign

public void assign(Flags prefix,
                   Context context,
                   TokenSource source,
                   Typesetter typesetter)
            throws InterpreterException
Description copied from class: AbstractAssignment
The method assign is the core of the functionality of execute(). This method is preferable to execute() since the execute() method provided in this class takes care of \afterassignment and \globaldefs as well.

Specified by:
assign in class AbstractAssignment
Parameters:
prefix - the prefix controlling the execution
context - the interpreter context
source - the token source
typesetter - the typesetter
Throws:
InterpreterException - in case of an error
See Also:
AbstractAssignment.assign( de.dante.extex.interpreter.Flags, de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.extex.typesetter.Typesetter)