(Trivial) print newlines in graphviz output for debugging

master
y5nw 2021-08-23 18:04:00 +02:00
parent 1728978923
commit e5197b2f50
2 changed files with 3 additions and 2 deletions

View File

@ -104,7 +104,7 @@
(ywsw:safe-graphviz-route
graph-ilroutes ("/graph/ilroutes" :method :get) ()
("Return a simple graph of TCBs and available routes")
(format nil "digraph{~{\"~a\"->\"~a\";~}}"
(format nil "digraph{~%~{\"~a\"->\"~a\";~%~}}"
(loop for pos being the hash-keys of (atil:ildb-tcbs *ildb*)
using (hash-value tcb)
append (loop with side = (atil:make-tcbside :pos pos :side 0)

View File

@ -116,12 +116,13 @@
(defun gvdump (tdb)
(with-output-to-string (stream)
(princ "digraph{" stream)
(write-char #\Newline stream)
(loop for pos being the hash-keys of tdb using (hash-value track)
for connections = (track-connects track) do
(loop for i from 0 to 15 for connects = (aref connections i)
for trackside = (make-trackside :pos pos :side i) do
(labels ((draw-connection (from to dist)
(format stream "\"~a\"->\"~a\"[label=\"~a\"];" from to dist)))
(format stream "\"~a\"->\"~a\"[label=\"~a\"];~%" from to dist)))
(loop for j in (cddr connects)
for target = (aref connections j)
do (draw-connection trackside (car target) (cadr target))))))