-- JaM.mesa
-- Last changed by Warren Teitelman, 1-Apr-82 15:28:50
-- Last changed by Doug Wyatt, April 21, 1982 12:42 pm
-- Last changed by Bill Paxton, May 18, 1982 1:21 pm
-- Last changed by McGregor, June 14, 1982 9:29 am
-- Last Edited by: Maxwell, January 14, 1983 8:33 am

DIRECTORY
UserExec USING [RegisterCommand, CommandProc],
IO USING [Handle, CreateOutputStreamToRope, GetOutputStreamRope, Put, text, int],
TypeScript USING [TS, PutRope],
Rope USING [ROPE],
JaMInternal USING [Frame],
JaMOps USING [NewFrame],
JaMTypeScript USING [InitTool];

JaM: PROGRAM
IMPORTS IO, JaMOps, JaMTypeScript, UserExec, TypeScript = {

count: INTEGER ← 1;

InitToolCommand: PROC [ts: TypeScript.TS, param: Rope.ROPE] = { OPEN IO;
name: Rope.ROPE ← "JaM";
IF JaMTypeScript.InitTool[viewerName: name, param: param].already THEN {
frame: JaMInternal.Frame ← JaMOps.NewFrame[];
h: Handle ← CreateOutputStreamToRope[];
Put[h,text["JaM"],int[count ← count+1]];
name ← GetOutputStreamRope[h];
[] ← JaMTypeScript.InitTool[name,frame,param,TRUE] };
TypeScript.PutRope[ts, name];
TypeScript.PutRope[ts, "TypeScript created.\n"] };

UserInitToolCommand: UserExec.CommandProc = TRUSTED {
InitToolCommand [NARROW[exec.viewer, TypeScript.TS], event.commandLine] };

UserExec.RegisterCommand["JaM", UserInitToolCommand, "Create a typescript for JaM"];

}.