de.dante.extex.interpreter.context
Interface Context

All Superinterfaces:
ContextCode, ContextCount, ContextDimen, ContextErrorCount, ContextFile, ContextFont, ContextGroup, ContextInteraction, ContextMark, ContextTokens, java.io.Serializable, Tokenizer
All Known Subinterfaces:
ContextInternals
All Known Implementing Classes:
ContextExtensionImpl, ContextImpl

public interface Context
extends ContextCode, ContextCount, ContextDimen, ContextFile, ContextFont, ContextGroup, ContextErrorCount, ContextInteraction, ContextTokens, ContextMark, Tokenizer, java.io.Serializable

This interface describes the container for all data of an interpreter context.

Version:
$Revision: 1.78 $
Author:
Gerd Neugebauer, Michael Niedermair

Method Summary
 void addUnit(UnitInfo info)
          Add a unit to the list of loaded units.
 java.lang.String esc(java.lang.String name)
          Attach the current escape character in front of a name and return the result.
 java.lang.String esc(Token token)
          This method is meant to produce a printable version of a control sequence for error messages.
 UnicodeChar escapechar()
          Return the current escape character or \0 if it is undefined.
 java.lang.Object get(java.lang.Object extension, java.lang.Object key)
          Getter for a value from an extended section of the context.
 Token getAfterassignment()
          Getter for the afterassignment token.
 Box getBox(java.lang.String name)
          Getter for the box register.
 Conditional getConditional()
          Getter for the currently active conditional.
 MathDelimiter getDelcode(UnicodeChar c)
          Getter for the delimiter code mapping.
 Glue getGlue(java.lang.String name)
          Getter for a glue register.
 java.lang.String getId()
          Getter for the id string.
 long getIfLevel()
          Getter for the current if level.
 Language getLanguage(java.lang.String language)
          Getter for the hyphenation record for a given language.
 LanguageManager getLanguageManager()
          Getter for the language manager.
 UnicodeChar getLccode(UnicodeChar uc)
          Getter for the lccode mapping of upper case characters to their lower case equivalent.
 long getMagnification()
          Getter for the magnification factor in per mille.
 MathCode getMathcode(UnicodeChar uc)
          Getter for the math code of a character.
 Muskip getMuskip(java.lang.String name)
          Getter for a muskip register.
 java.lang.String getNamespace()
          Getter for the current name space.
 ParagraphShape getParshape()
          Getter for the paragraph shape.
 Count getSfcode(UnicodeChar uc)
          Getter for the space factor code of a character.
 TokenStream getStandardTokenStream()
          Getter for standardTokenStream.
 TokenFactory getTokenFactory()
          Getter for the token factory.
 Tokenizer getTokenizer()
          Getter for the tokenizer.
 TypesettingContext getTypesettingContext()
          Getter for the typesetting context.
 UnicodeChar getUccode(UnicodeChar lc)
          Getter for the uccode mapping of lower case characters to their upper case equivalent.
 Conditional popConditional()
          Pop the management information for a conditional from the stack and return it.
 Direction popDirection()
          Pop a direction from the direction stack.
 void pushConditional(Locator locator, boolean value, Code primitive, long branch, boolean neg)
          Put a value onto the conditional stack.
 void pushDirection(Direction dir)
          Push a direction onto the direction stack.
 void set(Color color, boolean global)
          Setter for the color in the current typesetting context.
 void set(Direction direction, boolean global)
          Setter for the direction in the current typesetting context.
 void set(Font font, boolean global)
          Setter for the font in the current typesetting context.
 void set(Language language, boolean global)
          Setter for the language in the current typesetting context.
 void set(java.lang.Object extension, java.lang.Object key, java.lang.Object value, boolean global)
          Setter for a value from an extended section of the context.
 void set(TypesettingContext context, boolean global)
          Setter for the typesetting context in the specified groups.
 void setAfterassignment(Token token)
          Setter for the afterassignment token.
 void setBox(java.lang.String name, Box value, boolean global)
          Setter for the box register in the current group.
 void setCatcode(UnicodeChar c, Catcode catcode, boolean global)
          Setter for the catcode of a character in the specified groups.
 void setDelcode(UnicodeChar c, MathDelimiter delimiter, boolean global)
          Setter for the delimiter code mapping.
 void setGlue(java.lang.String name, Glue value, boolean global)
          Setter for a glue register.
 void setId(java.lang.String id)
          Setter for the id string.
 void setLanguageManager(LanguageManager manager)
          Setter for the language manager.
 void setLccode(UnicodeChar uc, UnicodeChar lc, boolean global)
          Declare the translation from an upper case character to a lower case character.
 void setMagnification(long mag, boolean lock)
          Setter for the magnification.
 void setMathcode(UnicodeChar uc, MathCode code, boolean global)
          Setter for the math code of a character
 void setMuskip(java.lang.String name, Muskip value, boolean global)
          Setter for a muskip register.
 void setNamespace(java.lang.String namespace, boolean global)
          Setter for the name space.
 void setParshape(ParagraphShape shape)
          Setter for the paragraph shape.
 void setSfcode(UnicodeChar uc, Count code, boolean global)
          Setter for the space factor code in the specified groups.
 void setStandardTokenStream(TokenStream standardTokenStream)
          Setter for standardTokenStream.
 void setTokenFactory(TokenFactory factory)
          Setter for the token factory.
 void setUccode(UnicodeChar lc, UnicodeChar uc, boolean global)
          Declare the translation from a lower case character to an upper case character.
 java.util.Iterator unitIterator()
          Get an iterator to enumerate all unit infos.
 
