;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-;; $Id: gtype.lisp,v 1.58 2006-08-31 20:40:56 espen Exp $
+;; $Id: gtype.lisp,v 1.62 2007-06-06 10:43:54 espen Exp $
(in-package "GLIB")
(defbinding type-init () nil)
(type-init)
-(deftype type-number () 'unsigned-long)
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (defbinding (bitsize-of-gtype "bitsize_of_gtype") () unsigned-int))
+
+(deftype type-number () `(unsigned-byte ,(bitsize-of-gtype)))
(deftype gtype () 'symbol)
while line
when (and
symbol (> (length symbol) 9)
+ (not (char= (char symbol 0) #\_))
(or
(not prefixes)
(some #'(lambda (prefix)
process)))))
-(defmacro init-types-in-library (filename &key prefix ignore)
- (let ((names (%find-types-in-library filename prefix ignore)))
+(defmacro init-types-in-library (system library &key prefix ignore)
+ (let* ((filename (asdf:component-pathname (asdf:find-component (asdf:find-system system) library)))
+ (names (%find-types-in-library filename prefix ignore)))
`(progn
,@(mapcar #'(lambda (name)
`(progn
;;;; Superclass for wrapping types in the glib type system
(eval-when (:compile-toplevel :load-toplevel :execute)
- (defclass ginstance (proxy)
+ (defclass ginstance (ref-counted-object)
(;(class :allocation :alien :type pointer :offset 0)
)
(:metaclass proxy-class)
(error "Object at ~A has an unkown type number: ~A"
location (%type-number-of-ginstance location)))))
-(define-type-method from-alien-form ((type ginstance) form &key (ref :copy))
- (call-next-method type form :ref ref))
-
-(define-type-method from-alien-function ((type ginstance) &key (ref :copy))
- (call-next-method type :ref ref))
-
;;;; Registering fundamental types
;; The argument is a list where each elements is on the form
;; (type . dependencies). This function will not handle indirect
-;; dependencies and types depending on them selve.
+;; dependencies and types depending on them selves.
(defun sort-types-topologicaly (unsorted)
(flet ((depend-p (type1)
(find-if #'(lambda (type2)
;;;; Initialize all non static types in GObject
-(init-types-in-library #.(concatenate 'string (pkg-config:pkg-variable "glib-2.0" "libdir") "/libgobject-2.0." asdf:*dso-extension*))
+(init-types-in-library glib "libgobject-2.0")