(FILECREATED " 3-MAY-77 14:37:23" <KRL1>LOG.;6 8080   

     changes to:  NewEditE

     previous date: "22-APR-77 09:37:04" <KRL1>LOG.;5)


(PRETTYCOMPRINT LOGCOMS)

(RPAQQ LOGCOMS [(F: (OpenInstrLogFile CNT CNT1 LogComment LogDate NewEditE InitEditLog StopEditLog 
				      GetEditComment))
		(BLOCKS (NewEditE NewEditE CNT CNT1 GetEditComment (NOLINKFNS . T)))
		(VARS (INSTRLOGFILE (QUOTE INSTR.LOG))
		      (LOGASKWAIT 10)
		      (EDITCOMMENTFLG T)
		      (LOGSTKPTR (RELSTK (STKNTH -1)))
		      [LOGADDVARSLST (QUOTE ((AFTERSYSOUTFORMS OpenInstrLogFile)
					     (LISPXMACROS * (PROGN (LogDate)
								   (LogComment LISPXLINE)))
					     (HISTORYCOMS . *]
		      (LOGEDITTYPEAHEADFLG))
		(ADDVARS (AFTERSYSOUTFORMS (OpenInstrLogFile)))
		(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS (NLAMA)
										      (NLAML])
(PRETTYCOMPRINT (F: (OpenInstrLogFile CNT CNT1 LogComment LogDate NewEditE InitEditLog StopEditLog
GetEditComment)))
(DEFINEQ

(OpenInstrLogFile
  [LAMBDA (file)                                       (* ht: "30-MAR-77 07:53")
    (if ~file
	then file←(PACKFILENAME 'DIRECTORY (USERNAME)
				'BODY INSTRLOGFILE))
    INSTRLOGFILE←(OPENFILE file 'APPEND 'OLD/NEW)
    INSTRLOGFILEJFN←(OPNJFN INSTRLOGFILE)
    (if (InitEditLog)
	then (for p in LOGADDVARSLST::1 do (SET p:1 <p::1 ! (EVAL p:1) >)))
    (LogDate)
    (LogComment <'S 'Begin (DATE)>)
    INSTRLOGFILE])

(CNT
  [LAMBDA (X)                                          (* A version of COUNT that won't fall into a circular trap)
    (CNT1 X -1500)+ 1500])

(CNT1
  [LAMBDA (X N)                                        (* used by CNT q.v.)
    (if (NLISTP X)
	then N
      elseif ~(SMALLP N)
	then (RETFROM (QUOTE CNT)
		      (IPLUS 1500 N))
      else (CNT1 (CDR X)
		 (CNT1 (CAR X)
		       (ADD1 N])

(LogComment
  [LAMBDA (X)                                          (* rmk: "15-DEC-76 11:39:19")
                                                       (* print comment and close bracket on log file)
    (PROG NIL
          (SELECTQ (U-CASE X:1)
		   (SHUTUP EDITCOMMENTFLG←NIL)
		   (DONTLOGEDIT (StopEditLog))
		   (LOGEDIT (InitEditLog))
		   (GOAWAY (StopEditLog)
			   (if (OPENP INSTRLOGFILE)
			       then (PRIN1 " GOAWAY]
" INSTRLOGFILE)
				    (CLOSEF INSTRLOGFILE))
			   (for f in '(OpenInstrLogFile LogComment LogDate NewEditE InitEditLog 
							StopEditLog)
			      do (PUTD f NIL))
			   (bind pos for p in LOGADDVARSLST do (if pos←(MEMBER p::1 (EVAL p:1))
								   then (DETACH pos)))
			   (REMPROP 'EDITE 'LOGSAVE)
			   (RETURN))
		   NIL)
          (for e in X do (PRIN1 " " INSTRLOGFILE)
			 (PRIN1 e INSTRLOGFILE)
	     finally (PRIN1 "]" INSTRLOGFILE)
		     (TERPRI INSTRLOGFILE])

(LogDate
  [LAMBDA NIL                                          (* ht: " 1-FEB-77 16:34:37")
                                                       (* put open bracket and date on log file)
    (PRIN1 "[" INSTRLOGFILE)
    (JSYS 144 INSTRLOGFILEJFN -1 -34351349760])

(NewEditE
  [LAMBDA (EXPR COMS ATM)                              (* ht: " 3-MAY-77 14:36")
                                                       (* replaces EDITE to do logging)
    (PROG (oName eType lEv eEv oSize eCom nSize nlEv neEv !VALUE flg1 flg2)
          (if (LISTP ATM)
	      then oName←ATM:1
		   eType←(SELECTQ (ATM:3)
				  ((NIL PROP)
				    'F)
				  (T 'V)
				  (0 'P)
				  (OR (CADR (ASSOC ATM:3 PRETTYTYPELST))
				      ATM:3))
	    else (if (STKNAME (REALSTKNTH -2 'EDITE T LOGSTKPTR))='EDITREC
		     then eType←'R
			  oName←(CAR (STKARG 1 LOGSTKPTR))
		   else (eType←'E)
			(oName←NIL))
		 (RELSTK LOGSTKPTR))
      LP1 (if ~(NLSETQ (PROGN (LogDate)
			      (PRIN1 " < " INSTRLOGFILE)
			      (PRIN1 eType INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 oName INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 (SETQ oSize (CNT EXPR))
				     INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 (SETQ lEv (CADR LISPXHISTORY))
				     INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 (SETQ eEv (CADR EDITHISTORY))
				     INSTRLOGFILE)
			      (LogComment)))
	      then (if ~(OR (OPENP INSTRLOGFILE)
			    flg1)
		       then (OpenInstrLogFile)
			    (SETQ flg1 T)
			    (GO LP1)))
          (!VALUE←(OldEditE EXPR COMS ATM))
      LP2 (if ~(NLSETQ (PROGN (LogDate)
			      [SETQ eCom
				(if (OR (NLISTP ATM)
					(CADR ATM))
				    then nSize←(CNT !VALUE)
					 [if EDITCOMMENTFLG
					     then (OR (ASKUSER LOGASKWAIT
							       (QUOTE (% N o C o m m e n t))
							       "c: "
							       [QUOTE ((%NoComment NIL RETURN
										     (QUOTE (NoCom)))
								       ( NIL RETURN (CAR ANSWER]
							       LOGEDITTYPEAHEADFLG)
						      (QUOTE (noCh]
				  else (SETQ nSize oSize)
				       (QUOTE (noCh]
			      (PRIN1 " > " INSTRLOGFILE)
			      (PRIN1 eType INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 oName INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 nSize INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 (IDIFFERENCE nSize oSize)
				     INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 (SETQ nlEv (CADR LISPXHISTORY))
				     INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 (IDIFFERENCE nlEv lEv)
				     INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 (SETQ neEv (CADR EDITHISTORY))
				     INSTRLOGFILE)
			      (PRIN1 " " INSTRLOGFILE)
			      (PRIN1 (IDIFFERENCE neEv eEv)
				     INSTRLOGFILE)
			      (LogComment eCom)))
	      then (if ~(OR (OPENP INSTRLOGFILE)
			    flg2)
		       then (OpenInstrLogFile)
			    flg2←T
			    (GO LP2)
		     else (StopEditLog)))
          (RETURN !VALUE])

(InitEditLog
  [LAMBDA NIL                                          (* ht: "14-DEC-76 17:09:02")
    (PROG1 (if ~(GETP 'EDITE 'LOGSAVE)
	       then (PUTD 'OldEditE (GETD 'EDITE))
		    (PUT 'EDITE 'LOGSAVE (GETD 'EDITE))
		    T)
	   (PUTD 'EDITE (GETD 'NewEditE))
	   (RELINK '(EDITFBLOCK EDITE])

(StopEditLog
  [LAMBDA NIL                                          (* ht: "14-DEC-76 17:17:33")
    (PUTD 'EDITE (GETP 'EDITE 'LOGSAVE))
    (RELINK 'EDITFBLOCK])

(GetEditComment
  [LAMBDA NIL                                          (* ht: "16-DEC-76 22:39:07")
    (PROG (ANS (WAIT (CONSTANT DWIMWAIT*4))
	       BUFS)
          (LINBUF)
          (SYSBUF)
          (BUFS←(CLBUFS NIL T READBUF))
          (PRIN1 "c: ")
          (DOBE)
          (if (READP T)
	      then (PRIN3 BELLS T)
		   (DOBE)
		   (CLEARBUF T))
      WAITLP
          (ANS←(if (READP T)
		   then (READLINE T)
		 elseif ~(MINUSP WAIT←WAIT-1)
		   then (DISMISS 250)
			(GO WAITLP)
		 else (PRIN1 "...]
" T)
		      NIL))
          (if BUFS
	      then (BKBUFS BUFS))
          (RETURN ANS])
)
[DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY
(BLOCK: NewEditE NewEditE CNT CNT1 GetEditComment (NOLINKFNS . T))
]

(RPAQQ INSTRLOGFILE INSTR.LOG)

(RPAQ LOGASKWAIT 10)

(RPAQ EDITCOMMENTFLG T)

(RPAQ LOGSTKPTR (RELSTK (STKNTH -1)))

(RPAQQ LOGADDVARSLST ((AFTERSYSOUTFORMS OpenInstrLogFile)
		      (LISPXMACROS * (PROGN (LogDate)
					    (LogComment LISPXLINE)))
		      (HISTORYCOMS . *)))

(RPAQ LOGEDITTYPEAHEADFLG NIL)

(ADDTOVAR AFTERSYSOUTFORMS (OpenInstrLogFile))
(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS 

(ADDTOVAR NLAMA )

(ADDTOVAR NLAML )
)
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1008 7416 (OpenInstrLogFile 1020 . 1515) (CNT 1519 . 1679) (CNT1 1683 . 1973) (
LogComment 1977 . 2998) (LogDate 3002 . 3284) (NewEditE 3288 . 6233) (InitEditLog 6237 . 6558) (
StopEditLog 6562 . 6736) (GetEditComment 6740 . 7413)))))
STOP