Methods inherited from interface de.dante.extex.interpreter.context.ContextCode
getCode, setCode
 
Methods inherited from interface de.dante.extex.interpreter.context.ContextCount
getCount, setCount
 
Methods inherited from interface de.dante.extex.interpreter.context.ContextDimen
getDimen, setDimen, setDimen
 
Methods inherited from interface de.dante.extex.interpreter.context.ContextFile
getInFile, getOutFile, setInFile, setOutFile
 
Methods inherited from interface de.dante.extex.interpreter.context.ContextFont
getFont, getFontFactory, setFont, setFontFactory
 
Methods inherited from interface de.dante.extex.interpreter.context.ContextGroup
afterGroup, afterGroup, closeGroup, getGroupInfos, getGroupLevel, getGroupType, isGlobalGroup, openGroup
 
Methods inherited from interface de.dante.extex.interpreter.context.ContextErrorCount
getErrorCount, incrementErrorCount
 
Methods inherited from interface de.dante.extex.interpreter.context.ContextInteraction
getInteraction, setInteraction
 
Methods inherited from interface de.dante.extex.interpreter.context.ContextTokens
getToks, getToksOrNull, setToks
 
Methods inherited from interface de.dante.extex.interpreter.context.ContextMark
clearSplitMarks, getBottomMark, getFirstMark, getSplitBottomMark, getSplitFirstMark, getTopMark, setMark, setSplitMark, startMarks
 
Methods inherited from interface de.dante.extex.interpreter.Tokenizer
getCatcode
 

Method Detail

addUnit

public void addUnit(UnitInfo info)
Add a unit to the list of loaded units. The units can be notified when the context is loaded from a format.

Parameters:
info - the info of the unit loaded
See Also:
unitIterator()

esc

public java.lang.String esc(java.lang.String name)
Attach the current escape character in front of a name and return the result. If the escape character is not set then the argument is returned unchanged.

This method is meant to produce a printable version of a control sequence for error messages.

Parameters:
name - the name of the macro
Returns:
the control sequence including the escape character

esc

public java.lang.String esc(Token token)
This method is meant to produce a printable version of a control sequence for error messages.

Parameters:
token - the token
Returns:
the control sequence including the escape character

escapechar

public UnicodeChar escapechar()
Return the current escape character or \0 if it is undefined. The escape character is retrieved from the count register \escapechar. This is a convenience method.

The Count Parameter \escapechar

The count register \escapechar contains code point of the escape character. This character is used whenever an control sequence is about to be printed and it has to be prefixed by the escape character.

If the value is less than zero then the escape character is assumed to be undefined. In this case the control sequence is not prefixed by any character.

Note that the escape character does not need to be in sync with the definition of the category codes. In fact they are independent. Usually they should coincide, but some interesting effects can be achieved with controlled disagreement.

Syntax

The formal description of this primitive is the following:
    ⟨escapechar⟩
     → \escapechar ⟨equals⟩ ⟨number⟩ 

Examples

    \escapechar=-1  

Returns:
the escape character

