Union

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

Classes

<gi-union>

Procedures, Accessors and Methods

make-c-union
c-union-ref
c-union-set!
!g-type__
!g-name__
!name___
!size_
!alignment_
!fields
!is-discriminated?
!discriminator-offset
!discriminator

Description

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

Classes

Class: <gi-union>

The <gi-union> class. Its class-direct-slots are:

g-type

#:accessor !g-type
#:init-keyword #:g-type

g-name

#:accessor !g-name
#:init-keyword #:g-name

name

#:accessor !name

size

#:accessor !size
#:init-keyword #:size

alignment

#:accessor !alignment
#:init-keyword #:alignment

fields

#:accessor !fields
#:init-keyword #:fields

is-discrimanted?

#:accessor !is-discriminated?
#:init-keyword #:is-discriminated?

discriminator-offset

#:accessor !discriminator-offset
#:init-keyword #:discriminator-offset

discriminator

#:accessor !discriminator #:init-keyword #:discriminator #:init-value #f

The name slot is automatically initialized.

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

Procedures, Accessors and Methods

Procedure: make-c-union types [type #f] [val #f]

Returns a pointer.

Create a foreign pointer to a C union for the list of types (see Foreign Types in the Guile Reference Manual for a list of supported types).

Procedure: c-union-ref foreign size type

Returns the content of the C union pointed by foreign, for the given size and type.

Procedure: c-union-set! foreign size type val

Returns nothing.

Sets the content of the C union pointed by foreign to val, given its size and type.

Accessor: !g-type (inst <gi-union>)
Accessor: !g-name (inst <gi-union>)
Accessor: !name (inst <gi-union>)
Accessor: !size (inst <gi-union>)
Accessor: !alignment (inst <gi-union>)
Accessor: !fields (inst <gi-union>)
Accessor: !is-discriminated? (inst <gi-union>)
Accessor: !discriminator-offset (inst <gi-union>)
Accessor: !discriminator (inst <gi-union>)

Returns the content of their respective slot for inst.