Adding support for glib interfaces (GInterface)
authorespen <espen>
Sun, 20 Jan 2002 14:09:52 +0000 (14:09 +0000)
committerespen <espen>
Sun, 20 Jan 2002 14:09:52 +0000 (14:09 +0000)
glib/glib-export.lisp
glib/gobject.lisp
glib/gtype.lisp

index 21c269a..a884660 100644 (file)
@@ -15,7 +15,7 @@
 ;; License along with this library; if not, write to the Free Software
 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-;; $Id: glib-export.lisp,v 1.5 2001-05-11 16:11:07 espen Exp $
+;; $Id: glib-export.lisp,v 1.6 2002-01-20 14:09:52 espen Exp $
 
 
 ;;; Autogenerating exported symbols
@@ -44,5 +44,6 @@
 (export-from-file #p"clg:glib;gtype.lisp")
 (export-from-file #p"clg:glib;gparam.lisp")
 (export-from-file #p"clg:glib;gcallback.lisp")
+(export-from-file #p"clg:glib;ginterface.lisp")
 (export-from-file #p"clg:glib;gobject.lisp")
 (export-from-file #p"clg:glib;genums.lisp")
index 8c54999..2a11bce 100644 (file)
@@ -15,7 +15,7 @@
 ;; License along with this library; if not, write to the Free Software
 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-;; $Id: gobject.lisp,v 1.9 2001-10-21 21:52:53 espen Exp $
+;; $Id: gobject.lisp,v 1.10 2002-01-20 14:09:52 espen Exp $
 
 (in-package "GLIB")
 
 
 (defun expand-gobject-type (type-number &optional options
                            (metaclass 'gobject-class))
-  (let* ((super (supertype type-number))
+  (let* ((supers (cons (supertype type-number) (implements type-number)))
         (class  (type-from-number type-number))
         (override-slots (getf options :slots))
         (expanded-slots
          (push slot-def expanded-slots))))
     
     `(progn
-       (defclass ,class (,super)
+       (defclass ,class ,supers
         ,expanded-slots
         (:metaclass ,metaclass)
         (:alien-name ,(find-type-name type-number))))))
index 13c5c7e..8f8e3c0 100644 (file)
@@ -15,7 +15,7 @@
 ;; License along with this library; if not, write to the Free Software
 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-;; $Id: gtype.lisp,v 1.14 2002-01-14 01:16:08 espen Exp $
+;; $Id: gtype.lisp,v 1.15 2002-01-20 14:09:52 espen Exp $
 
 (in-package "GLIB")
 
 (defun supertype (type)
   (type-from-number (type-parent type)))
 
+(defbinding %type-interfaces (type) pointer
+  ((find-type-number type t) type-number)
+  (n-interfaces unsigned-int :out))
+
+(defun type-interfaces (type)
+  (multiple-value-bind (array length) (%type-interfaces type)
+    (unwind-protect
+       (map-c-array 'list #'identity array 'type-number length)
+      (deallocate-memory array))))
+
+(defun implements (type)
+  (mapcar #'type-from-number (type-interfaces type)))
+
 (defun type-hierarchy (type)
   (let ((type-number (find-type-number type t)))
     (unless (= type-number 0)
   (let ((sorted ()))
     (loop while unsorted do
       (dolist (type unsorted)
-       (let ((dependencies (rest (type-hierarchy type))))
+       (let ((dependencies
+              (append (rest (type-hierarchy type)) (type-interfaces type))))
          (cond
           ((null dependencies)
            (push type sorted)