17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
(module mtargs
(
arg-hash
get-arg
get-arg-from
usage
get-args
print-args
any-defined?
)
(import scheme (chicken base) (chicken port) (chicken file) (chicken process-context))
(import srfi-69 srfi-1)
(define arg-hash (make-hash-table))
(define (get-arg arg . default)
(if (null? default)
(hash-table-ref/default arg-hash arg #f)
(hash-table-ref/default arg-hash arg (car default))))
|
<
>
>
>
>
>
|
|
>
>
>
>
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
(module mtargs
(
arg-hash
get-arg
get-arg-from
get-args
usage
print-args
any-defined?
)
(import scheme) ;; gives us cond-expand in chicken-4
(cond-expand
(chicken-5
(import scheme (chicken base) (chicken port) (chicken file) (chicken process-context))
(import srfi-69 srfi-1))
(chicken-4
(import chicken posix srfi-69 srfi-1))
(else))
(define usage (make-parameter print))
(define arg-hash (make-hash-table))
(define (get-arg arg . default)
(if (null? default)
(hash-table-ref/default arg-hash arg #f)
(hash-table-ref/default arg-hash arg (car default))))
|