[usocket-cvs] r618 - usocket/branches/0.5.x/backend

Chun Tian (binghe) ctian at common-lisp.net
Thu Mar 31 03:22:38 UTC 2011


Author: ctian
Date: Wed Mar 30 23:22:37 2011
New Revision: 618

Log:
Add VALUES declaration for SOCKET-RECEIVE, and I doubt not all backends currently return all four values correctly.

Modified:
   usocket/branches/0.5.x/backend/abcl.lisp
   usocket/branches/0.5.x/backend/allegro.lisp
   usocket/branches/0.5.x/backend/clisp.lisp
   usocket/branches/0.5.x/backend/cmucl.lisp
   usocket/branches/0.5.x/backend/lispworks.lisp
   usocket/branches/0.5.x/backend/openmcl.lisp
   usocket/branches/0.5.x/backend/sbcl.lisp
   usocket/branches/0.5.x/backend/scl.lisp

Modified: usocket/branches/0.5.x/backend/abcl.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/abcl.lisp	(original)
+++ usocket/branches/0.5.x/backend/abcl.lisp	Wed Mar 30 23:22:37 2011
@@ -343,6 +343,10 @@
 ;;; TODO: return-host and return-port cannot be get ...
 (defmethod socket-receive ((usocket datagram-usocket) buffer length
 			   &key (element-type '(unsigned-byte 8)))
+  (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer
+		   (integer 0)                          ; size
+		   (unsigned-byte 32)                   ; host
+		   (unsigned-byte 16)))                 ; port
   (let* ((socket (socket usocket))
 	 (real-length (or length +max-datagram-packet-size+))
 	 (byte-array (jnew-array $*byte real-length))

Modified: usocket/branches/0.5.x/backend/allegro.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/allegro.lisp	(original)
+++ usocket/branches/0.5.x/backend/allegro.lisp	Wed Mar 30 23:22:37 2011
@@ -155,6 +155,10 @@
       (socket:send-to s buffer length :remote-host host :remote-port port))))
 
 (defmethod socket-receive ((socket datagram-usocket) buffer length &key)
+  (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer
+		   (integer 0)                          ; size
+		   (unsigned-byte 32)                   ; host
+		   (unsigned-byte 16)))                 ; port
   (with-mapped-conditions (socket)
     (let ((s (socket socket)))
       (socket:receive-from s length :buffer buffer :extract t))))

Modified: usocket/branches/0.5.x/backend/clisp.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/clisp.lisp	(original)
+++ usocket/branches/0.5.x/backend/clisp.lisp	Wed Mar 30 23:22:37 2011
@@ -232,6 +232,10 @@
   (defmethod socket-receive ((socket datagram-usocket) buffer length &key)
     "Returns the buffer, the number of octets copied into the buffer (received)
 and the address of the sender as values."
+    (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer
+		     (integer 0)                          ; size
+		     (unsigned-byte 32)                   ; host
+		     (unsigned-byte 16)))                 ; port
     (let* ((sock (socket socket))
            (sockaddr (unless (connected-p socket)
                        (rawsock:make-sockaddr :inet)))
@@ -468,4 +472,13 @@
       (remove-waiter (wait-list usocket) usocket))
     (zerop (%close (socket usocket))))
 
+  (defmethod socket-receive ((socket datagram-usocket) buffer length &key)
+    (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer
+		     (integer 0)                          ; size
+		     (unsigned-byte 32)                   ; host
+		     (unsigned-byte 16)))                 ; port
+    )
+
+  (defmethod socket-send ((socket datagram-usocket) buffer length &key host port)
+    )
 ) ; progn

Modified: usocket/branches/0.5.x/backend/cmucl.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/cmucl.lisp	(original)
+++ usocket/branches/0.5.x/backend/cmucl.lisp	Wed Mar 30 23:22:37 2011
@@ -183,6 +183,10 @@
 	(%unix-send (socket usocket) buffer length 0))))
 
 (defmethod socket-receive ((usocket datagram-usocket) buffer length &key)
+  (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer
+		   (integer 0)                          ; size
+		   (unsigned-byte 32)                   ; host
+		   (unsigned-byte 16)))                 ; port
   (let ((real-buffer (or buffer
                          (make-array length :element-type '(unsigned-byte 8))))
         (real-length (or length

Modified: usocket/branches/0.5.x/backend/lispworks.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/lispworks.lisp	(original)
+++ usocket/branches/0.5.x/backend/lispworks.lisp	Wed Mar 30 23:22:37 2011
@@ -433,6 +433,10 @@
               (values nil n 0 0)))))))
 
 (defmethod socket-receive ((socket datagram-usocket) buffer length &key timeout)
+  (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer
+		   (integer 0)                          ; size
+		   (unsigned-byte 32)                   ; host
+		   (unsigned-byte 16)))                 ; port
   (multiple-value-bind (buffer size host port)
       (receive-message (socket socket)
                        (slot-value socket 'recv-buffer)

Modified: usocket/branches/0.5.x/backend/openmcl.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/openmcl.lisp	(original)
+++ usocket/branches/0.5.x/backend/openmcl.lisp	Wed Mar 30 23:22:37 2011
@@ -157,6 +157,10 @@
 	(ccl::send-for-usocket (socket usocket) buffer length))))
 
 (defmethod socket-receive ((usocket datagram-usocket) buffer length &key)
+  (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer
+		   (integer 0)                          ; size
+		   (unsigned-byte 32)                   ; host
+		   (unsigned-byte 16)))                 ; port
   (with-mapped-conditions (usocket)
     (openmcl-socket:receive-from (socket usocket) length :buffer buffer)))
 

Modified: usocket/branches/0.5.x/backend/sbcl.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/sbcl.lisp	(original)
+++ usocket/branches/0.5.x/backend/sbcl.lisp	Wed Mar 30 23:22:37 2011
@@ -387,6 +387,10 @@
 
 (defmethod socket-receive ((socket datagram-usocket) buffer length
 			   &key (element-type '(unsigned-byte 8)))
+  (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer
+		   (integer 0)                          ; size
+		   (unsigned-byte 32)                   ; host
+		   (unsigned-byte 16)))                 ; port
   (with-mapped-conditions (socket)
     (let ((s (socket socket)))
       (sb-bsd-sockets:socket-receive s buffer length :element-type element-type))))

Modified: usocket/branches/0.5.x/backend/scl.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/scl.lisp	(original)
+++ usocket/branches/0.5.x/backend/scl.lisp	Wed Mar 30 23:22:37 2011
@@ -145,6 +145,10 @@
 	  (scl-map-socket-error errno :socket socket)))))
 
 (defmethod socket-receive ((socket datagram-usocket) buffer length &key)
+  (declare (values (simple-array (unsigned-byte 8) (*)) ; buffer
+		   (integer 0)                          ; size
+		   (unsigned-byte 32)                   ; host
+		   (unsigned-byte 16)))                 ; port
   (let ((s (socket socket)))
     (let ((real-buffer (or buffer
 			   (make-array length :element-type '(unsigned-byte 8))))




More information about the usocket-cvs mailing list