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,c76108e955e7f138 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-26 20:21:47 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sunqbc.risq.qc.ca!falcon.america.net!eagle.america.net.POSTED!not-for-mail Message-ID: <3C2AA1E4.E2C3D57C@otelco.net> From: Larry Hazel X-Mailer: Mozilla 4.78 [en] (Win98; U) X-Accept-Language: en,x-ns11F8K63r3NhQ,x-ns2r2e09OnmPe2 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Why won't this package compile? - ERRORS FIXED & NEW PROBLEMS & New Source Code Listing References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 26 Dec 2001 22:21:56 -0600 NNTP-Posting-Host: 66.0.32.230 X-Trace: eagle.america.net 1009426907 66.0.32.230 (Wed, 26 Dec 2001 23:21:47 EST) NNTP-Posting-Date: Wed, 26 Dec 2001 23:21:47 EST Organization: 24hoursupport.com Xref: archiver1.google.com comp.lang.ada:18320 Date: 2001-12-26T22:21:56-06:00 List-Id: 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