changing the output file prefix changes some other defaults
svn: r1867
This commit is contained in:
parent
6108f2dafd
commit
1f7cffecae
|
@ -717,9 +717,11 @@ Keywords for configuring `check:':
|
|||
null -- no teachpacks.
|
||||
|
||||
* :create-text? -- if true, then a textual version of the submission
|
||||
is saved as `text.scm' in a `grading' subdirectory. This is
|
||||
intended for printouts and grading, and is in a subdirectory so
|
||||
students will not see it on the status web server. Defaults to #t.
|
||||
is saved as "text.scm" in a "grading" subdirectory (or any suffix
|
||||
that is specified by :output below, for example "hw.java" is
|
||||
converted into a textual "grading/text.java"). This is intended for
|
||||
printouts and grading, and is in a subdirectory so students will not
|
||||
see it on the status web server. Defaults to #t.
|
||||
|
||||
* :textualize? -- if true, then all submissions are converted to text,
|
||||
trying to convert objects like comment boxes and test cases to some
|
||||
|
@ -731,7 +733,18 @@ Keywords for configuring `check:':
|
|||
to 79. This feature can be disabled if set to #f.
|
||||
|
||||
* :output -- the name of the original handin file (unrelated to the
|
||||
text-converted files). Defaults to "hw.scm".
|
||||
text-converted files). Defaults to "hw.scm". (The suffix changes
|
||||
the defaults of the following two entries.)
|
||||
|
||||
* :markup-prefix -- used as the prefix for :student-lines and
|
||||
:extra-lines below. The default is ";;> " or "//> ", depending on
|
||||
the suffix of :output above. (Note: if you change this, make sure
|
||||
to change :prefix-re too.)
|
||||
|
||||
* :prefix-re -- used to identify lines with markup (";>" or "//>"
|
||||
etc), so students cannot fool the system by writing marked-up code.
|
||||
The default is ";>" or "//>", depending on the suffix of :output
|
||||
above.
|
||||
|
||||
* :student-line -- when a submission is converted to text, it begins
|
||||
with lines describing the students that have submitted it; this is
|
||||
|
@ -739,11 +752,12 @@ Keywords for configuring `check:':
|
|||
holes that that `user-substs' (see below) fills out. The default is
|
||||
"Student: {username} ({Full Name} <{Email}>)", which requires a
|
||||
"Full Name" and "Email" entries in the server's extra-fields
|
||||
configuration. These lines are always prefixed with ";;> ".
|
||||
configuration. These lines are prefixed with ";;> " or the prefix
|
||||
specified by :makup-prefix above.
|
||||
|
||||
* :extra-lines -- a list of lines to add after the student lines, all
|
||||
with a ";;> " prefix too. Defaults to a single line: "Maximum
|
||||
points for this assignment: <+100>".
|
||||
with a ";;> " or :markup-prefix too. Defaults to a single line:
|
||||
"Maximum points for this assignment: <+100>".
|
||||
|
||||
* :user-error-message -- a string that is used to report an error that
|
||||
occurred during evaluation of the submitted code (not during
|
||||
|
|
|
@ -247,6 +247,8 @@
|
|||
[create-text?* (get ':create-text? #'#t)]
|
||||
[textualize?* (get ':textualize? #'#f)]
|
||||
[maxwidth* (get ':maxwidth #'79)]
|
||||
[markup-prefix* (get ':markup-prefix #'#f)]
|
||||
[prefix-re* (get ':prefix-re #'#f)]
|
||||
[student-line*
|
||||
(get ':student-line
|
||||
#'"Student: {username} ({Full Name} <{Email}>)")]
|
||||
|
@ -287,6 +289,8 @@
|
|||
[create-text? create-text?*]
|
||||
[textualize? textualize?*]
|
||||
[maxwidth maxwidth*]
|
||||
[markup-prefix markup-prefix*]
|
||||
[prefix-re prefix-re*]
|
||||
[student-line student-line*]
|
||||
[extra-lines extra-lines*]
|
||||
[value-printer value-printer*]
|
||||
|
@ -295,6 +299,20 @@
|
|||
[user-error-message user-error-message*]
|
||||
[execute-counts #f])
|
||||
;; ========================================
|
||||
;; set defaults that depend on file name
|
||||
(define suffix
|
||||
(let ([sfx (string->symbol
|
||||
(string-downcase
|
||||
(regexp-replace #rx"^.*[.]" output-file "")))])
|
||||
(case sfx
|
||||
[(java c cc c++)
|
||||
(unless markup-prefix (set! markup-prefix "//> "))
|
||||
(unless prefix-re (set! prefix-re #rx"//>"))]
|
||||
[else
|
||||
(unless markup-prefix (set! markup-prefix ";;> "))
|
||||
(unless prefix-re (set! prefix-re #rx";>"))])
|
||||
sfx))
|
||||
;; ========================================
|
||||
;; verify submitting users
|
||||
(define (pre users submission)
|
||||
(current-run-status "checking submission username(s)")
|
||||
|
@ -316,17 +334,19 @@
|
|||
;; ========================================
|
||||
;; convert to text, evaluate, check
|
||||
(define (check users submission)
|
||||
(define text-file "grading/text.scm")
|
||||
(define text-file (format "grading/text.~a" suffix))
|
||||
(define (prefix-line str)
|
||||
(printf "~a~a\n" markup-prefix str))
|
||||
(define (write-text)
|
||||
(with-output-to-file text-file
|
||||
(lambda ()
|
||||
(define added (or (thread-cell-ref added-lines) '()))
|
||||
(for-each
|
||||
(lambda (user)
|
||||
(printf ";;> ~a\n" (user-substs user student-line)))
|
||||
(prefix-line (user-substs user student-line)))
|
||||
users)
|
||||
(for-each (lambda (l) (printf ";;> ~a\n" l)) extra-lines)
|
||||
(for-each (lambda (l) (printf ";;> ~a\n" l)) added)
|
||||
(for-each prefix-line extra-lines)
|
||||
(for-each prefix-line added)
|
||||
(display submission-text))
|
||||
'truncate))
|
||||
(define submission-text
|
||||
|
@ -334,8 +354,10 @@
|
|||
(submission->string submission maxwidth textualize?)))
|
||||
(when create-text?
|
||||
(make-directory "grading")
|
||||
(when (regexp-match #rx";>" submission-text)
|
||||
(error* "You cannot use \";>\" in your code!"))
|
||||
(when (regexp-match prefix-re submission-text)
|
||||
(error* "You cannot use \"~a\" in your code!"
|
||||
(if (regexp? prefix-re)
|
||||
(object-name prefix-re) prefix-re)))
|
||||
(write-text))
|
||||
(when value-printer (current-value-printer value-printer))
|
||||
(when coverage? (coverage-enabled #t))
|
||||
|
|
Loading…
Reference in New Issue
Block a user