Function Info

G-Golf Function Info low level API.
GIFunctionInfo — Struct representing a function.

Procedures

gi-function-info-is-method?
g-function-info-get-flags
g-function-info-get-property
g-function-info-get-symbol
g-function-info-get-vfunc
g-function-info-invoke

Types and Values

%g-function-info-flags

Struct Hierarchy

GIBaseInfoInfo
  +— GICallableInfo
           +— GIFunctionInfo
           +— GISignalInfo
           +— GIVFuncInfo

Description

GIFunctionInfo represents a function, method or constructor. To find out what kind of entity a GIFunctionInfo represents, call g-function-info-get-flags.

See also Callable Info for information on how to retreive arguments and other metadata.

Procedures

Note: in this section, the info argument is [must be] a pointer to a GIFunctionInfo.

Procedure: gi-function-info-is-method? info [flags #f]

Returns #t if info is a method, that is if is-method is a member of the info flags. Otherwise, it returns #f.

The optional flags argument, if passed, must be the list of the function info flags as returned by g-function-info-get-flags.

Procedure: g-function-info-get-flags info

Returns a list of %g-function-info-flags.

Obtain the GIFunctionInfoFlags for info.

Procedure: g-function-info-get-property info

Returns a pointer or #f.

Obtains the GIPropertyInfo associated with info. Only GIFunctionInfo with the flag is-getter or is-setter have a property set. For other cases, #f will be returned.

The GIPropertyInfo must be freed by calling g-base-info-unref when done.

Procedure: g-function-info-get-symbol info

Returns a string.

Obtain the ‘symbol’ of the function31.

Procedure: g-function-info-get-vfunc info

Returns a pointer or #f.

Obtains the GIVFuncInfo associated with info. Only GIFunctionInfo with the flag wraps-vfunc has its virtual function set. For other cases, #f will be returned.

The GIVFuncInfo must be freed by calling g-base-info-unref when done.

Procedure: g-function-info-invoke info in-args n-in out-args n-out r-val g-error

Returns #t if the function has been invoked, #f if an error occured.

Invokes the function described in info with the given arguments. Note that inout parameters must appear in both argument lists. The arguments are:

info

a pointer to a GIFunctionInfo describing the function to invoke.

in-args

a pointer to an array of GIArguments, one for each in and inout parameter of info. If there are no in parameter, in-args must be the %null-pointer.

n-in

the length of the in-args array.

out-args

a pointer to an array of GIArguments, one for each out and inout parameter of info. If there are no out parameter, out-args must be the %null-pointer.

n-out

the length of the out-args array.

r-val

a pointer to a GIArguments, the return location for the return value of the function. If the function returns void, r-val must be the %null-pointer.

g-error

a pointer to a newly allocated (and ‘empty’) GError (the recommended way for procedure calls that need such a pointer is to ‘surround’ the call using with-gerror).

Types and Values

Instance Variable of <gi-flags>: %g-function-info-flags

An instance of <gi-flags>, who’s members are the scheme representation of the GIFunctionInfoFlags:

g-name: GIFunctionInfoFlags
name: gi-function-info-flags
enum-set:

is-method

Is a method.

is-constructor

Is a constructor.

is-getter

Is a getter of a GIPropertyInfo.

is-setter

Is a setter of a GIPropertyInfo.

wraps-vfunc

Represent a virtul function.

throws

The function may throw an error.


Footnotes

(31)

As you have noticed already, since g-function-info-get-symbol returns a string, in the Glib, GObject and GObject Instrospection worlds, symbol has a different meaning then in the Lisp/Scheme worlds. However, since the procedure is part of the G-Golf low-level API, we decided to keep its name as close as the original name as possible, which in Glib terms is the name of the exported function, ‘suitable to be used as an argument to g_module_symbol()