mirror of
https://github.com/capnproto/pycapnp.git
synced 2025-03-05 17:01:01 +01:00
Fix problems compiling with gcc4.7
This commit is contained in:
parent
d8bb8206b9
commit
91c1bde833
3 changed files with 23 additions and 21 deletions
|
@ -9,7 +9,7 @@
|
||||||
cimport cython
|
cimport cython
|
||||||
cimport capnp_cpp as capnp
|
cimport capnp_cpp as capnp
|
||||||
cimport schema_cpp
|
cimport schema_cpp
|
||||||
from capnp_cpp cimport Schema as C_Schema, StructSchema as C_StructSchema, InterfaceSchema as C_InterfaceSchema, DynamicStruct as C_DynamicStruct, DynamicValue as C_DynamicValue, Type as C_Type, DynamicList as C_DynamicList, fixMaybe, getEnumString, SchemaParser as C_SchemaParser, ParsedSchema as C_ParsedSchema, VOID, ArrayPtr, StringPtr, String, StringTree, DynamicOrphan as C_DynamicOrphan, ObjectPointer as C_DynamicObject, WordArrayPtr, DynamicCapability as C_DynamicCapability, new_client, new_server, Request, Response, RemotePromise, convert_to_pypromise, SimpleEventLoop, PyPromise, VoidPromise, CallContext
|
from capnp_cpp cimport Schema as C_Schema, StructSchema as C_StructSchema, InterfaceSchema as C_InterfaceSchema, DynamicStruct as C_DynamicStruct, DynamicValue as C_DynamicValue, Type as C_Type, DynamicList as C_DynamicList, fixMaybe, getEnumString, SchemaParser as C_SchemaParser, ParsedSchema as C_ParsedSchema, VOID, ArrayPtr, StringPtr, String, StringTree, DynamicOrphan as C_DynamicOrphan, ObjectPointer as C_DynamicObject, DynamicCapability as C_DynamicCapability, new_client, new_server, Request, Response, RemotePromise, convert_to_pypromise, SimpleEventLoop, PyPromise, VoidPromise, CallContext
|
||||||
|
|
||||||
from schema_cpp cimport Node as C_Node, EnumNode as C_EnumNode
|
from schema_cpp cimport Node as C_Node, EnumNode as C_EnumNode
|
||||||
from cython.operator cimport dereference as deref
|
from cython.operator cimport dereference as deref
|
||||||
|
@ -1720,7 +1720,7 @@ cdef class _FlatArrayMessageReader(_MessageReader):
|
||||||
if sz % 8 != 0:
|
if sz % 8 != 0:
|
||||||
raise ValueError("input length must be a multiple of eight bytes")
|
raise ValueError("input length must be a multiple of eight bytes")
|
||||||
self._object_to_pin = buf
|
self._object_to_pin = buf
|
||||||
self.thisptr = new schema_cpp.FlatArrayMessageReader(capnp.WordArrayPtr(<capnp.word*>ptr, sz//8))
|
self.thisptr = new schema_cpp.FlatArrayMessageReader(schema_cpp.WordArrayPtr(<schema_cpp.word*>ptr, sz//8))
|
||||||
|
|
||||||
def _write_message_to_fd(int fd, _MessageBuilder message):
|
def _write_message_to_fd(int fd, _MessageBuilder message):
|
||||||
"""Serialize a Cap'n Proto message to a file descriptor
|
"""Serialize a Cap'n Proto message to a file descriptor
|
||||||
|
|
|
@ -12,8 +12,6 @@ from libcpp cimport bool as cbool
|
||||||
cdef extern from "capnp/common.h" namespace " ::capnp":
|
cdef extern from "capnp/common.h" namespace " ::capnp":
|
||||||
enum Void:
|
enum Void:
|
||||||
VOID " ::capnp::VOID"
|
VOID " ::capnp::VOID"
|
||||||
cdef cppclass word:
|
|
||||||
pass
|
|
||||||
|
|
||||||
cdef extern from "kj/exception.h" namespace " ::kj":
|
cdef extern from "kj/exception.h" namespace " ::kj":
|
||||||
cdef cppclass Exception:
|
cdef cppclass Exception:
|
||||||
|
@ -38,23 +36,11 @@ cdef extern from "kj/common.h" namespace " ::kj":
|
||||||
size_t size()
|
size_t size()
|
||||||
T& operator[](size_t index)
|
T& operator[](size_t index)
|
||||||
|
|
||||||
# Cython can't handle ArrayPtr[word] as a function argument
|
|
||||||
cdef cppclass WordArrayPtr "::kj::ArrayPtr<::capnp::word>":
|
|
||||||
WordArrayPtr()
|
|
||||||
WordArrayPtr(word *, size_t size)
|
|
||||||
size_t size()
|
|
||||||
word& operator[](size_t index)
|
|
||||||
|
|
||||||
cdef extern from "kj/array.h" namespace " ::kj":
|
cdef extern from "kj/array.h" namespace " ::kj":
|
||||||
cdef cppclass Array[T]:
|
cdef cppclass Array[T]:
|
||||||
T* begin()
|
T* begin()
|
||||||
size_t size()
|
size_t size()
|
||||||
|
|
||||||
# Cython can't handle Array[word] as a function argument
|
|
||||||
cdef cppclass WordArray "::kj::Array<::capnp::word>":
|
|
||||||
word* begin()
|
|
||||||
size_t size()
|
|
||||||
|
|
||||||
cdef extern from "capnp/schema.h" namespace " ::capnp":
|
cdef extern from "capnp/schema.h" namespace " ::capnp":
|
||||||
cdef cppclass Schema:
|
cdef cppclass Schema:
|
||||||
Node.Reader getProto() except +
|
Node.Reader getProto() except +
|
||||||
|
@ -194,7 +180,6 @@ cdef extern from "fixMaybe.h":
|
||||||
char * getEnumString(DynamicStruct.Builder val)
|
char * getEnumString(DynamicStruct.Builder val)
|
||||||
char * getEnumString(Request val)
|
char * getEnumString(Request val)
|
||||||
|
|
||||||
|
|
||||||
cdef extern from "capabilityHelper.h":
|
cdef extern from "capabilityHelper.h":
|
||||||
PyPromise evalLater(EventLoop &, PyObject * func)
|
PyPromise evalLater(EventLoop &, PyObject * func)
|
||||||
PyPromise there(EventLoop & loop, PyPromise & promise, PyObject * func, PyObject * error_func)
|
PyPromise there(EventLoop & loop, PyPromise & promise, PyObject * func, PyObject * error_func)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
from libc.stdint cimport *
|
from libc.stdint cimport *
|
||||||
from capnp_cpp cimport DynamicOrphan
|
from capnp_cpp cimport DynamicOrphan
|
||||||
cimport capnp_cpp
|
|
||||||
ctypedef unsigned int uint
|
ctypedef unsigned int uint
|
||||||
ctypedef uint8_t UInt8
|
ctypedef uint8_t UInt8
|
||||||
ctypedef uint16_t UInt16
|
ctypedef uint16_t UInt16
|
||||||
|
@ -691,18 +690,36 @@ cdef extern from "capnp/message.h" namespace " ::capnp":
|
||||||
enum Void:
|
enum Void:
|
||||||
VOID
|
VOID
|
||||||
|
|
||||||
|
cdef extern from "capnp/common.h" namespace " ::capnp":
|
||||||
|
cdef cppclass word:
|
||||||
|
pass
|
||||||
|
|
||||||
|
cdef extern from "kj/common.h" namespace " ::kj":
|
||||||
|
# Cython can't handle ArrayPtr[word] as a function argument
|
||||||
|
cdef cppclass WordArrayPtr " ::kj::ArrayPtr< ::capnp::word>":
|
||||||
|
WordArrayPtr()
|
||||||
|
WordArrayPtr(word *, size_t size)
|
||||||
|
size_t size()
|
||||||
|
word& operator[](size_t index)
|
||||||
|
|
||||||
|
cdef extern from "kj/array.h" namespace " ::kj":
|
||||||
|
# Cython can't handle Array[word] as a function argument
|
||||||
|
cdef cppclass WordArray " ::kj::Array< ::capnp::word>":
|
||||||
|
word* begin()
|
||||||
|
size_t size()
|
||||||
|
|
||||||
cdef extern from "capnp/serialize.h" namespace " ::capnp":
|
cdef extern from "capnp/serialize.h" namespace " ::capnp":
|
||||||
cdef cppclass StreamFdMessageReader(MessageReader):
|
cdef cppclass StreamFdMessageReader(MessageReader):
|
||||||
StreamFdMessageReader(int) except +
|
StreamFdMessageReader(int) except +
|
||||||
StreamFdMessageReader(int, ReaderOptions) except +
|
StreamFdMessageReader(int, ReaderOptions) except +
|
||||||
|
|
||||||
cdef cppclass FlatArrayMessageReader(MessageReader):
|
cdef cppclass FlatArrayMessageReader(MessageReader):
|
||||||
FlatArrayMessageReader(capnp_cpp.WordArrayPtr array) except +
|
FlatArrayMessageReader(WordArrayPtr array) except +
|
||||||
FlatArrayMessageReader(capnp_cpp.WordArrayPtr array, ReaderOptions) except +
|
FlatArrayMessageReader(WordArrayPtr array, ReaderOptions) except +
|
||||||
|
|
||||||
void writeMessageToFd(int, MessageBuilder&) except +
|
void writeMessageToFd(int, MessageBuilder&) except +
|
||||||
|
|
||||||
capnp_cpp.WordArray messageToFlatArray(MessageBuilder &)
|
WordArray messageToFlatArray(MessageBuilder &)
|
||||||
|
|
||||||
cdef extern from "capnp/serialize-packed.h" namespace " ::capnp":
|
cdef extern from "capnp/serialize-packed.h" namespace " ::capnp":
|
||||||
cdef cppclass PackedFdMessageReader(MessageReader):
|
cdef cppclass PackedFdMessageReader(MessageReader):
|
||||||
|
|
Loading…
Add table
Reference in a new issue