gclass_add_ev_action()
#
Adds an event-action pair to a specific state in the finite state machine (FSM) of a GClass.
Prototype
PUBLIC int gclass_add_ev_action(
hgclass gclass,
gobj_state_t state_name,
gobj_event_t event,
gobj_action_fn action,
gobj_state_t next_state
);
Parameters
Key |
Type |
Description |
---|---|---|
|
Handle to the GClass to which the event-action pair is being added. |
|
|
The name of the state where the event-action pair will be added. |
|
|
The event that triggers the specified action. |
|
|
The function to execute when the event occurs. |
|
|
The next state to transition to after the action is executed. If no transition is required, set this to |
Return Value
0
: The event-action pair was successfully added.-1
: The event-action pair could not be added (e.g., if the state does not exist).
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples