Google
 

Trailing-Edge - PDP-10 Archives - -
There are no other files named in the archive.
(FILECREATED "19-Mar-79 19:42:08" <LISPUSERS>IOWAITDAEMON..3 3477   


     changes to:  IOWAITDAEMON

     previous date: " 2-Jan-79 11:29:48" <LISPUSERS>IOWAITDAEMON..2)


(PRETTYCOMPRINT IOWAITDAEMONCOMS)

(RPAQQ IOWAITDAEMONCOMS [[DECLARE: FIRST
				   (P (MOVD? (QUOTE PROMPTCHAR)
					     (QUOTE OLDPROMPTCHAR]
			 (FNS IOWAITDAEMON PROMPTCHAR)
			 (VARS (IOWAITSLEEPINTERVAL 500)
			       (IOWAITDAEMONINTERVAL 60000)
			       (IOWAITDAEMONHARRAY (LIST (HARRAY 10)))
			       (IOWaitDaemonTimer 123456789))
			 (ADDVARS (IOWAITDAEMONFORMS)
				  (AFTERSYSOUTFORMS (CLRHASH 
						     IOWAITDAEMONHARRAY)))
			 (P (RELINK (QUOTE WORLD)))
			 (DECLARE: EVAL@COMPILE DONTCOPY
				   (P (RESETSAVE DWIMIFYCOMPFLG T])
(DECLARE: FIRST 
(MOVD? (QUOTE PROMPTCHAR)
       (QUOTE OLDPROMPTCHAR))
)
(DEFINEQ

(IOWAITDAEMON
  [LAMBDA NIL                                (* Edited by M.Yonke on 
					     19-Mar-79.)

    (* * This package simulates an IO Wait Daemon by redefining 
    PROMPTCHAR. The function IOWAITDAEMON is called and after 
    every IOWAITDAEMONINTERVAL minutes then it looks at every form
    on IOWAITDAEMONFORMS and see if its time to eval them.
    The time for the next eval is kept in a hash array using form 
    as the the hash key. Each form is responsible for returning 
    the time in minutes it should wait before evaling again.
    The default is one minute. IOWAITSLEEPINTERVAL is the time in 
    milliseconds to go to sleep before waking up to see if there 
    is any input. -
    NOTE: if READBUF is non-NIL then PROMPTCHAR is being called in
    a REDO or FIX and therefore should not go into the DISMISS 
    loop)


    (if IOWAITDAEMONFORMS and ~READBUF and ~(READP T)
	then
	 (while ~(READP T)
	    do
	     (if (IGEQ (SETN IOWaitDaemonTimer 
			     IOWaitDaemonTimer+IOWAITSLEEPINTERVAL)
		       IOWAITDAEMONINTERVAL)
		 then
		  (for form in IOWAITDAEMONFORMS bind IOWAITDAEMONFORMS
		     do                      (* bind IOWAITDAEMONFORMS to 
					     NIL in case a break occurs 
					     below)
                                             (* now process forms)
		      (if ((GETHASH form IOWAITDAEMONHARRAY) or 0) lt
			  (CLOCK 0)
			  then
			   (PUTHASH
			     form
			     (CLOCK 0)+(60000*([FIXP
				  (CAR (ERSETQ (EVAL form]
				  or 1))
			     IOWAITDAEMONHARRAY))
		     eachtime (if (READP T)
				  then (RETURN)))
                                             (* reset internal timer)
		  (SETN IOWaitDaemonTimer 0))
	     (if (READP T)
		 then (RETURN)
	       else                          (* sleep for a short time)
		    (DISMISS IOWAITSLEEPINTERVAL])

(PROMPTCHAR
  [LAMBDA (ID FLG HISTORY)                      (* Edited by M.Yonke on 
						21-Aug-78.)

    (* * This function gets moved to the PROMPTCHAR function cell 
    to implement the IOWAITDAEMON function.
    First it calls the old PROMPTCHAR and then calls IOWAITDAEMON 
    which loops until something has been typed.)


    (PROG1 (OLDPROMPTCHAR ID FLG HISTORY)
	   (IOWAITDAEMON])
)

(RPAQ IOWAITSLEEPINTERVAL 500)

(RPAQ IOWAITDAEMONINTERVAL 60000)

(RPAQ IOWAITDAEMONHARRAY (LIST (HARRAY 10)))

(RPAQ IOWaitDaemonTimer 123456789)

(ADDTOVAR IOWAITDAEMONFORMS )

(ADDTOVAR AFTERSYSOUTFORMS (CLRHASH IOWAITDAEMONHARRAY))
(RELINK (QUOTE WORLD))
(DECLARE: EVAL@COMPILE DONTCOPY 
(RESETSAVE DWIMIFYCOMPFLG T)
)
(DECLARE: DONTCOPY
  (FILEMAP (NIL (828 3112 (IOWAITDAEMON 840 . 2700) (PROMPTCHAR 2704 . 3109)))
))
STOP