;;;; chicken-bind.scm - Standalone wrapper generator (import scheme chicken) (import srfi-1) (import bind-translator) (define (usage #!optional (status 0)) (print #< (string-length arg) 1) (char=? #\- (string-ref arg 0)) ) (usage 1) ) (else (set! files (cons arg files)) (loop rest)))))) (when (null? files) (usage 1)) (when (and output (not (string=? "-" output))) (set! output (open-output-file output))) (for-each (lambda (f) (define (process) (print "\n;;; GENERATED BY CHICKEN-BIND FROM " f #\newline) (pp `(begin ,@(parse-easy-ffi (read-all (if (string=? f "-") (current-input-port) f) ) identity chunkify-only f))) (print "\n;;; END OF FILE")) (cond ((equal? "-" output) (process)) ((port? output) (with-output-to-port output process)) (else (with-output-to-file (pathname-replace-extension f "scm") process) ) )) (reverse files) ) ) ) (main (command-line-arguments))