(FILECREATED "15-Jul-87 18:52:35" {QV}<NOTECARDS>1.3KNEXT>RGPATCH054.;1 3768   

      changes to:  (VARS RGPATCH054COMS)
		   (FNS NC.DelFromLink))


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

(PRETTYCOMPRINT RGPATCH054COMS)

(RPAQQ RGPATCH054COMS ((* * rg&rt 7/15/87 fixes bug that caused cards filed in Orphans box to have 
			    falh links)
			 (* * changes to NCLINKS)
			 (FNS NC.AddFromLink NC.DelFromLink)))
(* * rg&rt 7/15/87 fixes bug that caused cards filed in Orphans box to have falh links)

(* * changes to NCLINKS)

(DEFINEQ

(NC.AddFromLink
  [LAMBDA (Link)                                             (* Randy.Gobbel "15-Jul-87 17:54")

          (* * Add Link to the FromLinks of the appropraite card on DatbaseStream)



          (* * kirk: 14Nov85: deleted use of of DatabaseStream)



          (* * rht 2/14/86: Now calls NC.UncacheLinks instead of two calls to NC.SetToLinks and NC.SetFromLinks.)



          (* * kef 7/22/86: Now only calls NC.PutFromLinks instead of NC.PutLinks because we can't be certain of owning the 
	  write locks on all of the Link parts.)



          (* * rg 5/15/87 now calls NC.LinksCachedP instead of NC.ActiveCardP)


    (LET ((Card (fetch (Link DestinationCard) of Link)))
         [COND
	   ((NC.LinksCachedP Card)
	     (NC.SetFromLinks Card (CONS Link (NC.FetchFromLinks Card)))
	     (NC.SetLinksDirtyFlg Card T))
	   (T (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile) of Card))
			    (NC.GetLinks Card)
			    (NC.SetFromLinks Card (CONS Link (NC.FetchFromLinks Card)))
			    (NC.PutFromLinks Card)
			    (NC.UncacheLinks Card]
     Link])

(NC.DelFromLink
  [LAMBDA (Link NoOrphanHookFlg)                             (* Randy.Gobbel "15-Jul-87 18:21")

          (* * Delete a FromLink from its destination card Hook card to orphan if this is the last link.)



          (* * rht 11/15/84: Changed decision as to when to orphanize a card. Now must have deleted its last link 
	  (not just last subbox or filedcard link). Also checks that link doesn't point from card to itself.)



          (* * rht 12/1/84: Now doesn't do any work unless ID is valid, i.e. not DELETED or FREE.)



          (* * kirk: 13Nov85: deleted of use of DatabaseStream and changed to call CachedDelFromLink.)



          (* * kirk 29Jan86 Changed to a direct recursive call eliminating CachedDelFromLink. Added NC.FileInOrphanBox.)



          (* * rht 2/14/86: Now calls NC.UncacheLinks instead of two calls to NC.SetToLinks and NC.SetFromLinks.)



          (* * kef 7/30/86: Modified so that it only puts the FROMLINKS in the case of an inactiveP card.)



          (* * rg 5/8/87 check for active card should have been check for links cached ; fixed)



          (* * rg 7/15/87 now waits to call NC.PutFromLinks until after NC.FileInOrphanBox)


    (LET ((DestinationCard (fetch (Link DestinationCard) of Link)))
         (COND
	   ((NC.ValidCardP DestinationCard)
	     (COND
	       ((NC.LinksCachedP DestinationCard)
		 (NC.CachedDelFromLink Link DestinationCard)
		 (OR NoOrphanHookFlg (NC.FileInOrphanBox Link DestinationCard)))
	       (T (WITH.MONITOR (NC.FetchMonitor (fetch (Card NoteFile) of DestinationCard))
				(NC.GetLinks DestinationCard)
				(NC.CachedDelFromLink Link DestinationCard)
				(OR NoOrphanHookFlg (NC.FileInOrphanBox Link DestinationCard))
				(NC.PutFromLinks DestinationCard)
				(NC.UncacheLinks DestinationCard))
		  Link])
)
(PUTPROPS RGPATCH054 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (576 3687 (NC.AddFromLink 586 . 1757) (NC.DelFromLink 1759 . 3685)))))
STOP