This file is indexed.

/usr/share/ada/adainclude/gtkada/glib-main.adb is in libgtkada2.24.4-dev 2.24.4dfsg-1.

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
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
-----------------------------------------------------------------------
--               GtkAda - Ada95 binding for Gtk+/Gnome               --
--                                                                   --
--                Copyright (C) 2006-2013, 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.                                       --
--                                                                   --
-----------------------------------------------------------------------

with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;

package body Glib.Main is

   function Low_Level_Source_Func (Func : G_Source_Func) return Gboolean;
   pragma Convention (C, Low_Level_Source_Func);
   --  Low-level wrapper around G_Source_Func, which can be called directly
   --  from C. Func is the Ada function that this wraps.

   function To_Address is new Ada.Unchecked_Conversion
     (G_Source_Func, System.Address);

   -----------------------
   -- Find_Source_By_Id --
   -----------------------

   function Find_Source_By_Id
     (Id : G_Source_Id; Context : G_Main_Context := null) return G_Source
   is
      function Internal
        (Context : G_Main_Context; Id : G_Source_Id) return G_Source;
      pragma Import (C, Internal, "g_main_context_find_source_by_id");
   begin
      return Internal (Context, Id);
   end Find_Source_By_Id;

   ---------------------------
   -- Low_Level_Source_Func --
   ---------------------------

   function Low_Level_Source_Func (Func : G_Source_Func) return Gboolean is
   begin
      if Func = null then
         return Boolean'Pos (False);
      else
         return Boolean'Pos (Func.all);
      end if;
   end Low_Level_Source_Func;

   --------------
   -- Idle_Add --
   --------------

   function Idle_Add (Func : G_Source_Func) return G_Source_Id is
      function Internal
        (Func : System.Address; Data : System.Address) return G_Source_Id;
      pragma Import (C, Internal, "g_idle_add");
   begin
      return Internal (Low_Level_Source_Func'Address, To_Address (Func));
   end Idle_Add;

   -----------------
   -- Timeout_Add --
   -----------------

   function Timeout_Add
     (Interval : Guint;
      Func     : G_Source_Func) return G_Source_Id
   is
      function Internal
        (Interval : Guint;
         Func     : System.Address;
         Data     : System.Address) return G_Source_Id;
      pragma Import (C, Internal, "g_timeout_add");
   begin
      return Internal
        (Interval, Low_Level_Source_Func'Address, To_Address (Func));
   end Timeout_Add;

   ---------------------
   -- Generic_Sources --
   ---------------------

   package body Generic_Sources is

      type Data_Type_Access is access Data_Type;

      type Cb_Record is record
         Func   : G_Source_Func;
         Notify : Destroy_Notify;
         Data   : Data_Type_Access;
      end record;
      type Cb_Record_Access is access Cb_Record;

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

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

      ----------
      -- Free --
      ----------

      procedure Free_Data (D : System.Address) is
         procedure Internal is new Ada.Unchecked_Deallocation
           (Cb_Record, Cb_Record_Access);
         procedure Internal2 is new Ada.Unchecked_Deallocation
           (Data_Type, Data_Type_Access);
         Data : Cb_Record_Access := Convert (D);

      begin
         if Data.Notify /= null then
            Data.Notify (Data.Data.all);
         end if;
         Internal2 (Data.Data);
         Internal (Data);
      end Free_Data;

      ----------------
      -- General_Cb --
      ----------------

      function General_Cb (D : System.Address) return Gint is
         Data : constant Cb_Record_Access := Convert (D);
      begin
         return Boolean'Pos (Data.Func (Data.Data.all));
      end General_Cb;

      --------------
      -- Idle_Add --
      --------------

      function Idle_Add
        (Func     : G_Source_Func;
         Data     : Data_Type;
         Priority : G_Priority := Priority_Default_Idle;
         Notify   : Destroy_Notify := null)
         return G_Source_Id
      is
         function Internal
           (Priority : G_Priority;
            Func     : System.Address;
            Data     : System.Address;
            Notify   : System.Address) return G_Source_Id;
         pragma Import (C, Internal, "g_idle_add_full");

         D : constant Cb_Record_Access := new Cb_Record'
           (Func   => Func,
            Notify => Notify,
            Data   => new Data_Type'(Data));
      begin
         return Internal
           (Priority, General_Cb'Address, Convert (D), Free_Data'Address);
      end Idle_Add;

      -----------------
      -- Timeout_Add --
      -----------------

      function Timeout_Add
        (Interval : Guint;
         Func     : G_Source_Func;
         Data     : Data_Type;
         Priority : G_Priority := Priority_Default;
         Notify   : Destroy_Notify := null) return G_Source_Id
      is
         function Internal
           (Priority : G_Priority;
            Interval : Guint;
            Func     : System.Address;
            Data     : System.Address;
            Notify   : System.Address) return G_Source_Id;
         pragma Import (C, Internal, "g_timeout_add_full");

         D : constant Cb_Record_Access := new Cb_Record'
           (Func   => Func,
            Notify => Notify,
            Data   => new Data_Type'(Data));
      begin
         return Internal
           (Priority, Interval,
            General_Cb'Address, Convert (D), Free_Data'Address);
      end Timeout_Add;

      ------------------
      -- Set_Callback --
      ------------------

      procedure Set_Callback
        (Source   : G_Source;
         Func     : G_Source_Func;
         Data     : Data_Type;
         Notify   : Destroy_Notify := null)
      is
         procedure Internal
           (Source : G_Source;
            Func   : System.Address;
            Data   : System.Address;
            Notify : System.Address);
         pragma Import (C, Internal, "g_source_set_callback");

         D : constant Cb_Record_Access := new Cb_Record'
           (Func   => Func,
            Notify => Notify,
            Data   => new Data_Type'(Data));
      begin
         Internal (Source, General_Cb'Address, Convert (D), Free_Data'Address);
      end Set_Callback;

   end Generic_Sources;

   ------------
   -- Remove --
   ------------

   function Remove (Id : G_Source_Id) return Boolean is
      function Internal (Id : G_Source_Id) return Gboolean;
      pragma Import (C, Internal, "g_source_remove");
   begin
      return Boolean'Val (Internal (Id));
   end Remove;

   ------------
   -- Remove --
   ------------

   procedure Remove (Id : G_Source_Id) is
      Tmp : Boolean;
      pragma Unreferenced (Tmp);
   begin
      Tmp := Remove (Id);
   end Remove;

   ----------------------
   -- Default_Dispatch --
   ----------------------

   function Default_Dispatch
     (Source : G_Source; Cb : G_Source_Func_User_Data; Data : System.Address)
      return Gboolean
   is
      pragma Unreferenced (Source);
   begin
      if Cb /= null then
         return Cb (Data);
      else
         --  No callback set => No need to call this g_source again, even.
         return 0;
      end if;
   end Default_Dispatch;

   -------------
   -- Acquire --
   -------------

   function Acquire (Context : G_Main_Context) return Boolean is
      function Internal (Context : G_Main_Context) return Gboolean;
      pragma Import (C, Internal, "g_main_context_acquire");
   begin
      return Boolean'Val (Internal (Context));
   end Acquire;

   --------------
   -- Is_Owner --
   --------------

   function Is_Owner (Context : G_Main_Context) return Boolean is
      function Internal (Context : G_Main_Context) return Gboolean;
      pragma Import (C, Internal, "g_main_context_is_owner");
   begin
      return Boolean'Val (Internal (Context));
   end Is_Owner;

   ---------------------
   -- Set_Can_Recurse --
   ---------------------

   procedure Set_Can_Recurse (Source : G_Source; Can_Recurse : Boolean) is
      procedure Internal (Source : G_Source; Can_Recurse : Gboolean);
      pragma Import (C, Internal, "g_source_set_can_recurse");
   begin
      Internal (Source, Boolean'Pos (Can_Recurse));
   end Set_Can_Recurse;

   ---------------------
   -- Get_Can_Recurse --
   ---------------------

   function Get_Can_Recurse (Source : G_Source) return Boolean is
      function Internal (Source : G_Source) return Gboolean;
      pragma Import (C, Internal, "g_source_get_can_recurse");
   begin
      return Boolean'Val (Internal (Source));
   end Get_Can_Recurse;

end Glib.Main;