(define (make-read-exprs with-input-port)
(named-lambda (read-exprs)
(map (lambda (file)
- (with-input-port
- file
- (lambda (port)
- (let loop ()
- (let ((obj (read port)))
- (if (eof-object? obj)
- '()
- (cons obj (loop))))))))
- (directory-read "../../src/runtime/*.scm"))))
+ (with-input-port
+ file
+ (lambda (port)
+ (let loop ()
+ (let ((obj (read port)))
+ (if (eof-object? obj)
+ '()
+ (cons obj (loop))))))))
+ (directory-read
+ (merge-pathnames (->simple-pathname "../../src/runtime/")
+ "*.scm")))))
(define (make-write-exprs with-output-port)
(named-lambda (write-exprs data)
(define (call-with-input-gfile pathname receiver)
(let* ((port ((access open-input-gfile (->environment '(gtk)))
- (string-append "file://" (->truename* pathname))))
+ (string-append "file://" (->simple-namestring pathname))))
(value (receiver port)))
(close-input-port port)
value))
-(define-integrable (->truename* pathname)
- (let loop ((simpler (pathname-simplify (->truename pathname))))
+(define-integrable (->simple-namestring pathname)
+ (->namestring (->simple-pathname pathname)))
+
+(define (->simple-pathname pathname)
+ (let loop ((simpler (pathname-simplify
+ (merge-pathnames pathname (working-directory-pathname))))
+ (count 1))
(let ((again (pathname-simplify simpler)))
- (if (pathname=? again simpler)
- (->namestring again)
- (loop again)))))
+ (cond ((fix:> count 100) (error "Could not simplify:" pathname))
+ ((pathname=? again simpler) again)
+ (else (loop again (fix:1+ count)))))))
(define (call-with-tmp-output-file receiver)
(call-with-temporary-file-pathname
(call-with-temporary-file-pathname
(lambda (pathname)
(let* ((port ((access open-output-gfile (->environment '(gtk)))
- (string-append "file://" (->truename* pathname))))
+ (string-append "file://"
+ (->simple-namestring pathname))))
(value (receiver port)))
(close-output-port port)
value))))
(loop 1))
;(register-test 'port-performance test-port-performance)
-(test-port-performance)
\ No newline at end of file
+;(test-port-performance)
\ No newline at end of file