<> <> <> <<>> <> <<>> <> <<>> DIRECTORY DB USING [Attribute, BoolType, DeclareAttribute, DeclareRelation, DeclareRelship, GetF, IntType, I2V, NextRelship, Relation, RelationSubset, ReleaseRelshipSet, Relship, RelshipSet, RopeType, SetF, TimeType, Version, V2I], Rope USING [ROPE], WalnutDefs USING [Segment], WalnutSchema USING [], WalnutSchemaInternal USING []; WalnutSchemaGlobalsImpl: CEDAR PROGRAM IMPORTS DB EXPORTS WalnutSchema, WalnutSchemaInternal = BEGIN OPEN DB, WalnutSchema; <<>> <> ROPE: TYPE = Rope.ROPE; <<>> <<>> <<(Some of the) Schema Variables - Global Relations>> <> <<>> gRootInfo: PUBLIC Relation; gRootFileStamp: PUBLIC Attribute; -- rootFile create date for this db gRootFileKey: PUBLIC Attribute; -- key from rootFile for this db gMailFor: PUBLIC Attribute; -- RName (ROPE) gLogInfo: PUBLIC Relation; gLogFileID: PUBLIC Attribute; -- int gOpInProgressPos: PUBLIC Attribute; -- int - long running operation Pos gFirstDestroyedMsgPos: PUBLIC Attribute; -- int gBytesInDestroyedMsgs: PUBLIC Attribute; -- int gParseLogInfo: PUBLIC Relation; gParseLogInProgress: PUBLIC Attribute; -- bool gParseLogPos: PUBLIC Attribute; -- int gExpungeInfo: PUBLIC Relation; gLogExpungePhase: PUBLIC Attribute; -- int gExpungeFileID: PUBLIC Attribute; -- int gCurrentLogPos: PUBLIC Attribute; -- int gExpungeLogPos: PUBLIC Attribute; -- int gNewMailInfo: PUBLIC Relation; gNewMailLogLength: PUBLIC Attribute; -- int gCopyNewMailLogPos: PUBLIC Attribute; -- int gAcceptNewMailLogPos: PUBLIC Attribute; -- int gAddingServerMsgs: PUBLIC Attribute; -- bool gLastNewMailTimeStamp: PUBLIC Attribute; -- time gReadArchiveInfo: PUBLIC Relation; gReadArchiveLogPos: PUBLIC Attribute; -- int gCopyReadArchiveLogPos: PUBLIC Attribute; -- int gVersionInfo: PUBLIC Relation; gMsgCount: PUBLIC Attribute; -- int gMsgSetCount: PUBLIC Attribute; -- int gMsgSetsVersion: PUBLIC Attribute; -- int << >> <> <<>> rRootInfo: PUBLIC Relship; rLogInfo: PUBLIC Relship; rParseLogInfo: PUBLIC Relship; rExpungeInfo: PUBLIC Relship; rVersionInfo: PUBLIC Relship; rNewMailInfo: PUBLIC Relship; rReadArchiveInfo: PUBLIC Relship; <> 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]; <> 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]; }; END.