include docs in dist
[rrq/hourglass.git] / control-logic.lsp
index c842c06eee67d320d6270d87548e66ec80baf1b6..bdf291d858cae4fe80cad182a4e709473d6db2d2 100644 (file)
@@ -9,7 +9,14 @@
   (write-line 2 (join (map string args)))
   (exit 1))
 
   (write-line 2 (join (map string args)))
   (exit 1))
 
-(constant 'NOW (date-value))
+(constant
+ 'NOW (date-value)
+ '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
+ )
 
 # Set current time variables in local timezone
 (map set '(YEAR MONTH DATE HOUR MINUTE SECOND DOY DOW)
 
 # Set current time variables in local timezone
 (map set '(YEAR MONTH DATE HOUR MINUTE SECOND DOY DOW)
  DAY (list YEAR MONTH DATE)
  HM (list HOUR MINUTE)
  TOTAL '()
  DAY (list YEAR MONTH DATE)
  HM (list HOUR MINUTE)
  TOTAL '()
- CONTROL.DAT "control.dat"
- EXTRA.DAT "control-extra.dat"
- USAGE.DAT "usage.dat"
- USAGE.TMP ".usage.dat" 
+ GAP SITE:control.activity.gap
+ CLIP SITE:control.activity.clip
  )
 
 # Load CONTROL.DAT
  )
 
 # Load CONTROL.DAT
          (list DOW (6 30) 120 (20 0)))
      )
 
          (list DOW (6 30) 120 (20 0)))
      )
 
-(setf
- GAP (or (lookup 'gap CONTROL) 15)
- CLIP (or (lookup 'clip CONTROL) 1000)
- NET  (or (lookup 'net CONTROL) "10.0.0.0/8")
- )
-
 # Load the configured control mechanism
 (if (lookup 'control CONTROL) (load $it)
   (die "** Unknown control mechanism. Exiting!!"))
 # Load the configured control mechanism
 (if (lookup 'control CONTROL) (load $it)
   (die "** Unknown control mechanism. Exiting!!"))
 ;;==== Utilities for activity data
 # Activity is lines of timestamps. Collect TOTAL as list of unique
 # time values (H M) within the start-end time span.
 ;;==== Utilities for activity data
 # Activity is lines of timestamps. Collect TOTAL as list of unique
 # time values (H M) within the start-end time span.
+
 (define (log-name-fmt t)
   (format "%d%02d%02d-.*\\.dat" (0 3 (date-list t))))
 
 (define (log-lines f)
 (define (log-name-fmt t)
   (format "%d%02d%02d-.*\\.dat" (0 3 (date-list t))))
 
 (define (log-lines f)
-  (find-all "([0-9]+( \\S+)?).*" (read-file (string "activity/" f)) $1 0))
+  (find-all "([0-9]+( \\S+)?).*" (read-file (format "%s/%s" ACTDIR f)) $1 0))
 
 # Collect all timestamps of the UTC date of the given time stamp
 (define (logs t)
 
 # Collect all timestamps of the UTC date of the given time stamp
 (define (logs t)
-  (flat (map log-lines (directory "activity" (log-name-fmt t)))))
+  (flat (map log-lines (directory ACTDIR (log-name-fmt t)))))
 
 # Translate timestamp into its local time (hour minute), if it's
 # within the applicable day, null otherwise.
 
 # Translate timestamp into its local time (hour minute), if it's
 # within the applicable day, null otherwise.