You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
465 B
17 lines
465 B
#pragma once
|
|
|
|
#include "state.h"
|
|
|
|
typedef sm_yield (*sm_gen_fun)(sm_state* state); //NOTE: Same as sm_yield
|
|
|
|
// A generator method
|
|
struct sm_generator;
|
|
|
|
/// Create a generator method with this function.
|
|
sm_generator* sm_generate(sm_gen_fun function);
|
|
/// Free a generator method
|
|
void sm_free_generator(sm_generator* generator);
|
|
/// Run this generator until the next yield.
|
|
/// Returns false if the generator ends.
|
|
bool sm_next(sm_generator** gen, sm_state* state);
|