39 lines
1.4 KiB
Racket
39 lines
1.4 KiB
Racket
#lang racket/base
|
|
;; Preserve, as in Fruit Preserve, as in a remarkably weak pun on pickling/dehydration etc
|
|
|
|
(provide (all-from-out "record.rkt")
|
|
(all-from-out "float.rkt")
|
|
(all-from-out "annotation.rkt")
|
|
(all-from-out "order.rkt")
|
|
|
|
(all-from-out "read-binary.rkt")
|
|
(all-from-out "read-text.rkt")
|
|
(all-from-out "write-binary.rkt")
|
|
(all-from-out "write-text.rkt")
|
|
|
|
read-preserve)
|
|
|
|
(require "record.rkt")
|
|
(require "float.rkt")
|
|
(require "annotation.rkt")
|
|
(require "order.rkt")
|
|
|
|
(require "read-binary.rkt")
|
|
(require "read-text.rkt")
|
|
(require "write-binary.rkt")
|
|
(require "write-text.rkt")
|
|
|
|
(define (read-preserve [in-port (current-input-port)]
|
|
#:read-syntax? [read-syntax? #f]
|
|
#:decode-pointer [decode-pointer #f]
|
|
#:source [source (object-name in-port)])
|
|
(define b (peek-byte in-port))
|
|
(cond [(eof-object? b) b]
|
|
[(<= #x80 b #xBF) (read-preserve/binary in-port
|
|
#:read-syntax? read-syntax?
|
|
#:decode-pointer decode-pointer)]
|
|
[else (read-preserve/text in-port
|
|
#:read-syntax? read-syntax?
|
|
#:decode-pointer decode-pointer
|
|
#:source source)]))
|