/* C/C++ macros that make coroutines easy! From Simon Tathams Web page http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html How to make a function resartable: 1. #include this file 2. Put 'restartable' as the first line of the function. 3. Write 'resume(....)' where the functions returns a result 4. Put 'endrestartable' at the end of the function. Each time you call the function it will continue where it left off with the new data that you have provided.... */ #define restartable int static QS=0; switch (QS){ case 0: #define resume(e) do{ QS=__LINE__; return e; case __LINE__:;} while(0) #define endrestartable }