features.scm 2.0 KB

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