/usr/share/racket/pkgs/contract-profile/dot.rkt is in racket-common 6.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #lang racket/base
;; Graphviz support
;; inspired by redex/private/dot.rkt (can't use directly because it uses GUI)
(require racket/match racket/system)
(provide with-output-to-dot)
;; these paths are explicitly checked (when find-executable-path
;; fails) because starting drracket from the finder (or the dock)
;; under mac os x generally does not get the path right.
(define dot-paths
'("/usr/bin"
"/bin"
"/usr/local/bin"
"/opt/local/bin/"))
(define dot.exe (if (eq? (system-type) 'windows) "dot.exe" "dot"))
(define dot
(with-handlers ([(lambda (e) ; may not have permission
(and (exn:fail? e)
(regexp-match "access denied" (exn-message e))))
(lambda _ #f)])
(or (find-executable-path dot.exe)
(ormap (λ (x)
(define candidate (build-path x dot.exe))
(and (file-exists? candidate) candidate))
dot-paths))))
(define-syntax-rule (with-output-to-dot output-file body ...)
(cond
[dot
(match-define (list from-dot to-dot pid from-dot-err _)
(process* dot "-Tpdf" (format "-o~a" output-file)))
(parameterize ([current-output-port to-dot])
body ...)
(close-output-port to-dot)]
[else
(error 'contract-profile "graphviz installation not found")]))
|