| 1 |
;;; Ikarus Scheme -- A compiler for R6RS Scheme. |
| 2 |
;;; Copyright (C) 2006,2007,2008 Abdulaziz Ghuloum |
| 3 |
;;; |
| 4 |
;;; This program is free software: you can redistribute it and/or modify |
| 5 |
;;; it under the terms of the GNU General Public License version 3 as |
| 6 |
;;; published by the Free Software Foundation. |
| 7 |
;;; |
| 8 |
;;; This program is distributed in the hope that it will be useful, but |
| 9 |
;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
;;; General Public License for more details. |
| 12 |
;;; |
| 13 |
;;; You should have received a copy of the GNU General Public License |
| 14 |
;;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
|
| 16 |
|
| 17 |
(library (ikarus command-line) |
| 18 |
(export command-line-arguments command-line) |
| 19 |
(import |
| 20 |
(ikarus system $arg-list) |
| 21 |
(except (ikarus) command-line command-line-arguments)) |
| 22 |
|
| 23 |
(define (command-line) (command-line-arguments)) |
| 24 |
(define command-line-arguments |
| 25 |
(make-parameter |
| 26 |
(map (lambda (x) |
| 27 |
(cond |
| 28 |
[(string? x) x] |
| 29 |
[(bytevector? x) (utf8->string x)] |
| 30 |
[else (die 'command-line "invalid" x)])) |
| 31 |
($arg-list)) |
| 32 |
(lambda (x) |
| 33 |
(if (and (list? x) (andmap string? x)) |
| 34 |
x |
| 35 |
(die 'command-list |
| 36 |
"invalid command-line-arguments" x)))))) |
| 37 |
|