-- JaMCommand.mesa
-- Last changed by Bill Paxton, 30-Jan-82 10:05:26

DIRECTORY
  CVExecutive USING [AddCommand],
  IOStream USING [Handle, CreateOutputStreamToRope, GetOutputStreamRope, Put, text, int, char],
  TypeScript USING [TS, PutRope],
  Rope USING [ROPE],
  JaMInternal USING [Frame],
  JaMOps USING [NewFrame],
  JaMTypeScript USING [InitTool];

JaMCommand: PROGRAM
IMPORTS IOStream, JaMOps, JaMTypeScript, CVExecutive, TypeScript = {

count: INTEGER ← 1;

InitToolCommand: PROC [ts: TypeScript.TS, param: Rope.ROPE] = { OPEN IOStream;
  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],char[' ]];
    name ← GetOutputStreamRope[h];
    [] ← JaMTypeScript.InitTool[name,frame,param,TRUE] };
  TypeScript.PutRope[ts, name];
  TypeScript.PutRope[ts, "TypeScript created.\n"] };

CVExecutive.AddCommand["JaM", InitToolCommand, "Create a typescript for JaM"];

}.