Skip to content

Commit bfdc593

Browse files
committed
This commit implements changes discussed in issue #1
1 parent d1974e9 commit bfdc593

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

graphviz_swish.pl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
%%% Plotting terms as trees using Graphviz %%%
22

33
term_list_linear(false). % change to true for plotting lists linearly
4+
:- dynamic write_to_file/1.
5+
write_to_file(false). % write the dot structure to a file?
46

57
term(Term,Dot) :-
68
gv_start('term.dot'),
@@ -83,6 +85,7 @@
8385
prove_d(B,Goal,N1,D1).
8486

8587
resolve(A,true) :-
88+
write_to_file(true),
8689
predicate_property(A,built_in),!,
8790
call(A).
8891
resolve(A,B):-
@@ -153,7 +156,7 @@
153156
% open file and start new graph
154157
gv_start(FileName) :-
155158
retractall('$my_assert'(_)),
156-
tell(FileName),
159+
(write_to_file(true) -> tell(FileName); true),
157160
writes(['digraph {']),
158161
%writes(['graph [size="4,6"];']),
159162
writes(['node [shape=plaintext, fontname=Courier, fontsize=12]']).
@@ -167,7 +170,7 @@
167170
% finish graph and close file
168171
gv_stop(Dot) :-
169172
writes(['}']),
170-
told,
173+
(write_to_file(true) -> told; true),
171174
get_dot(Dot).
172175

173176
% start new subgraph

0 commit comments

Comments
 (0)