205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
-
+
|
;; call only with (label (label value dispval [#t]) ...)
;; NB// sadly this block is redundantly almost identical to the s:select
;; fix that later ...
(define (s:optgroup dat)
(let ((label (car dat))
(rem (cdr dat)))
(if (null? rem)
(s:common-tag "OPTGROUP" 'label label)
(s:common-tag "OPTGROUP" `('label ,label))
(let loop ((hed (car rem))
(tal (cdr rem))
(res (list (conc "<OPTGROUP label=" label))))
;; (print "hed: " hed " tal: " tal " res: " res)
(let ((new (append res (list (if (list? (cadr hed))
(s:optgroup hed)
(s:option hed))))))
|
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
|
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
|
-
+
+
|
;; return (dat remdat)
(define (formdat:read-dat dat key)
(let ((index (substring-index key dat))) ;; (string-search-positions key dat)))
(if (or (not index)
(null? index)) ;; the key was not found
#f
(let* ((datstr (open-input-string dat))
(result (read-string (caar index) datstr))
;; (result (read-string (caar index) datstr))
(result (read-string index datstr))
(remdat (read-string #f datstr)))
(close-input-port datstr)
(list result remdat)))))
;; inp is port to read data from, maxsize is max data allowed to read (total)
(define (formdat:dat->list inp maxsize #!key (debug-port #f))
;; read 1Meg chunks from the input port. If a block is not complete
|
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
|
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
|
-
+
-
+
|
(define (s:set! key val)
(session:curr-page-set! s:session key val))
(define (s:del! key)
(session:page-var-del! s:session key))
(define (s:get-n-del! key)
#;(define (s:get-n-del! key)
(let ((val (session:page-get s:session key)))
(session:del! s:session key)
(session:del! s:session val key)
val))
;; these are session wide
(define (s:session-var-get key . params)
(session:get s:session "*sessionvars*" key params))
(define (s:session-var-set! key val)
|