[usocket-cvs] r140 - usocket/branches/0.2.x/backend

ehuelsmann at common-lisp.net ehuelsmann at common-lisp.net
Thu Jan 4 20:03:59 UTC 2007


Author: ehuelsmann
Date: Thu Jan  4 15:03:59 2007
New Revision: 140

Modified:
   usocket/branches/0.2.x/backend/allegro.lisp
   usocket/branches/0.2.x/backend/armedbear.lisp
   usocket/branches/0.2.x/backend/clisp.lisp
   usocket/branches/0.2.x/backend/cmucl.lisp
   usocket/branches/0.2.x/backend/lispworks.lisp
   usocket/branches/0.2.x/backend/openmcl.lisp
   usocket/branches/0.2.x/backend/sbcl.lisp
   usocket/branches/0.2.x/backend/scl.lisp
Log:
Backport r131 :element-type support.

Modified: usocket/branches/0.2.x/backend/allegro.lisp
==============================================================================
--- usocket/branches/0.2.x/backend/allegro.lisp	(original)
+++ usocket/branches/0.2.x/backend/allegro.lisp	Thu Jan  4 15:03:59 2007
@@ -36,12 +36,14 @@
                 :real-error condition
                 :socket socket))))))
 
-(defun socket-connect (host port)
+(defun socket-connect (host port &key (element-type 'character)
   (let ((socket))
     (setf socket
           (with-mapped-conditions (socket)
              (socket:make-socket :remote-host (host-to-hostname host)
-                                 :remote-port port)))
+                                 :remote-port port
+                                 :format (if (subtypep element-type 'character)
+                                             :text :binary))))
     (make-stream-socket :socket socket :stream socket)))
 
 (defmethod socket-close ((usocket usocket))

Modified: usocket/branches/0.2.x/backend/armedbear.lisp
==============================================================================
--- usocket/branches/0.2.x/backend/armedbear.lisp	(original)
+++ usocket/branches/0.2.x/backend/armedbear.lisp	Thu Jan  4 15:03:59 2007
@@ -11,13 +11,15 @@
   (typecase condition
     (error (error 'unknown-error :socket socket :real-error condition))))
 
-(defun socket-connect (host port)
+(defun socket-connect (host port &key (element-type 'character))
   (let ((usock))
     (with-mapped-conditions (usock)
        (let ((sock (ext:make-socket (host-to-hostname host) port)))
          (setf usock
-               (make-stream-socket :socket sock
-                                   :stream (ext:get-socket-stream sock)))))))
+               (make-stream-socket
+                :socket sock
+                :stream (ext:get-socket-stream sock
+                                               :element-type element-type)))))))
 
 (defmethod socket-close ((usocket usocket))
   (with-mapped-conditions (usocket)

Modified: usocket/branches/0.2.x/backend/clisp.lisp
==============================================================================
--- usocket/branches/0.2.x/backend/clisp.lisp	(original)
+++ usocket/branches/0.2.x/backend/clisp.lisp	Thu Jan  4 15:03:59 2007
@@ -38,13 +38,13 @@
                   :socket socket
                   :real-error condition))))))
 
-(defun socket-connect (host port)
+(defun socket-connect (host port &key (element-type 'character))
   (let ((socket)
         (hostname (host-to-hostname host)))
     (with-mapped-conditions (socket)
        (setf socket
              (socket:socket-connect port hostname
-                                    :element-type 'character
+                                    :element-type element-type
                                     :buffered t)))
     (make-stream-socket :socket socket
                         :stream socket))) ;; the socket is a stream too

Modified: usocket/branches/0.2.x/backend/cmucl.lisp
==============================================================================
--- usocket/branches/0.2.x/backend/cmucl.lisp	(original)
+++ usocket/branches/0.2.x/backend/cmucl.lisp	Thu Jan  4 15:03:59 2007
@@ -53,14 +53,14 @@
                          :real-condition condition
                          :socket socket))))
 
