chiark / gitweb /
Custom types are now re-registered when a saved image is loaded
[clg] / glib / ffi.lisp
index d57069698ea803d8c94ca0a8218ec4d3acd719c0..4a47c7e1b39cc41751c25af686f3f5a6a5c3c782 100644 (file)
@@ -20,7 +20,7 @@
 ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-;; $Id: ffi.lisp,v 1.28 2006/02/26 16:12:25 espen Exp $
+;; $Id: ffi.lisp,v 1.30 2006/03/03 20:31:24 espen Exp $
 
 (in-package "GLIB")
 
@@ -348,8 +348,9 @@ (defmacro define-type-generic (name lambda-list &optional documentation)
        (find (first lambda-list) '(&optional &key &rest &allow-other-keys)))
       (error "A type generic needs at least one required argument")
     `(progn 
-       (setf (get ',name 'type-methods) (make-hash-table))
-       (setf (get ',name 'built-in-type-hierarchy) ())
+       (unless (get ',name 'type-methods)
+        (setf (get ',name 'type-methods) (make-hash-table))
+        (setf (get ',name 'built-in-type-hierarchy) ()))
        (defun ,name ,lambda-list
         ,documentation
         (funcall 
@@ -1055,6 +1056,15 @@ (define-type-method from-alien-form ((type copy-of) form)
 (define-type-method from-alien-function ((type copy-of))
   (copy-from-alien-function (second (type-expand-to 'copy-of type))))
 
+(define-type-method cleanup-function ((type copy-of))
+  (declare (ignore type))
+  #'identity)
+
+(define-type-method destroy-function ((type copy-of))
+  (declare (ignore type))
+  #'(lambda (location &optional offset)
+      (declare (ignore location offset))))
+
 
 (define-type-method alien-type ((type callback))
   (declare (ignore type))