Пример #1
0
        internal static ProtoCore.Core DebugRunnerRunOnly(string code, out RuntimeCore runtimeCore)
        {
            ProtoCore.Core core;
            DebugRunner    fsr;

            // Specify some of the requirements of IDE.
            var options = new ProtoCore.Options();

            options.ExecutionMode     = ProtoCore.ExecutionMode.Serial;
            options.GCTempVarsOnDebug = false;

            string testPath = @"..\..\..\test\Engine\ProtoTest\ImportFiles\";

            options.IncludeDirectories.Add(testPath);

            core = new ProtoCore.Core(options);
            core.Compilers.Add(ProtoCore.Language.Associative, new ProtoAssociative.Compiler(core));
            core.Compilers.Add(ProtoCore.Language.Imperative, new ProtoImperative.Compiler(core));

            fsr = new DebugRunner(core);

            DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper());
            CLRModuleType.ClearTypes();

            //Run

            fsr.PreStart(code);
            DebugRunner.VMState vms = null;

            vms         = fsr.Run();
            runtimeCore = fsr.runtimeCore;
            return(core);
        }
        //Test "SomeNulls()"
        public void ComputeReducedParams()
        {
            string code =
                @"
                      a = {1,2};
                      b = {3,4};
                  "                                                                                     ;

            //Run
            fsr.PreStart(code, runnerConfig);
            DebugRunner.VMState vms = null;
            vms = fsr.Run();
            var mirror             = vms.mirror;
            List <StackValue> args = new List <StackValue>();

            args.Add(mirror.GetRawFirstValue("a"));
            args.Add(mirror.GetRawFirstValue("b"));
            List <ReplicationInstruction> ris = new List <ReplicationInstruction>();

            ris.Add(
                new ReplicationInstruction()
            {
                ZipIndecies = new List <int> {
                    0, 1
                },
                Zipped = true
            }
                );
            List <List <StackValue> > combin = ProtoCore.Lang.Replication.Replicator.ComputeAllReducedParams(args, ris, core);

            Assert.IsTrue(combin[0][0].opdata == 1);
            Assert.IsTrue(combin[0][1].opdata == 3);
            Assert.IsTrue(combin[1][0].opdata == 2);
            Assert.IsTrue(combin[1][1].opdata == 4);
        }
Пример #3
0
        internal static ProtoCore.Core DebugRunnerRunOnly(string code)
        {
            ProtoCore.Core core;
            DebugRunner    fsr;

            ProtoScript.Config.RunConfiguration runnerConfig;
            string testPath = @"..\..\..\Scripts\Debugger\";

            // Specify some of the requirements of IDE.
            var options = new ProtoCore.Options();

            options.ExecutionMode       = ProtoCore.ExecutionMode.Serial;
            options.SuppressBuildOutput = false;

            core = new ProtoCore.Core(options);
            core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core));
            core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core));

            runnerConfig             = new ProtoScript.Config.RunConfiguration();
            runnerConfig.IsParrallel = false;
            fsr = new DebugRunner(core);

            DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper());
            CLRModuleType.ClearTypes();

            //Run

            fsr.PreStart(code, runnerConfig);
            DebugRunner.VMState vms = null;

            vms = fsr.Run();

            return(core);
        }
Пример #4
0
        public void ComputeReducedParams()
        {
            // Tracked by http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-4115
            string code =
                @"
                      a = [1,2];
                      b = [3,4];
                  ";

            //Run
            fsr.PreStart(code);
            DebugRunner.VMState vms = null;
            vms = fsr.Run();
            var mirror             = vms.mirror;
            List <StackValue> args = new List <StackValue>();

            args.Add(mirror.GetRawFirstValue("a"));
            args.Add(mirror.GetRawFirstValue("b"));
            List <ReplicationInstruction> ris = new List <ReplicationInstruction>();

            ris.Add(
                new ReplicationInstruction()
            {
                ZipIndecies = new List <int> {
                    0, 1
                },
                Zipped = true
            }
                );
            runtimeCore = fsr.runtimeCore;
            List <List <StackValue> > combin = ProtoCore.Lang.Replication.Replicator.ComputeAllReducedParams(args, ris, runtimeCore);

            Assert.IsTrue(combin[0][0].IntegerValue == 1);
            Assert.IsTrue(combin[0][1].IntegerValue == 3);
        }
        private void RunWithDebuggerGuts() // On background thread, no UI access.
        {
            try
            {
                switch (workerParams.RequestedRunMode)
                {
                case RunMode.RunTo:
                    workerParams.CurrentVmState = debugRunner.Run();
                    break;

                case RunMode.StepNext:
                    workerParams.CurrentVmState = debugRunner.StepOver();
                    break;

                case RunMode.StepIn:
                    workerParams.CurrentVmState = debugRunner.Step();
                    break;

                case RunMode.StepOut:
                    workerParams.CurrentVmState = debugRunner.StepOut();
                    break;

                default:
                {
                    string runMode = workerParams.RequestedRunMode.ToString();
                    throw new InvalidOperationException("Unsupported RunMode: " + runMode);
                }
                }
            }
            catch (Exception exception)
            {
                switch (exception.GetType().ToString())
                {
                case "ProtoScript.Runners.DebugRunner+EndofScriptException":
                case "ProtoScript.Runners.DebugRunner.EndofScriptException":
                case "ProtoScript.Runners.DebugRunner+RunnerNotInitied":
                    workerParams.ExecutionEnded = true;
                    break;

                default:
                    workerParams.ExecException = exception;
                    break;
                }
            }
        }