From f70a3abb7d1adcbb9c3bee4b52a00c56163c9626 Mon Sep 17 00:00:00 2001 From: heck Date: Wed, 1 Jul 2020 16:29:45 +0200 Subject: [PATCH] generated EngineInterface started (need to merge in default now, there stuff has changed that causes problems now) --- src/gen_java_Engine.ysl2 | 46 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/gen_java_Engine.ysl2 b/src/gen_java_Engine.ysl2 index 1e74012..8d9ce6d 100644 --- a/src/gen_java_Engine.ysl2 +++ b/src/gen_java_Engine.ysl2 @@ -22,6 +22,19 @@ tstylesheet { `` apply "basic" } + || + document("foundation/pEp/jniadapter/{$cname}Interface.java", "text") + || + package foundation.pEp.jniadapter; + + import java.util.ArrayList; + import java.util.Vector; + + public interface «$cname»Interface { + `` apply "method", mode=java_interface + `` apply "basic", mode=java_interface + } + || } @@ -59,7 +72,25 @@ tstylesheet { } } } - + + template "basic" mode=java_interface { + const "itype" call "toIntermediate" with "type", "@type"; + const "jtype" call "toJava" with "type", "@type"; + + choose { + when "name(parm/*[1])='bytearray'" + || + public native «$itype» «@name»(`apply "parm/*", mode=basic_iparm`); + + || + otherwise { + || + public «$jtype» «@name»(`apply "parm/*", mode=basic_parm`); + || + } + } + } + template "*", mode=basic_parm_name choose { when "position() mod 2" { if "position() = 1 and name(.)='int'" @@ -237,6 +268,19 @@ tstylesheet { || } + template "method", mode=java_interface { + const "convert", "count(parm/stringlist|parm/stringpairlist|parm/string|parm/identity|parm/identitylist) > 0"; + const "singlereturn", "count(parm/creates|parm/returns|parm/inout[../int]) = 1"; + const "multireturn", "count(parm/creates|parm/returns|parm/inout[../int]) > 1"; + + || + public `if "not($convert)" > native ``call "returnJava"` «@name»( + `` apply "parm[in|inout]", 2, mode=java + ) throws pEpException; + + || + } + template "parm", mode=java { param "public", 0; const "dir", "name(*[1])";