comp.lang.ada
 help / color / mirror / Atom feed
* Can someone help me understand this queue package?
@ 2001-12-28 17:14 Liddle Feesh
  2001-12-28 18:16 ` Michal Nowak
  0 siblings, 1 reply; 18+ messages in thread
From: Liddle Feesh @ 2001-12-28 17:14 UTC (permalink / raw)


Essentially, I have a spec, and I'm trying my damndest to write a body for
it - and though I've tried (hence my previous two posts here), I'm still
quite stuck, with only a very basic stub compiling.

Does anyone have any decent queue tutorials? I've tried looking for a few on
the net - adapower, an ada program (console), and several books... However
when it comes to queues I'm none-the-wiser...

Looking at the pointers - is this some sort of linked list?

Could someone be so kind as to convert the following package into
pseudo-code for me?

Thanks in advance

--
Liddle Feesh
 '  O 0 o <"//><  ' o'^
(Remove UNDERPANTS to reply)





 package queue_package is

 -- queue type definition
  TYPE queue is LIMITED PRIVATE;
   empty_queue   :   EXCEPTION;

 procedure  initialise   (q:  in out queue);
 -- function mode 'in' added. Although the mode of all parameters must be
'in' for
 -- functions, it's always a good idea to show explicitly.
 function  is_empty_queue  (q:  in 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;

---------------------------------------------------------------------

X-No-Archive: Yes





^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2001-12-31 10:32 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-28 17:14 Can someone help me understand this queue package? Liddle Feesh
2001-12-28 18:16 ` Michal Nowak
2001-12-28 22:57   ` Liddle Feesh
2001-12-29 11:35     ` Michal Nowak
2001-12-29 19:37       ` Liddle Feesh
2001-12-29 20:05         ` Michal Nowak
2001-12-29 20:44           ` Liddle Feesh
2001-12-29 22:02       ` Liddle Feesh
2001-12-30 13:14         ` Michal Nowak
2001-12-30 22:28           ` Liddle Feesh
2001-12-31 10:32             ` Michal Nowak
2001-12-29 17:13   ` Liddle Feesh
2001-12-29 18:42     ` martin.m.dowie
2001-12-29 19:09       ` Liddle Feesh
2001-12-29 17:13   ` Liddle Feesh
2001-12-29 17:13   ` Liddle Feesh
2001-12-29 17:14     ` Liddle Feesh
2001-12-29 17:39     ` Liddle Feesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox