| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef JPY_JTYPE_H |
| 22 |
#define JPY_JTYPE_H |
| 23 |
|
| 24 |
#ifdef __cplusplus |
| 25 |
extern "C" { |
| 26 |
#endif |
| 27 |
|
| 28 |
#include "jpy_compat.h" |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
typedef struct JPy_JType |
| 34 |
{ |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
PyTypeObject typeObj; |
| 39 |
|
| 40 |
char* javaName; |
| 41 |
|
| 42 |
jclass classRef; |
| 43 |
|
| 44 |
struct JPy_JType* superType; |
| 45 |
|
| 46 |
struct JPy_JType* componentType; |
| 47 |
|
| 48 |
char isPrimitive; |
| 49 |
|
| 50 |
char isInterface; |
| 51 |
|
| 52 |
char isResolving; |
| 53 |
|
| 54 |
char isResolved; |
| 55 |
} |
| 56 |
JPy_JType; |
| 57 |
|
| 58 |
#define JTYPE_AS_PYTYPE(T) ((PyTypeObject*) T) |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
extern PyTypeObject JType_Type; |
| 64 |
|
| 65 |
typedef void (*JPy_DisposeArg)(JNIEnv*, jvalue* value, void* data); |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
typedef struct JPy_ArgDisposer |
| 73 |
{ |
| 74 |
void* data; |
| 75 |
JPy_DisposeArg DisposeArg; |
| 76 |
} |
| 77 |
JPy_ArgDisposer; |
| 78 |
|
| 79 |
|
| 80 |
struct JPy_ParamDescriptor; |
| 81 |
|
| 82 |
typedef int (*JPy_MatchPyArg)(JNIEnv*, struct JPy_ParamDescriptor*, PyObject*); |
| 83 |
typedef int (*JPy_MatchVarArgPyArg)(JNIEnv*, struct JPy_ParamDescriptor*, PyObject*, int); |
| 84 |
typedef int (*JPy_ConvertPyArg)(JNIEnv*, struct JPy_ParamDescriptor*, PyObject*, jvalue*, JPy_ArgDisposer*); |
| 85 |
typedef int (*JPy_ConvertVarArgPyArg)(JNIEnv*, struct JPy_ParamDescriptor*, PyObject*, int, jvalue*, JPy_ArgDisposer*); |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
typedef struct JPy_ReturnDescriptor |
| 91 |
{ |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
JPy_JType* type; |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
jint paramIndex; |
| 101 |
} |
| 102 |
JPy_ReturnDescriptor; |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
typedef struct JPy_ParamDescriptor |
| 108 |
{ |
| 109 |
JPy_JType* type; |
| 110 |
jboolean isMutable; |
| 111 |
jboolean isOutput; |
| 112 |
jboolean isReturn; |
| 113 |
JPy_MatchPyArg MatchPyArg; |
| 114 |
JPy_MatchVarArgPyArg MatchVarArgPyArg; |
| 115 |
JPy_ConvertPyArg ConvertPyArg; |
| 116 |
JPy_ConvertVarArgPyArg ConvertVarArgPyArg; |
| 117 |
} |
| 118 |
JPy_ParamDescriptor; |
| 119 |
|
| 120 |
|
| 121 |
int JType_Check(PyObject* obj); |
| 122 |
|
| 123 |
JPy_JType* JType_GetTypeForObject(JNIEnv* jenv, jobject objectRef, jboolean resolve); |
| 124 |
JPy_JType* JType_GetTypeForName(JNIEnv* jenv, const char* typeName, jboolean resolve); |
| 125 |
JPy_JType* JType_GetType(JNIEnv* jenv, jclass classRef, jboolean resolve); |
| 126 |
|
| 127 |
PyObject* JType_ConvertJavaToPythonObject(JNIEnv* jenv, JPy_JType* type, jobject objectRef); |
| 128 |
int JType_ConvertPythonToJavaObject(JNIEnv* jenv, JPy_JType* type, PyObject* arg, jobject* objectRef, jboolean allowObjectWrapping); |
| 129 |
|
| 130 |
PyObject* JType_GetOverloadedMethod(JNIEnv* jenv, JPy_JType* type, PyObject* methodName, jboolean useSuperClass); |
| 131 |
|
| 132 |
int JType_MatchPyArgAsJObject(JNIEnv* jenv, JPy_JType* type, PyObject* pyArg); |
| 133 |
|
| 134 |
int JType_CreateJavaPyObject(JNIEnv* jenv, JPy_JType* type, PyObject* pyArg, jobject* objectRef); |
| 135 |
|
| 136 |
int JType_CreateJavaArray(JNIEnv* jenv, JPy_JType* componentType, PyObject* pyArg, jobject* objectRef, jboolean allowObjectWrapping); |
| 137 |
|
| 138 |
|
| 139 |
int JType_InitSlots(JPy_JType* type); |
| 140 |
|
| 141 |
int JType_ResolveType(JNIEnv* jenv, JPy_JType* type); |
| 142 |
|
| 143 |
int JType_AddClassAttribute(JNIEnv* jenv, JPy_JType* type); |
| 144 |
|
| 145 |
#ifdef __cplusplus |
| 146 |
} |
| 147 |
#endif |
| 148 |
#endif |