예제 #1
0
        internal static ProtoCore.Core TestRunnerRunOnly(string code, out RuntimeCore runtimeCore)
        {
            ProtoCore.Core core;
            ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScriptRunner();

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

            options.ExecutionMode = ProtoCore.ExecutionMode.Serial;

            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 ProtoScriptRunner();

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

            //Run

            runtimeCore = fsr.Execute(code, core);

            return(core);
        }
예제 #2
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);
        }
예제 #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 override void Setup()
 {
     // Specify some of the requirements of IDE.
     fsr = new DebugRunner(core);
     DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper());
     CLRModuleType.ClearTypes();
 }
예제 #5
0
 public override void Setup()
 {
     base.Setup();
     runner = new DebugRunner(core);
     DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper());
     CLRModuleType.ClearTypes();
 }
예제 #6
0
        internal static ProtoCore.Core TestRunnerRunOnly(string code)
        {
            ProtoCore.Core core;
            ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScriptTestRunner();


            ProtoScript.Config.RunConfiguration runnerConfig;

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

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

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

            options.IncludeDirectories.Add(testPath);

            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 ProtoScriptTestRunner();

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

            //Run

            fsr.Execute(code, core);

            return(core);
        }
예제 #7
0
파일: EventTest.cs 프로젝트: Steell/Dynamo
 public override void Setup()
 {
     base.Setup();
     runconfig             = new ProtoScript.Config.RunConfiguration();
     runconfig.IsParrallel = false;
     runner = new DebugRunner(core);
     DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper());
     CLRModuleType.ClearTypes();
 }
예제 #8
0
 public override void Setup()
 {
     // Specify some of the requirements of IDE.
     runnerConfig             = new ProtoScript.Config.RunConfiguration();
     runnerConfig.IsParrallel = false;
     fsr = new DebugRunner(core);
     DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper());
     CLRModuleType.ClearTypes();
 }
예제 #9
0
        /// <summary>
        /// Creates a default core
        /// </summary>
        /// <returns>ProtoCore.Core</returns>
        private static Core CreateCore()
        {
            DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper());
            CLRModuleType.ClearTypes();
            var core = new Core(new Options());

            core.Compilers.Add(Language.Associative, new ProtoAssociative.Compiler(core));
            core.ParsingMode = ParseMode.AllowNonAssignment;
            return(core);
        }
예제 #10
0
파일: EventTest.cs 프로젝트: hipigod/Dynamo
        public void Setup()
        {
            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_));
            runconfig_             = new ProtoScript.Config.RunConfiguration();
            runconfig_.IsParrallel = false;
            runner_ = new DebugRunner(core_);
            DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper());
            CLRModuleType.ClearTypes();
        }
예제 #11
0
        public void Setup()
        {
            // 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();
        }
예제 #12
0
        internal static ProtoCore.Core DebugRunnerStepOver(string code, out RuntimeCore runtimeCore)
        {
            //Internal setup

            ProtoCore.Core core;
            DebugRunner    fsr;

            ProtoScript.Config.RunConfiguration runnerConfig;

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

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

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

            options.IncludeDirectories.Add(testPath);

            core = new ProtoCore.Core(options);
            core.Compilers.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Compiler(core));
            core.Compilers.Add(ProtoCore.Language.kImperative, new ProtoImperative.Compiler(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;

            while (!fsr.isEnded)
            {
                vms = fsr.StepOver();
            }

            runtimeCore = fsr.runtimeCore;
            return(core);
        }
예제 #13
0
        private ProtoCore.Core SetupTestCore()
        {
            testCore = new ProtoCore.Core(new ProtoCore.Options());
            testCore.Configurations.Add(ConfigurationKeys.GeometryFactory, "DSGeometry.dll");
            testCore.Configurations.Add(ConfigurationKeys.PersistentManager, "DSGeometry.dll");
            testCore.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(testCore));
            testCore.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(testCore));

            // this setting is to fix the random failure of replication test case
            testCore.Options.ExecutionMode = ProtoCore.ExecutionMode.Serial;
            testCore.Options.Verbose       = true;
