features.scm 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Richard Kelsey, Jonathan Rees, Mike Sperber
  3. ; This is file features.scm.
  4. ; Synchronize any changes with all the other *-features.scm files.
  5. ; These definitions should be quite portable to any Scheme implementation.
  6. ; Assumes Revised^5 Report Scheme, for EVAL and friends.
  7. ; LOW-EXCEPTIONS
  8. (define (error who message . irritants)
  9. (display-error-message "Error" who message irritants)
  10. (an-error-occurred-now-what?))
  11. (define (assertion-violation who message . irritants)
  12. (display-error-message "Assertion violation" who message irritants)
  13. (an-error-occurred-now-what?))
  14. (error who message irritants))
  15. (define (implementation-restriction-violation who message . irritants)
  16. (display-error-message "Assertion violation" who message irritants)
  17. (an-error-occurred-now-what?))
  18. (define (warning who message . irritants)
  19. (display-error-message "Warning" who message irritants))
  20. (define (syntax-violation who message form . maybe-subform)
  21. (apply display-error-message "Syntax violation" who message form maybe-subform)
  22. ''syntax-error)
  23. (define (note who message . irritants)
  24. (display-error-message "Note" who message irritants))
  25. (define (display-error-message heading who message irritants)
  26. (display heading)
  27. (display " [") (display who) (display "]: ")
  28. (display message)
  29. (newline)
  30. (let ((spaces (list->string
  31. (map (lambda (c) #\space) (string->list heading)))))
  32. (for-each (lambda (irritant)
  33. (display spaces)
  34. (write irritant)
  35. (newline))
  36. irritants)))
  37. ; Linker also needs SIGNAL, SYNTAX-ERROR, CALL-ERROR
  38. ; FEATURES
  39. (define (force-output port) #f)
  40. (define current-noise-port current-output-port)
  41. (define (string-hash s)
  42. (let ((n (string-length s)))
  43. (do ((i 0 (+ i 1))
  44. (h 0 (+ h (char->ascii (string-ref s i)))))
  45. ((>= i n) h))))
  46. (define (make-immutable! thing) thing)
  47. (define (immutable? thing) #f)
  48. ; BITWISE -- use alt/bitwise.scm (!)
  49. ; ASCII -- use alt/ascii.scm
  50. ; CODE-VECTORS -- use alt/code-vectors.scm
  51. ; BINARY I/O -- check out alt/write-byte.scm