comp.lang.ada
 help / color / mirror / Atom feed
From: "Rolf" <rolf.ebert_nospam_@gmx.net>
Subject: Timing events in GNAT GPL 2006
Date: 12 Jan 2007 08:49:14 -0800
Date: 2007-01-12T08:49:14-08:00	[thread overview]
Message-ID: <1168620554.469932.313660@a75g2000cwd.googlegroups.com> (raw)

I wanted to test the new Ada timing events with GNAT GPL 2006.  Here is
some code that should print a line every second. GNAT does not accept
my protected procedure when setting the handler. Why? I don't see my
error.

    Rolf
--
with Ada.Real_Time;                use Ada.Real_Time;
with Ada.Real_Time.Timing_Events;  use Ada.Real_Time.Timing_Events;
with Ada.Text_IO;                  use Ada.Text_IO;

procedure Test_Timing_Event is

   protected Clock_Tick is
      procedure Inc_Clock (Ev : Timing_Event);
   end Clock_Tick;

   Tick    : Timing_Event;
   One_Sec : constant Time_Span := Seconds (1);

   protected body Clock_Tick is
      procedure Inc_Clock (Ev : Timing_Event)
      is
      begin
         Put_Line ("Inc_Sec");
         -- using Time_Span
         Set_Handler (Tick, One_Sec, Handler => Inc_Clock'Access);
      end Inc_Clock;
   end Clock_Tick;

begin
   -- using absolute time
   Set_Handler (Tick, Clock + One_Sec, Clock_Tick.Inc_Clock'Access);
   loop null; end loop;
end Test_Timing_Event;

$ gnatmake -gnat05 test_timing_event.adb
gcc -c -gnat05 test_timing_event.adb
test_timing_event.adb:20:10: no candidate interpretations match the
actuals:
test_timing_event.adb:20:29: expected private type "Ada.Real_Time.Time"
test_timing_event.adb:20:29: found private type
"Ada.Real_Time.Time_Span"
test_timing_event.adb:20:29:   ==> in call to "Set_Handler" at
a-rttiev.ads:47
test_timing_event.adb:20:58: expected type
"Ada.Real_Time.Timing_Events.Timing_Event_Handler"
test_timing_event.adb:20:58: found type access to procedure "Inc_Clock"
defined at line 20
test_timing_event.adb:20:58:   ==> in call to "Set_Handler" at
a-rttiev.ads:52
test_timing_event.adb:26:04: no candidate interpretations match the
actuals:
test_timing_event.adb:26:29: expected private type
"Ada.Real_Time.Time_Span"
test_timing_event.adb:26:29: found private type "Ada.Real_Time.Time"
test_timing_event.adb:26:29:   ==> in call to "Set_Handler" at
a-rttiev.ads:52
test_timing_event.adb:26:60: expected type
"Ada.Real_Time.Timing_Events.Timing_Event_Handler"
test_timing_event.adb:26:60: found type access to procedure "Inc_Clock"
defined at line 26
test_timing_event.adb:26:60:   ==> in call to "Set_Handler" at
a-rttiev.ads:47
gnatmake: "test_timing_event.adb" compilation error

$ gnatls -v
GNATLS GPL 2006 (20060522-34)
Copyright 1997-2006, Free Software Foundation, Inc.




             reply	other threads:[~2007-01-12 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-12 16:49 Rolf [this message]
2007-01-12 17:40 ` Timing events in GNAT GPL 2006 Vo, Anh (US SSA)
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox