diff options
| author | tylov <[email protected]> | 2023-07-30 22:46:33 +0200 |
|---|---|---|
| committer | tylov <[email protected]> | 2023-07-30 22:46:33 +0200 |
| commit | e6003c0ecfd7e76803bac7d98feca814997e8a86 (patch) | |
| tree | b63ce2c6886af2a1e396f98566902e562e830bd8 /include | |
| parent | b7efd45f0b59511be7202ce0641283e8a8ff6028 (diff) | |
| download | STC-modified-e6003c0ecfd7e76803bac7d98feca814997e8a86.tar.gz STC-modified-e6003c0ecfd7e76803bac7d98feca814997e8a86.zip | |
Added cco_generator(Name, ...) macro to simplify defining the iterator struct. Updated example generator.c
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/coroutine.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/stc/coroutine.h b/include/stc/coroutine.h index 9f55dddf..7917878a 100644 --- a/include/stc/coroutine.h +++ b/include/stc/coroutine.h @@ -132,7 +132,19 @@ typedef enum { (void)((co)->cco_state = 0) /* - * Tasks (optional) + * Generators + */ + +#define cco_generator(Name, ...) \ + typedef Name Name##_value; \ + typedef struct { \ + Name##_value* ref; \ + int cco_state; \ + __VA_ARGS__ \ + } Name##_iter + +/* + * Tasks */ struct cco_runtime; |
