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,225946aa0d08aebc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-07 03:06:16 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!128.39.3.168!uninett.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: Why can't i get an EXE! Date: Mon, 7 Jan 2002 11:06:15 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: NNTP-Posting-Host: kiuk0156.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1010401575 14805 129.241.83.82 (7 Jan 2002 11:06:15 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Mon, 7 Jan 2002 11:06:15 +0000 (UTC) User-Agent: slrn/0.9.7.3 (Linux) Xref: archiver1.google.com comp.lang.ada:18596 Date: 2002-01-07T11:06:15+00:00 List-Id: On Sat, 5 Jan 2002 23:33:58 -0000, NTL wrote: > Package: QUE PACKAGE > > Hi > I am a university student studying computer science's and have to create a > small program as part of my coursework > The program below compiles perfectly and builds in ADAGIDE GNAT3.11, > however, I can not get it to create the .C and .EXE files... am I making > some small fundemental mistake. > > any help gladly recievied. > > David. > > P.s. Complete newbie to ADA programming. > > > >>> BEGIN QUE.ADS > > package que is > empty_queue : EXCEPTION; > > type queue is array(1..500) of integer; > > q : queue; > tail : integer := 0; > head : integer := 1; > count : integer := 0; Remove the 4 lines above. You don't need them. > qs : queue; > tails : integer := 0; > heads : integer := 1; > n : integer; Move line above to add procedure. > A : integer; Move line above to main procedure. > procedure initialiser(q: in out queue; head: in out integer; tail: in out > integer); > procedure add(q: in out queue; head: in out integer; tail: in out integer); > procedure remove(q: in out queue; head: in out integer; tail: in out > integer); > procedure show(q: in out queue; head: in out integer; tail: in out integer); replace "in out" with "in" in the 1 line above. > procedure remove(q: in out queue; head: in out integer; tail: in out > integer) is > begin > if head < tail then This must be wrong? > --put_line("Queue is currently empty"); > raise EMPTY_QUEUE; > else > head := head + 1; Why do you do this? > procedure show(q: in out queue; head: in out integer; tail: in out integer) > is > begin > if head < tail then This must be wrong? > > begin > loop > initialiser(q => qs, head => heads, tail => tails); When you put the initialiser inside the loop it will be called each time and thus reset your queue. Move it outside the loop. Preben -- () Join the worldwide campaign to protect fundamental human rights. '||} {||' http://www.amnesty.org/