From: Larry Hazel <lhhazel@otelco.net>
Subject: Re: Why won't this package compile? - ERRORS FIXED & NEW PROBLEMS & New Source Code Listing
Date: Wed, 26 Dec 2001 22:21:56 -0600
Date: 2001-12-26T22:21:56-06:00 [thread overview]
Message-ID: <3C2AA1E4.E2C3D57C@otelco.net> (raw)
In-Reply-To: aOsW7.49370$4z5.6910230@news6-win.server.ntlworld.com
Liddle Feesh wrote:
>
> Okay, the package SPEC compiles, and I have saved this as queue_package.ads
>
> However - the package body doesn't... I've made the changes as you wonderful
> people have suggested, but am still erroring...
>
> One problem was that I was making package body definitions(?) for a
> function. The following procedure should not have been included in the
> package body. It was declared as (and should stay as - a function).
>
> procedure is_empty_Queue (q: queue)
> begin
> null; -- Do nothing
> end is_empty_Queue;
>
> Removing this removed about 10 errors from the program.
>
> The remaining two errors (as reported by ObjectADA 7.2 Compiler) are:
>
> Error: Line 6 col 13 ... Completion required for specification 'initialise',
> Continuing
> Error: Line 7 col 12 ... Completion required for specification
> 'is_empty_queue', Continuing
>
> is_empty_queue is a function (I hope to iterate through the list, and return
> boolean true/false if empty), and 'initialise' seems to be properly complete
> to me.
>
> What on earth is the problem here? It's passed me completely. I have
> attached the queue_package.ads file, which contains both Spec and Body.
>
> TIA
>
> --
> Liddle Feesh
> ' O 0 o <"//>< ' o'^
> (Remove UNDERPANTS to reply)
>
> -- START OF FILE
> ---------------------------------------------------------------------
>
> -- Queue_Package Spec
> ---------------------------------------------------------------------
> package queue_package is
>
> TYPE queue is LIMITED PRIVATE;
> empty_queue : EXCEPTION; -- !! FIRST ERROR REPORTED HERE
> -- !! SECOND ERROR REPORTED HERE
> procedure initialise (q: in out queue);
> function is_empty_queue (q: queue) return boolean;
> procedure add(n: in integer; q: in out queue);
> procedure remove(n: out integer; q: in out queue);
> --remove raises the exception "empty-queue" if applied to an empty queue
>
> PRIVATE
> TYPE node;
> TYPE link is ACCESS node; --ACCESS is a pointer type
> TYPE node is RECORD
> value : integer;
> next : link :=NULL;
> END RECORD;
>
> TYPE queue is RECORD
> head : link;
> tail : link;
> END RECORD;
>
> END queue_package;
>
> -- Queue_Package Body
> ---------------------------------------------------------------------
> package body Queue_Package is
>
> procedure add (n: in integer; q: in out queue) is
> begin
> null; -- Do nothing
> end add;
>
> procedure remove (n: out integer; q: in out queue) is
> begin
> null; -- Do nothing
> end Remove;
>
> procedure initalise (q: in out queue) is
> begin
> null; -- Do nothing
> end initalise;
>
> end Queue_Package;
>
> -- END OF FILE
> ---------------------------------------------------------------------
You still need a stub body for the function is_empty_queue in the package body.
Just return either true or false. initialise is spelled initalise in the body.
Fix these 2 things and the package body compiles.
Larry
next prev parent reply other threads:[~2001-12-27 4:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-26 13:33 Why won't this package compile? Liddle Feesh
2001-12-26 14:15 ` Liddle Feesh
2001-12-26 14:59 ` Michal Nowak
2001-12-26 22:20 ` Liddle Feesh
2001-12-27 8:21 ` Michael Bode
2001-12-27 10:02 ` Michal Nowak
2001-12-27 17:03 ` Liddle Feesh
2001-12-28 9:15 ` GNAT on Win2K Was: " Michal Nowak
2001-12-28 16:25 ` Alfred Hilscher
2001-12-28 17:08 ` Liddle Feesh
2001-12-26 15:08 ` Jeff Creem
2001-12-26 14:49 ` Larry Hazel
2001-12-26 22:21 ` Liddle Feesh
2001-12-27 1:19 ` Larry Hazel
2001-12-26 19:33 ` martin.m.dowie
2001-12-26 23:10 ` Why won't this package compile? - ERRORS FIXED & NEW PROBLEMS & New Source Code Listing Liddle Feesh
2001-12-27 4:21 ` Larry Hazel [this message]
2001-12-27 16:57 ` Liddle Feesh
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox