DIRECTORY FS USING [Error, StreamOpen], TJaM USING [AtomFromRope, Error, ExecuteStream, Frame, PopRope, PushRope, RegisterPrimitive, ROPE, STREAM]; TJaMIOImpl: CEDAR PROGRAM IMPORTS FS, TJaM ~ BEGIN OPEN TJaM; badName: ATOM ~ AtomFromRope[".badname"]; fsError: ATOM ~ AtomFromRope[".fserror"]; ApplyRun: PROC[frame: Frame] = { fileName: ROPE ~ PopRope[frame]; errorAtom: ATOM _ NIL; stream: STREAM _ NIL; stream _ FS.StreamOpen[fileName ! FS.Error => { SELECT error.code FROM $unknownFile, $illegalName, $patternNotAllowed => errorAtom _ badName; ENDCASE => { PushRope[frame, error.explanation]; errorAtom _ fsError }; CONTINUE; }; ]; IF stream#NIL THEN ExecuteStream[frame, stream] ELSE ERROR Error[errorAtom]; }; RegisterPrimitive[".run", ApplyRun]; END. \TJaMIOImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Maureen Stone, February 14, 1985 6:42:18 pm PST Doug Wyatt, March 23, 1985 4:15:21 pm PST 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]; ΚΪ˜codešœ™Kšœ Οmœ1™