Utilities

G-Golf GObject Introspetion Utilities low level API.

Procedures and Syntax

gi-pointer-new
gi-pointer-inc
gi-attribute-iter-new
with-gerror
gi->scm
gi-boolean->scm
gi-string->scm
gi-n-string->scm
gi-strings->scm
gi-csv-string->scm
gi-pointer->scm
gi-n-pointer->scm
gi-pointers->scm
gi-n-gtype->scm
gi-glist->scm
gi-gslist->scm
scm->gi
scm->gi-boolean
scm->gi-string
scm->gi-n-string
scm->gi-strings
scm->gi-pointer
scm->gi-n-pointer
scm->gi-pointers
scm->gi-n-gtype
scm->gi-gslist

Types and Values

%gi-pointer-size

Description

G-Golf GObject Introspection utilities low level API.

Procedures and Syntax

Procedure: gi-pointer-new

Returns a newly allocated (Glib) pointer.

Procedure: gi-pointer-inc pointer [#:offset %gi-pointer-size]

Returns a foreign pointer object pointing to the address of pointer increased by offset.

Procedure: gi-attribute-iter-new

Returns a pointer.

Creates and returns a foreign pointer to a C struct for a GIAttributeIter (a C struct containg four pointers, initialized to %null-pointer).

Syntax: with-gerror var body

Returns the result of the execution of body, or raises an exception.

var must be an identifier. Evaluate body in a lexical environment where var is bound to a pointer to a newly allocated (and ‘empty’) GError. var will always be freed. If no exception is raised, the result of the execution of body is returned.

Procedure: gi->scm value type [cmpl #f]

Returns the scheme representation of value.

The type, a symbol name (also called a type tag or just a tag in the GI terminology) supported values are:

'boolean

Calls gi-boolean->scm.

'string
'pointer

Calls gi-string->scm or gi-pointer->scm.

'n-string
'n-pointer
'n-gtype

Calls gi-n-string->scm, gi-n-pointer->scm or gi-n-gtype->scm.

The optional cmpl (complement) argument must be passed and set to the number of string(s), pointer(s) or gtype(s) contained in value, .

'strings
'pointers

Calls gi-strings->scm or gi-pointers->scm.

'csv-string

Calls gi-csv-string->scm.

'glist
'gslist

Calls gi-glist->scm or gi-gslist->scm, repsectively.

Procedure: gi-boolean->scm value

Returns #t or #f.

The GType of value must be a gboolean.

Procedure: gi-string->scm value
Procedure: gi-pointer->scm value

Returns a string, a pointer or #f if value is the %null-pointer.

The GType of value must be a gchar* or a gpointer.

Procedure: gi-n-string->scm value n-string
Procedure: gi-n-pointer->scm value n-pointer
Procedure: gi-n-gtype->scm value n-gtype

Returns a (possibly empty list) of string(s), pointer(s) or GType(s).

The GType of value must be a gchar**, a gpointer[] or a GType[]. The n-string, n-pointer and n-gtype argument must be the length of the value array.

Procedure: gi-strings->scm value
Procedure: gi-pointers->scm value

Returns a (possibly empty) list of strings or pointer.

The GType of value must be a gchar** or gpointer[]. The array must be NULL terminated.

Procedure: gi-csv-string->scm value

Returns a list of string(s) or #f if value is the %null-pointer.

The GType of value is gchar*. Unless #f, the list of string(s) is obtained by splitting the (comma separated value) string pointed to by value using using #\, as the char-pred.

Procedure: gi-glist->scm g-list
Procedure: gi-gslist->scm g-slist

Returns a (possibly empty) list.

Obtains and returns a (possibly empty) list of the pointers stored in the data field of each element of g-list or g-slist.

Procedure: scm->gi value type [cmpl #f]

Returns the GI representation of value.

The type, a symbol name (also called a type tag or just a tag in the GI terminology) supported values are:

'boolean

Calls scm->gi-boolean.

'string
'pointer

Calls scm->gi-string or scm->gi-pointer.

'n-string
'n-pointer
'n-gtype

Calls scm->gi-n-string, scm->gi-n-pointer or scm->gi-n-gtype.

The optional cmpl (complement) argument may be passed and set to the number of string(s), pointer(s) or gtype(s) contained in value.

'strings
'pointers

Calls scm->gi-strings or scm->gi-pointers.

'gslist

Calls scm->gi-gslist.

Procedure: scm->gi-boolean value

Returns 0 if value is #f, otherwise, it returns 1.

Procedure: scm->gi-string value
Procedure: scm->gi-pointer value

Returns a pointer.

If value is #f, it returns %null-pointer. Otherwise, it returns a pointer to the string in value or value.

Procedure: scm->gi-n-string value [n-string #f]
Procedure: scm->gi-strings value

Returns two values.

If value is the empty list, it returns %null-pointer and an empty list. Otherwise, it returns a pointer to an array of pointer(s) to the string(s) in value and a list of the ‘inner’ string pointer(s).

It is the caller’s responsibility to maintain a reference to those inner pointer(s), until the array ‘itself’ (the first returned value) is no longer needed/used.

The array returned by scm->gi-strings is NULL terminated, where as the array returned by scm->gi-n-string is not.

Procedure: scm->gi-n-pointer value [n-pointer #f]
Procedure: scm->gi-n-gtype value [n-gtype #f]

Returns a pointer.

If value is an empty list, it returns %null-pointer. Otherwise, it returns a pointer to an array the pointer(s) or GType(s) in value.

The returned array is not NULL nor 0- terminated.

Procedure: scm->gi-pointers value

Returns a pointer.

If value is an empty list, it returns %null-pointer. Otherwise, it returns a pointer to an array the pointer(s) in value.

The returned array is NULL terminated.

Procedure: scm->gi-gslist value

Returns a pointer.

If value is an empty list, it returns %null-pointer. Otherwise, it returns a pointer to a GSList, with its element’s data being (in order), the pointer(s) in value.

Types and Values

Variable: %gi-pointer-size

The size (the number of bytes) that a (Glib) pointer occupies in memory (which is architecture dependent).