comp.lang.ada
 help / color / mirror / Atom feed
From: "Ratson Janiv" <janiv@013.net.il>
Subject: Re: coding problems, please help.
Date: Mon, 8 Dec 2003 23:31:32 +0200
Date: 2003-12-08T23:31:32+02:00	[thread overview]
Message-ID: <3fd4ee3b$1@news.barak.net.il> (raw)
In-Reply-To: 3fd4e0e2$1@news.barak.net.il

I found something ...
Still having a problem ...
procedure Q2 is

    package My_Base_Queue is new Jr.Queue(T=>Integer);

    package My_Queue_Max is new My_Base_Queue(">"=>">");

begin

null;

end Q2;

Compile Error :

q2.adb:12:32: expect name of generic package in instantiation

Help Needed,
10x.


"Ratson Janiv" <janiv@013.net.il> wrote in message
news:3fd4e0e2$1@news.barak.net.il...
> with Jr.Queue;
>
> with Jr.Queue.Max_Bounded_Queue;
>
> use Jr.Queue.Max_Bounded_Queue;
>
> procedure Q2 is
>
> package My_Queue is new Max_Bounded_Queue(T=>Integer,">"=>">");
>
>
> begin
>
>
> null;
>
> end Q2;
>
>  compile error :
>
> q2.adb:5:07: invalid prefix in selected component "Queue"
>
> q2.adb:9:28: "Max_Bounded_Queue" is not visible
>
> q2.adb:9:28: non-visible declaration at jr-queue-max_bounded_queue.ads:7
>
> q2.adb:9:28: non-visible declaration at jr-queue-max_bounded_queue.ads:5
>
> why ?
>
> generic
>
>    type T is private;
>
> package Jr.Queue is
>    type Queue is abstract tagged private;
>
>    procedure Push(Q: in out Queue'class;Item:T) is abstract;
>    procedure Pop(Q: in out Queue'class;Item:in out T) is abstract;
>    function Empty(Q: Queue'class) return Boolean is abstract;
>
>    private
>
>       type Queue is tagged null record;
>
> end Jr.Queue;
>
>
>
> -------------------------
>
> with Jr.Queue;
>
> generic
> package Jr.Queue.Max_Queue is
>
>    type Max_Queue is abstract new Queue with null record;
>
>    function Max(Q:Max_Queue) return T is abstract;
>
> end Jr.queue.Max_Queue;
>
>
> -----------------------
>
> generic
>
>    with function ">"(Item1,Item2:T) return Boolean;
>
> package Jr.Queue.Max_Bounded_Queue is
>
>    type Max_Bounded_Queue is new Queue with private;
>
>    procedure Push(Q: in out Max_Bounded_Queue;Item:T);
>    procedure Pop(Q: in out Max_Bounded_Queue;Item:in out T);
>    function Empty(Q: Max_Bounded_Queue) return Boolean;
>    function Max(Q:Max_Bounded_Queue) return T;
>
>    Queue_Full, Queue_Empty :exception;
>
>    private
>
>    Num_Items : constant := 100;
>
>    type Queue_Arr is array (1..Num_Items) of T;
>
>    type Max_Bounded_Queue is new Queue with record
>       Arr : Queue_Arr;
>       I : Integer := 1;
>       Max_Item : T;
>    end record;
>
>    procedure Find_Max(Q: in out Max_Bounded_Queue);
>
> end Jr.Queue.Max_Bounded_Queue;
>
>
>
> 10x.
>
>





  reply	other threads:[~2003-12-08 21:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-08 20:34 coding problems, please help Ratson Janiv
2003-12-08 21:31 ` Ratson Janiv [this message]
2003-12-09  7:48   ` Petter Fryklund
2003-12-09  8:40   ` Dmitry A. Kazakov
2003-12-13 15:13     ` Mr. J.
2003-12-13 17:19       ` Dmitry A. Kazakov
2003-12-13 14:58   ` Ratson Janiv
replies disabled

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