当前位置: 首页>>代码示例>>C#>>正文


C# ProtoCore.AddContextData方法代码示例

本文整理汇总了C#中ProtoCore.AddContextData方法的典型用法代码示例。如果您正苦于以下问题:C# ProtoCore.AddContextData方法的具体用法?C# ProtoCore.AddContextData怎么用?C# ProtoCore.AddContextData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProtoCore的用法示例。


在下文中一共展示了ProtoCore.AddContextData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        public ExecutionMirror Execute(string code, ProtoCore.Core core, Dictionary<string, Object> values, bool isTest = true)
        {
            //Inject the context data values from external source.
            core.AddContextData(values);
            int blockId = ProtoCore.DSASM.Constants.kInvalidIndex;
            bool succeeded = Compile(code, core, out blockId);
            if (succeeded)
            {
                core.GenerateExecutable();
                core.Rmem.PushGlobFrame(core.GlobOffset);
                core.RunningBlock = blockId;

                Execute(core, new ProtoCore.Runtime.Context());

                if (!isTest) { core.Heap.Free(); }
            }
            else
            {
                throw new ProtoCore.Exceptions.CompileErrorsOccured();
            }

            if (isTest && !core.Options.CompileToLib)
            {
                return new ExecutionMirror(core.CurrentExecutive.CurrentDSASMExec, core);
            }

            return null;
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:28,代码来源:ProtoScriptTestRunner.cs

示例2: Execute

        /// <summary>
        /// Compile and execute the source that is stored in the static context
        /// </summary>
        /// <param name="staticContext"></param>
        /// <param name="runtimeContext"></param>
        /// <param name="core"></param>
        /// <param name="isTest"></param>
        /// <returns></returns>
        public ExecutionMirror Execute(
            ProtoCore.CompileTime.Context staticContext,
            ProtoCore.Core core,
            out ProtoCore.RuntimeCore runtimeCoreOut,
            bool isTest = true)
        {
            Validity.Assert(null != staticContext.SourceCode && String.Empty != staticContext.SourceCode);
            ProtoCore.RuntimeCore runtimeCore = null;

            core.AddContextData(staticContext.GlobalVarList);

            string code = staticContext.SourceCode;
            bool succeeded = CompileAndGenerateExe(code, core, staticContext);
            if (succeeded)
            {
                runtimeCore = ExecuteVM(core);
                if (!isTest)
                {
                    runtimeCore.RuntimeMemory.Heap.Free();
                }
            }
            else
            {
                throw new ProtoCore.Exceptions.CompileErrorsOccured();
            }
            runtimeCoreOut = runtimeCore;

            if (isTest)
            {
                return new ExecutionMirror(runtimeCore.CurrentExecutive.CurrentDSASMExec, runtimeCore);
            }

            return null;
        }
开发者ID:AutodeskFractal,项目名称:Dynamo,代码行数:42,代码来源:ProtoScriptRunner.cs

示例3: Execute

        /// <summary>
        /// Compile and execute the source that is stored in the static context
        /// </summary>
        /// <param name="staticContext"></param>
        /// <param name="runtimeContext"></param>
        /// <param name="core"></param>
        /// <param name="isTest"></param>
        /// <returns></returns>
        public ExecutionMirror Execute(
            ProtoCore.CompileTime.Context staticContext, 
            ProtoCore.Core core, 
            out ProtoCore.RuntimeCore runtimeCoreOut, 
            bool isTest = true)
        {
            Validity.Assert(null != staticContext.SourceCode && String.Empty != staticContext.SourceCode);
            ProtoCore.RuntimeCore runtimeCore = null;

            core.AddContextData(staticContext.GlobalVarList);
   
            int blockId = ProtoCore.DSASM.Constants.kInvalidIndex;
            bool succeeded = Compile(staticContext, core, out blockId);
            if (succeeded)
            {
                core.GenerateExecutable();
                runtimeCore = Execute(core, blockId, staticContext);
                if (!isTest)
                {
                    runtimeCore.RuntimeMemory.Heap.Free();
                }
            }
            else
            {
                throw new ProtoCore.Exceptions.CompileErrorsOccured();
            }
            runtimeCoreOut = runtimeCore;

            if (isTest && !core.Options.CompileToLib)
            {
                return new ExecutionMirror(runtimeCore.CurrentExecutive.CurrentDSASMExec, runtimeCore);
            }

            return null;
        }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:43,代码来源:ProtoScriptTestRunner.cs


注:本文中的ProtoCore.AddContextData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。