Next: , Previous: gnome gw generics, Up: Top


12 (gnome gw support gobject)

12.1 Overview

G-Wrap support for (gnome gobject) types. Code in this module is only loaded when generating wrapsets; as such, it is not for end users.

12.2 Usage

— Class: <gobject-wrapset-base>

The base class for G-Wrap wrapsets that use <gobject> types.

— Generic: add-type-alias!
— Method: add-type-alias! (wrapset <gobject-wrapset-base>) (alias <string>) (name <symbol>)

Add a type alias to wrapset, that the string alias is associated with the type named symbol. For example, "GtkWindow*" might be associated with a type named <gtk-window>. See lookup-type-by-alias.

— Generic: lookup-type-by-alias
— Method: lookup-type-by-alias (wrapset <gobject-wrapset-base>) (name <string>)

Lookup a type aliased name in wrapset, and all wrapsets on which wrapset depends. This interface is used by load-defs to associate G-Wrap types with the strings parsed out of the C header files.

— Generic: add-type-rule!
— Method: add-type-rule! (self <gobject-wrapset-base>) (param-type <string>) (typespec <top>)

Add a type rule to wrapset, that the string param-type maps directly to the g-wrap typespec typespec. For example, "int*" might map to the typespec (int out). See find-type-rule.

— Generic: find-type-rule
— Method: find-type-rule (self <gobject-wrapset-base>) (param-type <string>)

See if the parameter type param-type has a type rule present in wrapset or in any wrapset on which wrapset depends. This interface is used by load-defs to associate G-Wrap typespecs with the strings parsed out of the C header files.

— Class: <gobject-type-base>

A base G-Wrap type class for GLib types.

— Class: <gobject-classed-type>

A base G-Wrap type class for classed GLib types (see gtype-classed?).

— Generic: gtype-id
— Method: gtype-id (o <gobject-custom-gvalue-type>)
— Method: gtype-id (o <gobject-custom-boxed-type>)
— Method: gtype-id (o <gobject-class-type>)
— Method: gtype-id (o <gobject-flags-type>)
— Method: gtype-id (o <gobject-enum-type>)
— Method: gtype-id (o <gobject-interface-type>)
— Method: gtype-id (o <gobject-pointer-type>)
— Method: gtype-id (o <gobject-boxed-type>)
— Method: gtype-id (o <gobject-instance-type>)
— Method: gtype-id (o <gobject-classed-pointer-type>)
— Method: gtype-id (o <gobject-classed-type>)

— Class: <gobject-classed-pointer-type>

A base G-Wrap type class for for classed GLib types whose values are pointers.

— Generic: unwrap-null-checked
— Method: unwrap-null-checked (value <gw-value>) (status-var <top>) (code <top>)

Unwrap a value into a C pointer, optionally unwrapping #f as NULL.

This function checks the typespec options on value, which should be a <gw-value>. If the null-ok option is set (which is only the case for value classes with null-ok in its #:allowed-options), this function generates code that unwraps #f as NULL. If null-ok is unset, or the value is not #f, code is run instead.

— Generic: wrap-instance!
— Method: wrap-instance! (ws <gobject-wrapset-base>) (args <top>)...

Define a wrapper for a specific instantiatable (<gtype-instance>-derived) type in ws. Required keyword arguments are #:ctype and #:gtype-id. For example,

           (wrap-instance! ws #:ctype "GtkWidget"
                              #:gtype-id "GTK_TYPE_WIDGET")

Normally only called from load-defs.

— Generic: wrap-boxed!
— Method: wrap-boxed! (ws <gobject-wrapset-base>) (args <top>)...

Define a wrapper for a specific boxed type in ws. Required keyword arguments are #:ctype and #:gtype-id, as in wrap-instance!.

— Generic: wrap-pointer!
— Method: wrap-pointer! (ws <gobject-wrapset-base>) (args <top>)...

Define a wrapper for a specific pointer type in ws. Required keyword arguments are #:ctype and #:gtype-id, as in wrap-instance!.

— Function: wrap-opaque-pointer! ws ctype

Define a wrapper for an opaque pointer with the C type ctype. It will not be possible to create these types from Scheme, but they can be received from a library, and passed as arguments to other calls into the library.

— Function: wrap-freeable-pointer! ws ctype free

foo

— Function: wrap-refcounted-pointer! ws ctype ref unref

foo

— Function: wrap-structure! ws ctype wrap unwrap

Define a wrapper for structure values of type ctype.

wrap and unwrap are the names of C functions to convert a C structure to Scheme and vice versa, respectively. When in a function call, parameters of this type of the form `StructName*' are interpreted as `out' parameters, while `const-StructName*' are treated as `in' parameters.

Note that ctype should be the type of the structure, not a pointer to the structure.

— Generic: wrap-interface!
— Method: wrap-interface! (ws <gobject-wrapset-base>) (args <top>)...

Define a wrapper for an interface type in ws. Required keyword arguments are #:ctype and #:gtype-id, as in wrap-instance!.

— Generic: wrap-flags!
— Method: wrap-flags! (ws <gobject-wrapset-base>) (args <top>)...

Define a wrapper for a flags type in ws. Required keyword arguments are #:ctype and #:gtype-id or #:values, as in wrap-enum!.

— Generic: wrap-gobject-class!
— Method: wrap-gobject-class! (ws <gobject-wrapset-base>) (args <top>)...

Define a wrapper for GObject class values ws. Required keyword arguments are #:ctype and #:gtype-id, as in wrap-instance!.

#:ctype should refer to the type of the class and not the instance; e.g. "GtkWidgetClass" and not "GtkWidget". This function will not be called by load-defs, and should be invoked manually in a wrapset as needed.

— Special Form: wrap-custom-boxed! ctype gtype wrap unwrap

Wrap a boxed type using custom wrappers and unwrappers.

FIXME: missing a wrapset argument!

ctype and gtype are as #:ctype and #:gtype-id in wrap-instance!. wrap and unwrap are G-Wrap forms in which scm-var and c-var will be bound to the names of the SCM and C values, respectively. For example:

            (wrap-custom-boxed!
             "GdkRectangle" "GDK_TYPE_RECTANGLE"
             (list scm-var " = "
                   c-var " ?  scm_gdk_rectangle_to_scm (" c-var ")"
                   " : SCM_BOOL_F;")
             (list c-var " = scm_scm_to_gdk_rectangle (" scm-var ");"))

— Special Form: wrap-custom-gvalue! ctype gtype wrap-func unwrap-func

Wrap a GValue type using custom wrap and unwrap functions.

FIXME: missing a wrapset argument!

ctype and gtype are as #:ctype and #:gtype-id in wrap-instance!. wrap-func and unwrap-func are names of functions to convert to and from Scheme values, respectively. For example:

           (wrap-custom-gvalue! "GstFraction" "GST_TYPE_FRACTION"
                                "scm_from_gst_fraction"
                                "scm_to_gst_fraction")