From 73d5083d10e95369400dc6ee9723f128f97b89a7 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sat, 11 Dec 2010 22:27:54 -0800 Subject: [PATCH] automatically adding blocking checks on input-port args in the stubber --- tools/genstubs.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/genstubs.scm b/tools/genstubs.scm index 3a932523..97bd56d1 100755 --- a/tools/genstubs.scm +++ b/tools/genstubs.scm @@ -775,6 +775,13 @@ (write-validator (string-append "arg" (type-index-string a)) a)) args)) +(define (write-additional-checks args) + (for-each + (lambda (a) + (if (eq? 'input-port (type-base a)) + (cat " sexp_check_block_port(ctx, arg" (type-index a) ", 0);\n"))) + args)) + (define (write-temporaries func) (for-each (lambda (a) @@ -975,6 +982,8 @@ (if (number? len) (cat " if (len" i " != " len ")\n" " free(tmp" i ");\n")))) + ((eq? (type-base a) 'input-port) + (cat " sexp_maybe_unblock_port(ctx, arg" (type-index a) ");\n")) ((and (type-result? a) (not (basic-type? a)) (not (assq (type-base a) *types*)) (not (type-free? a)) (not (type-pointer? a)) @@ -1006,6 +1015,7 @@ (write-parameters (func-scheme-args func)) ") {\n") (write-locals func) (write-validators (func-scheme-args func)) + (write-additional-checks (func-c-args func)) (write-temporaries func) (write-call func) (write-results func)