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(); }
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); }
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); }
public static void Run(ILibrary library) { var options = new DriverOptions(); var driver = new Driver(options); library.Setup(driver); driver.Setup(); if (driver.ParserOptions.Verbose) { Diagnostics.Level = DiagnosticKind.Debug; } if (!options.Quiet) { Diagnostics.Message("Parsing libraries..."); } if (!driver.ParseLibraries()) { return; } if (!options.Quiet) { Diagnostics.Message("Parsing code..."); } driver.BuildParseOptions(); if (!driver.ParseCode()) { Diagnostics.Error("CppSharp has encountered an error while parsing code."); return; } new CleanUnitPass { Context = driver.Context }.VisitASTContext(driver.Context.ASTContext); options.Modules.RemoveAll(m => m != options.SystemModule && !m.Units.GetGenerated().Any()); if (!options.Quiet) { Diagnostics.Message("Processing code..."); } driver.SetupPasses(library); library.Preprocess(driver, driver.Context.ASTContext); driver.ProcessCode(); library.Postprocess(driver, driver.Context.ASTContext); if (!options.Quiet) { Diagnostics.Message("Generating code..."); } var outputs = driver.GenerateCode(); foreach (var output in outputs) { foreach (var pass in driver.Context.GeneratorOutputPasses.Passes) { 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.Context.TargetInfo.Dispose(); driver.ParserOptions.Dispose(); }
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(); Log.Verbose = driver.Options.Verbose; 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); } } driver.WriteCode(outputs); if (driver.Options.IsCSharpGenerator) { driver.CompileCode(); } }
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); } }
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(); }
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(); }
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) || GenIOS) { SetupiOSTargets(); } if (Targets.Count == 0) { SetupOtherTargets(); } 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 driver = new Driver(options); Setup(driver, target); driver.Setup(); BuildParseOptions(driver, target); if (!driver.ParseCode()) { return; } Dump(driver.Context.ASTContext, driver.Context.TargetInfo, target); } }
public static void Run(ILibrary library) { var options = new DriverOptions(); var driver = new Driver(options, new TextDiagnosticPrinter()); library.Setup(driver); driver.Setup(); if (!options.Quiet) { Console.WriteLine("Parsing libraries..."); } if (!driver.ParseLibraries()) { return; } if (!options.Quiet) { Console.WriteLine("Indexing library symbols..."); } driver.LibrarySymbols.IndexSymbols(); if (!options.Quiet) { Console.WriteLine("Parsing code..."); } if (!driver.ParseCode()) { return; } if (!options.Quiet) { Console.WriteLine("Processing code..."); } library.Preprocess(driver, driver.Library); driver.SetupPasses(library); driver.ProcessCode(); library.Postprocess(driver.Library); if (!options.Quiet) { Console.WriteLine("Generating code..."); } var outputs = driver.GenerateCode(); foreach (var output in outputs) { foreach (var pass in driver.GeneratorOutputPasses.Passes) { pass.Driver = driver; pass.VisitGeneratorOutput(output); } } driver.WriteCode(outputs); }
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(); }