org.foray.ps
Class PsInterpreter4a

java.lang.Object
  extended by org.foray.ps.PsInterpreter4a
All Implemented Interfaces:
org.axsl.ps.PsInterpreter

public class PsInterpreter4a
extends Object
implements org.axsl.ps.PsInterpreter

A generic PostScript interpreter. This interpreter can be used in wide variety of different processing environments by creating approprate subclasses of PsSystemDict4a.


Field Summary
static byte CARRIAGE_RETURN
          The PostScript "carriage-return" character.
static byte[] DELIMITER
          The PostScript delimiters.
static byte FORM_FEED
          The PostScript "form-feed" character.
static byte LEFT_ANGLE
          The PostScript "left angle" character.
static byte LEFT_BRACKET
          The PostScript "left bracket" character.
static byte LEFT_CURLY
          The PostScript "left curly" character.
static byte LEFT_PAREN
          The PostScript "left parentheses" character.
static byte LINE_FEED
          The PostScript "line-feed" character.
static int MAX_ARRAY_SIZE
          The maximum PostScript array size.
static byte MINUS_SIGN
          The PostScript "minus" character.
static byte[] NEWLINE
          The PostScript new-line possibilities.
static byte NULL
          The PostScript "null" character.
static byte PERCENT
          The PostScript "percent" character.
static byte PLUS_SIGN
          The PostScript "plus" character.
static byte RIGHT_ANGLE
          The PostScript "right angle" character.
static byte RIGHT_BRACKET
          The PostScript "right bracket" character.
static byte RIGHT_CURLY
          The PostScript "right curly" character.
static byte RIGHT_PAREN
          The PostScript "right parentheses" character.
static byte[] SIGN_INDICATOR
          The PostScript sign indicators.
static byte SLASH
          The PostScript "slash" character.
static byte SPACE
          The PostScript "space" character.
static byte TAB
          The PostScript "tab" character.
static byte[] WHITESPACE
          The PostScript whitespace characters.
 
Constructor Summary
PsInterpreter4a(org.axsl.ps.PsInput input, PsSystemDict4a systemDict)
          Constructor for a PostScript interpreter.
 
Method Summary
protected  PsObject find(PsObject key)
          Find an object, searching through the dictionary stack until the object is found.
 PsObject find(String key)
          Convenience method for external users of the interpreter.
 int getCurrentColumn()
          Returns the current column number in the file being processed.
 int getCurrentLine()
          Returns the current line number in the file being processed.
 PsDictionaryStack getDictionaryStack()
          Returns the dictionary stack.
 PsExecutionStack getExecutionStack()
          Returns the execution stack.
 PsFontDirectory4a getFontDirectory()
          Returns the font dictionary.
 PsGraphicsState getGraphicsState()
          Returns the current graphics state.
 PsGraphicsStateStack getGraphicsStateStack()
          Returns the graphics state stack.
protected  PsDictionary getInternalDict()
          Returns the internal dictionary.
 PsOperandStack getOperandStack()
          Returns the operand stack.
 boolean getPackingMode()
          Returns the packing mode.
 PsDictionary getSystemDict()
          Returns the system dictionary.
 void process()
           
 void processItem()
          Processes the top item on the execution stack.
 void setPackingMode(boolean newPackingMode)
          Sets the packing mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final byte NULL
The PostScript "null" character.

See Also:
Constant Field Values

TAB

public static final byte TAB
The PostScript "tab" character.

See Also:
Constant Field Values

LINE_FEED

public static final byte LINE_FEED
The PostScript "line-feed" character.

See Also:
Constant Field Values

FORM_FEED

public static final byte FORM_FEED
The PostScript "form-feed" character.

See Also:
Constant Field Values

CARRIAGE_RETURN

public static final byte CARRIAGE_RETURN
The PostScript "carriage-return" character.

See Also:
Constant Field Values

SPACE

public static final byte SPACE
The PostScript "space" character.

See Also:
Constant Field Values

LEFT_PAREN

public static final byte LEFT_PAREN
The PostScript "left parentheses" character.

See Also:
Constant Field Values

RIGHT_PAREN

public static final byte RIGHT_PAREN
The PostScript "right parentheses" character.

See Also:
Constant Field Values

LEFT_ANGLE

public static final byte LEFT_ANGLE
The PostScript "left angle" character.

See Also:
Constant Field Values

RIGHT_ANGLE

public static final byte RIGHT_ANGLE
The PostScript "right angle" character.

