|
|
|
@ -1,4 +1,5 @@
@@ -1,4 +1,5 @@
|
|
|
|
|
using Cxxi.Generators; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using Cxxi.Generators; |
|
|
|
|
using Cxxi.Generators.CLI; |
|
|
|
|
using Cxxi.Passes; |
|
|
|
|
using Cxxi.Types; |
|
|
|
@ -6,68 +7,116 @@ using Cxxi.Types;
@@ -6,68 +7,116 @@ using Cxxi.Types;
|
|
|
|
|
namespace Cxxi.Libraries |
|
|
|
|
{ |
|
|
|
|
/// <summary>
|
|
|
|
|
/// Transform the Flush library declarations to something more .NET friendly.
|
|
|
|
|
/// Transform the Flood library declarations to something more .NET friendly.
|
|
|
|
|
/// </summary>
|
|
|
|
|
class Flush : ILibrary |
|
|
|
|
class Flood : ILibrary |
|
|
|
|
{ |
|
|
|
|
public void Preprocess(LibraryHelpers g) |
|
|
|
|
public void Preprocess(Library lib) |
|
|
|
|
{ |
|
|
|
|
g.IgnoreModulessWithName("API.h"); |
|
|
|
|
g.IgnoreModulessWithName("Concurrency.h"); |
|
|
|
|
g.IgnoreModulessWithName("ConcurrentQueue.h"); |
|
|
|
|
g.IgnoreModulessWithName("Delegate.h"); |
|
|
|
|
g.IgnoreModulessWithName("Event.h"); |
|
|
|
|
g.IgnoreModulessWithName("Handle.h"); |
|
|
|
|
//g.IgnoreModulessWithName("Memory.h");
|
|
|
|
|
g.IgnoreModulessWithName("Object.h"); |
|
|
|
|
g.IgnoreModulessWithName("Pointers.h"); |
|
|
|
|
g.IgnoreModulessWithName("References.h"); |
|
|
|
|
//g.IgnoreModulessWithName("Reflection.h");
|
|
|
|
|
g.IgnoreModulessWithName("Serialization.h"); |
|
|
|
|
lib.IgnoreModulessWithName("API.h"); |
|
|
|
|
lib.IgnoreModulessWithName("Concurrency.h"); |
|
|
|
|
lib.IgnoreModulessWithName("ConcurrentQueue.h"); |
|
|
|
|
lib.IgnoreModulessWithName("Delegate.h"); |
|
|
|
|
lib.IgnoreModulessWithName("Event.h"); |
|
|
|
|
lib.IgnoreModulessWithName("Handle.h"); |
|
|
|
|
lib.IgnoreModulessWithName("Object.h"); |
|
|
|
|
lib.IgnoreModulessWithName("Pointers.h"); |
|
|
|
|
lib.IgnoreModulessWithName("References.h"); |
|
|
|
|
lib.IgnoreModulessWithName("ReflectionHelpers.h"); |
|
|
|
|
|
|
|
|
|
//Core
|
|
|
|
|
g.SetClassAsValueType("StringHash"); |
|
|
|
|
g.IgnoreClassWithName("RawStringCompare"); |
|
|
|
|
lib.SetClassAsValueType("StringHash"); |
|
|
|
|
lib.IgnoreClassWithName("RawStringCompare"); |
|
|
|
|
|
|
|
|
|
g.IgnoreFunctionWithName("LogCreate"); |
|
|
|
|
g.SetClassAsValueType("LogEntry"); |
|
|
|
|
g.SetClassAsValueType("FileWatchEvent"); |
|
|
|
|
g.SetClassAsValueType("ExtensionMetadata"); |
|
|
|
|
lib.IgnoreFunctionWithName("LogCreate"); |
|
|
|
|
lib.SetClassAsValueType("LogEntry"); |
|
|
|
|
lib.SetClassAsValueType("FileWatchEvent"); |
|
|
|
|
lib.SetClassAsValueType("ExtensionMetadata"); |
|
|
|
|
|
|
|
|
|
g.IgnoreClassWithName("StreamFuncs"); |
|
|
|
|
lib.IgnoreFunctionWithName("AllocatorAllocate"); |
|
|
|
|
lib.IgnoreFunctionWithName("AllocatorDeallocate"); |
|
|
|
|
lib.SetNameOfFunction("AllocatorReset", "AllocatorResetMemory"); |
|
|
|
|
lib.IgnoreFunctionWithPattern(".+GetType"); |
|
|
|
|
|
|
|
|
|
lib.SetClassAsOpaque("FileStream"); |
|
|
|
|
|
|
|
|
|
lib.IgnoreClassWithName("StreamFuncs"); |
|
|
|
|
lib.IgnoreFunctionWithName("ClassGetIdMap"); |
|
|
|
|
lib.IgnoreFunctionWithName("ReflectionSetHandleContext"); |
|
|
|
|
lib.IgnoreFunctionWithName("SerializerCreateJSON"); |
|
|
|
|
lib.IgnoreFunctionWithName("SerializerCreateBinary"); |
|
|
|
|
|
|
|
|
|
// Math
|
|
|
|
|
g.SetClassAsValueType("ColorP"); |
|
|
|
|
g.SetClassAsValueType("Color"); |
|
|
|
|
g.SetClassAsValueType("Vector2P"); |
|
|
|
|
g.SetClassAsValueType("Vector2"); |
|
|
|
|
g.SetClassAsValueType("Vector2i"); |
|
|
|
|
g.SetClassAsValueType("Vector3P"); |
|
|
|
|
g.SetClassAsValueType("Vector3"); |
|
|
|
|
g.SetClassAsValueType("Vector4"); |
|
|
|
|
g.SetClassAsValueType("EulerAngles"); |
|
|
|
|
g.SetClassAsValueType("QuaternionP"); |
|
|
|
|
g.SetClassAsValueType("Quaternion"); |
|
|
|
|
lib.SetClassAsValueType("ColorP"); |
|
|
|
|
lib.SetClassAsValueType("Color"); |
|
|
|
|
lib.SetClassAsValueType("Vector2P"); |
|
|
|
|
lib.SetClassAsValueType("Vector2"); |
|
|
|
|
lib.SetClassAsValueType("Vector2i"); |
|
|
|
|
lib.SetClassAsValueType("Vector3P"); |
|
|
|
|
lib.SetClassAsValueType("Vector3"); |
|
|
|
|
lib.SetClassAsValueType("Vector4"); |
|
|
|
|
lib.SetClassAsValueType("EulerAngles"); |
|
|
|
|
lib.SetClassAsValueType("QuaternionP"); |
|
|
|
|
lib.SetClassAsValueType("Quaternion"); |
|
|
|
|
lib.SetClassAsValueType("Matrix4x4"); |
|
|
|
|
|
|
|
|
|
// Resources
|
|
|
|
|
g.IgnoreFunctionWithName("ResourcesInitialize"); |
|
|
|
|
g.IgnoreFunctionWithName("ResourcesDeinitialize"); |
|
|
|
|
g.SetClassAsValueType("ResourceEvent"); |
|
|
|
|
g.SetClassAsValueType("ResourceLoadOption"); |
|
|
|
|
g.SetClassAsValueType("ResourceLoadOptions"); |
|
|
|
|
lib.IgnoreFunctionWithName("ResourcesInitialize"); |
|
|
|
|
lib.IgnoreFunctionWithName("ResourcesDeinitialize"); |
|
|
|
|
lib.SetClassAsValueType("ResourceEvent"); |
|
|
|
|
lib.SetClassAsValueType("ResourceLoadOption"); |
|
|
|
|
lib.SetClassAsValueType("ResourceLoadOptions"); |
|
|
|
|
lib.SetNameOfClassMethod("Texture", "allocate", "alloc"); |
|
|
|
|
|
|
|
|
|
// Engine
|
|
|
|
|
g.IgnoreClassMethodWithName("Engine", "addSubsystem"); |
|
|
|
|
lib.IgnoreClassMethodWithName("Engine", "addSubsystem"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void Postprocess(Library lib) |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void Postprocess(LibraryHelpers generator) |
|
|
|
|
public void Setup(DriverOptions options) |
|
|
|
|
{ |
|
|
|
|
options.LibraryName = "Engine"; |
|
|
|
|
options.OutputNamespace = "Flood"; |
|
|
|
|
options.OutputDir = @"C:\Development\flood2\src\EngineManaged\Bindings"; |
|
|
|
|
options.IncludeDirs.Add(@"C:\Development\flood2\inc"); |
|
|
|
|
options.GeneratorKind = LanguageGeneratorKind.CPlusPlusCLI; |
|
|
|
|
|
|
|
|
|
SetupHeaders(options.Headers); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void SetupHeaders(List<string> headers) |
|
|
|
|
{ |
|
|
|
|
var sources = new string[] |
|
|
|
|
{ |
|
|
|
|
"Core/Log.h", |
|
|
|
|
"Core/Extension.h", |
|
|
|
|
"Core/Reflection.h", |
|
|
|
|
"Core/Serialization.h", |
|
|
|
|
"Resources/Resource.h", |
|
|
|
|
"Resources/ResourceLoader.h", |
|
|
|
|
"Resources/ResourceManager.h", |
|
|
|
|
"Graphics/Graphics.h", |
|
|
|
|
"Graphics/RenderDevice.h", |
|
|
|
|
"Graphics/RenderBatch.h", |
|
|
|
|
"Graphics/Texture.h", |
|
|
|
|
"Engine/Engine.h" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
headers.AddRange(sources); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void SetupPasses(PassBuilder p) |
|
|
|
|
{ |
|
|
|
|
p.RenameDeclsCase(RenameTargets.Function | RenameTargets.Method | RenameTargets.Field, |
|
|
|
|
RenameCasePattern.UpperCamelCase); |
|
|
|
|
const RenameTargets renameTargets = RenameTargets.Function |
|
|
|
|
| RenameTargets.Method | RenameTargets.Field; |
|
|
|
|
p.RenameDeclsCase(renameTargets, RenameCasePattern.UpperCamelCase); |
|
|
|
|
|
|
|
|
|
p.FunctionToInstanceMethod(); |
|
|
|
|
p.FunctionToStaticMethod(); |
|
|
|
|
p.CheckDuplicateNames(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void GenerateStart(TextTemplate template) |
|
|
|
@ -90,7 +139,7 @@ namespace Cxxi.Libraries
@@ -90,7 +139,7 @@ namespace Cxxi.Libraries
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
namespace Types.Flush |
|
|
|
|
namespace Types.Flood |
|
|
|
|
{ |
|
|
|
|
[TypeMap("RefPtr")] |
|
|
|
|
public class RefPtr : TypeMap |
|
|
|
@ -127,15 +176,27 @@ namespace Cxxi.Libraries
@@ -127,15 +176,27 @@ namespace Cxxi.Libraries
|
|
|
|
|
|
|
|
|
|
public override string MarshalFromNative(MarshalContext ctx) |
|
|
|
|
{ |
|
|
|
|
return string.Format("(HandleId){0}", ctx.ReturnVarName); |
|
|
|
|
return string.Format("{0}.id", ctx.ReturnVarName); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[TypeMap("Path")] |
|
|
|
|
[TypeMap("String")] |
|
|
|
|
[TypeMap("StringWide")] |
|
|
|
|
public class String : Cxxi.Types.Std.String |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[TypeMap("StringWide")] |
|
|
|
|
public class StringWide : Cxxi.Types.Std.WString |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static class Program |
|
|
|
|
{ |
|
|
|
|
public static void Main(string[] args) |
|
|
|
|
{ |
|
|
|
|
Cxxi.Program.Run(new Libraries.Flood()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|