DEFINITION MODULE QSUUI; (*=========================================================== Version : 1.00 03 May 1989 C. Lins Compiler : TopSpeed Modula-2 Component: Monolithic Structures - Queue (Opaque version) Non-priority Non-balking Sequential Unbounded Unmanaged Iterator This module is designed for use with the basic data types (e.g., INTEGERs, POINTERs to other structures) as data items. You must type cast the generic Items to/from your basic data type. Clear and Destroy now have O(1) complexity. Refer to the QueueSBMI module for all other commentary. REVISION HISTORY v1.00 03 May 1989 C. Lins: Initial implementation derived from QueueSBMI module. (C) Copyright 1989 Charles A. Lins ===========================================================*) FROM ErrorHandling IMPORT (*--Type*) HandlerProc; FROM Items IMPORT (*--Type*) Item, AccessProc, LoopAccessProc; FROM QEnum IMPORT (*--Type*) Exceptions; (*-- Type Declarations --*) TYPE Queue; CONST NullQueue = Queue(NIL); (*-- Exceptions --*) CONST ModuleID = 21; PROCEDURE QueueError () : Exceptions (*-- out *); PROCEDURE SetHandler ( theError : Exceptions (*-- in *); theHandler : HandlerProc (*-- in *)); PROCEDURE GetHandler ( theError : Exceptions (*-- in *)) : HandlerProc (*-- out *); (*-- Constructors --*) PROCEDURE Create () : Queue (*-- out *); PROCEDURE Destroy (VAR theQueue : Queue (*-- inout *)); PROCEDURE Clear (VAR theQueue : Queue (*-- inout *)); PROCEDURE Assign ( theQueue : Queue (*-- in *); VAR toQueue : Queue (*-- inout *)); PROCEDURE Arrive (VAR theQueue : Queue (*-- inout *); theItem : Item (*-- in *)); PROCEDURE Depart (VAR theQueue : Queue (*-- inout *)); (*-- Selectors --*) PROCEDURE IsDefined ( theQueue : Queue (*-- in *)) : BOOLEAN (*-- out *); PROCEDURE IsEmpty ( theQueue : Queue (*-- in *)) : BOOLEAN (*-- out *); PROCEDURE IsEqual ( left : Queue (*-- in *); right : Queue (*-- in *)) : BOOLEAN (*-- out *); PROCEDURE LengthOf ( theQueue : Queue (*-- in *)) : CARDINAL (*-- out *); PROCEDURE FrontOf ( theQueue : Queue (*-- in *)) : Item (*-- out *); (*-- Iterators --*) PROCEDURE LoopOver ( theQueue : Queue (*-- in *); theProcess: LoopAccessProc (*-- in *)); PROCEDURE Traverse ( theQueue : Queue (*-- in *); theProcess: AccessProc (*-- in *)); END QSUUI.