Commit 7a1000e0 authored by Thierry Martinez's avatar Thierry Martinez

Reaction graphs

parent 49afd4b8
...@@ -165,15 +165,6 @@ goto_level(Level) :- ...@@ -165,15 +165,6 @@ goto_level(Level) :-
). ).
indent(Doc, Level) :-
\+ (
between(0, Level, _),
\+ (
write(Doc, ' ')
)
).
increment_counter :- increment_counter :-
nb_getval(current_counters, OldCounters), nb_getval(current_counters, OldCounters),
append(HigherCounters, [LastCounter], OldCounters), append(HigherCounters, [LastCounter], OldCounters),
......
#!/bin/sh #!/bin/sh
brew install swi-prolog gsl libsbml gnuplot brew install swi-prolog gsl libsbml gnuplot graphviz
...@@ -491,10 +491,23 @@ optional(Item, List) :- ...@@ -491,10 +491,23 @@ optional(Item, List) :-
list_items(Options) :- list_items(Options) :-
all_ids(Options, Ids), all_ids(Options, Ids),
list_ids(Ids). list_ids(Options, Ids).
list_ids(Ids) :- list_ids(Ids) :-
list_ids([], Ids).
list_ids(Options, Ids) :-
optional(indent: Indent, Options),
default(Indent, 0),
(
member(recursive, Options)
->
Recursive = yes
;
Recursive = no
),
retractall(listed_item(_, _)), retractall(listed_item(_, _)),
set_counter(list_item_counter, 0), set_counter(list_item_counter, 0),
\+ ( \+ (
...@@ -503,7 +516,16 @@ list_ids(Ids) :- ...@@ -503,7 +516,16 @@ list_ids(Ids) :-
count(list_item_counter, Counter), count(list_item_counter, Counter),
assertz(listed_item(Counter, Id)), assertz(listed_item(Counter, Id)),
item(Id, _, _, Item), item(Id, _, _, Item),
format('[~d] ~w\n', [Counter, Item]) indent(Indent),
format('[~d] ~w\n', [Counter, Item]),
(
Recursive = yes
->
SubIndent is Indent + 1,
list_items([indent: SubIndent, recursive, parent: Id])
;
true
)
) )
). ).
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
list_to_equals/2, list_to_equals/2,
list/1, list/1,
nth0_eqq/3, nth0_eqq/3,
executable_filename/1 executable_filename/1,
indent/1,
indent/2
]). ]).
name_variables(L) :- name_variables(L) :-
...@@ -108,6 +110,19 @@ executable_filename(Filename) :- ...@@ -108,6 +110,19 @@ executable_filename(Filename) :-
current_prolog_flag(os_argv, [_Swipl, _X, Filename | _]). current_prolog_flag(os_argv, [_Swipl, _X, Filename | _]).
indent(Level) :-
indent(user_output, Level).
indent(Stream, Level) :-
\+ (
between(0, Level, _),
\+ (
write(Stream, ' ')
)
).
user:message_hook(_Msg, warning, _Lines) :- user:message_hook(_Msg, warning, _Lines) :-
catch( catch(
count(warnings, _), count(warnings, _),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment