Gtkada.C.Unbounded_Arrays

Entities

Generic formal parameters

Array Types

Access Types

Subprograms

Generic Instantiations

Description

----------- Arrays -- ----------- The following functions ease bindings: when a C function returns an array or a pointer to an array, it returns a C array, ie which doesn't contain bounds. The size of the array is generally reported separately. The following definitions are suitable for use internally in the binding, but should not, when possible, be made visble to the user, since they don't behave like usual Ada arrays ('Last is irrelevant for instance).

For instance, if a C function has the following profile: gint* get_sizes (GtkIconTheme* theme); -- 0 terminated array when the binding is: function Internal (Theme) return Unbounded_Gint_Array_Access; and you need to compute for yourself the number of elements, and return a Glib.Gint_Array to the user.

If the C function has the following profile: gboolean get_attach_points (theme, GdkPoint** p, gint* n); then the binding is: function Internal (Theme : System.Address; Points : out Unbounded_Points_Array_Access; N : access Gint) return Gboolean; and you do the following: R : aliased Unbounded_Points_Array_Access; N : aliased Gint; Tmp : constant Gboolean := Internal (.., R'Unchecked_Access, N'Unchecked_Access); Result : Gdk_Points_Array (1 .. Natural (N)) := To_Gint_Array (R, Natural (N)); Free (R); return Result;

Convert

function Convert is new Ada.Unchecked_Conversion
  (System.Address, Unbounded_Array_Access);

G_Free

procedure G_Free (Arr : Unbounded_Array_Access)
Parameters
Arr

Index

type Index is (<>);

Null_T

Null_T : T;

T

type T is private;

T_Array

type T_Array is array (Index range <>) of T;

To_Array

function To_Array
  (Arr : Unbounded_Array_Access; N : Index) return T_Array
Parameters
Arr
N
Return Value

Unbounded_Array

type Unbounded_Array
  is array (Index range Index'Val (1) .. Index'Last) of T;

Unbounded_Array_Access

type Unbounded_Array_Access is access Unbounded_Array;