From c23a039972c910c739f1f6ed07c64cedfbe076d3 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Sat, 8 Mar 2025 14:11:51 +0000 Subject: [PATCH] (zilch planner step): add (build-plan-next-id) --- planner/src/step.sld | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/planner/src/step.sld b/planner/src/step.sld index f4db2f5..a7e3608 100644 --- a/planner/src/step.sld +++ b/planner/src/step.sld @@ -8,6 +8,8 @@ register-build-step empty-build-plan build-plan-print build-plan-tick + build-plan-next-id + build-plan-current-plan build-plan-append build-plan-tail-call build-plan-return-append) @@ -40,10 +42,15 @@ (define (empty-build-plan) (make-build-plan (mapping (make-default-comparator)) '() (mapping (make-default-comparator)) 0)) - ;; Appends a new step to the build plan, returning its ID. - (define (build-plan-append plan type args dependencies) + ;; Returns a monotonically-increasing identifier for this build plan. + (define (build-plan-next-id plan) (define id (+ (build-plan-last-id plan) 1)) (set-build-plan-last-id! plan id) + id) + + ;; Appends a new step to the build plan, returning its ID. + (define (build-plan-append plan type args dependencies) + (define id (build-plan-next-id plan)) (define new-step (make-build-step id dependencies type args)) (set-build-plan-steps! plan (mapping-set! (build-plan-steps plan) id new-step)) id)