adjust and add "docs" to img-eval.rkt for Matthias's consumption
This commit is contained in:
parent
99635ab091
commit
e08c1f3ad1
|
@ -1,9 +1,34 @@
|
|||
#lang racket/base
|
||||
(require scribble/eval)
|
||||
(provide make-img-eval)
|
||||
(provide make-img-eval
|
||||
set-eval-handler-to-tweak-images)
|
||||
|
||||
#|
|
||||
|
||||
make-img-eval : -> (any/c . -> . any)
|
||||
calls @racket[make-base-eval] to create
|
||||
an evaluator, and then initializes it with
|
||||
@racket[set-eval-handler-to-tweak-images].
|
||||
|
||||
|
||||
set-eval-handler-to-tweak-images : (any/c . -> . any) -> void?
|
||||
|
||||
loads @racketmodname[2htdp/image] and @racketmodname[lang/posn]
|
||||
into the given evaluator and then sets its eval-handler to
|
||||
increase the bounding box for 2htdp/image images by 1.
|
||||
|
||||
It does this only for images that the result of evaluation
|
||||
directly (not for example, when lists that contain images
|
||||
are the result of evaluation).
|
||||
|
||||
|#
|
||||
|
||||
(define (make-img-eval)
|
||||
(define img-eval (make-base-eval))
|
||||
(set-eval-handler-to-tweak-images img-eval)
|
||||
img-eval)
|
||||
|
||||
(define (set-eval-handler-to-tweak-images img-eval)
|
||||
(interaction-eval #:eval img-eval (require 2htdp/image))
|
||||
(interaction-eval #:eval img-eval (require lang/posn))
|
||||
|
||||
|
@ -24,6 +49,4 @@
|
|||
i))
|
||||
(current-eval
|
||||
(λ (exp)
|
||||
(adjust-image exp (ce exp))))))
|
||||
|
||||
img-eval)
|
||||
(adjust-image exp (ce exp)))))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user