Struct

G-Golf class, accessors, methods and procedures to deal with C struct types.

Classes

<gi-struct>

Procedures, Accessors and Methods

!g-type____
!g-name_
!name____
!alignment
!size
!is-gtype-struct?
!is-foreign?
!field-types
!field-desc
!scm-types
!init-vals
!is-opaque?
!is-semi-opaque?
field-offset

Description

G-Golf class, accessors, methods and procedures to deal with C struct types.

Classes

Class: <gi-struct>

<gi-struct> is a class. It’s an instance of <class>.

Superclasses are:

<object>

Class Precedence List is:

<g-struct>
<object>
<top>

Directs slots are:

g-type
g-name
name
alignment
size
is-gtype-struct?
is-foreign?
field-types
field-desc
scm-types
init-vals
is-opaque?
is-semi-opaque?

Instances of the <gi-struct> are immutable (to be precise, there are not meant to be mutated, see GOOPS Notes and Conventions, ’Slots are not Immutable’).

Procedures and Accessors

Accessor: !g-type (inst <gi-struct>)
Accessor: !g-name (inst <gi-struct>)
Accessor: !name (inst <gi-struct>)
Accessor: !alignment (inst <gi-struct>)
Accessor: !size (inst <gi-struct>)
Accessor: !is-gtype-struct? (inst <gi-struct>)
Accessor: !field-types (inst <gi-struct>)
Accessor: !field-desc (inst <gi-struct>)
Accessor: !scm-types (inst <gi-struct>)
Accessor: !init-vals (inst <gi-struct>)

Returns the content of their respective slot for inst.

Accessor: !is-opaque? (inst <gi-struct>)

Returns #t if inst is ‘opaque’, otherwise, it returns #f.

A <gi-struct> instance is said to be ‘opaque’ when the call to g-struct-info-get-size upon its GIStructInfo pointer returns zero. In scheme, these <gi-struct> instances have no fields.

Opaque’ boxed types should never be ‘decoded’, nor ‘encoded’. Instead, procedures, accessors and methods should ‘blindingly’ receive, pass and/or return their pointer(s).

Accessor: !is-semi-opaque? (inst <gi-struct>)

Returns #t if inst is ‘semi-opaque’, otherwise, it returns #f.

A <gi-struct> instance is said to be ‘semi-opaque’ when one of its field types is void, interface or if the total size of the scm-types differs from the inst size slot vlue.

Semi-opaque’ boxed types should never be ‘decoded’, nor ‘encoded’. Instead, procedures, accessors and methods should ‘blindingly’ receive, pass and/or return their pointer(s).

Method: field-offset (inst <gi-struct>) field-name

Returns an integer.

Obtain and returns the field-name offset for inst, It is an error to call this method if there is no such field-name defined for inst.