(FILECREATED " 3-Apr-87 16:49:12" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH237.;1 5698   

      changes to:  (VARS RHTPATCH237COMS)
		   (FNS NC.CheckpointNoteFile))


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

(PRETTYCOMPRINT RHTPATCH237COMS)

(RPAQQ RHTPATCH237COMS ((* * Removes extra "T" arg being passed by NC.CheckpointNoteFile to 
			     NC.SaveDirtyCards.)
			  (* * Change to NCDATABASE)
			  (FNS NC.CheckpointNoteFile)))
(* * Removes extra "T" arg being passed by NC.CheckpointNoteFile to NC.SaveDirtyCards.)

(* * Change to NCDATABASE)

(DEFINEQ

(NC.CheckpointNoteFile
  (LAMBDA (NoteFile QuietFlg Don'tSaveDirtyCardsFlg InterestedWindow OperationMsg)
                                                             (* rht: " 3-Apr-87 16:47")

          (* * Checkpoint a notefile by call the device specific checkpoint fn.)



          (* * fgh 5/26/86 First created.)



          (* * fgh 9/1/86 Updated with with changes made to checkpinting since 5/23/86. Reimplemented changes include: 
	  (* * fgh 6/4/86 Added Don'tSaveDirtyCardsFlg to prevent double passes through active cards at close time) 
	  (* * fgh 6/13/86 Changed printouts to NF menu. Added check for operations in progress.) (* * fgh 6/25/86 Put in 
	  contention lock and NC.ProtectedNoteFileOperation Added Don'tCheckOperationInProgressFlg 
	  Don'tCheckCardOperationsInProgressFlg & InterestedWindow args.) (* * rht 7/4/86: Added check for readonly 
	  notefile.) (* * rht 7/16/86: Now passes QuietFlg arg down to NC.SaveDirtyCards.))



          (* * pmi 12/3/86 Added check for open NoteFile before attempting Checkpoint (Code stolen from NC.CloseNoteFile))



          (* * pmi 12/22/86 Made test for open notefile consistent with other NoteFile operations (ie. Abort Close))



          (* * rg 3/4/87 rewritten for new concurrency machinery)



          (* * rht 3/25/87: Now calls NC.CoerceToInterestedWindow.)



          (* * rg 3/27/87 fiddled with NC.ProtectedNoteFileOperation wrapper)



          (* * rht 4/3/87: Took out extra "T" argument being passed to NC.SaveDirtyCards.)


    (DECLARE (GLOBALVARS NC.MsgDelay))
    (NC.ProtectedNoteFileOperation
      NoteFile "Checkpoint NoteFile" InterestedWindow (OR (OPENWP InterestedWindow)
							    (SETQ InterestedWindow (
								NC.CoerceToInterestedWindow 
											 NoteFile)))
      (PROG ((FullFileName (fetch (NoteFile FullFileName) of NoteFile))
	       ReturnValue)

          (* * Make sure NF is open)


	      (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 checkpoint 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 Checkpoint. ↑ to abort Checkpoint."))))
			     then (RETURN ReturnValue)))
	      (SETQ OperationMsg (CONCAT (OR OperationMsg "")
					     "Checkpointing " FullFileName (CHARACTER 13)))
	      (if (NC.CheckForNotReadOnly NoteFile InterestedWindow "Can't checkpoint ")
		  then (RETURN (PROGN (OR QuietFlg (RESETSAVE NIL
									(BQUOTE (NC.ClearMsg
										    , 
										 InterestedWindow T)))
						  )

          (* * If appropriate, msg the user.)


					    (OR QuietFlg (NC.PrintMsg InterestedWindow 
									"Checkpointing notefile "
									  FullFileName " ..."
									  (CHARACTER 13)))

          (* * Save the dirty cards on the screen if necessary.)


					    (if (NULL Don'tSaveDirtyCardsFlg)
						then (NC.SaveDirtyCards NoteFile InterestedWindow 
									    OperationMsg QuietFlg))
                                                             (* Put out the new ChkptPtr to the file.)

          (* * Call the device specific checkpoint fn.)


					    (if (NULL (ERSETQ (SETQ ReturnValue
								      (APPLY* (fetch
										  (NoteFile 
									     CheckpointNoteFileFn)
										   of NoteFile)
										NoteFile 
										InterestedWindow 
										OperationMsg QuietFlg)
								      )))
						then (SETQ ReturnValue (QUOTE CheckpointFailed))
						  )

          (* * Process the error returns.)


					    (if (type? NoteFile ReturnValue)
						then 

          (* * Successful return.)


						       (OR QuietFlg (NC.PrintMsg InterestedWindow 
										     T
										     (OR 
										     OperationMsg "")
										     
									      " Checkpoint done."
										     (CHARACTER
										       13)))
						       NoteFile
					      else 

          (* * Error return.)


						     (ERSETQ (NC.ReportError NIL
										 (CONCAT 
									 "Checkpoint failed for "
											   
										     FullFileName 
										      " because "
											   
										      ReturnValue ".")
										 ))
						     ReturnValue))))))))
)
(PUTPROPS RHTPATCH237 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (587 5616 (NC.CheckpointNoteFile 597 . 5614)))))
STOP