Changeset 13550 in project for chicken


Ignore:
Timestamp:
03/07/09 06:39:03 (11 years ago)
Author:
Kon Lovett
Message:

'extension-name-and-version' has validation. 'extension-version' ensures default version result is a string.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/setup-api.scm

    r13548 r13550  
    684684          (else #f))))
    685685
    686 (define extension-name-and-version (make-parameter '("" "")))
     686(define extension-name-and-version
     687  (make-parameter '("" "")
     688    (lambda (x)
     689      (cond [(or (not x) (null? x))
     690             '("" "") ]
     691            [(and (list? x) (= 2 (length x)))
     692             (let ([dir (car x)]
     693                   [ver (cadr x)]
     694                   [ensure-string (lambda (x) (if (or (not x) (null? x)) "" (->string x)))])
     695               (list (ensure-string dir) (ensure-string ver)) ) ]
     696            [else
     697             (warning "invalid extension-name-and-version" x)
     698             (extension-name-and-version) ] ) ) ) )
    687699
    688700(define (extension-name)
     
    692704  (let ([ver (cadr (extension-name-and-version))])
    693705    (if (string-null? ver)
    694         defver
     706        (and defver (->string defver))
    695707        ver ) ) )
    696708
Note: See TracChangeset for help on using the changeset viewer.