Changes In Branch selfcontained Through [632ed21f6c] Excluding Merge-Ins
This is equivalent to a diff from 18e7e965e2 to 632ed21f6c
2015-04-14
| ||
04:45 | Merged selfcontained back to trunk check-in: d3fdfad50d user: matt tags: trunk | |
2013-05-18
| ||
21:13 | Added utility to rollup pages check-in: 136be142e4 user: matt tags: selfcontained | |
19:00 | Updated stmlrun to require-library stml check-in: 632ed21f6c user: matt tags: selfcontained | |
06:33 | changed stmlmodule.so to stml.so check-in: 0952b2f8ef user: matt tags: selfcontained | |
2013-05-17
| ||
07:08 | refactor for selfcontained executables (incomplete) check-in: 55a8152be6 user: matt tags: selfcontained | |
2013-02-03
| ||
05:25 | Added additional verbage for debug and setup easing check-in: 18e7e965e2 user: matt tags: trunk | |
2013-01-09
| ||
06:20 | Fixed output of error in error page check-in: 60f784c4db user: matt tags: trunk | |
Modified Makefile from [90d147b144] to [74ba9265cf].
1 2 3 4 5 6 7 8 9 10 11 | # 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 | | | | > > > | | 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 | # 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 keystore.scm html-filter.scm cookie.scm MODULEFILES = $(wildcard modules/*/*-mod.scm) SOFILES = $(MODULEFILES:%.scm=%.so) CFILES = $(MODULEFILES:%.scm=%.c) 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 $(TARGDIR)/stmlrun : stmlrun install stmlrun $(TARGDIR) chmod a+rx $(TARGDIR)/stmlrun $(TARGDIR)/modules : mkdir -p $(TARGDIR)/modules $(MODULES) : $(SOFILES) $(TARGDIR)/modules cp $< $@ stmlrun : $(OFILES) stmlrun.scm requirements.scm stmlcommon.scm csc $(OFILES) stmlrun.scm -o stmlrun stml.so : $(OFILES) stmlmodule.scm requirements.scm stmlcommon.scm csc $(OFILES) -s stml.scm # logging currently relies on this # $(LOGDIR) : mkdir -p $(LOGDIR) chmod a+rwx $(LOGDIR) |
︙ | ︙ |
Modified misc-stml.scm from [9d5a337236] to [805de087f1].
︙ | ︙ | |||
168 169 170 171 172 173 174 | (res '())) (if (eof-object? l) (s:log res) (loop (read-line p)(cons (list l "<BR>") res))))) #t)))) (define (s:validate-inputs) | > | | | | | | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | (res '())) (if (eof-object? l) (s:log res) (loop (read-line p)(cons (list l "<BR>") res))))) #t)))) (define (s:validate-inputs) (if (not (s:validate-uri)) (begin (s:error-page "Bad URI" (let ((ref (get-environment-variable "HTTP_REFERER"))) (if ref (list "referred from" ref) ""))) (exit)))) ;; anything except a list is converted to a string!!! (define (s:any->string val) (cond ((string? val) val) ((number? val) (number->string val)) ((symbol? val) (symbol->string val)) |
︙ | ︙ |
Modified session.scm from [c4e9fdabd2] to [35fee6e1bc].
︙ | ︙ | |||
91 92 93 94 95 96 97 | (define (sdat-set-curr-err! vec val)(vector-set! vec 27 val)) (define (sdat-set-log-port! vec val)(vector-set! vec 28 val)) (define (sdat-set-logfile! vec val)(vector-set! vec 29 val)) (define (sdat-set-seen-pages! vec val)(vector-set! vec 30 val)) (define (sdat-set-page-dir-style! vec val)(vector-set! vec 31 val)) (define (sdat-set-debugmode! vec val)(vector-set! vec 32 val)) | < < < < < < < | < < < < < < < < | < < < < < < < < < < < < < < < < < | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | (define (sdat-set-curr-err! vec val)(vector-set! vec 27 val)) (define (sdat-set-log-port! vec val)(vector-set! vec 28 val)) (define (sdat-set-logfile! vec val)(vector-set! vec 29 val)) (define (sdat-set-seen-pages! vec val)(vector-set! vec 30 val)) (define (sdat-set-page-dir-style! vec val)(vector-set! vec 31 val)) (define (sdat-set-debugmode! vec val)(vector-set! vec 32 val)) ;; The global session (define s:session (make-sdat)) ;; SPLIT INTO STRAIGHT FORWARD INIT AND COMPLEX INIT (define (session:initialize self) (sdat-set-dbtype! self 'pg) (sdat-set-page! self "home") ;; these are defaults (sdat-set-curr-page! self "home") (sdat-set-content-type! self "Content-type: text/html; charset=iso-8859-1\n\n") |
︙ | ︙ | |||
448 449 450 451 452 453 454 | (define (session:page-get self key) (hash-table-ref/default (sdat-get-pagevars self) key #f)) ;; get session vars for a specified page ;; (define (session:get self page key) (let ((ht (session:get-page-hash self page))) | | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | (define (session:page-get self key) (hash-table-ref/default (sdat-get-pagevars self) key #f)) ;; get session vars for a specified page ;; (define (session:get self page key) (let ((ht (session:get-page-hash self page))) (hash-table-ref/default ht (s:any->string key) #f))) ;; delete a session var for a specified page ;; (define (session:del! self page key) (let ((ht (session:get-page-hash self page))) (hash-table-delete! ht (s:any->string key)))) ;; get ALL keys for this page and store in the session pagevars hash ;; (define (session:get-vars self) (let ((session-id (sdat-get-session-id self))) (if (not session-id) (err:log "ERROR: No session id in session object! session:get-vars") |
︙ | ︙ |
Modified setup.scm from [f3ad64511f] to [73ece1fa1d].
︙ | ︙ | |||
8 9 10 11 12 13 14 | ;; PURPOSE. (declare (unit setup)) (declare (uses session)) (require-extension srfi-69) (require-extension regex) | < < < < < < < < | 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 | ;; PURPOSE. (declare (unit setup)) (declare (uses session)) (require-extension srfi-69) (require-extension regex) ;; use this for getting data from page to page when scope and evals ;; get in the way (define s:local-vars (make-hash-table)) (define (s:local-set! k v) (hash-table-set! s:local-vars k v)) (define (s:local-get k) (hash-table-ref/default s:local-vars k #f)) (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 |
︙ | ︙ |
Added stmlcommon.scm version [722378235d].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | ;; 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)) (include "requirements.scm") (declare (uses cookie)) (declare (uses html-filter)) (declare (uses misc-stml)) (declare (uses formdat)) (declare (uses stml)) (declare (uses session)) (declare (uses setup)) ;; s:session gets created here (declare (uses sqltbl)) (declare (uses keystore)) (define (stml:cgi-session session) (session:initialize session) (session:setup session) (session:get-vars session) (sdat-set-log-port! session ;; (current-error-port)) (open-output-file (sdat-get-logfile session) #:append)) (s:validate-inputs) (session:run-actions session) (sdat-set-pagedat! session (append (sdat-get-pagedat session) (s:call (sdat-get-toppage session)))) (if (eq? (sdat-get-page-type session) 'html) ;; default is html. (session:cgi-out session) (session:alt-out session)) (session:save-vars session) (session:close session)) (define (stml:main proc) (handle-exceptions exn (begin (print "Content-type: text/html") (print "") (print "<html> <head> <title>EXCEPTION</title> </head> <body>") (print " QUERY_STRING is: <b> " (get-environment-variable "QUERY_STRING") " </b> <br>") (print "<pre>") ;; (print " EXCEPTION: " ((condition-property-accessor 'exn 'message) exn)) (print-error-message exn) (print-call-chain) (print "</pre>") (print "<table>") (for-each (lambda (var) (print "<tr><td>" (car var) "</td><td>" (cdr var) "</td></tr>")) (get-environment-variables)) (print "</table>") (print "</body></html>")) (if proc (proc s:session) (stml:cgi-session s:session)) ;; (raise-error) ;; (exit) )) |
Modified stmlrun.scm from [ced526ca73] to [ab2a64d7c8].
︙ | ︙ | |||
8 9 10 11 12 13 14 | ;; 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)) | < < < < < < < < < < < < < < < < < < | < < < < | < < < < | < < < < < < < < < < < < | < < | 8 9 10 11 12 13 14 15 16 17 18 | ;; 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)) ;; (include "stmlcommon.scm") (require-library stml) (stml:main #f) |