From 337933d8e2bb8516a03d19c338050fc7a828b217 Mon Sep 17 00:00:00 2001 Message-Id: <337933d8e2bb8516a03d19c338050fc7a828b217.1716577628.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 20 Jan 2002 14:09:52 +0000 Subject: [PATCH] Adding support for glib interfaces (GInterface) Organization: Straylight/Edgeware From: espen --- glib/glib-export.lisp | 3 ++- glib/gobject.lisp | 6 +++--- glib/gtype.lisp | 18 ++++++++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/glib/glib-export.lisp b/glib/glib-export.lisp index 21c269a..a884660 100644 --- a/glib/glib-export.lisp +++ b/glib/glib-export.lisp @@ -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") diff --git a/glib/gobject.lisp b/glib/gobject.lisp index 8c54999..2a11bce 100644 --- a/glib/gobject.lisp +++ b/glib/gobject.lisp @@ -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)))))) diff --git a/glib/gtype.lisp b/glib/gtype.lisp index 13c5c7e..8f8e3c0 100644 --- a/glib/gtype.lisp +++ b/glib/gtype.lisp @@ -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) -- [mdw]