LarkRemoteControlImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last Edited by: Swinehart, June 18, 1987 6:04:09 pm PDT
DIRECTORY
Commander USING [ CommandProc, Register ],
CommandTool USING [ NextArgument ],
Convert USING [ IntFromRope ],
IO,
LarkRemoteControl USING [ BootLark ],
LarkRemoteControlRpcControl USING [ ImportInterface ],
NameDB USING [ Error, GetAttribute ],
Pup USING [ nullSocket ],
Rope USING [ ROPE ],
RPC USING [ CallFailed, ImportFailed ],
VoiceUtils USING [ CmdOrToken, MakeRName, NetAddress, NetAddressFromRope ]
;
LarkRemoteControlImpl: CEDAR PROGRAM
IMPORTS Commander, CommandTool, Convert, IO, LarkRemoteControl, LarkRemoteControlRpcControl, NameDB, RPC, VoiceUtils = {
BootLark: PROC[lark: Rope.ROPE, serverInstance: Rope.ROPE]
RETURNS [outcome: BOOLTRUE, comment: Rope.ROPENIL] ={
ENABLE RPC.CallFailed => { outcome ← FALSE; comment ← "No response or invalid response from server"; CONTINUE; };
hostHint: VoiceUtils.NetAddress;
hostHintVal: Rope.ROPE;
hostHintVal ← NameDB.GetAttribute[serverInstance, $connect!
NameDB.Error => {
comment ← IO.PutFR["Data base access error (%g): %g", [atom[ec]], [rope[explanation]]];
outcome ← FALSE; CONTINUE; }];
IF outcome=FALSE THEN RETURN;
hostHint ← VoiceUtils.NetAddressFromRope[hostHintVal];
IF serverInstance = NIL THEN RETURN[FALSE, "No server name provided"];
LarkRemoteControlRpcControl.ImportInterface[
interfaceName: [type: "LarkRemoteControl.Lark", instance: serverInstance],
hostHint: hostHint!
RPC.ImportFailed => GOTO ImportFailed];
RETURN[LarkRemoteControl.BootLark[[[173B], [Convert.IntFromRope[lark, 8]], Pup.nullSocket]]];
EXITS ImportFailed => {
outcome ← FALSE; comment ← "LarkRemoteControl interface import failed"};
};
BootLarkCmd: Commander.CommandProc = {
outcome: BOOL;
message: Rope.ROPE;
machine: Rope.ROPE = CommandTool.NextArgument[cmd];
instance: Rope.ROPE = VoiceUtils.MakeRName[VoiceUtils.CmdOrToken[
cmd: cmd, key: "NamesGVInstance", default: "Strowger.Lark"], rName];
IF machine = NIL THEN RETURN;
[outcome, message]𡤋ootLark[machine, instance];
IF outcome = FALSE THEN RETURN[$Failure, message];
};
Commander.Register["BootLark", BootLarkCmd, "BootLark <hostNumber> <server[Strowger]>\nBootLark 110 hardware-boots lark number 110"];
}.
Swinehart, September 9, 1985 10:47:13 am PDT
Created -- allows rudimentary control of larks by end-user RPC command.
Expect this to grow.
changes to: DIRECTORY, LarkRemoteControl