cl-ipp

Internet Printing Protocol (IPP) for Common Lisp
git clone https://logand.com/git/cl-ipp.git/
Log | Files | Refs

commit eb31a4127f4c0145755a555456e2175cbdb01617
parent c2fd6ea11c5faadfd8e567b46bd4cceebfc5ea03
Author: Tomas Hlavaty <tom@logand.com>
Date:   Mon, 19 Aug 2013 21:40:14 +0200

rw:till and rw:skip need rw:peek-reader, wraping in place where used

Diffstat:
Mipp.lisp | 27+++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/ipp.lisp b/ipp.lisp @@ -225,7 +225,7 @@ (read-text reader)))) (defun group-reader (reader) - (let (done tag group-tag attributes attribute) + (let (done tag group-tag attributes attribute (r (rw:peek-reader reader))) (lambda () (unless done (block found @@ -238,7 +238,7 @@ (setq group-tag tag attributes nil attribute nil) (return-from found z)))) (loop - (setq tag (tag (rw:next-u8 reader))) + (setq tag (tag (rw:next-u8 r))) ;;(print (list :!!! tag)) (when (eq :end-of-attributes-tag tag) (setq done t) @@ -251,17 +251,17 @@ (if (and group-tag (or attributes attribute)) (yield) (setq group-tag tag)) - (let ((k (read-text reader))) + (let ((k (read-text r))) (if k (progn (when attribute (push attribute attributes)) (setq attribute (list tag (or (attribute-keyword k) k) - (read-value reader tag)))) + (read-value r tag)))) (setq attribute (nconc attribute - (list (read-value reader tag))))) + (list (read-value r tag))))) #+nil(print (list :%%% attribute))))))))))) #+nil @@ -417,7 +417,7 @@ :request-id , (let ((x (rw:next-u32 reader))) (assert (= x request-id)) x) - :groups ,(rw:till (group-reader reader)))) + :groups ,(rw:till (rw:peek-reader (group-reader reader))))) #+nil (with-open-file (s "response.dat" :element-type '(unsigned-byte 8)) @@ -762,18 +762,21 @@ (multiple-value-bind (i all) (funcall s) (unless i (return-from found nil)) - (let ((z (rw:till (rw:skip (rw:reader all) (+ i n)) '(#\")))) + (let ((z (rw:till + (rw:skip + (rw:peek-reader (rw:reader all)) (+ i n)) '(#\")))) (when (and z (char/= #\? (car z))) (return-from found (coerce z 'string)))))))))) #+nil (with-open-file (s "printers.html") - (rw:till (printer-search-reader (rw:char-reader s)))) + (rw:till (rw:peek-reader (printer-search-reader (rw:char-reader s))))) (defun list-printers (ipp-client printer-uri response-file) (funcall ipp-client nil printer-uri nil response-file) (with-open-file (s response-file) - (rw:till (printer-search-reader (rw:char-reader s))))) + (rw:till (rw:peek-reader + (printer-search-reader (rw:char-reader s)))))) (defun wget-client (content-type printer-uri request-file response-file) (rw.net:wget printer-uri @@ -781,7 +784,7 @@ :response-file response-file :content-type content-type)) -;;(ipp:list-printers 'ipp-client "http://localhost:631/printers/" "printers.html") +;;(ipp:list-printers 'wget-client "http://localhost:631/printers/" "printers.html") (defun curl-client (content-type printer-uri request-file response-file) (rw.net:curl printer-uri @@ -835,7 +838,7 @@ ;;(ipp:get-jobs p :requested-attributes '(:job-description)) ;;(ipp:get-jobs p :requested-attributes '(:job-id :job-description)) ;;(ipp:get-jobs p :requested-attributes '(:all)) - (ipp:print-job p "test.txt" :ipp-attribute-fidelity nil :copies 2 :sides "two-sided-long-edge") ;; TODO create job object? + (ipp:print-job p "/home/tomas/git/cl-ipp/test.txt" :ipp-attribute-fidelity nil :copies 2 :sides "two-sided-long-edge") ;; TODO create job object? ;;(ipp:validate-job p :ipp-attribute-fidelity nil :copies 2 :sides "two-sided-long-edge") ) @@ -862,4 +865,4 @@ "response2.dat" 314)) (j (ipp:create-job p))) - (ipp:send-jdocument j "test.txt" :ipp-attribute-fidelity nil :copies 2 :sides "two-sided-long-edge")) + (ipp:send-document j "test.txt" :ipp-attribute-fidelity nil :copies 2 :sides "two-sided-long-edge"))