home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / j / jacal1a0.zip / jacal / math.scm < prev    next >
Text File  |  1992-12-05  |  1KB  |  47 lines

  1. ;;; JACAL: Symbolic Mathematics System.        -*-scheme-*-
  2. ;;; Copyright 1989, 1990, 1991, 1992 Aubrey Jaffer.
  3. ;;; See the file "COPYING" for terms applying to this program.
  4.  
  5. ;;; See Template.scm in the Scheme Library for how to set up
  6. ;;; vicinities and require.
  7.  
  8. (load (in-vicinity (program-vicinity) "scl.scm"))
  9.             ;Common Lisp/Scheme compatability definitions.
  10. (load (in-vicinity (program-vicinity) "toploads"))
  11.  
  12. ;;;; error and interrupt response for SCM.
  13. ;;; Put appropriate handlers for other systems here.
  14.  
  15. (define (impl_error str)
  16.   (force-output)
  17.   (newline-diag)
  18.   (perror "ERROR")
  19.   (set-errno 0)
  20.   (display-diag str)
  21.   (display-diag "; Last expression lost.")
  22.   (newline-diag)
  23.   (force-output)
  24.   (math_exit #f))            ;return to math top level.
  25.  
  26. ;;;; These are error handlers for SCM.
  27. (define out-of-storage #f)
  28. (define could-not-open #f)
  29. (define arithmetic-error #f)
  30. (define user-interrupt #f)
  31. (define end-of-program #f)
  32. ;(define hang-up end-of-program)        ;automatic
  33.  
  34. (define (set-handlers!)
  35.   (set! out-of-storage (lambda () (impl_error "Out of storage")))
  36.   (set! could-not-open (lambda () (impl_error "File not found")))
  37.   (set! arithmetic-error (lambda () (impl_error "Arithmetic Error")))
  38. ;  (set! user-interrupt (lambda () (impl_error "User Interrupt")))
  39.   (set! end-of-program (lambda () (math_exit #t))))
  40.  
  41. (define (cleanup-handlers!)
  42.   (set! out-of-storage #f)
  43.   (set! could-not-open #f)
  44.   (set! arithmetic-error #f)
  45.   (set! user-interrupt #f)
  46.   (set! end-of-program #f))
  47.