home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / runtime / site.scm.unix < prev    next >
Text File  |  1999-01-02  |  2KB  |  61 lines

  1. #| -*-Scheme-*-
  2.  
  3. $Id: site.scm.unix,v 1.15 1999/01/02 06:19:10 cph Exp $
  4.  
  5. Copyright (c) 1988-1999 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. |#
  21.  
  22. ;;;; Switzerland site specific stuff
  23. ;;;; call/cc is used by the C back end!
  24.  
  25. (declare (usual-integrations))
  26.  
  27. ;;; Local hacks
  28.  
  29. (define *call/cc-warn?* true)
  30. (define *call/cc-c-compiler* "cc")
  31.  
  32. (define (call/cc . args)
  33.   (let ((command-line
  34.      (with-output-to-string
  35.        (lambda ()
  36.          (write-string *call/cc-c-compiler*)
  37.          (let loop ((args args))
  38.            (if (not (null? args))
  39.            (begin
  40.              (write-string " ")
  41.              (display (car args))
  42.              (loop (cdr args)))))))))
  43.     (if *call/cc-warn?*
  44.     (warn "call/cc: Invoking the C compiler:" command-line))
  45.     (system command-line)))
  46.  
  47. (define (system command-line)
  48.   (let ((inside (->namestring
  49.          (directory-pathname-as-file (working-directory-pathname))))
  50.     (outside false))
  51.     (dynamic-wind
  52.      (lambda ()
  53.        (stop-thread-timer)
  54.        (set! outside ((ucode-primitive working-directory-pathname 0)))
  55.        ((ucode-primitive set-working-directory-pathname! 1) inside))
  56.      (lambda ()
  57.        ((ucode-primitive system 1) command-line))
  58.      (lambda ()
  59.        (set! inside ((ucode-primitive working-directory-pathname 0)))
  60.        ((ucode-primitive set-working-directory-pathname! 1) outside)
  61.        (start-thread-timer)))))