<> <> <> <> <> <> 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.