From d587e4152f96788d3f20fee16c3f80e9b2ae9b9a Mon Sep 17 00:00:00 2001 From: jottbee Date: Tue, 15 Feb 2005 11:29:08 +0000 Subject: [PATCH] changed syntax for file, md5, once, and always from ?thunk into ?action0 ... --- macros.scm | 113 +++++++++++++++++++++++++++-------------------------- 1 file changed, 57 insertions(+), 56 deletions(-) diff --git a/macros.scm b/macros.scm index c3041d4..915bf37 100644 --- a/macros.scm +++ b/macros.scm @@ -1,17 +1,9 @@ ;;; MAKEFILE: ;;; ========= -;;; (define-syntax makefile -;;; (syntax-rules () -;;; ((makefile ?rule0 ...) -;;; (let ((rule-candidates '())) -;;; (let* ((rule-candidates (?rule0 rule-candidates)) -;;; ...) -;;; rule-candidates))))) - ;;; ;;; ::= '(' + "makefile" + * + ')' -;;; ::= +;;; ::= ;;; | ;;; | ;;; | @@ -23,68 +15,73 @@ ((makefile ?rule0 ?rule1 ...) (?rule0 (makefile ?rule1 ...))))) ;;; -;;; +;;; ;;; ;;; to achieve consistency only rule will use the rule-tmpvars ;;; macro directly and all other macros use this clause ;;; (define-syntax makefile-rule (syntax-rules () - ((makefile-rule ?target ?prereqs ?thunk) (rule ?target ?prereqs ?thunk)))) + ((makefile-rule ?target ?prereqs ?action0 ...) + (file ?target ?prereqs ?action0 ...)))) (define-syntax is-out-of-date? (syntax-rules () - ((is-out-of-date? ?target ?prereqs ?thunk) (rule ?target ?prereqs ?thunk)))) + ((is-out-of-date? ?target ?prereqs ?action0 ...) + (file ?target ?prereqs ?action0 ...)))) -(define-syntax rule +(define-syntax file (syntax-rules () - ((rule ?target (?prereq0 ...) ?thunk) - (rule-tmpvars () ?target (?prereq0 ...) ?thunk)))) + ((file ?target (?prereq0 ...) ?action0 ...) + (file-tmpvars () ?target (?prereq0 ...) ?action0 ...)))) -(define-syntax rule-tmpvars +(define-syntax file-tmpvars (syntax-rules () - ((rule-tmpvars (tmp1 ...) ?target () ?thunk) + ((file-tmpvars (tmp1 ...) ?target () ?action0 ...) (let ((target ?target) - (prereqs (list tmp1 ...))) + (prereqs (list tmp1 ...)) + (thunk (lambda () ?action0 ...))) (lambda (rule-candidates) (cons (list target prereqs (make-is-out-of-date? target tmp1 ...) - (make-rule-build-func target prereqs ?thunk)) + (make-file-build-func target prereqs thunk)) rule-candidates)))) - ((rule-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?thunk) + ((file-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...) (let ((tmp2 ?prereq0)) - (rule-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?thunk))))) + (file-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...))))) ;;; ;;; ;;; -;;; to achieve consistency only rule-md5 will use the rule-md5-tmpvars +;;; to achieve consistency only file-md5 will use the file-md5-tmpvars ;;; macro directly and all other macros use this clause ;;; (define-syntax md5 (syntax-rules () - ((md5 ?target ?prereqs ?thunk) (rule-md5 ?target ?prereqs ?thunk)))) + ((md5 ?target ?prereqs ?action0 ...) + (file-md5 ?target ?prereqs ?action0 ...)))) -(define-syntax rule-md5 +(define-syntax file-md5 (syntax-rules () - ((rule-md5 ?target (?prereq0 ...) ?thunk) - (rule-md5-tmpvars () ?target (?prereq0 ...) ?thunk)))) + ((file-md5 ?target (?prereq0 ...) ?action0 ...) + (file-md5-tmpvars () ?target (?prereq0 ...) ?action0 ...)))) -(define-syntax rule-md5-tmpvars +(define-syntax file-md5-tmpvars (syntax-rules () - ((rule-md5-tmpvars (tmp1 ...) ?target () ?thunk) + ((file-md5-tmpvars (tmp1 ...) ?target () ?action0 ...) (let ((target ?target) - (prereqs (list tmp1 ...))) + (prereqs (list tmp1 ...)) + (thunk (lambda () ?action0 ...))) (lambda (rule-candidates) (cons (list target prereqs (make-md5-sum-changed? target tmp1 ...) - (make-md5-build-func target prereqs ?thunk)) + (make-md5-build-func target prereqs thunk)) rule-candidates)))) - ((rule-md5-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?thunk) + ((file-md5-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...) (let ((tmp2 ?prereq0)) - (rule-md5-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?thunk))))) + (file-md5-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...))))) ;;; ;;; @@ -94,36 +91,39 @@ ;;; (define-syntax phony (syntax-rules () - ((phony ?target ?prereqs ?thunk) (rule-always ?target ?prereqs ?thunk)))) + ((phony ?target ?prereqs ?action0 ...) + (file-always ?target ?prereqs ?action0 ...)))) (define-syntax always (syntax-rules () - ((always ?target ?prereqs ?thunk) (rule-always ?target ?prereqs ?thunk)))) + ((always ?target ?prereqs ?action0 ...) + (file-always ?target ?prereqs ?action0 ...)))) (define-syntax is-out-of-date! (syntax-rules () - ((is-out-of-date! ?target ?prereqs ?thunk) - (rule-always ?target ?prereqs ?thunk)))) + ((is-out-of-date! ?target ?prereqs ?action0 ...) + (file-always ?target ?prereqs ?action0 ...)))) -(define-syntax rule-always +(define-syntax file-always (syntax-rules () - ((rule-always ?target (?prereq0 ...) ?thunk) - (rule-always-tmpvars () ?target (?prereq0 ...) ?thunk)))) + ((file-always ?target ?prereqs ?action0 ...) + (file-always-tmpvars () ?target ?prereqs ?action0 ...)))) -(define-syntax rule-always-tmpvars +(define-syntax file-always-tmpvars (syntax-rules () - ((rule-always-tmpvars (tmp1 ...) ?target () ?thunk) + ((file-always-tmpvars (tmp1 ...) ?target () ?action0 ...) (let ((target ?target) - (prereqs (list tmp1 ...))) + (prereqs (list tmp1 ...)) + (thunk (lambda () ?action0 ...))) (lambda (rule-candidates) (cons (list target prereqs (make-is-out-of-date! target tmp1 ...) - (make-always-build-func target prereqs ?thunk)) + (make-always-build-func target prereqs thunk)) rule-candidates)))) - ((rule-always-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?thunk) + ((file-always-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...) (let ((tmp2 ?prereq0)) - (rule-always-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?thunk))))) + (file-always-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...))))) ;;; ;;; @@ -133,25 +133,26 @@ ;;; (define-syntax once (syntax-rules () - ((once ?target ?prereqs ?thunk) - (rule-once ?target ?prereqs ?thunk)))) + ((once ?target ?prereqs ?action0 ...) + (file-once ?target ?prereqs ?action0 ...)))) -(define-syntax rule-once +(define-syntax file-once (syntax-rules () - ((rule-once ?target (?prereq0 ...) ?thunk) - (rule-once-tmpvars () ?target (?prereq0 ...) ?thunk)))) + ((file-once ?target (?prereq0 ...) ?action0 ...) + (file-once-tmpvars () ?target (?prereq0 ...) ?action0 ...)))) -(define-syntax rule-once-tmpvars +(define-syntax file-once-tmpvars (syntax-rules () - ((rule-once-tmpvars (tmp1 ...) ?target () ?thunk) + ((file-once-tmpvars (tmp1 ...) ?target () ?action0 ...) (let ((target ?target) - (prereqs (list tmp1 ...))) + (prereqs (list tmp1 ...)) + (thunk (lambda () ?action0 ...))) (lambda (rule-candidates) (cons (list target prereqs (make-once target tmp1 ...) - (make-once-build-func target prereqs ?thunk)) + (make-once-build-func target prereqs thunk)) rule-candidates)))) - ((rule-once-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?thunk) + ((file-once-tmpvars (tmp1 ...) ?target (?prereq0 ?prereq1 ...) ?action0 ...) (let ((tmp2 ?prereq0)) - (rule-once-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?thunk))))) + (file-once-tmpvars (tmp1 ... tmp2) ?target (?prereq1 ...) ?action0 ...)))))