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


Ignore:
Timestamp:
07/22/09 12:54:00 (12 years ago)
Author:
felix winkelmann
Message:

-debug v; compile-file; all namespace decls in one file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/utils.scm

    r13677 r15246  
    2828(declare
    2929  (unit utils)
    30   (uses extras srfi-13)
     30  (uses extras srfi-13 posix files)
    3131  (usual-integrations)
    3232  (fixnum)
     
    120120                     (string c)))
    121121               (string->list str)))))))
     122
     123
     124;;; Compile and load file
     125
     126(define compile-file-options (make-parameter '("-S" "-O2" "-d1")))
     127
     128(define compile-file
     129  (let ((csc (foreign-value "C_CSC_PROGRAM" c-string))
     130        (path (foreign-value "C_INSTALL_BIN_HOME" c-string)) )
     131    (lambda (filename . options)
     132      (let ((cscpath (or (file-exists? (make-pathname path csc)) "csc"))
     133            (tmpfile (create-temporary-file "so")))
     134        (print "; compiling " filename " ...")
     135        (system*
     136         "~a -s ~a ~a -o ~a"
     137         (qs cscpath)
     138         (string-intersperse (append (compile-file-options) options) " ")
     139         (qs filename)
     140         (qs tmpfile))
     141        (on-exit (cut delete-file* tmpfile))
     142        (load tmpfile))) ) )
Note: See TracChangeset for help on using the changeset viewer.