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

6
src/gen_java_Engine.ysl2

@ -155,6 +155,12 @@ tstylesheet {
return result; 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 { enum DecryptFlags {
pEp_decrypt_flag_own_private_key > 1 pEp_decrypt_flag_own_private_key > 1
PEP_decrypt_flag_consumed > 2 PEP_decrypt_flag_consumed > 2
PEP_decrypt_flag_discarded > 4 PEP_decrypt_flag_ignored > 4
}; };
enum IdentityFlags { enum IdentityFlags {
@ -145,6 +145,7 @@ namespace pEp {
creates message dst, creates message dst,
creates stringlist keylist, creates stringlist keylist,
returns Rating rating, returns Rating rating,
/* TODO replace with int, this is a OR of multipla DecryptFlags */
returns DecryptFlags flags returns DecryptFlags flags
); );
@ -178,6 +179,16 @@ namespace pEp {
returns stringpairlist keyinfoList 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 string trustwords(identity ident);
basic identity myself(identity ident); basic identity myself(identity ident);
basic identity updateIdentity(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 "../enum[@name=$type]" > jint
when "$type = 'string'" > jbyteArray when "$type = 'string'" > jbyteArray
when "$type='bool'" > jboolean when "$type='bool'" > jboolean
when "$type='int'" > jint
otherwise > jobject otherwise > jobject
} }
} }

2
src/types_java.ysl2

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

Loading…
Cancel
Save