public void CreateStream()
        {
            var op0 = new Operand(OperandType.Literal, 1, 0);
            var op1 = new Operand(OperandType.Literal, 1, 0);

            var runtimeStream = new InstrucStream(
                new Instruction(OpCode.ADD, 1, op0, op1),
                new Instruction(OpCode.MOV, 2, op0, op1)
                );

            Assert.AreEqual(2, runtimeStream.Size);
        }
Esempio n. 2
0
        public Runnable GetScript(Instruction[] instructions, int secondIndex)
        {
            var stream = new InstrucStream(instructions);

            var function = new Function(Function.MainName, 0);
            var dofunction = new Function("Do", secondIndex);

            var ftable = new FunctionTable
                             {
                                 { Function.MainName, function },
                                 { "Do", dofunction}
                             };

            return new Runnable(stream, ftable);
        }
Esempio n. 3
0
 public Runnable(InstrucStream instStream, FunctionTable fTable)
 {
     Setup(instStream, fTable, null);
 }
Esempio n. 4
0
 public Runnable(InstrucStream instStream, FunctionTable fTable, SymbolTable symbolTable)
 {
     Setup(instStream, fTable, symbolTable);
 }
Esempio n. 5
0
        private void Setup(InstrucStream instStream, FunctionTable fTable, SymbolTable symbolTable)
        {
            stream = instStream;
            functionTable = fTable;

            if (functionTable.ContainsKey(Function.MainName))
            {
                mainFunction = functionTable[Function.MainName];
            }

            ScriptSymbolTable = SymbolTable.CreateFor(symbolTable);

            RuntimeStack = new RuntimeStack();

            ParamStack = new ParamStack();
        }