1.0.20: release, will be tagged sbcl_1_0_20
[sbcl/eslaughter.git] / contrib / sb-posix / designator.lisp
blobe3c0df7524cde548639094a4d5ee156528f9ca4a
1 (in-package :sb-posix)
2 (defvar *designator-types* (make-hash-table :test #'equal))
4 (defmacro define-designator (name result &body conversions)
5 (let ((type `(quote (or ,@(mapcar #'car conversions))))
6 (typename (intern (format nil "~A-~A"
7 (symbol-name name)
8 (symbol-name :designator))
9 #.*package*)))
10 `(progn
11 (eval-when (:compile-toplevel :load-toplevel :execute)
12 (deftype ,typename () ,type)
13 (setf (gethash ',name *designator-types*) ',result))
14 (defun ,(intern (symbol-name name) :sb-posix) (,name)
15 (declare (type ,typename ,name))
16 (etypecase ,name
17 ,@conversions)))))