#include <stdio.h>

#define DECLARE() int state = 0

#define BEGIN switch (state) { \
                      case 0:

#define YIELD(val) do { \
                        state = __LINE__;   \
                        return val;         \
                      case __LINE__:        \
                        ;                   \
                      } while (0)

#define END }

int next()
{
    static DECLARE();
    static int i=1;
    BEGIN;
        YIELD(++i);
        YIELD(++i);
    END;
    return 0;
}
int main()
{
    int num;
    while (num = next()) {
        printf("%d\n", num);
    }
    printf("done\n");
    return 0;
}