Update of /project/clhp/cvsroot/clhp/examples In directory common-lisp.net:/tmp/cvs-serv8963/examples
Modified Files: test.lisp index.clhp Log Message: * examples/index.clhp (PRINT-HASH-TO-TABLE): Modified to work with new hash-tables
* examples/test.lisp (PRINT-HASH): Modified test program to work with new hash-table
* cgi.lisp (*SERVER-ENV*,*QUERY-VARS*): Converted to hashtable.
Date: Tue Oct 21 00:16:58 2003 Author: aventimiglia
Index: clhp/examples/test.lisp diff -u clhp/examples/test.lisp:1.4 clhp/examples/test.lisp:1.5 --- clhp/examples/test.lisp:1.4 Sat Oct 18 21:57:13 2003 +++ clhp/examples/test.lisp Tue Oct 21 00:16:58 2003 @@ -19,19 +19,28 @@ ;; HomePage: http://common-lisp.net/project/clhp/
(ext:file-comment - "$Id: test.lisp,v 1.4 2003/10/19 01:57:13 aventimiglia Exp $") + "$Id: test.lisp,v 1.5 2003/10/21 04:16:58 aventimiglia Exp $")
-(clhp:init) -(clhp:header :extra (list "Content-Language: en")) +(use-package :clhp)
-(clhp:debug 'clhp:*query-vars*) -(clhp:debug 'clhp:*server-env*) +(defun print-hash (table &optional (stream t)) + (declare (type hash-table table)) + (maphash #'(lambda (k v) (format stream "~S = ~S~%" k v)) table)) + +(init) +(header :extra (list "Content-Language: en")) + +(debug '*query-vars*) +(debug '*server-env*) + +(debug '(print-hash *query-vars*)) +(debug '(print-hash *server-env*))
;; Test of CLHP::GET-POST to make sure it only actually reads once. -(if (string= (cdr (assoc :REQUEST_METHOD clhp:*server-env*)) "POST") +(if (string= (cdr (assoc :REQUEST_METHOD *server-env*)) "POST") (progn - (clhp:debug '(clhp::post-data)) - (clhp:debug '(clhp::post-data)))) + (debug '(post-data)) + (debug '(post-data))))
-(format t "~%--------~% $Date: 2003/10/19 01:57:13 $~%") +(format t "~%--------~% $Date: 2003/10/21 04:16:58 $~%")
Index: clhp/examples/index.clhp diff -u clhp/examples/index.clhp:1.6 clhp/examples/index.clhp:1.7 --- clhp/examples/index.clhp:1.6 Wed Oct 15 08:50:51 2003 +++ clhp/examples/index.clhp Tue Oct 21 00:16:58 2003 @@ -27,7 +27,9 @@ ;; will actually be written, it is meant to show examples of some of ;; the possibilities CLHP will allow
-(cgi:init) +(use-package :clhp) + +(init) (defun bold (str) "This is just an example (and test) to show that functions can be defined in documents. In reality, if you were working on a large site, @@ -66,27 +68,21 @@ <hr />
<?clhp -(defmacro print-a-list-table (a-list) +(defmacro print-hash-to-table (hash-table) `(echo - (tag 'h3 'align 'center ',a-list) + (tag 'h3 'align 'center ',hash-table) (tag '|table| 'border 1 - (cons (tag 'tr - (list - (tag 'td (tag "b" "Name")) + (cons + (tag 'tr + (list (tag 'td (tag "b" "Name")) (tag 'td (tag '|b| '|Value|)))) - (do* ((list ,a-list (cdr list)) - (k/v-pair (car list) (car list)) - (row-tag (tag "tr" - (list (tag "td" (car k/v-pair)) - (tag '|td| (cdr k/v-pair)))) - (tag "tr" - (list (tag "td" (car k/v-pair)) - (tag '|td| (cdr k/v-pair))))) - (rows (list row-tag) (cons row-tag rows))) - ((null list) (nreverse rows))))))) + (let (l) (maphash #'(lambda (key value) + (push (tag 'tr + (list (tag 'td key) (tag 'td value))) + l)) ,hash-table) l)))))
-(print-a-list-table cgi:*server-env*) -(print-a-list-table cgi:*query-vars*) +(print-hash-to-table *server-env*) +(print-hash-to-table *query-vars*) ?> </body>