nx_state_machine.nx
buildroot/runtime/nx_state_machine.nx
about
nx_state_machine.nx -- generic state-transition primitive.
Many primitives have sealed-state-machine shapes (nx_cell.state,
nx_yield.state, nx_treaty.state, nx_recovery.phase). This is the
shared substrate for that pattern: caller declares N states + a
transition table, gets atomic transitions + queries.
Composes with anything that has lifecycle states; useful for app-
level state machines beyond the substrate primitives.
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_crypto_event_compose_test.nxnx_state_machine_test.nx
structs
| 28 | struct NxStateMachine |
consts
| 14 | const NX_SM_OK: nx_int = 0 |
| 15 | const NX_SM_ERR_BAD_FROM: nx_int = 1 |
| 16 | const NX_SM_ERR_BAD_TO: nx_int = 2 |
| 17 | const NX_SM_ERR_BAD_TRANSITION: nx_int = 3 |
| 18 | const NX_SM_ERR_TABLE_FULL: nx_int = 4 |
functions
| 37 | func nx_state_machine_new(states_count: nx_int, initial_state: nx_int) -> *NxStateMachine |
| 70 | func nx_state_machine_allow(sm: *NxStateMachine, from: nx_int, to: nx_int) -> nx_int |
| 82 | func nx_state_machine_is_allowed(sm: *NxStateMachine, from: nx_int, to: nx_int) -> nx_int |
| 97 | func nx_state_machine_transition(sm: *NxStateMachine, to_state: nx_int) -> nx_int |
| 106 | func nx_state_machine_current(sm: *NxStateMachine) -> nx_int |
| 110 | func nx_state_machine_transitions(sm: *NxStateMachine) -> nx_int called by 1: main |
| 116 | func nx_state_machine_reset(sm: *NxStateMachine) -> nx_int called by 1: main |