(FILECREATED "26-Mar-86 18:41:55" {QV}<NOTECARDS>1.3K>RHTPATCH036.;1 4419   

      changes to:  (MACROS NC.ApplySupersFn)
		   (VARS RHTPATCH036COMS))


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

(PRETTYCOMPRINT RHTPATCH036COMS)

(RPAQQ RHTPATCH036COMS ((FNS NC.CloseDatabaseFile)
			  (MACROS NC.ApplySupersFn)))
(DEFINEQ

(NC.CloseDatabaseFile
  (LAMBDA (NoteFile)                                         (* rht: "26-Mar-86 18:12")
                                                             (* Close the currently open database file.)

          (* * rht 10/23/84: Now gives user option of closing and saving all open cards on the screen.)



          (* * rht 11/8/84: Put RESETLST around NC.CacheTitles call.)



          (* * rht 1/9/85: Clear the NC.UncachingNotCompleted variable when close successfully completes.)



          (* * rht 1/31/85: Added call to checkpoint database. That in turn dumps the next nodeID and next linkID.)



          (* * 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 10/16/85 removed call to CacheTypesAndTitles because uncacheing now done automatically by cache 
	  mechanism.)



          (* * fkr 10/29/85: Now kills caching process from database streamprop.)



          (* * fkr 11/8/85 Updated to handle new NoteFile object and new CardID scheme.)



          (* * kirk 23Jan86 Changed to use NC.AskYesOrNo)



          (* * rht 3/26/86: Now searches for active cards over whole notefile not just among cards up on screen.
	  Uses NC.MapCards.)


    (PROG ((Stream (fetch (NoteFile Stream) of NoteFile))
	     FileName CardTotal ActiveCards)
	    (COND
	      ((OR (NULL (STREAMP Stream))
		     (NOT (OPENP Stream)))
		(NC.PrintMsg NIL T (fetch (NoteFile FullFileName) of NoteFile)
			       " is not an open NoteFile!!!"
			       (CHARACTER 13)))
	      (T (COND
		   ((SETQ ActiveCards (NC.MapCards NoteFile (FUNCTION (LAMBDA (Card)
							   Card))
						       (FUNCTION NC.ActiveCardP)))
		     (COND
		       ((NC.AskYesOrNo (CONCAT "There are still active cards in NoteFile "
						   (fetch (NoteFile FullFileName) of NoteFile)
						   "."
						   (CHARACTER 13)
						   "Want to close and save them? ")
					 " -- "
					 (QUOTE Yes)
					 NIL
					 (NC.AttachPromptWindow (WFROMMENU (fetch (NoteFile
											  Menu)
										  of NoteFile)))
					 NIL NIL)
			 (NC.PrintMsg NIL T "Closing and saving active cards ... ")
			 (RESETLST (RESETSAVE NC.ForceSourcesFlg NIL)
				     (RESETSAVE NC.ForceFilingFlg NIL)
				     (RESETSAVE NC.ForceTitlesFlg NIL)
				     (for Card in ActiveCards bind Window
					do (NC.QuitCard Card T)
					     (if (SETQ Window (NC.FetchWindow Card))
						 then (bind (Process ←(WINDOWPROP Window
											(QUOTE
											  PROCESS)))
							   until (OR (NULL Process)
									 (PROCESS.FINISHEDP Process)
									 )
							   do (BLOCK)))))
			 (NC.PrintMsg NIL NIL "Done." (CHARACTER 13)))
		       (T (RETURN NIL)))))
		 (NC.PrintMsg NIL T "Closing Notefile ... " (CHARACTER 13))
		 (DEL.PROCESS (fetch (NoteFile CachingProcess) of NoteFile))
                                                             (* Delete the types and titles caching process if 
							     still alive.)
		 (NC.CheckpointDatabase NoteFile)
		 (SETQ FileName (fetch (NoteFile FullFileName) of NoteFile))

          (* * Set DatabaseStream GlobalVar to NIL so that the advise to CLOSEF will not refuse to close this file.)


		 (NC.ResetNoteFileInterface NoteFile)
		 (NC.ForceDatabaseClose NoteFile)
		 (NC.PrintMsg NIL T FileName " closed."))))))
)
(DECLARE: EVAL@COMPILE 
(PUTPROPS NC.ApplySupersFn MACRO (Args (BQUOTE (LET ((SuperType (fetch (Card SuperType)
								       of , (CADR Args))))
						    (APPLY* (NC.GetCardTypeField , (CAR Args)
										 SuperType)
							    ,@
							    (CDR Args))))))
)
(PUTPROPS RHTPATCH036 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (349 4073 (NC.CloseDatabaseFile 359 . 4071)))))
STOP