#| simple-header
-$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
DISCUSSION
; "GRAPHVIZ".
;
(defmethod graph->dot ((g basic-graph) (stream stream)
- &key
+ &key
(graph-formatter 'graph->dot-properties)
(vertex-key 'vertex-id)
(vertex-labeler nil)
(vertex-formatter 'vertex->dot)
- (edge-key nil)
(edge-labeler 'princ)
- (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"))
(format stream "[")
(funcall graph-formatter g stream)
(format stream "];")
(defmacro defpixel-inch-accessors (name attr type)
(bind ((actual-name (form-symbol name "-IN-PIXELS")))
`(progn
- (export ',actual-name)
+ (eval-always (export ',actual-name))
(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"
- (setf (dot-attribute-value ,attr thing) (coerce (/ value 72) 'double-float))))))
+ (setf (dot-attribute-value ,attr thing)
+ (coerce (/ value 72) 'double-float))))))
(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*."
+ (declare (ignorable file-name))
(let ((dot-string (graph->dot g nil))
(dot-type (concatenate 'string "-T" (string-downcase (symbol-name type)))))
+ (declare (ignorable dot-string dot-type))
#+lispworks (with-open-stream
(s (sys:open-pipe (concatenate 'string *dot-path* " -Tpng -o" file-name)
:direction :input))