- str))
-
-(define (gulp-file nm len)
- (gulp-port (open-file nm "r") len))
-
-;;; ARGH - cuases memory usage to explode with GUILE cvs.
-
-(define BOUNDING-BOX-RE
- "^%%BoundingBox: (-?[0-9]+) (-?[0-9]+) (-?[0-9]+) (-?[0-9]+)")
-
-(define (get-bbox file-name)
- (let* ((bbox (string-append file-name ".bbox"))
- ;; -sOutputFile does not work with bbox?
- (cmd (format #t "gs\
- -sDEVICE=bbox\
- -q\
- -dNOPAUSE\
- ~S\
- -c showpage\
- -c quit 2>~S"
- file-name bbox))
- (status (system cmd))
- (s (gulp-file d bbox 10240))
- (m (string-match BOUNDING_BOX_RE s)))
-
- (if m
- (list->vector
- (map (lambda (x) (string->number (car x))) (vector->list m)))
- #f)))