This repository has been archived on 2022-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
LEFTONE/util/statman/statman.h
falsycat 80b3b82332 [RELEASE] u22-v04
This version is submitted for U22 final presentation. (squashed 158 commits)
2021-02-07 00:00:00 +00:00

48 lines
941 B
C

#pragma once
#include <stdint.h>
typedef uint16_t statman_state_t;
typedef struct statman_meta_t statman_meta_t;
struct statman_meta_t {
statman_state_t state;
const char* name;
const void* data;
void
(*initialize)(
const statman_meta_t* meta,
void* instance,
statman_state_t* next
);
void
(*update)(
const statman_meta_t* meta,
void* instance,
statman_state_t* next
);
void
(*finalize)(
const statman_meta_t* meta,
void* instance,
statman_state_t* next
);
};
void
statman_update(
const statman_meta_t* meta,
void* instance,
statman_state_t* state
);
/* don't call in callback functions */
void
statman_transition_to(
const statman_meta_t* meta,
void* instance,
statman_state_t* state,
statman_state_t next
);