StartCluster.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Starts the Cluster Rosemary simulation
last modified by E. McCreight, May 17, 1984 10:37:04 am PDT
last modified by Curry, July 31, 1984 11:32:17 am PDT
DIRECTORY
Atom,
CacheOps,
Commander,
CommandTool,
Dragon,
IO,
Rope,
RoseCreate,
RoseDisplayBrowsing,
RoseDisplayInsides,
RoseDisplayOps,
RoseTypes,
TypeScript,
ViewerClasses,
ViewerIO;
StartCluster: CEDAR PROGRAM IMPORTS Atom, CacheOps, Commander, CommandTool, RoseCreate, RoseDisplayBrowsing, RoseDisplayOps, TypeScript, ViewerIO SHARES RoseDisplayOps, RoseDisplayBrowsing -- ugh! -- =
BEGIN
vm: CacheOps.VirtualMemory;
iCache, eCache: CacheOps.Cache;
iCacheInit, eCacheInit, ifuInit, euInit, fpInit, clusterInit: Atom.PropList;
clusterLog: IO.STREAM;
iDecoderLogRef, euLogRef, fpLogRef: REF REF;
root: RoseTypes.Cell;
osim: RoseTypes.Simulation;
cth: RoseTypes.CellTestHandle;
display: RoseDisplayInsides.Display;
v: ViewerClasses.Viewer;
DoStartCluster: Commander.CommandProc =
BEGIN
args: CommandTool.ArgumentVector = CommandTool.Parse[cmd];
IF args.argc<2 THEN RETURN [ msg: cmd.procData.doc ];
vm  ← CacheOps.NewVirtualMemoryFromFile[args[1]];
iCache ← CacheOps.NewCache[vm];
eCache ← CacheOps.NewCache[vm];
Atom.PutProp[$DragonSimulation, $VMFileName, args[1]];
Atom.PutProp[$DragonSimulation, $VM, vm];
Atom.PutProp[$DragonSimulation, $iCache, iCache];
Atom.PutProp[$DragonSimulation, $eCache, eCache];
RandomTest.Start in Random.quad
Atom.PutProp[$DragonSimulation, $RandomStartPC, NEW[Dragon.Word ← 0101764H] ];
iCacheInit ← Atom.PutPropOnList[ Atom.PutPropOnList[NIL,
$Cache,  iCache],
$SkipRejects, NEW[BOOLFALSE]];
eCacheInit ← Atom.PutPropOnList[NIL,
$Cache,  eCache];
ifuInit ← Atom.PutPropOnList[NIL,
$decoder,  Atom.PutPropOnList[NIL,
$LogRef,  iDecoderLogRef]];
euInit ← Atom.PutPropOnList[NIL,
$LogRef,  euLogRef];
fpInit ← Atom.PutPropOnList[NIL,
$LogRef,  fpLogRef];
clusterInit ←
Atom.PutPropOnList[
Atom.PutPropOnList[
Atom.PutPropOnList[
Atom.PutPropOnList[
Atom.PutPropOnList[ NIL,
$ifu,  ifuInit],
$eu,  euInit],
$fp,  fpInit],
$iCache, iCacheInit],
$eCache, eCacheInit];
Atom.PutProp[$DragonSimulation, $IDecoderLogRef, iDecoderLogRef];
Atom.PutProp[$DragonSimulation, $EULogRef, euLogRef];
Atom.PutProp[$DragonSimulation, $FPLogRef, fpLogRef];
clusterLog ← ViewerIO.CreateViewerStreams
[name: "Cluster Log", backingFile: "ClusterLog.txt"].out;
TypeScript.ChangeLooks[ViewerIO.GetViewerFromStream[clusterLog], 'f];
Atom.PutProp[$DragonSimulation, $ECacheLog, clusterLog];
Atom.PutProp[$DragonSimulation, $IDecoderLog, clusterLog];
Atom.PutProp[$DragonSimulation, $EULog, clusterLog];
Atom.PutProp[$DragonSimulation, $FPLog, clusterLog];
[root: root, osim: osim, cth: cth] ← RoseCreate.CreateTest[rootName: "ClusterRoot", testerName: "ClusterTester", testeeName: "ClusterTestee", typeName: "Cluster", stateToo: FALSE, decider: RoseCreate.DecideFromFile[(IF args.argc<3 THEN "Cluster.expand" ELSE args[2])] ];
initData: clusterInit ????
TRUSTED -- I don't know why Spreitzer hasn't fixed this...
BEGIN
display ← RoseDisplayOps.NewDisplay[sim: osim, info: [iconic: FALSE, name: "Cluster"], cth: cth];
v ← RoseDisplayBrowsing.BrowseDisplay[display: display, info: [iconic: FALSE, name: "Cluster Browser"]];
END;
END;
iDecoderLogRef ← NEW[REF];
euLogRef ← NEW[REF];
fpLogRef ← NEW[REF];
Commander.Register["Cluster", DoStartCluster, "Cluster fires up a Rosemary simulation of a single-processor Dragon. Format is\n Cluster CodeFile.quad Expansion.expand\n"];
END.