pseudoscheme-features.scm 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. ; -*- Mode: Scheme; Syntax: Scheme; Package: Scheme; -*-
  2. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  3. ; Authors: Richard Kelsey, Jonathan Rees, Mike Sperber
  4. ; This is file pseudoscheme-features.scm.
  5. ; Synchronize any changes with all the other *-features.scm files.
  6. (define *scheme-file-type* #f) ;For fun
  7. ; SIGNALS
  8. (define (error who message . irritants)
  9. (apply #'ps:scheme-error message irritants))
  10. (define (assertion-violation who message . irritants)
  11. (apply #'ps:scheme-error message irritants))
  12. (define (implementation-restriction-violation who message . irritants)
  13. (apply #'ps:scheme-error message irritants))
  14. (define (warning who message . irritants)
  15. (apply #'ps:scheme-warn message irritants))
  16. (define (note who message . irritants)
  17. (apply #'ps:scheme-warn message irritants))
  18. (define (syntax-violation who message form . maybe-subform)
  19. (apply warning who message form maybe-subform)
  20. ''syntax-error)
  21. ; FEATURES
  22. (define force-output #'lisp:force-output)
  23. (define (string-hash s)
  24. (let ((n (string-length s)))
  25. (do ((i 0 (+ i 1))
  26. (h 0 (+ h (lisp:char-code (string-ref s i)))))
  27. ((>= i n) h))))
  28. (define (make-immutable! thing) thing)
  29. (define (immutable? thing) #f)
  30. ; BITWISE
  31. (define arithmetic-shift #'lisp:ash)
  32. (define bitwise-and #'lisp:logand)
  33. (define bitwise-ior #'lisp:logior)
  34. (define bitwise-not #'lisp:lognot)
  35. ; ASCII
  36. (define char->ascii #'lisp:char-code)
  37. (define ascii->char #'lisp:code-char)
  38. (define ascii-limit lisp:char-code-limit)
  39. (define ascii-whitespaces '(32 10 9 12 13))
  40. ; CODE-VECTORS
  41. (define (make-code-vector len . fill-option)
  42. (lisp:make-array len :element-type '(lisp:unsigned-byte 8)
  43. :initial-element (if (null? fill-option)
  44. 0
  45. (car fill-option))))
  46. (define (code-vector? obj)
  47. (ps:true? (lisp:typep obj
  48. (lisp:quote (lisp:simple-array (lisp:unsigned-byte 8)
  49. (lisp:*))))))
  50. (define (code-vector-ref bv k)
  51. (lisp:aref (lisp:the (lisp:simple-array (lisp:unsigned-byte 8) (lisp:*))
  52. bv)
  53. k))
  54. (define (code-vector-set! bv k val)
  55. (lisp:setf (lisp:aref (lisp:the (lisp:simple-array (lisp:unsigned-byte 8)
  56. (lisp:*))
  57. bv)
  58. k)
  59. val))
  60. (define (code-vector-length bv)
  61. (lisp:length (lisp:the (lisp:simple-array (lisp:unsigned-byte 8) (lisp:*))
  62. bv)))
  63. (define (write-byte byte port)
  64. (write-char (ascii->char byte) port))
  65. ; The rest is unnecessary in Pseudoscheme versions 2.8d and after.
  66. ;(define eval #'schi:scheme-eval)
  67. ;(define (interaction-environment) schi:*current-rep-environment*)
  68. ;(define scheme-report-environment
  69. ; (let ((env (scheme-translator:make-program-env
  70. ; 'rscheme
  71. ; (list scheme-translator:revised^4-scheme-module))))
  72. ; (lambda (n)
  73. ; n ;ignore
  74. ; env)))
  75. ; Dynamic-wind.
  76. ;
  77. ;(define (dynamic-wind in body out)
  78. ; (in)
  79. ; (lisp:unwind-protect (body)
  80. ; (out)))
  81. ;
  82. ;(define values #'lisp:values)
  83. ;
  84. ;(define (call-with-values thunk receiver)
  85. ; (lisp:multiple-value-call receiver (thunk)))