# processs library for nipl typedef int (*process_func)(process *p) struct process process_func f int pc process_init(process *p, process_func f) p->f = f p->pc = 1 int resume(process *p) int rv = (*p->f)(p) if rv p->pc = rv return rv # primitives: # start is defined in sched.b define stop return 0 define yield return process_counter_next process_counter_inc process_counter . define wait p->pc = process_counter_next stop process_counter_inc process_counter . define coro(name) int name^^_f(process *p) name *d = (name *)p switch p->pc process_counter . . # ... # stop define s(foo) (d->foo)