InitializeGlobals:
PUBLIC
PROC[segment: WalnutDefs.Segment, version: Version ← NewOrOld] = {
gRootInfo ← DeclareRelation["RootInfo", segment, version];
gRootFileStamp ←
DeclareAttribute[gRootInfo, "RootFileStamp", TimeType, , , , version];
gRootFileKey ←
DeclareAttribute[gRootInfo, "RootFileKey", RopeType, , , , version];
gMailFor ←
DeclareAttribute[gRootInfo, "MailFor", RopeType, , 20, , version];
gLogInfo ← DeclareRelation["LogInfo", segment, version];
gLogFileID ← DeclareAttribute[gLogInfo, "LogFileID", IntType, , , , version];
gOpInProgressPos ←
DeclareAttribute[gLogInfo, "OpInProgressPos", IntType, , , , version];
gFirstDestroyedMsgPos ←
DeclareAttribute[gLogInfo, "FirstDestroyedMsgPos", IntType, , , , version];
gBytesInDestroyedMsgs ←
DeclareAttribute[gLogInfo, "BytesInDestroyedMsgs", IntType, , , , version];
gParseLogInfo ← DeclareRelation["ParseLogInfo", segment, version];
gParseLogInProgress ←
DeclareAttribute[gParseLogInfo, "ParseLogInProgress", BoolType, , , , version];
gParseLogPos ←
DeclareAttribute[gParseLogInfo, "ParseLogPos", IntType, , , , version];
gExpungeInfo ← DeclareRelation["ExpungeInfo", segment, version];
gLogExpungePhase ←
DeclareAttribute[gExpungeInfo, "LogExpungePhase", IntType, , , , version];
gExpungeFileID ←
DeclareAttribute[gExpungeInfo, "ExpungeFileID", IntType, , , , version];
gCurrentLogPos ←
DeclareAttribute[gExpungeInfo, "CurrentLogPos", IntType, , , , version];
gExpungeLogPos ←
DeclareAttribute[gExpungeInfo, "TempLogPos", IntType, , , , version];
gNewMailInfo ← DeclareRelation["NewMailInfo", segment, version];
gNewMailLogLength ←
DeclareAttribute[gNewMailInfo, "NewMailLogLength", IntType, , , , version];
gCopyNewMailLogPos ←
DeclareAttribute[gNewMailInfo, "CopyNewMailLogPos", IntType, , , , version];
gAcceptNewMailLogPos ←
DeclareAttribute[gNewMailInfo, "AcceptNewMailLogPos", IntType, , , , version];
gAddingServerMsgs ←
DeclareAttribute[gNewMailInfo, "AddingServerMsgs", BoolType, , , , version];
gLastNewMailTimeStamp ←
DeclareAttribute[gNewMailInfo, "LastNewMailTimeStamp", TimeType, , , , version];
gReadArchiveInfo ← DeclareRelation["ReadArchiveInfo", segment, version];
gReadArchiveLogPos ←
DeclareAttribute[gReadArchiveInfo, "ReadArchiveLogPos", IntType, , , , version];
gCopyReadArchiveLogPos ←
DeclareAttribute[
gReadArchiveInfo, "CopyReadArchiveLogPos", IntType, , , , version];
gVersionInfo ← DeclareRelation["VersionInfo", segment, version];
gMsgCount ← DeclareAttribute[gVersionInfo, "MsgCount", IntType, , , , version];
gMsgSetCount ←
DeclareAttribute[gVersionInfo, "MsgSetCount", IntType, , , , version];
gMsgSetsVersion ←
DeclareAttribute[gVersionInfo, "MsgSetsVersion", IntType, , , , version];
-- Declare the Global Relships
rRootInfo ← DeclareGlobalRelship[gRootInfo, version];
rLogInfo ← DeclareGlobalRelship[gLogInfo, version];
rParseLogInfo ← DeclareGlobalRelship[gParseLogInfo, version];
rExpungeInfo ← DeclareGlobalRelship[gExpungeInfo, version];
rVersionInfo ← DeclareGlobalRelship[gVersionInfo, version];
rNewMailInfo ← DeclareGlobalRelship[gNewMailInfo, version];
rReadArchiveInfo ← DeclareGlobalRelship[gReadArchiveInfo, version];
this is a kludge; Active and Deleted are not created in the normal fashion
IF
DB.V2I[
DB.GetF[rVersionInfo, gMsgSetCount]] = 0
THEN
DB.SetF[rVersionInfo, gMsgSetCount, DB.I2V[2]];
};
DeclareGlobalRelship:
PROC [r: Relation, version: Version ← NewOrOld]
RETURNS [rel: Relship] = {
rs: RelshipSet ← RelationSubset[r];
rel ← DB.NextRelship[rs];
IF DB.NextRelship[rs] # NIL THEN ERROR;
ReleaseRelshipSet[rs];
IF rel = NIL THEN rel ← DeclareRelship[r, NIL, version];
};