Exemplo n.º 1
0
        /// <summary>
        /// Bind the operand
        /// </summary>
        public override void Bind(EpsInterpreter interpreter)
        {
            var name = new NameOperand {
                Value = this.Name
            };

            BoundOperand = DictionaryStackHelper.FindValue(interpreter.DictionaryStack, name);
        }
Exemplo n.º 2
0
        public override void Execute(EpsInterpreter interpreter)
        {
            var name = new NameOperand {
                Value = this.Name
            };
            var op = DictionaryStackHelper.FindValue(interpreter.DictionaryStack, name);

            interpreter.OperandStack.Push(op);
        }
Exemplo n.º 3
0
        public override void Execute(EpsInterpreter interpreter)
        {
            var operandStack = interpreter.OperandStack;

            var key = operandStack.Pop();

            var value = DictionaryStackHelper.FindValue(interpreter.DictionaryStack, key);

            if (value == null)
            {
                throw new Exception($"unknown key \"{key}\"");
            }

            operandStack.Push(value.Copy());
        }
Exemplo n.º 4
0
        public override void Execute(EpsInterpreter interpreter)
        {
            var operandStack = interpreter.OperandStack;

            var value = operandStack.Pop();
            var key   = operandStack.Pop();

            var dict = DictionaryStackHelper.FindDictionary(interpreter.DictionaryStack, key);

            if (value == null)
            {
                dict = interpreter.DictionaryStack.Peek();
            }

            dict.Add(key, value);
        }
Exemplo n.º 5
0
        public override void Execute(EpsInterpreter interpreter)
        {
            if (!IsExecutable)
            {
                interpreter.OperandStack.Push(Copy());
            }
            else
            {
                var name = new NameOperand(this.Value);
                var op   = DictionaryStackHelper.FindValue(interpreter.DictionaryStack, name);

                if (op != null)
                {
                    interpreter.Execute(op);
                }
            }
        }
Exemplo n.º 6
0
        public override void Execute(EpsInterpreter interpreter)
        {
            var operandStack = interpreter.OperandStack;

            bool ret = false;
            var  key = operandStack.Pop();

            var dict = DictionaryStackHelper.FindDictionary(interpreter.DictionaryStack, key);

            if (dict != null)
            {
                var dictOperand = new DictionaryOperand(dict);
                operandStack.Push(dictOperand);
                ret = true;
            }

            var boolean = new BooleanOperand {
                Value = ret
            };

            operandStack.Push(boolean);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Execute the operand
        /// </summary>
        public override void Execute(EpsInterpreter interpreter)
        {
            if (interpreter.BreakCurrentLoop)
            {
                return;
            }

            if (BoundOperand != null)
            {
                interpreter.Execute(BoundOperand);
            }
            else
            {
                var name = new NameOperand {
                    Value = this.Name
                };
                var op = DictionaryStackHelper.FindValue(interpreter.DictionaryStack, name);

                if (op != null)
                {
                    interpreter.Execute(op);
                }
                else
                {
                    // Throwing an exception when the interpreter is within a stopped context
                    // would also be ok and is the prefered behavior. We test for the stopped
                    // context here to make debugging a bit easier. So that the debugger
                    // doesn't stop when the "exception" is handled in the postscript script,
                    // e.g. when tests are made if a command is available.

                    if (!interpreter.IsInStoppedContext)
                    {
                        throw new Exception($"unknown command \"{Name}\"");
                    }

                    interpreter.StopProcedure();
                }
            }
        }
Exemplo n.º 8
0
 public override void Execute(EpsInterpreter interpreter)
 {
     DictionaryStackHelper.RemoveNonPermanentDictionaries(interpreter.DictionaryStack);
 }