Browse Source

inout added

Volker Birk 7 years ago
parent
commit
a2076774ca
  1. 14
      src/gen_cpp_Engine.ysl2
  2. 18
      src/gen_java_Engine.ysl2
  3. 2
      src/pEp.yml2

14
src/gen_cpp_Engine.ysl2

@ -28,11 +28,11 @@ tstylesheet {
template "method" { template "method" {
const "mangled" call "mangle"; const "mangled" call "mangle";
const "returning", "count(parm/creates|parm/returns)"; const "returning", "count(parm/creates|parm/returns|parm/inout)";
const "CretType" choose { const "CretType" choose {
when "$returning = 0" > void when "$returning = 0" > void
when "$returning = 1" when "$returning = 1"
call "jni_type" with "type", "name(parm[returns|creates]/*[2])"; call "jni_type" with "type", "name(parm[returns|creates|inout]/*[2])";
when "$returning > 0" > jobject when "$returning > 0" > jobject
} }
const "CretDefault" choose { const "CretDefault" choose {
@ -43,14 +43,14 @@ tstylesheet {
|| ||
JNIEXPORT «$CretType» JNICALL «$mangled»( JNIEXPORT «$CretType» JNICALL «$mangled»(
JNIEnv *env, JNIEnv *env,
jobject obj`apply "parm[in]", mode=sig` jobject obj`apply "parm[in|inout]", mode=sig`
) )
{ {
PEP_SESSION session = (PEP_SESSION) callLongMethod(env, obj, "getHandle"); PEP_SESSION session = (PEP_SESSION) callLongMethod(env, obj, "getHandle");
|| ||
apply "parm[in]", mode=in; apply "parm[in|inout]", mode=in;
apply "parm[creates|returns]", mode=out; apply "parm[creates|returns]", mode=out;
|| ||
@ -64,7 +64,7 @@ tstylesheet {
|| ||
apply "parm[returns|creates]", mode=return; apply "parm[returns|creates|inout]", mode=return;
choose { choose {
when "$returning > 1" { when "$returning > 1" {
@ -78,7 +78,7 @@ tstylesheet {
result_ = env->NewObject(clazz_result_, constructor_result_, obj); result_ = env->NewObject(clazz_result_, constructor_result_, obj);
|| ||
apply "parm[returns|creates]", mode=setresult apply "parm[returns|creates|inout]", mode=setresult
with "jtype" > org/pEp/jniadapter/Engine$_«@name»_Return with "jtype" > org/pEp/jniadapter/Engine$_«@name»_Return
|| ||
@ -89,7 +89,7 @@ tstylesheet {
when "$returning = 1" { when "$returning = 1" {
|| ||
return «name(parm[returns|creates]/*[3])»_; return «name(parm[returns|creates|inout]/*[3])»_;
|| ||
} }
} }

18
src/gen_java_Engine.ysl2

@ -137,21 +137,21 @@ tstylesheet {
template "method", mode=plain { template "method", mode=plain {
const "convert", "count(parm/stringlist|parm/stringpairlist|parm/string|parm/identity|parm/identitylist) > 0"; const "convert", "count(parm/stringlist|parm/stringpairlist|parm/string|parm/identity|parm/identitylist) > 0";
const "singlereturn", "count(parm/creates|parm/returns) = 1"; const "singlereturn", "count(parm/creates|parm/returns|parms/inout) = 1";
const "multireturn", "count(parm/creates|parm/returns) > 1"; const "multireturn", "count(parm/creates|parm/returns|parms/inout) > 1";
if "$multireturn" { if "$multireturn" {
if "$convert" if "$convert"
|| ||
private class _«@name»_Return { private class _«@name»_Return {
`` apply "parm[creates|returns]", 1, mode=intermediate with "public", 1; `` apply "parm[creates|returns|inout]", 1, mode=intermediate with "public", 1;
} }
|| ||
|| ||
public class «@name»_Return { public class «@name»_Return {
`` apply "parm[creates|returns]", 1, mode=java with "public", 1; `` apply "parm[creates|returns|inout]", 1, mode=java with "public", 1;
} }
|| ||
@ -160,14 +160,14 @@ tstylesheet {
if "$convert" if "$convert"
|| ||
private native `call "returnInter"` _«@name»( private native `call "returnInter"` _«@name»(
`` apply "parm[in]", 2, mode=intermediate `` apply "parm[in|inout]", 2, mode=intermediate
) throws pEpException; ) throws pEpException;
|| ||
|| ||
public `if "not($convert)" > native ``call "returnJava"` «@name»( public `if "not($convert)" > native ``call "returnJava"` «@name»(
`` apply "parm[in]", 2, mode=java `` apply "parm[in|inout]", 2, mode=java
) throws pEpException`if "not($convert)" > ;` ) throws pEpException`if "not($convert)" > ;`
|| ||
@ -212,9 +212,9 @@ tstylesheet {
if "$multireturn" if "$multireturn"
|| ||
_«@name»_Return _result = _«@name»(`apply "parm[in]", mode=call;`); _«@name»_Return _result = _«@name»(`apply "parm[in|inout]", mode=call;`);
«@name»_Return result = new «@name»_Return(); «@name»_Return result = new «@name»_Return();
`` apply "parm[creates|returns]", mode=convertOut; `` apply "parm[creates|returns|inout]", mode=convertOut;
return result; return result;
|| ||
@ -272,7 +272,7 @@ tstylesheet {
const "type", "name(*[2])"; const "type", "name(*[2])";
const "name" call "lcase" with "text", "name(*[3])"; const "name" call "lcase" with "text", "name(*[3])";
if "$dir = 'in'" choose { if "$dir = 'in' or $dir = 'inout'" choose {
when "$type = 'string' or $type = 'stringlist'" when "$type = 'string' or $type = 'stringlist'"
| ¡$type _«$name» = AbstractEngine.toUTF8(«$name»); | ¡$type _«$name» = AbstractEngine.toUTF8(«$name»);
when "$type = 'identity'" when "$type = 'identity'"

2
src/pEp.yml2

@ -170,7 +170,7 @@ namespace pEp {
); );
method decrypt_message( method decrypt_message(
in message src, inout message src,
creates message dst, creates message dst,
creates stringlist keylist, creates stringlist keylist,
returns Rating rating, returns Rating rating,

Loading…
Cancel
Save