DIRECTORY GVBasics USING [RName], IO USING [STREAM], Rope USING [ROPE], BasicTime USING [GMT, nullGMT], Thrush USING [EncryptionKey, nullKey, Tune, VoiceInterval]; Nuthatch: CEDAR DEFINITIONS = BEGIN defaultType: Rope.ROPE; updateProcess: PROCESS; Tune: TYPE = Thrush.Tune; VoiceFileID: TYPE = Rope.ROPE; IDType: TYPE = Rope.ROPE; ID: TYPE = Rope.ROPE; EncryptionKey: TYPE = Thrush.EncryptionKey; VoiceInterval: TYPE = Thrush.VoiceInterval; NuthatchUserHandle: TYPE = REF NuthatchUserRec; -- a REF to the data for a particular instance of a nuthatch client; multiple instances can be created. LogEntryType: {Create, MakeRefEntry, Incr, Decr, DeleteRefEntry}; NuthatchUserRec: TYPE = RECORD [ -- the data for a particular tool instance logStream: IO.STREAM _ NIL, -- handle for the enclosing container userName: GVBasics.RName_NIL, -- current status line updateProcess: PROCESS, -- the process that updates the DB from this user's log refIDType: Rope.ROPE_NIL, -- the user's type for each ID associated with a voice file logFileName: Rope.ROPE_NIL, -- log file name -- inUse: BOOL_FALSE, doneUsing: CONDITION, logReadPoint: INT_0 -- read point in log -- ]; PD: TYPE = RECORD [ transactionOpen: BOOL_FALSE, reportLogOut: BOOL_FALSE, reportLogIn: BOOL_FALSE ]; pd: REF PD; InitializeNuthatch: PROC[ userName: GVBasics.RName_NIL, logFileName: Rope.ROPE_NIL, RefIDType: Rope.ROPE_NIL, close: BOOL_TRUE] RETURNS [success: BOOL_TRUE, nuthatchUserHandle: NuthatchUserHandle]; CatalogVoiceFile: PROC[ nuthatchUserHandle: NuthatchUserHandle, voiceFileID: VoiceFileID, tuneNumber: INT, recordedTime: BasicTime.GMT, referenceCount: INT_ 0, samples: INT_ 0, startingSample: INT_ 0, encryptionKey: EncryptionKey_ NULL, time: BasicTime.GMT, type: Rope.ROPE ]; MakeInterestEntry: PROC[ nuthatchUserHandle: NuthatchUserHandle, voiceFileID: VoiceFileID_ NIL, refID: Rope.ROPE_ NIL, time: BasicTime.GMT_BasicTime.nullGMT] ; AddInterest: PROC[ nuthatchUserHandle: NuthatchUserHandle, voiceFileID: VoiceFileID _ NIL, --optional -- refID: Rope.ROPE_ NIL, time: BasicTime.GMT_BasicTime.nullGMT] ; -- Writes a log entry to increment the reference count for this voice file. If the voice message does not have an entry in the database, ignore it (can't tell till DB update time if that's so.) Either voiceFileID or RefID must be non-NIL. LoseInterest: PROC[ nuthatchUserHandle: NuthatchUserHandle, voiceFileID: VoiceFileID _ NIL, --optional -- refID: Rope.ROPE_ NIL, time: BasicTime.GMT_BasicTime.nullGMT] ; RemoveInterestEntry: PROC[ nuthatchUserHandle: NuthatchUserHandle, voiceFileID: VoiceFileID _ NIL, --optional -- refID: Rope.ROPE_ NIL, time: BasicTime.GMT_BasicTime.nullGMT] ; GetFileID: PROC[ ID: Rope.ROPE, nuthatchUserHandle: Nuthatch.NuthatchUserHandle] RETURNS [voiceFileID: VoiceFileID] ; GetTune: PROC[ voiceFileID: VoiceFileID] RETURNS [tune: Tune] ; GetDirectoryEntry: PROC [voiceFileID: VoiceFileID] RETURNS [ tuneNumber: Nuthatch.Tune_ -1, recordTime: BasicTime.GMT_BasicTime.nullGMT, creator: GVBasics.RName_ NIL, samples: INT_ -1, startSample: INT_ -1, expirationDate: BasicTime.GMT_BasicTime.nullGMT, encryptionKey: Nuthatch.EncryptionKey_Thrush.nullKey, type: Rope.ROPE_NIL , referenceCount: INT_ 0, found: BOOL_FALSE]; NHTime: PROC[time: BasicTime.GMT] RETURNS [nhTime: BasicTime.GMT]; currentNUH: NuthatchUserHandle; -- right now, there's just one of them. END. lFile: Nuthatch.mesa Contents: procedures for writing on the Nuthatch log file Created by: Lia on August 31, 1983 Last Edited by: Lia, September 30, 1983 11:16 am Last Edited by: Swinehart, April 30, 1984 2:02:22 pm PDT InitializeNuthatch verifies that the nuthatch database is around and usable, and then looks for the user's log file. In nuthatchUserHandle, InitializeNuthatch initializes the logstream as the current log stream, userName as the current user, RefIDType as the current ID type for voice messages, and updateProcess as the identifier of the process that updates the database from the user's log. creator: GVBasics.RName, get this from current user name -- Sets up a new directory entry for a voice file if none exists, or updates the information about an old entry. -- refIDType: Rope.ROPE_ NIL, find this out from the user handle -- Writes a log entry to create an entry in the InterestList relation for this voice file, associating the RefID with the voiceFileID. refIDType: Rope.ROPE_ NIL, find this out from the user handle -- refIDType: Rope.ROPE_ NIL, find this out from the user handle -- Writes a log entry to decrement the reference count for this voice file. If the database has no record of this message containing voice, that's OK; it will be ignored. (Happens after doing an expunge in Walnut, for example.) refIDType: Rope.ROPE_ NIL, find this out from the user handle -- Writes a log entry to remove the entry in the InterestList relation for this voice file. Given the user's ID for a voice message, return its voiceFileID. -- Given the voiceFileID for a voice message, return its tune number. -- ʘJ˜Jšœ™šœ ™ Jšœ0™0J˜—Jšœ"™"Jšœ0™0Jšœ8™8J˜šÏk ˜ Jšœ œ ˜Jšœœœ˜Jšœœœ˜Jšœ œœ ˜!Jšœœ/˜;J˜—Jšœ œ œ˜J˜Jš˜J˜Jšœœ˜Jšœœ˜J˜Jšœœ˜Jšœ œœ˜Jšœœœ˜Jšœœœ˜Jšœœ˜-Jšœœ˜+J˜JšœœœÏcg˜˜J˜J˜AJ˜šœœœž*˜LJšœ œœœž%˜CJšœœž˜5Jšœœž7˜RJšœœœž;˜VJšœœœž˜/Jšœœœ˜Jšœ œ˜Jšœœž˜+J˜—J˜šœœœ˜Jšœœœ˜Jšœœœ˜Jšœ œ˜J˜—Jšœœœ˜ J˜JšÏnœœ˜Jšœœ˜Jšœœœ˜Jšœœœ œœœ œœ*˜qJšœ‰™‰J˜šŸœœ˜J˜'—šœ<™<˜Jšœ œ˜Jšœœ˜Jšœœ˜Jšœ œ˜Jšœœ˜Jšœœ˜%J˜Jšœ œ˜J˜Jšœq™qJ˜——šŸœœ˜J˜'Jšœœ˜—šœ@™@Jšœ œœ˜šœœ˜)Jšœƒ™ƒJ˜——šŸ œœ˜J˜'Jšœœž ˜-—šœ@™@Jšœ œœ˜Jšœœžò˜œJ˜—šŸ œœ˜J˜'Jšœœž ˜-—šœ@™@Jšœ œœ˜šœœ˜)Jšœã™ãJ˜——šŸœœ˜J˜'Jšœœž ˜-šœ@™@Jšœ œœ˜šœœ˜)JšœX™XJ˜———šŸ œœ˜šœœ3œ˜eJšœE™EJ˜——šŸœœ˜šœœ˜1JšœE™EJ˜——šŸœœœ˜