DIRECTORY BasicTime USING [earliestGMT, Now, Period], Commander USING [CommandProc, Register], Convert USING [TimeFromRope], IO USING [GetChar, PutFR, rope, int, STREAM], LoganBerry USING [AttributeType, AttributeValue, Entry, Open, OpenDB, ReadEntry], LoganBerryBackdoor USING [ReadLogEntry, WriteLogEntry, MarkUpdateComplete], Rope USING [Equal, Find, Substr, ROPE]; ConvertTunes: CEDAR PROGRAM IMPORTS BasicTime, Commander, Convert, IO, LoganBerry, LoganBerryBackdoor, Rope ~ BEGIN RefsToInterests: PROC [rs, is: IO.STREAM] RETURNS [] ~ { ref, interest: LoganBerry.Entry; gvID, creator, time, rtp, interestID: Rope.ROPE; timestamp: INT; ref _ LoganBerryBackdoor.ReadLogEntry[logStream: rs, byte: 0]; UNTIL ref = NIL DO FOR e: LoganBerry.Entry _ ref, e.rest WHILE e # NIL DO SELECT e.first.type FROM $rtp => { rtp _ e.first.value; rtp _ IF Rope.Equal[rtp, "GVID"] THEN "WalnutMsg" ELSE rtp; }; $cre => creator _ e.first.value; $rid => { gvID _ e.first.value; gvID _ Rope.Substr[base: gvID, start: Rope.Find[s1: gvID, s2: "/"]+1]; }; $tim => { time _ e.first.value; timestamp _ BasicTime.Period[from: BasicTime.earliestGMT, to: Convert.TimeFromRope[time]]; }; ENDCASE => NULL; ENDLOOP; FOR e: LoganBerry.Entry _ ref, e.rest WHILE e # NIL DO IF e.first.type = $vid THEN { interest _ LIST[[$Class, rtp], [$RefID, gvID]]; interest _ CONS[[$VRID, e.first.value], interest]; interestID _ IO.PutFR["%g#%g", IO.rope[creator], IO.int[timestamp]]; timestamp _ timestamp + 1; -- so next IID is different interest _ CONS[[$IID, interestID], interest]; IF Rope.Equal[rtp, "WalnutMsg"] THEN [] _ LoganBerryBackdoor.WriteLogEntry[logStream: is, entry: interest, continuation: TRUE]; }; ENDLOOP; [] _ IO.GetChar[rs]; -- eat up EndOfEntry ref _ LoganBerryBackdoor.ReadLogEntry[logStream: rs, byte: -1]; ENDLOOP; LoganBerryBackdoor.MarkUpdateComplete[logStream: is]; }; TunesToTempInterests: PROC [vrs, is: IO.STREAM, idb: LoganBerry.OpenDB] RETURNS [] ~ { vr, interest: LoganBerry.Entry; vrID, interestID, creator: Rope.ROPE; timestamp: INT _ BasicTime.Period[from: BasicTime.earliestGMT, to: BasicTime.Now[]]; vr _ LoganBerryBackdoor.ReadLogEntry[logStream: vrs, byte: 0]; UNTIL vr = NIL DO vrID _ GetAttributeValue[vr, $VRID]; IF LoganBerry.ReadEntry[db: idb, key: $VRID, value: vrID].entry = NIL THEN { creator _ GetAttributeValue[vr, $Creator]; interestID _ IO.PutFR["%g#%g", IO.rope[creator], IO.int[timestamp]]; timestamp _ timestamp + 1; -- so next IID is different interest _ LIST[[$IID, interestID], [$VRID, vrID], [$Class, "OldTune"], [$RefID, "temporary"]]; [] _ LoganBerryBackdoor.WriteLogEntry[logStream: is, entry: interest, continuation: TRUE]; }; [] _ IO.GetChar[vrs]; -- eat up EndOfEntry vr _ LoganBerryBackdoor.ReadLogEntry[logStream: vrs, byte: -1]; ENDLOOP; LoganBerryBackdoor.MarkUpdateComplete[logStream: is]; }; GetAttributeValue: PROC [entry: LoganBerry.Entry, type: LoganBerry.AttributeType] RETURNS [LoganBerry.AttributeValue] ~ { FOR e: LoganBerry.Entry _ entry, e.rest WHILE e # NIL DO IF e.first.type = type THEN RETURN[e.first.value]; ENDLOOP; RETURN[NIL]; }; TempInterestsProc: Commander.CommandProc = { TunesToTempInterests[vrs: cmd.in, is: cmd.out, idb: LoganBerry.Open[dbName: "TempVRRefs.db"]]; }; ConvertProc: Commander.CommandProc = { RefsToInterests[rs: cmd.in, is: cmd.out]; }; Commander.Register[key: "ConvertTunes", proc: ConvertProc, doc: "Converts tune references to voice rope interests\n Usage: ConvertTunes < TunesRefs.dblog > TuneRopesRefs.dblog"]; Commander.Register[key: "TempInterests", proc: TempInterestsProc, doc: "Creates temporary interests for tune ropes\n Usage: TempInterests < TuneRopes.dblog > TempRopeRefs.dblog"]; END. ŽConvertTunes.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Doug Terry, January 21, 1987 11:14:42 am PST Program to convert the old TunesRefs LoganBerry log to a log of voice rope interests. rs = log of old-style tunerefs, is = log of newly-created voice rope interests extract info from ref create a separate interest for each voice rope in ref get next ref entry vrs = log of voice ropes converted from tunes, idb = LoganBerry database of existing interests, is = log of newly created temporary interests for tune ropes without existing interests if vr has no existing interest, then create one get next vr entry [cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL] Assumes that the TuneRopes log is given as standard input and the voice rope interests log is written as standard output. [cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL] Assumes that the TuneRefs log is given as standard input and the voice rope interests log is written as standard output. Doug Terry, January 8, 1987 5:46:46 pm PST changes to: ConvertTunes, ~, GetAttributeValue Doug Terry, January 20, 1987 4:29:33 pm PST changes to: RefsToInterests, GetAttributeValue, ConvertProc, ~, DIRECTORY, IMPORTS Doug Terry, January 21, 1987 11:14:42 am PST changes to: RefsToInterests, DIRECTORY, TunesToTempInterests, GetAttributeValue, TempInterestsProc, ConvertProc, ~, IMPORTS ΚE˜codešœ™Kšœ Οmœ1™˜>šžœžœž˜K™šžœ#žœžœž˜6šžœž˜šœ ˜ Kšœ˜Kšœžœžœ žœ˜;K˜—Kšœ ˜ šœ ˜ Kšœ˜KšœF˜FKšœ˜—šœ ˜ Kšœ˜KšœZ˜ZKšœ˜—Kšžœžœ˜—Kšžœ˜—K™5šžœ#žœžœž˜6šžœž˜Kšœ žœ ˜/Kšœ žœ#˜2KšœD˜DKšœΟc˜7Kšœ žœ˜.šžœž˜$KšœTžœ˜Z—K˜—Kšžœ˜—K•StartOfExpansion[self: STREAM]™Kšœžœ‘˜*Kšœ?˜?Kšžœ˜—Kšœ5˜5K˜—K˜–L -- [cmd: Commander.Handle] RETURNS [result: REF ANY _ NIL, msg: ROPE _ NIL]š œžœ.žœ˜VK™ΈKšœ ˜ Kšœ žœ˜%Kšœ žœF˜TKšœ>˜>šžœžœž˜Kšœ$˜$K™/–}[conv: LoganBerry.Conv _ NIL, db: LoganBerry.OpenDB, key: LoganBerry.AttributeType, value: LoganBerry.AttributeValue]šžœ@žœžœ˜LKšœ*˜*Kšœ žœžœžœ˜DKšœ‘˜7Kšœ žœP˜_KšœTžœ˜ZK˜—K™Kšœžœ‘˜+Kšœ?˜?Kšžœ˜—Kšœ5˜5K˜K˜—š œžœ;žœ ˜yšžœ%žœžœž˜8šžœž˜Kšžœ˜—Kšžœ˜—Kšžœžœ˜ K˜K˜—š œ˜,Kš œžœ žœžœžœžœžœ™HKšœy™yKšœ^˜^Kšœ˜K˜—š  œ˜&Kš œžœ žœžœžœžœžœ™HKšœx™xKšœ)˜)Kšœ˜K˜—K–x[key: ROPE, proc: Commander.CommandProc, doc: ROPE _ NIL, clientData: REF ANY _ NIL, interpreted: BOOL _ TRUE]šœ²˜²K–x[key: ROPE, proc: Commander.CommandProc, doc: ROPE _ NIL, clientData: REF ANY _ NIL, interpreted: BOOL _ TRUE]šœ³˜³—K˜Kšžœ˜™*Kšœ Οr"™.—™+Kšœ ’F™R—™,Kšœ ’o™{—K™K™K™—…—b5