lib
Avril 3 years ago
parent 4f9278d4b7
commit 6dfb292273
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -32,6 +32,7 @@ inline sm_yield sm_continue() { return (sm_yield)_sm_noop; }
#define SM_VAR_EX(name, init) _sm_var(state, (name), (init)) //TODO: Replace `name' with (__LINE__ % _SM_STACK_SIZE) pseudo-hashmap
#define SM_VAR(init) _sm_var<__LINE__, decltype(init)>(state, (init))
#define SM_SLOT(T) _sm_var<__LINE__, T>(state, {})
#define SM_BEGIN switch(state->current->pc) { case 0:
#define SM_END } _sm_pop_stack(state); return sm_end()

@ -9,6 +9,12 @@ sm_yield sm_test(sm_state* state)
{
int* a = SM_VAR(10);
auto c = SM_SLOT(_test);
float* d = SM_SLOT(float);
*c = { 200, 300 };
*d = 10.f;
SM_BEGIN;
SM_YIELD(sm_continue());
*a = 5;

Loading…
Cancel
Save