(FILECREATED " 1-Jul-87 10:26:35" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH282.;1 11107  

      changes to:  (VARS RHTPATCH282COMS)
		   (FNS NC.PutLinks NC.PutPropList NC.PutTitle))


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

(PRETTYCOMPRINT RHTPATCH282COMS)

(RPAQQ RHTPATCH282COMS ((* * Fixes bug reported by Peggy whereby copying a new card caused it to be 
			     trashed.)
			  (* * Changes to NCDATABASE)
			  (FNS NC.PutLinks NC.PutPropList NC.PutTitle)))
(* * Fixes bug reported by Peggy whereby copying a new card caused it to be trashed.)

(* * Changes to NCDATABASE)

(DEFINEQ

(NC.PutLinks
  (LAMBDA (Card UseOldDateFlg OverrideStream)                (* rht: " 1-Jul-87 10:23")

          (* * Put the link data for ID onto the database file.)



          (* * rht 1/30/85: Changed to use index array instead of file.)



          (* * rht 7/9/85: Now puts out date after identifier. If UseOldDateFlg is non-nil, then use old date, otherwise use 
	  current date.)



          (* * rht 11/10/85: Updated to handle NoteFile and CardID scheme.)



          (* * fgh 11/20/85 Added call to NC.WriteCardPartHeader and the mechanism to write the start and end pointers of the
	  substance before calling the card type's putfn.)



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



          (* * kef 7/16/86: Makes use of the NoteFile device vector PutCardPartFn.)



          (* * fgh 8/31/86 Adapated to use NC.DoCardPartFn.)



          (* * pmi 11/4/86 Reinstated Randy's change (1/23/86) which somehow got lost.)



          (* * rht 11/14/86: Now makes sure hung var PutSuccessfulLoc is NIL if we were passed an OverrideStream.)



          (* * rht 7/1/87: Now only turns off dirty flg if no OverrideStream.)

                                                             (* Check to make sure this is an active note card.)
    (DECLARE (GLOBALVARS NC.LinksIdentifier))
    (AND (NEQ (fetch (Card Status) of Card)
		  (QUOTE ACTIVE))
	   (NC.ReportError "NC.PutLinks" (CONCAT (NC.FetchTitle Card)
						     " is not an active note card.")))
    (LET (PutSuccessfulLoc)
         (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile) of Card))
		       (NC.DoCardPartFn Put Card (QUOTE LINKS)
					(LET ((Stream (OR (STREAMP OverrideStream)
							    (NC.CoerceToNoteFileStream Card)))
					      StartLoc EndLoc)

          (* * Write the links data at the end of the database file.)


					     (SETQ StartLoc (GETFILEPTR Stream))
					     (NC.WriteCardPartHeader Card NC.LinksIdentifier
								       (COND
									 (UseOldDateFlg (
										NC.FetchLinksDate
											  Card))
									 (T (NC.SetLinksDate
									      Card
									      (DATE))))
								       Stream)
					     (NC.WriteListOfLinks Stream (NC.FetchToLinks Card))
					     (NC.WriteListOfLinks Stream (NC.FetchFromLinks
								      Card))
					     (NC.WriteListOfLinks Stream (NC.FetchGlobalLinks
								      Card))

          (* * Update the length field at the beginning of the card info)


					     (SETQ EndLoc (GETFILEPTR Stream))
					     (SETFILEPTR Stream StartLoc)
					     (NC.WritePtr Stream (DIFFERENCE EndLoc StartLoc)
							  3)
					     (SETFILEPTR Stream EndLoc)

          (* * Now update the index to point to the link data just written. Done last in case writing of links doesn't 
	  complete okay.)


					     (OR OverrideStream (NC.SetLinksDirtyFlg Card))

          (* * Now, since we were successful, we'll bind the PutSuccessfulLoc variable, which will be used freely by the 
	  AFTER PutCardPartFns to determine first if the Put succeeded, and if so, where in the stream it was Put.)



          (* * Don't put a reasonable value in the hung variable PutSuccessfulLoc if we were passed OverrideStream.)


					     (SETQ PutSuccessfulLoc
					       (if OverrideStream
						   then NIL
						 else StartLoc))
					 Card))))))

(NC.PutPropList
  (LAMBDA (Card UseOldDateFlg OverrideStream)                (* rht: " 1-Jul-87 10:23")

          (* * Put the prop list for ID onto the database file.)



          (* * rht 1/30/85: Changed to use index array instead of file.)



          (* * rht 7/9/85: Now puts out date after identifier. If UseOldDateFlg is non-nil, then use old date, otherwise use 
	  current date.)



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



          (* * fgh 11/20/85 Added call to NC.WriteCardPartHeader and the mechanism to write the start and end pointers of the
	  substance before calling the card type's putfn.)



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



          (* * kef 7/16/86: Makes use of the NoteFile device vector PutCardPartFn.)



          (* * fgh 8/31/86 Adapted to use NC.DoCardPartFn.)



          (* * pmi 11/4/86 Reinstated Randy's change (1/23/86) which somehow got lost.)



          (* * rht 11/14/86: Now makes sure hung var PutSuccessfulLoc is NIL if we were passed an OverrideStream.)



          (* * rht 7/1/87: Now only turns off dirty flg if no OverrideStream.)

                                                             (* Check to make sure this is an active note card.)
    (DECLARE (GLOBALVARS NC.PropsIdentifier))
    (AND (NEQ (fetch (Card Status) of Card)
		  (QUOTE ACTIVE))
	   (NC.ReportError "NC.PutPropList" (CONCAT (NC.FetchTitle Card)
							" is not an active note card.")))
    (LET (PutSuccessfulLoc)
         (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile) of Card))
		       (NC.DoCardPartFn Put Card (QUOTE PROPLIST)
					(LET ((Stream (OR (STREAMP OverrideStream)
							    (NC.CoerceToNoteFileStream Card)))
					      StartLoc EndLoc)

          (* * Write the proplist at the end of the database file.)


					     (SETQ StartLoc (GETFILEPTR Stream))
					     (NC.WriteCardPartHeader Card NC.PropsIdentifier
								       (COND
									 (UseOldDateFlg (
									     NC.FetchPropListDate
											  Card))
									 (T (NC.SetPropListDate
									      Card
									      (DATE))))
								       Stream)
					     (NC.WritePropList Stream (NC.FetchPropList Card))

          (* * Update the length field at the beginning of the card info)


					     (SETQ EndLoc (GETFILEPTR Stream))
					     (SETFILEPTR Stream StartLoc)
					     (NC.WritePtr Stream (DIFFERENCE EndLoc StartLoc)
							  3)
					     (SETFILEPTR Stream EndLoc)

          (* * Now update the index to point to the proplist just written. Done last in case writing of proplist doesn't 
	  complete okay.)


					     (OR OverrideStream (NC.SetPropListDirtyFlg Card))

          (* * Now, since we were successful, we'll bind the PutSuccessfulLoc variable, which will be used freely by the 
	  AFTER PutCardPartFns to determine first if the Put succeeded, and if so, where in the stream it was Put.)



          (* * Don't put a reasonable value in the hung variable PutSuccessfulLoc if we were passed OverrideStream.)


					     (SETQ PutSuccessfulLoc
					       (if OverrideStream
						   then NIL
						 else StartLoc))
					 Card))))))

(NC.PutTitle
  (LAMBDA (Card UseOldDateFlg OverrideStream)                (* rht: " 1-Jul-87 10:23")

          (* * Put the title of card ID onto DatabaseStream)



          (* * rht 7/9/85: Now puts out date after identifier. If UseOldDateFlg is non-nil, then use old date, otherwise use 
	  current date.)



          (* * rht 11/10/85: Updated to handle NoteFile and CardID scheme.)



          (* * fgh 11/20/85 Added call to NC.WriteCardPartHeader and the mechanism to write the start and end pointers of the
	  substance before calling the card type's putfn.)



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



          (* * kef 7/16/86: Makes use of the NoteFile device vector PutCardPartFn.)



          (* * fgh 8/31/86 Adpated to use NC.DoCardPartFn.)



          (* * pmi 11/4/86 Reinstated Randy's change (1/23/86) which somehow got lost.)



          (* * rht 11/14/86: Now makes sure hung var PutSuccessfulLoc is NIL if we were passed an OverrideStream.)



          (* * rht 7/1/87: Now only turns off dirty flg if no OverrideStream.)

                                                             (* Check to make sure this is an active note card.)
    (DECLARE (GLOBALVARS NC.TitlesIdentifier))
    (AND (NEQ (fetch (Card Status) of Card)
		  (QUOTE ACTIVE))
	   (NC.ReportError "NC.PutTitle" (CONCAT (NC.FetchTitle Card)
						     " is not an active note card.")))
    (LET (PutSuccessfulLoc)
         (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile) of Card))
		       (NC.DoCardPartFn Put Card (QUOTE TITLE)
					(LET ((Stream (OR (STREAMP OverrideStream)
							    (NC.CoerceToNoteFileStream Card)))
					      StartLoc EndLoc)

          (* * First write out the title.)


					     (SETQ StartLoc (GETFILEPTR Stream))
					     (NC.WriteCardPartHeader Card NC.TitlesIdentifier
								       (COND
									 (UseOldDateFlg (
										NC.FetchTitleDate
											  Card))
									 (T (NC.SetTitleDate
									      Card
									      (DATE))))
								       Stream)
					     (NC.WriteTitle Stream (NC.FetchTitle Card))

          (* * Update the length field at the beginning of the card info)


					     (SETQ EndLoc (GETFILEPTR Stream))
					     (SETFILEPTR Stream StartLoc)
					     (NC.WritePtr Stream (DIFFERENCE EndLoc StartLoc)
							  3)
					     (SETFILEPTR Stream EndLoc)

          (* * Now update the Index to reflect the new data just written. Done last in case the substance putting bombed for 
	  some reason.)


					     (OR OverrideStream (NC.SetTitleDirtyFlg Card))

          (* * Now, since we were successful, we'll bind the PutSuccessfulLoc variable, which will be used freely by the 
	  AFTER PutCardPartFns to determine first if the Put succeeded, and if so, where in the stream it was Put.)



          (* * Don't put a reasonable value in the hung variable PutSuccessfulLoc if we were passed OverrideStream.)


					     (SETQ PutSuccessfulLoc
					       (if OverrideStream
						   then NIL
						 else StartLoc))
					 Card))))))
)
(PUTPROPS RHTPATCH282 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (619 11025 (NC.PutLinks 629 . 4242) (NC.PutPropList 4244 . 7696) (NC.PutTitle 7698 . 
11023)))))
STOP