diff --git a/binder/Generators/Java/JavaMarshal.cs b/binder/Generators/Java/JavaMarshal.cs new file mode 100644 index 0000000..e897468 --- /dev/null +++ b/binder/Generators/Java/JavaMarshal.cs @@ -0,0 +1,80 @@ +using CppSharp.AST; + +namespace MonoEmbeddinator4000.Generators +{ + public class JavaMarshalPrinter : CMarshalPrinter + { + public JavaMarshalPrinter(MarshalContext marshalContext) + : base(marshalContext) + { + } + } + + public class JavaMarshalManagedToNative : JavaMarshalPrinter + { + public JavaMarshalManagedToNative(MarshalContext marshalContext) + : base(marshalContext) + { + } + + public override bool VisitManagedArrayType(ManagedArrayType array, + TypeQualifiers quals) + { + Context.Return.Write("null"); + return true; + } + + public override bool VisitClassDecl(Class @class) + { + Context.Return.Write($"{Context.ArgName}.__object"); + return true; + } + + public override bool VisitEnumDecl(Enumeration @enum) + { + Context.Return.Write(Context.ArgName); + return true; + } + + public override bool VisitPrimitiveType(PrimitiveType type, + TypeQualifiers quals) + { + Context.Return.Write(Context.ArgName); + return true; + } + } + + public class JavaMarshalNativeToManaged : JavaMarshalPrinter + { + public JavaMarshalNativeToManaged (MarshalContext marshalContext) + : base(marshalContext) + { + } + + public override bool VisitManagedArrayType(ManagedArrayType array, + TypeQualifiers quals) + { + Context.Return.Write("null"); + return true; + } + + public override bool VisitClassDecl(Class @class) + { + Context.Return.Write("null"); + return true; + } + + public override bool VisitEnumDecl(Enumeration @enum) + { + Context.Return.Write(Context.ReturnVarName); + return true; + } + + public override bool VisitPrimitiveType(PrimitiveType type, + TypeQualifiers quals) + { + Context.Return.Write(Context.ReturnVarName); + return true; + } + } +} diff --git a/build/projects/MonoEmbeddinator4000.csproj b/build/projects/MonoEmbeddinator4000.csproj index 074e2c7..8195b8c 100644 --- a/build/projects/MonoEmbeddinator4000.csproj +++ b/build/projects/MonoEmbeddinator4000.csproj @@ -72,6 +72,9 @@ binder/Generators/Java/JavaGenerator.cs + + binder/Generators/Java/JavaMarshal.cs + binder/Generators/Java/JavaNative.cs