//            testCore.Options.kDynamicCycleThreshold = 5;

            //FFI registration and cleanup
            DLLFFIHandler.Register(FFILanguage.CPlusPlus, new ProtoFFI.PInvokeModuleHelper());
            DLLFFIHandler.Register(FFILanguage.CSharp, new CSModuleHelper());
            CLRModuleType.ClearTypes();
            mErrorMessage = string.Empty;
            if (cfgImport)
            {
                testImport = cfgImport;
            }
            else
            {
                testImport = false;
            }
            Console.WriteLine("CONFIG:\t" + cfgImport);
            Console.WriteLine("CONFIG:\t" + cfgDebug);
            if (cfgDebug)
            {
                testImport = cfgDebug;
            }
            else
            {
                testDebug = false;
            }

            return(testCore);
        }
예제 #14
0
 public void Cleanup()
 {
     CLRModuleType.ClearTypes();
 }
예제 #15
0
 public void Cleanup()
 {
     OnDispose();
     CLRModuleType.ClearTypes();
 }
예제 #16
0
        private static List <FunctionDescriptor> GetFunctionDescriptorsFromDll(PathManager pathManager, Assembly asm)
        {
            var mscorelib   = typeof(object).Assembly.GetName().Name;
            var descriptors = new List <FunctionDescriptor>();

            string extension = System.IO.Path.GetExtension(asm.Location).ToLower();

            if (extension != ".dll" && extension != ".exe")
            {
                return(new List <FunctionDescriptor>());
            }

            // Getting ZT imports from CLRModuleTypes
            var dllModule = new CLRDLLModule(asm.GetName().Name, asm);

            //TODO if this does not work replace with simpler method to generate types in module.
            dllModule.ImportCodeBlock("", "", new CodeBlockNode());
            List <CLRModuleType> moduleTypes = CLRModuleType.GetTypes((CLRModuleType mtype) => { return(mtype.Module == dllModule); });

            var customizationFile = LibraryCustomizationServices.GetForAssembly(asm.Location, pathManager);

            foreach (var t in moduleTypes)
            {
                try
                {
                    var descriptorCount = 0;
                    var className       = t.ClassNode.ClassName;
                    var externalLib     = t.ClassNode.ExternLibName;
                    var classIsHidden   = t.ClassNode.ClassAttributes?.HiddenInLibrary ?? false;

                    Program.VerboseControlLog($"considering members in type: {externalLib} {className }");

                    // For some reason mscorelib sometimes gets passed to here, so filtering it away.
                    if (t.CLRType.Assembly.GetName().Name == mscorelib ||
                        classIsHidden)
                    {
                        continue;
                    }

                    var ctorNodesAllCount = t.ClassNode.Procedures
                                            .OfType <ConstructorDefinitionNode>().Count();

                    var functionNodesAllCount = t.ClassNode.Procedures
                                                .OfType <FunctionDefinitionNode>().Count();

                    Program.VerboseControlLog($"considering {ctorNodesAllCount} constructors, and {functionNodesAllCount} functions from {className}");

                    var ctorNodesFiltered = t.ClassNode.Procedures
                                            .OfType <ConstructorDefinitionNode>()
                                            .Where(c => c.Access == ProtoCore.CompilerDefinitions.AccessModifier.Public &&
                                                   c.MethodAttributes != null ?
                                                   !c.MethodAttributes.IsObsolete && !c.MethodAttributes.HiddenInLibrary :
                                                   true)
                                            .Cast <AssociativeNode>();

                    var functionNodesFiltered = t.ClassNode.Procedures
                                                .OfType <FunctionDefinitionNode>()
                                                .Where(f => !f.MethodAttributes.HiddenInLibrary &&
                                                       !f.MethodAttributes.IsObsolete &&
                                                       f.Name != "_Dispose")
                                                .Cast <AssociativeNode>();

                    var associativeNodes = ctorNodesFiltered.Union(functionNodesFiltered);

                    foreach (var node in associativeNodes)
                    {
                        if (TryGetFunctionDescriptor(node, asm.Location, className, out FunctionDescriptor des))
                        {
                            descriptorCount++;
                            descriptors.Add(des);
                        }
                    }
                    Program.VerboseControlLog($"found {descriptorCount} function descriptors from {className}");
                }
                catch (Exception e)
                {
                    CommandHandler.LogExceptionToConsole(e);
                    continue;
                }
            }

            return(descriptors);
        }