From 0992a6f9404bf2e5ec6b64bcaf337db42b1d5051 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 26 Apr 2021 09:14:34 +0200 Subject: 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. --- drmaa/v1/low.scm | 66 +++++++++++++++++++++++++++----------------------------- 1 file 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 -- cgit v1.2.3