diff --git a/examples/OpenCV/OpenCV.cs b/examples/OpenCV/OpenCV.cs index 4a890e7300..8a0a24aa8b 100644 --- a/examples/OpenCV/OpenCV.cs +++ b/examples/OpenCV/OpenCV.cs @@ -25,7 +25,7 @@ public void Setup(DriverOptions options) 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 def45c3753..d0274a495b 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 @@ public void Postprocess(Library lib) //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 0ecdddfdac..07cfddd8ab 100644 --- a/src/Generator/Library.cs +++ b/src/Generator/Library.cs @@ -20,7 +20,7 @@ public interface ILibrary /// /// 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 @@ public interface ILibrary /// /// 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 ec2d4d1360..a91838c203 100644 --- a/tests/Hello/Hello.cs +++ b/tests/Hello/Hello.cs @@ -10,7 +10,7 @@ public Hello(LanguageGeneratorKind kind) { } - public override void Preprocess(Library lib) + public override void Preprocess(Driver driver, Library lib) { lib.SetClassAsValueType("Bar"); lib.SetClassAsValueType("Bar2");