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. 30
      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

30
src/gen_cpp_Engine.ysl2

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

2
src/gen_java_Engine.ysl2

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

8
src/pEp.yml2

@ -203,6 +203,14 @@ namespace pEp {
returns identitylist identities 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 string trustwords(identity ident);
basic identity myself(identity ident); basic identity myself(identity ident);
basic identity updateIdentity(identity ident); basic identity updateIdentity(identity ident);

4
src/types_c.ysl2

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

4
src/types_java.ysl2

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

Loading…
Cancel
Save