From d0fb96121d1b286ad4761acd506ae00d7ddd2e47 Mon Sep 17 00:00:00 2001 From: triton Date: Sun, 23 Jun 2013 04:34:55 +0100 Subject: [PATCH] Change the ILibrary methods to take a driver instance. --- examples/OpenCV/OpenCV.cs | 2 +- examples/SDL/SDL.cs | 33 +++++++++++++-------------------- src/Generator/Library.cs | 4 ++-- tests/Hello/Hello.cs | 2 +- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/examples/OpenCV/OpenCV.cs b/examples/OpenCV/OpenCV.cs index 4a890e73..8a0a24aa 100644 --- a/examples/OpenCV/OpenCV.cs +++ b/examples/OpenCV/OpenCV.cs @@ -25,7 +25,7 @@ namespace CppSharp options.OutputDir = "opencv"; } - public void Preprocess(Library lib) + public void Preprocess(Driver driver, Library lib) { } diff --git a/examples/SDL/SDL.cs b/examples/SDL/SDL.cs index def45c37..d0274a49 100644 --- a/examples/SDL/SDL.cs +++ b/examples/SDL/SDL.cs @@ -8,15 +8,25 @@ namespace CppSharp /// class SDL : ILibrary { - public void Setup(DriverOptions options) + public void Setup(Driver driver) { + var options = driver.Options; options.LibraryName = "SDL"; options.Headers.Add("SDL.h"); options.IncludeDirs.Add("../../../examples/SDL/SDL-2.0/include"); options.OutputDir = "SDL"; } - public void Preprocess(Library lib) + public void SetupPasses(Driver driver, PassBuilder passes) + { + passes.RemovePrefix("SDL_"); + passes.RemovePrefix("SCANCODE_"); + passes.RemovePrefix("SDLK_"); + passes.RemovePrefix("KMOD_"); + passes.RemovePrefix("LOG_CATEGORY_"); + } + + public void Preprocess(Driver driver, Library lib) { lib.IgnoreEnumWithMatchingItem("SDL_FALSE"); lib.IgnoreEnumWithMatchingItem("DUMMY_ENUM_VALUE"); @@ -57,28 +67,11 @@ namespace CppSharp //lib.SetNameOfEnumWithName("LOG_CATEGORY", "LogCategory"); } - public void SetupPasses(PassBuilder p) - { - p.RemovePrefix("SDL_"); - p.RemovePrefix("SCANCODE_"); - p.RemovePrefix("SDLK_"); - p.RemovePrefix("KMOD_"); - p.RemovePrefix("LOG_CATEGORY_"); - } - - public void GenerateStart(TextTemplate template) - { - } - - public void GenerateAfterNamespaces(TextTemplate template) - { - } - static class Program { public static void Main(string[] args) { - Driver.Run(new SDL()); + ConsoleDriver.Run(new SDL()); } } } diff --git a/src/Generator/Library.cs b/src/Generator/Library.cs index 0ecdddfd..07cfddd8 100644 --- a/src/Generator/Library.cs +++ b/src/Generator/Library.cs @@ -20,7 +20,7 @@ namespace CppSharp /// /// Do transformations that should happen before passes are processed. /// - void Preprocess(Library lib); + void Preprocess(Driver driver, Library lib); /// /// Do transformations that should happen after passes are processed. @@ -30,7 +30,7 @@ namespace CppSharp /// /// Setup the driver options here. /// - void Setup(DriverOptions options); + void Setup(Driver driver); /// /// Setup your passes here. diff --git a/tests/Hello/Hello.cs b/tests/Hello/Hello.cs index ec2d4d13..a91838c2 100644 --- a/tests/Hello/Hello.cs +++ b/tests/Hello/Hello.cs @@ -10,7 +10,7 @@ namespace CppSharp.Tests { } - public override void Preprocess(Library lib) + public override void Preprocess(Driver driver, Library lib) { lib.SetClassAsValueType("Bar"); lib.SetClassAsValueType("Bar2");