VoiceRopeDB.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Doug Terry, June 12, 1986 2:36:18 pm PDT
Routines for storing voice ropes in a database and manipulating their structure. This interface is internal to the voice rope package.
DIRECTORY
BasicTime USING [GMT, nullGMT],
LoganBerry USING [Entry, OpenDB],
RefID USING [nullID],
Rope USING [ROPE],
Thrush USING [Tune, VoiceInterval, EncryptionKey];
VoiceRopeDB: CEDAR DEFINITIONS = {
Handle: TYPE = REF HandleRec;
HandleRec: TYPE = RECORD [
voiceRopeDB: LoganBerry.OpenDB ← RefID.nullID,
voiceInterestDB: LoganBerry.OpenDB ← RefID.nullID,
voiceRopeDBName: Rope.ROPE,
voiceInterestDBName: Rope.ROPE
];
TuneList: TYPE = LoganBerry.Entry;
Header: TYPE = LoganBerry.Entry;
Interest: TYPE = LoganBerry.Entry;
ID: TYPE = Rope.ROPE;
VoiceRopeInfo: TYPE ~ RECORD[
vrID: IDNIL, -- unique ID of the voice rope
length: INT ← -1, -- length of the voice rope
creator: Rope.ROPENIL, -- an RName, e.g. "Terry.pa"
timestamp: BasicTime.GMT ← BasicTime.nullGMT, -- time of creation
struct: TuneList ← NIL -- the actual voice rope components
];
InterestInfo: TYPE ~ RECORD[
interestID: IDNIL, -- unique ID of the interest
vrID: ID, -- unique ID of a voice rope
class: Rope.ROPE, -- e.g. "TiogaVoice"
refID: Rope.ROPE, -- e.g. "[Ivy]<>User>FileWithVoice.tioga"
creator: Rope.ROPENIL, -- actually an RName, e.g. "Terry.pa"
timestamp: BasicTime.GMT ← BasicTime.nullGMT, -- time interest was registered
data: Rope.ROPENIL -- class-specific data
];
Basic database operations
Error: ERROR [ec: ATOM, explanation: Rope.ROPENIL];
Open: PROC [dbName: Rope.ROPE] RETURNS [handle: Handle ← NIL];
Prepares the given database for service.
ReadVoiceRope: PROC [handle: Handle, ropeID: ID] RETURNS [header: Header, struct: TuneList];
Returns the structure of the given voice rope.
WriteVoiceRope: PROC [handle: Handle, struct: TuneList] RETURNS [info: VoiceRopeInfo];
Writes the voice rope information into the database.
DeleteVoiceRope: PROC [handle: Handle, ropeID: ID];
Deletes the given voice rope (regardless of what interests may exist).
AddInterest: PROC [handle: Handle, interest: InterestInfo];
Adds an entry to the interest database if a similar entry does not already exist.
DropInterest: PROC [handle: Handle, interest: InterestInfo];
Removes an entry from the interest database.
Queries and enumerations
VoiceRopeContainingTune: PROC [handle: Handle, tune: INT] RETURNS [header: Header];
Returns a voice rope containing the given tune, if one exists.
InterestInVoiceRope: PROC [handle: Handle, ropeID: ID] RETURNS [interest: Interest];
Returns an interest for the voice rope, if one exists.
InterestForRef: PROC [handle: Handle, class: Rope.ROPE, refID: Rope.ROPE] RETURNS [interest: Interest];
Returns an interest with the given class and refID, if one exists.
EnumProc: TYPE = PROC [info: VoiceRopeInfo] RETURNS [continue: BOOLEANTRUE];
EnumerateVoiceRopes: PROC [handle: Handle, start: IDNIL, proc: EnumProc];
Calls the enumeration procedure for every voice rope with id greater than start; start=NIL represents the first element of the database. Stops when proc returns FALSE or the end of the database is encountered.
InterestProc: TYPE = PROC [info: InterestInfo] RETURNS [continue: BOOLEANTRUE];
EnumerateInterestClass: PROC [handle: Handle, class: Rope.ROPE, proc: InterestProc];
Calls the enumeration procedure for every interest of the given class. Stops when proc returns FALSE or the end of the database is encountered.
Obtaining information
Clients of this interface should never attempt to directly access information in a Header or Interest entry. These routines are used to parse this information and return it in a client-usable form.
UnpackHeader: PROC [header: Header] RETURNS [info: VoiceRopeInfo];
Returns the information associated with a voice rope header.
UnpackInterest: PROC [interest: Interest] RETURNS [info: InterestInfo];
Returns the information associated with an interest entry.
Voice rope structure
The following routines allow clients to manipulate TuneLists without having to understand their internal representations.
SimpleTuneList: PROC [tune: Thrush.Tune, interval: Thrush.VoiceInterval, key: Thrush.EncryptionKey] RETURNS [list: TuneList];
Builds a tune list with a single tune's information.
NextTuneOnList: PROC [list: TuneList] RETURNS [tune: Thrush.Tune, interval: Thrush.VoiceInterval, key: Thrush.EncryptionKey, rest: TuneList];
Returns information about the next tune on the list; assumes that list really points to a properly structured TuneList so doesn't bother to check attribute types. The rest of the list is returned so this routine can be repetitively called to get all the tunes on the list.
TuneListInterval: PROC [list: TuneList, interval: Thrush.VoiceInterval] RETURNS [new: TuneList];
Returns the tune list representing the structure of the voice rope interval. Warning: this operation modifies the original list!
}.
Doug Terry, June 3, 1986 3:30:54 pm PDT
Created internal DB interface.
changes to: DIRECTORY, VoiceRopeDB, OpenDB, ReadVoiceRope, WriteVoiceRope, SimpleTuneList, NextTuneOnList, TuneListInterval
Doug Terry, June 12, 1986 2:32:49 pm PDT
Clarified the distinction between packed entries, such as Headers, and unpacked records, such as VocieRopeInfo.
changes to: DIRECTORY, VoiceRopeDB, ReadVoiceRope, WriteVoiceRope, DeleteVoiceRope, AddInterest, DropInterest, VoiceRopeContainingTune, InterestInVoiceRope, InterestForRef, EnumProc, EnumerateVoiceRopes, EnumerateInterestClass, UnpackHeader, UnpackInterest, TuneListInterval