5 #include <ccan/coroutine/coroutine.h>
8 * generator - generators for C
10 * Generators are a limited form of coroutines, which provide a useful
11 * way of expressing certain problems, while being much simpler to
12 * understand than general coroutines.
14 * Instead of returning a single value, a generator can "yield" a
15 * value at various points during its execution. Whenever it yields,
16 * the "calling" function resumes and obtains the newly yielded value
17 * to work with. When the caller asks for the next value from the
18 * generator, the generator resumes execution from the last yield and
19 * continues onto the next.
23 * #include <ccan/generator/generator.h>
25 * generator_def_static(simple_gen, int)
29 * generator_yield(17);
32 * int main(int argc, char *argv[])
34 * generator_t(int) gen = simple_gen();
37 * while ((ret = generator_next(gen)) != NULL) {
38 * printf("Generator returned %d\n", *ret);
44 * Author: David Gibson <david@gibson.dropbear.id.au>
45 * License: LGPL (v2.1 or any later version)
47 int main(int argc, char *argv[])
49 /* Expect exactly one argument */
53 if (strcmp(argv[1], "depends") == 0) {
54 printf("ccan/alignof\n");
55 printf("ccan/coroutine\n");
56 printf("ccan/cppmagic\n");
57 printf("ccan/compiler\n");
61 if (strcmp(argv[1], "ported") == 0) {
62 #if COROUTINE_AVAILABLE
66 printf("Needs coroutine support\n");
70 if (strcmp(argv[1], "testdepends") == 0) {
75 if (strcmp(argv[1], "ccanlint") == 0) {
76 /* We need several gcc extensions */
77 printf("objects_build_without_features FAIL\n");
78 printf("tests_compile_without_features FAIL\n");
79 printf("tests_helpers_compile_without_features FAIL\n");