(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP")
(FILECREATED " 7-Sep-88 12:40:21" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH109.;4 4204   

      changes to%:  (FNS NC.LogoutAdvice)
                    (VARS PMIPATCH109COMS)

      previous date%: " 6-Sep-88 18:29:11" {QV}<NOTECARDS>1.3LNEXT>PMIPATCH109.;3)


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

(PRETTYCOMPRINT PMIPATCH109COMS)

(RPAQQ PMIPATCH109COMS
       [

(* ;;; "New file")

        (DECLARE%: DONTCOPY (PROPS (PMIPATCH109 MAKEFILE-ENVIRONMENT)
                                   (PMIPATCH109 FILETYPE)))
        
        (* ;; " pmi 9/7/88: Fixes problem where logging out with notefiles opened caused a break; %"Illegal Stack Arg 'LOGOUT.%"  Now NC.LogoutAdvice returns T if it is okay to LOGOUT, NIL if there are open notefiles.  The advice on LOGOUT calls this function and returns if it fails.  ")

        
        (* ;; "Changed in NCINTERFACE")

        (FNS NC.LogoutAdvice)
        
        (* ;; "This is also changed in NCINTERFACE - in this INITADVISE,  replace (NC.LogoutAdvice) with (if (NC.LogoutAdvice) else (RETURN)).")

        (INITADVISE (LOGOUT (NIL (BEFORE NIL (if (NC.LogoutAdvice)
                                                 else
                                                 (RETURN])



(* ;;; "New file")

(DECLARE%: DONTCOPY 

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

(PUTPROPS PMIPATCH109 FILETYPE :BCOMPL)
)



(* ;; 
" pmi 9/7/88: Fixes problem where logging out with notefiles opened caused a break; %"Illegal Stack Arg 'LOGOUT.%"  Now NC.LogoutAdvice returns T if it is okay to LOGOUT, NIL if there are open notefiles.  The advice on LOGOUT calls this function and returns if it fails.  "
)




(* ;; "Changed in NCINTERFACE")

(DEFINEQ

(NC.LogoutAdvice
  [LAMBDA NIL                                                (* ; "Edited  6-Sep-88 17:35 by pmi")
                                                             (* ; 
                            "Advice attached to logout to prevent logging out with an open database.")

(* ;;; "fgh 11/14/85 Updated to handle Muiltiple open noteFiles.")

(* ;;; "rht 11/16/85: Modified to call NC.ListOfNoteFiles.")

(* ;;; "pmi 6/9/88: Fixes problem where logging out with notefiles opened caused a break for Illegal Stack Arg 'LOGOUT.  Removed (RETFROM 'LOGOUT) at end of advice because RETFROM no longer works the same way in Lyric.  Instead, this now returns T if it's okay for LOGOUT to proceed, and NIL if it should abort.  This will be checked in the actual advice added to LOGOUT.")

    (LET ((OpenNoteFiles (for NoteFile in (NC.ListOfNoteFiles)
                            when (AND (STREAMP (fetch (NoteFile Stream) of NoteFile))
                                      (OPENP (fetch (NoteFile Stream) of NoteFile))) collect NoteFile
                              )))
         (if OpenNoteFiles
             then (NC.PrintMsg NIL T "The following NoteFiles are still open." (CHARACTER 13)
                         "They must be closed before you can logout!!!"
                         (CHARACTER 13))
                  (for NF in OpenNoteFiles do (NC.PrintMsg NIL NIL (fetch (NoteFile FullFileName)
                                                                      of NF)
                                                     ",  "))
                  (RPTQ 1 (PROGN (VIDEOCOLOR T)
                                 (DISMISS 100)
                                 (VIDEOCOLOR NIL)
                                 (DISMISS 100)))
                  (RPTQ 3 (FLASHW PROMPTWINDOW))
                  NIL
           else T])
)



(* ;; 
"This is also changed in NCINTERFACE - in this INITADVISE,  replace (NC.LogoutAdvice) with (if (NC.LogoutAdvice) else (RETURN))."
)


[LOADINITADVISE NC-ADVICE0233 (LOGOUT (NIL (BEFORE NIL (if (NC.LogoutAdvice)
                                                         else (RETURN]
(PUTPROPS PMIPATCH109 COPYRIGHT ("Xerox Corporation" 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (1874 3813 (NC.LogoutAdvice 1884 . 3811)))))
STOP