Overview
Context
Changes
Modified Makefile
from [16c485aa22]
to [c46021886f].
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
+
-
+
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
-
+
-
|
# Copyright 2007-2008, 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.
include install.cfg
SRCFILES = stml.scm misc-stml.scm session.scm sqltbl.scm formdat.scm setup.scm stmlrun.scm keystore.scm html-filter.scm cookie.scm
MODULEFILES = $(wildcard modules/*/*-mod.scm)
SOFILES = $(MODULEFILES:%.scm=%.so)
CFILES = $(MODULEFILES:%.scm=%.c)
OFILES = $(MODULEFILES:%.scm=%.o)
OFILES = $(SRCFILES:%.scm=%.o)
TARGFILES = $(notdir $(SOFILES))
MODULES = $(addprefix $(TARGDIR)/modules/,$(TARGFILES))
install : $(TARGDIR)/stmlrun $(LOGDIR) $(MODULES)
all : $(SOFILES)
stmlrun : stmlrun.scm formdat.scm misc-stml.scm session.scm stml.scm \
setup.scm html-filter.scm requirements.scm keystore.scm \
cookie.scm sqltbl.scm
csc stmlrun.scm
# stmlrun : stmlrun.scm formdat.scm misc-stml.scm session.scm stml.scm \
# setup.scm html-filter.scm requirements.scm keystore.scm \
# cookie.scm sqltbl.scm
# csc stmlrun.scm
$(TARGDIR)/stmlrun : stmlrun
cp stmlrun $(TARGDIR)
chmod a+rx $(TARGDIR)/stmlrun
$(TARGDIR)/modules :
mkdir -p $(TARGDIR)/modules
$(MODULES) : $(SOFILES) $(TARGDIR)/modules
cp $< $@
stmlrun : $(OFILES) stmlrun.scm requirements.scm
csc $(OFILES) -o stmlrun
# logging currently relies on this
#
$(LOGDIR) :
mkdir -p $(LOGDIR)
chmod a+rwx $(LOGDIR)
test: kiatoa.db cookie.so
echo '(exit)'| csi -q ./tests/test.scm
# modules
#
%.so : %.scm
csc -I modules/* -s $<
%.o : %.scm
csc -c $<
# Cookie is a special case for now. Make a loadable so for test
# Complile it in by include (see dependencies above).
cookie.so : cookie.scm
csc -s cookie.scm
#
# $(CFILES): build/%.c: ../scm/%.scm ../scm/macros.scm
# chicken $< -output-file $@
#
#
# $(OFILES): src/%.o: src/%.c
# gcc -c $< `chicken-config -cflags` -o $@
#
# $(src_code): %: src/%.o src/laedlib.o src/layobj.o
# gcc src/$*.o src/laedlib.o src/layobj.o -o $* `chicken-config -libs`
#
|
Modified cookie.scm
from [287a3edd5d]
to [599d58e819].
︙ | | |
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
-
+
|
;; <ftp://ftp.isi.edu/in-notes/rfc2965.txt>
;; See also
;; RFC 2964 Use of HTTP state management
;; <ftp://ftp.isi.edu/in-notes/rfc2964.txt>
;; The parser also supports the old Netscape spec
;; <http://www.netscape.com/newsref/std/cookie_spec.html>
(declare (unit cookie))
(require-extension srfi-1 srfi-13 srfi-14 regex)
(declare (export parse-cookie-string construct-cookie-string))
#>
#include <time.h>
<#
|
︙ | | |
Modified formdat.scm
from [36ecd60344]
to [3d0d733457].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
-
+
+
-
+
|
;; Copyright 2007-2008, Matthew Welland.
;; 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 formdat))
(include "requirements.scm")
(use regex)
(define formdat:*debug* #f)
;; Old data format was something like this. BUT!
;; Forms do not have names so the hierarcy is
;; unnecessary (I think)
;;
|
︙ | | |
Modified html-filter.scm
from [0b79e98f29]
to [be2e4e1457].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
-
+
+
+
|
;; Copyright 2007-2008, Matthew Welland.
;; 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 html-filter))
;;
(define (s:split-string strng delim)
(if (eq? (string-length strng) 0) (list strng)
(let loop ((head (make-string 1 (car (string->list strng))))
(tail (cdr (string->list strng)))
(dest '())
|
︙ | | |
Modified keystore.scm
from [e9c191141b]
to [1e4a5aef9c].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
-
+
+
+
|
;; Copyright 2007-2008, Matthew Welland.
;; 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.
;;======================================================================
;; The meta data key store, just a general dumping ground for values
;; only used occasionally
;;======================================================================
(declare (unit keystore))
(define (keystore:get db key)
(dbi:get-one db "SELECT value FROM metadata WHERE key=?;" key))
(define (keystore:set! db key value)
(let ((curr-val (keystore:get db key)))
(if curr-val
|
︙ | | |
Modified misc-stml.scm
from [f5de1fb05e]
to [9d5a337236].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
-
+
+
+
+
|
;; Copyright 2007-2008, Matthew Welland.
;; 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.
;;======================================================================
;; dumbobj helpers
;;======================================================================
(declare (unit misc-stml))
(use regex)
;; given a list of symbols give the count of the matching symbol
;; l => '(a b c) (dumobj:indx a 'b) => 1
(define (s:get-fieldnum lst field-name)
(let loop ((head (car lst))
(tail (cdr lst))
(fnum 0))
|
︙ | | |
Modified session.scm
from [8a3d5fca7a]
to [0524c59e8f].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
-
+
+
-
+
+
+
|
;; Copyright 2007-2008, Matthew Welland.
;; 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 session))
(include "requirements.scm")
(require-library dbi)
(use regex)
(declare (uses cookie))
;; sessions table
;; id session_id session_key
;; create table sessions (id serial not null,session-key text);
;; session_vars table
;; id session_id page_id key value
|
︙ | | |
Modified setup.scm
from [b19d687f24]
to [b36f45d459].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
-
+
+
+
+
|
;; Copyright 2007-2008, Matthew Welland.
;; 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))
;;
(define s:session (make-sdat))
(session:initialize s:session)
;; use this for getting data from page to page when scope and evals
;; get in the way
(define s:local-vars (make-hash-table))
|
︙ | | |
Modified sqlite3.scm
from [67e8c1f054]
to [935dbe7787].
1
2
3
4
5
6
7
8
|
1
2
3
4
5
6
7
8
|
-
+
|
;; Copyright 2007-2008, Matthew Welland.
;; 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.
|
︙ | | |
Modified sqltbl.scm
from [2a2c7dc4e0]
to [39c7ffe769].
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
|
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
|
-
+
+
+
|
;; Copyright 2007-2008, Matthew Welland. Kiatoa.com All rights reserved.
;; Copyright 2007-2011, Matthew Welland. Kiatoa.com All rights reserved.
;;
;; DON'T USE THIS!!!! It was a bad idea :-(
;; (require-extension tinyclos)
;; (define-class <sqltbl> ()
;; (rows
;; fields ;; list of field
;; fields-hash ;; hash of fields -> number
;; query ;; query string using ?'s
;; query-params ;; list of params for the query
;; conn ;; connection to db
;; num-rows ;; whatever
;; curr-row-ptr ;; number of the current row
;; curr-row ;; the current row vector (?? do we really want this ??)
;; ))
(declare (unit sqltbl))
(define (make-sqltbl:tbl)(make-vector 9))
(define-inline (sqltbl:tbl-get-rows vec) (vector-ref vec 0))
(define-inline (sqltbl:tbl-get-fields vec) (vector-ref vec 1))
(define-inline (sqltbl:tbl-get-fields-hash vec) (vector-ref vec 2))
(define-inline (sqltbl:tbl-get-query vec) (vector-ref vec 3))
(define-inline (sqltbl:tbl-get-query-params vec) (vector-ref vec 4))
|
︙ | | |
Modified stml.scm
from [73ed44f16b]
to [d231bbdbe7].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
-
+
-
+
|
;; Copyright 2007-2008, Matthew Welland.
;; 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.
;; stml is a list of html strings
(declare (unit stml))
(include "misc-stml")
(declare (uses misc-stml))
;; extract various tokens from the parameter list
;; 'key val => put in the params list
;; strings => maintain order and add to the datalist <<== IMPORTANT
(define (s:extract inlst)
(if (null? inlst) inlst
(let loop ((data '())
|
︙ | | |
Modified stmlrun.scm
from [b64d7c8a58]
to [c4bf2d3a15].
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
|
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
|
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
-
|
#!/usr/local/bin/csi -q
;; Copyright 2007-2008, Matthew Welland.
;; 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.
;; (require-extension syntax-case)
;; (declare (run-time-macros))
(require-library dbi)
(include "requirements.scm")
(include "cookie.scm")
(include "html-filter.scm")
(include "misc-stml.scm")
(include "formdat.scm")
(include "stml.scm")
(declare (uses html-filter))
(declare (uses misc-stml))
(declare (uses formdat))
(declare (uses stml))
;; (include "dbi.scm")
(include "session.scm")
(include "setup.scm") ;; s:session gets created here
(include "sqltbl.scm")
(include "keystore.scm")
(declare (uses session))
(declare (uses setup)) ;; s:session gets created here
(declare (uses sqltbl))
(declare (uses keystore))
;; (include "sugar.scm")
(sdat-set-log-port! s:session ;; (current-error-port))
(open-output-file (sdat-get-logfile s:session) #:append))
;; (s:log "HTTP_COOKIE" (get-environment-variable "HTTP_COOKIE"))
;; (s:log "stdin-dat=" (slot-ref s:session 'stdin-dat))
|
︙ | | |
Modified sugar.scm
from [915b31470a]
to [08f3dbeadf].
1
2
3
4
5
6
7
8
|
1
2
3
4
5
6
7
8
|
-
+
|
;; Copyright 2007-2008, Matthew Welland.
;; 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.
|
︙ | | |