+ Splitting file surflets.scm into several packages
- Removing surflets.scm
+ The surflets package remains and collects the most usual used packages
It does not export any more the outdaters, the access to IDs
(like session-id), callbacks, form-query-list.
(and maybe some other stuff I've forgot to mention here, see list
below).
The new packages are (not included in surflets are marked (*)):
+ surflets/addresses: MAKE-ADDRESS, MAKE-ANNOTATED-ADDRESS
+ surflets/bindings: GET-BINDINGS, EXTRACT-BINDINGS and stuff
+ surflets/ids (*): MY-SESSION-ID, .., INSTANCE-SESSION-ID
+ surflets/input-fields: MAKE-INPUT-FIELD, MAKE-NUMBER-INPUT-FIELD...
+ surflets/outdaters(*): MAKE-OUTDATER, OUTDATER?...
+ surflets/returned-via: RETURNED-VIA, CASE-RETURNED-VIA
+ surflets/send-html: SEND-HTML/SUSPEND...
+ surflets/surflet-sxml: URL-RULE,..., SURLFET-SXML-RULES, ...
+ surflets/sxml: SXML->STRING, DEFAULT-RULE,...
+ surflets/typed-optionals(*): TYPED-OPTIONALS, OPTIONALS
+ surflets/utilities(*): MAKE-CALLBACK, FORM-QUERY-LIST,
GENERATE-UNIQUE-NAME...
2003-03-10 11:29:32 -05:00
|
|
|
(define url-rule
|
2003-04-14 04:40:45 -04:00
|
|
|
`(url *preorder*
|
|
|
|
. ,(lambda (tag uri . maybe-text)
|
|
|
|
(surflet-sxml->low-level-sxml
|
|
|
|
`(a (@ (href ,uri))
|
|
|
|
,(if (null? maybe-text)
|
|
|
|
uri
|
|
|
|
maybe-text))))))
|
+ Splitting file surflets.scm into several packages
- Removing surflets.scm
+ The surflets package remains and collects the most usual used packages
It does not export any more the outdaters, the access to IDs
(like session-id), callbacks, form-query-list.
(and maybe some other stuff I've forgot to mention here, see list
below).
The new packages are (not included in surflets are marked (*)):
+ surflets/addresses: MAKE-ADDRESS, MAKE-ANNOTATED-ADDRESS
+ surflets/bindings: GET-BINDINGS, EXTRACT-BINDINGS and stuff
+ surflets/ids (*): MY-SESSION-ID, .., INSTANCE-SESSION-ID
+ surflets/input-fields: MAKE-INPUT-FIELD, MAKE-NUMBER-INPUT-FIELD...
+ surflets/outdaters(*): MAKE-OUTDATER, OUTDATER?...
+ surflets/returned-via: RETURNED-VIA, CASE-RETURNED-VIA
+ surflets/send-html: SEND-HTML/SUSPEND...
+ surflets/surflet-sxml: URL-RULE,..., SURLFET-SXML-RULES, ...
+ surflets/sxml: SXML->STRING, DEFAULT-RULE,...
+ surflets/typed-optionals(*): TYPED-OPTIONALS, OPTIONALS
+ surflets/utilities(*): MAKE-CALLBACK, FORM-QUERY-LIST,
GENERATE-UNIQUE-NAME...
2003-03-10 11:29:32 -05:00
|
|
|
|
|
|
|
(define plain-html-rule
|
|
|
|
`(plain-html
|
|
|
|
*preorder*
|
|
|
|
. ,(lambda (tag . text) text)))
|
|
|
|
|
2003-04-16 08:19:44 -04:00
|
|
|
(define nbsp-rule
|
|
|
|
`(nbsp . ,(lambda (_) " ")))
|
|
|
|
|
2003-03-14 07:58:12 -05:00
|
|
|
(define comment-rule
|
|
|
|
`(*COMMENT* *preorder*
|
|
|
|
. ,(lambda (tag . elems)
|
2003-07-08 17:23:27 -04:00
|
|
|
`("<!-- " ,@elems "-->"))))
|
2003-03-14 07:58:12 -05:00
|
|
|
|
+ Splitting file surflets.scm into several packages
- Removing surflets.scm
+ The surflets package remains and collects the most usual used packages
It does not export any more the outdaters, the access to IDs
(like session-id), callbacks, form-query-list.
(and maybe some other stuff I've forgot to mention here, see list
below).
The new packages are (not included in surflets are marked (*)):
+ surflets/addresses: MAKE-ADDRESS, MAKE-ANNOTATED-ADDRESS
+ surflets/bindings: GET-BINDINGS, EXTRACT-BINDINGS and stuff
+ surflets/ids (*): MY-SESSION-ID, .., INSTANCE-SESSION-ID
+ surflets/input-fields: MAKE-INPUT-FIELD, MAKE-NUMBER-INPUT-FIELD...
+ surflets/outdaters(*): MAKE-OUTDATER, OUTDATER?...
+ surflets/returned-via: RETURNED-VIA, CASE-RETURNED-VIA
+ surflets/send-html: SEND-HTML/SUSPEND...
+ surflets/surflet-sxml: URL-RULE,..., SURLFET-SXML-RULES, ...
+ surflets/sxml: SXML->STRING, DEFAULT-RULE,...
+ surflets/typed-optionals(*): TYPED-OPTIONALS, OPTIONALS
+ surflets/utilities(*): MAKE-CALLBACK, FORM-QUERY-LIST,
GENERATE-UNIQUE-NAME...
2003-03-10 11:29:32 -05:00
|
|
|
(define default-rules
|
|
|
|
`(,attribute-rule
|
|
|
|
,default-rule
|
|
|
|
,text-rule
|
2003-03-14 07:58:12 -05:00
|
|
|
,comment-rule
|
+ Splitting file surflets.scm into several packages
- Removing surflets.scm
+ The surflets package remains and collects the most usual used packages
It does not export any more the outdaters, the access to IDs
(like session-id), callbacks, form-query-list.
(and maybe some other stuff I've forgot to mention here, see list
below).
The new packages are (not included in surflets are marked (*)):
+ surflets/addresses: MAKE-ADDRESS, MAKE-ANNOTATED-ADDRESS
+ surflets/bindings: GET-BINDINGS, EXTRACT-BINDINGS and stuff
+ surflets/ids (*): MY-SESSION-ID, .., INSTANCE-SESSION-ID
+ surflets/input-fields: MAKE-INPUT-FIELD, MAKE-NUMBER-INPUT-FIELD...
+ surflets/outdaters(*): MAKE-OUTDATER, OUTDATER?...
+ surflets/returned-via: RETURNED-VIA, CASE-RETURNED-VIA
+ surflets/send-html: SEND-HTML/SUSPEND...
+ surflets/surflet-sxml: URL-RULE,..., SURLFET-SXML-RULES, ...
+ surflets/sxml: SXML->STRING, DEFAULT-RULE,...
+ surflets/typed-optionals(*): TYPED-OPTIONALS, OPTIONALS
+ surflets/utilities(*): MAKE-CALLBACK, FORM-QUERY-LIST,
GENERATE-UNIQUE-NAME...
2003-03-10 11:29:32 -05:00
|
|
|
,url-rule
|
2003-04-16 08:19:44 -04:00
|
|
|
,plain-html-rule
|
|
|
|
,nbsp-rule))
|
+ Splitting file surflets.scm into several packages
- Removing surflets.scm
+ The surflets package remains and collects the most usual used packages
It does not export any more the outdaters, the access to IDs
(like session-id), callbacks, form-query-list.
(and maybe some other stuff I've forgot to mention here, see list
below).
The new packages are (not included in surflets are marked (*)):
+ surflets/addresses: MAKE-ADDRESS, MAKE-ANNOTATED-ADDRESS
+ surflets/bindings: GET-BINDINGS, EXTRACT-BINDINGS and stuff
+ surflets/ids (*): MY-SESSION-ID, .., INSTANCE-SESSION-ID
+ surflets/input-fields: MAKE-INPUT-FIELD, MAKE-NUMBER-INPUT-FIELD...
+ surflets/outdaters(*): MAKE-OUTDATER, OUTDATER?...
+ surflets/returned-via: RETURNED-VIA, CASE-RETURNED-VIA
+ surflets/send-html: SEND-HTML/SUSPEND...
+ surflets/surflet-sxml: URL-RULE,..., SURLFET-SXML-RULES, ...
+ surflets/sxml: SXML->STRING, DEFAULT-RULE,...
+ surflets/typed-optionals(*): TYPED-OPTIONALS, OPTIONALS
+ surflets/utilities(*): MAKE-CALLBACK, FORM-QUERY-LIST,
GENERATE-UNIQUE-NAME...
2003-03-10 11:29:32 -05:00
|
|
|
|
|
|
|
(define surflet-form-rule
|
|
|
|
`(surflet-form
|
|
|
|
;; Must do something to prevent the k-url string to be HTML
|
|
|
|
;; escaped.
|
|
|
|
*preorder*
|
|
|
|
. ,(lambda (trigger k-url . args)
|
|
|
|
(receive (parameters elems)
|
2003-07-09 13:18:57 -04:00
|
|
|
(optionals-first (list symbol? sxml-attribute?) args)
|
+ Splitting file surflets.scm into several packages
- Removing surflets.scm
+ The surflets package remains and collects the most usual used packages
It does not export any more the outdaters, the access to IDs
(like session-id), callbacks, form-query-list.
(and maybe some other stuff I've forgot to mention here, see list
below).
The new packages are (not included in surflets are marked (*)):
+ surflets/addresses: MAKE-ADDRESS, MAKE-ANNOTATED-ADDRESS
+ surflets/bindings: GET-BINDINGS, EXTRACT-BINDINGS and stuff
+ surflets/ids (*): MY-SESSION-ID, .., INSTANCE-SESSION-ID
+ surflets/input-fields: MAKE-INPUT-FIELD, MAKE-NUMBER-INPUT-FIELD...
+ surflets/outdaters(*): MAKE-OUTDATER, OUTDATER?...
+ surflets/returned-via: RETURNED-VIA, CASE-RETURNED-VIA
+ surflets/send-html: SEND-HTML/SUSPEND...
+ surflets/surflet-sxml: URL-RULE,..., SURLFET-SXML-RULES, ...
+ surflets/sxml: SXML->STRING, DEFAULT-RULE,...
+ surflets/typed-optionals(*): TYPED-OPTIONALS, OPTIONALS
+ surflets/utilities(*): MAKE-CALLBACK, FORM-QUERY-LIST,
GENERATE-UNIQUE-NAME...
2003-03-10 11:29:32 -05:00
|
|
|
(make-surflet-form k-url ; k-url
|
|
|
|
(car parameters) ; POST, GET or #f=GET
|
|
|
|
(cadr parameters); attributes
|
|
|
|
elems)))))
|
|
|
|
|
|
|
|
(define (make-surflet-form k-url method attributes elems)
|
|
|
|
(let ((real-method (case method
|
|
|
|
((get GET) "GET")
|
|
|
|
((post POST) "POST")
|
|
|
|
((#f) "GET")
|
|
|
|
(else
|
|
|
|
(error "invalid method type" method)))))
|
|
|
|
(surflet-sxml->low-level-sxml
|
|
|
|
`(form (@ ((method ,real-method)
|
|
|
|
(action ,k-url)
|
|
|
|
,@(if attributes (cdr attributes) '())))
|
|
|
|
,@elems))))
|
|
|
|
|
|
|
|
(define input-field-rule
|
|
|
|
`(,*input-field-trigger*
|
|
|
|
*preorder*
|
|
|
|
. ,(lambda (trigger input-field)
|
|
|
|
(surflet-sxml->low-level-sxml
|
2003-04-16 08:19:44 -04:00
|
|
|
;; We need a real input-field for input-field-html-tree.
|
|
|
|
(input-field-html-tree (list trigger input-field))))))
|
+ Splitting file surflets.scm into several packages
- Removing surflets.scm
+ The surflets package remains and collects the most usual used packages
It does not export any more the outdaters, the access to IDs
(like session-id), callbacks, form-query-list.
(and maybe some other stuff I've forgot to mention here, see list
below).
The new packages are (not included in surflets are marked (*)):
+ surflets/addresses: MAKE-ADDRESS, MAKE-ANNOTATED-ADDRESS
+ surflets/bindings: GET-BINDINGS, EXTRACT-BINDINGS and stuff
+ surflets/ids (*): MY-SESSION-ID, .., INSTANCE-SESSION-ID
+ surflets/input-fields: MAKE-INPUT-FIELD, MAKE-NUMBER-INPUT-FIELD...
+ surflets/outdaters(*): MAKE-OUTDATER, OUTDATER?...
+ surflets/returned-via: RETURNED-VIA, CASE-RETURNED-VIA
+ surflets/send-html: SEND-HTML/SUSPEND...
+ surflets/surflet-sxml: URL-RULE,..., SURLFET-SXML-RULES, ...
+ surflets/sxml: SXML->STRING, DEFAULT-RULE,...
+ surflets/typed-optionals(*): TYPED-OPTIONALS, OPTIONALS
+ surflets/utilities(*): MAKE-CALLBACK, FORM-QUERY-LIST,
GENERATE-UNIQUE-NAME...
2003-03-10 11:29:32 -05:00
|
|
|
|
|
|
|
(define surflet-sxml-rules
|
|
|
|
`(,@default-rules
|
|
|
|
;; form contents:
|
|
|
|
,input-field-rule
|
|
|
|
,surflet-form-rule))
|
|
|
|
|
|
|
|
;; Low-Level-SXML is a list that can be understood by
|
2003-03-13 06:32:38 -05:00
|
|
|
;; display-low-level-sxml. In contains only characters, strings, and
|
+ Splitting file surflets.scm into several packages
- Removing surflets.scm
+ The surflets package remains and collects the most usual used packages
It does not export any more the outdaters, the access to IDs
(like session-id), callbacks, form-query-list.
(and maybe some other stuff I've forgot to mention here, see list
below).
The new packages are (not included in surflets are marked (*)):
+ surflets/addresses: MAKE-ADDRESS, MAKE-ANNOTATED-ADDRESS
+ surflets/bindings: GET-BINDINGS, EXTRACT-BINDINGS and stuff
+ surflets/ids (*): MY-SESSION-ID, .., INSTANCE-SESSION-ID
+ surflets/input-fields: MAKE-INPUT-FIELD, MAKE-NUMBER-INPUT-FIELD...
+ surflets/outdaters(*): MAKE-OUTDATER, OUTDATER?...
+ surflets/returned-via: RETURNED-VIA, CASE-RETURNED-VIA
+ surflets/send-html: SEND-HTML/SUSPEND...
+ surflets/surflet-sxml: URL-RULE,..., SURLFET-SXML-RULES, ...
+ surflets/sxml: SXML->STRING, DEFAULT-RULE,...
+ surflets/typed-optionals(*): TYPED-OPTIONALS, OPTIONALS
+ surflets/utilities(*): MAKE-CALLBACK, FORM-QUERY-LIST,
GENERATE-UNIQUE-NAME...
2003-03-10 11:29:32 -05:00
|
|
|
;; thunks.
|
|
|
|
(define (surflet-sxml->low-level-sxml sxml-tree)
|
|
|
|
(pre-post-order sxml-tree surflet-sxml-rules))
|
|
|
|
|
2003-07-09 13:18:57 -04:00
|
|
|
|
|
|
|
|
|
|
|
;;; Helping funtion for surflet-sxml-rule
|
|
|
|
|
|
|
|
;; PRED-LIST contains list of predicates that recognizes optional
|
|
|
|
;; leading parameters. FURTHER-ATTRIBUTES is the optional parameter
|
|
|
|
;; list as got by procedure call. TYPED-OPTIONALS returns two values:
|
|
|
|
;; a list of the same length as PRED-LIST and a list containing the
|
|
|
|
;; left arguments that did not fit the predicates.
|
|
|
|
;;
|
|
|
|
;; With the help of OPTIONALS-FIRST you can define a function
|
|
|
|
;; like `make-submit-button [string] [further-attributes]' this way:
|
|
|
|
;; (define (make-submit-button . args)
|
|
|
|
;; (receive (params rest-args)
|
|
|
|
;; (prefix-optionals (list string? xml-attribute?) args)
|
|
|
|
;; (if (pair? rest-args)
|
|
|
|
;; (error "too many arguments to make-submit-button))
|
|
|
|
;; (let ((value (first params))
|
|
|
|
;; (attributes (second params)))
|
|
|
|
;; ...))))
|
|
|
|
;;
|
|
|
|
(define (optionals-first pred-list args)
|
|
|
|
(let loop ((results '())
|
|
|
|
(pred-list pred-list)
|
|
|
|
(args args))
|
|
|
|
(cond
|
|
|
|
((null? pred-list)
|
|
|
|
(values (reverse results) args))
|
|
|
|
((null? args)
|
|
|
|
(values (rev-append results (make-list (length pred-list) #f)) '()))
|
|
|
|
(((car pred-list) (car args))
|
|
|
|
(loop (cons (car args) results)
|
|
|
|
(cdr pred-list)
|
|
|
|
(cdr args)))
|
|
|
|
(else
|
|
|
|
(loop (cons #f results)
|
|
|
|
(cdr pred-list)
|
|
|
|
args)))))
|