From: Olof-Joachim Frahm Date: Sun, 26 Aug 2012 15:23:48 +0000 (+0200) Subject: Fix warnings for bare struct references in glib/. X-Git-Url: http://repo.macrolet.net/gitweb/?p=cl-gtk2.git;a=commitdiff_plain;h=44b7d0157ee74ec0565821064419b90cf0ab3050 Fix warnings for bare struct references in glib/. I.e. DEFCTYPE for every DEFCSTRUCT as well as for for generated and boxed types. --- diff --git a/glib/glib.glist.lisp b/glib/glib.glist.lisp index 1a8ff3c..686e9d0 100644 --- a/glib/glib.glist.lisp +++ b/glib/glib.glist.lisp @@ -16,6 +16,7 @@ (data :pointer) (next :pointer) (prev :pointer)) +(defctype g-list (:struct g-list)) (defcfun g-list-first (:pointer g-list) (list (:pointer g-list))) @@ -50,6 +51,7 @@ (defcstruct g-slist (data :pointer) (next :pointer)) +(defctype g-slist (:struct g-slist)) (defcfun g-slist-alloc (:pointer g-slist)) diff --git a/glib/glib.lisp b/glib/glib.lisp index bf6e9d6..9794185 100644 --- a/glib/glib.lisp +++ b/glib/glib.lisp @@ -201,8 +201,11 @@ In this example, for every @code{class}, @code{(initialize-gobject-class-g-type ;; Core Application Support - The Main Event Loop (defcstruct g-main-loop) +(defctype g-main-loop (:struct g-main-loop)) (defcstruct g-main-context) +(defctype g-main-context (:struct g-main-context)) (defcstruct g-source) +(defctype g-source (:struct g-source)) (defcstruct g-source-funcs (prepare :pointer) (check :pointer) @@ -210,23 +213,29 @@ In this example, for every @code{class}, @code{(initialize-gobject-class-g-type (finalize :pointer) (closure-callback :pointer) (closure-marshal :pointer)) +(defctype g-source-funcs (:struct g-source-funcs)) (defcstruct g-source-callback-funcs (ref :pointer) (unref :pointer) (get :pointer)) (defcstruct g-cond) +(defctype g-cond (:struct g-cond)) (defcstruct g-mutex) +(defctype g-mutex (:struct g-mutex)) (defcstruct g-poll-fd (fd :int) ;; TODO: #if defined (G_OS_WIN32) && GLIB_SIZEOF_VOID_P == 8 (events :ushort) (revent :ushort)) +(defctype g-poll-fd (:struct g-poll-fd)) (defcstruct g-time-val (seconds :long) (microseconds :long)) +(defctype g-time-val (:struct g-time-val)) (defcstruct g-thread) +(defctype g-thread (:struct g-thread)) (defcfun (g-main-loop-new "g_main_loop_new" :library glib) (:pointer g-main-loop) (context (:pointer g-main-context)) diff --git a/glib/gobject.boxed.lisp b/glib/gobject.boxed.lisp index 1445389..12f4cda 100644 --- a/glib/gobject.boxed.lisp +++ b/glib/gobject.boxed.lisp @@ -94,21 +94,25 @@ :slots (mapcar #'parse-cstruct-slot slots))) (defmacro define-g-boxed-cstruct (name g-type-name &body slots) - (let ((cstruct-description (parse-cstruct-definition name slots))) + (let ((cstruct-description (parse-cstruct-definition name slots)) + (cstruct-name (generated-cstruct-name name)) + (cunion-name (generated-cunion-name name))) `(progn (defstruct ,name ,@(iter (for slot in (cstruct-description-slots cstruct-description)) (for name = (cstruct-slot-description-name slot)) (for initform = (cstruct-slot-description-initform slot)) (collect (list name initform)))) - (defcstruct ,(generated-cstruct-name name) + (defcstruct ,cstruct-name ,@(iter (for slot in (cstruct-description-slots cstruct-description)) (for name = (cstruct-slot-description-name slot)) (for type = (cstruct-slot-description-type slot)) (for count = (cstruct-slot-description-count slot)) (collect `(,name ,type ,@(when count `(:count ,count)))))) - (defcunion ,(generated-cunion-name name) - (,name ,(generated-cstruct-name name))) + (defctype ,cstruct-name (:struct ,cstruct-name)) + (defcunion ,cunion-name + (,name ,cstruct-name)) + (defctype ,cunion-name (:union ,cunion-name)) (eval-when (:compile-toplevel :load-toplevel :execute) (setf (get ',name 'g-boxed-foreign-info) (make-g-boxed-cstruct-wrapper-info :name ',name @@ -380,22 +384,26 @@ (intern (format nil "~A-CUNION" (symbol-name symbol)) (symbol-package symbol))) (defun generate-cstruct-1 (struct) - `(defcstruct ,(generated-cstruct-name (cstruct-description-name struct)) - ,@(iter (for slot in (cstruct-description-slots struct)) - (collect `(,(cstruct-slot-description-name slot) ,(cstruct-slot-description-type slot) - ,@(when (cstruct-slot-description-count slot) - `(:count ,(cstruct-slot-description-count slot)))))))) + (let ((cstruct-name (generated-cstruct-name (cstruct-description-name struct)))) + `((defcstruct ,cstruct-name + ,@(iter (for slot in (cstruct-description-slots struct)) + (collect `(,(cstruct-slot-description-name slot) ,(cstruct-slot-description-type slot) + ,@(when (cstruct-slot-description-count slot) + `(:count ,(cstruct-slot-description-count slot))))))) + (defctype ,cstruct-name (:struct ,cstruct-name))))) (defun generate-c-structures (structure) (iter (for str in (all-structures structure)) (for cstruct = (var-structure-resulting-cstruct-description str)) - (collect (generate-cstruct-1 cstruct)))) + (nconcing (generate-cstruct-1 cstruct)))) (defun generate-variant-union (struct) - `(defcunion ,(generated-cunion-name (var-structure-name struct)) - ,@(iter (for str in (all-structures struct)) - (collect `(,(var-structure-name str) - ,(generated-cstruct-name (var-structure-name str))))))) + (let ((cunion-name (generated-cunion-name (var-structure-name struct)))) + `((defcunion ,cunion-name + ,@(iter (for str in (all-structures struct)) + (collect `(,(var-structure-name str) + ,(generated-cstruct-name (var-structure-name str)))))) + (defctype ,cunion-name (:union ,cunion-name))))) (defun generate-structure-1 (str) (let ((name (var-structure-name str))) @@ -480,7 +488,7 @@ (defmacro define-g-boxed-variant-cstruct (name g-type-name &body slots) (let* ((structure (parse-variant-structure-definition name slots))) `(progn ,@(generate-c-structures structure) - ,(generate-variant-union structure) + ,@(generate-variant-union structure) ,@(generate-structures structure) (eval-when (:compile-toplevel :load-toplevel :execute) (setf (get ',name 'g-boxed-foreign-info) diff --git a/glib/gobject.ffi.lisp b/glib/gobject.ffi.lisp index cb74528..8f20486 100644 --- a/glib/gobject.ffi.lisp +++ b/glib/gobject.ffi.lisp @@ -99,12 +99,15 @@ Example: (defcstruct g-type-interface (:type g-type-designator) (:instance-type g-type-designator)) +(defctype g-type-interface (:struct g-type-interface)) (defcstruct g-type-class (:type g-type-designator)) +(defctype g-type-class (:struct g-type-class)) (defcstruct g-type-instance (:class (:pointer g-type-class))) +(defctype g-type-instance (:struct g-type-instance)) (defcstruct g-type-info (:class-size :uint16) @@ -117,12 +120,14 @@ Example: (:n-preallocs :uint16) (:instance-init-fn :pointer) (:value-table :pointer)) +(defctype g-type-info (:struct g-type-info)) (defcstruct g-type-query (:type g-type-designator) (:type-name (:string :free-from-foreign nil)) (:class-size :uint) (:instance-size :uint)) +(defctype g-type-query (:struct g-type-query)) (defbitfield g-type-fundamental-flags :classed @@ -132,11 +137,13 @@ Example: (defcstruct g-type-fundamental-info (:type-flags g-type-fundamental-flags)) +(defctype g-type-fundamental-info (:struct g-type-fundamental-info)) (defcstruct g-interface-info (:interface-init :pointer) (:interface-finalize :pointer) (:interface-data :pointer)) +(defctype g-interface-info (:struct g-interface-info)) (defcstruct g-type-value-table (:value-init :pointer) @@ -147,6 +154,7 @@ Example: (:collect-value :pointer) (:lcopy-format (:string :free-from-foreign nil :free-to-foreign nil)) (:lcopy-value :pointer)) +(defctype g-type-value-table (:struct g-type-value-table)) (defbitfield g-type-flags (:abstract #. (ash 1 4)) @@ -156,8 +164,9 @@ Example: (:type-instance g-type-instance) (:ref-count :uint) (:data :pointer)) +(defctype %g-object (:struct %g-object)) -(defctype %g-initially-unowned %g-object) +(defctype %g-initially-unowned (:struct %g-object)) (defcstruct g-object-class (:type-class g-type-class) @@ -171,6 +180,7 @@ Example: (:notify :pointer) (:constructed :pointer) (:pdummy :pointer :count 7)) +(defctype g-object-class (:struct g-object-class)) (defbitfield g-param-flags :readable @@ -188,6 +198,7 @@ Example: (:flags g-param-flags) (:value-type g-type-designator) (:owner-type g-type-designator)) +(defctype g-param-spec (:struct g-param-spec)) (defcunion g-value-data (:int :int) @@ -199,23 +210,28 @@ Example: (:float :float) (:double :double) (:pointer :pointer)) +(defctype g-value-data (:union g-value-data)) (defcstruct g-value (:type g-type-designator) (:data g-value-data :count 2)) +(defctype g-value (:struct g-value)) (defcstruct g-object-construct-param (:param-spec (:pointer g-param-spec)) (:value (:pointer g-value))) +(defctype g-object-construct-param (:struct g-object-construct-param)) (defcstruct g-parameter (:name (:string :free-from-foreign nil :free-to-foreign nil)) (:value g-value)) +(defctype g-parameter (:struct g-parameter)) (defcstruct g-enum-value (:value :int) (:name (:string :free-from-foreign nil :free-to-foreign nil)) (:nick (:string :free-from-foreign nil :free-to-foreign nil))) +(defctype g-enum-value (:struct g-enum-value)) (defcstruct g-enum-class (:type-class g-type-class) @@ -223,69 +239,81 @@ Example: (:maximum :int) (:n-values :uint) (:values (:pointer g-enum-value))) +(defctype g-enum-class (:struct g-enum-class)) (defcstruct g-flags-value (:value :uint) (:name (:string :free-from-foreign nil :free-to-foreign nil)) (:nick (:string :free-from-foreign nil :free-to-foreign nil))) +(defctype g-flags-value (:struct g-flags-value)) (defcstruct g-flags-class (:type-class g-type-class) (:mask :uint) (:n-values :uint) (:values (:pointer g-flags-value))) +(defctype g-flags-class (:struct g-flags-class)) (defcstruct g-param-spec-boolean (:parent-instance g-param-spec) (:default-value :boolean)) +(defctype g-param-spec-boolean (:struct g-param-spec-boolean)) (defcstruct g-param-spec-char (:parent-instance g-param-spec) (:minimum :int8) (:maximum :int8) (:default-value :int8)) +(defctype g-param-spec-char (:struct g-param-spec-char)) (defcstruct g-param-spec-uchar (:parent-instance g-param-spec) (:minimum :uint8) (:maximum :uint8) (:default-value :uint8)) +(defctype g-param-spec-uchar (:struct g-param-spec-uchar)) (defcstruct g-param-spec-int (:parent-instance g-param-spec) (:minimum :int) (:maximum :int) (:default-value :int)) +(defctype g-param-spec-int (:struct g-param-spec-int)) (defcstruct g-param-spec-uint (:parent-instance g-param-spec) (:minimum :uint) (:maximum :uint) (:default-value :uint)) +(defctype g-param-spec-uint (:struct g-param-spec-uint)) (defcstruct g-param-spec-long (:parent-instance g-param-spec) (:minimum :long) (:maximum :long) (:default-value :ulong)) +(defctype g-param-spec-long (:struct g-param-spec-long)) (defcstruct g-param-spec-ulong (:parent-instance g-param-spec) (:minimum :ulong) (:maximum :ulong) (:default-value :ulong)) +(defctype g-param-spec-ulong (:struct g-param-spec-ulong)) (defcstruct g-param-spec-int64 (:parent-instance g-param-spec) (:minimum :uint64) (:maximum :uint64) (:default-value :uint64)) +(defctype g-param-spec-int64 (:struct g-param-spec-int64)) (defcstruct g-param-spec-uint64 (:parent-instance g-param-spec) (:minimum :uint64) (:maximum :uint64) (:default-value :uint64)) +(defctype g-param-spec-uint64 (:struct g-param-spec-uint64)) (defcstruct g-param-spec-float (:parent-instance g-param-spec) @@ -293,6 +321,7 @@ Example: (:maximum :float) (:default-value :float) (:epsilon :float)) +(defctype g-param-spec-float (:struct g-param-spec-float)) (defcstruct g-param-spec-double (:parent-instance g-param-spec) @@ -300,16 +329,19 @@ Example: (:maximum :double) (:default-value :double) (:epsilon :double)) +(defctype g-param-spec-double (:struct g-param-spec-double)) (defcstruct g-param-spec-enum (:parent-instance g-param-spec) (:enum-class (:pointer g-enum-class)) (:default-value :int)) +(defctype g-param-spec-enum (:struct g-param-spec-enum)) (defcstruct g-param-spec-flags (:parent-instance g-param-spec) (:flags-class (:pointer g-flags-class)) (:default-value :uint)) +(defctype g-param-spec-flags (:struct g-param-spec-flags)) (defcstruct g-param-spec-string (:parent-instance g-param-spec) @@ -318,27 +350,34 @@ Example: (:cset-nth (:string :free-to-foreign nil :free-from-foreign nil)) (:substitutor :char) (:flags-for-null :uint)) +(defctype g-param-spec-string (:struct g-param-spec-string)) (defcstruct g-param-spec-param (:parent-instance g-param-spec)) +(defctype g-param-spec-param (:struct g-param-spec-param)) (defcstruct g-param-spec-boxed (:parent-instance g-param-spec)) +(defctype g-param-spec-boxed (:struct g-param-spec-boxed)) (defcstruct g-param-spec-pointer (:parent-instance g-param-spec)) +(defctype g-param-spec-pointer (:struct g-param-spec-pointer)) (defcstruct g-param-spec-object (:parent-instance g-param-spec)) +(defctype g-param-spec-object (:struct g-param-spec-object)) (defcstruct g-param-spec-value-array (:parent-instance g-param-spec) (:element-spec (:pointer g-param-spec)) (:fixed-n-elements :uint)) +(defctype g-param-spec-value-array (:struct g-param-spec-value-array)) (defcstruct g-param-spec-g-type (:parent-instance g-param-spec) (:types-root g-type-designator)) +(defctype g-param-spec-g-type (:struct g-param-spec-g-type)) (defcstruct g-param-spec-class (:type-class g-type-class) @@ -347,12 +386,14 @@ Example: (:value-set-default :pointer) (:value-validate :pointer) (:values-cmp :pointer)) +(defctype g-param-spec-class (:struct g-param-spec-class)) (defcstruct g-closure (:private-data :uint32) (:marshal :pointer) (:data :pointer) (:notifiers :pointer)) +(defctype g-closure (:struct g-closure)) (defcfun g-type-class-ref (:pointer g-type-class) (type g-type-designator)) @@ -941,6 +982,7 @@ Example: (:return-type (g-type-designator :mangled-p t)) (:n-params :uint) (:param-types (:pointer (g-type-designator :mangled-p t)))) +(defctype g-signal-query (:struct g-signal-query)) (defcfun g-signal-query :void (signal-id :uint) @@ -961,3 +1003,4 @@ Example: (:type-instance g-type-instance) (:ref-count :uint) (:qdata :pointer)) +(defctype g-object-struct (:struct g-object-struct)) diff --git a/glib/gobject.object-function.lisp b/glib/gobject.object-function.lisp index 7c17faf..a3cf4b9 100644 --- a/glib/gobject.object-function.lisp +++ b/glib/gobject.object-function.lisp @@ -3,6 +3,7 @@ (defcstruct object-func-ref (:object :pointer) (:fn-id :int)) +(defctype object-func-ref (:struct object-func-ref)) (defmacro define-cb-methods (name return-type (&rest args)) (flet ((make-name (control-string) (intern (format nil control-string (symbol-name name)) (symbol-package name)))) diff --git a/glib/gobject.signals.lisp b/glib/gobject.signals.lisp index 99d77e5..3d6925d 100644 --- a/glib/gobject.signals.lisp +++ b/glib/gobject.signals.lisp @@ -6,6 +6,7 @@ (:parent-instance g-closure) (:object :pointer) (:function-id :int)) +(defctype lisp-signal-handler-closure (:struct lisp-signal-handler-closure)) (defun finalize-lisp-signal-handler-closure (closure) (let* ((function-id (foreign-slot-value closure 'lisp-signal-handler-closure :function-id))