More work on the chicken module. The test suite, zlib, and overload examples are still broken.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6610 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2004-11-02 02:50:30 +00:00
commit 2cdf91de5d
17 changed files with 305 additions and 181 deletions

View file

@ -584,7 +584,7 @@ SWIGEXPORT(void) SWIG_init(int, C_word, C_word) C_noret;
%insert(init) %{
/* CHICKEN initialization function */
static char[] swig_type_ptr_name = "type_pointer" SWIG_TYPE_TABLE_NAME;
static char *swig_type_ptr_name = "type_pointer" SWIG_TYPE_TABLE_NAME;
SWIGEXPORT(void)
SWIG_init(int argc, C_word closure, C_word continuation) {
static int typeinit = 0;
@ -593,6 +593,7 @@ SWIG_init(int argc, C_word closure, C_word continuation) {
C_word tmp;
C_word *a;
C_word ret;
C_word *return_vec;
if (!typeinit) {
/* lookup the type pointer... it is stored in it's own symbol table */
@ -620,6 +621,12 @@ SWIG_init(int argc, C_word closure, C_word continuation) {
ret = C_SCHEME_FALSE;
}
#if $veclength
return_vec = C_alloc(C_SIZEOF_VECTOR($veclength));
ret = (C_word) return_vec;
*(return_vec++) = C_VECTOR_TYPE | $veclength;
#endif
a = C_alloc(2*$nummethods$symsize);
%}

View file

@ -38,6 +38,7 @@ extern "C" {
#define C_swig_is_pair(x) (C_truep (C_blockp(x)) && C_truep (C_pairp(x)))
#define C_swig_is_ptr(x) (C_truep (C_blockp (x)) && C_truep (C_pointerp (x)))
#define C_swig_is_swigpointer(x) (C_truep (C_blockp(x)) && C_truep (C_swigpointerp(x)))
#define C_swig_is_closurep(x) (C_truep (C_blockp(x)) && C_truep(C_closurep(x)))
#define SWIG_APPEND_VALUE(object) \
if (resultobj == C_SCHEME_UNDEFINED) \
@ -60,9 +61,9 @@ enum {
SWIG_BARF1_ARGUMENT_NULL /* 1 arg */
};
struct swig_chicken_clientdata {
typedef struct swig_chicken_clientdata {
C_word clos_class;
};
} swig_chicken_clientdata;
static char *
SWIG_Chicken_MakeString(C_word str) {
@ -161,13 +162,22 @@ SWIG_Chicken_Barf(int code, C_char *msg, ...)
}
}
static SWIGINLINE C_word
static C_word
SWIG_Chicken_NewPointerObj(void *ptr, swig_type_info *type, int owner, C_word **data)
{
swig_chicken_clientdata *cdata = (swig_chicken_clientdata *) type->clientdata;
if (ptr == NULL)
return C_SCHEME_FALSE;
else
return C_swigmpointer(data, ptr, type);
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;
}
}
}
/* Return 0 if successful. */

View file

@ -1,15 +1,15 @@
;(declare (hide swig-initialize))
(declare (hide swig-initialize))
;(define (swig-initialize obj initargs create destroy)
; (if (memq 'swig-init initargs)
; (slot-set! obj 'swig-this (cadr initargs))
; (begin
; (slot-set! obj 'swig-this (apply create initargs))
;(let ((ret (apply create initargs)))
; (if (instance? ret)
; (slot-ref ret 'swig-this)
; ret)))
; (set-finalizer! obj destroy))))
(define (swig-initialize obj initargs create)
(slot-set! obj 'swig-this
(if (memq 'swig-this initargs)
(cadr initargs)
(let ((ret (apply create initargs)))
(if (instance? ret)
(begin
(set-finalizer! ret (lambda (x) #t))
(slot-ref ret 'swig-this))
ret)))))
(define-class <swig-metaclass-$module> (<class>) (void))