From 600425a55f655b470d9fb1813626ec2723e9e4b5 Mon Sep 17 00:00:00 2001 From: Emina Torlak Date: Tue, 9 May 2017 15:58:48 -0700 Subject: [PATCH] Use mrlib/graph to find dot for FSM visualization. --- sdsl/fsm/viz.rkt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sdsl/fsm/viz.rkt b/sdsl/fsm/viz.rkt index 4d9e1505..753cb703 100644 --- a/sdsl/fsm/viz.rkt +++ b/sdsl/fsm/viz.rkt @@ -1,15 +1,18 @@ #lang racket -(require racket/draw) +(require racket/draw (only-in mrlib/graph find-dot)) (provide automaton->bitmap automaton->dot) (define (automaton->bitmap a) - (define-values (p p-out p-in p-err) - (subprocess #f #f #f (find-executable-path "dot") "-Tjpeg")) - (automaton->dot a p-in) - (close-output-port p-in) - (read-bitmap p-out 'jpeg)) + (match (find-dot) + [#f a] + [dot + (define-values (p p-out p-in p-err) + (subprocess #f #f #f dot "-Tjpeg")) + (automaton->dot a p-in) + (close-output-port p-in) + (read-bitmap p-out 'jpeg)])) (define (automaton->dot a [port (current-output-port)]) (fprintf port "digraph fsm {\n")