(index ("safe-eval" 0) ("current-fuel" 953) ("current-allocation-limit" 1253) ("safe-environment?" 1641) ("current-safe-environment" 1813) ("default-safe-environment" 2027) ("make-safe-environment" 2204) ("safe-environment-ref" 2860) ("safe-environment-set!" 3243) ("safe-environment-remove!" 4017) ("safe-environment-macro-set!" 4227) ("safe-environment-macro-remove!" 4554))
(def (sig (procedure " (safe-eval EXPRESSION #!key ENVIRONMENT FUEL ALLOCATION-LIMIT)" (id safe-eval))) (p "Evaluates " (tt "EXPRESSION") " in a safe evaluation context. " (tt "FUEL") " specifies how much " (i "fuel") " the pre-translation and evaluation has before an exception will be raised. " (tt "ALLOCATION-LIMIT") " gives (a rough) estimation over the maximal size of storage that may be allocated during the evalution of " (tt "EXPRESSION") ". " (tt "FUEL") " and " (tt "ALLOCATION-LIMIT") " default to " (tt "#f") ", meaning no limit is given.") (p (tt "ENVIRONMENT") " specifies the evaluation environment that should be used, and defaults to the value of " (tt "default-safe-environment") ".") (p "Should an error occur during the execution of EXPRESSION, a composite condition of the original error condition and a condition of the kind " (tt "sandbox") " will be signalled.") (p "Note that de-allocation is not tracked, only allocation."))
(def (sig (parameter "current-fuel" (id current-fuel))) (p "A parameter holding the current amount " (i "fuel") ". If this counter reaches zero during the pre-translation or execution of an evaluated expression an error is signalled. The initial value is " (tt "#f") ", meaning no limit is given."))
(def (sig (parameter "current-allocation-limit" (id current-allocation-limit))) (p "A parameter holding the current maximum storage that an evaluated expression may allocate. If the total size of allocated storage exceeds this limit (given in bytes) and error is signalled. The initial value is " (tt "#f") ", meaning no limit is given.") (p "Note that this limit is a rough estimate."))
(def (sig (procedure "(safe-environment? X)" (id safe-environment?))) (p "Returns " (tt "#t") " if " (tt "X") " is a safe environment object or " (tt "#f") " otherwise."))
(def (sig (parameter "current-safe-environment" (id current-safe-environment))) (p "A parameter holding the current evaluation environment. The initial value is the value of " (tt "default-safe-environment") "."))
(def (sig (constant "default-safe-environment" (id default-safe-environment))) (p "An evaluation environment containing a basic R5RS environment without I/O procedures.</dd>"))
(def (sig (procedure "(make-safe-environment #!key NAME PARENT MUTABLE EXTENDABLE)" (id make-safe-environment))) (p "Creates a fresh evaluation environment with a given " (tt "NAME") " and parent environment " (tt "PARENT") ". Whn a binding is looked up and can not be found in the current environment, then the chain of parent environments will be checked for a matching binding.") (p "If " (tt "MUTABLE") " is not given or false, then this environment is not mutable and bindings in this environment may not be changed with " (tt "set!") ". If " (tt "EXTENDABLE") " is not given or true, then the environment may be extended with new global bindings."))
(def (sig (procedure "(safe-environment-ref ENVIRONMENT ID [DEFAULT])" (id safe-environment-ref))) (p "Returns the current value of the variable named " (tt "ID") " in " (tt "ENVIRONMENT") " or " (tt "DEFAULT") " if the " (tt "ENVIRONMENT") " or it's parent environments do not contain a binding with this name. If " (tt "DEFAULT") " is not given, " (tt "#f") " will be returned."))
(def (sig (procedure "(safe-environment-set! ENVIRONMENT ID VALUE)" (id safe-environment-set!))) (p "Sets the value of the variable named " (tt "ID") " in " (tt "ENVIRONMENT") " to value, creating a new binding if no variable with this name exists (it doesn't check the parent environment).  Use this procedure to add additional primitives to an evaluation context:") (highlight scheme "(define my-env\n  (make-safe-environment parent: default-safe-environment) )\n\n(safe-environment-set!\n  my-env 'hello\n  (lambda (arg) \n    (display \"Hello, \")\n    (display arg)\n    (display \"!\\n\") ) )\n\n(safe-eval '(hello \"you\") environment: my-env)\n\n; prints:\n\nHello, you!") (p "This procedure doesn't care whether an environment is mutable (or extendable) or not."))
(def (sig (procedure "(safe-environment-remove! ENVIRONMENT ID)" (id safe-environment-remove!))) (p "Removes the binding for " (tt "ID") " in the given environment or does nothing if no such binding exists."))
(def (sig (procedure "(safe-environment-macro-set! ENVIRONMENT ID PROC)" (id safe-environment-macro-set!))) (p "Defines or changes the macro-expander procedure for the macro with the name " (tt "ID") " to " (tt "PROC") ", which should be a procedure of one argument, the list of arguments (unevaluated) passed to the macro."))
(def (sig (procedure "(safe-environment-macro-remove! ENVIRONMENT ID)" (id safe-environment-macro-remove!))) (p "Removes the macro-binding for " (tt "ID") " in the given environment or does nothing if no such binding exists."))
