ikarus/src/libtoplevel.ss

45 lines
1.4 KiB
Scheme
Raw Normal View History

2006-12-06 21:05:19 -05:00
;;; Finally, we're ready to evaluate the files and enter the cafe.
(library (ikarus interaction)
(export bar)
(import (scheme))
(define bar 'i-am-an-exported-primitive-named-foo)
2007-05-01 05:49:33 -04:00
(let-values ([(files script args)
(let f ([args (command-line-arguments)])
(cond
[(null? args) (values '() #f '())]
[(string=? (car args) "--")
(values '() #f (cdr args))]
[(string=? (car args) "--script")
(let ([d (cdr args)])
(cond
[(null? d)
(error #f "--script requires a script name")]
[else
(values '() (car d) (cdr d))]))]
[else
(let-values ([(f* script a*) (f (cdr args))])
(values (cons (car args) f*) script a*))]))])
(cond
[script ; no greeting, no cafe
(command-line-arguments (cons script args))
(for-each load files)
(load script)
(exit 0)]
[else
2007-04-30 04:51:37 -04:00
(let ()
(define-syntax compile-time-string
(lambda (x) (date-string)))
(printf "Ikarus Scheme (Build ~a)\n" (compile-time-string)))
(display "Copyright (c) 2006-2007 Abdulaziz Ghuloum\n\n")
(command-line-arguments args)
(for-each load files)
(new-cafe)
(exit 0)])))