[update catalogs to use uri's instead of strings atsmyles@earthlink.net**20100412221002] hunk ./catalog.scm 57 - (uri (find string? (cdr form) #f))) - (make-version version requires (if uri (path-expand uri base) "") properties) + (path (find string? (cdr form) #f))) + (make-version version requires (if path (resolve-uri base (uri path)) "") properties) hunk ./catalog.scm 62 - (with-exception-catcher - (lambda (e) '()) - (lambda () (with-input-from-file path read)))) + (cond + ((not (uri? path)) (assertion-violation 'read-catalog "path must be a uri")) + ((or (not (uri-scheme path)) (not (eq? 'file (uri-scheme path)))) (assertion-violation 'read-catalog "read-catalog only supports the file scheme" path)) + (else (with-exception-catcher (lambda (e) '()) + (lambda () (with-input-from-file (uri-part path 'path) read)))))) hunk ./catalog.scm 79 - (base (find string? (cddr form) base-uri))) - (make-library name (map (lambda (f) (form->version f base)) versions) properties))) + (base (find string? (cddr form) #f))) + (make-library name (map (lambda (f) (form->version f (if base (uri base) base-uri))) versions) properties))) hunk ./catalog.scm 100 - (if (null? body) - (main base-uri (read-catalog base-uri)) - (main base-uri (car body)))))) -;remove this -#; (define library->versions - (let () - - - (lambda (name) - (call-with-values (lambda () (name&version name)) - (lambda (name version-reference) - (let ((library (hash-table-ref CATALOG name #f)) - (version? (version-predicate version-reference)) - (result '())) - (for-each (lambda (version) - (if (version? (version-number version)) (append (list version) result))) - (or (and library (library-versions library)) '())) - result)))) - )) + (cond + ((not (uri? base-uri)) (assertion-violation 'catalog->libraries "first argument must be a uri")) + ((null? body) (main base-uri (read-catalog base-uri))) + (else (main base-uri (car body))))))) hunk ./catalog.scm 107 +#| hunk ./catalog.scm 119 - +|# hunk ./catalog.scm 125 - ,(if (null? base) (version-uri v) (relativize (version-uri v) (car base))) + ,(if (null? base) (uri->string (version-uri v)) (relative-uri (car base) (version-uri v))) hunk ./compile-libs 13 +(define (debug arg) (pp arg) arg) + hunk ./compile-libs 64 - (define uri (path-expand file (current-directory))) + (define uri (make-uri 'file (path-expand file (current-directory)) #f #f)) hunk ./compile-libs 68 - `(library ,name (versions (,version ,(if multi? (string-append uri "#" (number->string multi?)) uri))))))) + `(library ,name (versions (,version ,(uri->string (if multi? (make-uri (uri-scheme uri) (uri-body uri) #f (number->string multi?)) uri)))))))) hunk ./compile-libs 85 - (pretty-print (ex:compile-catalog (current-directory) (generate-catalog libraries) (path-expand "~/.gambit/lib") options: '(debug)) port))) + (pretty-print (ex:compile-catalog (uri (string-append "file://" (current-directory))) (generate-catalog libraries) (uri (string-append "file://" (path-expand "~/.gambit/lib"))) options: '(debug)) port))) hunk ./primitives.scm 141 - (define (library-filename library) (path-strip-directory (path-strip-extension output-file))) - (define tmp-dir (string-append "/tmp/" (library-filename library-form) "-" - (number->string (time->seconds (current-time))) "/")) + (define (library-filename library) (path-strip-directory (path-strip-extension (uri-part output-file 'path)))) + (define tmp-dir (string-append "/tmp/" (library-filename library-form) "-" (number->string (time->seconds (current-time))) "/")) hunk ./primitives.scm 168 - input-files: input-files - output: (path-expand output-file) + input-files: input-files + output: (uri-part output-file 'path) hunk ./primitives.scm 182 - (define (split-uri uri) - (let loop ((i 0)) - (cond - ((= i (string-length uri)) uri) - ((char=? #\# (string-ref uri i)) (values (substring uri 0 i) (substring uri (+ i 1) (string-length uri)))) - (else (loop (+ 1 i)))))) + ;(define (split-uri uri) + ; (let loop ((i 0)) + ; (cond + ; ((= i (string-length uri)) uri) + ; ((char=? #\# (string-ref uri i)) (values (substring uri 0 i) (substring uri (+ i 1) (string-length uri)))) + ; (else (loop (+ 1 i)))))) hunk ./primitives.scm 189 - (if (version? uri) (ex:read-library (version-uri uri)) - (call-with-values - (lambda () (split-uri uri)) - (lambda (uri . fragment) - (if (null? fragment) - (with-input-from-file uri read) - (with-input-from-file uri + (if (version? uri) (ex:read-library (version-uri uri)) + (with-input-from-file (uri-part uri 'path) + (if (not (uri-fragment uri)) + read hunk ./primitives.scm 194 - (let loop ((i (string->number (car fragment)))) - (if (= i 0) (read) (begin (read) (loop (- i 1)))))))))))) + (let loop ((i (string->number (uri-fragment uri)))) + (if (= i 0) (read) (begin (read) (loop (- i 1)))))))))) hunk ./primitives.scm 202 - (define (library->filename name version base-dir) + (define (library->uri name version base-dir) hunk ./primitives.scm 210 - (path-expand + (resolve-uri base-dir + (make-uri #f hunk ./primitives.scm 214 - (string-append (name->string name "-") ".o1")) - base-dir)) + (string-append (name->string name "-") ".o1")) #f #f))) hunk ./primitives.scm 220 - (out-file (library->filename (library-name library) (version-number version) bin)) + (out-file (library->uri (library-name library) (version-number version) bin)) hunk ./runtime.scm 81 - ((and version (version-property version 'dynlib)) (load (version-uri version))) + ((and version (version-property version 'dynlib)) (load (uri-part (version-uri version) 'path))) hunk ./test/examples.scm 33 -(r6rs "~/.gambit/catalog.scat") +(r6rs (string-append "file://" (path-expand "~/.gambit/catalog.scat")))