Added cleanup invariant

master
Brady McDonough 2 years ago
parent 5994fefce6
commit 63d04ebadb

@ -325,17 +325,30 @@ registered" sym-name)
nil)) nil))
(defun tacc-invariant () (defun tacc-invariant ()
"Returns t if tacc is in a legal state for mutating tacc-info "Returns t if tacc is in a legal state for mutating tacc-info, signal an error otherwise
Note, if there is no tacc-buffer then you shouldn't be touching tacc-info" Note, if there is no tacc-buffer then you shouldn't be touching tacc-info"
(if (bufferp (tacc-buffer)) (if (bufferp (tacc-buffer))
(if (tacc-live?) (if (tacc-live?)
(if (tacc-live-state?) (if (tacc-live-state?)
t t
(signal 'tacc-error-illegal-buffer-state (tacc-buffer))) ;; Timer running without logical knowledge ;; Timer running without reason in logic
(signal 'tacc-error-illegal-buffer-state (tacc-buffer)))
(if (tacc-session-state?) (if (tacc-session-state?)
t t
(signal 'tacc-error-illegal-buffer-state (tacc-buffer)))) ;; Buffer live without logical reason ;; Buffer is live without reason in logic
(signal 'tacc-error-illegal-buffer-state (tacc-buffer)))) ;; We shouldn't be calling this when the buffer is dead (signal 'tacc-error-illegal-buffer-state (tacc-buffer))))
;; We shouldn't be calling this when the buffer is dead
(signal 'tacc-error-illegal-buffer-state (tacc-buffer))))
(defun tacc-cleanup-invariant ()
"Returns t if tacc is in a cleaned up state, signals an error otherwise"
(if (bufferp (tacc-buffer))
(signal 'tacc-dirty-state (tacc-buffer))
(if (tacc-live?)
(signal 'tacc-dirty-state tacc-timer)
(if (tacc-session?)
(signal 'tacc-dirty-state tacc-info)
t))))
;; 05.3 Predicates and helpers ;; 05.3 Predicates and helpers
(defun tacc-chime-p (countdown-ts) (defun tacc-chime-p (countdown-ts)

Loading…
Cancel
Save