[bknr-cvs] hans changed trunk/projects/quickhoney/src/json.lisp

BKNR Commits bknr at bknr.net
Fri Aug 1 04:41:27 UTC 2008


Revision: 3714
Author: hans
URL: http://bknr.net/trac/changeset/3714

Re-rename stream->output-stream

U   trunk/projects/quickhoney/src/json.lisp

Modified: trunk/projects/quickhoney/src/json.lisp
===================================================================
--- trunk/projects/quickhoney/src/json.lisp	2008-07-31 22:25:05 UTC (rev 3713)
+++ trunk/projects/quickhoney/src/json.lisp	2008-08-01 04:41:26 UTC (rev 3714)
@@ -3,18 +3,18 @@
 (defvar *json-output*)
 
 (defclass json-output-stream ()
-  ((stream :reader stream
-           :initarg :stream)
+  ((output-stream :reader output-stream
+                  :initarg :output-stream)
    (stack :accessor stack
           :initform nil)))
 
 (defun next-aggregate-element ()
   (if (car (stack *json-output*))
-      (princ (car (stack *json-output*)) (stream *json-output*))
+      (princ (car (stack *json-output*)) (output-stream *json-output*))
       (setf (car (stack *json-output*)) #\,)))
 
 (defmacro with-json-output ((stream) &body body)
-  `(let ((*json-output* (make-instance 'json-output-stream :stream ,stream)))
+  `(let ((*json-output* (make-instance 'json-output-stream :output-stream ,stream)))
      , at body))
 
 (defmacro with-json-output-to-string (() &body body)
@@ -26,12 +26,12 @@
   `(progn
      (when (stack *json-output*)
        (next-aggregate-element))
-     (princ ,begin-char (stream *json-output*))
+     (princ ,begin-char (output-stream *json-output*))
      (push nil (stack *json-output*))
      (prog1
          (progn , at body)
        (pop (stack *json-output*))
-       (princ ,end-char (stream *json-output*)))))
+       (princ ,end-char (output-stream *json-output*)))))
 
 (defmacro with-json-array (() &body body)
   `(with-json-aggregate (#\[ #\])
@@ -43,18 +43,18 @@
 
 (defun encode-array-element (object)
   (next-aggregate-element)
-  (json:encode-json object (stream *json-output*)))
+  (json:encode-json object (output-stream *json-output*)))
 
 (defun encode-object-element (key value)
   (next-aggregate-element)
-  (json:encode-json key (stream *json-output*))
-  (princ #\: (stream *json-output*))
-  (json:encode-json value (stream *json-output*)))
+  (json:encode-json key (output-stream *json-output*))
+  (princ #\: (output-stream *json-output*))
+  (json:encode-json value (output-stream *json-output*)))
 
 (defmacro with-object-element ((key) &body body)
   `(progn
      (next-aggregate-element)
-     (json:encode-json ,key (stream *json-output*))
+     (json:encode-json ,key (output-stream *json-output*))
      (setf (car (stack *json-output*)) #\:)
      (unwind-protect
           (progn , at body)
@@ -62,6 +62,6 @@
 
 (defmacro with-json-response (() &body body)
   `(with-http-response (:content-type "application/json")
-    (with-json-output-to-string ()
-      (with-json-object ()
-        , at body))))
+     (with-json-output-to-string ()
+       (with-json-object ()
+         , at body))))




More information about the Bknr-cvs mailing list