get

public java.lang.Object get(java.lang.Object extension,
                            java.lang.Object key)
Getter for a value from an extended section of the context.

Parameters:
extension - the name of the extension
key - the key for the value
Returns:
the value stored
See Also:
set(Object, Object, Object, boolean)

getAfterassignment

public Token getAfterassignment()
Getter for the afterassignment token.

Returns:
the afterassignment token.
See Also:
setAfterassignment(Token)

getBox

public Box getBox(java.lang.String name)
Getter for the box register. Count registers are named, either with a number or an arbitrary string. The numbered registers where limited to 256 in TeX. This restriction does no longer hold for ExTeX.

Parameters:
name - the name or number of the count register
Returns:
the count register or null if it is void
See Also:
setBox(String, Box, boolean)

getConditional

public Conditional getConditional()
Getter for the currently active conditional.

Returns:
the currently active conditional or null if none
See Also:
popConditional(), pushConditional(Locator, boolean, Code, long, boolean), getIfLevel()

getDelcode

public MathDelimiter getDelcode(UnicodeChar c)
Getter for the delimiter code mapping.

Parameters:
c - the character to which the delcode is assigned
Returns:
the delcode for the given character
See Also:
setDelcode(UnicodeChar, MathDelimiter, boolean)

getGlue

public Glue getGlue(java.lang.String name)
Getter for a glue register.

Parameters:
name - the name of the glue register to acquire.
Returns:
the value of the named glue register or null if none is set
See Also:
setGlue(String, Glue, boolean)

getId

public java.lang.String getId()
Getter for the id string. The id string is the classification of the original source like given in the format file. The id string can be null if not known yet.

Returns:
the id string
See Also:
setId(String)

getIfLevel

public long getIfLevel()
Getter for the current if level.

Returns:
the current if level
See Also:
getConditional(), popConditional(), pushConditional(Locator, boolean, Code, long, boolean)

getLanguage

public Language getLanguage(java.lang.String language)
                     throws InterpreterException
Getter for the hyphenation record for a given language. The language is used to find the hyphenation table. If the language is not known an attempt is made to create it. Otherwise the default hyphenation table is returned.

Parameters:
language - the name of the language to use
Returns:
the hyphenation table for the requested language
Throws:
InterpreterException - in case of an error
See Also:
set(Language, boolean)

getLanguageManager

public LanguageManager getLanguageManager()
Getter for the language manager.

Returns:
the language manager
See Also:
setLanguageManager(LanguageManager)

getLccode

public UnicodeChar getLccode(UnicodeChar uc)
Getter for the lccode mapping of upper case characters to their lower case equivalent.

Parameters:
uc - the upper case character
Returns:
the lower case equivalent or null if none exists
See Also:
setLccode(UnicodeChar, UnicodeChar, boolean), getUccode(UnicodeChar), setUccode(UnicodeChar, UnicodeChar, boolean)

getMagnification

public long getMagnification()
Getter for the magnification factor in per mille. The default value is 1000. It can only take positive numbers as values.

Returns:
the magnification factor

getMathcode

public MathCode getMathcode(UnicodeChar uc)
Getter for the math code of a character.

Parameters:
uc - the character index
Returns:
the math code
See Also:
setMathcode(UnicodeChar, MathCode, boolean)

getMuskip

public Muskip getMuskip(java.lang.String name)
Getter for a muskip register.

Parameters:
name - the name or the number of the register
Returns:
the named muskip or null if none is set
See Also:
setMuskip(String, Muskip, boolean)

getNamespace

public java.lang.String getNamespace()
Getter for the current name space.

Specified by:
getNamespace in interface Tokenizer
Returns:
the current name space
See Also:
setNamespace(String, boolean)

getParshape

public ParagraphShape getParshape()
Getter for the paragraph shape.

Returns:
the paragraph shape or null if no special shape is present
See Also:
setParshape(ParagraphShape)

getSfcode

public Count getSfcode(UnicodeChar uc)
Getter for the space factor code of a character.

Parameters:
uc - the Unicode character
Returns:
the space factor code.
See Also:
setSfcode(UnicodeChar, Count, boolean)

getStandardTokenStream

public TokenStream getStandardTokenStream()
Getter for standardTokenStream.

Returns:
the standardTokenStream
See Also:
setStandardTokenStream(TokenStream)

