teachpacks -> requires (keep :teachpacks for compatibility)

svn: r11865
This commit is contained in:
Eli Barzilay 2008-09-25 06:26:18 +00:00
parent cc5a495f87
commit b465a25656
4 changed files with 24 additions and 14 deletions

View File

@ -361,6 +361,7 @@
([users* (get ':users #'#f)]
[eval?* (get ':eval? #'#t)]
[language* (get ':language #'#f)]
[requires* (get ':requires #''())]
[teachpacks* (get ':teachpacks #''())]
[create-text?* (get ':create-text? #'#t)]
[untabify?* (get ':untabify? #'#t)]
@ -406,6 +407,7 @@
us))]
[eval? eval?*]
[language language*]
[requires requires*]
[teachpacks teachpacks*]
[create-text? create-text?*]
[untabify? untabify?*]
@ -509,7 +511,8 @@
(error* uem m)]
[else (error* "~a" uem)])))])
(call-with-evaluator/submission
language teachpacks submission values))])
language (append requires teachpacks)
submission values))])
(set-run-status "running tests")
(parameterize ([submission-eval (wrap-evaluator eval)])
(let-syntax ([with-submission-bindings
@ -537,6 +540,8 @@
"`untabify?' without `maxwidth'"]
[(and (not eval?) coverage?)
"`coverage?' without `eval?'"]
[(and (pair? requires) (pair? teachpacks))
"`requires' and `teachpacks'"]
;; [(and textualize? coverage?)
;; "`textualize?' and `coverage?'"]
[else #f])])

View File

@ -66,10 +66,14 @@ Keywords for configuring @scheme[check:]:
There is no default for this, so it must be set or an error is
raised.}
@item{@indexed-scheme[:teachpacks]---teachpacks for evaluating
submissions, same as the @scheme[_teachpacks] argument for
@scheme[make-evaluator] (see @schememodname[handin-server/sandbox]).
This defaults to null---no teachpacks.}
@item{@indexed-scheme[:requires]---paths for additional libraries to
require for evaluating the submission, same as the
@scheme[_requires] argument for @scheme[make-evaluator] (see
@schememodname[handin-server/sandbox]). This defaults to null---no
teachpacks.}
@item{@indexed-scheme[:teachpacks]---an alternative name for
@scheme[:requires], kept for legacy checkers.}
@item{@indexed-scheme[:create-text?]---if true, then a textual version
of the submission is saved as @filepath{text.scm} in a

View File

@ -22,7 +22,7 @@
[language (or/c module-path?
(list/c (one-of/c 'special) symbol?)
(cons/c (one-of/c 'begin) list?))]
[teachpack-paths (listof path-string?)]
[require-paths (listof path-string?)]
[content bytes?])
(any/c . -> . any)]{
@ -34,7 +34,7 @@
[language (or/c module-path?
(list/c (one-of/c 'special) symbol?)
(cons/c (one-of/c 'begin) list?))]
[teachpack-paths (listof path-string?)]
[require-paths (listof path-string?)]
[input-program any/c]
[proc (any/c . -> . any)])
any]{
@ -52,7 +52,7 @@
(or/c module-path?
(list/c (one-of/c 'special) symbol?)
(cons/c (one-of/c 'begin) list?))]
[teachpack-paths (listof path-string?)]
[require-paths (listof path-string?)]
[submission bytes?]
[proc (any/c . -> . any)])
any]{

View File

@ -52,9 +52,10 @@
(let ([inp (open-input-text-editor str)])
(port-count-lines! inp) inp))
(define (make-evaluator/submission language teachpacks str)
(define (make-evaluator/submission language requires str)
(let-values ([(defs interacts) (unpack-submission str)])
(make-evaluator language teachpacks (open-input-text-editor defs))))
(make-evaluator language #:requires requires
(open-input-text-editor defs))))
(define (evaluate-all source port eval)
(let loop ()
@ -160,17 +161,17 @@
(regexp-replace #rx"\n$" (get-output-string p) ""))))
(define current-value-printer (make-parameter default-value-printer))
(define (call-with-evaluator lang teachpacks program-port go)
(define (call-with-evaluator lang requires program-port go)
(parameterize ([error-value->string-handler (lambda (v s)
((current-value-printer) v))]
[list-abbreviation-enabled (not (or (eq? lang 'beginner)
(eq? lang 'beginner-abbr)))])
(reraise-exn-as-submission-problem
(lambda ()
(let ([e (make-evaluator lang #:requires teachpacks program-port)])
(let ([e (make-evaluator lang #:requires requires program-port)])
(set-run-status "executing your code")
(go e))))))
(define (call-with-evaluator/submission lang teachpacks str go)
(define (call-with-evaluator/submission lang requires str go)
(let-values ([(defs interacts) (unpack-submission str)])
(call-with-evaluator lang teachpacks (open-input-text-editor defs) go)))
(call-with-evaluator lang requires (open-input-text-editor defs) go)))