NamesGVImportImpl.Mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last modified by Swinehart, September 7, 1985 8:55:46 am PDT
DIRECTORY
Commander USING [ CommandProc, Register ],
CommandTool USING [ NumArgs, ArgN ],
NamesGVImpExp,
NamesGVRpcControl USING [ ImportInterface ],
IO,
Log USING [ Problem, Report ],
Names USING [ ROPE ],
RPC USING [ ImportFailed ],
UserProfile USING [ Token ]
;
NamesGVImportImpl:
CEDAR
PROGRAM
IMPORTS Commander, CommandTool, IO, Log, RPC, NamesGVRpcControl, UserProfile
EXPORTS NamesGVImpExp = {
OPEN IO;
Data
ROPE: TYPE= Names.ROPE;
imported: BOOL←FALSE;
Import Procedure
GVImport:
PUBLIC
PROC [instance:
ROPE←
NIL]
RETURNS [success:
BOOL←
FALSE] = {
ENABLE
RPC.ImportFailed => { Log.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:
ROPE←
NIL]
RETURNS [newInstance:
ROPE←
NIL] = {
IF instance=
NIL
THEN
instance ← UserProfile.Token[key: "NamesGVInstance", default: "Strowger.Lark"];
UnGVImport[];
NamesGVRpcControl.ImportInterface [[
type: "NamesGV.Lark",
instance: instance
]];
imported ← TRUE;
newInstance ← instance;
};
UnGVImport:
PUBLIC PROC = {
imported ← FALSE;
};
User command
CmdGVImport: Commander.CommandProc = {
ENABLE
RPC.ImportFailed => { Log.Problem["Couldn't import NamesGV.Lark", $System]; CONTINUE; };
instance:
ROPE=
DoImport[IF CommandTool.NumArgs[cmd]#0 THEN CommandTool.ArgN[cmd,1] ELSE NIL];
Log.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