On Thu, Aug 14, 2025 at 05:08:02PM +0200, Gabriele Monaco wrote:
> + def fill_constr_func(self) -> list[str]:
> + buff = []
> + if self.constraints:
> + buff.append(
> +"""/*
> + * This function is used to validate state transitions.
> + *
> + * It is generated by parsing the model, there is usually no need to change
> it,
> + * unless conditions were incorrectly specified
If the conditions were incorrectly specified, then they should be fixed in
the automaton, not fixed in this generated C code.
> or too complex for the parser.
Do you have examples of these "too complex" cases? Is there a plan to
handle them?
> + * If the monitor requires a timer, this function is responsible to arm it
> when
> + * the next state has a constraint and cancel it in any other case.
> Transitions
> + * to the same state never affect timers.
> + */
> +static bool ha_verify_constraint(struct ha_monitor *ha_mon,
> +\t\t\t\t enum %s curr_state, enum %s event,
> +\t\t\t\t enum %s next_state)
> +{
> +\tbool res = true;
> +""" % (self.enum_states_def, self.enum_events_def, self.enum_states_def))
> + buff += self.__get_constr_condition()
> + buff += self.__get_state_constr_condition()
> + buff.append("""\treturn res;
> +}\n""")
> + return buff
Nam