by "Jeffrey R. Carter" <spam.jrcarter.not@[EMAIL PROTECTED]
>
May 8, 2008 at 04:09 AM
ophir.geffen@[EMAIL PROTECTED]
wrote:
>
> * queues.ads:
> with Ada.Text_IO;
> generic
> type Item is private;
> with procedure Item_Put(The_Item : in Item);
Item_Put has exactly one parameter.
> package Int_IO is new Ada.Text_IO.Integer_IO(Integer);
> package Int_Queues is new Queues(Item => Integer, Item_Put =>
> Int_IO.Put); --- error here
>
> The package compiles on its own, but when I try to compile Test_Queues
> there is an error:
> no visible subprogram matches the specification for "Item_Put"
Ada.Text_IO.Integer_IO has the following procedures named Put:
procedure Put(File : in File_Type;
Item : in Num;
Width : in Field := Default_Width;
Base : in Number_Base := Default_Base);
procedure Put(Item : in Num;
Width : in Field := Default_Width;
Base : in Number_Base := Default_Base);
procedure Put(To : out String;
Item : in Num;
Base : in Number_Base := Default_Base);
None of these has exactly one parameter. That's why Int_IO.Put doesn't
match
Item_Put.
You can call the 2nd of these with only one explicit parameter:
Int_IO.Put (Item => 7);
but it still has 3 parameters; the other 2 get the default values as the
actual
parameters.
You need to create a procedure that matches Item_Put:
procedure Put (Item : in Integer) is
-- null;
begin -- Put
Int_IO.Put (Item => Item);
end Put;
and use it to instantiate your generic package.
--
Jeff Carter
"I unclog my nose towards you."
Monty Python & the Holy Grail
11