DIRECTORY BasicTime, IO, RefTab, Rope; BrineIO: CEDAR DEFINITIONS = BEGIN ReadRefProc: TYPE = PROC [IO.STREAM] RETURNS [REF]; WriteRefProc: TYPE = PROC [IO.STREAM, REF]; ReadInt: PROC [stream: IO.STREAM] RETURNS [int: INT]; WriteInt: PROC [stream: IO.STREAM, int: INT]; ReadBool: PROC [stream: IO.STREAM] RETURNS [bool: BOOL]; WriteBool: PROC [stream: IO.STREAM, bool: BOOL]; ReadReal: PROC [stream: IO.STREAM] RETURNS [real: REAL]; WriteReal: PROC [stream: IO.STREAM, real: REAL]; ReadGMT: PROC [stream: IO.STREAM] RETURNS [gmt: BasicTime.GMT]; WriteGMT: PROC [stream: IO.STREAM, gmt: BasicTime.GMT]; ReadAtom: PROC [stream: IO.STREAM] RETURNS [atom: ATOM]; WriteAtom: PROC [stream: IO.STREAM, atom: ATOM]; ReadID: PROC [stream: IO.STREAM] RETURNS [id: Rope.ROPE]; WriteID: PROC [stream: IO.STREAM, id: Rope.ROPE]; ReadRope: PROC [stream: IO.STREAM] RETURNS [rope: Rope.ROPE]; WriteRope: PROC [stream: IO.STREAM, rope: Rope.ROPE]; ReadAtomRef: ReadRefProc; WriteAtomRef: WriteRefProc; ReadIDRef: ReadRefProc; WriteIDRef: WriteRefProc; ReadRopeRef: ReadRefProc; WriteRopeRef: WriteRefProc; ReadRopes: PROC [stream: IO.STREAM] RETURNS [ropes: LIST OF Rope.ROPE]; WriteRopes: PROC [stream: IO.STREAM, ropes: LIST OF Rope.ROPE]; ReadRefTab: PROC [stream: IO.STREAM, readKey, readVal: ReadRefProc, equal: RefTab.EqualProc _ NIL, hash: RefTab.HashProc _ NIL] RETURNS [table: RefTab.Ref]; WriteRefTab: PROC [stream: IO.STREAM, table: RefTab.Ref, writeKey, writeVal: WriteRefProc]; GetRefTab: PROC [stream: IO.STREAM, key: ATOM, equal: RefTab.EqualProc _ NIL, hash: RefTab.HashProc _ NIL] RETURNS [table: RefTab.Ref]; MakeID: PROC [prefix: Rope.ROPE, int: INT] RETURNS [Rope.ROPE]; END. BrineIO.mesa Copyright Σ 1988 by Xerox Corporation. All rights reversed. Created by Bertrand Serlet May 4, 1988 11:15:43 pm PDT Bertrand Serlet May 5, 1988 10:29:07 pm PDT Types Basic Read/Write Functions It is the responsability of the caller to know the type of the data being read or written. In other terms, the type of the data is NOT written by the following functions. Uses a cache to avoid written litterals twicce. Just uses a standard IO.PutRope Uses a cache to share ropes. Ropes should not contain control characters not parsed by IO.GetRopeLiteral, but " are ok. Composite Read/Write Functions Those functions are similar to the ones of the previous section, but have the right type for composite readers or writers. Same restrictions as for ReadRope and WriteRope. Utilities In order to save DAGs, it is common to store a RefTab mapping objects to IDs on the output stream, and a SymTab mapping IDs to objects on the input stream. The following functions search the property list of the stream for a given key. To avoid collisions, it is good practise to prefix keys by the name of the module using them. For instance, the implementation uses the 2 keys $BrineIOAtomTable and $BrineIORopeTable. Creates the table if necessary. Generates a new ID for int. Κ―˜codešœ ™ Kšœ<™