From: "Lucretia" <lucretia9@lycos.co.uk>
Subject: [wxAda] Problem with "limited with" in a *real* application
Date: 11 Oct 2005 08:17:01 -0700
Date: 2005-10-11T08:17:01-07:00 [thread overview]
Message-ID: <1129043820.987947.200870@z14g2000cwz.googlegroups.com> (raw)
I have a type hierarchy which is rooted at wx.Factory.Factory_Type,
inside this package there is a function which allows the programmer to
get the C++ pointer to the wx instance for any wxAda type
(Get_wxObject).
<wx.Factory>
package wx.Factory is
-- This is the base type of all wxAda types.
type Factory_Type is new Ada.Finalization.Limited_Controlled with
private;
...
function Get_wxObject(Self : in Factory_Type) return System.Address;
...
end wx.Factory;
</wx.Factory>
Inside wx.Core.Sizer I have a Set_Sizer procedure which actually
belongs to the wxWindow class and thus should be inside wx.Core.Window.
It cannot go there currently, because of cyclic dependencies
(wx.Core.Sizer also requires access to wx.Core.Window). I have tried to
get this working using Ada 2005's "limited with" but for some reason I
just cannot get it to compile. I think wx.Core.Window needs to have the
full view of the Sizer_Type.
<wx.Core.Window>
limited with wx.Core.Sizer;
package wx.Core.Window is
type Window_Type is new Event_Handler_Type with private;
procedure Set_Sizer(
Self : in Window_Type;
Sizer : access wx.Core.Sizer.Sizer_Type;
Delete_Old_Sizer : in Boolean := True);
end wx.Core.Window;
package body wx.Core.Window is
procedure Set_Sizer(
Self : in Window_Type;
Sizer : access wx.Core.Sizer.Sizer_Type;
Delete_Old_Sizer : in Boolean := True) is
procedure wxWindow_SetSizer(
Self, Sizer : in System.Address;
Delete_Old_Sizer : in C.int);
pragma Import(C, wxWindow_SetSizer, "wxWindow_SetSizer");
Delete_Old_Sizer_Converted : C.int := 0;
begin
if Delete_Old_Sizer = True then
Delete_Old_Sizer_Converted := 1;
end if;
wxWindow_SetSizer(Get_wxObject(Self), Get_wxObject(Sizer.all),
Delete_Old_Sizer_Converted);
end Set_Sizer;
end wx.Core.Window;
</wx.Core.Window>
<log>
$ gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1-20050902/configure
--prefix=/opt/gcc-4.1-20050902 --enable-libada
--enable-languages=c,c++,objc,ada
Thread model: posix
gcc version 4.1.0 20050902 (experimental)
...
gcc -c -g -gnatf -gnatwj -gnat05 wx-core-window.adb
wx-core-window.adb:751:43: no candidate interpretations match the
actuals:
wx-core-window.adb:751:62: missing with_clause for scope of imported
type "Sizer.Sizer_Type"
wx-core-window.adb:751:62: ==> in call to "get_wxobject" at
wx-core-window.ads:22(inherited)
wx-core-window.adb:751:62: ==> in call to "get_wxobject" at
wx-core-colour.ads:9(inherited)
wx-core-window.adb:751:62: ==> in call to "get_wxobject" at
wx-base-event_handler.ads:17(inherited)
wx-core-window.adb:751:62: ==> in call to "get_wxobject" at
wx-base-event.ads:18(inherited)
wx-core-window.adb:751:62: ==> in call to "get_wxobject" at
wx-base-object.ads:21(inherited)
wx-core-window.adb:751:62: ==> in call to "Get_wxObject" at
wx-factory.ads:32
gnatmake: "wx-core-window.adb" compilation error
raised MAKE.COMPILATION_FAILED : make.adb:4791
</log>
next reply other threads:[~2005-10-11 15:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-11 15:17 Lucretia [this message]
2005-10-11 21:23 ` [wxAda] Problem with "limited with" in a *real* application Randy Brukardt
2005-10-12 17:06 ` Lucretia
2005-10-13 14:50 ` Lucretia
2005-10-13 16:18 ` Lucretia
2005-10-14 0:36 ` Randy Brukardt
2005-10-14 15:03 ` Lucretia
2005-10-14 23:47 ` Randy Brukardt
2005-10-15 13:48 ` Lucretia
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox