drscheme:eval:expand-program in DrScheme Tools Functions
(drscheme:eval:expand-program-> void?inputlanguage-settingseval-compile-time-part?initkill-terminationiter)
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/c string? any/c)) (-> 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/custodianto build the user's environment. The argumentslanguage-settings,init, andkill-terminationare passed todrscheme:eval:build-user-eventspace/custodian.The
inputargument specifies the source of the program.The
eval-compile-time-part?argument indicates if awscmexpand is called or ifexpand-top-level-with-compile-time-evalsis called when the program is expanded. Roughly speaking, if your tool will evaluate each expression itself by callingevalthen pass#f. Otherwise, if your tool just processes the expanded program, be sure to pass#t.This function calls
front-end/complete-programto expand the program.The first argument to
iteris the expanded program (represented as syntax) or eof. Theiterargument 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,iteris not called. Consider setting the exception-handler duringinitto handle this situation.The second argument to
iteris a thunk that continues expanding the rest of the contents of the definitions window. If the first argument toiterwas eof, this argument is just the primitivevoid.See also
drscheme:eval:expand-program/multiple.