(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP")
(FILECREATED "22-Jun-88 12:42:00" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH098.;4 5340   

      changes to%:  (FNS NC.PointerIconGetFn NC.ReadPointer NC.PointerIconPutFn 
                         NC.PointerIconDisplayFn NC.PointerIconImageBoxFn)
                    (VARS PMIPATCH098COMS)

      previous date%: "17-Jun-88 18:00:40" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH098.;1)


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

(PRETTYCOMPRINT PMIPATCH098COMS)

(RPAQQ PMIPATCH098COMS (

(* ;;; "pmi 6/21/88: This fixes a problem with writing a pointer icon to a file after its destination card has been deleted.  The pointer icon put fn now smashes such a pointer into a deleted image object.  Also, because the pointer image object get fn has already been written to the file by the time we get a chance to smash it, the object will be read back in as a pointer object. Now the pointer get fn and NC.ReadPointer are smarter about detecting when a deleted image object is really the thing being read.")

                        (DECLARE%: DONTCOPY (PROPS (PMIPATCH098 MAKEFILE-ENVIRONMENT)
                                                   (PMIPATCH098 FILETYPE)))
                        
          
          (* ;; "Changed in NCLINKS")

                        (FNS NC.PointerIconPutFn NC.PointerIconGetFn NC.ReadPointer)))



(* ;;; 
"pmi 6/21/88: This fixes a problem with writing a pointer icon to a file after its destination card has been deleted.  The pointer icon put fn now smashes such a pointer into a deleted image object.  Also, because the pointer image object get fn has already been written to the file by the time we get a chance to smash it, the object will be read back in as a pointer object. Now the pointer get fn and NC.ReadPointer are smarter about detecting when a deleted image object is really the thing being read."
)

(DECLARE%: DONTCOPY 

(PUTPROPS PMIPATCH098 MAKEFILE-ENVIRONMENT (:PACKAGE "INTERLISP" :READTABLE "INTERLISP"))

(PUTPROPS PMIPATCH098 FILETYPE :BCOMPL)
)



(* ;; "Changed in NCLINKS")

(DEFINEQ

(NC.PointerIconPutFn
  [LAMBDA (ImageObject Stream)                               (* ; "Edited 21-Jun-88 09:21 by pmi")
          
          (* ;; 
          "Writes the Pointer information in the pointer icon specified by ImageObject onto Stream")
          
          (* ;; "pmi 6/21/88: Now checks that pointer has a valid destination card before trying to write it out.  If it doesn't, convert it to a deleted imaged obj.")

    (LET ((Pointer (NC.FetchLinkFromLinkIcon ImageObject)))
         (if (type? NCPointer Pointer)
             then 
          
          (* ;; "Check for bad Pointer")

                  (if (NOT (NC.ValidCardP (fetch (NCPointer DestinationCard) of Pointer)))
                      then 
          
          (* ;; "Delete a bad pointer when it is discovered at put time.")

                           (NC.ReplaceWithDeletedLinkImageObj ImageObject)
                           (APPLY* (IMAGEOBJPROP ImageObject 'PUTFN)
                                  ImageObject Stream)
                    else (NC.WritePointer Pointer Stream])

(NC.PointerIconGetFn
  [LAMBDA (Stream)                                           (* ; "Edited 22-Jun-88 12:37 by pmi")
          
          (* ;; "Reads the pointer information from Stream and returns a pointer icon image object.")
          
          (* ;; "pmi 6/22/88: Now checks that NC.ReadPointer returns a valid NCPointer object before calling NC.MakePointerIcon.  If not, returns NC.DeletedLinkImageObject")

    (DECLARE (GLOBALVARS NC.DeletedLinkImageObject))
    (LET ((Pointer (NC.ReadPointer Stream)))
         (if (type? NCPointer Pointer)
             then (NC.MakePointerIcon Pointer)
           else NC.DeletedLinkImageObject])

(NC.ReadPointer
  [LAMBDA (Stream)                                           (* ; "Edited 22-Jun-88 12:11 by pmi")
          
          (* ;; "Read a single Pointer DATAYPE instance from Stream")
          
          (* ;; "pmi 6/22/88: Now checks for a 1 as the first character in the stream, signifying a Deleted link image obj.")

    (DECLARE (GLOBALVARS NC.OrigReadTable NC.DeletedLinkImageObject))
    (LET ((FirstChar (NC.ReadPtr Stream 1)))
         (COND
            ((EQ FirstChar 0)
          
          (* ;; "The link info for a version 0 style pointer.")

             (PROG1 (create NCPointer
                           DestinationCard ← (NC.CardOrCardHolderFromUID (NC.ReadUID Stream)
                                                    (NC.ReadUID Stream))
                           Label ← (READ Stream NC.OrigReadTable)
                           DisplayMode ← (READ Stream NC.OrigReadTable))

(* ;;; "Get that damn CR")

                    (BIN Stream)))
            ((EQ FirstChar 1)
             NC.DeletedLinkImageObject)
            ((EQ FirstChar 13)

(* ;;; "KLUDGE to account for fact that some versions of WRITE.IMAGEOBJ put a CR before beginning the actual stuff.")

             (NC.ReadPointer Stream])
)
(PUTPROPS PMIPATCH098 COPYRIGHT ("Xerox Corporation" 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (2146 5257 (NC.PointerIconPutFn 2156 . 3282) (NC.PointerIconGetFn 3284 . 3974) (
NC.ReadPointer 3976 . 5255)))))
STOP