Browse Source

JNI-15 added get_trustword. Implied adding a "sstring" for string with size, so that declaration in pEp.yml2 matches get_trustwords specificity.

JNI-44
Edouard Tisserant 9 years ago
parent
commit
3d88a55ef8
  1. 36
      src/gen_cpp_Engine.ysl2
  2. 2
      src/gen_java_Engine.ysl2
  3. 8
      src/pEp.yml2
  4. 4
      src/types_c.ysl2
  5. 4
      src/types_java.ysl2

36
src/gen_cpp_Engine.ysl2

@ -31,6 +31,8 @@ tstylesheet {
const "returning", "count(parm/creates|parm/returns)";
const "CretType" choose {
when "$returning = 0" > void
when "$returning = 1"
call "jni_type" with "type", "name(parm[returns|creates]/*[2])";
when "$returning > 0" > jobject
}
const "CretDefault" choose {
@ -124,13 +126,22 @@ tstylesheet {
param "name", "name(*[3])";
choose {
when "$type = 'stringlist' or $type = 'stringpairlist' or $type = 'identity' or $type = 'identitylist'"
||
jobject «$name»_ = NULL;
if (_«$name»)
«$name»_ = from_«$type»(env, _«$name»);
when "$type = 'stringlist' or $type = 'string' or $type = 'sstring' or $type = 'stringpairlist' or $type = 'identity' or $type = 'identitylist'"
{
const "jnitype" call "jni_type" with "type", "$type";
const "from_type" choose {
when "$type = 'sstring'"
> from_string
otherwise
> from_«$type»
}
||
«$jnitype» «$name»_ = NULL;
if (_«$name»)
«$name»_ = «$from_type»(env, _«$name»);
||
||
}
when "ancestor::namespace/child::enum[@name=$type]" {
const "ljtype" call "lcase" with "text","$jtype";
@ -203,6 +214,10 @@ tstylesheet {
choose {
when "ancestor::namespace/child::enum[@name=$type]"
| √$type _«$name»;
when "$type='sstring'"{
| char * _«$name»;
| size_t _«$name»_size;
}
otherwise
| √$type *_«$name»;
}
@ -210,6 +225,7 @@ tstylesheet {
template "parm", mode=call {
const "dir", "name(*[1])";
const "type", "name(*[2])";
const "name", "name(*[3])";
> ,
@ -217,12 +233,12 @@ tstylesheet {
choose {
when "$dir = 'Cconst'"
value "*[3]";
when "$dir = 'creates' or $dir = 'returns'" {
when "($dir = 'creates' or $dir = 'returns') and $type='sstring'"
> &_«$name», &_«$name»_size
when "$dir = 'creates' or $dir = 'returns'"
> &_«$name»
}
otherwise {
otherwise
> _«$name»
}
}
}

2
src/gen_java_Engine.ysl2

@ -132,7 +132,7 @@ tstylesheet {
// TODO factorize type conversion with multireturn and gen_java_message.java
when "count(parm[returns]/stringlist|parm[returns]/string) > 0"
when "count(parm[returns][stringlist|string|sstring]) > 0"
|> return AbstractEngine.toUTF16(_«@name»(`apply "parm[in]", mode=call;`));
when "count(parm[returns]/stringpairlist) > 0"
||

8
src/pEp.yml2

@ -203,6 +203,14 @@ namespace pEp {
returns identitylist identities
);
method get_trustwords(
in identity id1,
in identity id2,
in string lang,
returns sstring words,
in bool full
);
basic string trustwords(identity ident);
basic identity myself(identity ident);
basic identity updateIdentity(identity ident);

4
src/types_c.ysl2

@ -3,7 +3,7 @@ function "toC" {
choose {
when "$type='stringlist'" > stringlist_t
when "$type='string'" > char
when "$type='string' or $type='sstring'" > char
when "$type='identity'" > pEp_identity
when "$type='identitylist'" > identity_list
when "$type='timestamp'" > timestamp
@ -25,7 +25,7 @@ function "jni_type" {
choose {
when "../enum[@name=$type]" > jint
when "$type = 'string'" > jbyteArray
when "$type = 'string' or $type = 'sstring'" > jbyteArray
when "$type='bool'" > jboolean
when "$type='int'" > jint
otherwise > jobject

4
src/types_java.ysl2

@ -4,7 +4,7 @@ function "toJava" {
choose {
when "$type='bool'" > Boolean
when "$type='int'" > Integer
when "$type='string'" > String
when "$type='string' or $type='sstring'" > String
when "$type='timestamp'" > Date
when "$type='void'" > void
@ -62,7 +62,7 @@ function "toIntermediate" {
choose {
when "$type='bool'" > boolean
when "$type='int'" > int
when "$type='string'" > byte[]
when "$type='string' or $type='sstring'" > byte[]
when "$type='bloblist'" > Vector<_Blob>
when "$type='identity'" > _Identity

Loading…
Cancel
Save