From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9def90e15d8accc X-Google-Attributes: gid103376,public X-Google-Thread: 16adf3,41810a0fecb9b060 X-Google-Attributes: gid16adf3,public X-Google-Thread: 12f38b,41810a0fecb9b060 X-Google-Attributes: gid12f38b,public X-Google-ArrivalTime: 2003-12-08 23:48:23 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: petter.fryklund@atero.se (Petter Fryklund) Newsgroups: comp.lang.ada,news.admin.lang.ada,news.groups.lang.ada Subject: Re: coding problems, please help. Date: 8 Dec 2003 23:48:22 -0800 Organization: http://groups.google.com Message-ID: <95234e08.0312082348.55e96733@posting.google.com> References: <3fd4e0e2$1@news.barak.net.il> <3fd4ee3b$1@news.barak.net.il> NNTP-Posting-Host: 138.14.239.132 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1070956103 17243 127.0.0.1 (9 Dec 2003 07:48:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 9 Dec 2003 07:48:23 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:3260 Date: 2003-12-08T23:48:22-08:00 List-Id: Since I beleive your working on an assignment, I'll only try to send you off in the right direction. Remove all use and use full names and you will see! Use should only be used in declare blocks or very short subprograms in my opinion. gl, Petter "Ratson Janiv" wrote in message news:<3fd4ee3b$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" 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. > > > >