(FILECREATED " 6-Jul-86 18:09:34" {QV}<NOTECARDS>1.3K>RHTPATCH059.;1 4578   

      changes to:  (VARS RHTPATCH059COMS)
		   (FNS NC.AbortSession NC.AbortCard))


(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT RHTPATCH059COMS)

(RPAQQ RHTPATCH059COMS ((* * Fixes problem of abort doing reactivating of top level cards.)
			  (* * Changes to NCDATABASE)
			  (FNS NC.AbortSession)
			  (* * Changes to NCCARDS)
			  (FNS NC.AbortCard)))
(* * Fixes problem of abort doing reactivating of top level cards.)

(* * Changes to NCDATABASE)

(DEFINEQ

(NC.AbortSession
  (LAMBDA (NoteFile InterestedWindow)                        (* rht: " 6-Jul-86 18:04")

          (* * 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.)


    (LET ((Stream (fetch (NoteFile Stream) of NoteFile))
	  (FullFileName (fetch (NoteFile FullFileName) of NoteFile))
	  (LastChkptPtr (fetch (NoteFile CheckptPtr) of NoteFile))
	  EndPtr CardTotal NewBytes)
         (if (AND (STREAMP Stream)
		      (OPENP Stream))
	     then (OR InterestedWindow (SETQ InterestedWindow (WFROMMENU (fetch
										   (NoteFile Menu)
										    of NoteFile))))
		    (SETQ EndPtr (GETEOFPTR Stream))
		    (SETQ NewBytes (IDIFFERENCE EndPtr LastChkptPtr))
		    (if (OR (ZEROP NewBytes)
				(NC.AskYesOrNo (CONCAT "Do you wish to lose all changes since"
							   (CHARACTER 13)
							   "the last checkpoint (" NewBytes 
							   " bytes) of "
							   FullFileName)
						 "--" "Yes" NIL 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))
				         (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)
					     (COND
					       (Win (bind (Process ←(WINDOWPROP Win (QUOTE
										      PROCESS)))
						       until (OR (NULL Process)
								     (PROCESS.FINISHEDP Process))
						       do (BLOCK))
						    (CLOSEW Win))))))))))
			 (COND
			   ((LESSP LastChkptPtr EndPtr)
			     (NC.PrintMsg InterestedWindow T "Truncating file " FullFileName " ...")
			     (COND
			       ((NOT (SETFILEINFO FullFileName (QUOTE LENGTH)
						      LastChkptPtr))
				 (NC.PrintMsg InterestedWindow NIL "Couldn't truncate " 
						FullFileName "." (CHARACTER 13))))))
			 (NC.ResetNoteFileInterface NoteFile)
			 (NC.ForceDatabaseClose NoteFile))
		    (NC.ClearMsg InterestedWindow T)
	   else (NC.PrintMsg InterestedWindow T FullFileName " is not an open NoteFile!!!"
				 (CHARACTER 13))))))
)
(* * Changes to NCCARDS)

(DEFINEQ

(NC.AbortCard
  (LAMBDA (Card)                                             (* rht: " 6-Jul-86 18:04")

          (* * Kill this card's process and its window.)



          (* * fgh 11/13/85 Updated to handle Card object.)



          (* * rht 7/6/86: Now passes non-nil Don'tRecacheFlg to NC.QuitCard.)


    (NC.QuitCard Card NIL T T)))
)
(PUTPROPS RHTPATCH059 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (590 4089 (NC.AbortSession 600 . 4087)) (4121 4496 (NC.AbortCard 4131 . 4494)))))
STOP