(FILECREATED "25-Jul-86 16:50:53" {QV}<NOTECARDS>1.3K>KIRKPATCH021.;2 3531 changes to: (FNS NC.GetNewCard) (VARS KIRKPATCH021COMS) previous date: "25-Jul-86 15:52:11" {QV}<NOTECARDS>1.3K>KIRKPATCH021.;1) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT KIRKPATCH021COMS) (RPAQQ KIRKPATCH021COMS ((* * change to NCDATABASE fn fixing bugs at card slot overflow time) (FNS NC.GetNewCard))) (* * change to NCDATABASE fn fixing bugs at card slot overflow time) (DEFINEQ (NC.GetNewCard (LAMBDA (NoteFile DontUpdateFlg OptionalUID) (* kirk: "25-Jul-86 16:37") (* * rht 1/9/85: Keep track of the total number of cards in NC.UncachingNotCompleted.) (* * rht 1/31/85: Increases array size if needed. Also now stores highest ID number in a global var and only writes to the file at checkpoint time.) (* * rht 2/1/85: Now warn user if within 90% of index full. Also if index array is full, then increase its size.) (* * fgh 10/15/85 increase cache arry size when necessary) (* * rht 11/12/85: Updated to handle NoteFile format.) (* * rht 12/6/85: Fixed to reuse free index num if any. Find these on IndexNumsFreeList.) (* * rht 12/7/85: Added OptionalUID argument, so can build new card but assign it a given UID.) (* * kirk 7/25/85: Fixed overflow check to catch GEQ , gave warning message a window to show message , changed warning message and changed break call to ERROR!) (LET ((Stream (fetch (NoteFile Stream) of NoteFile)) (NextIndexNum (fetch (NoteFile NextIndexNum) of NoteFile)) (IndexSize (fetch (NoteFile HashArraySize) of NoteFile)) (IndexNumsFreeList (fetch (NoteFile IndexNumsFreeList) of NoteFile)) IndexNum Card PercentUsed) (if IndexNumsFreeList then (SETQ IndexNum (pop IndexNumsFreeList)) (replace (NoteFile IndexNumsFreeList) of NoteFile with IndexNumsFreeList) else (SETQ IndexNum NextIndexNum) (replace (NoteFile NextIndexNum) of NoteFile with (ADD1 NextIndexNum))) (if (GREATERP (SETQ PercentUsed (FIX (TIMES 100 (QUOTIENT (FLOAT NextIndexNum) (FLOAT IndexSize))))) 90) then (if (GREATERP NextIndexNum IndexSize) then (NC.PrintMsg (WFROMMENU (fetch (NoteFile Menu) of NoteFile)) T "Card slots for " (fetch (NoteFile FullFileName) of NoteFile) " are full." (CHARACTER 13) "You must compact the NoteFile now to get more.") (ERROR!) else (NC.PrintMsg (WFROMMENU (fetch (NoteFile Menu) of NoteFile)) T "Card slots for " (fetch (NoteFile FullFileName) of NoteFile) " are " PercentUsed "%% full." (CHARACTER 13) "Please compact the NoteFile soon."))) (SETQ Card (create Card UID ← (if (type? UID OptionalUID) then OptionalUID else (NC.MakeUID)) NoteFile ← NoteFile IndexLoc ← (NC.NoteFileLocFromIndexNum IndexNum) IndexDirtyFlg ← T)) (NC.InstallCardInNoteFile Card NoteFile) Card))) ) (PUTPROPS KIRKPATCH021 COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (538 3448 (NC.GetNewCard 548 . 3446))))) STOP