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!ALIEN")
12 (/show0 "host-c-call.lisp 12")
14 (define-alien-type-class (c-string :include pointer :include-args (to)))
16 (define-alien-type-translator c-string ()
17 (make-alien-c-string-type :to
18 (parse-alien-type 'char
19 (sb!kernel::make-null-lexenv))))
21 (define-alien-type-method (c-string :unparse) (type)
22 (declare (ignore type))
25 (define-alien-type-method (c-string :lisp-rep) (type)
26 (declare (ignore type))
27 '(or simple-base-string null (alien (* char))))
29 (define-alien-type-method (c-string :naturalize-gen) (type alien)
30 (declare (ignore type))
31 `(if (zerop (sap-int ,alien))
33 (%naturalize-c-string ,alien)))
35 (define-alien-type-method (c-string :deport-gen) (type value)
36 (declare (ignore type))
39 ((alien (* char)) (alien-sap ,value))
40 (simple-base-string (vector-sap ,value))))
42 (/show0 "host-c-call.lisp end of file")