(*********************************************************************
 *
 *  :Program.    Queue.def
 *  :Author.     Michael Frieß
 *  :Address.    Kernerstr. 22a
 *  :shortcut.   [MiF]
 *  :Version.    1.0
 *  :Date.       14.09.88
 *  :Copyright.  PD
 *  :Language.   Modula-II
 *  :Translator. M2Amiga
 *  :Imports.    MemSystem (at least V1.0 --> Amok#5)
 *  :Contents.   Generic data type: Queue
 *
 *********************************************************************)

DEFINITION MODULE Queue;
(* (C) Copyright 1988 by Michael Frieß *)

FROM SYSTEM   IMPORT BYTE, ADDRESS;

TYPE queue; (* opaque type! *)
     (* queue is a simple FIFO-list (First-In-First-Out) *)

PROCEDURE Init (VAR q:queue);
  (* :output.q = use this variable, when you call queue-procedures
     :semantic.Initialize queue q for further use
  *)


PROCEDURE Write (q:queue; Data : ARRAY OF BYTE);
  (* :input.q    = data is to be written in this queue
     :input.data = data to be written
     :semantic.a new element is appended at end of queue q
     :semantic.containing the given data.
  *)

PROCEDURE Read (q:queue; VAR Data : ARRAY OF BYTE);
  (* :input. q    = read of this queue
     :output.Data = contents of first element in queue
     :semantic.The contents of the first element is read into Data
     :semantic.and first element is deleted from queue.
  *)

PROCEDURE Empty (q:queue) : BOOLEAN;
  (* :input.q = queue
     :return.TRUE  : queue is empty
     :return.FALSE : otherwise
     :semantic.returns, whether queue is empty or not.
  *)


PROCEDURE Discard (VAR q:queue);
  (* :input.q = queue
     :semantic.Memory allocated for queue q is given back to
     :semantic.operating system.
  *)

END Queue.
