36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
#include <stdlib.h> |
#include <stdlib.h> |
39 |
|
#include <assert.h> |
40 |
#include <jni.h> |
#include <jni.h> |
41 |
#include "native_state.h" |
#include "native_state.h" |
42 |
|
|
166 |
*head = new_node; |
*head = new_node; |
167 |
} |
} |
168 |
|
|
169 |
|
#ifndef NDEBUG |
170 |
|
static void |
171 |
|
cp_gtk_check_compat (JNIEnv * env, jobject obj, struct state_table *table) |
172 |
|
{ |
173 |
|
jclass objclazz; |
174 |
|
|
175 |
|
objclazz = (*env)->GetObjectClass(env, obj); |
176 |
|
assert ((*env)->IsAssignableFrom(env, objclazz, table->clazz)); |
177 |
|
(*env)->DeleteLocalRef(env, objclazz); |
178 |
|
} |
179 |
|
#endif |
180 |
|
|
181 |
void |
void |
182 |
cp_gtk_set_state_oid (JNIEnv * env, jobject lock, struct state_table *table, |
cp_gtk_set_state_oid (JNIEnv * env, jobject lock, struct state_table *table, |
183 |
jint obj_id, void *state) |
jint obj_id, void *state) |
227 |
cp_gtk_set_state (JNIEnv * env, jobject obj, struct state_table *table, void *state) |
cp_gtk_set_state (JNIEnv * env, jobject obj, struct state_table *table, void *state) |
228 |
{ |
{ |
229 |
jint obj_id; |
jint obj_id; |
230 |
|
|
231 |
|
#ifndef NDEBUG |
232 |
|
cp_gtk_check_compat(env, obj, table); |
233 |
|
#endif |
234 |
|
|
235 |
obj_id = (*env)->GetIntField (env, obj, table->hash); |
obj_id = (*env)->GetIntField (env, obj, table->hash); |
236 |
|
|
237 |
if ((*env)->ExceptionOccurred (env) != NULL) |
if ((*env)->ExceptionOccurred (env) != NULL) |
245 |
cp_gtk_get_state (JNIEnv * env, jobject obj, struct state_table *table) |
cp_gtk_get_state (JNIEnv * env, jobject obj, struct state_table *table) |
246 |
{ |
{ |
247 |
jint obj_id; |
jint obj_id; |
248 |
|
|
249 |
|
#ifndef NDEBUG |
250 |
|
cp_gtk_check_compat(env, obj, table); |
251 |
|
#endif |
252 |
|
|
253 |
obj_id = (*env)->GetIntField (env, obj, table->hash); |
obj_id = (*env)->GetIntField (env, obj, table->hash); |
254 |
|
|
255 |
if ((*env)->ExceptionOccurred (env) != NULL) |
if ((*env)->ExceptionOccurred (env) != NULL) |
262 |
cp_gtk_remove_state_slot (JNIEnv * env, jobject obj, struct state_table *table) |
cp_gtk_remove_state_slot (JNIEnv * env, jobject obj, struct state_table *table) |
263 |
{ |
{ |
264 |
jint obj_id; |
jint obj_id; |
265 |
|
|
266 |
|
#ifndef NDEBUG |
267 |
|
cp_gtk_check_compat(env, obj, table); |
268 |
|
#endif |
269 |
|
|
270 |
obj_id = (*env)->GetIntField (env, obj, table->hash); |
obj_id = (*env)->GetIntField (env, obj, table->hash); |
271 |
|
|
272 |
if ((*env)->ExceptionOccurred (env) != NULL) |
if ((*env)->ExceptionOccurred (env) != NULL) |