patch: implement open-x-stream and a with-array-data fix for CMU

Matthew Kennedy <[email protected]> Wed, 22 Dec 2004 00:42:32 -0600
Newsgroups gmane.lisp.clx.devel
Message-ID <[email protected]>
--=-=-=

The attached patch defines open-x-stream for CMUCL and updates
with-underlying-simple-vector's use of with-array-data for CMUCL 19a.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=cmucl19a-open-x-stream.patch

diff -ur clx_0.6.orig/dependent.lisp clx_0.6/dependent.lisp
--- clx_0.6.orig/dependent.lisp	2004-06-11 07:18:17.000000000 -0500
+++ clx_0.6/dependent.lisp	2004-12-21 23:42:41.387986779 -0600
@@ -1511,11 +1511,16 @@
 						  (cdr (host-address host)))
 			  :foreign-port (+ *x-tcp-port* display)))
 
-#+(or sbcl ecl)
+#+(or sbcl ecl CMU)
 (defconstant +X-unix-socket-path+
   "/tmp/.X11-unix/X"
   "The location of the X socket")
 
+#+(or sbcl ecl CMU)
+(defconstant +X-tcp-port+
+  6000
+  "The TCP port number for X")
+
 #+sbcl
 (defun open-x-stream (host display protocol)  
   (declare (ignore protocol)
@@ -1528,11 +1533,21 @@
        (let ((host (car (host-ent-addresses (get-host-by-name host)))))
 	 (when host
 	   (let ((s (make-instance 'inet-socket :type :stream :protocol :tcp)))
-	     (socket-connect s host (+ 6000 display))
+	     (socket-connect s host (+ +X-tcp-port+ display))
 	     s))))
    :element-type '(unsigned-byte 8)
    :input t :output t :buffering :none))
 
+#+CMU
+(defun open-x-stream (host display protocol)
+  (declare (ignore protocol)
+	   (type (integer 0) display))
+  (system:make-fd-stream
+   (if (or (string= host "") (string= host "unix"))
+       (ext:connect-to-unix-socket (format nil "~A~D" +X-unix-socket-path+ display))
+       (ext:connect-to-inet-socket host (+ +X-tcp-port+ display)))
+   :input t :output t :element-type '(unsigned-byte 8)))
+
 #+ecl
 (defun open-x-stream (host display protocol)
   (declare (ignore protocol)
@@ -1541,7 +1556,7 @@
     (if (or (string= host "") (string= host "unix")) ; AF_UNIX doamin socket
 	(sys::open-unix-socket-stream
 	 (format nil "~A~D" +X-unix-socket-path+ display))
-	(si::open-client-stream host (+ 6000 display)))))
+	(si::open-client-stream host (+ +X-tcp-port+ display)))))
 
 ;;; BUFFER-READ-DEFAULT - read data from the X stream
 
@@ -3092,7 +3107,7 @@
 (defmacro with-underlying-simple-vector 
     ((variable element-type pixarray) &body body)
   (declare (ignore element-type))
-  `(#+cmu kernel::with-array-data #+sbcl sb-kernel:with-array-data
+  `(#+cmu lisp::with-array-data #+sbcl sb-kernel:with-array-data
     ((,variable ,pixarray) (start) (end))
     (declare (ignore start end))
     ,@body))
@@ -3505,11 +3520,11 @@
 			     height width)
   (declare (type array-index source-width sx sy dest-width dx dy height width))
   #.(declare-buffun)
-  (kernel::with-array-data ((sdata source)
+  (lisp::with-array-data ((sdata source)
 				 (sstart)
 				 (send))
     (declare (ignore send))
-    (kernel::with-array-data ((ddata dest)
+    (lisp::with-array-data ((ddata dest)
 				   (dstart)
 				   (dend))
       (declare (ignore dend))

--=-=-=


-- 
Matthew Kennedy


--=-=-=--

_______________________________________________
Portable-clx mailing list
[email protected]
http://lists.metacircles.com/cgi-bin/mailman/listinfo/portable-clx
cvs -d :ext:cvs.telent.net:/usr/local/src/cvs co clx  # over ssh
cvs -d :pserver:[email protected]:/cvs co clx  # anonymous