Commit a1d1a828 authored by Mathieu Hemery's avatar Mathieu Hemery
Browse files

Merge branch 'develop' into feature/Hybrid

parents 5b549e3d 1d9537b4
......@@ -34,6 +34,7 @@ commands = [
"compile_from_expression",
"compile_from_pivp",
"compile_program",
"compile_program_file",
"compile_transfer_function",
"compile_wgpac",
"continue",
......
......@@ -49,7 +49,7 @@ test(
setup(set_some_conservations),
cleanup(clear_model),
true(Conservations ==
'[0] a-a+2*a\n[1] b-b+2*b\n[2] c-c+2*c\n')
'[0] \'a-a\'+2*a\n[1] \'b-b\'+2*b\n[2] \'c-c\'+2*c\n')
]
) :-
with_output_to(atom(Conservations), command(list_conservations)).
......
......@@ -174,7 +174,7 @@ list_model_influences :-
).
prolog:error_message(not_an_influence_model) -->
prolog:message(error(not_an_influence_model)) -->
['Not an influence model'].
......@@ -278,7 +278,7 @@ print_influence(_Id, Item) :-
(
Item = (Force for BasicInfluence)
->
format('~w for ', [Force])
format('~p for ', [Force])
;
BasicInfluence = Item
),
......@@ -294,15 +294,15 @@ print_influence(_Id, Item) :-
(
Inputs = (PositiveInputs / NegativeInputs)
->
format('~w / ~w', [PositiveInputs, NegativeInputs])
format('~p / ~p', [PositiveInputs, NegativeInputs])
;
Inputs = (/ NegativeInputs)
->
format('/ ~w', [NegativeInputs])
format('/ ~p', [NegativeInputs])
;
write(Inputs)
),
format(' ~w ~w', [Arrow, Output]).
format(' ~w ~p', [Arrow, Output]).
substract_list([], Difference, Difference).
......
......@@ -498,10 +498,22 @@ print_item(Id) :-
->
G
;
write(Item)
print(Item)
).
% make it so that print/1 does not quote things that look like a variable
user:portray(Thing) :-
atom(Thing),
catch(
read_term_from_atom(Thing, Term, []),
_,
fail
),
\+ compound(Term),
!,
write(Thing).
:- dynamic(deleting/1).
......@@ -635,34 +647,20 @@ inherits(Id, AncestorId) :-
).
prolog:error_message(cannot_inherit_from_itself) -->
[
'Cannot inherit from itself.'
].
prolog:message(error(cannot_inherit_from_itself)) -->
['Cannot inherit from itself.'].
prolog:error_message(already_inherits) -->
[
'There is already such an inheritance relation.'
].
prolog:message(error(already_inherits)) -->
['There is already such an inheritance relation.'].
prolog:error_message(cannot_inherit_from_descendant) -->
[
'Cannot inherit from descendant.'
].
prolog:error_message(
kind_mismatch(Ident, Kind, NeededKind)
) -->
{
format(
atom(Message),
'There is a mismatch between the uses of ~a: ~a and ~a.',
[Ident, Kind, NeededKind]
)
},
[Message].
prolog:message(error(cannot_inherit_from_descendant)) -->
['Cannot inherit from descendant.'].
prolog:message(error(kind_mismatch(Ident, Kind, NeededKind))) -->
['There is a mismatch between the uses of ~a: ~a and ~a.'-[Ident,
Kind, NeededKind]].
inherits_from(Id, AncestorId) :-
......
......@@ -50,17 +50,10 @@ check_identifier_kind(Ident, NeededKind) :-
).
prolog:error_message(
already_defined_with_another_kind(Ident, Kind, NeededKind)
prolog:message(
error(already_defined_with_another_kind(Ident, Kind, NeededKind))
) -->
{
format(
atom(Message),
'~a cannot be ~a because it is already used as ~a.',
[Ident, NeededKind, Kind]
)
},
[Message].
['~a cannot be ~a because it is already used as ~a.'-[Ident, NeededKind, Kind]].
......@@ -76,29 +69,24 @@ check_no_free_identifiers :-
->
true
;
throw(error(not_defined(FreeIdents), check_no_free_identifiers))
throw(error(not_defined(FreeIdents)))
).
prolog:error_message(not_defined(FreeIdents)) -->
prolog:message(error(not_defined(FreeIdents))) -->
{
with_output_to(
atom(Message),
(
FreeIdents = [FreeIdent]
->
format('~a is not defined.', [FreeIdent])
;
write_successes(
member(FreeIdent, FreeIdents),
write(', '),
write(FreeIdent)
),
write(' are not defined.')
)
)
findall('~a', member(_, FreeIdents), As),
atomic_list_concat(As, ', ', Format),
(
FreeIdents = [_]
->
Verb = 'is'
;
Verb = 'are'
),
atomic_list_concat([Format, Verb, 'not defined'], ' ', FullFormat)
},
[Message].
[FullFormat-FreeIdents].
update_identifier_kinds(ModelId) :-
......
......@@ -179,7 +179,7 @@ list_model_reactions :-
).
prolog:error_message(not_a_reaction_model) -->
prolog:message(error(not_a_reaction_model)) -->
['Not a reaction model'].
......
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