ViewerlessGenMapImpl.mesa
Copyright Ó 1990, 1992 by Xerox Corporation. All rights reserved.
Mna, October 29, 1990 11:42 am PST
Laurie Horton, October 31, 1990 4:29 pm PST
Willie-s, January 22, 1992 5:42 pm PST
DIRECTORY
GenMapIO,
IO,
IOClasses USING [CreateDribbleOutputStream],
PFS USING [AccessOptions, StreamOpen, PathFromRope],
Process USING [CheckForAbort],
Rope;
ViewerlessGenMapImpl: CEDAR PROGRAM
IMPORTS IO, IOClasses, Process, PFS
EXPORTS GenMapIO
= BEGIN
T Y P E S
ROPE: TYPE = Rope.ROPE;
STREAM: TYPE = IO.STREAM;
Global variables
logFileStream: STREAM ¬ NIL;
Public Procs
CreateOutputStreams: PUBLIC PROC [logFileName: ROPE, typeScriptStream: STREAM ¬ NIL] RETURNS [outputStream: STREAM] = {
IF typeScriptStream = NIL THEN RETURN [typeScriptStream];
outputStream ¬ CreateTeeStream[logFileName, typeScriptStream];
};
CreateTeeStream: PROC [fileName: ROPE, typeScriptStream: STREAM]
RETURNS [STREAM] = {
logFileStream ¬ PFS.StreamOpen[fileName: PFS.PathFromRope[fileName], accessOptions: create];
RETURN [IOClasses.CreateDribbleOutputStream[typeScriptStream, logFileStream]];
};
CloseTeeStream : PUBLIC PROC = {
logFileStream.Close[];
logFileStream ¬ NIL;
};
PutRopes: PUBLIC PROC [stream: STREAM, r1,r2,r3,r4: ROPE ¬ NIL] = {
ENABLE UNWIND => NULL;
IF stream # NIL THEN {
IO.PutRope[stream, "\n"];
IF r1 # NIL THEN IO.PutRope[stream, r1];
IF r2 # NIL THEN IO.PutRope[stream, r2];
IF r3 # NIL THEN IO.PutRope[stream, r3];
IF r4 # NIL THEN IO.PutRope[stream, r4];
};
Process.CheckForAbort[];
};
PutMsg: PUBLIC PROC [r1,r2,r3,r4: ROPE ¬ NIL] = {
IF logFileStream # NIL THEN PutRopes[logFileStream, r1, r2, r3, r4];
};
END ...