comp.lang.ada
 help / color / mirror / Atom feed
* Some help for a C++ guy
@ 2005-04-07 22:14 defaultuserbr
  2005-04-07 22:51 ` Ed Falis
  2005-04-08  4:43 ` tmoran
  0 siblings, 2 replies; 18+ messages in thread
From: defaultuserbr @ 2005-04-07 22:14 UTC (permalink / raw)


I've inherited some code that I'm expanding, and my Ada skills are
somewhat weak, I mostly do C and C++.

Our system will have multiple messages defined, with three essential
components, a data buffer, a status buffer, and a callback. Currently
this is defined in a generic package. The package spec follows:

with MIL_STD_1553;
with OS_Types;
generic
package Message_Handler is

   package M1553 renames MIL_STD_1553;

   procedure Message_Callback (Status : in M1553.IO_Status_T);

   function Num_Message_Callbacks return OS_Types.Unsigned_Word;

   function Num_Errors return OS_Types.Unsigned_Word;

   Data_Buf_Ptr : constant M1553.Data_Buf_VPtr_T := new M1553.Data_Buf;
   Stat_Buf_Ptr : constant M1553.Status_Buf_VPtr_T := new
M1553.Status_Buf_T;


end Message_Handler;


Then in the implementation code, there's stuff like:

   package Message_0_Handler is new Message_Handler;
   package Message_5_Handler is new Message_Handler;

The buffers and the callback have to be registered for each of these
instantiated messages through another subroutine.

I don't much like this. It's cumbersome even for a couple of messages,
let alone when we grow to 20 or more, because we have duplicated code
for each registration.

What I'd like is to have some sort of array of the messages. That way
one could iterate over the array and reduce duplicate code and chance
for errors. I guess I'm thinking an OO approach, as long as the various
members could be passed as arguments to the registration routines.

We are working in Ada95. However one twist is that we are using Gnat
Pro with  something called a certifiable subset. Here some stuff about
it:

http://www.extensionmedia.com/windriver/datasheet.php?ds=2

I don't know much more myself, other than we can't use tasking. I
understand that such limitations may make this too
implementation-specific for a general newsgroup. Any help would be
appreciated.



Brian




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2005-04-09 22:20 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-07 22:14 Some help for a C++ guy defaultuserbr
2005-04-07 22:51 ` Ed Falis
2005-04-07 23:18   ` defaultuserbr
2005-04-07 23:32     ` Ed Falis
2005-04-08 15:41       ` defaultuserbr
2005-04-08  5:50     ` Simon Wright
2005-04-08 15:47       ` defaultuserbr
2005-04-08 17:49       ` defaultuserbr
2005-04-08 20:42         ` tmoran
2005-04-08 21:18           ` defaultuserbr
2005-04-08 20:54         ` defaultuserbr
2005-04-08 22:20           ` tmoran
2005-04-08 23:03             ` defaultuserbr
2005-04-09  0:19               ` tmoran
2005-04-09 15:17                 ` defaultuserbr
2005-04-08  4:43 ` tmoran
2005-04-08 15:55   ` defaultuserbr
2005-04-09 22:20     ` Matthew Heaney

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