getTokenFactory

public TokenFactory getTokenFactory()
Getter for the token factory. The token factory can be used to get new tokens of some kind.

Returns:
the token factory
See Also:
setTokenFactory(TokenFactory)

getTokenizer

public Tokenizer getTokenizer()
Getter for the tokenizer. The tokenizer provides a way to evaluate the settings of the category codes.

Returns:
the tokenizer
See Also:
setCatcode(UnicodeChar, Catcode, boolean)

getTypesettingContext

public TypesettingContext getTypesettingContext()
Getter for the typesetting context.

Returns:
the typesetting context
See Also:
set(Color, boolean), set(Direction, boolean), set(Font, boolean), set(Language, boolean), set(TypesettingContext, boolean)

getUccode

public UnicodeChar getUccode(UnicodeChar lc)
Getter for the uccode mapping of lower case characters to their upper case equivalent.

Parameters:
lc - the upper case character
Returns:
the upper case equivalent or null if none exists
See Also:
setUccode(UnicodeChar, UnicodeChar, boolean), getLccode(UnicodeChar), setLccode(UnicodeChar, UnicodeChar, boolean)

popConditional

public Conditional popConditional()
                           throws InterpreterException
Pop the management information for a conditional from the stack and return it. If the stack is empty then null is returned.

Returns:
the formerly topmost element from the conditional stack
Throws:
InterpreterException - in case of an error
See Also:
pushConditional(Locator, boolean, Code, long, boolean), getConditional(), getIfLevel()

popDirection

public Direction popDirection()
Pop a direction from the direction stack.

Returns:
the topmost direction on the stack or null if the stack is empty
See Also:
pushDirection(Direction)

pushConditional

public void pushConditional(Locator locator,
                            boolean value,
                            Code primitive,
                            long branch,
                            boolean neg)
Put a value onto the conditional stack.

Parameters:
locator - the locator for the start of the if statement
value - the value to push
primitive - the name of the primitive which triggered this operation
branch - the branch number
neg - negation indicator
See Also:
popConditional(), getConditional(), getIfLevel()

pushDirection

public void pushDirection(Direction dir)
Push a direction onto the direction stack.

Parameters:
dir - the direction
See Also:
popDirection()

set

public void set(Color color,
                boolean global)
         throws ConfigurationException
Setter for the color in the current typesetting context.

Parameters:
color - the new color
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
Throws:
ConfigurationException - in case of an error in the configuration.
See Also:
getTypesettingContext()

set

public void set(Direction direction,
                boolean global)
         throws ConfigurationException
Setter for the direction in the current typesetting context.

Parameters:
direction - the new direction
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
Throws:
ConfigurationException - in case of an error in the configuration.
See Also:
getTypesettingContext()

set

public void set(Font font,
                boolean global)
         throws ConfigurationException
Setter for the font in the current typesetting context.

Parameters:
font - the new font
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
Throws:
ConfigurationException - in case of an error in the configuration.
See Also:
getTypesettingContext()

set

public void set(Language language,
                boolean global)
         throws ConfigurationException
Setter for the language in the current typesetting context.

Parameters:
language - the new language
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
Throws:
ConfigurationException - in case of an error in the configuration.
See Also:
getTypesettingContext()

set

public void set(java.lang.Object extension,
                java.lang.Object key,
                java.lang.Object value,
                boolean global)
Setter for a value from an extended section of the context.

Parameters:
extension - the name of the extension
key - the key for the value
value - the value to store
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
See Also:
get(Object, Object)

set

public void set(TypesettingContext context,
                boolean global)
Setter for the typesetting context in the specified groups.

Parameters:
context - the processor context
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
See Also:
getTypesettingContext()

setAfterassignment

public void setAfterassignment(Token token)
Setter for the afterassignment token.

Parameters:
token - the afterassignment token.
See Also:
getAfterassignment()

setBox

public void setBox(java.lang.String name,
                   Box value,
                   boolean global)
Setter for the box register in the current group. Count registers are named, either with a number or an arbitrary string. The numbered registers where limited to 256 in TeX. This restriction does no longer hold for ExTeX.

Parameters:
name - the name or the number of the register
value - the new value of the register
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
See Also:
getBox(String)

setCatcode

public void setCatcode(UnicodeChar c,
                       Catcode catcode,
                       boolean global)
                throws HelpingException
