docstrings and g-type-designator
authorDmitry Kalyanov <Kalyanov.Dmitry@gmail.com>
Sat, 11 Jul 2009 00:25:53 +0000 (04:25 +0400)
committerDmitry Kalyanov <Kalyanov.Dmitry@gmail.com>
Sat, 11 Jul 2009 00:25:53 +0000 (04:25 +0400)
glib/glib.lisp
glib/gobject.boxed.lisp
glib/gobject.enum.lisp
glib/gobject.foreign-gobject.lisp
glib/gobject.gobject-query.lisp
glib/gobject.gparams.lisp
glib/gobject.gvalue-parser.lisp
glib/gobject.gvalue.lisp
glib/gobject.object.lisp
glib/gobject.package.lisp
glib/gobject.type.lisp

index 874548d..1103420 100644 (file)
         (funcall fn)))
 
 (defmacro at-init ((&rest keys) &body body)
-  "@arg[body]{the code}
+  "
+@arg[keys]{list of expression}
+@arg[body]{the code}
 Runs the code normally but also schedules the code to be run at image load time.
-It is used to reinitialize the libraries when the dumped image is loaded. (Works only on SBCL for now)
+It is used to reinitialize the libraries when the dumped image is loaded. (Works only on SBCL for now).
+
+At-init form may be called multiple times. The same code from should not be run multiple times at initialization time (in best case, this will only slow down initialization, in worst case, the code may crash). To ensure this, every @code{at-init} expression is added to hash-table with the @code{body} and @code{keys} as a composite key. This ensures that the same code is only executed once (once on the same set of parameters).
+
+Example:
+@begin{pre}
+\(defmethod initialize-instance :after ((class gobject-class) &key &allow-other-keys)
+  (register-object-type (gobject-class-g-type-name class) (class-name class))
+  (at-init (class) (initialize-gobject-class-g-type class)))
+@end{pre}
+
+In this example, for every @code{class}, @code{(initialize-gobject-class-g-type class)} will be called only once.
 "
   `(progn (register-initializer (list ,@keys ',body) (lambda () ,@body))
           ,@body))
index 80c96c4..aecec85 100644 (file)
@@ -1,17 +1,17 @@
 (in-package :gobject)
 
 (defcfun g-boxed-copy :pointer
-  (boxed-type g-type)
+  (boxed-type g-type-designator)
   (src-boxed :pointer))
 
 (defcfun g-boxed-free :void
-  (boxed-type g-type)
+  (boxed-type g-type-designator)
   (boxed :pointer))
 
-(defcfun g-boxed-type-register-static g-type
+(defcfun g-boxed-type-register-static g-type-designator
   (name :string)
   (copy-fn :pointer)
   (free-fn :pointer))
 
-(defcfun g-pointer-type-register-static g-type
+(defcfun g-pointer-type-register-static g-type-designator
   (name :string))
\ No newline at end of file
index ad8bf6c..ed86b28 100644 (file)
@@ -1,9 +1,9 @@
 (in-package :gobject)
 
-(defcfun g-enum-register-static g-type
+(defcfun g-enum-register-static g-type-designator
   (name :string)
   (static-values (:pointer g-enum-value)))
 
-(defcfun g-flags-register-static g-type
+(defcfun g-flags-register-static g-type-designator
   (name :string)
   (static-values (:pointer g-flags-value)))
\ No newline at end of file
index 2e64dd1..503fe00 100644 (file)
 (defun registered-object-type-by-name (name)
   (gethash name *registered-object-types*))
 (defun get-g-object-lisp-type (g-type)
+  (setf g-type (ensure-g-type g-type))
   (loop
      while (not (zerop g-type))
      for lisp-type = (gethash (g-type-name g-type) *registered-object-types*)
      when lisp-type do (return lisp-type)
-     do (setf g-type (g-type-parent g-type))))
+     do (setf g-type (ensure-g-type (g-type-parent g-type)))))
 
 (defun make-g-object-from-pointer (pointer)
   (let* ((g-type (g-type-from-instance pointer))
 
 (defun g-object-call-constructor (object-type args-names args-values
                                   &optional args-types)
-  (setf object-type (ensure-g-type object-type))
   (unless args-types
     (setf args-types
           (mapcar (lambda (name)
index 2937f58..6753d53 100644 (file)
@@ -1,6 +1,19 @@
 (in-package :gobject)
 
 (defstruct g-class-property-definition
+  "Structure describing property of a GObject class.
+
+See accessor functions:
+@itemize{
+@item{@fun{g-class-property-definition-name}}
+@item{@fun{g-class-property-definition-type}}
+@item{@fun{g-class-property-definition-readable}}
+@item{@fun{g-class-property-definition-writable}}
+@item{@fun{g-class-property-definition-constructor}}
+@item{@fun{g-class-property-definition-constructor-only}}
+@item{@fun{g-class-property-definition-owner-type}}
+}
+"
   name
   type
   readable
@@ -9,6 +22,34 @@
   constructor-only
   owner-type)
 
+(setf (documentation 'g-class-property-definition-name 'function)
+      "Name of GObject class property. See @class{g-class-property-definition}.
+@return{a string}")
+
+(setf (documentation 'g-class-property-definition-type 'function)
+      "Type of GObject class property. See @class{g-class-property-definition}.
+@return{a GType (integer)}")
+
+(setf (documentation 'g-class-property-definition-readable 'function)
+      "Whether the GObject class property is readable. See @class{g-class-property-definition}.
+@return{a boolean}")
+
+(setf (documentation 'g-class-property-definition-writable 'function)
+      "Whether the GObject class property is writable. See @class{g-class-property-definition}.
+@return{a boolean}")
+
+(setf (documentation 'g-class-property-definition-constructor 'function)
+      "Whether the GObject class property can be set at object construction time. See @class{g-class-property-definition}.
+@return{a boolean}")
+
+(setf (documentation 'g-class-property-definition-constructor-only 'function)
+      "Whether the GObject class property can only be set at object construction time. See @class{g-class-property-definition}.
+@return{a boolean}")
+
+(setf (documentation 'g-class-property-definition-owner-type 'function)
+      "The GType on which this GObject class property was defined. See @class{g-class-property-definition}.
+@return{a GType (integer)}")
+
 (defun parse-g-param-spec (param)
   (let ((flags (foreign-slot-value param 'g-param-spec 'flags)))
     (make-g-class-property-definition
@@ -24,6 +65,8 @@
                                      'owner-type))))
 
 (defun class-properties (g-type)
+  "@return{list of properties of GObject class @code{g-type}. Each property is described by an object of type @class{g-class-property-definition}.}
+@arg[g-type]{an integer or a string specifying the GType}"
   (setf g-type (ensure-g-type g-type))
   (let ((g-class (g-type-class-ref g-type)))
     (unwind-protect
@@ -41,6 +84,8 @@
   (g-type-parent (ensure-g-type type)))
 
 (defun interface-properties (g-type)
+"@return{list of properties of GObject interface @code{g-type}. Each property is described by an object of type @class{g-class-property-definition}.}
+@arg[g-type]{an integer or a string specifying the GType}"
   (setf g-type (ensure-g-type g-type))
   (let ((g-iface (g-type-default-interface-ref g-type)))
     (unwind-protect
       (g-type-default-interface-unref g-iface))))
 
 (defstruct enum-item
+  "A structure describing a single enumeration item.
+
+See accessor functions:
+@itemize{
+@item{@fun{enum-item-name}}
+@item{@fun{enum-item-value}}
+@item{@fun{enum-item-nick}}
+}"
   name value nick)
 
+(setf (documentation 'enum-item-name 'function)
+      "The C name of enum item, e.g. \"GTK_WINDOW_TOPLEVEL\".
+@return{a string}")
+
+(setf (documentation 'enum-item-value 'function)
+      "The numeric value of enum item.
+@return{an integer}")
+
+(setf (documentation 'enum-item-nick 'function)
+      "The \"nickname\" of enum item. Nickname is a short name of enum item. E.g., \"toplevel\".
+@return{a string}")
+
 (defun get-enum-items (type)
+  "Gets the list of enum items that belong to GEnum type @code{type}
+@arg[type]{a string or an integer specifying GEnum type}
+@return{a list of @class{enum-item} objects}"
   (let ((g-class (g-type-class-ref (ensure-g-type type))))
     (unwind-protect
          (loop
       (g-type-class-unref g-class))))
 
 (defstruct flags-item
+  "A structure describing a single flags item.
+
+See accessor functions:
+@itemize{
+@item{@fun{flags-item-name}}
+@item{@fun{flags-item-value}}
+@item{@fun{flags-item-nick}}
+}"
   name value nick)
 
+(setf (documentation 'flags-item-name 'function)
+      "The C name of flags item, e.g. \"GDK_PROPERTY_CHANGE_MASK\".
+@return{a string}")
+
+(setf (documentation 'flags-item-value 'function)
+      "The numeric value of flags item.
+@return{an integer}")
+
+(setf (documentation 'flags-item-nick 'function)
+      "The \"nickname\" of flags item. Nickname is a short name of flags item. E.g., \"property-change-mask\".
+@return{a string}")
+
 (defun get-flags-items (type)
+  "Gets the list of flags items that belong to GFlags type @code{type}
+@arg[type]{a string or an integer specifying GFlags type}
+@return{a list of @class{flags-item} objects}"
   (let ((g-class (g-type-class-ref (ensure-g-type type))))
     (unwind-protect
          (loop
index e99b452..9f93478 100644 (file)
   (name :string)
   (nick :string)
   (blurb :string)
-  (enum-type g-type)
+  (enum-type g-type-designator)
   (default-value :int)
   (flags g-param-flags))
 
   (name :string)
   (nick :string)
   (blurb :string)
-  (flags-type g-type)
+  (flags-type g-type-designator)
   (default-value :int)
   (flags g-param-flags))
 
   (name :string)
   (nick :string)
   (blurb :string)
-  (param-type g-type)
+  (param-type g-type-designator)
   (flags g-param-flags))
 
 (defcfun g-value-set-param :void
   (name :string)
   (nick :string)
   (blurb :string)
-  (boxed-type g-type)
+  (boxed-type g-type-designator)
   (flags g-param-flags))
 
 (defcfun g-value-set-boxed :void
   (name :string)
   (nick :string)
   (blurb :string)
-  (object-type g-type)
+  (object-type g-type-designator)
   (flags g-param-flags))
 
 (defcfun g-value-set-object :void
   (name :string)
   (nick :string)
   (blurb :string)
-  (types-root g-type)
+  (types-root g-type-designator)
   (flags g-param-flags))
 
 (defcfun (g-value-set-g-type "g_value_set_gtype") :void
   (g-value (:pointer g-value))
-  (new-value g-type))
+  (new-value g-type-designator))
 
-(defcfun (g-value-get-g-type "g_value_get_gtype") g-type
+(defcfun (g-value-get-g-type "g_value_get_gtype") g-type-designator
   (g-value (:pointer g-value)))
 
 (defcfun g-param-spec-ref-sink (:pointer g-param-spec)
index 212992f..f06ea41 100644 (file)
 
 @arg[value]{a C pointer to the GValue structure}
 @return{value contained in the GValue structure. Type of value depends on GValue type}"
-  (let* ((type (gvalue-type gvalue))
-         (fundamental-type (g-type-fundamental type)))
+  (let* ((type (ensure-g-type (gvalue-type gvalue)))
+         (fundamental-type (ensure-g-type (g-type-fundamental type))))
     (cond
-      ((= type (g-strv-get-type)) (convert-from-foreign (g-value-get-boxed gvalue) '(glib:gstrv :free-from-foreign nil)))
+      ((= type (ensure-g-type (g-strv-get-type))) (convert-from-foreign (g-value-get-boxed gvalue) '(glib:gstrv :free-from-foreign nil)))
       (t (ev-case fundamental-type
            (+g-type-invalid+ (error "GValue is of invalid type (~A)" (g-type-name type)))
            (+g-type-void+ nil)
 @arg[zero-g-value]{a boolean specifying whether GValue should be zero-initialized before assigning. See @fun{g-value-zero}}
 @arg[unset-g-value]{a boolean specifying whether GValue should be \"unset\" before assigning. See @fun{g-value-unset}. The \"true\" value should not be passed to both @code{zero-g-value} and @code{unset-g-value} arguments}
 @arg[g-value-init]{a boolean specifying where GValue should be initialized}"
+  (setf type (ensure-g-type type))
   (cond
     (zero-g-value (g-value-zero gvalue))
     (unset-g-value (g-value-unset gvalue)))
   (when g-value-init (g-value-init gvalue type))
-  (let ((fundamental-type (g-type-fundamental type)))
+  (let ((fundamental-type (ensure-g-type (g-type-fundamental type))))
     (cond
-      ((= type (g-strv-get-type)) (g-value-set-boxed gvalue (convert-to-foreign value 'glib:gstrv)))
+      ((= type (ensure-g-type (g-strv-get-type))) (g-value-set-boxed gvalue (convert-to-foreign value 'glib:gstrv)))
       (t (ev-case fundamental-type
            (+g-type-invalid+ (error "Invalid type (~A)" type))
            (+g-type-void+ nil)
index 4162ee7..b5c92b9 100644 (file)
@@ -6,7 +6,7 @@
 @arg[value]{a C pointer to the GValue structure}
 @arg[type]{an integer specifying the GType}"
   (value (:pointer g-value))
-  (type g-type))
+  (type g-type-designator))
 
 (defun g-value-zero (g-value)
   "Initializes the GValue in \"unset\" state.
index cb9abec..4ae1038 100644 (file)
@@ -31,7 +31,7 @@
   (n-properties (:pointer :uint)))
 
 (defcfun g-object-newv :pointer
-  (object-type g-type)
+  (object-type g-type-designator)
   (n-parameter :uint)
   (parameters (:pointer g-parameter)))
 
index b02a772..ccd59c4 100644 (file)
@@ -1,6 +1,27 @@
 (defpackage :gobject
   (:use :cl :glib :cffi :tg :bordeaux-threads :iter :closer-mop)
-  (:export #:g-object
+  (:export #:+g-type-invalid+
+           #:+g-type-void+
+           #:+g-type-interface+
+           #:+g-type-char+
+           #:+g-type-uchar+
+           #:+g-type-boolean+
+           #:+g-type-int+
+           #:+g-type-uint+
+           #:+g-type-long+
+           #:+g-type-ulong+
+           #:+g-type-int64+
+           #:+g-type-uint64+
+           #:+g-type-enum+
+           #:+g-type-flags+
+           #:+g-type-float+
+           #:+g-type-double+
+           #:+g-type-string+
+           #:+g-type-pointer+
+           #:+g-type-boxed+
+           #:+g-type-param+
+           #:+g-type-object+
+           #:g-object
            #:pointer
            #:g-type-from-object
            #:g-type-name
            #:g-class-property-definition-constructor
            #:g-class-property-definition-constructor-only
            #:g-class-property-definition-owner-type
+           #:class-properties
+           #:interface-properties
+           #:enum-item
+           #:enum-item-name
+           #:enum-item-value
+           #:enum-item-nick
+           #:get-enum-types
+           #:flags-item
+           #:flags-item-name
+           #:flags-item-value
+           #:flags-item-nick
+           #:get-flags-types
            #:g-type-class-ref
            #:g-object-class
            #:gobject-class
            #:g-signal-lookup
            #:g-type-parent
            #:connect-signal
-           #:boxed-c-structure-name)
+           #:boxed-c-structure-name
+           #:g-type-designator
+           #:g-type-fundamental
+           #:g-type-depth
+           #:g-type-next-base
+           #:g-type-is-a
+           #:g-type-interfaces
+           #:g-type-interface-prerequisites)
   (:documentation
-"This package contains bindings to GLib object system called GObject.
+   "CL-GTK2-GOBJECT is a binding to GObject type system.
+For information on GObject, see its @a[http://library.gnome.org/devel/gobject/stable/]{documentation}.
 
-It contains:
+CL-GTK2-GOBJECT is structured as follows:
+@itemize{
+@item{Binding to GObject API, providing low-level means to use functionality of GObject. This includes introspection facilities and means to invoke functionality of GObject.}
+@item{GObject wrapper that bridges Lisp language with GObject API.}
+}
+
+@begin[GObject instrospection API]{section}
+The base of GObject type system is GType. GType is a numerical value that is the unique identifier of a registered type.
+Each GType has a name that is retrieved with @fun{g-type-name}. Conversely, GType can be retrieved from its name via @fun{g-type-from-name}.
+
+There are several predefined GType values that correspond to fundamental or base types.
 @begin{itemize}
-@item{type system}
-@item{object system}
-@item{utilities for memory management}
+@item{@variable{+g-type-invalid+}}
+@item{@variable{+g-type-void+}}
+@item{@variable{+g-type-interface+}}
+@item{@variable{+g-type-char+}}
+@item{@variable{+g-type-uchar+}}
+@item{@variable{+g-type-boolean+}}
+@item{@variable{+g-type-int+}}
+@item{@variable{+g-type-uint+}}
+@item{@variable{+g-type-long+}}
+@item{@variable{+g-type-ulong+}}
+@item{@variable{+g-type-int64+}}
+@item{@variable{+g-type-uint64+}}
+@item{@variable{+g-type-enum+}}
+@item{@variable{+g-type-flags+}}
+@item{@variable{+g-type-float+}}
+@item{@variable{+g-type-double+}}
+@item{@variable{+g-type-string+}}
+@item{@variable{+g-type-pointer+}}
+@item{@variable{+g-type-boxed+}}
+@item{@variable{+g-type-param+}}
+@item{@variable{+g-type-object+}}
 @end{itemize}
 
-@begin[GObject type system querying]{section}
-GObject type information can queried. Type is identified by GType — an integer.
+GType values form type hierarchies via signle inheritance. Functions @fun{g-type-parent} and @fun{g-type-children} enable to traverse through the type hierarchy.
 
-Function @fun{g-type-from-name} returns GType by its name, and function @fun{g-type-name} returns the name of a GType. Function @fun{ensure-g-type} is a convenience function that returns GType from either GType or its name.
+For some types, additional information is available. Functions @fun{class-properties} and @fun{interface-properties} return properties of classes and interfaces. Functions @fun{get-enum-items} and @fun{get-flags-items} return members of enum and flags types.
 
-Functions @fun{g-type-parent} and @fun{g-type-children} inspect type hierarchy.
-@end{section}
+//TODO: document and refactor signals
 
-@begin[GValue]{section}
-GValue is a GObject's \"variant\"-like type. It can contain value of any type that GObject supports. The GValue is used for passing parameters to signal handlers, properties' getters and setters. Functions @fun{g-value-init}, @fun{g-value-unset}, @fun{g-value-zero}, @fun{parse-gvalue} and @fun{set-g-value} are used to init, reset, retrieve and assign GValue structures.
 @end{section}
 
-@begin[Utilities]{section}
-GObject contains implementation of stable pointers. Stable pointer is a reference that can be passed between FFI boundaries. Stable pointer is an integer that is allocated with @fun{allocate-stable-pointer}. This integer can be passed to other code and back. The value of this pointer (that is retrieved with @fun{get-stable-pointer-value}) is stable, staying the same until the pointer is freed with @fun{free-stable-pointer}. For convenience, @fun{with-stable-pointer} macro is provided.
+@begin[GValue]{section}
+GObject uses GValues as a generic way to pass values. It is used when calling closures, emitting signals, setting and getting properties' values, passing values to object constructors. @class{g-value} foreign structure is used for holding GValue. It used like all foreign structures: either with @code{cffi:foreign-alloc} or with @code{cffi:with-foreign-object}. Before first use, @class{g-value} should be zeroed with @fun{g-value-zero}. Zeroed @class{g-value} may be configured to hold a GValue of a given type with @fun{g-value-init}. @fun{parse-g-value} retrieves the Lisp object corresponding to the value stored in GValue. @fun{set-g-value} sets the GValue from Lisp object.
 @end{section}"))
 
 (in-package :gobject)
index f72b125..834d894 100644 (file)
@@ -1,46 +1,75 @@
 (in-package :gobject)
 
-(defcfun (g-type-fundamental "g_type_fundamental") g-type
-  (type-id g-type))
+(define-foreign-type g-type-designator ()
+  ()
+  (:documentation "Values of this type identify the GType. GType is designated by a its name (a string) or a numeric identifier. Functions accept GType designators as a string or integer and return them as a string. Functions @fun{g-type-name} and @fun{g-type-from-name} are used to convert between name and numeric identifier.")
+  (:actual-type g-type)
+  (:simple-parser g-type-designator))
+
+(defmethod translate-from-foreign (value (type g-type-designator))
+  (g-type-name value))
+
+(defmethod translate-to-foreign (value (type g-type-designator))
+  (etypecase value
+    (string (g-type-from-name value))
+    (integer value)
+    (null +g-type-invalid+)))
+
+(defcfun (g-type-fundamental "g_type_fundamental") g-type-designator
+  "Returns the fundamental type which is the ancestor of @code{type}.
+@arg[type]{GType designator (see @class{g-type-fundamental})}
+@return{GType designator}"
+  (type g-type-designator))
 
 (defcfun (%g-type-init "g_type_init") :void)
 
 (at-init () (%g-type-init))
 
 (defcfun (g-type-name "g_type_name") :string
-  "Returns the GType name
+  "Returns the name of a GType.
 
-@arg[type]{an integer specifying the GType}
-@return{a string - name of type}"
-  (type g-type))
+@arg[type]{GType designator (see @class{g-type-designator})}
+@return{a string}"
+  (type g-type-designator))
 
 (defcfun (g-type-from-name "g_type_from_name") g-type
-  "Looks up the GType by its name
+  "Returns the numeric identifier of a GType by its name
 
-@arg[name]{a string naming the type}
-@return{an integer specifying GType}"
+@arg[name]{a string - name of GType}
+@return{an integer}"
   (name :string))
 
-(defcfun g-type-parent g-type
+(defcfun g-type-parent g-type-designator
   "Returns the parent of a GType
 
-@arg[type]{an integer specifying the GType}
-@return{an integer specifying the parent GType}"
-  (type g-type))
+@arg[type]{GType designator (see @class{g-type-designator})}
+@return{GType designator}"
+  (type g-type-designator))
 
 (defcfun g-type-depth :uint
-  (type g-type))
-
-(defcfun g-type-next-base g-type
-  (leaf-type g-type)
-  (root-type g-type))
+  "Returns the length of the ancestry of @code{type}. This includes the @code{type} itself, so that e.g. a fundamental type has depth 1.
+@arg[type]{GType designator (see @class{g-type-designator})}
+@return{an integer}"
+  (type g-type-designator))
+
+(defcfun g-type-next-base g-type-designator
+  "Determines the type that is derived directly from @code{root-type} which is also a base class of @code{leaf-type}.
+@arg[leaf-type]{GType designator (see @class{g-type-designator})}
+@arg[root-type]{GType designator}
+@return{GType designator}"
+  (leaf-type g-type-designator)
+  (root-type g-type-designator))
 
 (defcfun g-type-is-a :boolean
-  (type g-type)
-  (is-a-type g-type))
+  "If @code{is-a-type} is a derivable type, check whether type is a descendant of @code{is-a-type}. If @code{is-a-type} is an interface, check whether type conforms to it.
+@arg[type]{GType designator (see @class{g-type-designator})}
+@arg[is-a-type]{GType designator}
+@return{boolean}"
+  (type g-type-designator)
+  (is-a-type g-type-designator))
 
 (defcfun g-type-class-ref (:pointer g-type-class)
-  (type g-type))
+  (type g-type-designator))
 
 (defcfun g-type-class-unref :void
   (class (:pointer g-type-class)))
   (private-size gsize))
 
 (defcfun g-type-default-interface-ref :pointer
-  (type g-type))
+  (type g-type-designator))
 
 (defcfun g-type-default-interface-unref :void
   (interface :pointer))
 
 (defcfun (%g-type-children "g_type_children") (:pointer g-type)
-  (type g-type)
+  (type g-type-designator)
   (n-children (:pointer :uint)))
 
 (defun g-type-children (g-type)
   "Returns the list of types inherited from @code{g-type}.
 
-@arg[g-type]{an integer or a string specifying type}"
-  (setf g-type (ensure-g-type g-type))
+@arg[g-type]{GType designator (see @class{g-type-designator})}
+@return{list of GType designators}"
   (with-foreign-object (n-children :uint)
     (let ((g-types-ptr (%g-type-children g-type n-children)))
       (prog1
           (loop
              for i from 0 below (mem-ref n-children :uint)
-             collect (mem-aref g-types-ptr 'g-type i))
+             collect (mem-aref g-types-ptr 'g-type-designator i))
         (g-free g-types-ptr)))))
 
 (defcfun (%g-type-interfaces "g_type_interfaces") (:pointer g-type)
-  (type g-type)
+  (type g-type-designator)
   (n-interfaces (:pointer :uint)))
 
 (defun g-type-interfaces (g-type)
-  (setf g-type (ensure-g-type g-type))
+  "Returns the list of interfaces the @code{g-type} conforms to.
+
+@arg[g-type]{GType designator (see @class{g-type-designator})}
+@return{list of GType designators}"
   (with-foreign-object (n-interfaces :uint)
     (let ((g-types-ptr (%g-type-interfaces g-type n-interfaces)))
       (prog1
           (loop
              for i from 0 below (mem-ref n-interfaces :uint)
-             collect (mem-aref g-types-ptr 'g-type i))
+             collect (mem-aref g-types-ptr 'g-type-designator i))
         (g-free g-types-ptr)))))
 
 (defcfun (%g-type-interface-prerequisites "g_type_interface_prerequisites") (:pointer g-type)
-  (type g-type)
+  (type g-type-designator)
   (n-interface-prerequisites (:pointer :uint)))
 
 (defun g-type-interface-prerequisites (g-type)
+  "Returns the prerequisites of an interface type. Prerequisite is a type that must be a superclass of an implementing class or an interface that the object must also implement.
+@arg[g-type]{GType designator (see @class{g-type-designator})}
+@return{list of GType designators}"
   (with-foreign-object (n-interface-prerequisites :uint)
     (let ((g-types-ptr (%g-type-interface-prerequisites g-type n-interface-prerequisites)))
       (prog1
           (loop
              for i from 0 below (mem-ref n-interface-prerequisites :uint)
-             collect (mem-aref g-types-ptr 'g-type i))
+             collect (mem-aref g-types-ptr 'g-type-designator i))
         (g-free g-types-ptr)))))
 
-(defcfun g-type-register-static g-type
-  (parent-type g-type)
+(defcfun g-type-register-static g-type-designator
+  (parent-type g-type-designator)
   (type-name :string)
   (info (:pointer g-type-info))
   (flags g-type-flags))
 
-(defcfun g-type-register-static-simple g-type
-  (parent-type g-type)
+(defcfun g-type-register-static-simple g-type-designator
+  (parent-type g-type-designator)
   (type-name :string)
   (class-size :uint)
   (class-init :pointer)
   (flags g-type-flags))
 
 (defcfun g-type-add-interface-static :void
-  (instance-type g-type)
-  (interface-type g-type)
+  (instance-type g-type-designator)
+  (interface-type g-type-designator)
   (info (:pointer g-interface-info)))
 
 (defcfun g-type-interface-add-prerequisite :void
-  (interface-type g-type)
-  (prerequisite-type g-type))
+  (interface-type g-type-designator)
+  (prerequisite-type g-type-designator))
 
 (defun g-type-from-object (object)
   "Returns the GType of an @code{object}
 
 @arg[object]{C pointer to an object}
-@return{an integer specifying the GType}"
+@return{GType designator (see @class{g-type-designator})}"
   (g-type-from-instance object))
 
 (defun g-type-from-class (g-class)
-  (foreign-slot-value g-class 'g-type-class 'type))
+  (g-type-name (foreign-slot-value g-class 'g-type-class 'type)))
 
 (defun g-type-from-instance (type-instance)
   (g-type-from-class (foreign-slot-value type-instance 'g-type-instance 'class)))
 
 (defun g-type-from-interface (type-interface)
-  (foreign-slot-value type-interface 'g-type-interface 'type))
+  (g-type-name (foreign-slot-value type-interface 'g-type-interface 'type)))
 
-(defcfun g-strv-get-type g-type)
+(defcfun g-strv-get-type g-type-designator)
 
-(g-strv-get-type)
+(at-init nil (g-strv-get-type))
 
-(defcfun g-closure-get-type g-type)
+(defcfun g-closure-get-type g-type-designator)
 
-(g-closure-get-type)
+(at-init nil (g-closure-get-type))
 
 (defcfun g-type-query :void
-  (type g-type)
+  (type g-type-designator)
   (query (:pointer g-type-query)))
\ No newline at end of file