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


C# WrenVM.Interpret方法代码示例

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


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

示例1: LoadLibrary

 public static void LoadLibrary(WrenVM vm)
 {
     vm.Interpret("scheduler", "scheduler", _schedulerSource);
     ObjClass scheduler = (ObjClass)vm.FindVariable("scheduler", "Scheduler");
     vm.Primitive(scheduler.ClassObj, "captureMethods_()", CaptureMethods);
     vm.Interpret("scheduler", "scheduler", "Scheduler.captureMethods_()");
 }
开发者ID:robotii,项目名称:Wren.NET,代码行数:7,代码来源:Scheduler.cs

示例2: LoadLibrary

        public static void LoadLibrary(WrenVM vm)
        {
            vm.Interpret("", "", MetaLibSource);

            ObjClass meta = (ObjClass)vm.FindVariable("Meta");
            vm.Primitive(meta.ClassObj, "eval(_)", Eval);
        }
开发者ID:robotii,项目名称:Wren.NET,代码行数:7,代码来源:Meta.cs

示例3: RunFile

        static int RunFile(string path)
        {
            if (!File.Exists(path)) 
                return 66; // File Not Found

            _loadedFile = path;
            string source = File.ReadAllText(path);
            WrenVM vm = new WrenVM { LoadModuleFn = LoadModule };
            LibraryLoader.LoadLibraries(vm);
            return (int)vm.Interpret("main", path, source);
        }
开发者ID:robotii,项目名称:Wren.NET,代码行数:11,代码来源:Program.cs

示例4: RunFile

 static int RunFile(string path)
 {
     if (File.Exists(path))
     {
         loadedFile = path;
         string source = File.ReadAllText(path);
         WrenVM vm = new WrenVM { LoadModuleFn = LoadModule };
         return (int)vm.Interpret(path, source);
     }
     return 66; // File Not Found
 }
开发者ID:minirop,项目名称:Wren.NET,代码行数:11,代码来源:Program.cs

示例5: LoadLibrary

        public static void LoadLibrary(WrenVM vm)
        {
            vm.Interpret("io", "io", IoSource);
            ObjClass file = (ObjClass)vm.FindVariable("io", "File");
            vm.Primitive(file.ClassObj, "open_(_,_)", Open);
            vm.Primitive(file.ClassObj, "sizePath_(_,_)", SizePath);

            vm.Primitive(file, "close_(_)", Close);
            vm.Primitive(file, "descriptor", Descriptor);
            vm.Primitive(file, "readBytes_(_,_)", ReadBytes);
            vm.Primitive(file, "size_(_)", Size);
        }
开发者ID:robotii,项目名称:Wren.NET,代码行数:12,代码来源:io.cs

示例6: RunRepl

        static void RunRepl()
        {
            WrenVM vm = new WrenVM();

            Console.WriteLine("-- wren v0.0.0");

            string line = "";

            for (; line != "/exit"; )
            {
                Console.Write("> ");
                line = Console.ReadLine();

                // TODO: Handle failure.
                vm.Interpret("Prompt", line);
            }
        }
开发者ID:minirop,项目名称:Wren.NET,代码行数:17,代码来源:Program.cs

示例7: RunRepl

        static void RunRepl()
        {
            WrenVM vm = new WrenVM();
            LibraryLoader.LoadLibraries(vm);

            Console.WriteLine("-- wren v0.0.0");

            string line = "";

            for (; ; )
            {
                Console.Write("> ");
                line += Console.ReadLine() + "\n";

                if(OpenBrackets(line) > 0)
                    continue;

                // TODO: Handle failure.
                vm.Interpret("Prompt","Prompt", line);
                line = "";
            }
        }
开发者ID:robotii,项目名称:Wren.NET,代码行数:22,代码来源:Program.cs

示例8: LoadIOLibrary

 public static void LoadIOLibrary(WrenVM vm)
 {
     vm.Interpret("", IOLibSource);
     ObjClass IO = (ObjClass)vm.FindVariable("IO").Obj;
     vm.Primitive(IO.ClassObj, "writeString_(_)", WriteString);
     vm.Primitive(IO.ClassObj, "read", Read);
     vm.Primitive(IO.ClassObj, "clock", Clock);
     vm.Primitive(IO.ClassObj, "time", Time);
 }
开发者ID:minirop,项目名称:Wren.NET,代码行数:9,代码来源:System.cs

示例9: LoadLibrary

 public static void LoadLibrary(WrenVM vm)
 {
     vm.Interpret("timer", "timer", _timerSource);
     ObjClass timer = (ObjClass)vm.FindVariable("timer", "Timer");
     vm.Primitive(timer.ClassObj, "startTimer_(_,_)", StartTimer);
 }
开发者ID:robotii,项目名称:Wren.NET,代码行数:6,代码来源:Timer.cs


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