X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=control-logic.lsp;h=2d2cd3e4efcac3ed4824390b071bda48bd59cc20;hb=f043a152769c7d67053fdbbd4cf8d2bc44b18956;hp=d75a9133a629e0fe46a2d24b9f0c8fe8baa52311;hpb=4466d2ec250322c1b603d041703259586e213b22;p=rrq%2Fhourglass.git diff --git a/control-logic.lsp b/control-logic.lsp index d75a913..2d2cd3e 100644 --- a/control-logic.lsp +++ b/control-logic.lsp @@ -14,8 +14,9 @@ 'ACTDIR SITE:listener.activity.dir 'CONTROL.DAT SITE:control.dat 'EXTRA.DAT SITE:control.extra.dat - 'USAGE.DAT SITE:usage.dat - 'USAGE.TMP SITE:usage.tmp + 'USAGE.DAT SITE:control.usage.dat + 'USAGE.TMP SITE:control.usage.tmp + 'ACTION SITE:control.action ) # Set current time variables in local timezone @@ -27,29 +28,29 @@ DAY (list YEAR MONTH DATE) HM (list HOUR MINUTE) TOTAL '() + GAP SITE:control.activity.gap + CLIP SITE:control.activity.clip ) # Load CONTROL.DAT -# ( (control "file") (gap minutes) ( weekday start limit stop ) ... ) +# (( weekday start limit stop ) ... ) (setf CONTROL (read-expr (or (read-file CONTROL.DAT) (die "** Missing " CONTROL.DAT " ** Exiting.")) )) + +(write-line 2 (string (list CONTROL DOW))) + (map set '(dow MODE START LIMIT END) (or (assoc DOW CONTROL) (assoc 'policy CONTROL) (list DOW (6 30) 120 (20 0))) ) -(setf - GAP (or (lookup 'gap CONTROL) 15) - CLIP (or (lookup 'clip CONTROL) 1000) - ) - # Load the configured control mechanism -(if (lookup 'control CONTROL) (load $it) +(if (file? ACTION) (load ACTION) (die "** Unknown control mechanism. Exiting!!")) (unless control - (die "** Control function (control cmd reason) not defined. Exiting!!")) + (die "** Control function (control cmd reason) not defined. Exiting!!")) ;; Apply control command with reason, then exit (define (do-control x r) (control x r) (exit 0))