From cb1859c683624d39be56da3168b4085b86debdeb Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Tue, 22 Dec 2009 22:55:46 +0900 Subject: [PATCH] allowing link on input parameters for use with functions like readdir --- lib/chibi/posix.stub | 2 +- tools/genstubs.scm | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/chibi/posix.stub b/lib/chibi/posix.stub index 03d4f981..25dd5dbd 100644 --- a/lib/chibi/posix.stub +++ b/lib/chibi/posix.stub @@ -25,7 +25,7 @@ (define-c errno (delete-directory "rmdir") (string)) (define-c (free DIR) opendir (string)) -(define-c dirent readdir (DIR)) +(define-c dirent readdir ((link DIR))) (define-c int (duplicate-fd "dup") (int)) diff --git a/tools/genstubs.scm b/tools/genstubs.scm index baa3b741..9f33ef91 100755 --- a/tools/genstubs.scm +++ b/tools/genstubs.scm @@ -683,7 +683,7 @@ ((type-array ret-type) " tmp = ") (else " res = "))) ((if (type-array ret-type) - (lambda (t f) (f)) + (lambda (t f x) (f)) c->scheme-converter) ret-type (lambda () @@ -709,7 +709,11 @@ arg (string-append "arg" (type-index-string arg)))))) c-args) - (cat ")"))) + (cat ")")) + (cond + ((any type-link? (func-c-args func)) + => (lambda (a) (string-append "arg" (type-index-string a)))) + (else #f))) (cat ";\n") (if (type-array ret-type) (write-result ret-type))))