Changeset 15001 in project for chicken


Ignore:
Timestamp:
06/17/09 15:07:03 (10 years ago)
Author:
felix winkelmann
Message:
  • deprecated "stat-..." functions from posix unit
  • added to posix unit: character-device? block-device? socket?
  • library: added "directory-exists?"
  • error during compilation doesn't show backtrace
  • import-libraries are first looked for in current directory
Location:
chicken/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/chicken.import.scm

    r14555 r15001  
    7777   features
    7878   file-exists?
     79   directory-exists?
    7980   fixnum-bits
    8081   fixnum-precision
  • chicken/trunk/chicken.scm

    r14828 r15001  
    152152                (if (string? o) o (conc "-" o)) )
    153153               (loop rest) ] ) ) ) )
    154   (apply compile-source-file filename options)
     154  (handle-exceptions ex
     155      (begin
     156        (print-error-message ex (current-error-port))
     157        (exit 1))
     158    (apply compile-source-file filename options) )
    155159  (exit) )
  • chicken/trunk/eval.scm

    r14999 r15001  
    10871087
    10881088(define ##sys#find-extension
    1089   (let ([file-exists? file-exists?]
    1090         [string-append string-append] )
     1089  (let ((file-exists? file-exists?)
     1090        (string-append string-append) )
    10911091    (lambda (p inc? here-first?)
    10921092      (let ((rp (##sys#repository-path)))
    10931093        (define (check path)
    1094           (let ([p0 (string-append path "/" p)])
     1094          (let ((p0 (string-append path "/" p)))
    10951095            (and (or (and rp
    10961096                          (not ##sys#dload-disabled)
     
    10991099                     (file-exists? (##sys#string-append p0 source-file-extension)) )
    11001100                 p0) ) )
    1101           (let loop ([paths (##sys#append
     1101          (let loop ((paths (##sys#append
    11021102                             (if here-first? '(".") '())
    1103                              (if rp (list rp) '("."))
    1104                              (if inc? (##sys#append ##sys#include-pathnames '(".")) '()) ) ] )
     1103                             (if rp (list rp) '())
     1104                             (if inc? ##sys#include-pathnames '())
     1105                             (if here-first? '() '("."))) ) )
    11051106            (and (pair? paths)
    1106                  (let ([pa (##sys#slot paths 0)])
     1107                 (let ((pa (##sys#slot paths 0)))
    11071108                   (or (check pa)
    11081109                       (loop (##sys#slot paths 1)) ) ) ) ) ) ) ))
  • chicken/trunk/library.scm

    r14898 r15001  
    19671967    (lambda (name)
    19681968      (and (##sys#file-info (##sys#platform-fixup-pathname name)) name) )
     1969    #:exists?) )
     1970
     1971(define (directory-exists? name)
     1972  (##sys#check-string name 'directory-exists?)
     1973  (##sys#pathname-resolution
     1974    name
     1975    (lambda (name)
     1976      (and-let* ((info (##sys#file-info (##sys#platform-fixup-pathname name))))
     1977        (eq? 1 (vector-ref info 4))
     1978        name))
    19691979    #:exists?) )
    19701980
  • chicken/trunk/manual/Unit library

    r13710 r15001  
    219219
    220220
     221==== directory-exists?
     222
     223<procedure>(directory-exists? STRING)</procedure>
     224
     225Returns {{STRING}} if a directory with the given pathname exists, or
     226{{#f}} otherwise.
     227
     228
    221229==== file-exists?
    222230
    223231<procedure>(file-exists? STRING)</procedure>
    224232
    225 Returns {{STRING}} if a file with the given pathname exists, or
     233Returns {{STRING}} if a file or directory with the given pathname exists, or
    226234{{#f}} otherwise.
    227235
  • chicken/trunk/manual/Unit posix

    r14779 r15001  
    452452
    453453
    454 ==== stat-regular?
    455 ==== stat-directory?
    456 ==== stat-char-device?
    457 ==== stat-block-device?
    458 ==== stat-fifo?
    459 ==== stat-symlink?
    460 ==== stat-socket?
    461 
    462 <procedure>(stat-regular? FILENAME)</procedure>
    463 <procedure>(stat-directory? FILENAME)</procedure>
    464 <procedure>(stat-char-device? FILENAME)</procedure>
    465 <procedure>(stat-block-device? FILENAME)</procedure>
    466 <procedure>(stat-fifo? FILENAME)</procedure>
    467 <procedure>(stat-symlink? FILENAME)</procedure>
    468 <procedure>(stat-socket? FILENAME)</procedure>
     454==== character-device?
     455==== block-device?
     456==== fifo?
     457==== socket?
     458
     459<procedure>(character-device? FILENAME)</procedure>
     460<procedure>(block-device? FILENAME)</procedure>
     461<procedure>(fifo? FILENAME)</procedure>
     462<procedure>(socket? FILENAME)</procedure>
    469463
    470464These procedures return {{#t}} if the {{FILENAME}} given is of the
  • chicken/trunk/posix.import.scm

    r14779 r15001  
    240240   signals-list
    241241   sleep
    242    stat-block-device?
    243    stat-char-device?
    244    stat-directory?
    245    stat-fifo?
    246    stat-regular?
    247    stat-socket?
    248    stat-symlink?
     242   stat-block-device?                   ; DEPRECATED
     243   block-device?
     244   character-device?
     245   stat-char-device?                    ; DEPRECATED
     246   stat-directory?                      ; DEPRECATED
     247   stat-fifo?                           ; DEPRECATED
     248   fifo?
     249   stat-regular?                        ; DEPRECATED
     250   stat-socket?                         ; DEPRECATED
     251   socket?
     252   stat-symlink?                        ; DEPRECATED
    249253   string->time
    250254   symbolic-link?
  • chicken/trunk/posixunix.scm

    r14828 r15001  
    790790  (foreign-value "C_islink" bool) )
    791791
    792 (define (stat-regular? fname)
     792(define (stat-regular? fname)           ; DEPRECATED
    793793    (##sys#check-string fname 'stat-regular?)
    794794    (##sys#stat fname #f 'stat-regular?)
    795795    (foreign-value "C_isreg" bool))
    796796
    797 (define (stat-directory? fname)
     797(define (stat-directory? fname)         ; DEPRECATED
    798798    (##sys#check-string fname 'stat-directory?)
    799799    (##sys#stat fname #f 'stat-directory?)
    800800    (foreign-value "C_isdir" bool))
    801801
    802 (define (stat-char-device? fname)
    803     (##sys#check-string fname 'stat-char-device?)
    804     (##sys#stat fname #f 'stat-char-device?)
     802(define (character-device? fname)
     803    (##sys#check-string fname 'character-device?)
     804    (##sys#stat fname #f 'character-device?)
    805805    (foreign-value "C_ischr" bool))
    806806
    807 (define (stat-block-device? fname)
    808     (##sys#check-string fname 'stat-block-device?)
    809     (##sys#stat fname #f 'stat-block-device?)
     807(define stat-char-device? character-device?) ; DEPRECATED
     808
     809(define (block-device? fname)
     810    (##sys#check-string fname 'block-device?)
     811    (##sys#stat fname #f 'block-device?)
    810812    (foreign-value "C_isblk" bool))
    811813
    812 (define (stat-fifo? fname)
     814(define stat-block-device? block-device?) ; DEPRECATED
     815
     816(define (fifo? fname)
    813817    (##sys#check-string fname 'stat-fifo?)
    814818    (##sys#stat fname #f 'stat-fifo?)
    815819    (foreign-value "C_isfifo" bool))
    816820
    817 (define (stat-symlink? fname)
    818     (##sys#check-string fname 'stat-symlink?)
    819     (##sys#stat fname #t 'stat-symlink?)
    820     (foreign-value "C_islink" bool))
    821 
    822 (define (stat-socket? fname)
    823     (##sys#check-string fname 'stat-socket?)
    824     (##sys#stat fname #f 'stat-socket?)
    825     (foreign-value "C_issock" bool))
     821(define stat-fifo? fifo?)               ; DEPRECATED
     822(define stat-symlink? symbolic-link?)   ; DEPRECATED
     823
     824(define (socket? fname)
     825  (##sys#check-string fname 'socket?)
     826  (##sys#stat fname #f 'socket?)
     827  (foreign-value "C_issock" bool))
     828
     829(define stat-socket? socket?)           ; DEPRECATED
    826830
    827831(define set-file-position!
  • chicken/trunk/posixwin.scm

    r14779 r15001  
    11121112                 (##sys#check-string fname name)
    11131113                 #f))))
    1114     (set! stat-regular? regular-file?)
    1115     (set! stat-directory? (stat-type 'stat-directory?))
    1116     (set! stat-char-device? (stat-type 'stat-char-device?))
    1117     (set! stat-block-device? (stat-type 'stat-block-device?))
    1118     (set! stat-fifo? (stat-type 'stat-fifo?))
    1119     (set! stat-symlink? (stat-type 'stat-symlink?))
    1120     (set! stat-socket? (stat-type 'stat-socket?)))
     1114    (set! stat-regular? regular-file?)  ; DEPRECATED
     1115    (set! stat-directory? (stat-type 'stat-directory?)) ; DEPRECATED
     1116    (set! stat-device? (stat-type 'stat-char-device?))  ; DEPRECATED
     1117    (set! character-device? (stat-type 'character-device?))
     1118    (set! block-device? (stat-type 'block-device?))
     1119    (set! stat-block-device? (stat-type 'stat-block-device?)) ; DEPRECATED
     1120    (set! stat-fifo? (stat-type 'stat-fifo?))                 ; DEPRECATED
     1121    (set! fifo? (stat-type 'fifo?))
     1122    (set! stat-symlink? (stat-type 'stat-symlink?)) ; DEPRECATED
     1123    (set! socket? (stat-type 'socket?))
     1124    (set! stat-socket? (stat-type 'stat-socket?))) ; DEPRECATED
    11211125
    11221126(define set-file-position!
  • chicken/trunk/tests/runtests.sh

    r14828 r15001  
    2727echo "======================================== scrutiny tests ..."
    2828$compile scrutiny-tests.scm -scrutinize -analyze-only -ignore-repository -types ../types.db 2>scrutiny.out
     29
     30if test -n "$MSYSTEM"; then
     31    dos2unix scrutiny.out
     32fi
     33
    2934diff -u scrutiny.out scrutiny.expected || exit 1
    3035
  • chicken/trunk/types.db

    r14993 r15001  
    274274(features (procedure features () list))
    275275(file-exists? (procedure file-exists? (string) *))
     276(directory-exists? (procedure directory-exists? (string) *))
    276277(fixnum-bits fixnum)
    277278(fixnum-precision fixnum)
     
    842843(signals-list list)
    843844(sleep (procedure sleep (fixnum) fixnum))
    844 (stat-block-device? (procedure stat-block-device? (string) boolean))
    845 (stat-char-device? (procedure stat-char-device? (string) boolean))
    846 (stat-directory? (procedure stat-directory? (string) boolean))
    847 (stat-fifo? (procedure stat-fifo? (string) boolean))
    848 (stat-regular? (procedure stat-regular? (string) boolean))
    849 (stat-socket? (procedure stat-socket? (string) boolean))
    850 (stat-symlink? (procedure stat-symlink? (string) boolean))
     845(block-device? (procedure block-device? (string) boolean))
     846(stat-block-device? deprecated)
     847(character-device? (procedure character-device? (string) boolean))
     848(stat-char-device? deprecated)
     849(stat-fifo? deprecated)
     850(stat-directory? deprecated)
     851(fifo? (procedure fifo? (string) boolean))
     852(stat-regular? deprecated)
     853(stat-socket? deprecated)
     854(socket? (procedure socket? (string) boolean))
     855(stat-symlink? deprecated)
    851856(string->time (procedure string->time (string #!optional string) vector))
    852857(symbolic-link? (procedure symbolic-link? (string) boolean))
Note: See TracChangeset for help on using the changeset viewer.