plt-features.scm 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ; -*- Mode: Scheme; Syntax: Scheme; Package: Scheme; -*-
  2. ; Copyright (c) 1993-2007 by Richard Kelsey and Jonathan Rees. See file COPYING.
  3. ; This is file plt-features.scm.
  4. ; Synchronize any changes with all the other *-features.scm files.
  5. ; SIGNALS
  6. ; ERROR is built-in
  7. (define (format-error-message message irritants)
  8. (apply string-append message
  9. (map (lambda (irritant)
  10. (string-append " " ((error-value->string-handler) irritant 1000)))
  11. irritants)))
  12. (define (warn message . irritants)
  13. (void)
  14. (display (format-error-message message irritants)
  15. (current-error-port))
  16. (newline (current-error-port))
  17. )
  18. (define (signal type . stuff)
  19. (apply warn "condition signalled" type stuff))
  20. (define (syntax-error . rest) ; Must return a valid expression.
  21. (apply warn rest)
  22. ''syntax-error)
  23. (define (call-error message proc . args)
  24. (error message (cons proc args)))
  25. ; FEATURES
  26. (define force-output flush-output)
  27. (define current-noise-port current-error-port)
  28. (define (string-hash s) (abs (equal-hash-code s)))
  29. (define (make-immutable! thing) thing) ; PLT can only do this upon construction
  30. ; IMMUTABLE? is built in
  31. ; BITWISE
  32. ; ARITHMETIC-SHIFT is built-in
  33. ; BITWISE-AND is built-in
  34. ; BITWISE-IOR is built-in
  35. ; BITWISE-NOT is built-in
  36. ; ASCII
  37. (define char->ascii char->integer)
  38. (define ascii->char integer->char)
  39. (define ascii-limit 127)
  40. (define ascii-whitespaces '(32 10 9 12 13))
  41. ; CELLS
  42. (define make-cell box)
  43. (define cell-ref unbox)
  44. (define cell-set! set-box!)
  45. ; CODE-VECTORS
  46. (define make-code-vector make-bytes)
  47. (define code-vector? bytes?)
  48. (define code-vector-ref bytes-ref)
  49. (define code-vector-set! bytes-set!)
  50. (define code-vector-length bytes-length)
  51. ; BINARY I/O
  52. ; WRITE-BYTE is built-in
  53. (define (set-port-crlf?! port val)
  54. (values))