-(defun socket-connect (host port)
+(defun socket-connect (host port &key (element-type 'character))
   (let* ((socket))
     (setf socket
           (with-mapped-conditions (socket)
              (ext:connect-to-inet-socket (host-to-hbo host) port :stream)))
     (if socket
         (let* ((stream (sys:make-fd-stream socket :input t :output t
-                                           :element-type 'character
+                                           :element-type element-type
                                            :buffering :full))
                ;;###FIXME the above line probably needs an :external-format
                (usocket (make-stream-socket :socket socket

Modified: usocket/branches/0.2.x/backend/lispworks.lisp
==============================================================================
--- usocket/branches/0.2.x/backend/lispworks.lisp	(original)
+++ usocket/branches/0.2.x/backend/lispworks.lisp	Thu Jan  4 15:03:59 2007
@@ -47,12 +47,13 @@
 ;;                       :real-condition condition
 ;;                       :socket socket))))
 
-(defun socket-connect (host port)
+(defun socket-connect (host port &key (element-type 'character))
   (let ((hostname (host-to-hostname host))
         (stream))
     (setf stream
           (with-mapped-conditions ()
-             (comm:open-tcp-stream hostname port)))
+             (comm:open-tcp-stream hostname port
+                                   :element-type element-type)))
     (if stream
         (make-stream-socket :socket (comm:socket-stream-socket stream)
                             :stream stream)

Modified: usocket/branches/0.2.x/backend/openmcl.lisp
==============================================================================
--- usocket/branches/0.2.x/backend/openmcl.lisp	(original)
+++ usocket/branches/0.2.x/backend/openmcl.lisp	Thu Jan  4 15:03:59 2007
@@ -40,12 +40,15 @@
     (error (error 'unknown-error :socket socket :real-error condition))
     (condition (signal 'unknown-condition :real-condition condition))))
 
-(defun socket-connect (host port)
+(defun socket-connect (host port &key (element-type 'character))
   (with-mapped-conditions ()
      (let ((mcl-sock (openmcl-socket:make-socket :remote-host
                                                  (host-to-hostname host)
                                                  :remote-port port)))
-        (openmcl-socket:socket-connect mcl-sock)
+        (openmcl-socket:socket-connect mcl-sock
+                                       :element-type (if (subtypep element-type
+                                                                   'character)
+                                                         :text :binary))
         (make-stream-socket :stream mcl-sock :socket mcl-sock))))
 
 (defmethod socket-close ((usocket usocket))

Modified: usocket/branches/0.2.x/backend/sbcl.lisp
==============================================================================
--- usocket/branches/0.2.x/backend/sbcl.lisp	(original)
+++ usocket/branches/0.2.x/backend/sbcl.lisp	Thu Jan  4 15:03:59 2007
@@ -67,14 +67,14 @@
                            :real-condition condition))))))
 
 
-(defun socket-connect (host port)
+(defun socket-connect (host port &key (element-type 'character))
   (let* ((socket (make-instance 'sb-bsd-sockets:inet-socket
                                 :type :stream :protocol :tcp))
          (stream (sb-bsd-sockets:socket-make-stream socket
                                                     :input t
                                                     :output t
                                                     :buffering :full
-                                                    :element-type 'character))
+                                                    :element-type element-type))
          ;;###FIXME: The above line probably needs an :external-format
          (usocket (make-stream-socket :stream stream :socket socket))
          (ip (host-to-vector-quad host)))

Modified: usocket/branches/0.2.x/backend/scl.lisp
==============================================================================
--- usocket/branches/0.2.x/backend/scl.lisp	(original)
+++ usocket/branches/0.2.x/backend/scl.lisp	Thu Jan  4 15:03:59 2007
@@ -33,12 +33,12 @@
         :real-condition condition
         :socket socket))))
 
-(defun socket-connect (host port)
+(defun socket-connect (host port &key (element-type 'character))
   (let* ((socket
       (with-mapped-conditions (nil)
         (ext:connect-to-inet-socket (host-to-hbo host) port :kind :stream)))
      (stream (sys:make-fd-stream socket :input t :output t
-                     :element-type 'character
+                     :element-type element-type
                      :buffering :full)))
     ;;###FIXME the above line probably needs an :external-format
     (make-stream-socket :socket socket :stream stream)))



More information about the usocket-cvs mailing list