public EpsInterpreter() { OperandStack = new EpsStack <Operand>(); }
/// <summary> /// Prepare dictionaries /// </summary> private void PrepareStandardDictionaries(int postscriptVersion) { ResourceManager = new ResourceManager(); ResourceManager.DefineResource("Category", new NameOperand("Generic"), new DictionaryOperand()); DictionaryStack = new EpsStack <EpsDictionary>(); SystemDict = new EpsDictionary { IsPermanent = true }; GlobalDict = new EpsDictionary { IsPermanent = true }; UserDict = new EpsDictionary { IsPermanent = true }; ErrorDict = new EpsDictionary { IsPermanent = true }; DollarErrordict = new EpsDictionary { IsPermanent = true }; statusDict = new EpsDictionary { IsPermanent = true }; fontDict = new EpsDictionary { IsPermanent = true }; DictionaryStack.Push(SystemDict); DictionaryStack.Push(GlobalDict); DictionaryStack.Push(UserDict); var systemDict = SystemDict; var name = new NameOperand("systemdict"); Operand operand = new DictionaryOperand(SystemDict); systemDict.Add(name, operand); name = new NameOperand("userdict"); operand = new DictionaryOperand(UserDict); systemDict.Add(name, operand); name = new NameOperand("globaldict"); operand = new DictionaryOperand(GlobalDict); systemDict.Add(name, operand); name = new NameOperand("statusdict"); operand = new DictionaryOperand(statusDict); systemDict.Add(name, operand); name = new NameOperand("errordict"); operand = new DictionaryOperand(ErrorDict); systemDict.Add(name, operand); name = new NameOperand("$error"); operand = new DictionaryOperand(DollarErrordict); systemDict.Add(name, operand); name = new NameOperand("GlobalFontDirectory"); operand = new DictionaryOperand(fontDict); systemDict.Add(name, operand); name = new NameOperand("SharedFontDirectory"); operand = new DictionaryOperand(fontDict); systemDict.Add(name, operand); name = new NameOperand("true"); operand = new BooleanOperand(true); systemDict.Add(name, operand); name = new NameOperand("false"); operand = new BooleanOperand(false); systemDict.Add(name, operand); name = new NameOperand("null"); operand = new NullOperand(); systemDict.Add(name, operand); // for level 1 do not create this name, some adobe scripts // assume level 2 or higher just based on the existence of the name if (postscriptVersion >= 2) { name = new NameOperand("languagelevel"); operand = new IntegerOperand(postscriptVersion); systemDict.Add(name, operand); } name = new NameOperand("newerror"); var b = new BooleanOperand(false); DollarErrordict.Add(name, b); }