NamesGVImportImpl.Mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Last modified by Swinehart, June 27, 1986 9:42:55 am PDT
Importing is now automatic on binding failures in the RpcClient implementation. This interface is here for backward compatibility and to allow specification of a different server host than the default.
DIRECTORY
Commander USING [ CommandProc, Register ],
CommandTool USING [ NextArgument ],
NamesGVImpExp,
NamesGVRpcControl USING [ ImportInterface ],
IO,
Rope USING [ ROPE ],
RPC USING [ ImportFailed ],
UserProfile USING [ Token ],
VoiceUtils USING [ MakeRName, Problem, Report ]
;
NamesGVImportImpl: CEDAR PROGRAM
IMPORTS Commander, CommandTool, IO, NamesGVRpcControl, RPC, UserProfile, VoiceUtils
EXPORTS NamesGVImpExp = {
OPEN IO;
Data
ROPE: TYPE= Rope.ROPE;
Import Procedure
GVImport: PUBLIC PROC [instance: ROPENIL] RETURNS [success: BOOLFALSE] = {
ENABLE
RPC.ImportFailed => { VoiceUtils.Problem["Couldn't import NamesGV.Lark", $Finch]; CONTINUE; };
$Finch until $System can be made much cleverer! Defaults to $System when there's no Finch.
[] ← DoImport[instance];
success ← TRUE;
};
DoImport: PROC [instance: ROPENIL] RETURNS [newInstance: ROPENIL] = {
Import "NamesGV.Lark" from the specified instance, using any available host hint, then after succeeding, update host hint from NamesGV database. See RPC documentation for description of import host hint option.
newInstance ← VoiceUtils.MakeRName[style: rName,
name: IF instance#NIL THEN instance
ELSE UserProfile.Token[key: "NamesGVInstance", default: "Strowger.Lark"]];
NamesGVRpcControl.ImportInterface [
interfaceName: [ type: "NamesGV.Lark", instance: newInstance ]
];
};
UnGVImport: PUBLIC PROC = { NULL; };
User command
CmdGVImport: Commander.CommandProc = {
ENABLE
RPC.ImportFailed => { VoiceUtils.Problem["Couldn't import NamesGV.Lark", $System]; CONTINUE; };
instance: ROPE = DoImport[CommandTool.NextArgument[cmd]];
VoiceUtils.Report[IO.PutFR["ImportInterface[NamesGV.Lark, %s]", rope[instance]], $System];
};
Initialization
Commander.Register["GVImport", CmdGVImport, "Connect to remote NamesGV."];
}.
Swinehart, May 14, 1985 12:59:49 pm PDT
Cedar 6.0
Swinehart, May 9, 1986 11:29:57 am PDT
Convert to new communications package
changes to: DIRECTORY, importHostHint