DIRECTORY CedarSnapshot, -- using lots InputFocus USING [EnableInput], Menus USING [ClickProc], MessageWindow USING [Append, Blink, Confirm], SafeStorage USING [ReclaimCollectibleObjects], ViewerClasses USING [Viewer], ViewerOps USING [EnumerateViewers, EnumProc, FindViewer], ViewersSnapshot, WindowManager USING [UnWaitCursor, WaitCursor]; ViewersSnapshotImpl: CEDAR MONITOR IMPORTS CedarSnapshot, InputFocus, MessageWindow, SafeStorage, ViewerOps, WindowManager EXPORTS ViewersSnapshot SHARES InputFocus = BEGIN working: BOOL _ FALSE; Working: ENTRY PROC RETURNS [now: BOOL] = INLINE {now _ working; working _ TRUE}; Done: ENTRY PROC = INLINE {working _ FALSE}; Checkpoint: PUBLIC PROC RETURNS [outcome: CedarSnapshot.Outcome] = BEGIN OPEN CedarSnapshot; IF Working[] THEN RETURN [checkpointed]; WindowManager.WaitCursor[]; MessageWindow.Append["Trace and sweep of collectable storage...", TRUE]; [] _ SafeStorage.ReclaimCollectibleObjects[TRUE, TRUE]; -- t&s collection MessageWindow.Append["Processing checkpoint file...", TRUE]; TRUSTED {outcome _ CedarSnapshot.Checkpoint[]}; MessageWindow.Append[SELECT outcome FROM checkpointed => "Checkpoint created successfully.", rolledBack => "State restored to previous checkpoint.", insufficientDiskSpace => "Insufficient disk space to make checkpoint!", transactionsInProgress => "Transaction in progress . . . checkpoint aborted.", overwrittenBcd => "OVERWRITTEN BCDS! Strongly recommend you boot!", potentiallyDangerousCodeLinks => "Warning: Checkpoint has potentially dangerous code links!", ENDCASE => "Checkpoint or Rollback problem; see a system wizard!", TRUE]; IF outcome = overwrittenBcd THEN { bootButton: ViewerClasses.Viewer; MessageWindow.Blink[]; bootButton _ ViewerOps.FindViewer["Boot"]; IF bootButton # NIL THEN bootButton.class.notify[bootButton, LIST[$Mark, $Hit]]; MessageWindow.Blink[]}; InputFocus.EnableInput[]; WindowManager.UnWaitCursor[]; Done[]; END; RollBack: PUBLIC PROC = BEGIN TRUSTED {CedarSnapshot.RollBack[]}; -- no return unless rollback fails! MessageWindow.Append["No previous Checkpoint to restore!"]; MessageWindow.Blink[]; END; NothingWorthSaving: PROC RETURNS[BOOLEAN] = BEGIN dirty: BOOLEAN _ FALSE; CheckDirty: ViewerOps.EnumProc = {dirty _ v.newVersion OR v.newFile OR dirty}; ViewerOps.EnumerateViewers[CheckDirty]; IF dirty THEN { MessageWindow.Blink[]; IF ~MessageWindow.Confirm[ "Confirm discard of edits ... "] THEN { MessageWindow.Append["action aborted."]; RETURN[FALSE]}}; RETURN[TRUE]; END; MCheckpoint: PUBLIC Menus.ClickProc = {IF NothingWorthSaving[] THEN [] _ Checkpoint[]}; MRollBack: PUBLIC Menus.ClickProc = {IF NothingWorthSaving[] THEN RollBack[]}; END. ΚViewersSnapshotImpl.mesa; Written by S. McGregor last edited by McGregor October 25, 1982 2:35 pm Last Edited by: Maxwell, January 27, 1983 12:42 pm Last Edited by: Pausch, July 18, 1983 4:46 pm Κ– "cedar" style˜JšΟc0™0Jš0™0J™2JšΟi-™-J˜šΟk ˜ Jšœ ˜Jšœ Ÿœ˜JšœŸœ ˜JšœŸœ˜-Jšœ Ÿœ˜.JšœŸœ ˜Jšœ Ÿœ*˜9Jšœ˜JšœŸœ˜/J˜—JšœŸ ˜"J˜JšŸœP˜WJšŸœ˜JšŸœ ˜J˜JšŸ˜J˜Jšœ ŸœŸœ˜J˜JšΟnœŸœŸœŸœŸœŸœŸœ˜QJ˜Jš  œŸœŸœŸœ Ÿœ˜,J˜š  œŸœŸœŸœ#˜BJšŸœŸœ˜JšŸœ ŸœŸœ˜(Jšœ˜JšœBŸœ˜HJšœ+ŸœŸœ˜IJšœ6Ÿœ˜