drscheme:eval:expand-program in DrScheme Tools Functions
(drscheme:eval:expand-program -> void?
input language-settings eval-compile-time-part? init kill-termination iter)
input : (union port? drscheme:language:text/pos?)
language-settings : drscheme:language-configuration:language-settings?
eval-compile-time-part? : boolean?
init : (-> void?)
kill-termination : (-> void?)
iter : ((union eof-object? syntax? (cons/p string? any?)) (-> any) . -> . any)
Use this function to expand the contents of the definitions window for use with external program processing tools.
This function uses
drscheme:eval:build-user-eventspace/custodian to build the user's environment.
The arguments language-settings, init, and
kill-termination are passed to
drscheme:eval:build-user-eventspace/custodian.
The input argument specifies the source of the program.
The eval-compile-time-part? argument indicates if
awscmexpand
is called or if
expand-top-level-with-compile-time-evals
is called when the program is expanded.
Roughly speaking, if your tool will evaluate each expression
itself by calling
eval
then pass #f. Otherwise, if your tool
just processes the expanded program, be sure to pass
#t.
This function calls
front-end/complete-program to expand the program.
The first argument to iter is the expanded program
(represented as syntax) or eof.
The iter argument is called for each expression in the
expanded program and once more with eof, unless an error is
raised during expansion.
It is called from the user's thread.
If an exception is raised during expansion of the
user's program, iter is not called.
Consider setting the exception-handler during init to
handle this situation.
The second argument to iter is a thunk that
continues expanding the rest of the contents of the
definitions window. If the first argument to iter was
eof, this argument is just the primitive
void.
See also
drscheme:eval:expand-program/multiple.