예제 #1
0
        private XzaarAssembly Read(byte[] binary)
        {
            var assembly = new XzaarAssembly();
            var ctx      = new AssemblyReaderContext(binary, assembly);

            return(this.Read(ctx));
        }
예제 #2
0
 internal Runtime(VirtualMachine vm, XzaarAssembly asm, RuntimeSettings settings)
 {
     this.vm       = vm;
     this.asm      = asm;
     this.settings = settings ?? RuntimeSettings.Default;
     this.Init();
 }
예제 #3
0
        // private int tempVariableCount;

        public ScriptCompilerContext(string assemblyName, XzaarExpression expressionTree)
        {
            MethodInstructions = new CompilerInstructionCollection(this);
            GlobalInstructions = new CompilerInstructionCollection(this);

            this.ExpressionTree  = expressionTree;
            this.KnownTypes      = new List <TypeReference>();
            this.Assembly        = XzaarAssembly.CreateAssembly(assemblyName);
            this.flowControl     = new FlowControlScope(null, -1);
            this.rootFlowControl = this.flowControl;
        }
예제 #4
0
 public static string AssemblyCode(this XzaarAssembly tree)
 {
     return(XzaarScriptDisassembler.Disassemble(tree));
 }
예제 #5
0
 public static XzaarRuntime Load(this XzaarAssembly asm)
 {
     return(XzaarVirtualMachine.Load(asm));
 }
예제 #6
0
 public AssemblyWriterContext(XzaarAssembly assembly, string filename)
 {
     this.Assembly = assembly;
     this.Filename = filename;
 }
예제 #7
0
 public static Runtime Debug(XzaarAssembly asm, RuntimeSettings settings)
 {
     return(new VirtualMachine(asm).RunImpl(RuntimeStepType.StepByStep, settings));
 }
예제 #8
0
 public static Runtime Load(XzaarAssembly asm, RuntimeSettings settings)
 {
     return(new VirtualMachine(asm).CreateRuntimeInstance(settings));
 }
예제 #9
0
 public static Runtime Run(XzaarAssembly asm, RuntimeSettings settings)
 {
     return(new VirtualMachine(asm).RunImpl(RuntimeStepType.Complete, settings));
 }
예제 #10
0
 public static Runtime Load(this XzaarAssembly asm, RuntimeSettings settings)
 {
     return(VirtualMachine.Load(asm, settings));
 }
예제 #11
0
 public VirtualMachine(XzaarAssembly asm)
 {
     this.asm         = asm;
     this.interpreter = new VirtualMachineInstructionInterpreter(this);
 }
예제 #12
0
 public static Runtime Run(this XzaarAssembly asm)
 {
     return(VirtualMachine.Run(asm));
 }
예제 #13
0
        public static void WriteToFile(XzaarAssembly xzaarAssembly, string filename)
        {
            var writer = new AssemblyWriter();

            writer.Write(new AssemblyWriterContext(xzaarAssembly, filename));
        }
예제 #14
0
 public AssemblyReaderContext(byte[] assemblyBytes, XzaarAssembly assembly)
 {
     this.AssemblyBytes = assemblyBytes;
     this.Assembly      = assembly;
     this.Reader        = new BinaryReader(new MemoryStream(this.AssemblyBytes));
 }
예제 #15
0
 public static string Disassemble(XzaarAssembly asm)
 {
     return(new XzaarScriptDisassembler(asm).Disassemble());
 }
예제 #16
0
 public XzaarScriptDisassembler(XzaarAssembly asm)
 {
     this.asm = asm;
 }