(FILECREATED " 7-Aug-87 11:35:10" {QV}<NOTECARDS>1.3KNEXT>PMIPATCH055.;1 6600 changes to: (VARS PMIPATCH055COMS) (FNS NC.AbortSession)) (* Copyright (c) 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT PMIPATCH055COMS) (RPAQQ PMIPATCH055COMS ((* * pmi 8/7/87: Fixes bug %#591: Too easy to abort from open NoteFile.) (* * Changed in NCDATABASE) (FNS NC.AbortSession))) (* * pmi 8/7/87: Fixes bug %#591: Too easy to abort from open NoteFile.) (* * Changed in NCDATABASE) (DEFINEQ (NC.AbortSession (LAMBDA (NoteFile InterestedWindow Don'tConfirmFlg QuietFlg) (* pmi: " 7-Aug-87 11:27") (* * Kill the current notecards session. Work lost since last checkpoint.) (* * rht 7/14/85: Replaced the call to reset the main menu with call to NC.ResetMainMenu. Also took out redundant reset of PSA.Database, since NC.ForceDatabaseClose is doing that.) (* * fgh & rht 10/16/85 Update with new cacheing mechanism.) (* * fkr 11/8/85 Updated to handle noteFile object and new CardID scheme.) (* * kirk 20Jan86 Added Don'tCloseFlg to leave NoteFile open after done deleting changes.) (* * kirk 23Jan86 Changed to use NC.AskYesOrNo) (* * rht 7/2/86: No longer bugs you if no changes were made since last checkpoint. Removed Don'tCloseFlg arg and added InterestedWindow arg.) (* * rht 7/6/86: Now clears InterestedWindow of final truncating message.) (* * rht 7/13/86: Added Don'tConfirmFlg and QuietFlg args. Note that Don'tConfirmFlg non-nil stops questioning of user as to losing all changes.) (* * kirk 11/17/86 Changed call on SETFILEINFO to pass stream instead of filename.) (* * pmi 12/22/86 Made test for open notefile consistent with other NoteFile operations (ie. Checkpoint, Close)) (* * rht 2/19/87: Added DEL.PROCESS call to kill caching process.) (* * rg 3/6/87 added NC.ProtectedSessionOperation wrapper) (* * rht 3/25/87: Now calls NC.CoerceToInterestedWindow.) (* * rg 3/31/87 changed ProtectedSessionOp to ProtectedNoteFileOp) (* * pmi 8/7/87: Now asks for confirm no matter what work was done.) (DECLARE (GLOBALVARS NC.MsgDelay)) (OR InterestedWindow (SETQ InterestedWindow (NC.CoerceToInterestedWindow NoteFile))) (NC.ProtectedNoteFileOperation NoteFile "Abort Session" InterestedWindow (PROG ((Stream (fetch (NoteFile Stream) of NoteFile)) (FullFileName (fetch (NoteFile FullFileName) of NoteFile)) (LastChkptPtr (fetch (NoteFile CheckptPtr) of NoteFile)) EndPtr CardTotal NewBytes ReturnValue) (if (NULL (ERSETQ (SETQ ReturnValue (NC.NoteFileOpenP NoteFile)))) then (SETQ ReturnValue (QUOTE OpenPFailed))) (if (NULL ReturnValue) then (* * NoteFile is not open.) (NC.PrintMsg InterestedWindow T "Can't abort a closed notefile." (CHARACTER 13)) (DISMISS NC.MsgDelay) (NC.ClearMsg InterestedWindow T) (RETURN NIL) elseif (NOT (type? NoteFile ReturnValue)) then (* * Error return from NoteFileOpenPFn) (if (NULL (ERSETQ (NC.ReportError NIL (CONCAT "OpenP test on " FullFileName "failed because " ReturnValue (CHARACTER 13) "OK to continue Abort. ↑ to abort Abort.")))) then (RETURN ReturnValue))) (* * Delete the types and titles caching process if still alive. Have to do it now in order to make checking operations that follow suitably efficient. Note its a bit too early since we can still cancel this close. But any harm done is loss of speed if NoteFile remains open when close iss cancelled.) (DEL.PROCESS (fetch (NoteFile CachingProcess) of NoteFile)) (* * Removed old confirm question based on amount of stuff written past the checkpoint.) (SETQ EndPtr (GETEOFPTR Stream)) (* * (SETQ NewBytes (IDIFFERENCE EndPtr LastChkptPtr))) (* * This was in the if below: (OR (ZEROP NewBytes) Don'tConfirmFlg (NC.AskYesOrNo (CONCAT "Do you wish to lose all changes since" (CHARACTER 13) "the last checkpoint (" NewBytes " bytes) of " FullFileName) "--" "Yes" T InterestedWindow NIL T))) (if (NC.AskYesOrNo (CONCAT "Do you wish to lose all changes since" (CHARACTER 13) "the open or last checkpoint of " FullFileName) "--" "No" T InterestedWindow NIL T) then (LET ((CardNumber 0) (CardTotal (fetch (NoteFile HashArraySize) of NoteFile))) (NC.MapCards NoteFile (FUNCTION (LAMBDA (Card) (LET (Win) (SETQ CardNumber (ADD1 CardNumber)) (OR QuietFlg (COND ((ZEROP (IREMAINDER CardNumber 100)) (NC.PrintMsg InterestedWindow T "Quitting from active cards ... " (CHARACTER 13) "Processing item number " CardNumber " out of " CardTotal "." (CHARACTER 13))))) (COND ((NC.ActiveCardP Card) (SETQ Win (NC.FetchWindow Card)) (NC.AbortCard Card QuietFlg) (COND (Win (bind (Process ←(WINDOWPROP Win (QUOTE PROCESS))) until (OR (NULL Process) (PROCESS.FINISHEDP Process)) do (BLOCK)) (CLOSEW Win)))))))))) (COND ((LESSP LastChkptPtr EndPtr) (OR QuietFlg (NC.PrintMsg InterestedWindow T "Truncating file " FullFileName " ...")) (COND ((NOT (SETFILEINFO Stream (QUOTE LENGTH) LastChkptPtr)) (NC.PrintMsg InterestedWindow NIL "Couldn't truncate " FullFileName "." (CHARACTER 13)))))) (NC.ResetNoteFileInterface NoteFile) (NC.ForceDatabaseClose NoteFile)) (NC.ClearMsg InterestedWindow T))))) ) (PUTPROPS PMIPATCH055 COPYRIGHT ("Xerox Corporation" 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (537 6518 (NC.AbortSession 547 . 6516))))) STOP