Changeset 15262 in project for chicken/trunk/utils.scm


Ignore:
Timestamp:
07/26/09 01:49:53 (12 years ago)
Author:
felix winkelmann
Message:

bumped version to 4.1.1; improvements and corrections for compile-file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/utils.scm

    r15246 r15262  
    124124;;; Compile and load file
    125125
    126 (define compile-file-options (make-parameter '("-S" "-O2" "-d1")))
     126(define compile-file-options (make-parameter '("-S" "-O2" "-d2")))
    127127
    128128(define compile-file
    129129  (let ((csc (foreign-value "C_CSC_PROGRAM" c-string))
    130130        (path (foreign-value "C_INSTALL_BIN_HOME" c-string)) )
    131     (lambda (filename . options)
     131    (lambda (filename #!key (options '()) output-file)
    132132      (let ((cscpath (or (file-exists? (make-pathname path csc)) "csc"))
    133             (tmpfile (create-temporary-file "so")))
     133            (tmpfile (and (not output-file) (create-temporary-file "so"))))
    134134        (print "; compiling " filename " ...")
    135135        (system*
     
    138138         (string-intersperse (append (compile-file-options) options) " ")
    139139         (qs filename)
    140          (qs tmpfile))
    141         (on-exit (cut delete-file* tmpfile))
    142         (load tmpfile))) ) )
     140         (qs (or output-file tmpfile)))
     141        (unless output-file
     142          (on-exit (cut delete-file* tmpfile)))
     143        (let ((f (or output-file tmpfile)))
     144          (handle-exceptions ex
     145              (begin
     146                (delete-file* f)
     147                (abort ex))
     148            (load f)
     149            f))))))
Note: See TracChangeset for help on using the changeset viewer.