diff --git a/src/gen_cpp_Engine.ysl2 b/src/gen_cpp_Engine.ysl2 index 8ad7fe7..af339d9 100644 --- a/src/gen_cpp_Engine.ysl2 +++ b/src/gen_cpp_Engine.ysl2 @@ -82,25 +82,7 @@ tstylesheet { } 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", 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", call "toJavaDeclare" with "type", "$rettype"; - with "jnitype", "'jlong'"; - with "sig", "'(J)V'"; - } - - when "$rettype = 'stringlist'" apply "parm[returns|creates]", mode=return; - when "$rettype = 'stringpairlist'" apply "parm[returns|creates]", mode=return; - - otherwise error | # not implemented: return type "«$rettype»"; - } + apply "parm[returns|creates]", mode=return; || return «name(parm[returns|creates]/*[3])»_; @@ -139,14 +121,14 @@ tstylesheet { param "jtype" call "toJava" with "type", "$type"; param "name", "name(*[3])"; param "jnitype" choose { - when "$type = 'message'" > jlong + when "$type = 'message' or $type = 'identity'" > jlong when "ancestor::namespace/child::enum[@name=$type]" > jint when "$type = 'stringlist'" > jbyteArray otherwise > } param "retname", "$name"; param "sig" choose { - when "$type = 'message'" > (J)V + when "$type = 'message' or $type = 'identity'" > (J)V when "ancestor::namespace/child::enum[@name=$type]" > (I)V when "$type = 'stringlist'" > (Ljava.lang.Object;)V otherwise > ()V @@ -177,7 +159,7 @@ tstylesheet { || - when "ancestor::namespace/child::enum[@name=$jtype]" { + when "ancestor::namespace/child::enum[@name=$type]" { const "ljtype" call "lcase" with "text","$jtype"; || jobject «$name»_ = NULL; diff --git a/src/types_java.ysl2 b/src/types_java.ysl2 index ff249b0..e5d0a96 100644 --- a/src/types_java.ysl2 +++ b/src/types_java.ysl2 @@ -2,43 +2,26 @@ function "toJava" { param "type"; choose { - when "$type='stringlist'" > Vector + when "$type='bool'" > Boolean + when "$type='int'" > Integer when "$type='string'" > String - when "$type='message'" > Message - when "$type='identity'" > Identity - when "$type='identitylist'" > Vector when "$type='timestamp'" > Date - when "$type='EncFormat'" > Message.EncFormat - when "$type='bloblist'" > Vector - when "$type='stringpairlist'" > ArrayList> - when "$type='message'" > Message when "$type='void'" > void - when "$type='bool'" > Boolean - when "$type='int'" > Integer - - otherwise call "CamelCase" with "text", "$type"; - } -} -function "toJavaDeclare" { - param "type"; + when "$type='identity'" > Identity + when "$type='message'" > Message - choose { + when "$type='bloblist'" > Vector + when "$type='identitylist'" > Vector when "$type='stringlist'" > Vector - when "$type='string'" error | # cannot declare "string" - when "$type='message'" > Message - when "$type='identity'" > _Identity - when "$type='identitylist'" | # cannot declare "identitylist" - when "$type='timestamp'" | # cannot declare "timestamp" - when "$type='EncFormat'" > Message.EncFormat - when "$type='bloblist'" | # cannot declare "bloblist" - when "$type='stringpairlist'" | # cannot declare "stringpairlist" - when "$type='message'" > Message + when "$type='stringpairlist'" > ArrayList> + when "$type='Color'" > Color + when "$type='DecryptFlags'" > DecryptFlags + when "$type='EncFormat'" > Message.EncFormat when "$type='Rating'" > Rating - //when "$type='bool'" > boolean - otherwise error | # cannot declare "«$type»" + otherwise call "CamelCase" with "text", "$type"; } } @@ -51,19 +34,22 @@ function "toSig" { otherwise { > L choose { - when "$type='stringlist'" > java/util/Vector - when "$type='string'" error | # cannot declare "string" - when "$type='message'" > org/pEp/jniadapter/Message - when "$type='identity'" > org/pEp/jniadapter/_Identity - when "$type='identitylist'" > java/util/Vector when "$type='timestamp'" > java/util/Date - when "$type='EncFormat'" > org/pEp/jniadapter/Message/EncFormat + + when "$type='identity'" > org/pEp/jniadapter/_Identity + when "$type='message'" > org/pEp/jniadapter/Message + when "$type='bloblist'" > java/util/Vector + when "$type='identitylist'" > java/util/Vector + when "$type='stringlist'" > java/util/Vector when "$type='stringpairlist'" > java/util/ArrayList - when "$type='message'" > org/pEp/jniadapter/Message + when "$type='Color'" > org/pEp/jniadapter/Color - when "$type='Rating'" > org/pEp/jniadapter/Rating when "$type='DecryptFlags'" > org/pEp/jniadapter/DecryptFlags + when "$type='EncFormat'" > org/pEp/jniadapter/Message/EncFormat + when "$type='Rating'" > org/pEp/jniadapter/Rating + + otherwise error | # cannot declare "«$type»" } > ; } @@ -74,16 +60,15 @@ function "toIntermediate" { param "type"; choose { - when "$type='stringlist'" > Vector - when "$type='stringpairlist'" > ArrayList> + when "$type='bool'" > boolean + when "$type='int'" > int when "$type='string'" > byte[] + + when "$type='bloblist'" > Vector<_Blob> when "$type='identity'" > _Identity when "$type='identitylist'" > Vector<_Identity> - when "$type='bloblist'" > Vector<_Blob> - when "$type='bool'" > boolean - when "$type='DecryptFlags'" > DecryptFlags - when "$type='SyncHandshakeResult'" > int - when "$type='int'" > int + when "$type='stringlist'" > Vector + when "$type='stringpairlist'" > ArrayList> otherwise call "toJava" with "type", "$type"; }