3 * Coroutines for Mac OS X
5 * Created by Jens Alfke on 4/29/08.
6 * Adapted from Steve Dekorte's libCoroutine:
7 * <http://www.dekorte.com/projects/opensource/libCoroutine/>
8 * by putting it on a piece of wood and banging a few nails through it.
9 * No, actually I removed all the stuff for cross-platform support, leaving only the simple
10 * code that works on Mac OS X 10.5, and then cleaned things up a bit.
12 * Copyright 2008 Jens Alfke. All rights reserved.
13 * Copyright (c) 2002, 2003 Steve Dekorte. All rights reserved.
14 * License is at the bottom of CoroX.c.
22 /** C coroutine implementation for Mac OS X.
23 Based on, and API-compatible with, Steve Dekorte's libCoroutine.
24 His docs are at http://www.dekorte.com/projects/opensource/libCoroutine/docs/
31 typedef struct Coro Coro;
34 void Coro_free(Coro *self);
38 void *Coro_stack(Coro *self);
39 size_t Coro_stackSize(Coro *self);
40 void Coro_setStackSize_(Coro *self, size_t sizeInBytes);
41 size_t Coro_bytesLeftOnStack(Coro *self);
42 int Coro_stackSpaceAlmostGone(Coro *self);
46 void Coro_initializeMainCoro(Coro *self);
48 typedef void (CoroStartCallback)(void *);
50 void Coro_startCoro_(Coro *self, Coro *other, void *context, CoroStartCallback *callback);
54 void Coro_switchTo_(Coro *self, Coro *next);