IPEncodingOut.mesa
Written by John Warnock, August 26,1981
Last edited by Chuck Geschke, April 16, 1982 9:58 AM
Last edited by Andy Shore, February 14, 1983 3:54 pm
This module provides the Interpress literal interface
(see Introduction to Interpress chapter 7).
It writes the "Xerox Encoding" form of Interpress 2.0.
See IPOperatorOut for the higher-level "operator interface".
DIRECTORY
IO USING [Handle],
IPXeroxEncoding USING [SequenceType, EncodingValue],
Rope USING [MaxLen, ROPE];
IPEncodingOut: CEDAR DEFINITIONS = BEGIN
OPEN IPX: IPXeroxEncoding;
Handle: TYPE = RECORD[h: IO.Handle]; -- allows Cedar clustering
Interpress Master Creation Procs
OpenOutputMaster: PROCEDURE [name: Rope.ROPE] RETURNS[h: Handle];
OpenOutputMaster opens an output file and writes the header.
CloseMaster: PROCEDURE [h: Handle];
CloseMaster closes the output master.
Interpress Master Writing Procs
The following procedures produce the various types in the "Xerox Encoding."
AppendByte: PROCEDURE [h: Handle, val: [0..255]];
AppendSequenceDescriptor: PROCEDURE [h: Handle, type: IPX.SequenceType, length: NAT];
AppendString: PROCEDURE [h: Handle, length: NAT, proc: PROCEDURE RETURNS [c: [0..255]]];
AppendRope: PROCEDURE [h: Handle, rope: Rope.ROPE, start: INT ← 0, len: INT ← Rope.MaxLen];
AppendLargeVector: PROCEDURE [
h: Handle,
length: NAT,
bytesPerItem: [0..255],
proc: PROCEDURE RETURNS [c: [0..255]]];
Note: "proc" is called "bytesPerItem" times for each element of the vector
AppendReal: PROCEDURE [h: Handle, n: REAL];
AppendRational: PROCEDURE [h: Handle, i, j: INT];
AppendInteger: PROCEDURE [h: Handle, i: INT];
AppendOp: PROCEDURE [h: Handle, op: IPX.EncodingValue];
AppendIdentifier: PROCEDURE [h: Handle, id: Rope.ROPE, start: INT ← 0, len: INT ← Rope.MaxLen];
AppendComment: PROCEDURE [h: Handle, c: Rope.ROPE];
Private Stuff (appears here for Cedar clustering)
Append2Int: PRIVATE PROCEDURE [h: Handle, e: CARDINAL, c: CARDINAL];
AppendLongInteger: PRIVATE PROCEDURE [h: Handle, f: INT, e: CARDINAL];
Append2Rational: PRIVATE PROCEDURE [h: Handle, i: INT, e: INTEGER];
AppendInt: PRIVATE PROCEDURE [h: Handle, i: INT, c: CARDINAL];
WriteInterpressHeader: PRIVATE PROCEDURE [h: Handle];
NotInterpress: SIGNAL;
Error: ERROR [errorCode: ErrorCode];
ErrorCode: PUBLIC TYPE = {FileNotAvailable, RopeEncodingError};
END.
Change Log
Changed by Shore; August 23, 1982 4:04 pm
updated for Cedar 3.3 (changed IOStream to IO)
Changed by Shore; September 4, 1982 3:06 pm
modified to use Doug's Latest IPXeroxEncoding
Changed by Shore; September 24, 1982 12:58 pm
made changes suggested by Sproull -- AppendRope now here, etc
Change by Shore; November 11, 1982 2:04 pm
change to Cedar.Style and added node styles
Changed by Shore; January 19, 1983 3:34 pm
changed to CEDAR, Interpress 2.0, and new node styles