WriteSparseMemory.mesa
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) July 15, 1985 9:35:34 pm PDT
DIRECTORY
DragOpsCross USING [Word, ZerosWord],
IO USING [STREAM],
Rope USING [ROPE],
SparseMemory USING [Base];
WriteSparseMemory: CEDAR DEFINITIONS = BEGIN
Base: TYPE = SparseMemory.Base;
ROPE: TYPE = Rope.ROPE;
STREAM: TYPE = IO.STREAM;
Word: TYPE = DragOpsCross.Word;
ZerosWord: Word = DragOpsCross.ZerosWord;
TestAbort: TYPE = PROC RETURNS [abort: BOOLFALSE];
ToStream: PROC [st: STREAM, base: Base, start: Word ← ZerosWord, words: INTLAST[INT], byteOutput, displayCode: BOOLFALSE, testAbort: TestAbort ← NIL];
Writes stream in Dragon memory file format starting at the given address.
If byteOutput, then use byte output format.
If displayCode, then display instructions (when legal).
If testAbort # NIL, then it is periodically called to test for abort requests.
ToFile: PROC [name: ROPE, base: Base, byteOutput, displayCode: BOOLFALSE];
First writes header giving file name, author, and date, then writes file in Dragon memory file format using ToStream. Finally closes the file. Allows FS.Error to propagate through.
If byteOutput, then use byte output format.
If displayCode, then display instructions (when legal).
END.