About my projects, examples and tutorials
Gnome::N::GlibToRakuTypes

Gnome::N::GlibToRakuTypes

Description

A series of basic types which are named after the Glib types and mapped to Raku types. They are used internally most of the time but sometimes it is used to describe a callback interface. But even then, many Raku types can be translated back into the native types automatically. For instance, Bool

For almost all of the (unsigned) integer types, one can use Int or UInt. While that is true, you must take care that it fits in the proper native type. Only magicians can fit the integer number 1024 into a gint8 for example.

Also there is an automatic mapping from Num to gfloat which is like a Raku type num32. Furthermore The Raku Rat type is mapped to gdouble whih is represented as num64 in Raku.

Special types

  • GEnum; An integer used to refer to native enumerations.

  • GFlag; An unsigned integer to be used as a mask of bits.

  • GQuark; An unsigned integer to be used in the native error system.

  • GType; An unsigned integer to be used as a type number. There are a series of fixed numbers but the classes get a type number when instantiated.

  • gunichar; Classifies a Unicode character by type.

Pointers to character string

  • char-ppptr; A pointer to an array of strings. Used by the native functions to return string arrays.

  • char-pptr; A pointer to a character string.

  • gchar-ppptr; Like char-ppptr. Documentation of Gnome is not always concequent in the use of types.

  • gchar-pptr; Like char-pptr.

  • gchar-ptr; A character string. The Raku Str type can be used for this.

Pointers to integer

  • int-ptr; A pointer to an integer. Used by the native functions to return an integer.

  • gint-ptr; Like int-ptr

Special pointers

  • void-ptr; Used when nothing is returned from a function.

  • gpointer; A pointer to some object.

Simple types

  • gboolean; An integer value being 0 or 1. You can use the Bool type for it.

  • gchar; An 8 bit number for a character

  • guchar; The Raku type UInt can be used.

Floating point

  • gdouble; A large floating point number. The modules will translate Raku type Rat to this type.

  • gfloat; A smaller floating point value. The modules will translate Raku type Num to this type.

Integer types

  • gint; An integer. The Raku type Int can be used.

  • gint16; a 16 bit integer. The Raku type Int can be used.

  • gint32; a 32 bit integer. The Raku type Int can be used.

  • gint64; a 64 bit integer. The Raku type Int can be used.

  • gint8; An 8 bit integer. The Raku type Int can be used.

  • glong; A large integer. The Raku type Int can be used.

  • gshort; A small integer. The Raku type Int can be used.

Special integer types

  • gsize; An unsigned integer use for sizes. The Raku type UInt can be used.

  • gssize; An integer also used for sizes The Raku type Int can be used.

Unsigned integer types

  • guint; An unsigned integer. The Raku type UInt can be used.

  • guint16; A 16 bit unsigned integer. The Raku type UInt can be used.

  • guint32; A 32 bit unsigned integer. The Raku type UInt can be used.

  • guint64; A 64 bit unsigned integer. The Raku type UInt can be used.

  • guint8; An 8 bit unsigned integer. The Raku type UInt can be used.

  • gulong; An unsigned large integer. The Raku type UInt can be used.

  • gushort; An unsigned small integer. The Raku type UInt can be used.

  • time_t; A 64 bit unsigned integer. The Raku type UInt can be used.