rewrote (make-rule-result ...) using two named functions for tracing purposes
fixed: build-func-result now returns (res . end-state)
This commit is contained in:
parent
bf7f4e2afb
commit
113cd54a71
|
@ -39,27 +39,48 @@
|
||||||
(wants-build?-result rule-result-wants-build?)
|
(wants-build?-result rule-result-wants-build?)
|
||||||
(build-func-result rule-result-build-func))
|
(build-func-result rule-result-build-func))
|
||||||
|
|
||||||
|
;;; a named function mainly for tracing purposes
|
||||||
|
(define (apply-build-func build-required? rule prereqs prereqs-results cooked-state)
|
||||||
|
(let ((build-func (rule-build-func rule)))
|
||||||
|
(if (null? prereqs)
|
||||||
|
(build-func build-required? cooked-state)
|
||||||
|
(apply build-func
|
||||||
|
(append (list build-required?)
|
||||||
|
prereqs-results (list cooked-state))))))
|
||||||
|
|
||||||
|
;;; a named function mainly for tracing purposes
|
||||||
|
(define (apply-wants-build? rule prereqs prereqs-results init-state)
|
||||||
|
(let ((wants-build? (rule-wants-build? rule)))
|
||||||
|
(if (null? prereqs)
|
||||||
|
(wants-build? init-state)
|
||||||
|
(apply wants-build? (append prereqs-results (list init-state))))))
|
||||||
|
|
||||||
(define (rule-make rule init-state rule-set)
|
(define (rule-make rule init-state rule-set)
|
||||||
(let* ((pre-results (map (lambda (prereq)
|
(let* ((prereqs (rule-prereqs rule))
|
||||||
|
(prereqs-results (map (lambda (prereq)
|
||||||
(if (assq prereq (rule-set-rules rule-set))
|
(if (assq prereq (rule-set-rules rule-set))
|
||||||
(rule-make prereq init-state rule-set)
|
(rule-make prereq init-state rule-set)
|
||||||
(error "prerequisite is not in rule-set!")))
|
(error "prerequisite is not in rule-set!")))
|
||||||
(rule-prereqs rule)))
|
prereqs))
|
||||||
(wants-build?-result (if (null? prereqs-results)
|
(wants-build?-result (apply-wants-build? rule prereqs
|
||||||
((rule-wants-build? rule) init-state)
|
prereqs-results init-state))
|
||||||
(apply (rule-wants-build? rule)
|
;;; (wants-build?-result (if (null? prereqs)
|
||||||
(append prereqs-results
|
;;; ((rule-wants-build? rule) init-state)
|
||||||
(list init-state)))))
|
;;; (apply (rule-wants-build? rule)
|
||||||
|
;;; (append prereqs-results
|
||||||
|
;;; (list init-state)))))
|
||||||
(build-required? (car wants-build?-result))
|
(build-required? (car wants-build?-result))
|
||||||
(cooked-state (cdr wants-build?-result)))
|
(cooked-state (cdr wants-build?-result)))
|
||||||
(if build-required?
|
(if build-required?
|
||||||
(if (null? prereqs-results)
|
(let* ((build-func (rule-build-func rule))
|
||||||
(make-rule-result wants-build?-result
|
;;; (build-func-result (if (null? prereqs)
|
||||||
((rule-build-func rule)
|
;;; (build-func build-required? cooked-state)
|
||||||
build-required? cooked-state))
|
;;; (apply build-func
|
||||||
(make-rule-result wants-build?-result
|
;;; (append (list build-required?)
|
||||||
(apply (rule-build-func rule)
|
;;; prereqs-results
|
||||||
(append (list build-required?)
|
;;; (list cooked-state)))))
|
||||||
prereqs-results
|
(build-func-result (apply-build-func build-required? rule prereqs
|
||||||
(list cooked-state)))))
|
prereqs-results cooked-state))
|
||||||
|
(end-state (cdr build-func-result)))
|
||||||
|
(make-rule-result wants-build?-result build-func-result))
|
||||||
(make-rule-result wants-build?-result #f))))
|
(make-rule-result wants-build?-result #f))))
|
||||||
|
|
Loading…
Reference in New Issue