(FILECREATED "14-Nov-86 22:31:05" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH154.;1 7154 changes to: (VARS RHTPATCH154COMS) (FNS NC.SmartDeleteLinks)) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH154COMS) (RPAQQ RHTPATCH154COMS ((* * Yet another fix to make card deletion not try to read card substance) (* * Change to NCLINKS) (FNS NC.SmartDeleteLinks))) (* * Yet another fix to make card deletion not try to read card substance) (* * Change to NCLINKS) (DEFINEQ (NC.SmartDeleteLinks (LAMBDA (ListOfLinks QuietFlg InterestedWindow Don'tPutToBeDeletedCardsFlg) (* rht: "14-Nov-86 22:28") (* * Delete a bunch of links efficiently. Sort so that links with same source bunch together. This way, only read and write each source card once. If a card has the AboutToBeDeletedFlg UID prop set and Don'tPutToBeDeletedCardsFlg is non-nil, then don't put it down to the file even if changes were made. Just throw away its cache.) (* * rht 10/17/86: Now passes non-nil NoOrphanHookFlg to NC.DeleteLink unless destination card is marked as about to be deleted.) (* * rht 11/4/86: Now takes Don'tCreateDeletedImageObjFlg arg.) (* * rht 11/13/86: Undid change of 11/4/86. Now passes non-nil Don'tDelLinkIconFlg to NC.DeleteLink instead like it used to.) (* * rht 11/14/86: Avoids call to NC.GetNoteCard for cards about to be deleted.) (LET (DestCardsw/oLinksCached NumLinksToDelete) (* * For each destination card, make sure its links are cached. At the same time, collect these cards for future uncaching.) (SETQ DestCardsw/oLinksCached (for Link in ListOfLinks bind DestCard when (NOT (NC.LinksCachedP (SETQ DestCard (fetch (Link DestinationCard) of Link)))) collect (NC.GetLinks DestCard) DestCard)) (* * Sort the List of links so that links with same source cards bunch together.) (OR QuietFlg (NC.PrintMsg InterestedWindow T "Sorting " (SETQ NumLinksToDelete (LENGTH ListOfLinks)) " links prior to deletion.")) (SORT ListOfLinks (FUNCTION (LAMBDA (Link1 Link2) (LESSP (fetch (Card IndexLoc) of (fetch (Link SourceCard) of Link1)) (fetch (Card IndexLoc) of (fetch (Link SourceCard) of Link2))))) ) (* * Now bring up source cards one at a time and do the delete of the links.) (OR QuietFlg (NC.PrintMsg InterestedWindow T "Deleting links: 1 out of " NumLinksToDelete " ...")) (for Link in ListOfLinks as i from 1 bind PreviousSourceCard WasNotActiveFlg SavedFromLinks HadLinksCachedFlg eachtime (BLOCK) when (NC.ValidLinkP Link) do (OR QuietFlg (if (ZEROP (REMAINDER i 10)) then (NC.PrintMsg InterestedWindow T "Deleting links: " i " out of " NumLinksToDelete " ..."))) (LET ((SourceCard (fetch (Link SourceCard) of Link))) (if (NOT (NC.SameCardP SourceCard PreviousSourceCard)) then (* Write down changes to previous card's substance.) (if WasNotActiveFlg then (* Have to call NC.CardSaveFn first and then NC.QuitCard with Don'tSaveFlg to avoid insureProperFiling check.) (if (AND Don'tPutToBeDeletedCardsFlg (NC.UIDGetProp (fetch (Card UID) of PreviousSourceCard) (QUOTE AboutToBeDeletedFlg))) then (* Throw away cache if card about to be deleted.) (NC.DeactivateCard PreviousSourceCard) else (NC.CardSaveFn PreviousSourceCard T) (NC.QuitCard PreviousSourceCard NIL T NIL NIL NIL NIL T)) (* Recache links for previous card if they were cached before.) (if HadLinksCachedFlg then (NC.GetLinks PreviousSourceCard))) (* Cache card and overwrite from links with previously cached ones.) (if (AND (SETQ WasNotActiveFlg (NOT (NC.ActiveCardP SourceCard))) (NOT (NC.UIDGetProp (fetch (Card UID) of SourceCard) (QUOTE AboutToBeDeletedFlg)))) then (* Save cached from links for this card.) (SETQ SavedFromLinks (if (SETQ HadLinksCachedFlg (NC.LinksCachedP SourceCard)) then (NC.FetchFromLinks SourceCard))) (NC.GetNoteCard SourceCard) (if HadLinksCachedFlg then (NC.SetFromLinks SourceCard SavedFromLinks))) ) (NC.DeleteLink Link (NC.UIDGetProp (fetch (Card UID) of (fetch (Link DestinationCard) of Link)) (QUOTE AboutToBeDeletedFlg)) (NC.UIDGetProp (fetch (Card UID) of (fetch (Link SourceCard) of Link)) (QUOTE AboutToBeDeletedFlg))) (SETQ PreviousSourceCard SourceCard)) finally (if (AND WasNotActiveFlg (NC.ValidCardP PreviousSourceCard)) then (* Have to call NC.CardSaveFn first and then NC.QuitCard with Don'tSaveFlg to avoid insureProperFiling check.) (if (AND Don'tPutToBeDeletedCardsFlg (NC.UIDGetProp (fetch (Card UID) of PreviousSourceCard) (QUOTE AboutToBeDeletedFlg))) then (* Throw away cache if card about to be deleted.) (NC.DeactivateCard PreviousSourceCard) else (NC.CardSaveFn PreviousSourceCard T) (NC.QuitCard PreviousSourceCard NIL T NIL NIL NIL NIL T)) (* Recache links for previous card if they were cached before.) (if HadLinksCachedFlg then (NC.GetLinks PreviousSourceCard)))) (* * Finally, write down links for cards whose links have changed and whose links weren't cached when this function was called.) (for DestCard in DestCardsw/oLinksCached eachtime (BLOCK) when ( NC.FetchLinksDirtyFlg DestCard) do (NC.PutLinks DestCard)) (OR QuietFlg (NC.ClearMsg InterestedWindow T))))) ) (PUTPROPS RHTPATCH154 COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (542 7072 (NC.SmartDeleteLinks 552 . 7070))))) STOP