support for cache-image

svn: r5395
This commit is contained in:
Matthew Flatt 2007-01-18 13:47:48 +00:00
parent 298db5ef07
commit ca93f4e358
4 changed files with 34 additions and 8 deletions

View File

@ -0,0 +1,30 @@
(module cache-image mzscheme
(require (lib "class.ss"))
(provide reader
(struct cache-image (argb width height pin-x pin-y)))
(define-struct cache-image (argb width height pin-x pin-y))
(define reader
(new
(class object%
(define/public (read-header vers stream)
(void))
(define/public (read-snip text? cvers stream)
(let ([content (send stream read-bytes "content")])
(if text?
#"."
(let ([l (read (open-input-bytes content))])
(make-cache-image (car l)
(cadr l)
(/ (vector-length (car l)) (cadr l) 4)
(caddr l)
(cadddr l))))))
(super-new)))))

View File

@ -14,7 +14,9 @@
[decimal-prefix (send stream read-bytes "decimal prefix")]
[fraction-bytes (send stream read-bytes "fraction")]
[expansions (send stream read-bytes "expansions")])
number))
(if text?
number
(lambda (src line col pos) (string->number (bytes->string/latin-1 number))))))
(super-new)))))

View File

@ -36,4 +36,4 @@
(register-lib-mapping!
"(lib \"cache-image-snip.ss\" \"mrlib\")"
"(lib \"image.ss\" \"mred\" \"wxme\")"))
"(lib \"cache-image.ss\" \"mred\" \"wxme\")"))

View File

@ -1,6 +0,0 @@
(module wxmefile mzscheme
(require "wxme/wxme.ss")
(provide (all-from-except "wxme/wxme.ss"
wxme:read
wxme:read-syntax)))