DIRECTORY AMMiniModel, AMModel, Commander, Interpreter, InterpreterOps, IO, List, ProcessProps, Rope, SymTab, WorldVM; MoreInterpreterCommands: CEDAR PROGRAM IMPORTS AMMiniModel, AMModel, Commander, InterpreterOps, IO, List, ProcessProps, SymTab, WorldVM = BEGIN SetGlobalFrame: PROC [cmd: Commander.Handle] RETURNS [result: REF _ NIL, msg: Rope.ROPE _ NIL] --Commander.CommandProc-- = BEGIN cmdStream: IO.STREAM _ IO.RIS[cmd.commandLine]; moduleName: Rope.ROPE _ NIL; localWorld: WorldVM.World; rootContext, moduleContext: AMModel.Context; ppl: List.AList; head: InterpreterOps.EvalHead; TRUSTED {localWorld _ WorldVM.LocalWorld[]; rootContext _ AMModel.RootContext[localWorld]}; moduleName _ cmdStream.GetTokenRope[IO.IDProc !IO.EndOfStream => CONTINUE].token; IF moduleName # NIL THEN { TRUSTED {moduleContext _ AMModel.MostRecentNamedContext[moduleName, rootContext]}; IF moduleContext = NIL THEN moduleContext _ AMMiniModel.GetInterfaceRecord[moduleName, localWorld]; IF moduleContext = NIL THEN {result _ $Failure; msg _ IO.PutFR["No such program or interface as %g\n", IO.rope[moduleName]]}; } ELSE moduleContext _ NIL; ppl _ ProcessProps.GetPropList[]; head _ NARROW[List.Assoc[$EvalHead, ppl]]; IF head = NIL THEN { IF ppl = NIL THEN ERROR; head _ InterpreterOps.NewEvalHead[context: rootContext, specials: SymTab.Create[]]; [] _ List.PutAssoc[key: $EvalHead, val: head, aList: ppl]; }; IF moduleContext # NIL THEN {contextName: Rope.ROPE; TRUSTED {contextName _ AMModel.ContextName[moduleContext]}; head.context _ moduleContext; cmd.out.PutF["Evaluation context set to %g\n", IO.rope[contextName]]; } ELSE { head.context _ rootContext; cmd.out.PutRope["Evaluation context set to local world\n"]; }; END; Commander.Register[key: "SetGlobalFrame", proc: SetGlobalFrame, doc: "set evaluation context to be a program"]; Commander.Register[key: "SGF", proc: SetGlobalFrame, doc: "set evaluation context to be a program"]; END. `MoreInterpreterCommands.Mesa Last Edited by: Spreitzer, November 16, 1984 4:41:00 pm PST Κ– "cedar" style˜Icode™K™;K˜KšΟk œ?œ,˜vK˜šΠbxœœ˜&Kšœ2œ'˜b—K˜Kš˜K˜šΟnœœœ œœ œœΟcœ˜zKš˜Kš œ œœœœ˜/Kšœœœ˜K˜K˜,Kšœ˜Kšœ˜šœ$˜+Kšœ/˜/—Kšœ$œ œœ˜Qšœœœ˜KšœK˜RKšœœœH˜cKš œœœœ/œ˜}Kšœ˜—Kšœœ˜Kšœ!˜!Kšœœ˜*šœœœ˜Kšœœœœ˜KšœS˜SKšœ:˜:K˜—šœ˜šœœ˜Kšœ4˜;Kšœ˜Kšœ/œ˜EK˜—šœ˜Kšœ˜K˜;K˜——Kšœ˜—K˜K˜oK˜dK˜Kšœ˜—…—”