DIRECTORY Commander USING [CommandProc, Handle, Register], IO, Names USING [ GetGVDetails, GVDetails, Results, SetGVDetails, WaitForGV ], Rope USING [ Cat, Equal, Fetch, ROPE ] ; GVLarkImpl: CEDAR PROGRAM IMPORTS Commander, IO, Names, Rope = { OPEN IO; Results: TYPE = Names.Results; GVDetails: TYPE = Names.GVDetails; ROPE: TYPE = Rope.ROPE; LarkDetails: PROC[larkName: ROPE] = { Calling["DetailsOfLark#", larkName]; DoDetails[FullLark[larkName]]; }; Details: PROC[rName: ROPE] = { Calling["Details", rName]; DoDetails[rName]; }; DoDetails: PROC[rName: ROPE] = { details: GVDetails; results: Results; [results, details] _ Names.GetGVDetails[rName, error]; IF results=ok THEN PrintDetails[details]; }; Create: PROC[rName, password: ROPE] = { details: GVDetails; results: Results; Calling["Create", rName, password]; [results, details] _ Names.GetGVDetails[rName, create]; IF results=ok THEN PrintDetails[details]; }; Mode: PROC[larkNum, newMode: ROPE] = { details: GVDetails; results: Results; Calling["Mode", larkNum, newMode]; [results, details] _ Names.GetGVDetails[FullLark[larkNum], error]; IF results#ok THEN RETURN; details.mode _ newMode.Fetch[0]; details.larkSpec _ TRUE; Names.SetGVDetails[details]; PrintDetails[details]; }; Tune: PROC[larkNum, newTune: ROPE] = { details: GVDetails; results: Results; Calling["Tune", larkNum, newTune]; [results, details] _ Names.GetGVDetails[FullLark[larkNum], error]; IF results#ok THEN RETURN; details.ringTune _ newTune; details.larkSpec _ TRUE; Names.SetGVDetails[details]; PrintDetails[details]; }; Instance: PROC[larkNum, newInstance: ROPE] = { details: GVDetails; results: Results; Calling["Instance", larkNum, newInstance]; [results, details] _ Names.GetGVDetails[FullLark[larkNum], error]; IF results#ok THEN RETURN; details.instance _ newInstance.Cat[".lark"]; details.larkSpec _ TRUE; Names.SetGVDetails[details]; PrintDetails[details]; }; Owner: PROC[larkNum, newOwner: ROPE] = { Calling["Owner", larkNum, newOwner]; DoConnect[FullLark[larkNum], newOwner]; }; Connect: PROC[rName, newConnect: ROPE] = { Calling["Connect", rName, newConnect]; DoConnect[rName, newConnect]; }; DoConnect: PROC[rName, newConnect: ROPE] = { details: GVDetails; results: Results; [results, details] _ Names.GetGVDetails[rName, error]; IF results#ok THEN RETURN; details.connect _ newConnect; Names.SetGVDetails[details]; PrintDetails[details]; }; Make: PROC[rName, extension, machine, instance, mode, net, host: ROPE] = { larkDetails, rnameDetails, wsDetails: GVDetails; results: Results; wsName: ROPE_IF net=NIL THEN NIL ELSE net.Cat["#",host,"#.Lark"]; fullName: ROPE_rName.Cat[".Lark"]; Calling["Make", rName, extension, machine, instance, mode, net, host]; [results, larkDetails] _ Names.GetGVDetails[FullLark[machine], create]; IF results#ok THEN RETURN; [results, rnameDetails] _ Names.GetGVDetails[fullName, create]; IF results#ok THEN RETURN; IF wsName#NIL THEN [results, wsDetails] _ Names.GetGVDetails[wsName, create]; IF results#ok THEN RETURN; larkDetails.instance _ instance.Cat[".Lark"]; larkDetails.mode _ mode.Fetch[0]; larkDetails.connect _ fullName; larkDetails.larkSpec _ TRUE; rnameDetails.connect _ Rope.Cat["173#", machine, "#"]; rnameDetails.telephoneExtension _ extension; rnameDetails.userSpec _ TRUE; Names.SetGVDetails[larkDetails]; PrintDetails[larkDetails]; Names.SetGVDetails[rnameDetails]; PrintDetails[rnameDetails]; IF wsDetails=NIL THEN RETURN; wsDetails.connect_rName; Names.SetGVDetails[wsDetails]; PrintDetails[wsDetails]; }; SemiTok: IO.BreakProc = TRUSTED {RETURN[IF char='; THEN break ELSE other]; }; CommaTok: IO.BreakProc = TRUSTED {RETURN[IF char=', THEN break ELSE other]; }; DetailsCommand: Commander.CommandProc = TRUSTED { StartTok[cmd]; Details[Token[]]; }; LarkCommand: Commander.CommandProc = TRUSTED { StartTok[cmd]; LarkDetails[Token[]]; }; MakeCommand: Commander.CommandProc = TRUSTED { rName, extension, machine, instance, mode, net, host: ROPE; StartTok[cmd]; rName_Token[]; extension_Token[]; machine_Token[]; instance_Token[]; mode _ Token[]; net_Token[]; IF net.Equal["none"] THEN net_NIL ELSE host_Token[]; Make[rName, extension, machine, instance, mode, net, host]; }; CreateCommand: Commander.CommandProc = TRUSTED { a1, a2: ROPE; StartTok[cmd]; a1_Token[]; a2_Token[]; []_Create[a1, a2]; }; InstanceCommand: Commander.CommandProc = TRUSTED { a1, a2: ROPE; StartTok[cmd]; a1_Token[]; a2_Token[]; Instance[a1, a2]; }; OwnerCommand: Commander.CommandProc = TRUSTED { a1, a2: ROPE; StartTok[cmd]; a1_Token[]; a2_Token[]; Owner[a1, a2]; }; ConnectCommand: Commander.CommandProc = TRUSTED { a1, a2: ROPE; StartTok[cmd]; a1_Token[]; a2_Token[]; Connect[a1, a2]; }; ModeCommand: Commander.CommandProc = TRUSTED { a1, a2: ROPE; StartTok[cmd]; a1_Token[]; a2_Token[]; Mode[a1, a2]; }; TuneCommand: Commander.CommandProc = TRUSTED { a1, a2: ROPE; StartTok[cmd]; a1_Token[]; a2_Token[]; Tune[a1, a2]; }; WaitCommand: Commander.CommandProc = TRUSTED { Names.WaitForGV[]; }; StartTok: PROC[cmd: Commander.Handle] = { cmdStream _ IO.RIS[cmd.commandLine]; out _ cmd.out; }; Token: PROC RETURNS [r: ROPE _ NIL] = { r _ cmdStream.GetTokenRope[breakProc: IO.IDProc ! IO.EndOfStream => CONTINUE;].token; }; PrintDetails: PROC[details: GVDetails] = { out.PutF["%s: %s, %s\n", rope[details.rName], rope[details.connect], rope[details.forward]]; }; FullLark: PROC[larkName: ROPE] RETURNS [fullName: ROPE] = { RETURN[Rope.Cat["173#", larkName, "#.lark"]]; }; Calling: PROC[funcName, a, b, c, d, e, f, g: ROPE_NIL] = { res: ROPE_funcName.Cat["[", a]; IF b#NIL THEN res_res.Cat[", ", b]; IF c#NIL THEN res_res.Cat[", ", c]; IF d#NIL THEN res_res.Cat[", ", d]; IF e#NIL THEN res_res.Cat[", ", e]; IF f#NIL THEN res_res.Cat[", ", f]; IF g#NIL THEN res_res.Cat[", ", g]; res_res.Cat["]\n "]; out.PutRope[res]; }; cmdStream: IO.STREAM; out: IO.STREAM; Commander.Register["GVDetails", DetailsCommand, "Print RName details\nPrints connect and forwarding fields of fully-specified RName"]; Commander.Register["GVLark", LarkCommand, "Print details for Lark\nPrints connect and forwarding fields, given string for octal representation of a Lark's host ID; network 173B assumed."]; Commander.Register["GVMake", MakeCommand, "Update data base for Lark and user\nGVMake Swinehart.pa 4473 104 Morley O 3 333 sets Swinehart.pa.lark and 173#104#.lark and 3#333#.lark (creating if necessary) to contain all necessary fields for Lark operation. Use none for 3 333 to avoid associating a workstation with the Lark."]; Commander.Register["GVCreate", CreateCommand, "Create RName\nGVCreate Swinehart.pa.lark mflflx creates the specified rName with the specified password"]; Commander.Register["GVInstance", InstanceCommand, "Set instance field\nGVInstance 100 Morley makes Morley.Lark the instance for the type LarkSmarts.Lark for Lark numbered 173#100#. If there's no forwarding field, also sets defaults for the development mode and the program to run."]; Commander.Register["GVOwner", OwnerCommand, "Set Lark connect field\nGVOwner 100 Swinehart.pa.lark sets the connect field of RName 173#100#.lark to Swinehart.pa.lark."]; Commander.Register["GVConnect", ConnectCommand, "Set Connect field\nGVConnect Swinehart.pa.lark 173#100# sets the connect field of RName Swinehart.pa.lark to 173#100#."]; Commander.Register["GVMode", ModeCommand, "Set Operational Mode\nGVMode 100 O sets the mode field of RName 173#100#.lark to O."]; Commander.Register["GVWait", WaitCommand, "Wait for all Grapevine operations to terminate."]; Commander.Register["GVTune", TuneCommand, "Set ringing tune to the PlayTune on command line. Tune should be in double quotes\n GVTune 101 \"cdefgab>c\" sets the ringing tune of RName 173#101#.lark to a C major scale."]; }. øGVLarkImpl.mesa Last modified by D. Swinehart, November 23, 1983 1:23 pm Last Edited by: Pier, May 10, 1984 1:08:21 pm PDT Copies Action routines Does Individual exist already? Command Procs Utilities Initialization Edited on August 30, 1983 9:16 am, by Swinehart Upgrade for use by real world; Cedar, use Commander, and use Names update functions; no need to make it a monitor, since Names implementation provides all needed protection. changes to: DIRECTORY, GVLarkImpl, Results, DetailsCommand, LarkCommand, MakeCommand, CreateCommand, InstanceCommand, OwnerCommand, ConnectCommand, ModeCommand, StartTok Edited on October 12, 1983 5:33 pm, by Swinehart changes to: WaitCommand, DIRECTORY, GVLarkImpl Edited on November 23, 1983 1:23 pm, by Swinehart changes to: DIRECTORY, GVLarkImpl, WaitCommand Edited on May 1, 1984 6:59:24 pm PDT, by Pier changes to: Tune, Instance, TuneCommand, WaitCommand Edited on May 10, 1984 1:08:22 pm PDT, by Pier changes to: Token to catch EndOfStream and return NIL token Ê!˜Jšœ™Jšœ8™8J™1J˜šÏk ˜ Jšœ œ!˜0Jšœ˜J˜JJšœœœ˜&J˜J˜—šœ ˜š˜J˜ Jšœ˜J˜Jšœ˜Jšœœ˜—J˜—šœ™J˜Jšœ œ˜Jšœ œ˜"Jšœœœ˜J˜—™J˜šÏn œœ œ˜%Jšœ$˜$J˜J˜J˜—šžœœœ˜Jšœ˜Jšœ˜J˜J˜—J˜šž œœœ˜ J˜J˜J˜6Jšœ œ˜)J˜J˜—šžœœœ˜'Jšœ™J˜Jšœ˜Jšœ#˜#Jšœ7˜7J˜)Jšœ˜—J˜šžœœœ˜&J˜J˜Jšœ"˜"JšœB˜BJšœ œœ˜J˜ Jšœœ˜Jšœ˜Jšœ˜J˜—J˜šžœœœ˜&J˜J˜Jšœ"˜"JšœB˜BJšœ œœ˜Jšœ˜Jšœœ˜Jšœ˜Jšœ˜J˜—J˜šžœœœ˜.J˜J˜Jšœ*˜*JšœB˜BJšœ œœ˜J˜,Jšœœ˜Jšœ˜Jšœ˜Jšœ˜—J˜šžœœœ˜(Jšœ$˜$Jšœ'˜'Jšœ˜—J˜šžœœœ˜*Jšœ&˜&J˜J˜—J˜šž œœœ˜,J˜J˜Jšœ6˜6Jšœ œœ˜Jšœ˜Jšœ˜Jšœ˜J˜J˜—šžœœ7œ˜JJ˜0J˜J˜AJ˜"JšœF˜FJšœG˜GJšœ œœ˜Jšœ?˜?Jšœ œœ˜Jšœœœ;˜MJšœ œœ˜Jšœ-˜-Jšœ!˜!Jšœ˜Jšœœ˜Jšœ6˜6J˜,Jšœœ˜Jšœ ˜ Jšœ˜Jšœ!˜!Jšœ˜Jšœ œœœ˜Jšœ˜Jšœ˜Jšœ˜J˜J˜——™ J˜Jš œ œ œœœ œœ ˜MJš œ œ œœœ œœ ˜NJ˜šœ(œ˜1J˜J˜J˜—šœ%œ˜.J˜J˜—J˜šœ%œ˜.Jšœ6œ˜;J˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜J˜J˜ Jšœœœœ˜4Jšœ>˜>—J˜šœ'œ˜0Jšœœ˜ J˜Jšœ ˜ Jšœ ˜ J˜—J˜šœ)œ˜2Jšœœ˜ J˜Jšœ ˜ Jšœ ˜ J˜—J˜šœ&œ˜/Jšœœ˜ J˜J˜ J˜ J˜—J˜šœ(œ˜1Jšœœ˜ J˜Jšœ ˜ Jšœ ˜ J˜—J˜šœ%œ˜.Jšœœ˜ J˜Jšœ ˜ Jšœ ˜ J˜—J˜šœ%œ˜.Jšœœ˜ J˜Jšœ ˜ Jšœ ˜ J˜—J˜šœ%œ˜.J˜—J˜—™ J˜šžœœ˜)Jšœ œœ˜$J˜J˜J˜—Jšžœœœœœ,œ œœ ˜€J˜šž œœ˜*˜J˜C—J˜—J˜š žœœ œœ œ˜;Jšœ'˜-Jšœ˜J˜—šžœœ œœ˜:Jšœœ˜Jšœœœ˜#Jšœœœ˜#Jšœœœ˜#Jšœœœ˜#Jšœœœ˜#Jšœœœ˜#J˜J˜J˜J˜——J™˜Jšœ œœ˜šœœœ˜J˜—Jšœ†˜†Jšœ¼˜¼JšœÈ˜ÈJšœ™˜™Jšœœ˜œJšœ©˜©Jšœª˜ªJšœ˜Jšœ]˜]JšœÛ˜Û—J˜J˜™/J™­Jšœ Ïr™©—™0Jšœ Ÿ"™.—J™™1Jšœ Ÿ"™.—™-Jšœ Ÿ(™4—™.Jšœ Ÿ/™;—J™—…—<*U