(FILECREATED " 5-Sep-86 19:38:42" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH101.;1 5567   

      changes to:  (VARS RHTPATCH101COMS))


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

(PRETTYCOMPRINT RHTPATCH101COMS)

(RPAQQ RHTPATCH101COMS ((* * Change to NCDATABASE)
			  (FNS NC.CreateNoteFile)))
(* * Change to NCDATABASE)

(DEFINEQ

(NC.CreateNoteFile
  (LAMBDA (NoteFileOrFileName SizeInCards Don'tCreateSpecialCards InterestedWindow OperationMsg 
			      QuietFlg PublicOrPrivate)      (* rht: " 5-Sep-86 19:32")

          (* * Create a NoteFile. Most of the work should be done by the device specific create notefile fn.)



          (* * fgh 9/1/86 First created.)



          (* * fgh&rht 9/5/86: Now creates small temporary hash array.)


    (LET (NoteFile NoteFileName)

          (* * Get the name from the user if necessary.)


         (SETQ NoteFileName (if (type? NoteFile NoteFileOrFileName)
				  then (fetch (NoteFile FullFileName) of NoteFileOrFileName)
				else (OR NoteFileOrFileName (NC.DatabaseFileName 
						    "What is the name of the file to be created?"
										       " -- " T T NIL 
										 InterestedWindow))))
         (if (NULL NoteFileName)
	     then (QUOTE CreateCancelled)
	   else 

          (* * Create a NoteFile object with a UID, etc.)


		  (SETQ NoteFile (if (type? NoteFile NoteFileOrFileName)
				       then NoteFileOrFileName
				     else (OR (NC.NoteFileFromFileName NoteFileName)
						  (create NoteFile))))
		  (replace (NoteFile UID) of NoteFile with (NC.MakeUID))
		  (replace (NoteFile MonitorLock) of NoteFile with (CREATE.MONITORLOCK
									   (QUOTE 
									       Creating% NoteFile)))
		  (replace (NoteFile FullFileName) of NoteFile with NoteFileName)
		  (replace (NoteFile ReadOnlyFlg) of NoteFile with NIL) 

          (* * only a small hash array for creating a file.)


		  (replace (NoteFile HashArray) of NoteFile
		     with (NC.CreateUIDHashArray (CONSTANT (LENGTH (RECORDFIELDNAMES
									     (QUOTE 
									     NoteFileCriticalUIDs)))))
			     )

          (* * Install the appropriate device vector)


		  (NC.InstallDeviceVectorInNoteFile NoteFile PublicOrPrivate) 

          (* * Say something to the user.)


		  (OR QuietFlg (NC.PrintMsg InterestedWindow T (OR OperationMsg "")
						"Creating NoteFile " NoteFileName 
						".  Please wait...  "))

          (* * Call the device specific create notefile fn.)


		  (if (type? NoteFile (SETQ ReturnValue
				   (CAR (ERSETQ (APPLY* (fetch (NoteFile CreateNoteFileFn)
								 of NoteFile)
							      NoteFile SizeInCards InterestedWindow 
							      OperationMsg QuietFlg)))))
		      then 

          (* * Device specific Create NoteFile fn returned okay. Go an an create the special cards.)


			     (if Don'tCreateSpecialCards
			       else (replace (NoteFile NextIndexNum) of NoteFile with 1)
				      (NC.InitializeSpecialCards NoteFile))

          (* * Checkpoint the NF, then close it and return the NF objet.)


			     (NC.CheckpointNoteFile NoteFile QuietFlg T T T InterestedWindow 
						      OperationMsg)
			     (if (type? NoteFile (SETQ ReturnValue
					      (CAR (ERSETQ (APPLY* (fetch (NoteFile 
										  CloseNoteFileFn)
									    of NoteFile)
									 NoteFile SizeInCards 
									 InterestedWindow 
									 OperationMsg QuietFlg)))))
				 then                      (* Close went okay.)
					(if (NULL QuietFlg)
					    then (NC.PrintMsg InterestedWindow NIL "Done!"
								  (CHARACTER 13))
						   (NC.ClearMsg InterestedWindow T))
                                                             (* Clean out the NF object and "notice it".)
					(create NoteFile smashing NoteFile UID ←(fetch
									(NoteFile UID) of NoteFile)
								      FullFileName ←(fetch
									(NoteFile FullFileName)
										       of NoteFile)
								      Menu ←(fetch (NoteFile Menu)
									       of NoteFile)
								      NoteFileDevice ←(fetch
									(NoteFile NoteFileDevice)
											 of 
											 NoteFile))
					(NC.StoreNoteFileInHashArray NoteFile NC.NoteFilesHashArray)
                                                             (* Set the DatabaseFileNameSuggestion)
					(SETQ NC.DatabaseFileNameSuggestion
					  (PACKFILENAME (QUOTE VERSION)
							  NIL
							  (QUOTE BODY)
							  (fetch (NoteFile FullFileName)
							     of NoteFile)))
                                                             (* Return the NoteFile.)
					NoteFile
			       else                        (* Problems with closing the NoteFile -- error)
				      (NC.ReportError "NC.CreateNoteFile" (CONCAT 
				       "Could not close nortefile after it was created because: "
										      ReturnValue))
				      ReturnValue)
		    else 

          (* * There was an error in the device specific create notefile fn.)


			   (NC.ReportError "NC.CreateNoteFile" (CONCAT 
							      "Could not create NoteFile due to "
									   ReturnValue " error."))
			   ReturnValue)))))
)
(PUTPROPS RHTPATCH101 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (354 5485 (NC.CreateNoteFile 364 . 5483)))))
STOP