run-program: support I/O redirection to binary streams on win32.
[sbcl.git] / contrib / sb-posix / designator.lisp
blobef33e4005bbace0874fcdfc381c6a666df72e772
1 (in-package :sb-posix)
2 (defvar *designator-types* (make-hash-table :test #'equal))
4 (defmacro define-designator (name (lisp-type alien-type) doc
5 &body conversions)
6 (let ((designator-type `(or ,@(mapcar #'car conversions)))
7 (designator-name (intern (format nil "~A-~A"
8 (symbol-name name)
9 (symbol-name :designator))
10 #.*package*))
11 (name (intern (symbol-name name) :sb-posix)))
12 `(progn
13 (deftype ,name ()
14 ,@(when doc (list (first doc)))
15 ',lisp-type)
16 (deftype ,designator-name ()
17 ,@(when doc (list (second doc)))
18 ',designator-type)
19 (eval-when (:compile-toplevel :load-toplevel :execute)
20 (setf (gethash ',name *designator-types*) ',alien-type))
21 (declaim (ftype (function (t) (values ,lisp-type &optional)) ,name))
22 (defun ,name (,name)
23 ,@(when doc (list (third doc)))
24 (etypecase ,name
25 ,@conversions)))))