clsql/uffi clsql-uffi.lisp,1.28,1.29

"Kevin M. Rosenberg" <[email protected]> Fri, 6 Jun 2003 15:59:11 -0600
Newsgroups gmane.lisp.clsql.cvs
Message-ID <[email protected]>
Update of /pubcvs/clsql/uffi
In directory boa.b9.com:/tmp/cvs-serv10381/uffi

Modified Files:
	clsql-uffi.lisp 
Log Message:
return from san diego

Index: clsql-uffi.lisp
===================================================================
RCS file: /pubcvs/clsql/uffi/clsql-uffi.lisp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** clsql-uffi.lisp	29 May 2003 05:19:50 -0000	1.28
--- clsql-uffi.lisp	6 Jun 2003 21:59:09 -0000	1.29
***************
*** 83,89 ****
    `(values (ash ,int64 -32) (logand ,int64 +2^32-1+)))
  
- (defvar +ascii-N-value+ (char-code #\N))
- (defvar +ascii-U-value+ (char-code #\U))
- 
  (uffi:def-type char-ptr-def (* :unsigned-char))
  
--- 83,86 ----
***************
*** 93,99 ****
    ;; never be non-numeric
    (declare (type char-ptr-def char-ptr))
!   (let ((char (uffi:ensure-char-character
! 	       (uffi:deref-pointer char-ptr :char))))
!     (char-equal char #\N)))
      
  (defun convert-raw-field (char-ptr types index)
--- 90,95 ----
    ;; never be non-numeric
    (declare (type char-ptr-def char-ptr))
!   (char-equal #\N (uffi:ensure-char-character
! 		   (uffi:deref-pointer char-ptr :char))))
      
  (defun convert-raw-field (char-ptr types index)
***************
*** 120,167 ****
  		  (make-64-bit-integer high32 low32)))))
  	 (t
! 	  #+(or allegro lispworks) (native-to-string char-ptr) ;; optimized
! 	  #-(or allegro lispworks) (uffi:convert-from-foreign-string char-ptr)))))))
    
- 
- (uffi:def-function "strlen"
-     ((str (* :unsigned-char)))
-   :returning :unsigned-int)
- 
- #+(or lispworks (and allegro ics))
- (defun native-to-string (s)
-   (declare (optimize (speed 3) (space 0) (safety 0) (compilation-speed 0))
- 	   (type char-ptr-def s))
-   (let* ((len (strlen s))
- 	 (str (make-string len)))
-     (declare (fixnum len)
- 	     (simple-string str))
-     (do ((i 0))
- 	((= i len))
-       (declare (fixnum i))
-       (setf (schar str i)
- 	(code-char (uffi:deref-array s '(:array :unsigned-char) i)))
-       (incf i))
-     str))
- 
- #+(and allegro (not ics))
- (defun native-to-string (s)
-   (declare (optimize (speed 3) (space 0) (safety 0) (compilation-speed 0))
- 	   (type char-ptr-def s))
-   (let* ((len (strlen s))
- 	 (len4 (floor len 4))
- 	 (str (make-string len)))
-     (declare (fixnum len)
- 	     (type (simple-array (signed-byte 32) (*)) str))
-     (do ((i 0))
- 	((= i len4))
-       (declare (fixnum i))
-       (setf (aref (the (simple-array (signed-byte 32) (*)) str) i)
- 	(uffi:deref-array s '(:array :int) i))
- 	(incf i))
-     (do ((i (* 4 len4)))
- 	((= i len))
-       (declare (fixnum i))
-       (setf (aref (the (simple-array (signed-byte 8) (*)) str) i)
- 	(uffi:deref-array s '(:array :unsigned-char) i))
-       (incf i))
-     str))
--- 116,119 ----
  		  (make-64-bit-integer high32 low32)))))
  	 (t
! 	  (uffi:convert-from-foreign-string char-ptr :locale :none)))))))