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


C# Driver.ParseCode方法代码示例

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


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

示例1: Run

        public static void Run(ILibrary library)
        {
            var options = new DriverOptions();

            var Log = new TextDiagnosticPrinter();
            var driver = new Driver(options, Log);

            library.Setup(driver);
            driver.Setup();

            if(driver.Options.Verbose)
                Log.Level = DiagnosticKind.Debug;

            if (!options.Quiet)
                Log.EmitMessage("Parsing libraries...");

            if (!driver.ParseLibraries())
                return;

            if (!options.Quiet)
                Log.EmitMessage("Indexing library symbols...");

            driver.Symbols.IndexSymbols();

            if (!options.Quiet)
                Log.EmitMessage("Parsing code...");

            if (!driver.ParseCode())
                return;

            if (!options.Quiet)
                Log.EmitMessage("Processing code...");

            library.Preprocess(driver, driver.ASTContext);

            driver.SetupPasses(library);

            driver.ProcessCode();
            library.Postprocess(driver, driver.ASTContext);

            if (!options.Quiet)
                Log.EmitMessage("Generating code...");

            var outputs = driver.GenerateCode();

            foreach (var output in outputs)
            {
                foreach (var pass in driver.GeneratorOutputPasses.Passes)
                {
                    pass.Driver = driver;
                    pass.VisitGeneratorOutput(output);
                }
            }

            if (!driver.Options.DryRun)
                driver.WriteCode(outputs);

            if (driver.Options.IsCSharpGenerator)
                driver.CompileCode();
        }
开发者ID:kitsilanosoftware,项目名称:CppSharp,代码行数:60,代码来源:Driver.cs

示例2: Main

        public static void Main(string[] args)
        {
            ParseCommandLineArgs(args);

            Console.WriteLine();
            Console.WriteLine("Parsing Mono's source code...");

            var options = new DriverOptions();

            var log = new TextDiagnosticPrinter();
            var driver = new Driver(options, log);

            Setup(driver);
            driver.Setup();

            BuildParseOptions(driver);
            if (!driver.ParseCode())
                return;

            Check(driver.ASTContext);
        }
开发者ID:Profit0004,项目名称:mono,代码行数:21,代码来源:MonoChecker.cs

示例3: Main

        public static void Main(string[] args)
        {
            ParseCommandLineArgs(args);

            string monodroidDir;
            if (!Directory.Exists (MonodroidDir) &&
                GetParentSubDirectoryPath ("monodroid", out monodroidDir)) {
                MonodroidDir = Path.Combine (monodroidDir);
            }

            if (Directory.Exists (MonodroidDir))
                SetupAndroidTargets();

            string maccoreDir;
            if (!Directory.Exists (MaccoreDir) &&
                GetParentSubDirectoryPath ("maccore", out maccoreDir)) {
                MaccoreDir = Path.Combine (maccoreDir);
            }

            if (Directory.Exists(MaccoreDir))
                SetupiOSTargets();

            foreach (var target in Targets)
             {
                if (Abis.Any() && !Abis.Any (target.Triple.Contains))
                    continue;
                
                Console.WriteLine();
                Console.WriteLine("Processing triple: {0}", target.Triple);

                var options = new DriverOptions();

                var log = new TextDiagnosticPrinter();
                var driver = new Driver(options, log);

                Setup(driver, target);
                driver.Setup();

                BuildParseOptions(driver, target);
                if (!driver.ParseCode())
                    return;

                Dump(driver.Context.ASTContext, driver.Context.TargetInfo, target);
            }
        }
开发者ID:sushihangover,项目名称:playscript,代码行数:45,代码来源:MonoAotOffsetsDumper.cs

示例4: Run

        public static void Run(ILibrary library)
        {
            var options = new DriverOptions();

            var Log = new TextDiagnosticPrinter();
            var driver = new Driver(options, Log);

            library.Setup(driver);

            driver.Setup();

            if(driver.Options.Verbose)
                Log.Level = DiagnosticKind.Debug;

            if (!options.Quiet)
                Log.Message("Parsing libraries...");

            if (!driver.ParseLibraries())
                return;

            if (!options.Quiet)
                Log.Message("Indexing library symbols...");

            driver.Symbols.IndexSymbols();

            if (!options.Quiet)
                Log.Message("Parsing code...");

            driver.SortModulesByDependencies();
            driver.BuildParseOptions();

            if (!driver.ParseCode())
            {
                Log.Error("CppSharp has encountered an error while parsing code.");
                return;
            }

            new CleanUnitPass(options).VisitLibrary(driver.ASTContext);
            options.Modules.RemoveAll(m => m.Units.All(u => u.Declarations.Count == 0));

            if (!options.Quiet)
                Log.Message("Processing code...");

            library.Preprocess(driver, driver.ASTContext);

            driver.SetupPasses(library);

            driver.ProcessCode();
            library.Postprocess(driver, driver.ASTContext);

            if (!options.Quiet)
                Log.Message("Generating code...");

            var outputs = driver.GenerateCode();

            foreach (var output in outputs)
            {
                foreach (var pass in driver.GeneratorOutputPasses.Passes)
                {
                    pass.Driver = driver;
                    pass.VisitGeneratorOutput(output);
                }
            }

            if (!driver.Options.DryRun)
            {
                driver.SaveCode(outputs);
                if (driver.Options.IsCSharpGenerator && driver.Options.CompileCode)
                    foreach (var module in driver.Options.Modules)
                    {
                        driver.CompileCode(module);
                        if (driver.HasCompilationErrors)
                            break;
                    }
            }

            driver.Generator.Dispose();
            driver.TargetInfo.Dispose();
        }
开发者ID:ymlai87416,项目名称:CppSharp,代码行数:79,代码来源:Driver.cs

示例5: Run

        public static void Run(ILibrary library)
        {
            var options = new DriverOptions();

            var Log = new TextDiagnosticPrinter();
            var driver = new Driver(options, Log);

            library.Setup(driver);
            driver.Setup();

            if(driver.Options.Verbose)
                Log.Level = DiagnosticKind.Debug;

            if (!options.Quiet)
                Log.Message("Parsing libraries...");

            if (!driver.ParseLibraries())
                return;

            if (!options.Quiet)
                Log.Message("Indexing library symbols...");

            driver.Symbols.IndexSymbols();

            if (!options.Quiet)
                Log.Message("Parsing code...");

            driver.BuildParseOptions();

            if (!driver.ParseCode())
            {
                Log.Error("CppSharp has encountered an error while parsing code.");
                return;
            }

            if (!options.Quiet)
                Log.Message("Processing code...");

            library.Preprocess(driver, driver.ASTContext);

            driver.SetupPasses(library);

            driver.ProcessCode();
            library.Postprocess(driver, driver.ASTContext);

            if (!options.Quiet)
                Log.Message("Generating code...");

            var outputs = driver.GenerateCode();

            foreach (var output in outputs)
            {
                foreach (var pass in driver.GeneratorOutputPasses.Passes)
                {
                    pass.Driver = driver;
                    pass.VisitGeneratorOutput(output);
                }
            }

            if (!driver.Options.DryRun)
            {
                driver.SaveCode(outputs);
                if (driver.Options.IsCSharpGenerator && driver.Options.CompileCode)
                    driver.CompileCode();
            }

            driver.Generator.Dispose();
            driver.TargetInfo.Dispose();
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:69,代码来源:Driver.cs


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