Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current syntax of
mucalc
formulas allows checking state propositions{ s = v }
wheres
designates an entry of the state vector andv
is an integer or string value. This patch letss
refer to state labels too.When
s
is not the name of a state part, it is understood as a state label and eventually checked using theGBgetStateLabelLong
function. Syntactic sugar{ p }
has been defined for writing Boolean state labels{ p = 1 }
.The changes are:
pins2pins-mucalc.c
,mucalc_add_proposition_values
looks fors
as a state label in case the identifier is not a state variable. Thestate_idx
attribute of the proposition structure can now be either the index of an entry in the state vector or the index of a state label of the original model. Since their ranges coincide, state labels are enumerated fromctx->len
, the length of the state vector.mucalc_long
andmucalc_all
check the proposition referring to a state label (i.e.state_idx >= ctx->len
) usingGBgetStateLabelLong
.GBaddMucalc
sets the dependency matrices based on the original state-label-info matrix for those propositions using state labels instead of state variables.mucalc-grammar.lemon
,{ p }
has been defined as syntactic sugar for{ p = 1 }
.I have tested it with some examples and it works, but perhaps I have missed something, like the reason it had not been done before.