(FILECREATED "23-May-86 16:14:15" {QV}<notecards>1.3K>KIRKPATCH004.;1 4258   

      changes to:  (VARS KIRKPATCH004COMS hmmm)
		   (FNS NC.GetTitle NC.FetchMonitor NC.FormatUnavailableTitle))


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

(PRETTYCOMPRINT KIRKPATCH004COMS)

(RPAQQ KIRKPATCH004COMS ((* * changed from NCDATABASE Added checks to avoid break windows from 
			      attempts at cross-file links.)
			   (FNS NC.GetTitle NC.FetchMonitor)
			   (* * New Function for NCDATABASE)
			   (FNS NC.FormatUnavailableTitle)))
(* * changed from NCDATABASE Added checks to avoid break windows from attempts at cross-file 
links.)

(DEFINEQ

(NC.GetTitle
  (LAMBDA (Card OverrideStream)                              (* kirk: "23-May-86 12:57")
                                                             (* Retrieve title for card specified by Card from the 
							     database specified by DatabaseStream)

          (* * rht 1/31/85: Now reads pointers from index array rather than file.)



          (* * rht 7/9/85: Now gets date if notefile has newer data format.)



          (* * kirk 10/28/85 Now returns NIL if Status not ACTIVE)



          (* * fkr 10/29/85: Fixed to use new numeric ID format.)



          (* * rht 11/10/85 Updated to handle new Card scheme and NoteFile objects.)



          (* * fgh 11/20/85 Added call to NC.ReadCardPartHeader)



          (* * rht 1/23/86: Now takes optional OverrideStream arg. This, if given, overrides stream of card's notefile.)



          (* * rht 1/28/86: Now passes extra arg to NC.ReadCardPartHeader indicating that when we're overriding the notefile 
	  stream, you shouldn't force UIDs on stream and in card to match.)



          (* * kirk 23May86 Added checks to avoid break windows from attempts at cross-file links.)


    (LET (MonitorLock (NoteFile (fetch (Card NoteFile) of Card))
		      Stream Title)
         (COND
	   ((NULL NoteFile)
	     (NC.FormatUnavailableTitle Card))
	   ((NULL (SETQ MonitorLock (fetch (NoteFile MonitorLock) of NoteFile)))
	     (NC.FormatUnavailableTitle (OR (fetch (NoteFile FullFileName) of NoteFile)
						NoteFile)))
	   (T (WITH.MONITOR MonitorLock (if (EQ (fetch (Card Status) of Card)
						    (QUOTE ACTIVE))
					    then 

          (* * Only reposition the file if OverrideStream argument was NIL. Otherwise assume we're positioned within 
	  OverrideStream)


						   (if (STREAMP OverrideStream)
						       then (SETQ Stream OverrideStream)
						     else (SETQ Stream (
								NC.CoerceToNoteFileStream Card))
							    (SETFILEPTR Stream (fetch
									    (Card TitleLoc)
										    of Card)))
						   (NC.SetTitleDate Card (NC.ReadCardPartHeader
									Card NC.TitlesIdentifier 
									Stream (STREAMP 
										   OverrideStream)))
						   (NC.SetTitle Card (SETQ Title (NC.ReadTitle
								      Stream)))
						   Title)))))))

(NC.FetchMonitor
  (LAMBDA (NoteFile)                                         (* kirk: "23-May-86 12:53")

          (* * fetch the monitor lock from a NoteFile and make sure that it is okay.)



          (* * kirk 23May86 Added OPENP check)


    (LET ((MonitorLock (fetch (NoteFile MonitorLock) of NoteFile)))
         (COND
	   ((type? MONITORLOCK MonitorLock)
	     MonitorLock)
	   ((NOT (OPENP (fetch (NoteFile FullFileName) of NoteFile)))
	     (NC.PrintMsg NIL NIL (CHARACTER (CHARCODE EOL))
			    (fetch (NoteFile FullFileName) of NoteFile)
			    " is not open.")
	     (ERROR!))
	   (T (NC.ReportError "NC.FetchMonitor" (CONCAT "No monitorlock on NoteFile -- "
							    (fetch (NoteFile FullFileName)
							       of NoteFile))))))))
)
(* * New Function for NCDATABASE)

(DEFINEQ

(NC.FormatUnavailableTitle
  (LAMBDA (Msg)                                              (* kirk: "23-May-86 12:55")
    (CONCAT "-> " Msg " <-")))
)
(PUTPROPS KIRKPATCH004 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (671 3964 (NC.GetTitle 681 . 3123) (NC.FetchMonitor 3125 . 3962)) (4005 4175 (
NC.FormatUnavailableTitle 4015 . 4173)))))
STOP