Changeset 7931 in project for chicken/branches/release/csi.scm


Ignore:
Timestamp:
01/25/08 23:22:28 (13 years ago)
Author:
felix winkelmann
Message:

merged from prerelease branch rev. 7930 - release version 3.0.0; fixed wrong version numbers in some files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/branches/release/csi.scm

    r7332 r7931  
    9191    -i  -case-insensitive       enable case-insensitive reading
    9292    -e  -eval EXPRESSION        evaluate given expression
     93    -p  -print EXPRESSION       evaluate and print result(s)
     94    -P  -pretty-print EXPRESSION  evaluate and print result(s) prettily
    9395    -D  -feature SYMBOL         register feature identifier
    9496    -q  -quiet                  do not print banner
     
    797799
    798800(define-constant short-options
    799   '(#\k #\s #\v #\h #\D #\e #\i #\R #\b #\n #\q #\w #\- #\I #f #f) )
     801  '(#\k #\s #\v #\h #\D #\e #\i #\R #\b #\n #\q #\w #\- #\I #\p #\P) )
    800802
    801803(define-constant long-options
    802   '("-keyword-style" "-script" "-version" "-help" "--help" "--" "-feature" "-eval" "-case-insensitive"
    803     "-require-extension" "-batch" "-quiet" "-no-warnings" "-no-init" "-include-path" "-release" "-ss") )
     804  '("-keyword-style" "-script" "-version" "-help" "--help" "--" "-feature"
     805    "-eval" "-case-insensitive"
     806    "-require-extension" "-batch" "-quiet" "-no-warnings" "-no-init"
     807    "-include-path" "-release" "-ss"
     808    "-print" "-pretty-print") )
    804809
    805810(define (canonicalize-args args)
     
    848853           (and-let* ([p (member "--" args)])
    849854             (set-cdr! p '()) ) ] )
    850     (let* ([eval? (member* '("-e" "-eval") args)]
     855    (let* ([eval? (member* '("-e" "-p" "-P" "-eval" "-print" "-pretty-print") args)]
    851856           [batch (or script (member* '("-b" "-batch") args) eval?)]
    852857           [quietflag (member* '("-q" "-quiet") args)]
     
    869874                (when (file-exists? fn)
    870875                  (load fn) ) ) ) ) )
     876      (define (evalstring str #!optional (rec (lambda _ (void))))
     877        (let ((in (open-input-string str)))
     878          (do ([x (read in) (read in)])
     879              ((eof-object? x))
     880            (rec (receive (eval x))) ) ) )
    871881      (when quietflag (set! ##sys#eval-debug-level 0))
    872882      (when (member* '("-h" "-help" "--help") args)
     
    919929          (cond ((member
    920930                  arg
    921                   '("--" "-batch" "-quiet" "-no-init" "-no-warnings" "-script" "-b" "-q" "-n" "-w" "-s" "-i"
     931                  '("--" "-batch" "-quiet" "-no-init" "-no-warnings" "-script"
     932                    "-b" "-q" "-n" "-w" "-s" "-i"
    922933                    "-case-insensitive" "-ss") ) )
    923                 ((member arg '("-feature" "-include-path" "-keyword-style" "-D" "-I" "-k"))
     934                ((member arg '("-feature" "-include-path" "-keyword-style"
     935                               "-D" "-I" "-k"))
    924936                 (set! args (cdr args)) )
    925937                ((or (string=? "-R" arg) (string=? "-require-extension" arg))
     
    927939                 (set! args (cdr args)) )
    928940                ((or (string=? "-e" arg) (string=? "-eval" arg))
    929                  (let ([in (open-input-string (cadr args))])
    930                    (do ([x (read in) (read in)])
    931                        ((eof-object? x))
    932                      (eval x) )
    933                    (set! args (cdr args)) ) )
     941                 (evalstring (cadr args))
     942                 (set! args (cdr args)) )
     943                ((or (string=? "-p" arg) (string=? "-print" arg))
     944                 (evalstring
     945                  (cadr args)
     946                  (cut for-each print <...>) )
     947                 (set! args (cdr args)) )
     948                ((or (string=? "-P" arg) (string=? "-pretty-print" arg))
     949                 (evalstring
     950                  (cadr args)
     951                  (cut for-each pretty-print <...>) )
     952                 (set! args (cdr args)) )
    934953                (else
    935954                 (load arg)
Note: See TracChangeset for help on using the changeset viewer.