IMPORTS Atom, CacheOps, Commander, CommandTool, RoseCreate, RoseDisplayBrowsing, RoseDisplayOps, TypeScript, ViewerIO
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[BOOL ← FALSE]];
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;
Commander.Register["Cluster", DoStartCluster, "Cluster fires up a Rosemary simulation of a single-processor Dragon. Format is\n Cluster CodeFile.quad Expansion.expand\n"];