Converting utils.ss and checker.ss to scheme/base.
svn: r11633
This commit is contained in:
parent
a115dc3d8b
commit
12bcac14d3
|
@ -1,16 +1,17 @@
|
||||||
#lang mzscheme
|
#lang scheme/base
|
||||||
|
|
||||||
(require "utils.ss" mzlib/file mzlib/list mzlib/class mred)
|
(require (for-syntax scheme/base) "utils.ss" scheme/file scheme/list scheme/class mred)
|
||||||
|
|
||||||
(provide (all-from-except mzscheme #%module-begin) (all-from "utils.ss"))
|
(provide (except-out (all-from-out scheme/base) #%module-begin)
|
||||||
|
(all-from-out "utils.ss"))
|
||||||
|
|
||||||
(provide (rename module-begin~ #%module-begin))
|
(provide (rename-out [module-begin~ #%module-begin]))
|
||||||
(define-syntax (module-begin~ stx)
|
(define-syntax (module-begin~ stx)
|
||||||
(let ([e (if (syntax? stx) (syntax-e stx) stx)])
|
(let ([e (if (syntax? stx) (syntax-e stx) stx)])
|
||||||
(if (pair? e)
|
(if (pair? e)
|
||||||
(with-syntax ([user-pre (datum->syntax-object stx 'user-pre stx)]
|
(with-syntax ([user-pre (datum->syntax stx 'user-pre stx)]
|
||||||
[user-post (datum->syntax-object stx 'user-post stx)])
|
[user-post (datum->syntax stx 'user-post stx)])
|
||||||
(datum->syntax-object
|
(datum->syntax
|
||||||
(quote-syntax here)
|
(quote-syntax here)
|
||||||
(list* (quote-syntax #%plain-module-begin)
|
(list* (quote-syntax #%plain-module-begin)
|
||||||
#'(define user-pre #f)
|
#'(define user-pre #f)
|
||||||
|
@ -104,7 +105,7 @@
|
||||||
(format "~a" (or (send x get-text 0 (send x get-count) #t) x))]
|
(format "~a" (or (send x get-text 0 (send x get-count) #t) x))]
|
||||||
[(special-comment? x)
|
[(special-comment? x)
|
||||||
(format "#| ~a |#" (special-comment-value x))]
|
(format "#| ~a |#" (special-comment-value x))]
|
||||||
[(syntax? x) (syntax-object->datum x)]
|
[(syntax? x) (syntax->datum x)]
|
||||||
[else x]))
|
[else x]))
|
||||||
(let-values ([(filter) (if (pair? filter) (car filter) item->text)]
|
(let-values ([(filter) (if (pair? filter) (car filter) item->text)]
|
||||||
[(in out) (make-pipe 4096)])
|
[(in out) (make-pipe 4096)])
|
||||||
|
@ -317,7 +318,7 @@
|
||||||
(define submission-eval (make-parameter #f))
|
(define submission-eval (make-parameter #f))
|
||||||
|
|
||||||
;; without this the primitive eval is not available
|
;; without this the primitive eval is not available
|
||||||
(provide (rename eval prim-eval))
|
(provide (rename-out [eval prim-eval]))
|
||||||
|
|
||||||
;; for adding lines in the checker
|
;; for adding lines in the checker
|
||||||
(define added-lines (make-thread-cell #f))
|
(define added-lines (make-thread-cell #f))
|
||||||
|
@ -344,7 +345,7 @@
|
||||||
|
|
||||||
(provide check:)
|
(provide check:)
|
||||||
(define-syntax (check: stx)
|
(define-syntax (check: stx)
|
||||||
(define (id s) (datum->syntax-object stx s stx))
|
(define (id s) (datum->syntax stx s stx))
|
||||||
(let loop ([stx (syntax-case stx () [(_ x ...) #'(x ...)])]
|
(let loop ([stx (syntax-case stx () [(_ x ...) #'(x ...)])]
|
||||||
[keyvals '()]
|
[keyvals '()]
|
||||||
[got null])
|
[got null])
|
||||||
|
@ -473,7 +474,7 @@
|
||||||
(prefix-line (subst str generic-substs)))
|
(prefix-line (subst str generic-substs)))
|
||||||
(define (write-text)
|
(define (write-text)
|
||||||
(set-run-status "creating text file")
|
(set-run-status "creating text file")
|
||||||
(with-output-to-file text-file
|
(with-output-to-file text-file #:exists 'truncate
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(for-each (lambda (user)
|
(for-each (lambda (user)
|
||||||
(prefix-line
|
(prefix-line
|
||||||
|
@ -482,8 +483,7 @@
|
||||||
(for-each prefix-line/substs extra-lines)
|
(for-each prefix-line/substs extra-lines)
|
||||||
(for-each prefix-line/substs
|
(for-each prefix-line/substs
|
||||||
(or (thread-cell-ref added-lines) '()))
|
(or (thread-cell-ref added-lines) '()))
|
||||||
(display submission-text))
|
(display submission-text))))
|
||||||
'truncate))
|
|
||||||
(define submission-text
|
(define submission-text
|
||||||
(and create-text?
|
(and create-text?
|
||||||
(begin (set-run-status "reading submission")
|
(begin (set-run-status "reading submission")
|
||||||
|
@ -557,7 +557,7 @@
|
||||||
[(_ get (var ...) body ...)
|
[(_ get (var ...) body ...)
|
||||||
(with-syntax ([(>var ...)
|
(with-syntax ([(>var ...)
|
||||||
(map (lambda (v)
|
(map (lambda (v)
|
||||||
(datum->syntax-object
|
(datum->syntax
|
||||||
v
|
v
|
||||||
(string->symbol
|
(string->symbol
|
||||||
(string-append
|
(string-append
|
||||||
|
@ -572,7 +572,7 @@
|
||||||
(let ([make-pre/post:
|
(let ([make-pre/post:
|
||||||
(lambda (what)
|
(lambda (what)
|
||||||
(lambda (stx)
|
(lambda (stx)
|
||||||
(define (id s) (datum->syntax-object stx s stx))
|
(define (id s) (datum->syntax stx s stx))
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_ body ...)
|
[(_ body ...)
|
||||||
(with-syntax ([users (id 'users)]
|
(with-syntax ([users (id 'users)]
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
(module utils mzscheme
|
#lang scheme/base
|
||||||
(require mzlib/list
|
|
||||||
mzlib/class
|
(require scheme/list
|
||||||
|
scheme/class
|
||||||
mred
|
mred
|
||||||
lang/posn
|
lang/posn
|
||||||
(prefix pc: mzlib/pconvert)
|
(prefix-in pc: mzlib/pconvert)
|
||||||
mzlib/pretty
|
scheme/pretty
|
||||||
(only "main.ss" timeout-control)
|
(only-in "main.ss" timeout-control)
|
||||||
"private/run-status.ss"
|
"private/run-status.ss"
|
||||||
"private/config.ss"
|
"private/config.ss"
|
||||||
"private/logger.ss"
|
"private/logger.ss"
|
||||||
"sandbox.ss")
|
"sandbox.ss")
|
||||||
|
|
||||||
(provide (all-from "sandbox.ss")
|
(provide (all-from-out "sandbox.ss")
|
||||||
|
|
||||||
get-conf
|
get-conf
|
||||||
log-line
|
log-line
|
||||||
|
@ -183,5 +184,3 @@
|
||||||
(define (call-with-evaluator/submission lang teachpacks str go)
|
(define (call-with-evaluator/submission lang teachpacks str go)
|
||||||
(let-values ([(defs interacts) (unpack-submission str)])
|
(let-values ([(defs interacts) (unpack-submission str)])
|
||||||
(call-with-evaluator lang teachpacks (open-input-text-editor defs) go)))
|
(call-with-evaluator lang teachpacks (open-input-text-editor defs) go)))
|
||||||
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user