Chibi fixes

This commit is contained in:
retropikzel 2025-07-12 08:40:54 +03:00
parent 1957a05e51
commit 62f243cecf
3 changed files with 8 additions and 9 deletions

View File

@ -86,6 +86,7 @@
(cond-expand (cond-expand
(chicken #t) ; FIXME (chicken #t) ; FIXME
(kawa #t) ; FIXME (kawa #t) ; FIXME
;(chibi #t)
(else (define make-c-null (else (define make-c-null
(lambda () (lambda ()
(cond-expand (stklos (let ((pointer (make-c-bytevector 1))) (cond-expand (stklos (let ((pointer (make-c-bytevector 1)))
@ -96,7 +97,7 @@
(cond-expand (cond-expand
(chicken #t) ; FIXME (chicken #t) ; FIXME
(kawa #t) ; FIXME (kawa #t) ; FIXME
(chibi (define c-null? pointer?)) (chibi #t)
(else (define c-null? (else (define c-null?
(lambda (pointer) (lambda (pointer)
(if (c-bytevector? pointer) (if (c-bytevector? pointer)

View File

@ -69,12 +69,6 @@
(let ((c-function (dlsym shared-object c-name)) (let ((c-function (dlsym shared-object c-name))
(maybe-dlerror (dlerror))) (maybe-dlerror (dlerror)))
(lambda arguments (lambda arguments
(display "NAME: ")
(display c-name)
(newline)
(display "ARGS: ")
(write arguments)
(newline)
(let* ((return-pointer (let* ((return-pointer
(internal-ffi-call (length argument-types) (internal-ffi-call (length argument-types)
(type->libffi-type-number return-type) (type->libffi-type-number return-type)

View File

@ -10,6 +10,10 @@
(c-declare "void* make_c_null() { return NULL; }") (c-declare "void* make_c_null() { return NULL; }")
(define-c (maybe-null pointer void*) make-c-null ()) (define-c (maybe-null pointer void*) make-c-null ())
;; c-null?
(c-declare "sexp is_null(void* pointer) { if(pointer == NULL) { return SEXP_TRUE; } else { return SEXP_FALSE; } }")
(define-c sexp (c-null? is_null) ((maybe-null pointer void*)))
;; c-type-size ;; c-type-size
(c-declare " (c-declare "
int size_of_int8_t() { return sizeof(int8_t); } int size_of_int8_t() { return sizeof(int8_t); }
@ -109,9 +113,9 @@
double vals18[nargs]; double vals18[nargs];
void* vals20[nargs]; void* vals20[nargs];
printf(\"nargs: %i\\n\", nargs); //printf(\"nargs: %i\\n\", nargs);
for(int i = 0; i < nargs; i++) { for(int i = 0; i < nargs; i++) {
printf(\"i: %i\\n\", i); //printf(\"i: %i\\n\", i);
void* arg = NULL; void* arg = NULL;
switch(atypes[i]) { switch(atypes[i]) {
case 1: case 1: