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