Files
pycapnp/capnp/async_cpp.pxd
2013-09-15 16:52:34 -07:00

31 lines
947 B
Cython

# schema.capnp.cpp.pyx
# distutils: language = c++
# distutils: extra_compile_args = --std=c++11
from cpython.ref cimport PyObject
cdef extern from "kj/exception.h" namespace " ::kj":
cdef cppclass Exception:
pass
cdef extern from "kj/async.h" namespace " ::kj":
cdef cppclass Promise[T]:
Promise(Promise)
T wait()
ctypedef Promise[PyObject *] PyPromise
cdef extern from "kj/async.h" namespace " ::kj":
cdef cppclass EventLoop:
EventLoop()
# Promise[void] yieldFrom'yield'()
object wait(PyPromise)
object there(PyPromise)
PyPromise evalLater(PyObject * func)
PyPromise there(PyPromise, PyObject * func)
cdef cppclass SimpleEventLoop(EventLoop):
pass
cdef extern from "asyncHelper.h":
PyPromise evalLater(EventLoop &, PyObject * func)
PyPromise there(EventLoop & loop, PyPromise & promise, PyObject * func, PyObject * error_func)