/usr/share/ada/adainclude/gtkada/gtkada-c.ads is in libgtkada2.24.1-dev 2.24.1-14.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | -----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 2006, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-----------------------------------------------------------------------
-- This package is purely internal to GtkAda.
-- It was moved out of Gtkada.Bindings for elaboration circularity issues
with Ada.Unchecked_Conversion;
with System;
package Gtkada.C is
-------------
-- 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;
generic
type T is private;
Null_T : T;
type Index is (<>);
type T_Array is array (Index range <>) of T;
package Unbounded_Arrays is
type Unbounded_Array
is array (Index range Index'Val (1) .. Index'Last) of T;
pragma Convention (C, Unbounded_Array);
type Unbounded_Array_Access is access Unbounded_Array;
procedure G_Free (Arr : Unbounded_Array_Access);
function To_Array
(Arr : Unbounded_Array_Access; N : Index) return T_Array;
function Convert is new Ada.Unchecked_Conversion
(System.Address, Unbounded_Array_Access);
private
pragma Import (C, G_Free, "g_free");
end Unbounded_Arrays;
end Gtkada.C;
|