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")
12 (def-alien-type-class (c-string :include pointer :include-args (to)))
14 (def-alien-type-translator c-string ()
15 (make-alien-c-string-type :to
16 (parse-alien-type 'char
17 (sb!kernel::make-null-lexenv))))
19 (def-alien-type-method (c-string :unparse) (type)
20 (declare (ignore type))
23 (def-alien-type-method (c-string :lisp-rep) (type)
24 (declare (ignore type))
25 '(or simple-base-string null (alien (* char))))
27 (def-alien-type-method (c-string :naturalize-gen) (type alien)
28 (declare (ignore type))
29 `(if (zerop (sap-int ,alien))
31 (%naturalize-c-string ,alien)))
33 (def-alien-type-method (c-string :deport-gen) (type value)
34 (declare (ignore type))
37 ((alien (* char)) (alien-sap ,value))
38 (simple-base-string (vector-sap ,value))))