DIRECTORY IO USING [STREAM], Rope USING [ROPE]; SchemeEvents: CEDAR DEFINITIONS ~ BEGIN InputQueue: TYPE ~ REF InputQueueRep; -- private rep below. InputEvent: TYPE ~ REF; -- one of the following: MouseEvent: TYPE ~ REF MouseEventRep; ReadyStreamEvent: TYPE ~ IO.STREAM; -- A stream that has chars available StreamErrorEvent: TYPE ~ REF StreamErrorEventRep; -- an error occured on this stream CharEvent: TYPE ~ REF CHAR; -- immutable! MakeInputQueue: PROC RETURNS [InputQueue]; Reset: PROC [queue: InputQueue]; Enqueue: PROC [queue: InputQueue, a: InputEvent]; EnqueueMouse: PROC [queue: InputQueue, me: MouseEventRep]; EnqueueStream: PROC [queue: InputQueue, stream: IO.STREAM]; FlushAvailableWhitespace: PROC [stream: IO.STREAM] RETURNS [newlineRead: BOOL]; Notify: PROC [queue: InputQueue, input: LIST OF REF ANY]; InputAvailable: PROC [queue: InputQueue] RETURNS [BOOL]; Dequeue: PROC [queue: InputQueue] RETURNS [a: InputEvent]; MouseEventRep: TYPE ~ RECORD [action: ATOM ¬ NIL, button: ATOM ¬ NIL, mx, my: INT ¬ 0, args: REF ¬ NIL]; StreamErrorEventRep: TYPE ~ RECORD [stream: IO.STREAM, object: REF, msg: Rope.ROPE]; InputQueueRep: TYPE ~ PRIVATE MONITORED RECORD [ ready: CONDITION, count: CARD, head: LIST OF InputEvent, last: LIST OF InputEvent, impl: REF ¬ NIL ]; END. δ SchemeEvents.mesa Copyright Σ 1989, 1991 by Xerox Corporation. All rights reserved. Created by Michael Plass, February 21, 1989 Michael Plass, February 21, 1989 12:34:03 pm PST Implements yet another queuing mechanism. This one is pull-model. ... or anything else the consumer and producer can agree on. Kills all outstanding events and stream waiters Producer side The basic queueing mechanism A convenience proc for a mouse event. The stream must be an input stream. When at least one character becomes available on it, a ReadyStreamEvent (or a StreamErrorEvent) will be generated. Until then, no other process should try to read from the stream. After the event is generated, EnqueueStream must be called again to generate further events. Reads any whitespace characters already on the stream, without blocking. It is often useful to call this before calling EnqueueStream. A convenience for parsing TIP-style events Consumer side The basic queueing mechanism Representations Κν•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ Οeœ7™BK™+™0K™—K™B—K˜š Οk œžœžœžœžœžœ˜/K˜—KšΠln œžœž ˜šœž˜K˜šœ žœžœΟc˜;K˜—šœ žœžœ ˜0Kšœ žœžœ˜%Kšœžœžœžœ $˜HKšœžœžœ "˜TKšœ žœžœžœ  ˜)K™