DIRECTORY BasicTime, Commander, CommanderOps, HostAndTerminalOps, IO, NetAddressing, Rope, TerminalLocation; RemoteHostCommands: CEDAR PROGRAM IMPORTS BasicTime, Commander, CommanderOps, HostAndTerminalOps, IO, NetAddressing, TerminalLocation = BEGIN OPEN HAT:HostAndTerminalOps, NA:NetAddressing, TL:TerminalLocation; ROPE: TYPE ~ Rope.ROPE; ParseResult: TYPE ~ RECORD [msg: ROPE ¬ NIL, addr: NA.Address ¬ NA.nullAddress]; GetLocStateCmd: PROC [cmd: Commander.Handle] RETURNS [result: REF ANY ¬ NIL, msg: ROPE ¬ NIL] --Commander.CommandProc-- ~ { is: TL.InstState ~ TL.PeekLoc[]; cmd.out.PutRope["Terminal locations are "]; cmd.out.PutRope[TL.FormatInstState[is]]; cmd.out.PutF1["; net-initiated observers will be %g.\n", [rope[IF TL.ObserversAllowed[] THEN "accepted" ELSE "rejected"]] ]; RETURN}; SetPrimaryCmd: PROC [cmd: Commander.Handle] RETURNS [result: REF ANY ¬ NIL, msg: ROPE ¬ NIL] --Commander.CommandProc-- ~ { argv: CommanderOps.ArgumentVector ~ CommanderOps.Parse[cmd]; IF argv.argc#2 THEN RETURN [$Failure, "Usage: RemoteHostSetPrimary "]; {pl: TL.Location ~ TL.ParseLoc[argv[1] !NA.Error => { expl: ROPE ~ NA.FormatError[codes, msg]; ERROR CommanderOps.Failed[expl]}]; TL.SetPrimary[pl]; RETURN GetLocStateCmd[cmd]}}; SelPrimaryCmd: PROC [cmd: Commander.Handle] RETURNS [result: REF ANY ¬ NIL, msg: ROPE ¬ NIL] --Commander.CommandProc-- ~ { argv: CommanderOps.ArgumentVector ~ CommanderOps.Parse[cmd]; IF argv.argc#2 THEN RETURN [$Failure, "Usage: RemoteHostSelPrimary "]; {pl: TL.Location ~ TL.ParseLoc[argv[1] !NA.Error => { expl: ROPE ~ NA.FormatError[codes, msg]; ERROR CommanderOps.Failed[expl]}]; TL.SelPrimary[pl]; RETURN GetLocStateCmd[cmd]}}; AddSecondaryCmd: PROC [cmd: Commander.Handle] RETURNS [result: REF ANY ¬ NIL, msg: ROPE ¬ NIL] --Commander.CommandProc-- ~ { argv: CommanderOps.ArgumentVector ~ CommanderOps.Parse[cmd]; IF argv.argc#2 THEN RETURN [$Failure, "Usage: RemoteHostAddSecondary "]; {pl: TL.Location ~ TL.ParseLoc[argv[1] !NA.Error => { expl: ROPE ~ NA.FormatError[codes, msg]; ERROR CommanderOps.Failed[expl]}]; TL.AddSecondary[pl]; RETURN GetLocStateCmd[cmd]}}; AbandonCmd: PROC [cmd: Commander.Handle] RETURNS [result: REF ANY ¬ NIL, msg: ROPE ¬ NIL] --Commander.CommandProc-- ~ { argv: CommanderOps.ArgumentVector ~ CommanderOps.Parse[cmd]; IF argv.argc#2 THEN RETURN [$Failure, "Usage: RemoteHostAbandon "]; {pl: TL.Location ~ TL.ParseLoc[argv[1] !NA.Error => { expl: ROPE ~ NA.FormatError[codes, msg]; ERROR CommanderOps.Failed[expl]}]; TL.Abandon[pl, [BasicTime.Now[], "user command"]]; RETURN GetLocStateCmd[cmd]}}; AcceptObserversCmd: Commander.CommandProc ~ { TL.AllowObservers[TRUE]; RETURN GetLocStateCmd[cmd]}; RejectObserversCmd: Commander.CommandProc ~ { TL.AllowObservers[FALSE]; RETURN GetLocStateCmd[cmd]}; PrintVersions: PROC [cmd: Commander.Handle] RETURNS [result: REF ANY ¬ NIL, msg: ROPE ¬ NIL] --Commander.CommandProc-- ~ { Print: PROC [protocol: ROPE, pvr: HAT.ProtocolVersionRange] ~ { cmd.out.PutF["%g: [%g .. %g]\n", [rope[protocol]], [integer[pvr.min]], [integer[pvr.max]] ]; RETURN}; HAT.EnumerateProtocolVersionsOfSide[SELECT cmd.procData.clientData FROM $Host => Host, $Terminal => Terminal, ENDCASE => ERROR, Print]; }; Commander.Register["RemoteHostGetLocState", GetLocStateCmd, "--- reports locations of this Host's terminals"]; Commander.Register["RHGetLocState", GetLocStateCmd, "--- reports locations of this Host's terminals"]; Commander.Register["RemoteHostSetPrimary", SetPrimaryCmd, " --- establishes RemoteTerminal connection"]; Commander.Register["RHSetPrimary", SetPrimaryCmd, " --- establishes RemoteTerminal connection"]; Commander.Register["RemoteHostSelPrimary", SelPrimaryCmd, " --- gives floor to indicated terminal"]; Commander.Register["RHSelPrimary", SelPrimaryCmd, " --- gives floor to indicated terminal"]; Commander.Register["RemoteHostAddSecondary", AddSecondaryCmd, " --- add observer"]; Commander.Register["RHAddSecondary", AddSecondaryCmd, " --- add observer"]; Commander.Register["RemoteHostAbandon", AbandonCmd, " --- disconnect from a terminal"]; Commander.Register["RHAbandon", AbandonCmd, " --- disconnect from a terminal"]; Commander.Register["RemoteHostAcceptObservers", AcceptObserversCmd, "--- accept net-initiated observers"]; Commander.Register["RHAcceptObservers", AcceptObserversCmd, "--- accept net-initiated observers"]; Commander.Register["RemoteHostRejectObservers", RejectObserversCmd, "--- reject net-initiated observers"]; Commander.Register["RHRejectObservers", RejectObserversCmd, "--- reject net-initiated observers"]; Commander.Register["HostVersions", PrintVersions, "--- prints installed protocol versions for Host side of RemoteTerminal system", $Host]; END.   RemoteHostCommands.mesa Copyright Σ 1990, 1992 by Xerox Corporation. All rights reserved. Last tweaked by Mike Spreitzer on March 18, 1992 8:03 am PST Κj•NewlineDelimiter –(cedarcode) style™code™Kšœ Οeœ7™BKšœ<™<—K˜KšΟk œ9žœ(˜lK˜šΟnœžœž˜!Kšžœ9žœ!˜cK˜—K˜Kš žœžœžœžœžœ˜IK˜Kšžœžœžœ˜K˜Kš œ žœžœžœžœžœ žœ˜PK˜šŸœžœžœ žœžœžœžœžœΟcœ˜{Kšœžœ žœ ˜ K˜+Kšœžœ˜(Kš œ?žœžœžœ žœ˜|Kšžœ˜—K˜šŸ œžœžœ žœžœžœžœžœ œ˜zKšœ<˜