pseudoscheme-features.scm 2.9 KB

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