diff options
author | Arun Isaac | 2023-11-16 13:35:40 +0000 |
---|---|---|
committer | Arun Isaac | 2023-11-16 13:59:33 +0000 |
commit | 900c76a29726778a34ba0cbeb832cddd618783f4 (patch) | |
tree | 817d51c15cd8d4c2ee88b6f9f018f16c20f47529 /ccwl/ccwl.scm | |
parent | 7d1cc9b535afeb6021bec83b3220928998361528 (diff) | |
download | ccwl-900c76a29726778a34ba0cbeb832cddd618783f4.tar.gz ccwl-900c76a29726778a34ba0cbeb832cddd618783f4.tar.lz ccwl-900c76a29726778a34ba0cbeb832cddd618783f4.zip |
ccwl: Support nested arrays.
* ccwl/ccwl.scm (construct-type-syntax): Construct types recursively
to support nested arrays.
(key->output): Recursively convert stdout types to File types.
* ccwl/cwl.scm (type->cwl): New function.
(input->cwl-scm, output->cwl-scm): Use type->cwl.
* tests/ccwl.scm (make-array-type): New function.
(construct-type-syntax-wrapper): New syntax.
("construct-type-syntax on primitive types", "construct-type-syntax on
array types", "construct-type-syntax on nested array types"): New
tests.
* tests/cwl.scm, doc/array-types.scm, doc/nested-array-types.scm: New
files.
* doc/ccwl.skb (Cookbook)[Array types]: New section.
Diffstat (limited to 'ccwl/ccwl.scm')
-rw-r--r-- | ccwl/ccwl.scm | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index 66a8ab7..5ae0761 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -132,11 +132,9 @@ compared using @code{equal?}." (define (construct-type-syntax type-spec) "Return syntax to build a type from @var{type-spec}." - ;; TODO: Does CWL support arrays of arrays? If so, support such - ;; recursive type definitions. (syntax-case type-spec (array) ((array member-type) - #'(make-array-type 'member-type)) + #`(make-array-type #,(construct-type-syntax #'member-type))) (primitive-type #''primitive-type))) @@ -714,6 +712,14 @@ a <key> object, in STEPS, a list of <step> objects. If no such <output> object is found, return #f. Note that the returned syntax is only applicable to construct <output> objects for workflows, not in commands." + (define (stdout->file-type type) + "Recursively convert stdout types in @var{type} to File types." + (cond + ((array-type? type) + (make-array-type (stdout->file-type (array-type-member-type type)))) + ((eq? type 'stdout) 'File) + (else type))) + (and-let* ((step-with-output (find (lambda (step) (eq? (step-id step) (key-step key))) @@ -734,17 +740,7 @@ commands." (cwl-key-address key)) (key-name key)) ;; Convert stdout type outputs to File type outputs. - (let ((type - (cond - ((eq? (output-type output-for-key) - 'stdout) - 'File) - ((and (array-type? (output-type output-for-key)) - (eq? (array-type-member-type (output-type output-for-key)) - 'stdout)) - (make-array-type 'File)) - (else - (output-type output-for-key))))) + (let ((type (stdout->file-type (output-type output-for-key)))) ;; If step scatters, convert to an array type. (if (null? (step-scattered-inputs step-with-output)) type |