BlackCherry.mesa
Copyright Ó 1989, 1990, 1992 by Xerox Corporation. All rights reserved.
Bill Jackson (bj) June 23, 1989 1:15:33 pm PDT
Willie-Sue, February 9, 1990 11:30:13 am PST
Doug Terry, January 22, 1990 10:34:54 am PST
DIRECTORY
IO USING [ STREAM, Value ],
Menus USING [MenuProc],
Rope USING [ ROPE ],
TiogaButtons USING [ TiogaButton ],
ViewerClasses USING [ IconFlavor, Viewer ],
ViewerEvents USING [ EventRegistration ];
BlackCherry: CEDAR DEFINITIONS ~ {
ROPE: TYPE ~ Rope.ROPE;
STREAM: TYPE ~ IO.STREAM;
Viewer: TYPE = ViewerClasses.Viewer;
msgSetIcon, msgIcon: ViewerClasses.IconFlavor;
MsgHandle: TYPE ~ REF MsgHandleRec;
MsgHandleRec: TYPE ~ RECORD [
toc, gvID: ROPE ¬ NIL,
deleted: BOOL ¬ FALSE,
unRead: BOOL ¬ TRUE,
headersPos, textLen: INT,
formatPos, formatLen: INT,
entryStart, entryLen: INT ¬ 0,
charPos: INT ¬ 0,
tocButton: TiogaButtons.TiogaButton,
msInfo: MsgSetInfo,
next: MsgHandle,
data: REF ANY ¬ NIL
];
MsgSetInfo: TYPE ~ REF MsgSetInfoRec;
MsgSetInfoRec: TYPE ~ RECORD [
tiogaViewer: Viewer, -- only child, $TiogaButton viewer
fileName: ROPE,
fileData: BCFileData,
viewer: Viewer,
whichMenu: ATOM ¬ $all, -- matches whichMenu in OpsProc
destroyER: ViewerEvents.EventRegistration,
msgDisplayer: Viewer,
first, last, selected: MsgHandle,
data: REF ANY ¬ NIL
];
Exported operations
GetMsgContents: PROC [msInfo: MsgSetInfo, msgH: MsgHandle] RETURNS [contents, formatting: ROPE];
Returns the contents and formatting of the given message.
GetMsgID: PROC [msInfo: MsgSetInfo, msgH: MsgHandle] RETURNS [id: ROPE];
Returns the ID of the given message.
DisplayOneMsg: PROC [msgH: MsgHandle, grow: BOOL];
Displays the given messages.
NewFile: PROC [msInfo: MsgSetInfo];
Clears message set.
Registered procedures
ProcessNewMailProc: TYPE = PROC [msInfo: MsgSetInfo, msgH: MsgHandle] RETURNS [];
Called whenever new messages have been retrieved. The set of new messages is linked together; this procedure should not change these links.
InsertMsgsProc: TYPE = PROC [msInfo: MsgSetInfo, msgH: MsgHandle] RETURNS [];
Called to add the given set of messages to the given message set. Messages can be added in any order; the default is to simply add messages to the end of the message set.
MsgButtonTextProc: TYPE = PROC [msInfo: MsgSetInfo, msgH: MsgHandle] RETURNS [text: ROPE];
Called to get the text to be used for the message's button in a message set displayer; the default is the message's TOC, e.g. "19 Jan 90 Willie Sue ... Some subject".
CustomProcs: TYPE = REF CustomProcsRec;
CustomProcsRec: TYPE = RECORD[
newMail: ProcessNewMailProc ¬ NIL,
insertMsgs: InsertMsgsProc ¬ NIL,
msgButtonText: MsgButtonTextProc ¬ NIL
];
RegisterCustomProcs: PROC[procs: CustomProcs];
Register a complete new set of procedures, replacing previous procedures. If procs is NIL then the default procedures are reinstated.
GetCustomProcs: PROC[] RETURNS [procs: CustomProcs];
Returns the currently registered set of procedures.
Menu items
OpsProc: TYPE ~ PROC[msI: MsgSetInfo];
AddOpsProc: PROC[menuName: ROPE, proc: OpsProc, whichMenu: ATOM ¬ $all];
Add item to "Ops" menu that invokes the given procedure when buttoned.
whichMenu can be
$all => all ops Menus
$writeNeeded => do not include in readOnly ops menus
... more as needed
AddDisplayerProc: PROC[menuName: ROPE, proc: Menus.MenuProc];
Add item to main per-msgSet menu.
AddMsgProc: PROC[menuName: ROPE, proc: Menus.MenuProc];
Add item to main per-msg menu.
File access
BadName: ERROR;
OpenFailed: ERROR;
BCFileData: TYPE = REF BCFileDataRec;
BCFileDataRec: TYPE = RECORD[
name: ROPE,
readStream: STREAM,
writeStream: STREAM,
clientData: REF ANY
];
RegisterFileProcs: PROC[procs: FileProcs];
FileProcs: TYPE = REF FileProcsRec;
FileProcsRec: TYPE = RECORD[
fullName: PROC[ fileName: ROPE, wDir: ROPE ¬ NIL ] RETURNS [ fullName: ROPE ],
openOrCreate: PROC[ name: ROPE, how: ATOM ] RETURNS [ fileData: BCFileData ],
how = $open, $create, $openOrCreate, etc
setByteCount: PROC[ fileData: BCFileData, bytes: INT ],
iconSetter: PROC[iconFileName: ROPE]
];
Reporting
Report: PROC [format: ROPE, v1, v2, v3: IO.Value ¬ [null[]] ];
}.