LogDB.mesa
Last modified by D. Swinehart, March 22, 1985 1:19:06 pm PST
Ephemeral and Persistent data base services for Thrush
DIRECTORY
BTree,
BTreeSimple,
BTreeVM,
FS,
IO,
Log USING [ WhereToReport ],
Rope USING [ ROPE ],
RefTab USING [ Ref ]
;
LogDB: CEDAR DEFINITIONS = {
Thrush-wide system control parameters.
PD: TYPE = RECORD [
debug: BOOLEAN, -- Diagnostic and progress display
encryptionRequested: BOOLEAN, -- Encrypt RPC
encryptVoice: BOOLEAN,-- Separate decision; false for debugging only, please!
defaultLarkReports: BOOLEANFALSE, -- If TRUE and debug, Lark events reported SOMEwhere.
Otherwise, only reported if LarkControl window up for this Lark and debug=TRUE
autoGVUpdate: BOOLEANFALSE,
Default values for ringing -- too device-dependent, but life is hard.
ringsInvalid: BOOLTRUE, -- set to cause recreation of standard ring tunes
tonesVolume: CARDINAL ← 2,
defaultRingVolume: CARDINAL ← 2,
subduedVolumeInterval: CARDINAL𡤁,
feepVolume: CARDINAL ← 0
];
pd: REF PD;
Types
WPState: TYPE = REF WPStateRecord;
WPStateRecord: TYPE = RECORD [
treeRootName: ROPE,-- File name for Tree, FTree, and Data files: extensions determine which
logFileName: ROPE,
wpTree: BTreeSimple.Tree, -- Tree: BTree to white pages, sorted by RName.
wpFile: FS.OpenFile, -- open handle for file backing wpTree
wpFeepTree: BTreeSimple.Tree, -- Tree: BTree to white pages, sorted by FeepName *.
wpFeepFile: FS.OpenFile, -- open handle for file backing wpFeepTree
logStream: IO.STREAM, -- stream onto the data file indexed by the trees.
wpExtInt: RefTab.Ref, --Map from names in text-format input files to key ATOMs in tree
accessOptions: FS.AccessOptions←$read, -- $read, $create, $write
wpOpen: BOOLFALSE -- TRUE when trees and all their files are ready for business.
];
* FeepName is the numeric string resulting from spelling out the RName on a DTMF pad:
"Q" is presumed to live between "P" and "R" on the "7" key.
"Z" is presumed to live after "Y" on the "9" key.
All punctuation, digits, non-alphabetic keys are mapped to "1".
ROPE: TYPE=Rope.ROPE;
WPListing: TYPE = RefTab.Ref; -- a table of keys and values.
Attrs: TYPE = MACHINE DEPENDENT {
name(1), rName(2), officeNumber(3), officeDDDNumber(4),
outsideNumber(5), officeAddress(6), officeLocation(7), organization(8),
homeAddress(9), frequency(10), mailSystem(11), primaryKey(12),
(15)
};
WhitePages
These functions provide access to Swinehart's cobby old BTree-based "White Pages"
database. This one is assumed to be keyed and sorted by RName.
They are at present only called by the RName diddling code; see same for usage.
Lookup: PROC[ wpState: WPState, name: ROPE, feep: BOOLFALSE ] RETURNS [ listing: WPListing ];
name must be in form rr.xxxxxxx
Returns first listing for which name is a substring, case unimportant, of the listing
GetEntry: PROC[
wpState: WPState, name: ROPENIL, key: ATOM←$officeNumber,
feep: BOOLFALSE, listing: WPListing←NIL
] RETURNS [fullRName: ROPE, entry: ROPE, newListing: WPListing];
LogAndEnter: PROC[wpState: WPState, listing: WPListing];
Put in something new, or replace something old.
PrintEntries: PUBLIC SAFE PROC[listing: WPListing];
NewListing: PROC RETURNS [WPListing];
This and the following provide a way to build database entries.
List: PROC[listing: WPListing, key: ATOM, value: Rope.ROPE];
Include an enumerator here, if anybody ends up wanting it outside the implementation.
InitWhitePagesDatabase: PUBLIC SAFE PROC[
NIL for fileName or extIntMapName defaults to User Profile values
fileName: ROPENIL, logFileName: ROPE, extIntMapName: ROPENIL, accessOptions: FS.AccessOptions ← $read,
howToComplain: Log.WhereToReport←$System]
RETURNS[wpState: WPState←NIL];
CloseWhitePagesDatabase: PUBLIC SAFE PROC[
wpState: WPState, howToComplain: Log.WhereToReport←$System]
RETURNS[ok: BOOLTRUE];
}.