r8251: fix compilation on SunOS
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 19 Nov 2003 17:43:03 +0000 (17:43 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 19 Nov 2003 17:43:03 +0000 (17:43 +0000)
src/strings.lisp
tests/make.sh

index 250df2e67734ba18bcaa27b274e606977ea411c4..5fdbc89188037c2bc261cc60544e24289e1f2d88 100644 (file)
@@ -156,7 +156,7 @@ that LW/CMU automatically converts strings from c-calls."
   `(if (zerop ,obj)
        nil
      (if (eq ,locale :none)
-        (fast-native-to-string ,obj)
+        (fast-native-to-string ,obj ,length)
        (excl:native-to-string
        ,obj 
        ,@(when length (list :length length))
@@ -165,7 +165,7 @@ that LW/CMU automatically converts strings from c-calls."
   `(if (fli:null-pointer-p ,obj)
        nil
      (if (eq ,locale :none)
-        (fast-native-to-string ,obj)
+        (fast-native-to-string ,obj ,length)
        (fli:convert-from-foreign-string 
        ,obj
        ,@(when length (list :length length))
@@ -311,45 +311,22 @@ that LW/CMU automatically converts strings from c-calls."
 (def-type char-ptr-def (* :unsigned-char))
 
 #+(or lispworks (and allegro (not ics)))
-(defun fast-native-to-string (s)
+(defun fast-native-to-string (s len)
   (declare (optimize (speed 3) (space 0) (safety 0) (compilation-speed 0))
           (type char-ptr-def s))
-  (let* ((len (strlen s))
-        (str (make-string len)))
+  (let* ((len (or len (strlen s)))
+         (str (make-string len)))
     (declare (fixnum len)
             (type (simple-array (signed-byte 8) (*)) str))
     (dotimes (i len str)
-      (setf (aref str i) (uffi:deref-array s '(:array :char) i)))))
+      (setf (aref str i) 
+       (uffi:deref-array s '(:array :char) i)))))
 
 #+(and allegro ics)
-(defun fast-native-to-string (s)
+(defun fast-native-to-string (s len)
   (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))
-          (type char-ptr-def s))
-  (let* ((len (strlen s))
-        (len4 (the fixnum (ash (the fixnum len) -2)))
-        (end4 (the fixnum (ash (the fixnum len4) 2)))
-        (remainder (the fixnum (- len end4)))
-        (str (make-string len))
-        (str4 str))
-    (declare (type fixnum len len4 end4 remainder)
-            (type (simple-array (signed-byte 32) (*)) str4)
-            (type (simple-array (signed-byte 8) (*)) str))
-    (dotimes (i len4)
-      (declare (fixnum i))
-      (setf (aref str4 i) (uffi:deref-array s '(:array :int) i)))
-    (dotimes (i remainder)
-      (declare (fixnum i))
-      (setf (aref str end4) (uffi:deref-array s '(:array :char) end4))
-      (incf end4))
-    str))
+  (let* ((len (or len (strlen s)))
+         (str (make-string len)))
+      (dotimes (i len str)
+        (setf (aref str i) (uffi:deref-array s '(:array :char) i)))))
index 8bb895c3de52017f71999e21267a6a22c0b73686..ba59d82321738481c46ba55e7e885b1bcc218bc1 100644 (file)
@@ -3,7 +3,7 @@
 case "`uname`" in
     Linux) os_linux=1 ;;
     Darwin) os_darwin=1 ;;
-    SunOs) os_sunos=1 ;;
+    SunOS) os_sunos=1 ;;
     AIX) os_aix=1 ;;
     *) echo "Unable to identify uname " `uname`
        exit 1 ;;