-$Id: graphviz-support.lisp,v 1.7 2005/06/21 20:51:51 moody Exp $
-
-Author: Gary King, Levente Mészáros, Attila Lendvai
+Author: Gary King, Levente Mészáros, Attila Lendvai
- (edge-formatter 'edge->dot))
- (format stream "~A G {~%graph " (if (contains-undirected-edge-p g) "graph" "digraph"))
+ (edge-formatter 'edge->dot)
+ &allow-other-keys)
+ (format stream "~A G {~%graph "
+ (if (contains-undirected-edge-p g) "graph" "digraph"))
(setf (getf (dot-attributes thing) attr) value))
(defmethod dot-attribute-value ((attr symbol) (thing dot-attributes-mixin))
(getf (dot-attributes thing) attr))
(defmacro defpixel-inch-accessors (name attr type)
(setf (getf (dot-attributes thing) attr) value))
(defmethod dot-attribute-value ((attr symbol) (thing dot-attributes-mixin))
(getf (dot-attributes thing) attr))
(defmacro defpixel-inch-accessors (name attr type)
(defmethod ,actual-name ((thing ,type))
"Return the attribute in pixels assuming 72 dpi"
(defmethod ,actual-name ((thing ,type))
"Return the attribute in pixels assuming 72 dpi"
- (awhen (dot-attribute-value ,attr thing)
- (* 72 it)))
+ (when (dot-attribute-value ,attr thing)
+ (* 72 (dot-attribute-value ,attr thing))))
(defmethod (setf ,actual-name) (value (thing ,type))
"Set the attribute in pixels assuming 72 dpi"
(defmethod (setf ,actual-name) (value (thing ,type))
"Set the attribute in pixels assuming 72 dpi"
(defpixel-inch-accessors width :width dot-vertex-mixin)
(defpixel-inch-accessors height :height dot-vertex-mixin)
(defpixel-inch-accessors width :width dot-vertex-mixin)
(defpixel-inch-accessors height :height dot-vertex-mixin)
(defmethod graph->dot-external ((g basic-graph) file-name &key (type :ps))
"Generate an external represenation of a graph to a file, by running
the program in *dot-path*."
(defmethod graph->dot-external ((g basic-graph) file-name &key (type :ps))
"Generate an external represenation of a graph to a file, by running
the program in *dot-path*."
(let ((dot-string (graph->dot g nil))
(dot-type (concatenate 'string "-T" (string-downcase (symbol-name type)))))
(let ((dot-string (graph->dot g nil))
(dot-type (concatenate 'string "-T" (string-downcase (symbol-name type)))))
#+lispworks (with-open-stream
(s (sys:open-pipe (concatenate 'string *dot-path* " -Tpng -o" file-name)
:direction :input))
#+lispworks (with-open-stream
(s (sys:open-pipe (concatenate 'string *dot-path* " -Tpng -o" file-name)
:direction :input))
(defun test-dot-external ()
(let* ((g (make-graph 'dot-graph))
(v1 (add-vertex g 'a :dot-attributes '(:shape :box
(defun test-dot-external ()
(let* ((g (make-graph 'dot-graph))
(v1 (add-vertex g 'a :dot-attributes '(:shape :box