guile-prescheme/prescheme/scheme48.scm
2022-07-19 19:12:27 +10:00

54 lines
1.4 KiB
Scheme

;;; Copyright 2022 Andrew Whatson
;;;
;;; Minimal Scheme48 compatibility layer for Pre-Scheme on Guile.
;;;
(define-module (prescheme scheme48)
#:use-module (srfi srfi-8)
#:use-module (srfi srfi-60)
#:use-module (rnrs bytevectors)
#:use-module (rnrs io ports)
#:use-module (prescheme s48-defenum)
#:export (arithmetic-shift
ascii->char
char->ascii
unspecific
make-code-vector
code-vector-ref
code-vector-set!
code-vector-length
byte-ready?
peek-byte
read-byte
write-byte
assertion-violation)
#:re-export (define-enumeration
enum
name->enumerand
enumerand->name
bitwise-and
bitwise-ior
bitwise-xor
bitwise-not
receive))
(define arithmetic-shift ash)
(define ascii->char integer->char)
(define char->ascii char->integer)
(define unspecific (if #f #f))
(define make-code-vector make-bytevector)
(define code-vector-ref bytevector-u8-ref)
(define code-vector-set! bytevector-u8-set!)
(define code-vector-length bytevector-length)
(define byte-ready? char-ready?)
(define peek-byte lookahead-u8)
(define read-byte get-u8)
(define write-byte put-u8)
(define (assertion-violation who message . irritants)
(apply error message irritants))