TJaMIOImpl.mesa
Copyright Ó 1985, 1986, 1991, 1992 by Xerox Corporation. All rights reserved.
Maureen Stone, February 14, 1985 6:42:18 pm PST
Michael Plass, December 20, 1989 2:26:20 pm PST
Willie-s, February 14, 1991 8:41 pm PST
Doug Wyatt, November 27, 1992 2:04 pm PST
DIRECTORY
PFS USING [Error, PathFromRope, StreamOpen],
TJaM USING [AtomFromRope, CommandProc, Error, ExecuteStream, PopRope, PushRope, RegisterPrimitive, ROPE, STREAM];
TJaMIOImpl: CEDAR PROGRAM
IMPORTS PFS, TJaM
~ BEGIN OPEN TJaM;
badName: ATOM ~ AtomFromRope[".badname"];
pfsError: ATOM ~ AtomFromRope[".pfserror"];
ApplyRun: CommandProc = {
fileName: ROPE ~ PopRope[frame];
errorAtom: ATOM ¬ NIL;
stream: STREAM ¬ NIL;
stream ¬ PFS.StreamOpen[PFS.PathFromRope[fileName] !
PFS.Error => {
SELECT error.group FROM
user => errorAtom ¬ badName;
ENDCASE => { PushRope[frame, error.explanation]; errorAtom ¬ pfsError };
CONTINUE;
};
];
IF stream#NIL
THEN ExecuteStream[frame, stream]
ELSE ERROR Error[errorAtom];
};
RegisterPrimitive[".run", ApplyRun];
RegisterPrimitive[".stream", ApplyStream];
RegisterPrimitive[".readitem", ApplyReadItem];
RegisterPrimitive[".writeitem", ApplyWriteItem];
RegisterPrimitive[".writebytes", ApplyWriteBytes];
RegisterPrimitive[".killstream", ApplyKillStream];
RegisterPrimitive[".print", ApplyPrint];
RegisterPrimitive[".loadbcd", ApplyLoadBCD];
RegisterPrimitive[".iochar", ApplyIOChar];
RegisterPrimitive[".iobool", ApplyIOBool];
RegisterPrimitive[".ioint", ApplyIOInt];
RegisterPrimitive[".ioreal", ApplyIOReal];
RegisterPrimitive[".ioline", ApplyIOLine];
RegisterPrimitive[".iotoken", ApplyIOToken];
RegisterPrimitive[".iocedartoken", ApplyIOCedarToken];
RegisterPrimitive[".ioclose", ApplyIOClose];
END.