DEFINITION MODULE MiniCircularBuffers; (****************************************************************) (* *) (* Circular Buffer for passing character data *) (* between a pair of tasks. (Demonstration version.) *) (* *) (* Author: P. Moylan *) (* Last edited: 16 August 1992 *) (* *) (* Status: OK. *) (* *) (****************************************************************) TYPE CircularBuffer; (* is private *) PROCEDURE CreateBuffer (VAR (*OUT*) B: CircularBuffer; size: CARDINAL); (* Allocates space for a circular buffer, and initializes it. The *) (* caller specifies how many characters the buffer will hold. *) PROCEDURE PutBuffer (B: CircularBuffer; item: CHAR); (* Waits for space available, then puts item at the tail of the queue. *) PROCEDURE GetBuffer (B: CircularBuffer) : CHAR; (* Takes one character from the head of the queue, waiting if necessary. *) END MiniCircularBuffers.