de.dante.extex.interpreter
Interface Interpreter

All Superinterfaces:
TokenSource
All Known Implementing Classes:
Max

public interface Interpreter
extends TokenSource

This interface represents the outside view on an interpreter. It contains everything needed to set it up and make it run.

Version:
$Revision: 1.38 $
Author:
Gerd Neugebauer, Michael Niedermair
See Also:
"TeX – The Program [1029]"

Method Summary
 Context getContext()
          Getter for the context
 ErrorHandler getErrorHandler()
          Getter for the error handler.
 Interaction getInteraction()
          Getter for the interaction mode.
 Typesetter getTypesetter()
          Getter for the typesetter.
 void loadFormat(java.io.InputStream stream, java.lang.String fmt, java.lang.String contextType, java.lang.String languageType)
          Load the format from an external source.
 void loadUnit(java.lang.String name)
          Load a unit.
 void run()
          Process the current token streams by repeatedly reading a single token and processing it until no token is left.
 void run(TokenStream stream)
          Add a token stream and start processing it.
 Context setContext(Context context)
          Setter for the context.
 void setErrorHandler(ErrorHandler handler)
          Setter for the error handler.
 void setFontFactory(FontFactory fontFactory)
          Setter for the font factory
 void setInteraction(Interaction interaction)
          Setter for the interaction mode.
 void setJobname(java.lang.String jobname)
          Setter for the job name.
 void setTokenStreamFactory(TokenStreamFactory factory)
          Setter for the token stream factory.
 void setTypesetter(Typesetter typesetter)
          Setter for the typesetter.
 
Methods inherited from interface de.dante.extex.interpreter.TokenSource
addStream, closeAllStreams, closeNextFileStream, execute, executeGroup, expand, getBox, getControlSequence, getFont, getKeyword, getLastToken, getLocator, getNonSpace, getOptionalEquals, getToken, getTokens, getTokenStreamFactory, push, push, push, scanCharacterCode, scanNonSpace, scanNumber, scanNumber, scanRegisterName, scanToken, scanTokens, scanTokensAsString, scanUnprotectedTokens, skipSpace, update
 

Method Detail

getContext

public Context getContext()
Getter for the context

Returns:
the context
See Also:
setContext(Context)

getErrorHandler

public ErrorHandler getErrorHandler()
Getter for the error handler. The error handler might not be set. In this case null is returned.

Returns:
the error handler currently registered
See Also:
setErrorHandler(ErrorHandler)

getInteraction

public Interaction getInteraction()
Getter for the interaction mode.

Returns:
the interaction mode
See Also:
setInteraction(Interaction)

getTypesetter

public Typesetter getTypesetter()
Getter for the typesetter.

Returns:
the typesetter
See Also:
setTypesetter(Typesetter)

loadFormat

public void loadFormat(java.io.InputStream stream,
                       java.lang.String fmt,
                       java.lang.String contextType,
                       java.lang.String languageType)
                throws LoaderException,
                       java.io.IOException
Load the format from an external source.

Parameters:
stream - stream to read from
fmt - the name of the format to be loaded
Throws:
java.io.IOException - in case of an IO error
LoaderException - in case of an error during loading

loadUnit

public void loadUnit(java.lang.String name)
              throws ConfigurationException
Load a unit.

Parameters:
name - the name of the configuration
Throws:
ConfigurationException - in case of an error

run

public void run()
         throws ConfigurationException,
                ErrorLimitException,
                InterpreterException
Process the current token streams by repeatedly reading a single token and processing it until no token is left. The visitor pattern is used to branch to the appropriate method for processing a single token.

Throws:
ConfigurationException - in case of a configuration error
ErrorLimitException - in case that the error limit has been reached
InterpreterException - in case of another error
See Also:
run(TokenStream)

run

public void run(TokenStream stream)
         throws ConfigurationException,
                ErrorLimitException,
                InterpreterException
Add a token stream and start processing it.

Parameters:
stream - the input stream to consider
Throws:
ConfigurationException - in case of a configuration error
ErrorLimitException - in case that the error limit has been reached
InterpreterException - in case of another error
See Also:
run()

setContext

public Context setContext(Context context)
Setter for the context. Use with care!

Parameters:
context - the interpreter context
Returns:
the old context
See Also:
getContext()

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
Setter for the error handler. The value of null can be used to delete the error handler currently set.

Parameters:
handler - the new error handler
See Also:
getErrorHandler()

setFontFactory

public void setFontFactory(FontFactory fontFactory)
Setter for the font factory

Parameters:
fontFactory - the new font factory

setInteraction

public void setInteraction(Interaction interaction)
                    throws GeneralException
Setter for the interaction mode.

Parameters:
interaction - the interaction mode
Throws:
GeneralException - in case of an error
See Also:
getInteraction()

setJobname

public void setJobname(java.lang.String jobname)
                throws GeneralException
Setter for the job name.

Parameters:
jobname - the new value for the job name
Throws:
GeneralException - in case of an error

setTokenStreamFactory

public void setTokenStreamFactory(TokenStreamFactory factory)
                           throws ConfigurationException
Setter for the token stream factory. During the processing of the input several occasions might come up where new token streams are needed. In this case the factory can be used to acquire them.

Parameters:
factory - the token stream factory
Throws:
ConfigurationException - in case of en error in the configuration

setTypesetter

public void setTypesetter(Typesetter typesetter)
Setter for the typesetter.

Parameters:
typesetter - the new typesetter
See Also:
getTypesetter()