Skip to content
Snippets Groups Projects
Commit 8754a8f9 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Fix bogus mark-status-needed, merge-action-status

Fix mark-status-needed to be a special-purpose action-status-or,
and not use an action-status-and that merge-action-status is.
This was causing level escalation to wholly invalidate some actions
and have them rebuild all the time.

Fix merge-action-status which is a action-status-and;
also fix its documentation. That is minor, but still.
parent 4ed76c32
No related branches found
No related tags found
No related merge requests found
...@@ -135,21 +135,24 @@ or NIL if no the status is considered outside of a specific plan.")) ...@@ -135,21 +135,24 @@ or NIL if no the status is considered outside of a specific plan."))
(defun status-need-p (status) (defun status-need-p (status)
(plusp (logand (status-bits status) #.+need-bit+))) (plusp (logand (status-bits status) #.+need-bit+)))
(defun merge-action-status (status1 status2) (defun merge-action-status (status1 status2) ;; status-and
"Return the latest status earlier than both status1 and status2" "Return the earliest status later than both status1 and status2"
(make-action-status (make-action-status
:bits (logand (status-bits status1) (status-bits status2)) :bits (logand (status-bits status1) (status-bits status2))
:stamp (latest-stamp (status-stamp status1) (status-stamp status2)) :stamp (latest-stamp (status-stamp status1) (status-stamp status2))
:level (max (status-level status1) (status-level status2)) :level (min (status-level status1) (status-level status2))
:index (or (status-index status1) (status-index status2)))) :index (or (status-index status1) (status-index status2))))
(defun mark-status-needed (status &optional (level (operate-level))) (defun mark-status-needed (status &optional (level (operate-level))) ;; limited status-or
"Return the same status but with the need bit set, for the given level" "Return the same status but with the need bit set, for the given level"
(merge-action-status (if (and (status-need-p status)
status (>= (status-level status) level))
(make-action-status status
:bits +need-bit+ (make-action-status
:level level))) :bits (logior (status-bits status) +need-bit+)
:level (max level (status-level status))
:stamp (status-stamp status)
:index (status-index status))))
(defmethod print-object ((status action-status) stream) (defmethod print-object ((status action-status) stream)
(print-unreadable-object (status stream :type t) (print-unreadable-object (status stream :type t)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment