github.com/thommil/tge-mobile@v0.0.0-20190308225214-66a08abd51aa/bind/testdata/java.java.c.golden (about) 1 // File is generated by gobind. Do not edit. 2 3 #include <jni.h> 4 #include "seq.h" 5 #include "classes.h" 6 7 static jclass class_java_lang_Float; 8 static jmethodID m_java_lang_Float_toString; 9 static jclass class_java_lang_Long; 10 static jmethodID m_java_lang_Long_toString; 11 static jclass class_java_lang_Object; 12 static jmethodID m_java_lang_Object_toString; 13 static jclass class_java_lang_Runnable; 14 15 void init_proxies() { 16 JNIEnv *env = go_seq_push_local_frame(4); 17 jclass clazz; 18 clazz = go_seq_find_class("java/lang/Float"); 19 if (clazz != NULL) { 20 class_java_lang_Float = (*env)->NewGlobalRef(env, clazz); 21 m_java_lang_Float_toString = go_seq_get_method_id(clazz, "toString", "()Ljava/lang/String;"); 22 } 23 clazz = go_seq_find_class("java/lang/Long"); 24 if (clazz != NULL) { 25 class_java_lang_Long = (*env)->NewGlobalRef(env, clazz); 26 m_java_lang_Long_toString = go_seq_get_method_id(clazz, "toString", "()Ljava/lang/String;"); 27 } 28 clazz = go_seq_find_class("java/lang/Object"); 29 if (clazz != NULL) { 30 class_java_lang_Object = (*env)->NewGlobalRef(env, clazz); 31 m_java_lang_Object_toString = go_seq_get_method_id(clazz, "toString", "()Ljava/lang/String;"); 32 } 33 clazz = go_seq_find_class("java/lang/Runnable"); 34 if (clazz != NULL) { 35 class_java_lang_Runnable = (*env)->NewGlobalRef(env, clazz); 36 } 37 go_seq_pop_local_frame(env); 38 } 39 40 ret_nstring cproxy_java_lang_Float_toString(jint this) { 41 JNIEnv *env = go_seq_push_local_frame(1); 42 // Must be a Java object 43 jobject _this = go_seq_from_refnum(env, this, NULL, NULL); 44 jstring res = (*env)->CallObjectMethod(env, _this, m_java_lang_Float_toString); 45 jobject _exc = go_seq_get_exception(env); 46 int32_t _exc_ref = go_seq_to_refnum(env, _exc); 47 if (_exc != NULL) { 48 res = NULL; 49 } 50 nstring _res = go_seq_from_java_string(env, res); 51 go_seq_pop_local_frame(env); 52 ret_nstring __res = {_res, _exc_ref}; 53 return __res; 54 } 55 56 ret_nstring cproxy_java_lang_Long_toString(jint this) { 57 JNIEnv *env = go_seq_push_local_frame(1); 58 // Must be a Java object 59 jobject _this = go_seq_from_refnum(env, this, NULL, NULL); 60 jstring res = (*env)->CallObjectMethod(env, _this, m_java_lang_Long_toString); 61 jobject _exc = go_seq_get_exception(env); 62 int32_t _exc_ref = go_seq_to_refnum(env, _exc); 63 if (_exc != NULL) { 64 res = NULL; 65 } 66 nstring _res = go_seq_from_java_string(env, res); 67 go_seq_pop_local_frame(env); 68 ret_nstring __res = {_res, _exc_ref}; 69 return __res; 70 } 71 72 ret_nstring cproxy_java_lang_Object_toString(jint this) { 73 JNIEnv *env = go_seq_push_local_frame(1); 74 // Must be a Java object 75 jobject _this = go_seq_from_refnum(env, this, NULL, NULL); 76 jstring res = (*env)->CallObjectMethod(env, _this, m_java_lang_Object_toString); 77 jobject _exc = go_seq_get_exception(env); 78 int32_t _exc_ref = go_seq_to_refnum(env, _exc); 79 if (_exc != NULL) { 80 res = NULL; 81 } 82 nstring _res = go_seq_from_java_string(env, res); 83 go_seq_pop_local_frame(env); 84 ret_nstring __res = {_res, _exc_ref}; 85 return __res; 86 } 87 88 // JNI functions for the Go <=> Java bridge. 89 // gobind -lang=java java 90 // 91 // File is generated by gobind. Do not edit. 92 93 #include <android/log.h> 94 #include <stdint.h> 95 #include "seq.h" 96 #include "_cgo_export.h" 97 #include "java.h" 98 99 jclass proxy_class_java_F; 100 jmethodID proxy_class_java_F_cons; 101 static jmethodID mid_F_ToString; 102 jclass proxy_class_java_L; 103 jmethodID proxy_class_java_L_cons; 104 static jmethodID mid_L_ToString; 105 jclass proxy_class_java_O; 106 jmethodID proxy_class_java_O_cons; 107 static jmethodID mid_O_ToString; 108 jclass proxy_class_java_R; 109 jmethodID proxy_class_java_R_cons; 110 111 JNIEXPORT void JNICALL 112 Java_java_Java__1init(JNIEnv *env, jclass _unused) { 113 jclass clazz; 114 clazz = (*env)->FindClass(env, "java/Java$proxyF"); 115 proxy_class_java_F = (*env)->NewGlobalRef(env, clazz); 116 proxy_class_java_F_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V"); 117 clazz = (*env)->FindClass(env, "java/F"); 118 mid_F_ToString = (*env)->GetMethodID(env, clazz, "toString", "()Ljava/lang/String;"); 119 120 clazz = (*env)->FindClass(env, "java/Java$proxyL"); 121 proxy_class_java_L = (*env)->NewGlobalRef(env, clazz); 122 proxy_class_java_L_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V"); 123 clazz = (*env)->FindClass(env, "java/L"); 124 mid_L_ToString = (*env)->GetMethodID(env, clazz, "toString", "()Ljava/lang/String;"); 125 126 clazz = (*env)->FindClass(env, "java/Java$proxyO"); 127 proxy_class_java_O = (*env)->NewGlobalRef(env, clazz); 128 proxy_class_java_O_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V"); 129 clazz = (*env)->FindClass(env, "java/O"); 130 mid_O_ToString = (*env)->GetMethodID(env, clazz, "toString", "()Ljava/lang/String;"); 131 132 clazz = (*env)->FindClass(env, "java/Java$proxyR"); 133 proxy_class_java_R = (*env)->NewGlobalRef(env, clazz); 134 proxy_class_java_R_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V"); 135 clazz = (*env)->FindClass(env, "java/R"); 136 137 } 138 139 JNIEXPORT jstring JNICALL 140 Java_java_Java_00024proxyF_toString(JNIEnv* env, jobject __this__) { 141 int32_t o = go_seq_to_refnum_go(env, __this__); 142 nstring r0 = proxyjava_F_ToString(o); 143 jstring _r0 = go_seq_to_java_string(env, r0); 144 return _r0; 145 } 146 147 nstring cproxyjava_F_ToString(int32_t refnum) { 148 JNIEnv *env = go_seq_push_local_frame(0); 149 jobject o = go_seq_from_refnum(env, refnum, proxy_class_java_F, proxy_class_java_F_cons); 150 jstring res = (*env)->CallObjectMethod(env, o, mid_F_ToString); 151 nstring _res = go_seq_from_java_string(env, res); 152 go_seq_pop_local_frame(env); 153 return _res; 154 } 155 156 JNIEXPORT jstring JNICALL 157 Java_java_Java_00024proxyL_toString(JNIEnv* env, jobject __this__) { 158 int32_t o = go_seq_to_refnum_go(env, __this__); 159 nstring r0 = proxyjava_L_ToString(o); 160 jstring _r0 = go_seq_to_java_string(env, r0); 161 return _r0; 162 } 163 164 nstring cproxyjava_L_ToString(int32_t refnum) { 165 JNIEnv *env = go_seq_push_local_frame(0); 166 jobject o = go_seq_from_refnum(env, refnum, proxy_class_java_L, proxy_class_java_L_cons); 167 jstring res = (*env)->CallObjectMethod(env, o, mid_L_ToString); 168 nstring _res = go_seq_from_java_string(env, res); 169 go_seq_pop_local_frame(env); 170 return _res; 171 } 172 173 JNIEXPORT jstring JNICALL 174 Java_java_Java_00024proxyO_toString(JNIEnv* env, jobject __this__) { 175 int32_t o = go_seq_to_refnum_go(env, __this__); 176 nstring r0 = proxyjava_O_ToString(o); 177 jstring _r0 = go_seq_to_java_string(env, r0); 178 return _r0; 179 } 180 181 nstring cproxyjava_O_ToString(int32_t refnum) { 182 JNIEnv *env = go_seq_push_local_frame(0); 183 jobject o = go_seq_from_refnum(env, refnum, proxy_class_java_O, proxy_class_java_O_cons); 184 jstring res = (*env)->CallObjectMethod(env, o, mid_O_ToString); 185 nstring _res = go_seq_from_java_string(env, res); 186 go_seq_pop_local_frame(env); 187 return _res; 188 } 189