diff --git a/lib/chibi/process.stub b/lib/chibi/process.stub index baa5a7a5..5c0f1a34 100644 --- a/lib/chibi/process.stub +++ b/lib/chibi/process.stub @@ -4,7 +4,7 @@ (c-system-include "signal.h") (c-system-include "unistd.h") -(define-c-struct siginfo +(define-c-type siginfo_t predicate: signal-info? (int si_signo signal-number) (int si_errno signal-error-number) @@ -12,8 +12,9 @@ (pid_t si_pid signal-pid) (uid_t si_uid signal-uid) (int si_status signal-status) - (clock_t si_utime signal-user-time) - (clock_t si_stime signal-system-time)) + ;;(clock_t si_utime signal-user-time) + ;;(clock_t si_stime signal-system-time) + ) (define-c-type sigset_t predicate: signal-set?) diff --git a/lib/chibi/signal.c b/lib/chibi/signal.c index 6def22ef..930ef468 100644 --- a/lib/chibi/signal.c +++ b/lib/chibi/signal.c @@ -15,7 +15,7 @@ static void sexp_call_sigaction (int signum, siginfo_t *info, void *uctx) { sexp_gc_preserve1(sigctx, args); args = sexp_cons(sigctx, SEXP_FALSE, SEXP_NULL); sexp_car(args) - = sexp_make_cpointer(sigctx, sexp_siginfo_type_id, info, SEXP_FALSE, 0); + = sexp_make_cpointer(sigctx, sexp_siginfo_t_type_id, info, SEXP_FALSE, 0); args = sexp_cons(sigctx, SEXP_FALSE, args); sexp_car(args) = sexp_make_fixnum(signum); sexp_apply(sigctx, handler, args); diff --git a/tools/genstubs.scm b/tools/genstubs.scm index c679c30c..a6a9fc98 100755 --- a/tools/genstubs.scm +++ b/tools/genstubs.scm @@ -502,7 +502,8 @@ (let ((ctype (assq base *types*))) (cond (ctype - (cat (if (type-null? type) + (cat "(" (type-c-name type) ")" + (if (type-null? type) "sexp_cpointer_maybe_null_value" "sexp_cpointer_value") "(" val ")")) @@ -532,13 +533,16 @@ ((string env-string non-null-string) "char*") (else (symbol->string base)))) +(define (type-struct-type type) + (let ((type-spec (assq (if (vector? type) (type-base type) type) *types*))) + (cond ((and type-spec (memq 'type: type-spec)) => cadr) + (else #f)))) + (define (type-c-name type) (let* ((type (parse-type type)) (base (type-base type)) (type-spec (assq base *types*)) - (struct-type - (cond ((and type-spec (memq 'type: type-spec)) => cadr) - (else #f)))) + (struct-type (type-struct-type type))) (string-append (if (type-const? type) "const " "") (if struct-type (string-append (symbol->string struct-type) " ") "") @@ -988,7 +992,8 @@ (lambda () (c->scheme-converter (car field) - (string-append "((struct " (mangle name) "*)" + (string-append "((" (x->string (or (type-struct-type name) "")) + " " (mangle name) "*)" "sexp_cpointer_value(x))" (if (type-struct? (car field)) "." "->") (x->string (cadr field))) @@ -1008,7 +1013,8 @@ " " (lambda () (c->scheme-converter (car field) - (string-append "((struct " (mangle name) "*)" + (string-append "((" (x->string (or (type-struct-type name) "")) + " " (mangle name) "*)" "sexp_cpointer_value(x))" (if (type-struct? (car field)) "." "->") (x->string (cadr field)))))