RegisterJaMImager.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last Edited by: Stone, January 31, 1984 5:22:54 pm PST
McCreight, December 3, 1985 1:50:14 pm PST
Tim Diebert: July 30, 1985 3:07:20 pm PDT
DIRECTORY
Commander USING [Register, CommandProc],
Convert USING [RopeFromInt],
JaM USING [ExecuteRope, State],
JaMImager USING [Create],
JaMIPrivate USING [GetInfo],
JaMTS USING [GetLastHandle, JaMData, CreateJaMTS],
List USING [Append, Assoc],
ReadEvalPrint USING [Handle],
Rope USING [Cat, Length, ROPE]
;
RegisterJaMImager: CEDAR PROGRAM
IMPORTS Commander, Convert, JaM, Rope, List, JaMImager, JaMIPrivate, JaMTS = {
called: INT ← 0;
NewJaMImager: Commander.CommandProc --[cmd: Commander.Handle]-- = {
rep: ReadEvalPrint.Handle ← JaMTS.GetLastHandle[];
data: JaMTS.JaMData;
IF rep = NIL -- no JaM typescripts in existence
OR JaMIPrivate.GetInfo[NARROW[rep.clientData, JaMTS.JaMData].state] # NIL -- last one already has an Imager
OR cmd.commandLine.Length>0 -- non-default start-up
THEN { -- make a new JaM typescript
name: Rope.ROPE ← "JaM";
rules: LIST OF REF ANY ← List.Append[NARROW[List.Assoc[key: $SearchRules, aList: cmd.propertyList]]];
IF called#0 THEN name ← Rope.Cat[name,Convert.RopeFromInt[from: called, showRadix: FALSE]];
rep ← JaMTS.CreateJaMTS[name, cmd.commandLine, rules];
called ← called+1;
};
data ← NARROW[rep.clientData];
result ← JaMImager.Create[state: data.state, typescript: rep.viewer];
JaM.ExecuteRope[data.state, "(JaMImager.jam) .run"];
};
Commander.Register[key: "JaMImager", proc: NewJaMImager, doc: "Start JaM, its typescript and its Imager viewer"];
}.