3 ;;; functions to aid in running a macsyma background job.
4 (eval-when (eval compile)
5 (or (status feature iota) (load '|liblsp;iota fasl|)))
8 (DEFUN $SLEEP (&OPTIONAL (SEC '|no arg/||) (MINUTES 0) (HOURS 0))
9 (COND ((EQ SEC '|no arg/||)
11 SLEEP(SECONDS,MINUTES,HOURS), where MINUTES and HOURS
12 are optional arguments. SLEEP for that much wall clock time.|))
14 (SLEEP (PLUS SEC (TIMES 60. (PLUS MINUTES (TIMES 60. HOURS)))))
19 (DEFUN CLI-SEND-FORMS (UNAME JNAME request &REST FORMS)
20 (IOTA ((F `((CLI *) ,UNAME ,JNAME) '(OUT)))
22 (PRINT (LIST REQUEST (STATUS UNAME) (STATUS JNAME)) F)
24 (MAPCAR '(LAMBDA (U) (PRINT U F)) FORMS)))))
28 (DEFUN CLI-interrupt-HANDLER (&REST ARGS &AUX uname jname request FORMS)
30 (IOTA ((CLA '((CLA)) '(CLA)))
31 (READLINE CLA) ;;; Sixbit cruft.
32 (SETQ request (READ CLA)
37 (DO ((FORM (READ CLA '*EOF*)
40 (setq forms (reverse forms)))
41 (SETQ FORMS (CONS FORM FORMS))))
42 (COND ((EQ REQUEST 'EVAL)
44 ((EQ REQUEST 'EVAL-RETURN)
45 (APPLY 'CLI-SEND-FORMS `(,UNAME ,JNAME RETURN
46 ,@(MAPCAR 'EVAL FORMS))))
47 ((EQ REQUEST 'EVAL-PRINT)
48 (APPLY 'CLI-SEND-FORMS
49 `(,UNAME ,JNAME PRINT ,@(MAPCAR 'EVAL FORMS))))
51 (*throw 'cli-return-throw forms) ;;; can have sync problems.
53 (MAPCAR 'PRINT FORMS)))))
57 (SETQ CLI-MESSAGE 'CLI-INTERRUPT-HANDLER)
59 (defun cli-eval-form (jname uname form &aux ret)
60 (cli-send-forms jname uname 'eval-return form)
61 (setq ret (*catch 'cli-return-throw (sleep (* 60. 60. 10.)) ; 10. hours?
63 (cond ((eq ret '*no*return*) ret)
66 (defun cli-print-form (jname uname form)
67 (cli-send-forms jname uname 'print form))
69 (defun $REMOTE%DEBUG (&aux uname jname)
72 (stripdollar (retrieve '|What user name does the macsyma have?|
75 (stripdollar (retrieve '|What is its job name?| nil)))
77 (princ '|Enter expessions and wait for reply from remote job.| tyo)
79 (do ((form (retrieve '|Expression to send or EXIT| nil)
80 (retrieve '|Expression to send or EXIT| nil)))
81 ((eq form '$exit) '$done)
82 (setq $REMOTE (cli-eval-form uname jname
87 (errset (meval ',form) nil))))
88 (displa `((mlable) $REMOTE ,$REMOTE))))
92 ^W t) ;;; ^W , what a crock oldio.
97 (defun $alarm_off () (alarmclock 'time -1))
98 (defun $alarm_exp fexpr (L)
99 (let (((expr time) l))
100 (setq time (meval time))
101 (cond ((not (numberp time)) (erlist '|non-numeric time|))
102 ((lessp time 0.01) (erlist '|Time is in minutes, I don't like it less than 0.01|)))
106 (alarmclock 'time ,time)))