1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB!C-CALL")
15 (def-alien-type-class (c-string :include pointer :include-args (to)))
17 (def-alien-type-translator c-string ()
18 (make-alien-c-string-type :to
19 (parse-alien-type 'char
20 (sb!kernel::make-null-lexenv))))
22 (def-alien-type-method (c-string :unparse) (type)
23 (declare (ignore type))
26 (def-alien-type-method (c-string :lisp-rep) (type)
27 (declare (ignore type))
28 '(or simple-base-string null (alien (* char))))
30 (def-alien-type-method (c-string :naturalize-gen) (type alien)
31 (declare (ignore type))
32 `(if (zerop (sap-int ,alien))
34 (%naturalize-c-string ,alien)))
36 (def-alien-type-method (c-string :deport-gen) (type value)
37 (declare (ignore type))
40 ((alien (* char)) (alien-sap ,value))
41 (simple-base-string (vector-sap ,value))))