diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2021-04-26 09:14:34 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2021-04-26 09:14:34 +0200 |
commit | 0992a6f9404bf2e5ec6b64bcaf337db42b1d5051 (patch) | |
tree | 287eb8fd3ae00980c372a0969efce68b1890d6b9 | |
parent | 05b794af43c0f47c2fde85aa3f37c1a0185da62e (diff) |
low: Do not capture get-{vector-,}attribute-names result in closure.
This makes compilation without a DRMAA library impossible.
* drmaa/v1/low.scm (set-attribute!, set-vector-attribute!): Compute
valid attribute names at runtime.
-rw-r--r-- | drmaa/v1/low.scm | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/drmaa/v1/low.scm b/drmaa/v1/low.scm index 0d71e32..ca2b8d7 100644 --- a/drmaa/v1/low.scm +++ b/drmaa/v1/low.scm @@ -262,23 +262,22 @@ not be affected by this." #true error-message))) -(define set-attribute! +(define (set-attribute! template name value) (let ((valid (get-attribute-names))) - (lambda (template name value) - (unless (member name valid) - (raise (condition - (&formatted-message - (format "This DRMAA implementation does not support the attribute `~a'.~%") - (arguments (list name)))))) - (let ((error-message - (make-char* (bytevector->pointer - (make-bytevector (DRMAA 'ERROR_STRING_BUFFER)))))) - (return (drmaa_set_attribute template - (string->pointer name) value - error-message - (DRMAA 'ERROR_STRING_BUFFER)) - #true - error-message))))) + (unless (member name valid) + (raise (condition + (&formatted-message + (format "This DRMAA implementation does not support the attribute `~a'.~%") + (arguments (list name)))))) + (let ((error-message + (make-char* (bytevector->pointer + (make-bytevector (DRMAA 'ERROR_STRING_BUFFER)))))) + (return (drmaa_set_attribute template + (string->pointer name) value + error-message + (DRMAA 'ERROR_STRING_BUFFER)) + #true + error-message)))) (define (get-attribute template name) (let ((error-message @@ -296,25 +295,24 @@ not be affected by this." (char*->string value) error-message))) -(define set-vector-attribute! +(define (set-vector-attribute! template name . values) (let ((valid (get-vector-attribute-names))) - (lambda (template name . values) - (unless (member name valid) - (raise (condition - (&formatted-message - (format "This DRMAA implementation does not support the vector attribute `~a'.~%") - (arguments (list name)))))) - (let ((error-message - (make-char* (bytevector->pointer - (make-bytevector (DRMAA 'ERROR_STRING_BUFFER))))) - (array (make-cstr-array values))) - (return (drmaa_set_vector_attribute template - name - (bytevector->pointer array) - error-message - (DRMAA 'ERROR_STRING_BUFFER)) - #true - error-message))))) + (unless (member name valid) + (raise (condition + (&formatted-message + (format "This DRMAA implementation does not support the vector attribute `~a'.~%") + (arguments (list name)))))) + (let ((error-message + (make-char* (bytevector->pointer + (make-bytevector (DRMAA 'ERROR_STRING_BUFFER))))) + (array (make-cstr-array values))) + (return (drmaa_set_vector_attribute template + name + (bytevector->pointer array) + error-message + (DRMAA 'ERROR_STRING_BUFFER)) + #true + error-message)))) (define (get-vector-attribute template name) (let ((error-message |