DIRECTORY Rope USING [ROPE], IO USING [STREAM, DeliverWhenProc, IsACR], ViewerClasses USING [Viewer] ; ViewerIO: CEDAR DEFINITIONS IMPORTS IO = BEGIN CreateViewerStreams: PROC [name: Rope.ROPE, viewer: ViewerClasses.Viewer _ NIL, backingFile: Rope.ROPE _ NIL, editedStream: BOOL _ TRUE] RETURNS [in: IO.STREAM, out: IO.STREAM]; GetViewerFromStream: PROC [stream: IO.STREAM] RETURNS[ViewerClasses.Viewer]; CreateEditedViewerStream: PUBLIC PROCEDURE [in: IO.STREAM, echoTo: IO.STREAM, deliverWhen: IO.DeliverWhenProc _ IO.IsACR] RETURNS [h: IO.STREAM]; NotAllowed: PRIVATE ERROR [stream: IO.STREAM]; CreateMessageWindowStream: PROCEDURE RETURNS [IO.STREAM]; END. šFile: ViewerIO.mesa Teitelman on January 14, 1983 10:28 am If viewer is non-NIL, creates two streams, one for input, one for output, and "connects" them to the indicated viewer. Viewer must be of viewerclass TypeScript or raises RTTypesBasic.NarrowRefFault. If viewer is NIL, creates a Viewer of class TypeScript with name name, and proceeds as above. If backingFile is non-NIL, creates a file stream on this file (using overWrite semantics), then creates a dribble stream which outputs to the out and dribbles to the file stream, flushing every 256 characters, i.e. out _ IO.CreateDribbleStream[stream: out, dribbleTo: CreateFileStream[backingFile, overWrite], flushEveryNChars: 256] if editedStream is TRUE, in _ CreateEditedViewerStream[in, out]. N.B. It is perfectly permissible to have more than one output stream connected to the same viewer. However, if two input streams are connected to the same viewer and a character is typed, only one of the streams will get the character. If a viewer to which a viewer stream is connected is destroyed, the next time an attempt to do an output or input operation (or if the system is currently waiting for a character from that stream), the signal IO.ERROR[StreamClosed] will be raised. if stream is connected to a viewer, i.e. one of the values returned from CreateViewerStreams, return corresponding viewer, otherwise NIL. like IO.CreateEditedStream except that uses the typescript document itself as the "buffer". Thus, if editable typescripts are enabled, the user can edit any of the characters not yet read. For example, if deliverWhen = IsACR, the user can edit anything on the line that he is typing. This includes deleting material previously typed, as well as inserting new material. raised by a viewers edited stream when attempt made to set echo to other than out, or, more typically, when echoing is off during which time the buffer (viewer) gets out of synch. Caught by UserExec. Characters output to the stream will be displayed in the message window when the stream is flushed. Edited on December 14, 1982 4:58 pm, by Teitelman added NotAllowed and CreateMessageWindowStream changes to: NotAllowed, CreateMessageWindowStream ÊʘJ˜Jšœ™Jšœ'™'J˜šÏk ˜ Jšœœœ˜Jšœœœ˜*Jšœœ ˜J˜J˜—JšÐblœœœœ˜*J˜Jš˜J˜šÏnœœ œ!œœœœœœœœœœ˜²JšœÇ™ÇJšœ]™]JšœÌ™ÌJšœ@™@J™Jšœë™ëJ™J™÷J˜—š Ÿœœ œœœ˜LJšœ‰™‰—J˜šŸœœ œœœ œœœœœœœ˜‘Jšœð™ð—˜JšŸ œ œ œ˜.˜J™ÈJ™——š Ÿœ œœœœœ˜:J™c—J˜Jšœ˜J˜J˜™1J™.Jšœ Ïr%™1—J™—…—¨