| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#ifndef __GO_SEQ_ANDROID_HDR__ |
| 6 |
#define __GO_SEQ_ANDROID_HDR__ |
| 7 |
|
| 8 |
#include <stdint.h> |
| 9 |
#include <android/log.h> |
| 10 |
|
| 11 |
#include <stdlib.h> |
| 12 |
#include <jni.h> |
| 13 |
|
| 14 |
#define LOG_INFO(...) __android_log_print(ANDROID_LOG_INFO, "go/Seq", __VA_ARGS__) |
| 15 |
#define LOG_FATAL(...) \ |
| 16 |
{ \ |
| 17 |
__android_log_print(ANDROID_LOG_FATAL, "go/Seq", __VA_ARGS__); \ |
| 18 |
abort(); \ |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
typedef struct nstring { |
| 23 |
|
| 24 |
|
| 25 |
void *chars; |
| 26 |
|
| 27 |
jsize len; |
| 28 |
} nstring; |
| 29 |
typedef struct nbyteslice { |
| 30 |
void *ptr; |
| 31 |
jsize len; |
| 32 |
} nbyteslice; |
| 33 |
typedef jlong nint; |
| 34 |
|
| 35 |
extern void go_seq_dec_ref(int32_t ref); |
| 36 |
extern void go_seq_inc_ref(int32_t ref); |
| 37 |
|
| 38 |
|
| 39 |
extern int32_t go_seq_unwrap(jint refnum); |
| 40 |
extern int32_t go_seq_to_refnum(JNIEnv *env, jobject o); |
| 41 |
extern int32_t go_seq_to_refnum_go(JNIEnv *env, jobject o); |
| 42 |
extern jobject go_seq_from_refnum(JNIEnv *env, int32_t refnum, jclass proxy_class, jmethodID proxy_cons); |
| 43 |
|
| 44 |
extern void go_seq_maybe_throw_exception(JNIEnv *env, jobject msg); |
| 45 |
|
| 46 |
extern jobject go_seq_get_exception(JNIEnv *env); |
| 47 |
|
| 48 |
extern jbyteArray go_seq_to_java_bytearray(JNIEnv *env, nbyteslice s, int copy); |
| 49 |
extern nbyteslice go_seq_from_java_bytearray(JNIEnv *env, jbyteArray s, int copy); |
| 50 |
extern void go_seq_release_byte_array(JNIEnv *env, jbyteArray arr, jbyte* ptr); |
| 51 |
|
| 52 |
extern jstring go_seq_to_java_string(JNIEnv *env, nstring str); |
| 53 |
extern nstring go_seq_from_java_string(JNIEnv *env, jstring s); |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
extern JNIEnv *go_seq_push_local_frame(jint cap); |
| 58 |
|
| 59 |
extern void go_seq_pop_local_frame(JNIEnv *env); |
| 60 |
|
| 61 |
|
| 62 |
extern jclass go_seq_find_class(const char *name); |
| 63 |
extern jmethodID go_seq_get_static_method_id(jclass clazz, const char *name, const char *sig); |
| 64 |
extern jmethodID go_seq_get_method_id(jclass clazz, const char *name, const char *sig); |
| 65 |
extern int go_seq_isinstanceof(jint refnum, jclass clazz); |
| 66 |
|
| 67 |
#endif |