<> <> 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; <> ROPE: TYPE= Names.ROPE; imported: BOOL_FALSE; <> 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]; }; <> UnGVImport: PUBLIC PROC = { ENABLE RPC.CallFailed => GOTO Failed; IF ~imported THEN RETURN; NamesGVRpcControl.UnimportInterface [!LupineRuntime.BindingError=>CONTINUE]; imported _ FALSE; EXITS Failed => imported _ FALSE; }; <> CmdGVImport: Commander.CommandProc = { []_GVImport[IF CommandToolExtras.NumArgs[cmd]#0 THEN CommandToolExtras.ArgN[cmd,1] ELSE NIL]; }; <> <<>> Commander.Register["GVImport", CmdGVImport, "Connect to remote NamesGV."]; }.