r5495: *** empty log message ***
[uffi.git] / src / strings.lisp
index b5eeebe19df0e43e3898ea0749208c62632a20fe..a8cbf8bdcd3937707cf90f2119a0c14612680dc3 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: strings.lisp,v 1.9 2003/06/12 18:32:30 kevin Exp $
+;;;; $Id: strings.lisp,v 1.10 2003/07/18 21:33:26 kevin Exp $
 ;;;;
 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -310,8 +310,7 @@ that LW/CMU automatically converts strings from c-calls."
 
 (def-type char-ptr-def (* :unsigned-char))
 
-;;#+(or lispworks (and allegro ics))
-#+(or lispworks allegro)
+#+(or lispworks (and allegro (not ics)))
 (defun fast-native-to-string (s)
   (declare (optimize (speed 3) (space 0) (safety 0) (compilation-speed 0))
           (type char-ptr-def s))
@@ -322,7 +321,17 @@ that LW/CMU automatically converts strings from c-calls."
     (dotimes (i len str)
       (setf (aref str i) (uffi:deref-array s '(:array :char) i)))))
 
-;;#+(and allegro (not ics))
+#+(and allegro ics)
+(defun fast-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))
+    (dotimes (i len str)
+      (setf (schar str i) (ensure-char-character
+                         (uffi:deref-array s '(:array :char) i))))))
+
 #+ignore
 (defun fast-native-to-string (s)
   (declare (optimize (speed 3) (space 0) (safety 0) (compilation-speed 0) (debug 0))