1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
;; Copyright 2007-2011, Matthew Welland.
;;
;; This program is made available under the GNU GPL version 2.0 or
;; greater. See the accompanying file COPYING for details.
;;
;; This program is distributed WITHOUT ANY WARRANTY; without even the
;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE.
(declare (unit setup))
(declare (uses session))
(require-extension srfi-69)
(require-extension regex)
;; macros in sugar don't work, have to load in all files or use compiled mode?
;;
;; (include "sugar.scm")
;; use this for getting data from page to page when scope and evals
;; get in the way
;; save data for use in the page generation here. Does NOT persist across page reads.
(define *page-data* (make-hash-table))
(define (s:lset! var val)
(hash-table-set! *page-data* var val))
(define (s:lget var . default)
(hash-table-ref/default *page-data* var (if (null? default)
#f
(car default))))
(define (s:log . msg)
(apply session:log s:session msg))
(define (s:set-err . args)
(sdat-set-curr-err! s:session args))
;; Usage: (s:get-err s:big)
(define (s:get-err wrapperfunc)
(let ((errmsg (sdat-get-curr-err s:session)))
(if errmsg ((if wrapperfunc
|
>
>
>
>
>
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
;; Copyright 2007-2011, Matthew Welland.
;;
;; This program is made available under the GNU GPL version 2.0 or
;; greater. See the accompanying file COPYING for details.
;;
;; This program is distributed WITHOUT ANY WARRANTY; without even the
;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE.
(module setup
*
(import chicken scheme data-structures extras srfi-13 ports posix)
(uses session misc-stml)
;; (declare (unit setup))
;; (declare (uses session))
(require-extension srfi-69)
(require-extension regex)
;; macros in sugar don't work, have to load in all files or use compiled mode?
;;
;; (include "sugar.scm")
;; use this for getting data from page to page when scope and evals
;; get in the way
;; save data for use in the page generation here. Does NOT persist across page reads.
(define *page-data* (make-hash-table))
(define (s:lset! var val)
(hash-table-set! *page-data* var val))
(define (s:lget var . default)
(hash-table-ref/default *page-data* var (if (null? default)
#f
(car default))))
(define (s:set-err . args)
(sdat-set-curr-err! s:session args))
;; Usage: (s:get-err s:big)
(define (s:get-err wrapperfunc)
(let ((errmsg (sdat-get-curr-err s:session)))
(if errmsg ((if wrapperfunc
|
210
211
212
213
214
215
216
|
(define (s:never-called-page? page)
(session:never-called-page? s:session page))
;; find out if we are in debugmode
(define (s:debug-mode?)
(sdat-get-debugmode s:session))
|
>
|
212
213
214
215
216
217
218
219
|
(define (s:never-called-page? page)
(session:never-called-page? s:session page))
;; find out if we are in debugmode
(define (s:debug-mode?)
(sdat-get-debugmode s:session))
)
|