chiark / gitweb /
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 87c3da4b3156eda8ef681911aa4b2f8af9c79b5e..f26e0b6789d2e2f01fbae077541508163f81c3c2 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;gboxed.lisp")
 (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 1611fdab47d6926f83435a181e905954f0ffe4ca..b42ee7ddb25c2eeca66dc6e7c823ee304ba4915d 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")
 
@@ -201,7 +201,7 @@ (defun default-slot-accessor (class-name slot-name type)
 
 (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
@@ -251,7 +251,7 @@                      (default-slot-accessor class slot-name slot-type)))
          (push slot-def expanded-slots))))
     
     `(progn
-       (defclass ,class (,super)
+       (defclass ,class ,supers
         ,expanded-slots
         (:metaclass ,metaclass)
         (:alien-name ,(find-type-name type-number))))))
index 8d22bbbe0966fc65d6cd2122a22deecba5a6d9bf..dc78d6a014bb4a81fda7f1e4e8e0f2540256bcf3 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")
 
@@ -244,6 +244,19 @@ (defbinding type-parent (type) type-number
 (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)
@@ -288,7 +301,8 @@ (defun %sort-types-topologicaly (unsorted)
   (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)