From 9af74fe933c7a58851547997dfaaa348d4c958f6 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 14 Nov 2023 15:51:45 +0000 Subject: ccwl: Build output from key outside of syntax. It is easier (no need to juggle complex with-syntax constructs) to do more complicated operations outside of the scope of syntax. * ccwl/ccwl.scm (key->output): Build output from key outside of syntax. --- ccwl/ccwl.scm | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index 2ece5d9..e174159 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -688,16 +688,31 @@ a object, in STEPS, a list of objects. If no such (eq? (step-id step) (key-step key))) steps))) - (with-syntax ((key-name (datum->syntax #f (key-name key))) - (key-cwl-id (datum->syntax #f (key-cwl-id key)))) - #`(set-output-id - (set-output-source (find (lambda (output) - (eq? (output-id output) - 'key-cwl-id)) - (function-outputs - #,(step-run step-with-output))) - #,(cwl-key-address key)) - 'key-name)))) + (let* ((output-for-key + ;; Find output object that corresponds to key. + (find (lambda (output) + (eq? (output-id output) + (key-cwl-id key))) + (function-outputs + (function-object + (step-run step-with-output))))) + (output + ;; Set output id and source fields from key. + (set-output-id + (set-output-source output-for-key + (cwl-key-address key)) + (key-name key)))) + ;; Construct syntax to recreate output object. + #`(make-output + #,(with-syntax ((id (datum->syntax #f (output-id output)))) + #''id) + #,(with-syntax ((type (datum->syntax #f (output-type output)))) + #''type) + #,(with-syntax ((binding (datum->syntax #f (output-binding output)))) + #''binding) + #,(output-source output) + #,(with-syntax ((other (datum->syntax #f (output-other output)))) + #''other))))) (define-syntax workflow (lambda (x) -- cgit v1.2.3