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
|
gnatgcc -c -Iglade -g -O2 -gnatn -gnatws dgate.adb
dgate.adb:128:12: "Init" not declared in "Glade"
gnatmake: "dgate.adb" compilation error
--
Ludovic Brenta.
--- src/dgate.adb~
+++ src/dgate.adb
@@ -31,7 +31,7 @@
with Glade.XML; use Glade.XML;
with Gtk.Main;
with DGate_Callbacks;
-with System;
+with System.Address_To_Access_Conversions;
with Unchecked_Conversion;
with GNAT.OS_Lib;
with GNAT.Command_Line; use GNAT.Command_Line;
@@ -44,8 +44,11 @@
package My_Timeout is new Gtk.Main.Timeout (Integer);
- type String_Access is access all String;
- for String_Access'Size use Standard'Address_Size;
+ package String_Access_Conversions is
+ new System.Address_To_Access_Conversions (Object => String);
+
+ subtype String_Access is
+ String_Access_Conversions.Object_Pointer;
N : Node_Ptr;
Id : Gtk.Main.Timeout_Handler_Id;
@@ -53,9 +56,6 @@
Filename : String_Ptr;
XML : Glade_XML;
- function To_Address is new Unchecked_Conversion
- (String_Access, System.Address);
-
procedure Register_Signals (N : Node_Ptr);
-- Call Set_Signal for each signal declared in the N tree.
@@ -76,7 +76,7 @@
S := new String '(Name.all & ':' & Handler.all);
Signal_Connect
(XML, Handler.all, DGate_Callbacks.Generic_Callback'Address,
- To_Address (S));
+ String_Access_Conversions.To_Address (S));
return;
end if;
end if;
@@ -125,7 +125,6 @@
end if;
Gtk.Main.Init;
- Glade.Init;
N := Parse (Filename.all);
Gtk_New (XML, Filename.all);
Register_Signals (N);
--- src/dgate_callbacks.adb~
+++ src/dgate_callbacks.adb
@@ -21,17 +21,10 @@
-- This package provides to DGATE a generic callback
with Ada.Text_IO;
-with Unchecked_Conversion;
with Gtk.Main;
package body DGate_Callbacks is
- type String_Ptr is access all String;
- for String_Ptr'Size use Standard'Address_Size;
-
- function To_String is new Unchecked_Conversion
- (System.Address, String_Ptr);
-
----------------------
-- Generic_Callback --
----------------------
|