35 fprintf(stream,
"%sThe argument state machine descriptor is NULL\n", prefix);
58 if (smDesc->
esmDesc[i] != NULL) {
75 fprintf(stream,
"\n");
76 fprintf(stream,
"%sSTATE MACHINE SIZE\n", prefix);
77 fprintf(stream,
"%s------------------\n", prefix);
78 fprintf(stream,
"%sDeclared number of states : %d\n", prefix, smDesc->
smBase->
nOfPStates);
79 fprintf(stream,
"%sDeclared number of choice pseudo-states: %d\n", prefix, smDesc->
smBase->
nOfCStates);
80 fprintf(stream,
"%sDeclared number of transitions : %d\n", prefix, smDesc->
smBase->
nOfTrans);
81 fprintf(stream,
"%sDeclared number of actions : %d\n", prefix, smDesc->
nOfActions - 1);
82 fprintf(stream,
"%sDeclared number of guards : %d\n", prefix, smDesc->
nOfGuards - 1);
83 fprintf(stream,
"\n");
85 fprintf(stream,
"%sSTATE MACHINE CONFIGURATION\n", prefix);
86 fprintf(stream,
"%s---------------------------\n", prefix);
88 fprintf(stream,
"%sThe SM Execution Counter is : %u\n", prefix, smDesc->
smExecCnt);
89 fprintf(stream,
"%sThe State Execution Counter is : %u\n", prefix, smDesc->
stateExecCnt);
91 fprintf(stream,
"%sNumber of configured states : %d\n", prefix, actNOfPStates);
92 fprintf(stream,
"%sNumber of configured choice pseudo-states: %d\n", prefix, actNOfCStates);
93 fprintf(stream,
"%sNumber of configured transitions : %d\n", prefix, actNOfTrans);
94 fprintf(stream,
"%sNumber of configured actions : %d\n", prefix, actNOfActions - 1);
95 fprintf(stream,
"%sNumber of configured guards : %d\n", prefix, actNOfGuards - 1);
96 fprintf(stream,
"%sNumber of embedded state machines : %d\n", prefix, actNOfEsm);
98 fprintf(stream,
"%sCurrent state machine state is : STOPPED\n", prefix);
101 fprintf(stream,
"%sState machine is STARTED and is in state : %d\n", prefix,
FwSmGetCurState(smDesc));
103 fprintf(stream,
"\n");
105 fprintf(stream,
"%sCONFIGURATION OF INITIAL PSEUDO STATE\n", prefix);
106 fprintf(stream,
"%s-------------------------------------\n", prefix);
109 fprintf(stream,
"%sThe transition from the initial pseudo-state is not defined\n", prefix);
113 fprintf(stream,
"%sThe transition from the initial pseudo state is to state n. %d\n", prefix,
117 fprintf(stream,
"%sThe transition from the initial pseudo state is to choice pseudo-state n. %d\n", prefix,
121 fprintf(stream,
"%sThe transition from the initial pseudo state is to the final pseudo-state.\n", prefix);
128 fprintf(stream,
"\tNo Transition Action\n");
131 fprintf(stream,
"\tNo Transition Guard\n");
133 fprintf(stream,
"\n");
136 fprintf(stream,
"%sCONFIGURATION OF STATES\n", prefix);
137 fprintf(stream,
"%s-----------------------\n", prefix);
142 fprintf(stream,
"%sState %d is not defined\n", prefix, i + 1);
145 fprintf(stream,
"%sState %d:\n", prefix, i + 1);
151 fprintf(stream,
"\tNo entry action\n");
158 fprintf(stream,
"\tNo do-action\n");
165 fprintf(stream,
"\tNo exit action\n");
168 if (smDesc->
esmDesc[i] == NULL) {
169 fprintf(stream,
"\tNo state machine is embedded in this state\n");
172 fprintf(stream,
"\tA state machine is embedded in this state\n");
179 if (trans.
dest > 0) {
180 fprintf(stream,
"\t'Execute' transition to state %d\n", trans.
dest);
182 else if (trans.
dest < 0) {
183 fprintf(stream,
"\t'Execute' transition to choice pseudo-state %d\n", -trans.
dest);
186 fprintf(stream,
"\t'Execute' transition to final pseudo-state\n");
190 if (trans.
dest > 0) {
191 fprintf(stream,
"\tTransition %d to state %d\n", trans.
id, trans.
dest);
193 else if (trans.
dest < 0) {
194 fprintf(stream,
"\tTransition %d to choice pseudo-state %d\n", trans.
id, -trans.
dest);
197 fprintf(stream,
"\tTransition %d to final pseudo-state\n", trans.
id);
202 fprintf(stream,
"\t\tTransition Action is action n. %d\n", trans.
iTrAction);
205 fprintf(stream,
"\t\tNo Transition Action\n");
209 fprintf(stream,
"\t\tTransition Guard is guard n. %d\n", trans.
iTrGuard);
212 fprintf(stream,
"\t\tNo Transition Guard\n");
217 fprintf(stream,
"\n");
220 fprintf(stream,
"%sCONFIGURATION OF CHOICE PSEUDO-STATES\n", prefix);
221 fprintf(stream,
"%s-------------------------------------\n", prefix);
226 fprintf(stream,
"%sChoice Pseudo-State %d is not defined\n", prefix, i + 1);
229 fprintf(stream,
"%sChoice Pseudo-State %d:\n", prefix, i + 1);
234 fprintf(stream,
"\tTransition to state %d\n", smDesc->
smBase->
trans[j].
dest);
237 fprintf(stream,
"\tTransition to choice pseudo-state %d (this is an illegal transition)\n",
241 fprintf(stream,
"\tTransition to final pseudo-state\n");
248 fprintf(stream,
"\t\tNo Transition Action\n");
255 fprintf(stream,
"\t\tNo Transition Guard\n");
271 if (NULL != embDesc) {
283 return "smOutOfMemory";
285 return "smNullPState";
287 return "smNullCState";
289 return "smNullTrans";
291 return "smConfigErr";
293 return "smIllStateId";
295 return "smIllChoiceId";
297 return "smStateIdInUse";
299 return "smChoiceIdInUse";
301 return "smUndefinedTransSrc";
303 return "smIllegalPDest";
305 return "smIllegalCDest";
307 return "smIllNOfOutTrans";
309 return "smIllTransSrc";
313 return "smTooManyTrans";
315 return "smTooManyOutTrans";
317 return "smTooManyActions";
319 return "smTooManyGuards";
321 return "smTooFewActions";
323 return "smTooFewGuards";
325 return "smNegOutTrans";
327 return "smUndefAction";
329 return "smUndefGuard";
331 return "smNotDerivedSM";
333 return "smEsmDefined";
335 return "smWrongNOfActions";
337 return "smWrongNOfGuards";
339 return "invalid error code";
A choice pseudo-state is added to a state machine with an illegal (out-of-range) identifier.
FwSmCounterS1_t outTransIndex
index of first out-going transition in transition array of SmBaseDesc_t
#define FW_TR_EXECUTE
Identifier of "Execute" transition in a state machine.
FwSmCounterS1_t dest
the index of the destination of the transition
FwSmCounterS1_t nOfOutTrans
number of outgoing transitions from the choice pseudo-state
FwSmCounterS1_t iTrGuard
the index of the guard associated to the transition
A transition from a certain source (either a state or a choice pseudo-state) is added to a state mach...
FwSmErrCode_t
Error codes and function return codes for the state machine functions.
FwSmBool_t FwSmIsStarted(FwSmDesc_t smDesc)
Check whether the state machine is started.
There is an undefined transition in a state machine.
There is an undefined state in a state machine.
There is an undefined choice pseudo-state in a state machine.
FwSmCounterS1_t nOfActions
the number of actions (state actions + transition actions) in the state machine
A configuration error has been detected during the state machine configuration process.
FwSmAction_t * smActions
the state machine actions (state and transition actions)
FwSmCounterS1_t iDoAction
the do action for the state
An error was encountered while executing a transition in a state machine (see FwSmMakeTrans).
The number of actions added to the state machine is smaller than the number of actions declared when ...
Declaration of the configuration interface for a FW State Machine.
FwSmCounterS1_t nOfPStates
the number of states in the state machine
A choice pseudo-state is added to a state machine with less than 1 out-going transitions.
A transition is added to a state machine with a source (either a state or a choice pseudo-state) whic...
SmCState_t * cStates
array holding the choice pseudo-states in the state machine
The number of guards added to the state machine exceeds the number of guards declared when the state ...
The number of guards in the base state machine is not the same as in the derived state machine...
The number of actions added to the state machine exceeds the number of actions declared when the stat...
FwSmCounterU2_t id
the identifier (the "name") of the transition
FwSmErrCode_t errCode
either 'success' or the code of the last error encountered by the state machine
The state machine where an action or a guard is overridden or a state machine is embedded is not a de...
FwSmCounterS1_t outTransIndex
index of first out-going transition in the transition array of SmBaseDesc_t
struct FwSmDesc ** esmDesc
the state machines embedded in the state machine
A transition is added to a state machine with an illegal (out-of-range) choice pseudo-state destinati...
FwSmCounterS1_t nOfCStates
the number of choice pseudo-states in the state machine
FwSmCounterU3_t smExecCnt
the state machine execution counter
FwSmCounterS1_t nOfOutTrans
number of outgoing transitions
A state is added with a negative number of outgoing transitions.
FwSmDesc_t FwSmGetEmbSm(FwSmDesc_t smDesc, FwSmCounterS1_t i)
Return the state machine embedded in the i-th state of the argument state machine.
The overridden guard in a derived state machine does not exist.
void FwSmPrintConfigRec(FwSmDesc_t smDesc, FILE *stream)
Print the configuration of the state machine and its embedded state machines to an output stream...
FwSmCounterS1_t nOfTrans
the number of transitions in SM
Structure representing a transition.
Structure representing a state machine descriptor.
A choice pseudo-state is added twice to the same state machine.
FwSmCounterS1_t FwSmGetCurState(FwSmDesc_t smDesc)
Return the identifier of the current state in a state machine (or zero if the state machine is stoppe...
A transition is added to a state machine with an illegal (out-of-range) state destination.
FwSmCounterU3_t stateExecCnt
the state execution counter
FwSmErrCode_t FwSmCheck(FwSmDesc_t smDesc)
Check the correctness and completeness of the configuration of a state machine descriptor.
FwSmCounterS1_t iExitAction
the exit action for the state
void FwSmPrintConfig(FwSmDesc_t smDesc, FILE *stream)
Print the configuration of the state machine to an output stream.
FwSmCounterS1_t iTrAction
the index of the action associated to the transition
FwSmCounterS1_t nOfGuards
the number of guards in the state machine
FwSmGuard_t * smGuards
the transition guards in the state machine
A state is added twice to the same state machine.
A call to malloc has failed (it has returned a NULL pointer).
SmPState_t * pStates
array holding the proper states in the state machine
char * FwSmPrintErrCode(FwSmErrCode_t errCode)
Print the name of a state machine error code.
SmBaseDesc_t * smBase
pointer to the base descriptor
A transition is added to a state machine with a source which has an illegal identifier.
The number of guards added to the state machine is smaller than the number of guards declared when th...
The overridden action in a derived state machine does not exist.
Return codes of a function which has completed execution without errors.
Declaration of the auxiliary interface for a FW State Machine.
The state in a derived state machine to which an embedded state machine is added already holds an emb...
signed char FwSmCounterS1_t
Type used for signed counters with a "short" range.
A state or choice pseudo-state is added to a state machine which has more out-going transitions than ...
The number of actions in the base state machine is not the same as in the derived state machine...
FwSmCounterS1_t iEntryAction
the entry action for the state
Declaration of the internal data structures of the FW State Machine Module.
SmTrans_t * trans
array holding the transitions in the state machine
A state is added to a state machine with an illegal (out-of-range) identifier.