-- /ivy/binding/calendar/calStorage.mesa
-- Last edited by: Binding, August 16, 1984 2:52:54 pm PDT
DIRECTORY
Calendar USING [ Days, Months, Years, Date, ZoomLevel],
Hickory USING [ EventList, Event, Reason, EventTuple],
ViewerClasses USING [ Viewer],
RopeSets USING [ RopeSet]
;
CalStorage: CEDAR DEFINITIONS =
BEGIN OPEN Calendar;
Global Types
DayNode: TYPE = RECORD [
Day: Days,
Initialized: BOOLEANFALSE, -- was Hickory already queried for that day?
EvList: Hickory.EventList ← NIL
];
MonthNode: TYPE = RECORD [
Month: Months,
Initialized: BOOLEANFALSE, -- for that month?
DayNodes: ARRAY Days OF DayNode,
Viewer: ViewerClasses.Viewer ← NIL
];
YearNode: TYPE = RECORD [
Year: Years,
Initialized: BOOLEANFALSE, -- for that year?
MonthNodes: ARRAY Months OF MonthNode,
Next: REF YearNode,
Viewer: ViewerClasses.Viewer ← NIL
];
Mode: TYPE = { Query, Browse, EnterEvent, Initial };
ProtectedData: TYPE = MONITORED RECORD [
calViewer: ViewerClasses.Viewer ← NIL,
curDate: Date,
curMode: Mode,
yearTrees: REF YearNode
];
Global Variables
protData: ProtectedData;
Operations
GetEventsOfDay: PRIVATE --INTERNAL-- PROCEDURE [ date: Date, zoomLevel: ZoomLevel] RETURNS [ evl: Hickory.EventList];
zoomLevel is used for prefetching....
RetrieveViewer: PRIVATE -- INTERNAL-- PROCEDURE [ date: Date, zoom: ZoomLevel] RETURNS [ viewer: ViewerClasses.Viewer];
StoreViewer: PRIVATE -- INTERNAL-- PROCEDURE [ date: Date, zoom: ZoomLevel, viewer: ViewerClasses.Viewer];
DestroyAllViewers: PRIVATE --INTERNAL-- PROCEDURE;
to destroy all viewers that are cached in CalStorage.
FindEvent: PRIVATE --INTERNAL-- PROCEDURE [ date: Date, key: Hickory.Event] RETURNS [ evPtr: REF Hickory.EventTuple];
return the pointer onto the event in storage. Makes a copy of tuple...
HickoryChange: PRIVATE --INTERNAL-- PROCEDURE [ reason: Hickory.Reason, ev: Hickory.Event, data: RopeSets.RopeSet] RETURNS [ oldEvl, newEvl: Hickory.EventList];
here we update calendar storage and return the list of events that have indeed
changed. 'oldEvl' is the list of events with key = 'ev' that were in storge before
the change to hickory, newEvl is the list of events that now is in calStorage.
END.