SoftcardToolImpl.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
written by Christian Le Cocq, September 21, 1988
Christian Le Cocq October 12, 1988 11:08:43 am PDT
Creates a console for the Sparc Softcard on the 6085.
DIRECTORY
IO,
Menus,
Rope,
SoftcardFSAccess,
SoftcardMonitor,
SoftcardTool,
ViewerClasses,
ViewerIO;
SoftcardToolImpl: CEDAR PROGRAM
IMPORTS IO, Menus, SoftcardFSAccess, SoftcardMonitor, ViewerIO
EXPORTS SoftcardTool
~ BEGIN
translateStreamProcs: REF IO.StreamProcs ← IO.CreateStreamProcs[
variety: $input,
class: $CRToLFTranslator,
getChar: MyGetChar
];
MyGetChar: PROC [self: IO.STREAM] RETURNS [ch: CHAR] = {
in: IO.STREAMNARROW[self.streamData];
ch ← IO.GetChar[in];
IF ch='\n THEN ch ← '\l;
};
CreateCmdStreams: PUBLIC PROC [name: Rope.ROPE] RETURNS [in, out, err: IO.STREAM] ~ {
[in, out] ← ViewerIO.CreateViewerStreams[name: IF name=NIL THEN "Puff Console" ELSE name];
in ← IO.CreateStream[translateStreamProcs, in, in];
err ← out;
};
BreakSparc: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: Menus.MouseButton, shift, control: BOOL] ~ {
viewer: Viewer ~ NARROW[parent];
SoftcardMonitor.Break[]
};
CreateTool: PUBLIC PROC[name: Rope.ROPENIL] ~ {
Description of the procedure.
breakEntry: Menus.MenuEntry ← Menus.CreateEntry[
name: "BREAK!",
proc: BreakSparc,
clientData: NIL,
documentation: "Interrupts the Sparc",
guarded: FALSE
];
v: ViewerClasses.Viewer;
in, out: IO.STREAM;
[in, out] ← ViewerIO.CreateViewerStreams[name: IF name=NIL THEN "Puff Console" ELSE name];
in ← IO.CreateStream[translateStreamProcs, in, in];
SoftcardFSAccess.RegisterConsoleStreams[in, out, out];
v ← ViewerIO.GetViewerFromStream[out];
Menus.AppendMenuEntry[menu: v.menu, entry: breakEntry];
};
CreateTool[];
END.