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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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 14:04:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!t-online.de!diablo.theplanet.net!news-hub.cableinet.net!blueyonder!newspeer.clara.net!news.clara.net!news5-gui.server.ntli.net!ntli.net!news2-win.server.ntlworld.com.POSTED!not-for-mail Reply-To: "Liddle Feesh" From: "Liddle Feesh" Newsgroups: comp.lang.ada References: Subject: Re: Why can't i get an EXE! X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: Date: Mon, 7 Jan 2002 21:59:00 -0000 NNTP-Posting-Host: 213.105.185.39 X-Complaints-To: abuse@ntlworld.com X-Trace: news2-win.server.ntlworld.com 1010440737 213.105.185.39 (Mon, 07 Jan 2002 21:58:57 GMT) NNTP-Posting-Date: Mon, 07 Jan 2002 21:58:57 GMT Organization: ntl Cablemodem News Service Xref: archiver1.google.com comp.lang.ada:18626 Date: 2002-01-07T21:59:00+00:00 List-Id: "NTL" wrote: > >> BEGIN QUE.ADS > > package que is > empty_queue : EXCEPTION; > > type queue is array(1..500) of integer; Array 1..500? Big time efficiency waste !!! You have to incorporate this using linked lists. Okay. In reference to Real Time Programming - you have to justify these changes to the master spec. > < > >>BEGIN QUE.ADB > > with ada.text_io, ada.integer_text_io; > use ada.text_io, ada.integer_text_io; > with text_io; > use text_io; ^^^ Big inconsistancy > > package body que is > > > > procedure initialiser(q: in out queue; head: in out integer; tail: in out > integer) is > begin > tail := 0; > head := 1; > for count in head..tail loop > q(count) := 0; > end loop; > > end initialiser; > > procedure add(q: in out queue; head: in out integer; tail: in out integer) > is > begin > put_line("Please enter an integer "); > get(n); > tail := tail+1; > q(tail) := n; > --call proc show here > end add; > > procedure remove(q: in out queue; head: in out integer; tail: in out > integer) is > begin > if head < tail then > --put_line("Queue is currently empty"); > raise EMPTY_QUEUE; > else > head := head + 1; > end if; > --call proc show here You have implemented this using an array. The node should contain a pointer of type link which points to the base value of the next node. Geddit? > exception > when EMPTY_QUEUE=> > SKIP_LINE; > Put_Line("The queue is currently empty"); > NEW_LINE; > > end remove; > > procedure show(q: in out queue; head: in out integer; tail: in out integer) > is > begin > if head < tail then > --put_line("Queue is currently empty"); > raise EMPTY_QUEUE; > else > for count in head..tail loop > put_line(" "); > end loop; > end if; > exception > when EMPTY_QUEUE=> > SKIP_LINE; > Put_Line("The queue is currently empty"); > NEW_LINE; > > end show; > > > begin > loop > initialiser(q => qs, head => heads, tail => tails); > Put_Line("****************************"); > Put_Line(" 1). Add to queue"); > Put_Line(" 2). remove to queue"); > Put_Line(" 3). Quit queue program"); > Put_Line("****************************"); > get(A); > case A is --Execute menu option depending on A's value > when 1 => add(q => qs, head => heads, tail => tails); > when 2 => remove(q => qs, head => heads, tail => tails); > when 3 => exit; > when others => Put_Line("Sorry incorrect entry please retry"); > end case; > end loop; > > > end que; > > << ' o'^ (Remove UNDERPANTS to reply)