DIRECTORY IO USING [Value], Menus USING [MenuProc], Rope USING [ROPE], ViewerClasses USING [Viewer]; WalnutWindow: CEDAR DEFINITIONS = BEGIN Viewer: TYPE = ViewerClasses.Viewer; ROPE: TYPE = Rope.ROPE; OutCome: TYPE = {ok, flushed, notRunning}; WalnutHandle: TYPE = REF WalnutHandleRec; WalnutHandleRec: TYPE; GetHandleForRootFile: PROC[rootFile: ROPE] RETURNS[wH: WalnutHandle]; GetHandleForMail: PROC RETURNS[wH: WalnutHandle]; GetHandleList: PROC RETURNS[LIST OF WalnutHandle]; GetRootFileForHandle: PROC[wH: WalnutHandle] RETURNS[rootFile: ROPE]; GetSegmentForHandle: PROC[wH: WalnutHandle] RETURNS[segment: ATOM]; GetHandleForSegment: PROC[segment: ATOM] RETURNS[wH: WalnutHandle]; GetMsgName: PROC[v: Viewer] RETURNS[mName: ROPE, rootFile: ROPE]; GetMsgSetName: PROC[v: Viewer] RETURNS[msName: ROPE, rootFile: ROPE]; CurrentVersion: PROC[wH: WalnutHandle, msName: ROPE] RETURNS[version: INT]; AddToMsgMenu: PROC[wH: WalnutHandle, label: ROPE, proc: Menus.MenuProc, clientData: REF ANY ¬ NIL, onQueue: BOOL ¬ FALSE, doReset: BOOL ¬ TRUE]; ReplaceInMsgMenu: PROC[wH: WalnutHandle, label: ROPE, proc: Menus.MenuProc, clientData: REF ANY ¬ NIL, onQueue: BOOL ¬ FALSE, doReset: BOOL ¬ TRUE] RETURNS[oldFound: BOOL]; RemoveFromMsgMenu: PROC[wH: WalnutHandle, name: ROPE]; DisplayMsg: PROC[wH: WalnutHandle, msg: ROPE, oldV: Viewer ¬ NIL, shift: BOOL ¬ FALSE, paint: BOOL ¬ TRUE] RETURNS[v: Viewer]; DisplayMsgSet: PROC[wH: WalnutHandle, msgSet: ROPE, shift: BOOL ¬ FALSE, repaint: BOOL ¬ TRUE] RETURNS[v: Viewer]; StartUp: PROC[rootFile: ROPE, dontDoMail: BOOL ¬ FALSE] RETURNS[wH: WalnutHandle]; Shutdown: PROC[wH: WalnutHandle]; QueueCall: PROC[wH: WalnutHandle, proc: PROC[WalnutHandle] RETURNS[doReset: BOOL]] RETURNS[outCome: OutCome]; GetNewMail: PROC[wH: WalnutHandle]; Expunge: PROC[wH: WalnutHandle]; Scavenge: PROC[rootFile: ROPE, dontDoMail: BOOL ¬ FALSE] RETURNS[wH: WalnutHandle]; WriteArchiveFile: PROC[wH: WalnutHandle, fileName: ROPE, msgSetList: LIST OF ROPE]; ReadArchiveFile: PROC[wH: WalnutHandle, fileName, msgSet: ROPE, useCategoriesInFile: BOOL ¬ FALSE]; SelectMsgSetsFromMSNames: PROC [wH: WalnutHandle, msNames: LIST OF ROPE] RETURNS[notFound: LIST OF ROPE]; GetWalnutViewers: PROC[wH: WalnutHandle] RETURNS [msgSetList, msgList, wallabyList: LIST OF Viewer]; Report: PROC[wH: WalnutHandle, msg1, msg2, msg3: ROPE ¬ NIL]; ReportRope: PROC[wH: WalnutHandle, msg1, msg2, msg3: ROPE ¬ NIL]; ReportFormat: PROC[wH: WalnutHandle, format: ROPE ¬ NIL, v1, v2, v3, v4, v5: IO.Value ¬ [null[]] ]; END.  WalnutWindow.Mesa Copyright Σ 1985, 1987, 1988, 1992 by Xerox Corporation. All rights reserved. Willie-Sue, July 18, 1988 7:37:28 pm PDT Donahue, May 22, 1985 10:41:18 am PDT Dealing with multiple Walnut Control Windows wH will be NIL if that rootFile is not an active walnut get wH for the one database allowed to get new Mail - may return NIL returns a list of all the known WalnutHandle's returns NIL if the handle is no longer valid returns NIL if the handle is no longer valid returns NIL if no handle for that segment Msg and MsgSet viewer procedures If v is a Viewer for a Walnut Msg, then return its name else NIL If v is a Viewer for a Walnut MsgSet, then return its name else NIL Give the current "expected version" of the message set (-1 means "don't care"). This version may not agree with the database; it is simply the current version that WalnutWindow believes! adds menu button, synchronised using walnutQueue if onQueue is TRUE; if doReset then after the call to the client proc, walnut's display will be checked and updated if necessary. Errors from WalnutOps will cause WalnutDefs.Error to be raised. IF WalnutHandle is NIL, then will get added for all current running Walnut's, but then the client has no way of finding out which Walnut it is running in. replaces menu button lable if found (else adds it), synchronised using walnutQueue if onQueue is TRUE; if doReset then after the call to the client proc, walnut's display will be checked and updated if necessary. Errors from WalnutOps will cause WalnutDefs.Error to be raised. If WalnutHandle is NIL, then will get added for all current running Walnut's, but then the client has no way of finding out which Walnut it is running in. removes the named button from the msg displayer menu, if such a button exists; no errors Displaying Msgs and MsgSets displays Msg name (if it exists) in Viewer oldV; if oldV is NIL it creates a viewer returns NIL if msgSet is not a MsgSet in wH. This operation also inserts the viewer into the state recorded by the Walnut control window, so that operations on the messages in the message set are guaranteed to use a consistent version of the set. If the message set is already displayed, then it will be repainted if repaint is TRUE Other useful operations Open up a WalnutWindow on the database named in the root file Close down the WalnutWindow places proc on Walnut's TBQueue; Walnut will do a Reset after the call completes, in case proc has changed the displayed state of Walnut. outCome lets the caller know what happened with the call. Errors from WalnutOps will cause WalnutDefs.Error to be raised. If proc changed the database then proc should return TRUE, to get Walnut to update the display checks if user has changes, then calls DoNewMail If the message set list is NIL, then the entire database is dumped IF msgSet is NIL and useCategoriesInFile is FALSE, then messages go into Active; IF msgSet is NIL and useCategoriesInFile is TRUE, then use the ones specified in the file IF msgSet is non-NIL THEN put all messages into it Selects the message set buttons in the Walnut Control viewer which corresponds to the list of msNames given. Returns a list of any not found Reporting Operations Prints non-omitted arguments in the Walnut window followed by CR. Similar to above, but doesn't print CR at end. Κ[•NewlineDelimiter –(cedarcode) style™codešΟb™Kšœ ΟeœC™NK™(KšΟy%™%—K˜šΟk ˜ Kš œ œ ˜Kšœ œ ˜Kšœ œ œ˜Kšœ œ ˜K˜—KšΟn œ œ  œ˜!˜Kš ˜K˜Kšœ œ˜$Kš œ œ œ˜Kšœ  œ˜*K˜Kšœ œ œ˜)Kšœ œ˜K˜—šΠbl,™,K˜š‘œ œ  œ œ˜EK™7K™—š‘œ œ œ˜1K™DK™—š ‘ œ œ œ œ œ˜2Kšœ.™.K™—š‘œ œ œ  œ˜EK™,K™—š‘œ œ œ  œ˜CK™,K™—š‘œ œ  œ œ˜CKšœ œ™)K™——š’ ™ K˜š ‘ œ œ  œ œ  œ˜AKšœ@™@—K˜š ‘ œ œ  œ  œ  œ˜EKšœC™C—K˜š ‘œ œ œ œ  œ˜KKšœ»™»—K˜š‘ œ œ œ$ œ œ œ  œ œ  œ œ˜Kšœ²™²K™?šœš™šK™——š‘œ œ œ$ œ œ œ  œ œ  œ œ˜“Kš œ  œ˜KšœΤ™ΤK™?Kšœš™š—K˜š‘œ œ œ˜6K™X——K™š’™K˜š‘ œ œ œ œ  œ œ  œ œ˜jKšœ œ ˜KšœS™S—K™š‘ œ œ œ  œ œ  œ œ œ ˜rKšœΞ™ΞK™——š’™K˜š ‘œ œ  œ œ œ œ˜RKšœ=™=—K˜š‘œ œ˜!Kšœ™—K˜š ‘ œ œ œ œ  œ œ˜mK™Ε—K™ŸK˜š‘ œ œ˜#Kšœ0™0K˜—Kš‘œ œ˜ K˜Kš ‘œ œ  œ œ œ œ˜SK˜š ‘œ œ œ œ œ œ˜SKšœB™B—K˜š ‘œ œ% œ œ œ˜cKšœͺ™ͺKšœ2™2—K˜š ‘œ œ œ œ œ˜HKš œ œ  œ œ œ˜!K™Œ—K˜š‘œ œ˜(Kšœ œ$ œ œ ˜<—K™—š’™K˜š‘œ œ% œ œ˜=KšœA™A—K˜š‘ œ œ% œ œ˜AKšœ.™.K™—š ‘ œ œ œ œ œ˜cK™——K˜Kš œ˜K˜K˜—…— φg