Text preview for : Output.mesa_Oct77.pdf part of xerox Output.mesa Oct77 xerox mesa 3.0_1977 listing Output.mesa_Oct77.pdf
Back to : Output.mesa_Oct77.pdf | Home
Output.mesa 25-0CT-77 15:22:25 Page 1
-- file: Output.mesa
-- edited by Sandman July 17, 1977 6:00 PM
DIRECTORY
IODefs: FROM "iodefs",
OutputDefs: FROM "outputdefs",
SegmentDefs: FROM "segmentdefs",
StreamDefs: FROM "streamdefs",
StringDefs: FROM "stringdefs",
TimeDefs: FROM "timedefs":
Output: PROGRAM
IMPORTS IODefs, SegmentDefs, StreamDefs, StringDefs, TimeDefs
EXPORTS OutputDefs =
PUBLIC BEGIN
outStream: StreamDefs.StreamHandle ~ NIL:
PutTab: PROCEDURE = BEGIN PutChar[IODefs.TAB]: RETURN END:
PutCR: PROCEDURE = BEGIN PutChar[IODefs.CR]: RETURN END:
PutChar: PROCEDURE [c:CHARACTER] =
BEGIN
outStream.put[outStream,c]:
END:
PutString: PROCEDURE [s:STRING] =
BEGIN
i: CARDINAL:
FOR i IN [O .. s.length) DO
outStream.put[outStream,s[i]]:
ENDLOOP:
END:
PutTime: PROCEDURE [t: TimeDefs.PackedTime]
BEGIN
OPEN TimeDefs:
s: STRING ~ [20]:
AppendDayTime[s,UnpackDT[t]]:
PutString[s]:
RETURN
END:
PutNumber: PROCEDURE [val: CARDINAL. format: IODefs.NumberFormat] =
BEGIN
IODefs.OutNumber[outStream,val,format]:
RETURN
END:
PutDecimal: PROCEDURE [val: CARDINAL] =
BEGIN
IODefs.OutNumber[outStream,val.[10.FALSE.FALSE.l]]:
RETURN
END:
PutOctal: PROCEDURE [val: UNSPECIFIED] =
BEGIN
IODefs.OutNumber[outStream.val,[B,FALSE,TRUE.l]]:
IF val -IN[O .. 7] THEN outStream.put[outStream. 'B]:
RETURN
END;
OpenOutput: PROCEDURE [root: STRING, ext: STRING] =
B[GIN OPEN StringDefs. SegmentDefs:
i: CARDINAL;
name: STRING ~ [40]:
AppendString[name.root]:
FOR i IN [O .. name.length) 00
IF name[ i] = '. THEN
BrGIN name. length .. i: EXIT [NO:
ENDIOOP:
AppendString[name.ext]:
ouLSLream .. SLreamOefs.CreateByteStream[
Newrile[name.Write+Append,DefaultVersion].Write+Append1:
[NO:
Output.mesa 25-0CT-77 15:22:25 Page 2
CloseOutput: PROCEDURE =
BEGIN
outStream.destroy[outStream];
outStream .. NIL;
END;
END