summaryrefslogtreecommitdiff
path: root/Lisp/data-types.lisp
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-02-15 19:33:34 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-02-15 19:33:34 +0100
commit996fa5e19c1ec8603b99a4ce29b85b7af7468a78 (patch)
treea544291c00f53951ae979d8b1749212f0176919e /Lisp/data-types.lisp
parent30221c2f6a6384ddb6a3e8a9cc1f191f2791ce12 (diff)
Refine the public interface to Lisp-managed foreign structs and unions.
darcs-hash:b3c869d86d1e4655ec1562dade69cbdb93600eed
Diffstat (limited to 'Lisp/data-types.lisp')
-rw-r--r--Lisp/data-types.lisp37
1 files changed, 23 insertions, 14 deletions
diff --git a/Lisp/data-types.lisp b/Lisp/data-types.lisp
index 6726f70..91e10f3 100644
--- a/Lisp/data-types.lisp
+++ b/Lisp/data-types.lisp
@@ -232,23 +232,24 @@ an __exception__, you can simply send it the `self' message.
:documentation "Whether we need to handle deallocation.")))
-(defclass opaque-struct (foreign-value)
- ((name :type (or null string)
- :accessor struct-name
- :initarg :name)))
-
-(defclass tagged-struct (foreign-value)
- ((name :type (or null string)
- :accessor struct-name
- :initarg :name)
- (typespec :accessor foreign-value-typespec
- :initarg :typespec)))
+;; FIXME: Document.
+(defclass foreign-struct (foreign-value)
+ ((name :type (or null string)
+ :accessor struct-name
+ :initarg :name)))
-(defclass opaque-union (opaque-struct) ())
+;; The following are for private use only.
+(defclass opaque-struct (foreign-struct) ())
+(defclass tagged-struct (foreign-struct) ())
+(defclass opaque-union (opaque-struct) ())
(defclass tagged-union (tagged-struct) ())
-(defclass tagged-array (foreign-value)
+
+;; FIXME: Either document or throw away. (Does the C language actually
+;; support returning arrays from functions? It certainly does not
+;; support passing them as arguments.)
+(defclass foreign-array (foreign-value)
((element-type :type symbol
:accessor tagged-array-element-type
:initarg :element-type)
@@ -257,17 +258,25 @@ an __exception__, you can simply send it the `self' message.
(typespec :accessor foreign-value-typespec)))
+;; FIXME: Document.
(defgeneric foreign-value-lisp-managed-p (foreign-value))
(defmethod foreign-value-lisp-managed-p ((foreign-value foreign-value))
(with-slots (lisp-managed-cell) foreign-value
(aref lisp-managed-cell)))
+;; FIXME: Document.
(defgeneric (setf foreign-value-lisp-managed-p) (managedp foreign-value))
(defmethod (setf foreign-value-lisp-managed-p)
(managedp (foreign-value foreign-value))
(with-slots (lisp-managed-cell) foreign-value
- (setf (aref lisp-managed-cell) managedp)))
+ (setf (aref lisp-managed-cell) (if managedp t nil))))
+
+
+;; FIXME: Document.
+(defgeneric foreign-value-pointer (foreign-value))
+(defmethod foreign-value-pointer ((foreign-value foreign-value))
+ (pointer-to foreign-value))
(defun make-struct-wrapper (pointer typespec managedp)