Better contracts

svn: r12318
This commit is contained in:
Jay McCarthy 2008-11-05 22:39:39 +00:00
parent 05f36015d5
commit f046f218b8
4 changed files with 13 additions and 8 deletions

View File

@ -4,12 +4,15 @@
mzlib/pretty)
(require "configuration-table-structs.ss"
"../servlet/bindings.ss")
(define configuration-table-sexpr? list?)
(provide/contract
[configuration-table-sexpr? (any/c . -> . boolean?)]
[read-configuration-table (path-string? . -> . configuration-table?)]
[write-configuration-table (configuration-table? path-string? . -> . void)]
[configuration-table->sexpr (configuration-table? . -> . list?)]
[sexpr->configuration-table (list? . -> . configuration-table?)]
[default-configuration-table-path path?])
[configuration-table->sexpr (configuration-table? . -> . configuration-table-sexpr?)]
[sexpr->configuration-table (configuration-table-sexpr? . -> . configuration-table?)]
[default-configuration-table-path path?])
(define default-configuration-table-path
(build-path (collection-path "web-server") "default-web-root" "configuration-table.ss"))

View File

@ -91,13 +91,17 @@ structures.
@defthing[default-configuration-table-path path?]{The default configuration table S-expression file.}
@defproc[(sexpr->configuration-table (sexpr list?))
@defthing[configuration-table-sexpr? (any . -> . boolean?)]{
Equivalent to @scheme[list?].
}
@defproc[(sexpr->configuration-table (sexpr configuration-table-sexpr?))
configuration-table?]{
This function converts a @scheme[configuration-table] from an S-expression.
}
@defproc[(configuration-table->sexpr (ctable configuration-table?))
list?]{
configuration-table-sexpr?]{
This function converts a @scheme[configuration-table] to an S-expression.
}

View File

@ -80,7 +80,6 @@
[server-root-path (directory-part default-configuration-table-path)]
#:extra-files-paths
[extra-files-paths (list (build-path server-root-path "htdocs"))]
; XXX Add support for other servlets
#:servlets-root
[servlets-root (build-path server-root-path ".")]
#:file-not-found-path

View File

@ -8,7 +8,6 @@
"configuration/namespace.ss"
"configuration/responders.ss"
"web-config-sig.ss")
; XXX unit? should be particular unit sig
(provide/contract
[configuration-table->web-config@
(->* (path-string?)
@ -17,7 +16,7 @@
#:make-servlet-namespace make-servlet-namespace/c)
unit?)]
[configuration-table-sexpr->web-config@
(->* (list?) ; XXX
(->* (configuration-table-sexpr?)
(#:web-server-root path-string?
#:port (or/c false/c number?)
#:listen-ip (or/c false/c string?)