See Also:
Constant Field Values

LEFT_BRACKET

public static final byte LEFT_BRACKET
The PostScript "left bracket" character.

See Also:
Constant Field Values

RIGHT_BRACKET

public static final byte RIGHT_BRACKET
The PostScript "right bracket" character.

See Also:
Constant Field Values

LEFT_CURLY

public static final byte LEFT_CURLY
The PostScript "left curly" character.

See Also:
Constant Field Values

RIGHT_CURLY

public static final byte RIGHT_CURLY
The PostScript "right curly" character.

See Also:
Constant Field Values

SLASH

public static final byte SLASH
The PostScript "slash" character.

See Also:
Constant Field Values

PERCENT

public static final byte PERCENT
The PostScript "percent" character.

See Also:
Constant Field Values

PLUS_SIGN

public static final byte PLUS_SIGN
The PostScript "plus" character.

See Also:
Constant Field Values

MINUS_SIGN

public static final byte MINUS_SIGN
The PostScript "minus" character.

See Also:
Constant Field Values

WHITESPACE

public static final byte[] WHITESPACE
The PostScript whitespace characters.


NEWLINE

public static final byte[] NEWLINE
The PostScript new-line possibilities.


DELIMITER

public static final byte[] DELIMITER
The PostScript delimiters.


SIGN_INDICATOR

public static final byte[] SIGN_INDICATOR
The PostScript sign indicators.


MAX_ARRAY_SIZE

public static final int MAX_ARRAY_SIZE
The maximum PostScript array size.

See Also:
Constant Field Values
Constructor Detail

PsInterpreter4a

public PsInterpreter4a(org.axsl.ps.PsInput input,
                       PsSystemDict4a systemDict)
                throws PsInterpreterException4a
Constructor for a PostScript interpreter.

Parameters:
input - The PsInput instance that should be used as standard input to the interpreter.
systemDict - The dictionary that should be used.
Throws:
PsInterpreterException4a - For invalid parameters.
Method Detail

process

public void process()
             throws PsInterpreterException4a
Specified by:
process in interface org.axsl.ps.PsInterpreter
Throws:
PsInterpreterException4a

processItem

public void processItem()
                 throws PsOperatorException,
                        PsInterpreterException4a
Processes the top item on the execution stack.

Throws:
PsOperatorException - For errors executing operators.
PsInterpreterException4a - For any PostScript error.

find

protected PsObject find(PsObject key)
Find an object, searching through the dictionary stack until the object is found.

Parameters:
key - The key to the object desired.
Returns:
The value corresponding to key, or null if it is not found in any dictionary.

find

public PsObject find(String key)
Convenience method for external users of the interpreter.

Parameters:
key - String containing the name of the item to be found.
Returns:
The PsObject that is stored with key.

getSystemDict

public PsDictionary getSystemDict()
Returns the system dictionary. This should always be the one at the bottom of the dictonary stack.

Returns:
The system dictionary.

getFontDirectory

public PsFontDirectory4a getFontDirectory()
Returns the font dictionary.

Specified by:
getFontDirectory in interface org.axsl.ps.PsInterpreter
Returns:
The font dictionary.

getInternalDict

protected PsDictionary getInternalDict()
Returns the internal dictionary.

Returns:
The internal dictionary.

getExecutionStack

public PsExecutionStack getExecutionStack()
Returns the execution stack.

Returns:
The execution stack.

getOperandStack

public PsOperandStack getOperandStack()
Returns the operand stack.

Returns:
The operand stack.

getDictionaryStack

public PsDictionaryStack getDictionaryStack()
Returns the dictionary stack.

Returns:
The dictionary stack.

getGraphicsStateStack

public PsGraphicsStateStack getGraphicsStateStack()
Returns the graphics state stack.

Returns:
The graphics state stack.

getGraphicsState

public PsGraphicsState getGraphicsState()
Returns the current graphics state.

Returns:
The current graphics state.

getPackingMode

public boolean getPackingMode()
Returns the packing mode.

Returns:
The packing mode.

setPackingMode

public void setPackingMode(boolean newPackingMode)
Sets the packing mode.

Parameters:
newPackingMode - The new packing mode.

getCurrentLine

public int getCurrentLine()
Returns the current line number in the file being processed.

Returns:
The current line number in the file being processed.

getCurrentColumn

public int getCurrentColumn()
Returns the current column number in the file being processed.

Returns:
The current column number in the file being processed.


Copyright © 2017. All rights reserved.