DIRECTORY
Commander USING [ CommandProc, Register ],
CommandToolExtras USING [ NumArgs, ArgN ],
NamesGVImpExp,
NamesGVRpcControl USING [ ImportInterface, UnimportInterface ],
IO,
Log USING [ Problem, Report ],
LupineRuntime USING [ BindingError ],
Names USING [ ROPE ],
RPC USING [ CallFailed, ImportFailed ],
UserProfile USING [ Token ]
;
NamesGVImportImpl:
CEDAR
PROGRAM
IMPORTS Commander, CommandToolExtras, IO, Log, LupineRuntime, RPC, NamesGVRpcControl, UserProfile
EXPORTS NamesGVImpExp = {
OPEN IO;
GVImport:
PUBLIC
PROC [instance:
ROPE←
NIL]
RETURNS [success:
BOOL←
FALSE] = {
ENABLE
RPC.ImportFailed => { Log.Problem["Couldn't import NamesGV.Lark"]; CONTINUE; };
IF instance=
NIL
THEN
instance ← UserProfile.Token[key: "NamesGVInstance", default: "Strowger.Lark"];
UnGVImport[];
NamesGVRpcControl.ImportInterface [[
type: "NamesGV.Lark",
instance: instance
]];
imported ← success ← TRUE;
Log.Report[IO.PutFR["ImportInterface[NamesGV.Lark, %s]", rope[instance]], $System];
};
Export this next time NamesGVExpInt can change.
UnGVImport:
PUBLIC PROC = {
ENABLE RPC.CallFailed => GOTO Failed;
IF ~imported THEN RETURN;
NamesGVRpcControl.UnimportInterface [!LupineRuntime.BindingError=>CONTINUE];
imported ← FALSE;
EXITS Failed => imported ← FALSE;
};
}.