(FILECREATED " 2-May-87 18:01:36" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH253.;1 5960 changes to: (VARS RHTPATCH253COMS)) (* Copyright (c) 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH253COMS) (RPAQQ RHTPATCH253COMS ((DECLARE: FIRST (P (NC.LoadFileFromDirectories (QUOTE NCCOMPACT)))) (* * Changes NC.InstallCardInNoteFile so that it breaks if encounters two cards with same UID. Also minor fixes to compact in place.) (* * Changes to NCCOMPACT) (FNS NC.CopySortedCardPart NC.UpdateCardLoc NC.CopySortedCardPartInPlace) (* * Changes to NCDATABASE) (FNS NC.InstallCardInNoteFile))) (DECLARE: FIRST (NC.LoadFileFromDirectories (QUOTE NCCOMPACT)) ) (* * Changes NC.InstallCardInNoteFile so that it breaks if encounters two cards with same UID. Also minor fixes to compact in place.) (* * Changes to NCCOMPACT) (DEFINEQ (NC.CopySortedCardPart (LAMBDA (SortingRecord ToNoteFile InterestedWindow) (* rht: " 1-May-87 14:46") (* * Copy some portion of a card; title, links, substance, proplist, to ptr in Stream and update index accordingly.) (* * fkr 11/8/85: No longer worries about link labels part. Also updated to hadle new CradID and NoteFileobject.) (* * kirk 23Nov85: restructured to reduce redundant code) (* * rht 1/22/87: Added InterestedWindow arg.) (* * rht 5/1/87: Changed mention of FromNoteFile to ToNoteFile.) (WITH.MONITOR (NC.FetchMonitor ToNoteFile) (LET ((FromPtr (fetch (SortingRecord FileLoc) of SortingRecord)) (Card (fetch (SortingRecord Card) of SortingRecord)) (CardPartTypeNum (fetch (SortingRecord CardPartTypeNum) of SortingRecord)) (ToStream (fetch (NoteFile Stream) of ToNoteFile)) ToPtr) (SETQ ToPtr (GETFILEPTR ToStream)) (if (NC.CopyCardPart (fetch (NoteFile Stream) of (fetch (Card NoteFile) of Card)) ToStream FromPtr ToPtr InterestedWindow) then (NC.UpdateCardLoc Card CardPartTypeNum ToPtr)))))) (NC.UpdateCardLoc (LAMBDA (Card CardPartTypeNum ToPtr) (* rht: " 2-May-87 16:34") (* * rht 5/2/87: Now returns NIL if bad notefile.) (SELECTQ CardPartTypeNum (0 (replace (Card MainLoc) of Card with ToPtr)) (1 (replace (Card LinksLoc) of Card with ToPtr)) (2 (replace (Card TitleLoc) of Card with ToPtr)) (3 (replace (Card PropListLoc) of Card with ToPtr)) (PROGN (FLASHW PROMPTWINDOW) (NC.PrintMsg NIL T "Bad NoteFile. Please Inspect and Repair." (CHARACTER 13)) NIL)))) (NC.CopySortedCardPartInPlace (LAMBDA (SortingRecord BufferStream ToPtr EOFBufferLoc InterestedWindow) (* rht: " 2-May-87 16:36") (* * Copy some portion of a card; title, links, substance, proplist, to ptr in Stream and update index accordingly.) (* * fkr 11/8/85: No longer worries about link labels part. Also updated to hadle new CradID and NoteFileobject.) (* * kirk 23Nov85: added ToNoteFile parameter and restructured to reduce redundant code and to blindly COPYBYTES) (* * rht 1/22/87: Now properly handles case when NC.CopyCardPart returns NIL. This function no longer called under NC.ExpandIndexInPlace. Added InterestedWindow arg.) (* * rht 5/2/87: Now returns nil if last call to NC.UpdateCardLoc fails.) (LET ((FromPtr (fetch (SortingRecord FileLoc) of SortingRecord)) (Card (fetch (SortingRecord Card) of SortingRecord)) (CardPartTypeNum (fetch (SortingRecord CardPartTypeNum) of SortingRecord)) NoteFile) (if (EQUAL ToPtr FromPtr) then (PLUS ToPtr (NC.GetCardPartLength Card FromPtr)) else (WITH.MONITOR (NC.FetchMonitor (SETQ NoteFile (fetch (Card NoteFile) of Card))) (LET ((Stream (fetch (NoteFile Stream) of NoteFile)) EndPtr Length) (* * Copy the substance out to the {NODIRCORE} stream.) (SETQ Length (NC.CopyCardPart Stream BufferStream FromPtr 0 InterestedWindow)) (* * Copy to end of file if needed for safety. That way, if we crash during second copy, all nearby card parts are still okay.) (SETQ EndPtr (PLUS ToPtr Length)) (if (OR (GEQ FromPtr EndPtr) (AND (NC.CopyCardPart BufferStream Stream 0 EOFBufferLoc InterestedWindow) (NC.UpdateCardLoc Card CardPartTypeNum EOFBufferLoc))) then (* * Now copy to its proper home.) (AND (NC.CopyCardPart BufferStream Stream 0 ToPtr InterestedWindow) (NC.UpdateCardLoc Card CardPartTypeNum ToPtr) EndPtr)))))))) ) (* * Changes to NCDATABASE) (DEFINEQ (NC.InstallCardInNoteFile (LAMBDA (Card NoteFile) (* rht: " 2-May-87 17:15") (* * Put Card into NoteFile's hash array.) (* * rht 5/2/87: Now dies if there's already a card in the hash array having same UID.) (LET ((OtherCard (NC.CardFromUID (fetch (Card UID) of Card) NoteFile))) (if OtherCard then (SHOULDNT "Two cards in notefile with same UID. Please notify the nearest NoteCards guru.") else (PUTHASH (fetch (Card UID) of Card) Card (fetch (NoteFile HashArray) of NoteFile)) Card)))) ) (PUTPROPS RHTPATCH253 COPYRIGHT ("Xerox Corporation" 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (901 5159 (NC.CopySortedCardPart 911 . 2166) (NC.UpdateCardLoc 2168 . 2811) ( NC.CopySortedCardPartInPlace 2813 . 5157)) (5194 5878 (NC.InstallCardInNoteFile 5204 . 5876))))) STOP