forked from pEp.foundation/pEpJNIAdapter
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.8 KiB
Plaintext
86 lines
2.8 KiB
Plaintext
function "toJava" {
|
|
param "type";
|
|
|
|
choose {
|
|
when "$type='bool'" > Boolean
|
|
when "$type='int'" > int
|
|
when "$type='uint'" > int
|
|
when "$type='string' or $type='sstring'" > String
|
|
when "$type='timestamp'" > Date
|
|
when "$type='void'" > void
|
|
|
|
when "$type='identity'" > Identity
|
|
when "$type='message'" > Message
|
|
|
|
when "$type='bloblist'" > Vector<Blob>
|
|
when "$type='identitylist'" > Vector<Identity>
|
|
when "$type='stringlist'" > Vector<String>
|
|
when "$type='stringpairlist'" > ArrayList<Pair<String, String>>
|
|
when "$type='bytearray'" > byte[]
|
|
|
|
when "$type='Color'" > Color
|
|
when "$type='DecryptFlags'" > DecryptFlags
|
|
when "$type='EncFormat'" > Message.EncFormat
|
|
when "$type='Rating'" > Rating
|
|
|
|
otherwise call "CamelCase" with "text", "$type";
|
|
}
|
|
}
|
|
|
|
function "toSig" {
|
|
param "type";
|
|
|
|
choose {
|
|
when "$type='string'" error | # cannot declare "string"
|
|
when "$type='bool'" > Z
|
|
when "$type='bytearray'" > [b
|
|
otherwise {
|
|
> L
|
|
choose {
|
|
when "$type='timestamp'" > java/util/Date
|
|
when "$type='int'" > java/lang/Integer
|
|
|
|
when "$type='identity'" > foundation/pEp/jniadapter/_Identity
|
|
when "$type='message'" > foundation/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='Color'" > foundation/pEp/jniadapter/Color
|
|
when "$type='DecryptFlags'" > foundation/pEp/jniadapter/DecryptFlags
|
|
when "$type='EncFormat'" > foundation/pEp/jniadapter/Message/EncFormat
|
|
when "$type='Rating'" > foundation/pEp/jniadapter/Rating
|
|
|
|
otherwise error | # cannot declare "«$type»"
|
|
}
|
|
> ;
|
|
}
|
|
}
|
|
}
|
|
|
|
function "toIntermediate" {
|
|
param "type";
|
|
param "dir";
|
|
|
|
choose {
|
|
when "$type='bool'" > boolean
|
|
when "$type='int'" > int
|
|
when "$type='string' or $type='sstring'" > byte[]
|
|
when "$type='bytearray' or $type='sstring'" > byte[]
|
|
|
|
when "$type='bloblist'" > Vector<_Blob>
|
|
when "$type='identity'" > _Identity
|
|
when "$type='identitylist'" > Vector<_Identity>
|
|
when "$type='stringlist'" > Vector<byte[]>
|
|
when "$type='stringpairlist'" > ArrayList<Pair<byte[], byte[]>>
|
|
|
|
otherwise call "toJava" with "type", "$type";
|
|
}
|
|
}
|
|
|
|
define operator "†([$@]?[a-zA-Z0-9_]+)" as call "toJava" with "type", "%1";
|
|
define operator "¡([$@]?[a-zA-Z0-9_]+)" as call "toIntermediate" with "type", "%1";
|
|
|