bkyk8rc3zvpnsf5inmcqq4n3k98cv6hj-my-site-hyper-literate-git.test.suzanne.soy-0.0.1

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 0808c21415b743cd9668c3561d205bb72c7880a6
parent d16c59f097697a49a62902b6cfd848bf0d611f9f
Author: David Van Horn <dvanhorn@ccs.neu.edu>
Date:   Fri, 22 Feb 2013 19:01:42 -0500

Add #:lang and input-program inputs to make-base-eval and friends.

This commit extends make-base-eval, make-base-eval-factory, and
make-eval-factory with an #:eval and input-program inputs so that
these functions are more like racket/sandbox make-evaluator.

original commit: 213430f728b33486fcc8334058a833f9d8c9de78

Diffstat:
Mcollects/scribble/eval.rkt | 14++++++++------
Mcollects/scribblings/scribble/eval.scrbl | 24++++++++++++++++++++----
2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/collects/scribble/eval.rkt b/collects/scribble/eval.rkt @@ -342,13 +342,13 @@ (namespace-attach-module ns 'racket/pretty) (current-print (dynamic-require 'racket/pretty 'pretty-print-handler))))) -(define (make-base-eval #:pretty-print? [pretty-print? #t]) +(define (make-base-eval #:lang [lang '(begin)] #:pretty-print? [pretty-print? #t] . ips) (call-with-trusted-sandbox-configuration (lambda () (parameterize ([sandbox-output 'string] [sandbox-error-output 'string] [sandbox-propagate-breaks #f]) - (let ([e (make-evaluator '(begin))]) + (let ([e (apply make-evaluator lang ips)]) (let ([ns (namespace-anchor->namespace anchor)]) (call-in-sandbox-context e @@ -357,7 +357,8 @@ e))))) (define (make-base-eval-factory mod-paths - #:pretty-print? [pretty-print? #t]) + #:lang [lang '(begin)] + #:pretty-print? [pretty-print? #t] . ips) (let ([ns (delay (let ([ns ;; This namespace-creation choice needs to be consistent ;; with the sandbox (i.e., with `make-base-eval') @@ -370,7 +371,7 @@ (when pretty-print? (dynamic-require 'racket/pretty #f))) ns))]) (lambda () - (let ([ev (make-base-eval #:pretty-print? #f)] + (let ([ev (apply make-base-eval #:lang lang #:pretty-print? #f ips)] [ns (force ns)]) (when pretty-print? (install-pretty-printer! ev ns)) (call-in-sandbox-context @@ -381,8 +382,9 @@ ev)))) (define (make-eval-factory mod-paths - #:pretty-print? [pretty-print? #t]) - (let ([base-factory (make-base-eval-factory mod-paths #:pretty-print? pretty-print?)]) + #:lang [lang '(begin)] + #:pretty-print? [pretty-print? #t] . ips) + (let ([base-factory (apply make-base-eval-factory mod-paths #:lang lang #:pretty-print? pretty-print? ips)]) (lambda () (let ([ev (base-factory)]) (call-in-sandbox-context diff --git a/collects/scribblings/scribble/eval.scrbl b/collects/scribblings/scribble/eval.scrbl @@ -155,10 +155,16 @@ Like @racket[examples], but each definition using @racket[define] or prompt, and with line of space after it.} -@defproc[(make-base-eval [#:pretty-print? pretty-print? any/c #t]) +@defproc[(make-base-eval [#:pretty-print? pretty-print? any/c #t] + [#:lang lang + (or/c module-path? + (list/c 'special symbol?) + (cons/c 'begin list?)) + '(begin)] + [input-program any/c] ...) (any/c . -> . any)]{ -Creates an evaluator using @racket[(make-evaluator 'racket/base)], +Creates an evaluator using @racket[(make-evaluator 'racket/base #:lang lang input-program ...)], setting sandbox parameters to disable limits, setting the outputs to @racket['string], and not adding extra security guards. @@ -167,7 +173,12 @@ If @racket[pretty-print?] is true, the sandbox's printer is set to @defproc[(make-base-eval-factory [mod-paths (listof module-path?)] - [#:pretty-print? pretty-print? any/c #t]) + [#:pretty-print? pretty-print? any/c #t] + [#:lang lang + (or/c module-path? + (list/c 'special symbol?) + (cons/c 'begin list?)) + '(begin)]) (-> (any/c . -> . any))]{ Produces a function that is like @racket[make-base-eval], except that @@ -178,7 +189,12 @@ time) and then attached to each evaluator that is created.} @defproc[(make-eval-factory [mod-paths (listof module-path?)] - [#:pretty-print? pretty-print? any/c #t]) + [#:pretty-print? pretty-print? any/c #t] + [#:lang lang + (or/c module-path? + (list/c 'special symbol?) + (cons/c 'begin list?)) + '(begin)]) (-> (any/c . -> . any))]{ Like @racket[make-base-eval-factory], but each module in @racket[mod-paths] is