Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

consolidate stream api in de.setf.utility.codec module

  • Loading branch information...
commit 56d42db5c4555c8866d0db4d2d84461c7d908b70 1 parent d84e1d0
@lisp authored
Showing with 23 additions and 122 deletions.
  1. +1 −0  amqp.asd
  2. +3 −4 classes.lisp
  3. +18 −19 frames.lisp
  4. +1 −99 package.lisp
View
1  amqp.asd
@@ -58,6 +58,7 @@
:de.weitz.cl-ppcre
:com.b9.puri.puri-ppcre
:de.setf.utility
+ :de.setf.utility.codecs
:de.setf.utility.mime
#+sbcl :sb-simple-streams)
:components ((:file "package")
View
7 classes.lisp
@@ -1410,18 +1410,19 @@
;;; allocate, resource-manage, read, and write immediately through
;;; a connection or indirectly through a channel.
+(defgeneric frame-channel-number (frame) )
+
+(defgeneric (setf frame-channel-number) (number frame) )
(defgeneric claim-input-frame (device)
(:documentation "Returns a free input frame or creates a new one.")
(:method ((channel amqp:channel))
- (declare (ftype function (setf frame-channel-number)))
(let ((frame (dequeue (device-free-input-frames channel))))
(setf (frame-channel-number frame) (channel-number channel))
frame))
(:method ((connection amqp:connection))
- (declare (ftype function (setf frame-channel-number)))
(let ((frame (dequeue (device-free-input-frames connection))))
(setf (frame-channel-number frame) 0)
frame)))
@@ -1435,7 +1436,6 @@
(flet ((make-channel-frame ()
(make-output-frame channel)))
(declare (dynamic-extent #'make-channel-frame))
- (declare (ftype function (setf frame-channel-number)))
(let ((frame (dequeue (device-free-output-frames channel)
:if-empty #'make-channel-frame)))
(setf (frame-channel-number frame) (channel-number channel))
@@ -1448,7 +1448,6 @@
(flet ((make-connection-frame ()
(make-output-frame connection)))
(declare (dynamic-extent #'make-connection-frame))
- (declare (ftype function (setf frame-channel-number)))
(let ((frame (dequeue (device-free-output-frames connection)
:if-empty #'make-connection-frame)))
(setf (frame-channel-number frame) 0)
View
37 frames.lisp
@@ -151,12 +151,12 @@
(:method ((frame input-frame))
(when (frame-connection frame)
- (setf-frame-channel-number 0 frame))
+ (setf (frame-channel-number frame) 0))
(enqueue frame (device-free-input-frames (frame-connection frame))))
(:method ((frame output-frame))
(when (frame-connection frame)
- (setf-frame-channel-number 0 frame)
+ (setf (frame-channel-number frame) 0)
(enqueue frame (device-free-output-frames (frame-connection frame))))))
@@ -353,29 +353,28 @@
cycle))
-(defgeneric frame-channel-number (frame)
- (:method ((frame 7-byte-header-frame))
- (buffer-unsigned-byte-16 (frame-header frame) 1))
+(defmethod frame-channel-number ((frame 7-byte-header-frame))
+ (buffer-unsigned-byte-16 (frame-header frame) 1))
- (:method ((frame 8-byte-header-frame))
- (buffer-unsigned-byte-16 (frame-header frame) 2))
+(defmethod frame-channel-number ((frame 8-byte-header-frame))
+ (buffer-unsigned-byte-16 (frame-header frame) 2))
- (:method ((frame 12-byte-header-frame))
- (buffer-unsigned-byte-16 (frame-header frame) 6)))
+(defmethod frame-channel-number ((frame 12-byte-header-frame))
+ (buffer-unsigned-byte-16 (frame-header frame) 6))
-(defgeneric setf-frame-channel-number (number frame)
- (:method (number (frame 7-byte-header-frame))
- (setf (buffer-unsigned-byte-16 (frame-header frame) 1) number))
- (:method (number (frame 8-byte-header-frame))
- (setf (buffer-unsigned-byte-16 (frame-header frame) 2) number))
+(defmethod (setf frame-channel-number) (number (frame 7-byte-header-frame))
+ (setf (buffer-unsigned-byte-16 (frame-header frame) 1) number))
- (:method (number (frame 12-byte-header-frame))
- number
- (error "NYI")))
+(defmethod (setf frame-channel-number) (number (frame 8-byte-header-frame))
+ (setf (buffer-unsigned-byte-16 (frame-header frame) 2) number))
+
+(defmethod (setf frame-channel-number) (number (frame 12-byte-header-frame))
+ number
+ (error "NYI"))
-(setf (fdefinition '(setf frame-channel-number))
- #'setf-frame-channel-number)
+(setf (fdefinition 'setf-frame-channel-number)
+ #'(setf frame-channel-number))
(defgeneric frame-track-number (frame)
View
100 package.lisp
@@ -349,6 +349,7 @@
(defpackage :de.setf.amqp.utility
(:use :common-lisp :puri )
+ (:use ::de.setf.utility.codecs)
(:documentation "The :de.setf.amqp.utility package exports names to make library components available to
applications. It uses no package, but is intended to be used - as is the case with the library implementation
itself. It cross-exports several terms from the AMQP standard package for this purpose.")
@@ -390,105 +391,6 @@
:string-32-p
:string-8-p
)
- (:import-from :de.setf.utility
- :stream-reader
- :stream-writer
- )
- #+ccl
- (:import-from :ccl
- #:open-stream-p
- #:stream-clear-input
- #:stream-clear-output
- #:stream-direction
- #:stream-element-type
- #:stream-eofp
- #:stream-finish-output
- #:stream-force-output
- #:stream-fresh-line
- #:stream-listen
- #:stream-position
- #:stream-read-byte
- #:stream-write-byte
- #:stream-write-string
- )
- #+clozure
- (:import-from :ccl
- :double-float-positive-infinity
- :double-float-negative-infinity
- #+ccl-1.4 :double-float-nan
- #:stream-advance-to-column
- #:stream-line-column
- #:stream-peek-char
- #:stream-read-char-no-hang
- #:stream-read-char
- #:stream-read-line
- #:stream-start-line-p
- #:stream-terpri
- #:stream-unread-char
- #:stream-write-char
- )
- #+lispworks
- (:import-from :stream
- #:stream-advance-to-column
- #:stream-clear-input
- #:stream-clear-output
- #:stream-file-position
- #:stream-line-column
- #:stream-peek-char
- #:stream-read-byte
- #:stream-read-char
- #:stream-read-char-no-hang
- #:stream-read-line
- #:stream-read-sequence
- #:stream-start-line-p
- #:stream-terpri
- #:stream-unread-char
- #:stream-write-char
- #:stream-write-byte
- #:stream-write-sequence
- #:stream-write-string)
- #+mcl
- (:import-from :ccl
- #:stream-close
- #:stream-read-sequence
- #:stream-untyi
- #:stream-tyi
- #:stream-tyo
- #:stream-write-sequence
- )
- #+sbcl
- (:import-from :sb-gray
- #:open-stream-p
- #:stream-advance-to-column
- #:stream-clear-input
- #:stream-clear-output
- #:stream-element-type
- #:stream-file-position
- #:stream-finish-output
- #:stream-force-output
- #:stream-fresh-line
- #:stream-line-column
- #:stream-listen
- #:stream-peek-char
- #:stream-read-byte
- #:stream-read-char
- #:stream-read-char-no-hang
- #:stream-read-line
- #:stream-read-sequence
- #:stream-start-line-p
- #:stream-terpri
- #:stream-unread-char
- #:stream-write-byte
- #:stream-write-char
- #:stream-write-sequence
- #:stream-write-string
- )
- #+sbcl
- (:import-from :sb-ext
- :double-float-positive-infinity
- :double-float-negative-infinity
- :single-float-positive-infinity
- :single-float-negative-infinity)
#+sbcl
(:import-from :sb-simple-streams
:device-close
Please sign in to comment.
Something went wrong with that request. Please try again.