public class PostscriptFactory extends Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
currentType |
protected static double |
isFalse |
protected static double |
isTrue |
protected static int |
PS_abs
main method to run the software as standalone application *
public static void main(String[] args) {
|
protected static int |
PS_add |
protected static int |
PS_and |
protected static int |
PS_atan |
protected static int |
PS_bits |
protected static int |
PS_BOOLEAN |
protected static int |
PS_ceil |
protected static int |
PS_copy |
protected static int |
PS_cos |
protected static int |
PS_cvi |
protected static int |
PS_cvr |
protected static int |
PS_div |
protected static int |
PS_dup |
protected static int |
PS_eq |
protected static int |
PS_exch |
protected static int |
PS_exp |
protected static int |
PS_fals |
protected static int |
PS_floo |
protected static int |
PS_ge |
protected static int |
PS_gt |
protected static int |
PS_idiv |
protected static int |
PS_if |
protected static int |
PS_ifel |
protected static int |
PS_inde |
protected static int |
PS_INTEGER |
protected static int |
PS_le |
protected static int |
PS_ln |
protected static int |
PS_log |
protected static int |
PS_lt |
protected static int |
PS_mod |
protected static int |
PS_mul |
protected static int |
PS_ne |
protected static int |
PS_neg |
protected static int |
PS_not |
protected static int |
PS_or |
protected static int |
PS_pop |
protected static int |
PS_REAL |
protected static int |
PS_roll |
protected static int |
PS_roun |
protected static int |
PS_sin |
protected static int |
PS_sqrt |
protected static int |
PS_sub |
protected static int |
PS_true |
protected static int |
PS_trun |
protected static int |
PS_UNKNOWN |
protected static int |
PS_xor |
protected double[] |
stack |
protected int[] |
stackType |
protected int |
stkPtr |
protected int |
stkTypePtr |
protected boolean |
testingFunction |
| Constructor and Description |
|---|
PostscriptFactory(byte[] stream) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
execute(int id) |
double[] |
executePostscript()
work through Postscript stream reading commands and executing
|
protected static int |
getCommandID(byte[] cmds) |
void |
resetStacks(float[] values)
put input values onto stack for processing
|
protected boolean testingFunction
protected double[] stack
protected int[] stackType
protected int stkPtr
protected int stkTypePtr
protected int currentType
protected static final double isTrue
protected static final double isFalse
protected static final int PS_INTEGER
protected static final int PS_REAL
protected static final int PS_BOOLEAN
protected static final int PS_UNKNOWN
protected static final int PS_abs
}
static{
String[] cmds = new String[]{ "abs","add","atan","ceiling","cos","cvi","cvr","div","exp","floor","idiv", "ln","log","mod","mul","neg","sin","sqrt","sub","round", "truncate","and", "bitshift","eq","false","ge","gt","le","lt","ne","not","or","true", "xor", "if", "ifelse","copy","exch","pop","dup","index","roll"};
// generate a unique checksum for each based on first 4 characters Map checkvalues=new HashMap();
int commandCount = cmds.length;
// build table of values
for(int i=0;i
for(int j=0;j
if(checkvalues.containsKey(mappedKey)){
System.out.println("Duplicate on "+checkvalues.get(mappedKey)+" "+cmds[i]);
}
checkvalues.put(mappedKey,cmds[i]);
System.out.println("\n//unique id for "+cmds[i]);
if(cmds[i].length()>4)
System.out.println("final protected static int PS_"+cmds[i].substring(0,4)+" = "+mappedKey+";");
else
System.out.println("final protected static int PS_"+cmds[i]+" = "+mappedKey+";");
}
// build cases
System.out.println("//identify command\nprotected static int getCommandID(int value) {\nint id = -1;\nswitch (value) {");
for(int i=0;i
for(int j=0;j
System.out.println("\n}\nreturn id;\n}");
// build getString
//System.out.println("//identify command\nprotected static int getCommandID(int value) {\nint id = -1;\nswitch (value) {");
for(int i=0;i
for(int j=0;j
System.out.println("break;");
}
System.out.println("\n}\nreturn id;\n}");
}
/
protected static final int PS_add
protected static final int PS_atan
protected static final int PS_ceil
protected static final int PS_cos
protected static final int PS_cvi
protected static final int PS_cvr
protected static final int PS_div
protected static final int PS_exp
protected static final int PS_floo
protected static final int PS_idiv
protected static final int PS_ln
protected static final int PS_log
protected static final int PS_mod
protected static final int PS_mul
protected static final int PS_neg
protected static final int PS_sin
protected static final int PS_sqrt
protected static final int PS_sub
protected static final int PS_roun
protected static final int PS_trun
protected static final int PS_and
protected static final int PS_bits
protected static final int PS_eq
protected static final int PS_fals
protected static final int PS_ge
protected static final int PS_gt
protected static final int PS_le
protected static final int PS_lt
protected static final int PS_ne
protected static final int PS_not
protected static final int PS_or
protected static final int PS_true
protected static final int PS_xor
protected static final int PS_if
protected static final int PS_ifel
protected static final int PS_copy
protected static final int PS_exch
protected static final int PS_pop
protected static final int PS_dup
protected static final int PS_inde
protected static final int PS_roll
protected static int getCommandID(byte[] cmds)
protected int execute(int id)
id - execute commands or return -1 as errorpublic double[] executePostscript()
public void resetStacks(float[] values)
values - Copyright © 2017. All rights reserved.