6.2 Utilities
Returns a value from the configuration file (useful for reading things
like field names, etc.). Known keys (see
Server Setup) have
defaults and some have their values go through a translation (for
example,
'active-dirs produces a list of complete paths).
Other keys get neither, and an exception is raised if the
key
is not specified.
Returns two
text% objects corresponding to the submitted
definitions and interactions windows.
Like
make-evaluator, but the definitions content is
supplied as a submission byte string. The byte string is opened for
reading, with line-counting enabled.
In addition to the language specification for
make-evaluator, the language argument can be a
list that begins with 'module. In this case,
make-module-language is used to create an evaluator, and
the module code must be using the specified language in its
language position. In this case, the requires-paths
argument is used only for paths that are allowed to be accessed (the
allow-read argument to make-evaluator, since the
submission is expected to be a complete submission.)
Calls
proc with an evaluator for the given language,
teachpack paths, and initial definition content as supplied by
input-program (see
make-evaluator). It also sets
the current error-value print handler to print values in a way
suitable for
language, it initializes
set-run-status with
"executing your code", and it
catches all exceptions to re-raise them in a form suitable as a
submission error. See
make-evaluator/submission for
further details.
Like
load on an input port.
Like
load on a submission byte string.
Calls the function named
proc-name using the evaluator
eval, giving it the (unquoted) arguments
arg ...
Let
result-v be the result of the call; unless
(compare-proc result-v expect-v) is true, an exception is
raised.
Every exception or result mismatch during the call to
compare-proc is phrased suitably for the handin client.
Checks whether name is defined in the evaluator
eval, and raises an error if not (suitably phrased for the
handin client). If it is defined as non-syntax, its value is
returned. Warning: in the beginner language level, procedure
definitions are bound as syntax.
Inspects the given
text% object to determine whether it
contains at least
n tests for the function
name.
The tests must be top-level expressions.
Like
check-proc, but with no result checking. This
function is often useful for calling a student-defined constructor.
Controls how run-time errors are reported to the handin client. If
the parameter’s value is true, then the complete sequence of tested
expressions is reported to the handin client for any test failure.
Set this parameter to true when testing programs that use state.
The first case of
message is intended to update the client on
the current activity —
it updates the status line in the submission
dialog box on the client. Use it to indicate operations that might
take a while and/or indicate progress during these operations.
In the second case, where 'final is used as a flag, does not
show the text immediately — instead, it causes it to be displayed in
the status line after a successful submission instead of the usual
“Handin successful” message. This is useful for submissions that
are accepted but had some problems.
The third case, when styles is a list of symbols, opens a
message-box dialog on the client side, and the resulting
value is returned as the result of message. The
styles list is passed as the style argument to
message-box. You can use this to send warnings to the
student or to ask for confirmation, for example, “your submission
does not pass 3 tests, continue?”.
Registers information about the current actions of the checker, in
case the session is terminated due to excessive memory consumption
or a timeout. For example, a checker might set the status to
indicate which instructor-supplied test was being executed when the
session aborted.
Controls how values are printed. The
proc must be a
procedure that expects a Racket value and returns a string
representation for it. The default value printer uses
pretty-print, with DrRacket-like settings.
Calls thunk in a context that catches exceptions and
re-raises them in a form suitable as a submission error. It returns
the value returned by thunk if no exception occurs.
Produces a line in the server log file, using the given format
string and arguments. This function arranges to print the line fast
(to avoid mixing lines from different threads) to the error port,
and flush it. (The log port will prefix all lines with a time stamp
and a connection identifier.)
Controls the timeout for this session. The timeout is initialized
by the value of the session-timeout configuration entry,
and the checker can use this procedure to further control it: if
msg is 'reset the timeout is reset to
session-timeout seconds; if msg is a number the
timeout will be set to that many seconds in the future. The timeout
can be completely disabled using 'disable or #f.
(Note that before the checker is used (after the pre-checker, if
specified), the timer will be reset to the 'session-timeout
value.)
The main directory the server is running from. Useful for getting
to files that are not local to a specific submission.