Changeset 3703
- Timestamp:
- 07/31/08 09:44:11 (4 months ago)
- Files:
-
- trunk/projects/quickhoney/src/handlers.lisp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/projects/quickhoney/src/handlers.lisp
r3702 r3703 434 434 435 435 (defclass json-output-stream () 436 (( stream :readerstream437 :initarg :stream)436 ((output-stream :reader output-stream 437 :initarg :output-stream) 438 438 (stack :accessor stack 439 439 :initform nil))) … … 441 441 (defun next-aggregate-element () 442 442 (if (car (stack *json-output*)) 443 (princ #\, ( stream *json-output*))443 (princ #\, (output-stream *json-output*)) 444 444 (setf (car (stack *json-output*)) t))) 445 445 446 446 (defmacro with-json-output ((stream) &body body) 447 `(let ((*json-output* (make-instance 'json-output-stream : stream ,stream)))447 `(let ((*json-output* (make-instance 'json-output-stream :output-stream ,stream))) 448 448 ,@body)) 449 449 … … 457 457 (when (stack *json-output*) 458 458 (next-aggregate-element)) 459 (princ ,begin-char ( stream *json-output*))459 (princ ,begin-char (output-stream *json-output*)) 460 460 (push nil (stack *json-output*)) 461 461 (prog1 462 462 (progn ,@body) 463 463 (pop (stack *json-output*)) 464 (princ ,end-char ( stream *json-output*)))))464 (princ ,end-char (output-stream *json-output*))))) 465 465 466 466 (defmacro with-json-array (() &body body) … … 474 474 (defun encode-array-element (object) 475 475 (next-aggregate-element) 476 (json:encode-json object ( stream *json-output*)))476 (json:encode-json object (output-stream *json-output*))) 477 477 478 478 (defun encode-object-element (key value) 479 479 (next-aggregate-element) 480 (json:encode-json key ( stream *json-output*))481 (princ #\: ( stream *json-output*))482 (json:encode-json value ( stream *json-output*)))480 (json:encode-json key (output-stream *json-output*)) 481 (princ #\: (output-stream *json-output*)) 482 (json:encode-json value (output-stream *json-output*))) 483 483 484 484 (defmethod handle-object ((handler news-json-handler) (channel rss-channel))
