svn: r12768
This commit is contained in:
Stevie Strickland 2008-12-10 19:02:08 +00:00
commit a30d1aa9a3
6 changed files with 69 additions and 21 deletions

View File

@ -326,6 +326,11 @@
(or (and (pair? a)
(eq? 'lib (car a)))
(symbol? a)))
(define (symbol-to-lib-form l)
(if (symbol? l)
`(lib ,(symbol->string l))
l))
(define (unix-style-split p)
(let ([m (regexp-match #rx"^([^/]*)/(.*)$" p)])
@ -423,7 +428,7 @@
(not (and (pair? x)
(eq? 'quote (car x))))))
(apply append (map cdr importss)))]
[extra-paths (get-extra-imports filename code)])
[extra-paths (map symbol-to-lib-form (get-extra-imports filename code))])
(let ([sub-files (map (lambda (i) (normalize (resolve-module-path-index i filename)))
all-file-imports)]
[sub-paths (map (lambda (i) (collapse-module-path-index i module-path))

View File

@ -726,8 +726,10 @@
(define-syntax (!test/exn stx)
(syntax-case stx ()
[(_ test-exp)
#`(with-handlers ([exn:fail? (lambda (exn) #t)])
((submission-eval) `test-exp)
#`(unless
(with-handlers ([exn:fail? (lambda (exn) #t)])
((submission-eval) `test-exp)
#f)
(error* "expected exception on test expression: ~v"
(->disp 'test-exp)))]))

View File

@ -439,18 +439,31 @@
(λ (port)
(cond
[(is-wxme-stream? port)
(let-values ([(snip-class-names data-class-names)
(extract-used-classes port)])
(list*
'(lib "wxme/read.ss")
'(lib "mred/mred.ss")
reader-module
(filter
values
(map (λ (x) (string->lib-path x #t))
(append
snip-class-names
data-class-names)))))]
(append
;; Extract snip-related modules:
(let-values ([(snip-class-names data-class-names)
(extract-used-classes port)])
(list*
'(lib "wxme/read.ss")
'(lib "mred/mred.ss")
reader-module
(filter
values
(map (λ (x) (string->lib-path x #t))
(append
snip-class-names
data-class-names)))))
;; Extract reader-related modules:
(begin
(file-position port 0)
(let ([mods null])
(parameterize ([current-reader-guard
(let ([g (current-reader-guard)])
(lambda (p)
(set! mods (cons p mods))
(g p)))])
(read-language (wxme-port->port port) (lambda () #f)))
mods)))]
[else
'()]))))
#:mred? #t))))))

View File

@ -1 +1 @@
#lang scheme/base (provide stamp) (define stamp "9dec2008")
#lang scheme/base (provide stamp) (define stamp "10dec2008")

View File

@ -61,7 +61,7 @@
(lambda (flags)
(configuration-table->web-config@
(extract-flag 'config flags default-configuration-table-path)
#:port (or (port) 80)
#:port (port)
#:listen-ip (extract-flag 'ip-address flags #f)))
'()))

View File

@ -52,10 +52,18 @@ functions of interest for the servlet developer.
@defproc[(send/suspend/dispatch [make-response (embed/url/c . -> . response?)])
any/c]{
Calls @scheme[make-response] with a function that, when called with a procedure from
Calls @scheme[make-response] with a function (@scheme[embed/url]) that, when called with a procedure from
@scheme[request?] to @scheme[any/c] will generate a URL, that when invoked will call
the function with the @scheme[request?] object and return the result to the caller of
@scheme[send/suspend/dispatch].
@scheme[send/suspend/dispatch]. Therefore, if you pass @scheme[embed/url] the identity function,
@scheme[send/suspend/dispatch] devolves into @scheme[send/suspend]:
@schemeblock[
(define (send/suspend response-generator)
(send/suspend/dispatch
(lambda (embed/url)
(response-generator (embed/url (lambda (x) x))))))
]
Use @scheme[send/suspend/dispatch] when there are multiple `logical' continuations of a page.
For example, we could either add to a number or subtract from it:
@ -79,8 +87,28 @@ functions of interest for the servlet developer.
(add1 i)))])
"+"))))))))
]
It is very common that the return value of @scheme[send/suspend/dispatch] is irrevelant in
your application and you may think of it as ``embedding'' value-less callbacks.
Notice that in this example the result of the handlers are returned to the continuation of @scheme[send/suspend/dispatch].
However, it is very common that the return value of @scheme[send/suspend/dispatch] is irrevelant in
your application and you may think of it as ``embedding'' value-less callbacks. Here is the same example in this style:
@schemeblock[
(define (count-dot-com i)
(send/suspend/dispatch
(lambda (embed/url)
`(html
(head (title "Count!"))
(body
(h2 (a ([href
,(embed/url
(lambda (req)
(count-dot-com (sub1 i))))])
"-"))
(h1 ,(number->string i))
(h2 (a ([href
,(embed/url
(lambda (req)
(count-dot-com (add1 i))))])
"+")))))))
]
}
@defproc[(send/forward [make-response response-generator/c]