add and use close-eval to reduce memory use when rendering reference and guide
svn: r9981
This commit is contained in:
parent
af9d53e7f0
commit
7ae0f500ae
|
@ -23,6 +23,7 @@
|
|||
as-examples
|
||||
|
||||
make-base-eval
|
||||
close-eval
|
||||
|
||||
scribble-eval-handler)
|
||||
|
||||
|
@ -244,6 +245,10 @@
|
|||
[sandbox-eval-limits #f]
|
||||
[sandbox-make-inspector current-inspector])
|
||||
(make-evaluator '(begin (require scheme/base)))))
|
||||
|
||||
(define (close-eval e)
|
||||
(kill-evaluator e)
|
||||
"")
|
||||
|
||||
(define (do-plain-eval ev s catching-exns?)
|
||||
(call-with-values (lambda ()
|
||||
|
|
|
@ -799,3 +799,7 @@ Using this form in conjunction with trait operators such as
|
|||
(define/public (get-color)
|
||||
.... (get-spots-color) .... (get-stripes-color) ....))))
|
||||
]
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[class-eval]
|
||||
|
|
|
@ -264,3 +264,7 @@ For an example of how @tech{continuations} are useful, see
|
|||
@other-manual['(lib "scribblings/more/more.scrbl")]. For specific
|
||||
control operators that have more convenient names than the primitives
|
||||
described here, see @schememodname[scheme/control].
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[cc-eval]
|
||||
|
|
|
@ -490,3 +490,5 @@ A @scheme[_struct-option] always starts with a keyword:
|
|||
@; ----------------------------------------
|
||||
|
||||
@refdetails["structures"]{structure types}
|
||||
|
||||
@close-eval[posn-eval]
|
||||
|
|
|
@ -257,3 +257,7 @@ in the next section). However, other definition forms can appear as a
|
|||
@secref["macros"]).
|
||||
|
||||
@refdetails/gory["intdef-body"]{internal definitions}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[def-eval]
|
||||
|
|
|
@ -412,3 +412,9 @@ immediately if that's all that is available:
|
|||
(copy-port (open-input-string "broom") o)
|
||||
(get-output-string o)
|
||||
]
|
||||
|
||||
@close-eval[port-eval]
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[io-eval]
|
||||
|
|
|
@ -237,3 +237,7 @@ case that matches the number of given arguments.
|
|||
|
||||
A @scheme[case-lambda] function cannot directly support optional or
|
||||
keyword arguments.
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[greet-eval]
|
||||
|
|
|
@ -344,3 +344,7 @@ directly, so the tail-call ``optimization'' kicks in:
|
|||
#,step (cons "a" (list "b"))
|
||||
#,step (list "a" "b")
|
||||
]
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[list-eval]
|
||||
|
|
|
@ -120,3 +120,5 @@ pattern variables can be bound to lists of lists of matches:
|
|||
]
|
||||
|
||||
For information on many more pattern forms, see @schememodname[scheme/match].
|
||||
|
||||
@close-eval[match-eval]
|
||||
|
|
|
@ -117,3 +117,7 @@ Unless otherwise specified, a module that is documented as a
|
|||
@scheme[module] in the same way as @schememodfont{#lang}
|
||||
@schememodname[scheme]. The documented language name can be used
|
||||
directly with @scheme[module] or @scheme[require], too.
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[cake-eval]
|
||||
|
|
|
@ -460,3 +460,5 @@ defines the macro.
|
|||
@; ----------------------------------------
|
||||
|
||||
@include-section["certificates.scrbl"]
|
||||
|
||||
@close-eval[check-eval]
|
||||
|
|
|
@ -952,3 +952,5 @@ The regexp @scheme[ip-re] will match all and only valid IP addresses.
|
|||
(regexp-match ip-re "1.2.3.4")
|
||||
(regexp-match ip-re "0.0.0.0")
|
||||
]
|
||||
|
||||
@close-eval[ex-eval]
|
||||
|
|
|
@ -597,3 +597,7 @@ use earlier bindings:
|
|||
[z (+ x y)])
|
||||
(format "adding ~s and ~s produces ~s" x y z))
|
||||
]
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[ex-eval]
|
||||
|
|
|
@ -40,6 +40,8 @@ and @scheme[cdr] is pronounced ``could-er.'')
|
|||
(pair? (list 1 2 3))
|
||||
]
|
||||
|
||||
@close-eval[list-eval]
|
||||
|
||||
Scheme's pair datatype and its relation to lists is essentially a
|
||||
historical curiosity, along with the dot notation for printing and the
|
||||
funny names @scheme[car] and @scheme[cdr]. Pairs are deeply wired into
|
||||
|
|
|
@ -510,3 +510,6 @@ use @scheme[unit] when you need to parameterize code over functions,
|
|||
datatypes, and classes, and when the parameterized code itself
|
||||
provides definitions to be linked with other parameterized code.
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[toy-eval]
|
||||
|
|
|
@ -218,3 +218,7 @@ which Scheme and Lisp implementations have historically fought with ad
|
|||
hoc command-line flags, compiler directives, and build tools. The
|
||||
module system is to designed to avoid the problems, so start with
|
||||
@hash-lang[], and you'll be happier with PLT Scheme in the long run.
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[piece-eval]
|
||||
|
|
|
@ -1713,3 +1713,5 @@ a method that is not supplied by an object.
|
|||
@; ----------------------------------------------------------------------
|
||||
|
||||
@include-section["surrogate.scrbl"]
|
||||
|
||||
@close-eval[class-eval]
|
||||
|
|
|
@ -190,3 +190,7 @@ and the only constraint on the form is that it starts with some
|
|||
(set-posn-x! (make-posn 1 2) 0)
|
||||
(define-xy-struct posn #:bad-option)
|
||||
]}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@close-eval[posn-eval]
|
||||
|
|
|
@ -466,3 +466,8 @@ mappings are the same when keys and values are compared with
|
|||
(dict-set! h 1 'one)
|
||||
(dict-ref h "1")
|
||||
]}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[dict-eval]
|
||||
|
||||
|
|
|
@ -433,3 +433,7 @@ A transformer produced by a second @scheme[proc-expr] subexpression is
|
|||
A parameter that determines the comparison procedure used to check
|
||||
whether multiple uses of an identifier match the ``same'' value. The
|
||||
default is @scheme[equal?].}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[match-eval]
|
||||
|
|
|
@ -858,3 +858,7 @@ Returns the hyperbolic sine of @scheme[z].}
|
|||
@defproc[(cosh [z number?]) number?]{
|
||||
|
||||
Returns the hyperbolic cosine of @scheme[z].}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[math-eval]
|
||||
|
|
|
@ -634,6 +634,8 @@ returns @scheme[#f].
|
|||
(filter-not even? '(1 2 3 4 5 6))
|
||||
]}
|
||||
|
||||
@close-eval[list-eval]
|
||||
|
||||
@; ----------------------------------------
|
||||
@section{Immutable Cyclic Data}
|
||||
|
||||
|
|
|
@ -468,6 +468,7 @@ arguments, and following steps add arguments to the left of these.
|
|||
|
||||
@examples[#:eval fun-eval
|
||||
(map (curryr list 'foo) '(1 2 3))
|
||||
]
|
||||
]}
|
||||
|
||||
}
|
||||
|
||||
@close-eval[fun-eval]
|
||||
|
|
|
@ -612,3 +612,7 @@ A macro version of @scheme[call-with-limits].}
|
|||
A predicate and accessor for exceptions that are raised by
|
||||
@scheme[call-with-limits]. The @scheme[resource] field holds a symbol,
|
||||
either @scheme['time] or @scheme['memory].}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[box-eval]
|
||||
|
|
|
@ -491,3 +491,7 @@ This directory path is used as a last resort when
|
|||
@scheme[deserialize-id] indicates a module that was loaded through a
|
||||
relative path with respect to the top level. Usually, it should be
|
||||
@scheme[(or (current-load-relative-directory) (current-directory))].}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[ser-eval]
|
||||
|
|
|
@ -122,3 +122,7 @@ data cycles (but only with cycles that can be created via mutation).
|
|||
b)
|
||||
]}
|
||||
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[shared-eval]
|
||||
|
|
|
@ -384,3 +384,5 @@ one between @scheme[list] and @scheme[list*].
|
|||
(string-append* (cdr (append* (map (lambda (x) (list ", " x))
|
||||
'("Alpha" "Beta" "Gamma")))))
|
||||
]}
|
||||
|
||||
@close-eval[string-eval]
|
||||
|
|
|
@ -610,3 +610,7 @@ by @scheme[make-struct-info]. This @tech{structure type descriptor} is
|
|||
mostly useful for creating structure subtypes. The structure type
|
||||
includes a guard that checks an instance's first field in the same way
|
||||
as @scheme[make-struct-info].}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[struct-eval]
|
||||
|
|
|
@ -720,3 +720,7 @@ Like @scheme[syntax-local-certifier], but to certify @tech{syntax
|
|||
objects} that correspond to @scheme[provide] sub-forms, so that
|
||||
@scheme[expand-export] can deconstruct the @tech{syntax object} as
|
||||
necessary to expand it.}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@close-eval[stx-eval]
|
||||
|
|
|
@ -93,6 +93,13 @@ setting sandbox parameters to disable limits, set the outputs to
|
|||
@scheme['string], and not add extra security guards.}
|
||||
|
||||
|
||||
@defproc[(close-eval [eval (any/c . -> . any)]) (one-of/c "")]{
|
||||
|
||||
Shuts down an evaluator produced by @scheme[make-base-eval]. Use
|
||||
@scheme[close-eval] when garbage collection cannot otherwise reclaim
|
||||
an evaluator (e.g., because it is defined in a module body).}
|
||||
|
||||
|
||||
@defparam[scribble-eval-handler handler
|
||||
((any/c . -> . any) any/c boolean? . -> . any)]{
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user