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


Ignore:
Timestamp:
01/05/08 20:17:50 (12 years ago)
Author:
felix winkelmann
Message:

merged trunk

File:
1 edited

Legend:

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

    r6175 r7276  
    5353(include "banner")
    5454
    55 
    56 #{csi
     55(private csi
    5756  print-usage print-banner
    5857  run hexdump del
     
    6160  deldups tty-input?
    6261  history-list history-count history-add history-ref
    63   trace-indent trace-indent-level traced-procedure-entry traced-procedure-exit}
     62  trace-indent trace-indent-level traced-procedure-entry traced-procedure-exit)
    6463
    6564(declare
     
    6766    ##sys#windows-platform)
    6867  (hide parse-option-string bytevector-data member* canonicalize-args do-trace do-untrace
    69         traced-procedures describer-table
     68        traced-procedures describer-table dirseparator?
    7069        findall trace-indent command-table do-break do-unbreak broken-procedures) )
    7170
     
    131130;;; Chop terminating separator from pathname:
    132131
     132(define (dirseparator? c)
     133  (or (char=? c #\\) (char=? c #\/)))
     134
    133135(define chop-separator
    134   (let ([pds ##sys#pathname-directory-separator]
    135         [substring substring] )
     136  (let ([substring substring] )
    136137    (lambda (str)
    137       (let ([len (sub1 (##sys#size str))])
    138         (if (and (fx> len 0) (char=? (string-ref str len) pds))
     138      (let* ((len (sub1 (##sys#size str)))
     139             (c (string-ref str len)))
     140        (if (and (fx> len 0) (dirseparator? c))
    139141            (substring str 0 len)
    140142            str) ) ) ) )
     
    162164      (let ([path (getenv "PATH")])
    163165        (and (> (##sys#size name) 0)
    164              (cond [(char=? ##sys#pathname-directory-separator (string-ref name 0)) (addext name)]
    165                    [(string-index (lambda (c) (char=? c ##sys#pathname-directory-separator)) name)
     166             (cond [(dirseparator? (string-ref name 0)) (addext name)]
     167                   [(string-index dirseparator? name)
    166168                    (and-let* ([p (_getcwd buf 256)])
    167                       (addext (string-append (chop-separator p) (string ##sys#pathname-directory-separator) name)) ) ]
     169                      (addext (string-append (chop-separator p) "/" name)) ) ]
    168170                   [(addext name)]
    169171                   [else
    170                     (let ([name2 (string-append (string ##sys#pathname-directory-separator) name)])
     172                    (let ([name2 (string-append "/" name)])
    171173                      (let loop ([ps (string-split path ";")])
    172174                        (and (pair? ps)
     
    849851    (let* ([eval? (member* '("-e" "-eval") args)]
    850852           [batch (or script (member* '("-b" "-batch") args) eval?)]
    851            [quiet (or script (member* '("-q" "-quiet") args) eval?)]
     853           [quietflag (member* '("-q" "-quiet") args)]
     854           [quiet (or script quietflag eval?)]
    852855           [ipath (map chop-separator (string-split (or (getenv "CHICKEN_INCLUDE_PATH") "") ";"))] )     
    853856      (define (collect-options opt)
     
    864867              (load fn)
    865868              (let* ([prefix (chop-separator (or (getenv "HOME") "."))]
    866                      [fn (string-append prefix (string ##sys#pathname-directory-separator) init-file)] )
     869                     [fn (string-append prefix "/" init-file)] )
    867870                (when (file-exists? fn)
    868871                  (load fn) ) ) ) ) )
     872      (when quietflag (set! ##sys#eval-debug-level 0))
    869873      (when (member* '("-h" "-help" "--help") args)
    870874        (print-usage)
Note: See TracChangeset for help on using the changeset viewer.