xexpr/c usage
svn: r13316
This commit is contained in:
parent
f27d2df5a2
commit
9f48c1a4d2
|
@ -68,7 +68,7 @@
|
|||
|
||||
; Contracts
|
||||
(define xexpr-forest/c
|
||||
(listof xexpr?))
|
||||
(listof xexpr/c))
|
||||
|
||||
(define (formlet/c c)
|
||||
(integer? . -> .
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(provide/contract
|
||||
[send/formlet (((formlet/c any/c))
|
||||
(#:wrap (xexpr? . -> . response?))
|
||||
(#:wrap (xexpr/c . -> . response?))
|
||||
. ->* . any/c)])
|
||||
|
||||
(define (send/formlet f
|
||||
|
@ -23,7 +23,7 @@
|
|||
,@(formlet-display f)))))))
|
||||
|
||||
(provide/contract
|
||||
[embed-formlet (embed/url/c (formlet/c any/c) . -> . xexpr?)])
|
||||
[embed-formlet (embed/url/c (formlet/c any/c) . -> . xexpr/c)])
|
||||
|
||||
(define (embed-formlet embed/url f)
|
||||
`(form ([action ,(embed/url
|
||||
|
|
|
@ -128,7 +128,7 @@ These combinators may be used directly to construct low-level formlets, such as
|
|||
types. Refer to @secref["input-formlets"] for example low-level formlets using these combinators.
|
||||
|
||||
@defthing[xexpr-forest/c contract?]{
|
||||
Equivalent to @scheme[(listof xexpr?)]
|
||||
Equivalent to @scheme[(listof xexpr/c)]
|
||||
}
|
||||
|
||||
@defproc[(formlet/c [content any/c]) contract?]{
|
||||
|
@ -165,7 +165,7 @@ types. Refer to @secref["input-formlets"] for example low-level formlets using t
|
|||
Constructs a @tech{formlet} with the rendering @scheme[r] and the identity procedure as the processing step.
|
||||
}
|
||||
|
||||
@defproc[(xml [r xexpr?])
|
||||
@defproc[(xml [r xexpr/c])
|
||||
(formlet/c procedure?)]{
|
||||
Equivalent to @scheme[(xml-forest (list r))].
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ A few utilities are provided for using @tech{formlet}s in Web applications.
|
|||
|
||||
@defproc[(send/formlet [f (formlet/c any/c)]
|
||||
[#:wrap wrapper
|
||||
(xexpr? . -> . response?)
|
||||
(xexpr/c . -> . response?)
|
||||
(lambda (form-xexpr)
|
||||
`(html (head (title "Form Entry"))
|
||||
(body ,form-xexpr)))])
|
||||
|
@ -241,7 +241,7 @@ A few utilities are provided for using @tech{formlet}s in Web applications.
|
|||
|
||||
@defproc[(embed-formlet [embed/url embed/url/c]
|
||||
[f (formlet/c any/c)])
|
||||
xexpr?]{
|
||||
xexpr/c]{
|
||||
Like @scheme[send/formlet], but for use with @scheme[send/suspend/dispatch].
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
the request is returned to this continuation.
|
||||
}
|
||||
|
||||
@defproc[(send/suspend/hidden [response-generator (url? xexpr? . -> . response?)])
|
||||
@defproc[(send/suspend/hidden [response-generator (url? xexpr/c . -> . response?)])
|
||||
request?]{
|
||||
Captures the current continuation. Serializes it and generates an INPUT
|
||||
form that includes the serialization as a hidden form.
|
||||
|
|
|
@ -192,4 +192,4 @@
|
|||
;; END OF TEST
|
||||
|
||||
(provide read-plist)
|
||||
(provide/contract [write-plist (xexpr? output-port? . -> . void?)]))
|
||||
(provide/contract [write-plist (xexpr/c output-port? . -> . void?)]))
|
||||
|
|
|
@ -245,16 +245,16 @@ like @scheme[display-xml].}
|
|||
and leave them in place in the resulting ``@tech{X-expression}''.
|
||||
}
|
||||
|
||||
@defproc[(xml->xexpr [content content?]) xexpr?]{
|
||||
@defproc[(xml->xexpr [content content?]) xexpr/c]{
|
||||
|
||||
Converts document content into an @tech{X-expression}, using
|
||||
@scheme[permissive?] to determine if foreign objects are allowed.}
|
||||
|
||||
@defproc[(xexpr->xml [xexpr xexpr?]) content?]{
|
||||
@defproc[(xexpr->xml [xexpr xexpr/c]) content?]{
|
||||
|
||||
Converts an @tech{X-expression} into XML content.}
|
||||
|
||||
@defproc[(xexpr->string [xexpr xexpr?]) string?]{
|
||||
@defproc[(xexpr->string [xexpr xexpr/c]) string?]{
|
||||
|
||||
Converts an @tech{X-expression} into a string containing XML.}
|
||||
|
||||
|
@ -376,12 +376,12 @@ could be create by an expression matching the following
|
|||
(list 'array pl-value ...)]
|
||||
]
|
||||
|
||||
@defproc[(read-plist [in input-port?]) xexpr?]{
|
||||
@defproc[(read-plist [in input-port?]) xexpr/c]{
|
||||
|
||||
Reads a plist from a port, and produces a @tech{dictionary
|
||||
X-expression}.}
|
||||
|
||||
@defproc[(write-plist [dict xexpr?] [out output-port?]) void?]{
|
||||
@defproc[(write-plist [dict xexpr/c] [out output-port?]) void?]{
|
||||
|
||||
Write a plist to the given port. If @scheme[dict] is not a
|
||||
@tech{dictionary X-expression}, the @scheme[exn:fail:contract]
|
||||
|
|
Loading…
Reference in New Issue
Block a user