Utility predicates for packing: UNBOUNDED-SC-P and UNBOUNDED-TN-P
[sbcl.git] / src / code / target-c-call.lisp
index a3ff56a..c978ac8 100644 (file)
 (define-alien-type char (integer 8))
 (define-alien-type short (integer 16))
 (define-alien-type int (integer 32))
+#!-(and win32 x86-64)
 (define-alien-type long (integer #.sb!vm::n-machine-word-bits))
+#!+(and win32 x86-64)
+(define-alien-type long (integer 32))
+
 (define-alien-type long-long (integer 64))
 
 (define-alien-type unsigned-char (unsigned 8))
 (define-alien-type unsigned-short (unsigned 16))
 (define-alien-type unsigned-int (unsigned 32))
+#!-(and win32 x86-64)
 (define-alien-type unsigned-long (unsigned #.sb!vm::n-machine-word-bits))
+#!+(and win32 x86-64)
+(define-alien-type unsigned-long (unsigned 32))
 (define-alien-type unsigned-long-long (unsigned 64))
 
 (define-alien-type float single-float)
   (declare (type simple-string string))
   (locally
       (declare (optimize (speed 3) (safety 0)))
-    (let ((func (sb!impl::get-external-format-function external-format 10)))
-      (unless func
-        (error "Undefined external-format ~A.~%" external-format))
-      (funcall (symbol-function func) string))))
+    (let ((external-format (sb!impl::get-external-format-or-lose external-format)))
+      (funcall (sb!impl::ef-write-c-string-fun external-format) string))))
 
 (defun c-string-to-string (sap external-format element-type)
   (declare (type system-area-pointer sap))
   (locally
       (declare (optimize (speed 3) (safety 0)))
-    (let ((func (sb!impl::get-external-format-function external-format 9)))
-      (unless func
-        (error "Undefined external-format ~A.~%" external-format))
-      (funcall (symbol-function func) sap element-type))))
-
+    (let ((external-format (sb!impl::get-external-format-or-lose external-format)))
+      (funcall (sb!impl::ef-read-c-string-fun external-format) sap element-type))))