24#ifndef __M_STATE_MACHINE_H__
25#define __M_STATE_MACHINE_H__
29#include <mstdlib/base/m_defs.h>
30#include <mstdlib/base/m_types.h>
555struct M_state_machine;
558struct M_state_machine_cleanup;
778typedef void (*
M_state_machine_trace_cb)(
M_state_machine_trace_t trace, M_uint64 mndescr,
const char *mdescr, M_uint64 sndescr,
const char *sdescr,
const char *fdescr, M_uint64 id,
M_state_machine_status_t status, M_bool run_sub, M_uint64 next_id,
void *thunk);
struct M_list_u64 M_list_u64_t
Definition: m_list_u64.h:78
M_bool M_state_machine_has_state(const M_state_machine_t *m, M_uint64 id)
void M_state_machine_reset(M_state_machine_t *m, M_state_machine_cleanup_reason_t reason)
void M_state_machine_enable_trace(M_state_machine_t *m, M_state_machine_trace_cb cb, void *thunk)
void M_state_machine_cleanup_destroy(M_state_machine_cleanup_t *m)
M_bool M_state_machine_cleanup_remove_state(M_state_machine_cleanup_t *m, M_uint64 id)
const M_list_u64_t * M_state_machine_list_states(const M_state_machine_t *m)
M_bool M_state_machine_remove_state(M_state_machine_t *m, M_uint64 id)
M_state_machine_status_t(* M_state_machine_state_cb)(void *data, M_uint64 *next)
Definition: m_state_machine.h:791
M_state_machine_cleanup_t * M_state_machine_cleanup_create(M_uint64 ndescr, const char *descr, M_uint32 flags)
M_state_machine_flags_t
Definition: m_state_machine.h:632
const char * M_state_machine_descr(const M_state_machine_t *m, M_bool recurse)
M_state_machine_status_t M_state_machine_run(M_state_machine_t *m, void *data)
M_bool(* M_state_machine_pre_cb)(void *data, M_state_machine_status_t *status, M_uint64 *next)
Definition: m_state_machine.h:821
const M_state_machine_t * M_state_machine_active_sub(const M_state_machine_t *m, M_bool recurse)
M_bool M_state_machine_cleanup_insert_sub_state_machine(M_state_machine_cleanup_t *m, M_uint64 id, M_uint64 ndescr, const char *descr, const M_state_machine_t *subm, M_state_machine_pre_cb pre, M_state_machine_post_cb post, M_state_machine_cleanup_t *cleanup, M_list_u64_t *next_ids)
M_bool M_state_machine_insert_state(M_state_machine_t *m, M_uint64 id, M_uint64 ndescr, const char *descr, M_state_machine_state_cb func, M_state_machine_cleanup_t *cleanup, M_list_u64_t *next_ids)
M_state_machine_t * M_state_machine_create(M_uint64 ndescr, const char *descr, M_uint32 flags)
void M_state_machine_cleanup_enable_trace(M_state_machine_cleanup_t *m, M_state_machine_trace_cb cb, void *thunk)
M_bool M_state_machine_cleanup_insert_state(M_state_machine_cleanup_t *m, M_uint64 id, M_uint64 ndescr, const char *descr, M_state_machine_cleanup_cb func, M_state_machine_cleanup_t *cleanup, M_list_u64_t *next_ids)
M_bool M_state_machine_cleanup_has_state(const M_state_machine_cleanup_t *m, M_uint64 id)
M_bool M_state_machine_insert_sub_state_machine(M_state_machine_t *m, M_uint64 id, M_uint64 ndescr, const char *descr, const M_state_machine_t *subm, M_state_machine_pre_cb pre, M_state_machine_post_cb post, M_state_machine_cleanup_t *cleanup, M_list_u64_t *next_ids)
M_state_machine_status_t(* M_state_machine_post_cb)(void *data, M_state_machine_status_t sub_status, M_uint64 *next)
Definition: m_state_machine.h:872
M_state_machine_trace_t
Definition: m_state_machine.h:685
M_state_machine_status_t(* M_state_machine_cleanup_cb)(void *data, M_state_machine_cleanup_reason_t reason, M_uint64 *next)
Definition: m_state_machine.h:805
M_state_machine_cleanup_reason_t
Definition: m_state_machine.h:671
const M_list_u64_t * M_state_machine_cleanup_list_states(const M_state_machine_cleanup_t *m)
M_state_machine_status_t
Definition: m_state_machine.h:565
M_state_machine_t * M_state_machine_duplicate(const M_state_machine_t *m) M_MALLOC
char * M_state_machine_descr_full(const M_state_machine_t *m, M_bool show_id)
M_bool M_state_machine_insert_sub_state_machine_interleaved(M_state_machine_t *m, M_uint64 id, const M_state_machine_t *subm)
M_uint64 M_state_machine_active_state_ndescr(const M_state_machine_t *m, M_bool recurse)
M_uint64 M_state_machine_ndescr(const M_state_machine_t *m, M_bool recurse)
struct M_state_machine M_state_machine_t
Definition: m_state_machine.h:556
M_bool M_state_machine_active_state(const M_state_machine_t *m, M_uint64 *id)
struct M_state_machine_cleanup M_state_machine_cleanup_t
Definition: m_state_machine.h:559
const char * M_state_machine_active_state_descr(const M_state_machine_t *m, M_bool recurse)
M_bool M_state_machine_cleanup_insert_cleanup_sub_state_machine(M_state_machine_cleanup_t *m, M_uint64 id, M_uint64 ndescr, const char *descr, const M_state_machine_cleanup_t *subm, M_state_machine_pre_cb pre, M_state_machine_post_cb post, M_state_machine_cleanup_t *cleanup, M_list_u64_t *next_ids)
void(* M_state_machine_trace_cb)(M_state_machine_trace_t trace, M_uint64 mndescr, const char *mdescr, M_uint64 sndescr, const char *sdescr, const char *fdescr, M_uint64 id, M_state_machine_status_t status, M_bool run_sub, M_uint64 next_id, void *thunk)
Definition: m_state_machine.h:778
M_bool M_state_machine_insert_state_interleaved(M_state_machine_t *m, M_uint64 id, M_uint64 ndescr, const char *descr, M_state_machine_pre_cb pre, M_state_machine_post_cb post, M_state_machine_cleanup_t *cleanup, M_list_u64_t *next_ids)
void M_state_machine_destroy(M_state_machine_t *m)
@ M_STATE_MACHINE_DONE_CLEANUP
Definition: m_state_machine.h:644
@ M_STATE_MACHINE_NONE
Definition: m_state_machine.h:633
@ M_STATE_MACHINE_SINGLE_PREV
Definition: m_state_machine.h:634
@ M_STATE_MACHINE_LINEAR_END
Definition: m_state_machine.h:656
@ M_STATE_MACHINE_SELF_CALL
Definition: m_state_machine.h:642
@ M_STATE_MACHINE_EXPLICIT_NEXT
Definition: m_state_machine.h:647
@ M_STATE_MACHINE_INTERNOABORT
Definition: m_state_machine.h:660
@ M_STATE_MACHINE_CONTINUE_LOOP
Definition: m_state_machine.h:636
@ M_STATE_MACHINE_ONE_CLEANUP
Definition: m_state_machine.h:645
@ M_STATE_MACHINE_TRACE_CLEANUP
Definition: m_state_machine.h:753
@ M_STATE_MACHINE_TRACE_STATE_FINISH
Definition: m_state_machine.h:707
@ M_STATE_MACHINE_TRACE_MACHINEEXIT
Definition: m_state_machine.h:692
@ M_STATE_MACHINE_TRACE_NONE
Definition: m_state_machine.h:686
@ M_STATE_MACHINE_TRACE_POST_START
Definition: m_state_machine.h:736
@ M_STATE_MACHINE_TRACE_MACHINEENTER
Definition: m_state_machine.h:687
@ M_STATE_MACHINE_TRACE_STATE_START
Definition: m_state_machine.h:698
@ M_STATE_MACHINE_TRACE_POST_FINISH
Definition: m_state_machine.h:744
@ M_STATE_MACHINE_TRACE_PRE_FINISH
Definition: m_state_machine.h:726
@ M_STATE_MACHINE_TRACE_PRE_START
Definition: m_state_machine.h:717
@ M_STATE_MACHINE_CLEANUP_REASON_CANCEL
Definition: m_state_machine.h:678
@ M_STATE_MACHINE_CLEANUP_REASON_RESET
Definition: m_state_machine.h:676
@ M_STATE_MACHINE_CLEANUP_REASON_ERROR
Definition: m_state_machine.h:675
@ M_STATE_MACHINE_CLEANUP_REASON_DONE
Definition: m_state_machine.h:674
@ M_STATE_MACHINE_CLEANUP_REASON_NONE
Definition: m_state_machine.h:672
@ M_STATE_MACHINE_STATUS_STOP_CLEANUP
Definition: m_state_machine.h:611
@ M_STATE_MACHINE_STATUS_PREV
Definition: m_state_machine.h:571
@ M_STATE_MACHINE_STATUS_ERROR_INVALID
Definition: m_state_machine.h:614
@ M_STATE_MACHINE_STATUS_WAIT
Definition: m_state_machine.h:598
@ M_STATE_MACHINE_STATUS_ERROR_INF_CONT
Definition: m_state_machine.h:627
@ M_STATE_MACHINE_STATUS_ERROR_BAD_NEXT
Definition: m_state_machine.h:621
@ M_STATE_MACHINE_STATUS_NONE
Definition: m_state_machine.h:567
@ M_STATE_MACHINE_STATUS_ERROR_NO_PREV
Definition: m_state_machine.h:625
@ M_STATE_MACHINE_STATUS_PAUSE
Definition: m_state_machine.h:601
@ M_STATE_MACHINE_STATUS_CONTINUE
Definition: m_state_machine.h:584
@ M_STATE_MACHINE_STATUS_NEXT
Definition: m_state_machine.h:568
@ M_STATE_MACHINE_STATUS_ERROR_NO_NEXT
Definition: m_state_machine.h:617
@ M_STATE_MACHINE_STATUS_ERROR_SELF_NEXT
Definition: m_state_machine.h:623
@ M_STATE_MACHINE_STATUS_ERROR_BAD_ID
Definition: m_state_machine.h:615
@ M_STATE_MACHINE_STATUS_DONE
Definition: m_state_machine.h:608
@ M_STATE_MACHINE_STATUS_ERROR_STATE
Definition: m_state_machine.h:595