X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=uffi%2Fclsql-uffi.lisp;h=11fb988c6358269588418cd98105c1232a11db0d;hb=082969cc01765b8ebde78cd35a41ad274d1af02d;hp=3b5cf719382429f26428870de84d5bb7754a1b61;hpb=73d3c42de4eb898508f635362896ddcbc1d5ce7a;p=clsql.git diff --git a/uffi/clsql-uffi.lisp b/uffi/clsql-uffi.lisp index 3b5cf71..11fb988 100644 --- a/uffi/clsql-uffi.lisp +++ b/uffi/clsql-uffi.lisp @@ -7,7 +7,7 @@ ;;;; Programmers: Kevin M. Rosenberg ;;;; Date Started: Mar 2002 ;;;; -;;;; $Id: clsql-uffi.lisp,v 1.5 2003/05/06 02:22:58 kevin Exp $ +;;;; $Id: clsql-uffi.lisp,v 1.6 2003/05/15 07:33:21 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -120,5 +120,25 @@ low32 (make-64-bit-integer high32 low32))))) (t + (native-to-string char-ptr) + #+ignore (uffi:convert-from-foreign-string char-ptr))))))) + +(uffi:def-function "strlen" + ((str (* :unsigned-char))) + :returning :unsigned-int) + +(defun native-to-string (s) + (declare (optimize (speed 3) (space 0) (safety 0) (compilation-speed 0))) + (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))