Utils Arcade

Utils Arcade. G-Golf utilities.

Syntax

scm->g-type
allocate-c-struct

Description

Welcome to the G-Golf Utils Arcade.

Syntax

Procedure: scm->g-type value

Returns a GType.

Obtains and returns the GType for value, which may be a number (then assumed to be a valid GType), a string, a symbol (a %g-type-fundamental-types member) or a <gobject-class>.

Syntax: allocate-c-struct name . fields

Returns a (or more) pointer(s).

This syntax takes the name of a GI upstream library C struct26 and returns a pointer to a newly - scheme allocated, zero initialized - memory block.

When fields is not null?, it returns additional value(s), one for each specified field name, a pointer to the field in the C struct.

Here is an example, an excerpt form the peg-solitaire.scm example, distributed with G-Golf. The example shows how to obtain a pointer to newly allocated block for a GskRoundedRect, as well as a pointer to its bounds field:

(receive (outline outline:bounds)
    (allocate-c-struct gsk-rounded-rect bounds)
  ...
  (push-rounded-clip snapshot outline)
  (append-color snapshot
                '(0.61 0.1 0.47 1.0)
                 outline:bounds)
  ...)

Footnotes

(26)

More specifically, an unquoted scheme representation name of a GI upstream library C struct.