From ed308c4063f21b72a4e253c32ad49711ef2d0dfa Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Fri, 25 Jan 2013 00:45:03 +0900 Subject: [PATCH] Adding char validator. --- tools/chibi-ffi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/chibi-ffi b/tools/chibi-ffi index bfda4fd6..fde34545 100755 --- a/tools/chibi-ffi +++ b/tools/chibi-ffi @@ -723,7 +723,8 @@ (if (type-null? type) "(" "") (type-predicate type) "(" arg ")" (lambda () (if (type-null? type) (cat " || sexp_not(" arg "))"))))) - ((or (int-type? base) (float-type? base) (port-type? base)) + ((or (eq? base 'char) (int-type? base) + (float-type? base) (port-type? base)) (cat (type-predicate type) "(" arg ")")) ((or (lookup-type base) (void-pointer-type? type)) (cat @@ -765,7 +766,8 @@ (float-type? base-type) (string-type? base-type) (port-type? base-type) - (memq base-type '(fileno fileno-nonblock))) + (memq base-type '(fileno fileno-nonblock)) + (and (not array) (eq? 'char base-type))) (cat " if (! " (lambda () (check-type arg type)) ")\n" " return sexp_type_exception(ctx, self, "