|
@ -7,19 +7,39 @@ tstylesheet { |
|
|
|
|
|
|
|
|
template "interface" document("org_pEp_jniadapter_{@name}.cc", "text") |
|
|
template "interface" document("org_pEp_jniadapter_{@name}.cc", "text") |
|
|
|| |
|
|
|| |
|
|
|
|
|
#include <assert.h> |
|
|
#include "org_pEp_jniadapter_«@name».h" |
|
|
#include "org_pEp_jniadapter_«@name».h" |
|
|
|
|
|
#include "jniutils.hh" |
|
|
|
|
|
|
|
|
|
|
|
using namespace pEp::JNIAdapter; |
|
|
|
|
|
|
|
|
`` apply "method", 0 |
|
|
`` apply "method", 0 |
|
|
|| |
|
|
|| |
|
|
|
|
|
|
|
|
template "method" { |
|
|
template "method" { |
|
|
const "mangled" call "mangle"; |
|
|
const "mangled" call "mangle"; |
|
|
|
|
|
const "jtype" call "CamelCase" with "text", "name(parm[creates|returns]/*[2])"; |
|
|
|
|
|
|
|
|
|| |
|
|
|| |
|
|
JNIEXPORT jobject JNICALL «$mangled»(JNIEnv *env, jobject obj`apply "parm[in]", mode=sig`) |
|
|
JNIEXPORT jobject JNICALL «$mangled»( |
|
|
|
|
|
JNIEnv *env, |
|
|
|
|
|
jobject obj`apply "parm[in]", mode=sig` |
|
|
|
|
|
) |
|
|
{ |
|
|
{ |
|
|
jobject result; |
|
|
|| |
|
|
|
|
|
|
|
|
|
|
|
choose { |
|
|
|
|
|
when "count(parm[returns|creates]) > 1" |
|
|
|
|
|
|> jclass clazz = findClass(env, "org/pEp/jniadapter/_«@name»_Return"); |
|
|
|
|
|
when "count(parm[returns|creates]) = 1" { |
|
|
|
|
|
|> jclass clazz = findClass(env, "org/pEp/jniadapter/«$jtype»"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|| |
|
|
|
|
|
jmethodID constructor = env->GetMethodID(clazz, "<init>", "()V"); |
|
|
|
|
|
assert(constructor); |
|
|
|
|
|
jobject result = env->NewObject(clazz, constructor); |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
@ -40,7 +60,7 @@ tstylesheet { |
|
|
|
|
|
|
|
|
template "parm", mode=sig { |
|
|
template "parm", mode=sig { |
|
|
const "name", "name(*[3])"; |
|
|
const "name", "name(*[3])"; |
|
|
> , jobject «$name» |
|
|
> ,\n jobject «$name» |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|