Setter for the catcode of a character in the specified groups.

Parameters:
c - the character to assign a catcode for
catcode - the catcode of the character
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
Throws:
HelpingException - in case of an error
See Also:
getTokenizer()

setDelcode

public void setDelcode(UnicodeChar c,
                       MathDelimiter delimiter,
                       boolean global)
Setter for the delimiter code mapping.

Parameters:
c - the character to which the delcode is assigned
delimiter - the delimiter code
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
See Also:
getDelcode(UnicodeChar)

setGlue

public void setGlue(java.lang.String name,
                    Glue value,
                    boolean global)
             throws InterpreterException
Setter for a glue register.

Parameters:
name - the name of the glue register
value - the glue value to set
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
Throws:
InterpreterException - in case of an error
See Also:
getGlue(String)

setId

public void setId(java.lang.String id)
Setter for the id string. The id string is the classification of the original source like given in the format file.

Parameters:
id - the id string
See Also:
getId()

setLanguageManager

public void setLanguageManager(LanguageManager manager)
                        throws ConfigurationException
Setter for the language manager.

Parameters:
manager - the language manager
Throws:
ConfigurationException - in case of an configuration error
See Also:
getLanguageManager()

setLccode

public void setLccode(UnicodeChar uc,
                      UnicodeChar lc,
                      boolean global)
Declare the translation from an upper case character to a lower case character.

Parameters:
uc - upper case character
lc - lower case equivalent
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
See Also:
getLccode(UnicodeChar), getUccode(UnicodeChar), setUccode(UnicodeChar, UnicodeChar, boolean)

setMagnification

public void setMagnification(long mag,
                             boolean lock)
                      throws HelpingException
Setter for the magnification. The magnification is a global value which can be assigned at most once. It contains the magnification factor in per mille. The default value is 1000. It can only take positive numbers as values. A maximal value can be enforced by an implementation.

Parameters:
mag - the new magnification factor
lock - lock the new value. Thus it can not be alterd afterwards.
Throws:
HelpingException - in case that the magnification factor is not in the allowed range or that the magnification has been set to a different value earlier.
See Also:
getMagnification()

setMathcode

public void setMathcode(UnicodeChar uc,
                        MathCode code,
                        boolean global)
Setter for the math code of a character

Parameters:
uc - the character index
code - the new math code
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
See Also:
getMathcode(UnicodeChar)

setMuskip

public void setMuskip(java.lang.String name,
                      Muskip value,
                      boolean global)
Setter for a muskip register.

Parameters:
name - the name or the number of the register
value - the new value
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
See Also:
getMuskip(String)

setNamespace

public void setNamespace(java.lang.String namespace,
                         boolean global)
Setter for the name space.

Parameters:
namespace - the new name space
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
See Also:
getNamespace()

setParshape

public void setParshape(ParagraphShape shape)
Setter for the paragraph shape.

Parameters:
shape - the new paragraph shape
See Also:
getParshape()

setSfcode

public void setSfcode(UnicodeChar uc,
                      Count code,
                      boolean global)
Setter for the space factor code in the specified groups. Any character has an associated space factor. This value can be set with the current method.

Parameters:
uc - the Unicode character to assign the sfcode to
code - the new sfcode
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
See Also:
getSfcode(UnicodeChar)

setStandardTokenStream

public void setStandardTokenStream(TokenStream standardTokenStream)
Setter for standardTokenStream.

Parameters:
standardTokenStream - the standardTokenStream to set.
See Also:
getStandardTokenStream()

setTokenFactory

public void setTokenFactory(TokenFactory factory)
Setter for the token factory.

Parameters:
factory - the new token factory
See Also:
getTokenFactory()

setUccode

public void setUccode(UnicodeChar lc,
                      UnicodeChar uc,
                      boolean global)
Declare the translation from a lower case character to an upper case character.

Parameters:
lc - lower case character
uc - uppercase equivalent
global - the indicator for the scope; true means all groups; otherwise the current group is affected only
See Also:
getUccode(UnicodeChar), getLccode(UnicodeChar), setLccode(UnicodeChar, UnicodeChar, boolean)

unitIterator

public java.util.Iterator unitIterator()
Get an iterator to enumerate all unit infos.

Returns:
the iterator for unit infos
See Also:
addUnit(UnitInfo)