From cdd9cf7ffa9f46abbaac95dd8df4064d76f4016d Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Wed, 23 Nov 2011 09:46:26 -0800 Subject: [PATCH] Bug 701374 - Add macros for wrappers with return value (r=dougt) --HG-- extra : rebase_source : 9fbc2c264d08fea75542471370db6e228dba6226 --- other-licenses/android/APKOpen.cpp | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/other-licenses/android/APKOpen.cpp b/other-licenses/android/APKOpen.cpp index 3339371be959..a9b1a84effa4 100644 --- a/other-licenses/android/APKOpen.cpp +++ b/other-licenses/android/APKOpen.cpp @@ -219,6 +219,15 @@ Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc) \ f_ ## name(jenv, jc); \ } +#define SHELL_WRAPPER0_WITH_RETURN(name, return_type) \ +typedef return_type (*name ## _t)(JNIEnv *, jclass); \ +static name ## _t f_ ## name; \ +extern "C" NS_EXPORT return_type JNICALL \ +Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc) \ +{ \ + return f_ ## name(jenv, jc); \ +} + #define SHELL_WRAPPER1(name,type1) \ typedef void (*name ## _t)(JNIEnv *, jclass, type1 one); \ static name ## _t f_ ## name; \ @@ -228,6 +237,15 @@ Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one f_ ## name(jenv, jc, one); \ } +#define SHELL_WRAPPER1_WITH_RETURN(name, return_type, type1) \ +typedef return_type (*name ## _t)(JNIEnv *, jclass, type1 one); \ +static name ## _t f_ ## name; \ +extern "C" NS_EXPORT return_type JNICALL \ +Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one) \ +{ \ + return f_ ## name(jenv, jc, one); \ +} + #define SHELL_WRAPPER2(name,type1,type2) \ typedef void (*name ## _t)(JNIEnv *, jclass, type1 one, type2 two); \ static name ## _t f_ ## name; \ @@ -237,6 +255,15 @@ Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one f_ ## name(jenv, jc, one, two); \ } +#define SHELL_WRAPPER2_WITH_RETURN(name, return_type, type1, type2) \ +typedef return_type (*name ## _t)(JNIEnv *, jclass, type1 one, type2 two); \ +static name ## _t f_ ## name; \ +extern "C" NS_EXPORT return_type JNICALL \ +Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one, type2 two) \ +{ \ + return f_ ## name(jenv, jc, one, two); \ +} + #define SHELL_WRAPPER3(name,type1,type2,type3) \ typedef void (*name ## _t)(JNIEnv *, jclass, type1 one, type2 two, type3 three); \ static name ## _t f_ ## name; \ @@ -246,6 +273,15 @@ Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one f_ ## name(jenv, jc, one, two, three); \ } +#define SHELL_WRAPPER3_WITH_RETURN(name, return_type, type1, type2, type3) \ +typedef return_type (*name ## _t)(JNIEnv *, jclass, type1 one, type2 two, type3 three); \ +static name ## _t f_ ## name; \ +extern "C" NS_EXPORT return_type JNICALL \ +Java_org_mozilla_gecko_GeckoAppShell_ ## name(JNIEnv *jenv, jclass jc, type1 one, type2 two, type3 three) \ +{ \ + return f_ ## name(jenv, jc, one, two, three); \ +} + SHELL_WRAPPER0(nativeInit) SHELL_WRAPPER1(nativeRun, jstring) SHELL_WRAPPER1(notifyGeckoOfEvent, jobject)