[java] Initial implementation or marshaling for Java types.
This commit is contained in:
Родитель
85abfc9db0
Коммит
54b0cff0b1
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -72,6 +72,9 @@
|
|||
<Compile Include="../../binder/Generators/Java/JavaGenerator.cs">
|
||||
<Link>binder/Generators/Java/JavaGenerator.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="../../binder/Generators/Java/JavaMarshal.cs">
|
||||
<Link>binder/Generators/Java/JavaMarshal.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="../../binder/Generators/Java/JavaNative.cs">
|
||||
<Link>binder/Generators/Java/JavaNative.cs</Link>
|
||||
</Compile>
|
||||
|
|
Загрузка…
Ссылка в новой задаче