#!/bin/sh #| -*- scheme -*- exec csi -R r7rs -R utf8 -s "$0" "$@" schmaltz --- the command-line program |# (import (schmaltz) (scheme file) (scheme eval) (scheme repl) (srfi 1)) (cond-expand (chicken (render-specials (cons (cons #\@ (lambda (port) ; wrap the next form in `sxml->html' `(begin (import (html-parser)) (sxml->html ,(list 'quasiquote (read port)))))) (render-specials))) (render-unprintables (list (cons "#" unprintable/skip) (cons "#!eof" unprintable/backtrack)))) (else)) (define (main args) (define (rout file) (with-input-from-file file (lambda () (render) (newline)))) (cond ((and (null? args) ; input from stdin (char-ready?)) (render) (newline)) ((member "-" args) (let-values (((fs1 fs2) (break (lambda (x) (equal? x "-")) args))) (for-each rout fs1) (render) (newline) (for-each rout (cdr fs2)))) ((< 0 (length args)) (for-each rout args)) (else (display "Usage: schmaltz FILE...\n" (current-error-port)) (exit 1)))) (cond-expand ((and chicken (or chicken-script compiling)) (import (chicken process-context)) (main (command-line-arguments))) (chicken) (else (import (scheme process-context)) (main (cdr (command-line)))))