commit 0cd14153e2fdbc7a178eadb62286283de7331283
parent 0c030cec93e25d399979bc2cf8a8398f23d2f221
Author: Tomas Hlavaty <tom@logand.com>
Date: Wed, 7 Aug 2013 09:09:53 +0200
better printer-uri arg passing
Diffstat:
M | ipp.lisp | | | 41 | ++++++++++++++++++++++++++--------------- |
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/ipp.lisp b/ipp.lisp
@@ -258,24 +258,24 @@
(with-open-file (*input-stream* "response.dat" :element-type '(unsigned-byte 8))
(read-ipp 314))
-(defun ipp (request-file response-file data-file request-id operation groups)
+(defun ipp (printer-uri request-file response-file data-file request-id operation groups)
(with-open-file (*output-stream* request-file
:element-type '(unsigned-byte 8)
:direction :output
:if-exists :supersede
:if-does-not-exist :create)
(write-ipp data-file request-id operation groups))
- (funcall *ipp-client* request-file response-file)
+ (funcall *ipp-client* printer-uri request-file response-file)
(with-open-file (*input-stream* response-file :element-type '(unsigned-byte 8))
(read-ipp request-id)))
-(defun print-job (request-file
+(defun print-job (printer-uri
+ request-file
response-file
data-file
request-id
attributes-charset
attributes-natural-language
- printer-uri
&key
requesting-user-name
job-name
@@ -287,7 +287,8 @@
job-k-octets
job-impressions
job-media-sheets)
- (ipp request-file
+ (ipp printer-uri
+ request-file
response-file
data-file
request-id
@@ -328,17 +329,22 @@
;;(wget "http://localhost:631/printers/" :response-file "/tmp/a.html")
;; wget|curl|lisp-http-client driver/backend
-(defun make-ipp-client (printer-uri)
- (lambda (request-file response-file)
+(defun make-ipp-client ()
+ (lambda (printer-uri request-file response-file)
(wget printer-uri
:request-file request-file
:response-file response-file
:content-type "application/ipp")))
#+nil
-(let* ((url "http://localhost:631/printers/Virtual_PDF_Printer")
- (ipp::*ipp-client* (make-ipp-client url)))
- (ipp::print-job "request2.dat" "response2.dat" "test.txt" 314 "utf-8" "en" url
+(let ((ipp::*ipp-client* (make-ipp-client)))
+ (ipp::print-job "http://localhost:631/printers/Virtual_PDF_Printer"
+ "request2.dat"
+ "response2.dat"
+ "test.txt"
+ 314
+ "utf-8"
+ "en"
:requesting-user-name "tomas"))
(defpackage :ipp.curl
@@ -361,15 +367,20 @@
;;(curl "http://localhost:631/printers/" :response-file "/tmp/a.html")
;; curl|curl|lisp-http-client driver/backend
-(defun make-ipp-client (printer-uri)
- (lambda (request-file response-file)
+(defun make-ipp-client ()
+ (lambda (printer-uri request-file response-file)
(curl printer-uri
:request-file request-file
:response-file response-file
:content-type "application/ipp")))
#+nil
-(let* ((url "http://localhost:631/printers/Virtual_PDF_Printer")
- (ipp::*ipp-client* (make-ipp-client url)))
- (ipp::print-job "request2.dat" "response2.dat" "test.txt" 314 "utf-8" "en" url
+(let ((ipp::*ipp-client* (make-ipp-client)))
+ (ipp::print-job "http://localhost:631/printers/Virtual_PDF_Printer"
+ "request2.dat"
+ "response2.dat"
+ "test.txt"
+ 314
+ "utf-8"
+ "en"
:requesting-user-name "tomas"))