Browse Source

JNI-19 added set_identity_flags and unset_identity_flags

JNI-44
Edouard Tisserant 9 years ago
parent
commit
ecd3fc2869
  1. 27
      src/gen_cpp_Engine.ysl2
  2. 6
      src/gen_java_Engine.ysl2
  3. 13
      src/pEp.yml2
  4. 1
      src/types_c.ysl2
  5. 2
      src/types_java.ysl2

27
src/gen_cpp_Engine.ysl2

@ -28,12 +28,18 @@ tstylesheet {
template "method" {
const "mangled" call "mangle";
const "rettype", "name(parm[creates|returns]/*[2])";
const "retname", "name(parm[creates|returns]/*[3])";
const "jtype" call "toJavaDeclare" with "type", "$rettype";
const "returning", "count(parm/creates|parm/returns)";
const "CretType" choose {
when "$returning = 0" > void
when "$returning > 0" > jobject
}
const "CretDefault" choose {
when "$returning = 0" >
when "$returning > 0" > NULL
}
||
JNIEXPORT jobject JNICALL «$mangled»(
JNIEXPORT «$CretType» JNICALL «$mangled»(
JNIEnv *env,
jobject obj`apply "parm[in]", mode=sig`
)
@ -51,13 +57,13 @@ tstylesheet {
status < PEP_STATUS_OK |`> |`
status >= PEP_TRUSTWORD_NOT_FOUND) {
throw_pEp_Exception(env, status);
return NULL;
return «$CretDefault»;
}
||
choose {
when "count(parm[returns|creates]) > 1" {
when "$returning > 1" {
apply "parm[returns|creates]", mode=return;
apply "parm[1]", mode=return {
@ -75,16 +81,17 @@ tstylesheet {
||
}
when "count(parm[returns|creates]) = 1" {
when "$returning = 1" {
const "rettype", "name(parm[creates|returns]/*[2])";
choose {
when "ancestor::namespace/child::enum[@name=$rettype]" apply "parm[returns|creates]", mode=return {
with "jtype", "$jtype";
with "jtype", call "toJavaDeclare" with "type", "$rettype";
with "jnitype", "'jint'";
with "sig", "'(I)V'";
}
when "$rettype = 'message' or $rettype = 'identity'" apply "parm[returns|creates]", mode=return {
with "jtype", "$jtype";
with "jtype", call "toJavaDeclare" with "type", "$rettype";
with "jnitype", "'jlong'";
with "sig", "'(J)V'";
}
@ -239,6 +246,8 @@ tstylesheet {
| message *_«$name» = (message *) callLongMethod(env, «$name», "getHandle");
when "$type='bool'"
| bool _«$name» = (bool) «$name»;
when "$type='int'"
| int _«$name» = (int) «$name»;
otherwise
| √$type *_«$name» = to_«$type»(env, «$name»);
}

6
src/gen_java_Engine.ysl2

@ -155,6 +155,12 @@ tstylesheet {
return result;
||
if "not($singlereturn) and not($multireturn)"
||
_«@name»(`apply "parm[in]", mode=call;`);
return;
||
||
}
||

13
src/pEp.yml2

@ -109,7 +109,7 @@ namespace pEp {
enum DecryptFlags {
pEp_decrypt_flag_own_private_key > 1
PEP_decrypt_flag_consumed > 2
PEP_decrypt_flag_discarded > 4
PEP_decrypt_flag_ignored > 4
};
enum IdentityFlags {
@ -145,6 +145,7 @@ namespace pEp {
creates message dst,
creates stringlist keylist,
returns Rating rating,
/* TODO replace with int, this is a OR of multipla DecryptFlags */
returns DecryptFlags flags
);
@ -178,6 +179,16 @@ namespace pEp {
returns stringpairlist keyinfoList
);
method set_identity_flags(
in identity ident,
in int flags
);
method unset_identity_flags(
in identity ident,
in int flags
);
basic string trustwords(identity ident);
basic identity myself(identity ident);
basic identity updateIdentity(identity ident);

1
src/types_c.ysl2

@ -27,6 +27,7 @@ function "jni_type" {
when "../enum[@name=$type]" > jint
when "$type = 'string'" > jbyteArray
when "$type='bool'" > jboolean
when "$type='int'" > jint
otherwise > jobject
}
}

2
src/types_java.ysl2

@ -14,6 +14,7 @@ function "toJava" {
when "$type='message'" > Message
when "$type='void'" > void
when "$type='bool'" > Boolean
when "$type='int'" > Integer
otherwise call "CamelCase" with "text", "$type";
}
@ -82,6 +83,7 @@ function "toIntermediate" {
when "$type='bool'" > boolean
when "$type='DecryptFlags'" > DecryptFlags
when "$type='SyncHandshakeResult'" > int
when "$type='int'" > int
otherwise call "toJava" with "type", "$type";
}

Loading…
Cancel
Save