Fix a bug where chicken wrappers were not correctly registering values with the

chicken garbage collector.
Update the chicken documentation to reflect the new proxy class support.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6648 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2004-11-03 23:13:59 +00:00
commit bf83bb81a1
6 changed files with 72 additions and 221 deletions

View file

@ -604,9 +604,10 @@ SWIG_init(int argc, C_word closure, C_word continuation) {
swig_type_list_handle = (swig_type_info **) C_block_item(sym, 0);
}
} else {
C_word *a = C_alloc(C_SIZEOF_POINTER + C_SIZEOF_INTERNED_SYMBOL(C_strlen(swig_type_ptr_name)));
stable = C_new_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION, 16);
sym = C_intern_in(C_heaptop, C_strlen(swig_type_ptr_name), swig_type_ptr_name, stable);
C_mutate(&C_block_item(sym, 0), C_mpointer(C_heaptop, (void *) swig_type_list_handle));
sym = C_intern_in(&a, C_strlen(swig_type_ptr_name), swig_type_ptr_name, stable);
C_mutate(&C_block_item(sym, 0), C_mpointer(&a, (void *) swig_type_list_handle));
}
for (i = 0; swig_types_initial[i]; i++) {

View file

@ -62,7 +62,7 @@ enum {
};
typedef struct swig_chicken_clientdata {
C_word clos_class;
void *gc_proxy_create;
} swig_chicken_clientdata;
static char *
@ -171,12 +171,14 @@ SWIG_Chicken_NewPointerObj(void *ptr, swig_type_info *type, int owner, C_word **
return C_SCHEME_FALSE;
else {
C_word cptr = C_swigmpointer(data, ptr, type);
if (cdata && cdata->clos_class && C_swig_is_closurep(cdata->clos_class)) {
C_save(cptr);
return C_callback(cdata->clos_class, 1);
} else {
return cptr;
if (cdata && cdata->gc_proxy_create) {
C_word closure = CHICKEN_gc_root_ref(cdata->gc_proxy_create);
if (C_swig_is_closurep(closure)) {
C_save(cptr);
return C_callback(closure, 1);
}
}
return cptr;
}
}

View file

@ -6,9 +6,7 @@
(cadr initargs)
(let ((ret (apply create initargs)))
(if (instance? ret)
(begin
(set-finalizer! ret (lambda (x) #t))
(slot-ref ret 'swig-this))
(slot-ref ret 'swig-this)
ret)))))
(define-class <swig-metaclass-$module> (<class>) (void))