Make Text and Data fields readable
This commit is contained in:
@@ -14,13 +14,24 @@ ctypedef int16_t Int16
|
|||||||
ctypedef int32_t Int32
|
ctypedef int32_t Int32
|
||||||
ctypedef int64_t Int64
|
ctypedef int64_t Int64
|
||||||
|
|
||||||
ctypedef char * Data
|
|
||||||
ctypedef char * Object
|
ctypedef char * Object
|
||||||
ctypedef char * Text
|
|
||||||
ctypedef bint Bool
|
ctypedef bint Bool
|
||||||
ctypedef float Float32
|
ctypedef float Float32
|
||||||
ctypedef double Float64
|
ctypedef double Float64
|
||||||
|
|
||||||
|
cdef extern from "capnp/blob.h" namespace "::capnp":
|
||||||
|
cdef cppclass Data:
|
||||||
|
cppclass Reader:
|
||||||
|
char * begin()
|
||||||
|
size_t size()
|
||||||
|
cppclass Builder:
|
||||||
|
char * begin()
|
||||||
|
size_t size()
|
||||||
|
cdef cppclass Text:
|
||||||
|
cppclass Reader:
|
||||||
|
char * cStr()
|
||||||
|
cppclass Builder:
|
||||||
|
char * cStr()
|
||||||
cdef extern from "capnp/message.h" namespace "::capnp":
|
cdef extern from "capnp/message.h" namespace "::capnp":
|
||||||
cdef cppclass List[T]:
|
cdef cppclass List[T]:
|
||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
@@ -60,12 +71,12 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
{{'int which()' if node_dict['body'] == 'union'}}
|
{{'int which()' if node_dict['body'] == 'union'}}
|
||||||
{%- for member_name, member_dict in node_dict['members'].items() %}
|
{%- for member_name, member_dict in node_dict['members'].items() %}
|
||||||
{{member_dict['type']}}{{'.Reader' if member_dict.get('type', '').startswith('List') }} get{{member_name|capitalize}}()
|
{{member_dict['type']}}{{'.Reader' if member_dict.get('type', '').startswith('List') or member_dict.get('type', '') in ['Text', 'Data'] }} get{{member_name|capitalize}}()
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
cppclass Builder:
|
cppclass Builder:
|
||||||
{{'int which()' if node_dict['body'] == 'union'}}
|
{{'int which()' if node_dict['body'] == 'union'}}
|
||||||
{%- for member_name, member_dict in node_dict['members'].items() %}
|
{%- for member_name, member_dict in node_dict['members'].items() %}
|
||||||
{{member_dict['type']}}{{'.Builder' if member_dict.get('type', '').startswith('List') }} get{{member_name|capitalize}}()
|
{{member_dict['type']}}{{'.Builder' if member_dict.get('type', '').startswith('List') or member_dict.get('type', '') in ['Text', 'Data'] }} get{{member_name|capitalize}}()
|
||||||
{%- if member_dict.get('type', '').startswith('List') %}
|
{%- if member_dict.get('type', '').startswith('List') %}
|
||||||
{{member_dict['type']}}.Builder init{{member_name|capitalize}}(int)
|
{{member_dict['type']}}.Builder init{{member_name|capitalize}}(int)
|
||||||
{%- else %}
|
{%- else %}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
# distutils: extra_compile_args = --std=c++11
|
# distutils: extra_compile_args = --std=c++11
|
||||||
# distutils: libraries = capnp
|
# distutils: libraries = capnp
|
||||||
|
|
||||||
cimport capnp_schema as capnp
|
cimport schema_cpp as capnp
|
||||||
from capnp_schema cimport {% for node_name, node_dict in nodes.items() %}{% if node_dict['body'] != 'enum' %}{{node_name|capitalize}} as C_{{node_name|capitalize}}{{',' if not loop.last}}{%- endif %}{% endfor %}
|
from schema_cpp cimport {% for node_name, node_dict in nodes.items() %}{% if node_dict['body'] != 'enum' %}{{node_name|capitalize}} as C_{{node_name|capitalize}}{{',' if not loop.last}}{%- endif %}{% endfor %}
|
||||||
from capnp_schema cimport {% for node_dict in enum_types %}{%- for member_name, member_dict in node_dict['members'].items() %}{{node_dict['full_name_cython']}}_{{member_name}}{{',' if not loop.last}}{%- endfor %}{{',' if not loop.last}}{%- endfor %}
|
from schema_cpp cimport {% for node_dict in enum_types %}{%- for member_name, member_dict in node_dict['members'].items() %}{{node_dict['full_name_cython']}}_{{member_name}}{{',' if not loop.last}}{%- endfor %}{{',' if not loop.last}}{%- endfor %}
|
||||||
from capnp_schema cimport {% for node_dict in union_types %}{%- for member_name, member_dict in node_dict['members'].items() %}{{node_dict['full_name_cython']}}_{{member_name}}{{',' if not loop.last}}{%- endfor %}{{',' if not loop.last}}{% endfor %}
|
from schema_cpp cimport {% for node_dict in union_types %}{%- for member_name, member_dict in node_dict['members'].items() %}{{node_dict['full_name_cython']}}_{{member_name}}{{',' if not loop.last}}{%- endfor %}{{',' if not loop.last}}{% endfor %}
|
||||||
|
|
||||||
# from capnp_schema cimport *
|
# from schema_cpp cimport *
|
||||||
# Not doing this since we want to namespace away the class names
|
# Not doing this since we want to namespace away the class names
|
||||||
|
|
||||||
from cython.operator cimport dereference as deref
|
from cython.operator cimport dereference as deref
|
||||||
@@ -24,12 +24,16 @@ ctypedef int16_t Int16
|
|||||||
ctypedef int32_t Int32
|
ctypedef int32_t Int32
|
||||||
ctypedef int64_t Int64
|
ctypedef int64_t Int64
|
||||||
|
|
||||||
ctypedef char * Data
|
|
||||||
ctypedef char * Object
|
ctypedef char * Object
|
||||||
ctypedef char * Text
|
|
||||||
ctypedef bint Bool
|
ctypedef bint Bool
|
||||||
ctypedef float Float32
|
ctypedef float Float32
|
||||||
ctypedef double Float64
|
ctypedef double Float64
|
||||||
|
cdef extern from "capnp/blob.h" namespace "::capnp":
|
||||||
|
cdef cppclass Data:
|
||||||
|
char * begin()
|
||||||
|
size_t size()
|
||||||
|
cdef cppclass Text:
|
||||||
|
char * cStr()
|
||||||
cdef extern from "capnp/message.h" namespace "::capnp":
|
cdef extern from "capnp/message.h" namespace "::capnp":
|
||||||
cdef cppclass List[T]:
|
cdef cppclass List[T]:
|
||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
@@ -104,6 +108,11 @@ cdef class {{ node_dict['full_name_cython'] }}Reader:
|
|||||||
return self.thisptr.get{{member_name|capitalize}}()
|
return self.thisptr.get{{member_name|capitalize}}()
|
||||||
{%- elif member_dict['type'].startswith('List[') %}
|
{%- elif member_dict['type'].startswith('List[') %}
|
||||||
return _{{ member_dict['type'] |replace('[', '_')|replace(']','_')|replace('.','_')}}Reader().init(self.thisptr.get{{member_name|capitalize}}())
|
return _{{ member_dict['type'] |replace('[', '_')|replace(']','_')|replace('.','_')}}Reader().init(self.thisptr.get{{member_name|capitalize}}())
|
||||||
|
{%- elif member_dict['type'] == 'Text' %}
|
||||||
|
return self.thisptr.get{{member_name|capitalize}}().cStr()
|
||||||
|
{%- elif member_dict['type'] == 'Data' %}
|
||||||
|
temp = self.thisptr.get{{member_name|capitalize}}()
|
||||||
|
return (<char*>temp.begin())[:temp.size()]
|
||||||
{%- elif member_dict['type'] in built_in_types %}
|
{%- elif member_dict['type'] in built_in_types %}
|
||||||
return None
|
return None
|
||||||
{%- else %}
|
{%- else %}
|
||||||
@@ -127,6 +136,11 @@ cdef class {{ node_dict['full_name_cython'] }}Builder:
|
|||||||
return self.thisptr.get{{member_name|capitalize}}()
|
return self.thisptr.get{{member_name|capitalize}}()
|
||||||
{%- elif member_dict['type'].startswith('List[') %}
|
{%- elif member_dict['type'].startswith('List[') %}
|
||||||
return _{{ member_dict['type'] |replace('[', '_')|replace(']','_')|replace('.','_')}}Builder().init(self.thisptr.get{{member_name|capitalize}}())
|
return _{{ member_dict['type'] |replace('[', '_')|replace(']','_')|replace('.','_')}}Builder().init(self.thisptr.get{{member_name|capitalize}}())
|
||||||
|
{%- elif member_dict['type'] == 'Text' %}
|
||||||
|
return self.thisptr.get{{member_name|capitalize}}().cStr()
|
||||||
|
{%- elif member_dict['type'] == 'Data' %}
|
||||||
|
temp = self.thisptr.get{{member_name|capitalize}}()
|
||||||
|
return (<char*>temp.begin())[:temp.size()]
|
||||||
{%- elif member_dict['type'] in built_in_types %}
|
{%- elif member_dict['type'] in built_in_types %}
|
||||||
return None
|
return None
|
||||||
{%- else %}
|
{%- else %}
|
||||||
@@ -178,11 +192,11 @@ cdef class MessageReader:
|
|||||||
|
|
||||||
cdef class StreamFdMessageReader(MessageReader):
|
cdef class StreamFdMessageReader(MessageReader):
|
||||||
def __cinit__(self, int fd):
|
def __cinit__(self, int fd):
|
||||||
self.thisptr = new capnp.StreamFdMessageReader(int)
|
self.thisptr = new capnp.StreamFdMessageReader(fd)
|
||||||
|
|
||||||
cdef class PackedFdMessageReader(MessageReader):
|
cdef class PackedFdMessageReader(MessageReader):
|
||||||
def __cinit__(self, int fd):
|
def __cinit__(self, int fd):
|
||||||
self.thisptr = new capnp.PackedFdMessageReader(int)
|
self.thisptr = new capnp.PackedFdMessageReader(fd)
|
||||||
|
|
||||||
def writeMessageToFd(int fd, MessageBuilder m):
|
def writeMessageToFd(int fd, MessageBuilder m):
|
||||||
capnp.writeMessageToFd(fd, deref(m.thisptr))
|
capnp.writeMessageToFd(fd, deref(m.thisptr))
|
||||||
@@ -197,6 +211,8 @@ temp = {{ node_dict['full_name'] }} = ModuleType('{{ node_dict['full_name'] }}')
|
|||||||
{%- if node_dict['body'] != 'enum' %}
|
{%- if node_dict['body'] != 'enum' %}
|
||||||
temp.Reader = {{ node_dict['full_name_cython'] }}Reader
|
temp.Reader = {{ node_dict['full_name_cython'] }}Reader
|
||||||
temp.Builder = {{ node_dict['full_name_cython'] }}Builder
|
temp.Builder = {{ node_dict['full_name_cython'] }}Builder
|
||||||
|
{%- elif node_dict['body'] == 'union' %}
|
||||||
|
temp.Which = {{ node_dict['full_name_cython'] }}_Which
|
||||||
{%- else %}
|
{%- else %}
|
||||||
{{ node_dict['full_name'] }} = {{ node_dict['full_name_cython'] }}
|
{{ node_dict['full_name'] }} = {{ node_dict['full_name_cython'] }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|||||||
6603
schema.cpp
6603
schema.cpp
File diff suppressed because it is too large
Load Diff
52
schema.pyx
52
schema.pyx
@@ -8,7 +8,7 @@ from schema_cpp cimport CodeGeneratorRequest as C_CodeGeneratorRequest,Interface
|
|||||||
from schema_cpp cimport _ElementSize_inlineComposite,_ElementSize_eightBytes,_ElementSize_pointer,_ElementSize_bit,_ElementSize_twoBytes,_ElementSize_fourBytes,_ElementSize_byte,_ElementSize_empty
|
from schema_cpp cimport _ElementSize_inlineComposite,_ElementSize_eightBytes,_ElementSize_pointer,_ElementSize_bit,_ElementSize_twoBytes,_ElementSize_fourBytes,_ElementSize_byte,_ElementSize_empty
|
||||||
from schema_cpp cimport _Value_Body_uint32Value,_Value_Body_float64Value,_Value_Body_voidValue,_Value_Body_dataValue,_Value_Body_listValue,_Value_Body_int32Value,_Value_Body_enumValue,_Value_Body_int8Value,_Value_Body_boolValue,_Value_Body_int16Value,_Value_Body_float32Value,_Value_Body_interfaceValue,_Value_Body_uint16Value,_Value_Body_uint8Value,_Value_Body_int64Value,_Value_Body_structValue,_Value_Body_textValue,_Value_Body_uint64Value,_Value_Body_objectValue,_Type_Body_boolType,_Type_Body_structType,_Type_Body_int32Type,_Type_Body_voidType,_Type_Body_uint16Type,_Type_Body_dataType,_Type_Body_objectType,_Type_Body_int64Type,_Type_Body_float64Type,_Type_Body_interfaceType,_Type_Body_uint32Type,_Type_Body_uint8Type,_Type_Body_listType,_Type_Body_int8Type,_Type_Body_float32Type,_Type_Body_enumType,_Type_Body_uint64Type,_Type_Body_textType,_Type_Body_int16Type,_Node_Body_annotationNode,_Node_Body_interfaceNode,_Node_Body_enumNode,_Node_Body_structNode,_Node_Body_constNode,_Node_Body_fileNode,_StructNode_Member_Body_fieldMember,_StructNode_Member_Body_unionMember
|
from schema_cpp cimport _Value_Body_uint32Value,_Value_Body_float64Value,_Value_Body_voidValue,_Value_Body_dataValue,_Value_Body_listValue,_Value_Body_int32Value,_Value_Body_enumValue,_Value_Body_int8Value,_Value_Body_boolValue,_Value_Body_int16Value,_Value_Body_float32Value,_Value_Body_interfaceValue,_Value_Body_uint16Value,_Value_Body_uint8Value,_Value_Body_int64Value,_Value_Body_structValue,_Value_Body_textValue,_Value_Body_uint64Value,_Value_Body_objectValue,_Type_Body_boolType,_Type_Body_structType,_Type_Body_int32Type,_Type_Body_voidType,_Type_Body_uint16Type,_Type_Body_dataType,_Type_Body_objectType,_Type_Body_int64Type,_Type_Body_float64Type,_Type_Body_interfaceType,_Type_Body_uint32Type,_Type_Body_uint8Type,_Type_Body_listType,_Type_Body_int8Type,_Type_Body_float32Type,_Type_Body_enumType,_Type_Body_uint64Type,_Type_Body_textType,_Type_Body_int16Type,_Node_Body_annotationNode,_Node_Body_interfaceNode,_Node_Body_enumNode,_Node_Body_structNode,_Node_Body_constNode,_Node_Body_fileNode,_StructNode_Member_Body_fieldMember,_StructNode_Member_Body_unionMember
|
||||||
|
|
||||||
# from capnp_schema cimport *
|
# from schema_cpp cimport *
|
||||||
# Not doing this since we want to namespace away the class names
|
# Not doing this since we want to namespace away the class names
|
||||||
|
|
||||||
from cython.operator cimport dereference as deref
|
from cython.operator cimport dereference as deref
|
||||||
@@ -24,12 +24,16 @@ ctypedef int16_t Int16
|
|||||||
ctypedef int32_t Int32
|
ctypedef int32_t Int32
|
||||||
ctypedef int64_t Int64
|
ctypedef int64_t Int64
|
||||||
|
|
||||||
ctypedef char * Data
|
|
||||||
ctypedef char * Object
|
ctypedef char * Object
|
||||||
ctypedef char * Text
|
|
||||||
ctypedef bint Bool
|
ctypedef bint Bool
|
||||||
ctypedef float Float32
|
ctypedef float Float32
|
||||||
ctypedef double Float64
|
ctypedef double Float64
|
||||||
|
cdef extern from "capnp/blob.h" namespace "::capnp":
|
||||||
|
cdef cppclass Data:
|
||||||
|
char * begin()
|
||||||
|
size_t size()
|
||||||
|
cdef cppclass Text:
|
||||||
|
char * cStr()
|
||||||
cdef extern from "capnp/message.h" namespace "::capnp":
|
cdef extern from "capnp/message.h" namespace "::capnp":
|
||||||
cdef cppclass List[T]:
|
cdef cppclass List[T]:
|
||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
@@ -470,7 +474,7 @@ cdef class _InterfaceNode_Method_ParamReader:
|
|||||||
return _TypeReader().init(<C_Type.Reader>self.thisptr.getType())
|
return _TypeReader().init(<C_Type.Reader>self.thisptr.getType())
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
property annotations:
|
property annotations:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return _List_InterfaceNode_Method_Param_Annotation_Reader().init(self.thisptr.getAnnotations())
|
return _List_InterfaceNode_Method_Param_Annotation_Reader().init(self.thisptr.getAnnotations())
|
||||||
@@ -493,7 +497,7 @@ cdef class _InterfaceNode_Method_ParamBuilder:
|
|||||||
pass
|
pass
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
def __set__(self, val):
|
def __set__(self, val):
|
||||||
pass
|
pass
|
||||||
property annotations:
|
property annotations:
|
||||||
@@ -512,7 +516,7 @@ cdef class _InterfaceNode_MethodReader:
|
|||||||
return self.thisptr.getCodeOrder()
|
return self.thisptr.getCodeOrder()
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
property params:
|
property params:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return _List_InterfaceNode_Method_InterfaceNode_Method_Param_Reader().init(self.thisptr.getParams())
|
return _List_InterfaceNode_Method_InterfaceNode_Method_Param_Reader().init(self.thisptr.getParams())
|
||||||
@@ -539,7 +543,7 @@ cdef class _InterfaceNode_MethodBuilder:
|
|||||||
self.thisptr.setCodeOrder(val)
|
self.thisptr.setCodeOrder(val)
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
def __set__(self, val):
|
def __set__(self, val):
|
||||||
pass
|
pass
|
||||||
property params:
|
property params:
|
||||||
@@ -605,7 +609,8 @@ cdef class _Value_BodyReader:
|
|||||||
return None
|
return None
|
||||||
property dataValue:
|
property dataValue:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
temp = self.thisptr.getDataValue()
|
||||||
|
return (<char*>temp.begin())[:temp.size()]
|
||||||
property listValue:
|
property listValue:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return None
|
||||||
@@ -644,7 +649,7 @@ cdef class _Value_BodyReader:
|
|||||||
return None
|
return None
|
||||||
property textValue:
|
property textValue:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getTextValue().cStr()
|
||||||
property uint64Value:
|
property uint64Value:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return self.thisptr.getUint64Value()
|
return self.thisptr.getUint64Value()
|
||||||
@@ -677,7 +682,8 @@ cdef class _Value_BodyBuilder:
|
|||||||
pass
|
pass
|
||||||
property dataValue:
|
property dataValue:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
temp = self.thisptr.getDataValue()
|
||||||
|
return (<char*>temp.begin())[:temp.size()]
|
||||||
def __set__(self, val):
|
def __set__(self, val):
|
||||||
pass
|
pass
|
||||||
property listValue:
|
property listValue:
|
||||||
@@ -742,7 +748,7 @@ cdef class _Value_BodyBuilder:
|
|||||||
pass
|
pass
|
||||||
property textValue:
|
property textValue:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getTextValue().cStr()
|
||||||
def __set__(self, val):
|
def __set__(self, val):
|
||||||
pass
|
pass
|
||||||
property uint64Value:
|
property uint64Value:
|
||||||
@@ -1012,7 +1018,7 @@ cdef class _FileNode_ImportReader:
|
|||||||
return self.thisptr.getId()
|
return self.thisptr.getId()
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
|
|
||||||
cdef class _FileNode_ImportBuilder:
|
cdef class _FileNode_ImportBuilder:
|
||||||
cdef C_FileNode.Import.Builder thisptr
|
cdef C_FileNode.Import.Builder thisptr
|
||||||
@@ -1027,7 +1033,7 @@ cdef class _FileNode_ImportBuilder:
|
|||||||
self.thisptr.setId(val)
|
self.thisptr.setId(val)
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
def __set__(self, val):
|
def __set__(self, val):
|
||||||
pass
|
pass
|
||||||
cdef class _FileNodeReader:
|
cdef class _FileNodeReader:
|
||||||
@@ -1128,7 +1134,7 @@ cdef class _Node_NestedNodeReader:
|
|||||||
|
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
property id:
|
property id:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return self.thisptr.getId()
|
return self.thisptr.getId()
|
||||||
@@ -1141,7 +1147,7 @@ cdef class _Node_NestedNodeBuilder:
|
|||||||
|
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
def __set__(self, val):
|
def __set__(self, val):
|
||||||
pass
|
pass
|
||||||
property id:
|
property id:
|
||||||
@@ -1160,7 +1166,7 @@ cdef class _NodeReader:
|
|||||||
return _Node_BodyReader().init(<C_Node.Body.Reader>self.thisptr.getBody())
|
return _Node_BodyReader().init(<C_Node.Body.Reader>self.thisptr.getBody())
|
||||||
property displayName:
|
property displayName:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getDisplayName().cStr()
|
||||||
property annotations:
|
property annotations:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return _List_Node_Annotation_Reader().init(self.thisptr.getAnnotations())
|
return _List_Node_Annotation_Reader().init(self.thisptr.getAnnotations())
|
||||||
@@ -1187,7 +1193,7 @@ cdef class _NodeBuilder:
|
|||||||
pass
|
pass
|
||||||
property displayName:
|
property displayName:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getDisplayName().cStr()
|
||||||
def __set__(self, val):
|
def __set__(self, val):
|
||||||
pass
|
pass
|
||||||
property annotations:
|
property annotations:
|
||||||
@@ -1333,7 +1339,7 @@ cdef class _EnumNode_EnumerantReader:
|
|||||||
return self.thisptr.getCodeOrder()
|
return self.thisptr.getCodeOrder()
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
property annotations:
|
property annotations:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return _List_EnumNode_Enumerant_Annotation_Reader().init(self.thisptr.getAnnotations())
|
return _List_EnumNode_Enumerant_Annotation_Reader().init(self.thisptr.getAnnotations())
|
||||||
@@ -1351,7 +1357,7 @@ cdef class _EnumNode_EnumerantBuilder:
|
|||||||
self.thisptr.setCodeOrder(val)
|
self.thisptr.setCodeOrder(val)
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
def __set__(self, val):
|
def __set__(self, val):
|
||||||
pass
|
pass
|
||||||
property annotations:
|
property annotations:
|
||||||
@@ -1464,7 +1470,7 @@ cdef class _StructNode_MemberReader:
|
|||||||
return self.thisptr.getCodeOrder()
|
return self.thisptr.getCodeOrder()
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
property annotations:
|
property annotations:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return _List_StructNode_Member_Annotation_Reader().init(self.thisptr.getAnnotations())
|
return _List_StructNode_Member_Annotation_Reader().init(self.thisptr.getAnnotations())
|
||||||
@@ -1492,7 +1498,7 @@ cdef class _StructNode_MemberBuilder:
|
|||||||
self.thisptr.setCodeOrder(val)
|
self.thisptr.setCodeOrder(val)
|
||||||
property name:
|
property name:
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return None
|
return self.thisptr.getName().cStr()
|
||||||
def __set__(self, val):
|
def __set__(self, val):
|
||||||
pass
|
pass
|
||||||
property annotations:
|
property annotations:
|
||||||
@@ -1688,11 +1694,11 @@ cdef class MessageReader:
|
|||||||
|
|
||||||
cdef class StreamFdMessageReader(MessageReader):
|
cdef class StreamFdMessageReader(MessageReader):
|
||||||
def __cinit__(self, int fd):
|
def __cinit__(self, int fd):
|
||||||
self.thisptr = new capnp.StreamFdMessageReader(int)
|
self.thisptr = new capnp.StreamFdMessageReader(fd)
|
||||||
|
|
||||||
cdef class PackedFdMessageReader(MessageReader):
|
cdef class PackedFdMessageReader(MessageReader):
|
||||||
def __cinit__(self, int fd):
|
def __cinit__(self, int fd):
|
||||||
self.thisptr = new capnp.PackedFdMessageReader(int)
|
self.thisptr = new capnp.PackedFdMessageReader(fd)
|
||||||
|
|
||||||
def writeMessageToFd(int fd, MessageBuilder m):
|
def writeMessageToFd(int fd, MessageBuilder m):
|
||||||
capnp.writeMessageToFd(fd, deref(m.thisptr))
|
capnp.writeMessageToFd(fd, deref(m.thisptr))
|
||||||
|
|||||||
@@ -14,13 +14,24 @@ ctypedef int16_t Int16
|
|||||||
ctypedef int32_t Int32
|
ctypedef int32_t Int32
|
||||||
ctypedef int64_t Int64
|
ctypedef int64_t Int64
|
||||||
|
|
||||||
ctypedef char * Data
|
|
||||||
ctypedef char * Object
|
ctypedef char * Object
|
||||||
ctypedef char * Text
|
|
||||||
ctypedef bint Bool
|
ctypedef bint Bool
|
||||||
ctypedef float Float32
|
ctypedef float Float32
|
||||||
ctypedef double Float64
|
ctypedef double Float64
|
||||||
|
|
||||||
|
cdef extern from "capnp/blob.h" namespace "::capnp":
|
||||||
|
cdef cppclass Data:
|
||||||
|
cppclass Reader:
|
||||||
|
char * begin()
|
||||||
|
size_t size()
|
||||||
|
cppclass Builder:
|
||||||
|
char * begin()
|
||||||
|
size_t size()
|
||||||
|
cdef cppclass Text:
|
||||||
|
cppclass Reader:
|
||||||
|
char * cStr()
|
||||||
|
cppclass Builder:
|
||||||
|
char * cStr()
|
||||||
cdef extern from "capnp/message.h" namespace "::capnp":
|
cdef extern from "capnp/message.h" namespace "::capnp":
|
||||||
cdef cppclass List[T]:
|
cdef cppclass List[T]:
|
||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
@@ -130,7 +141,7 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
|
|
||||||
Value getDefaultValue()
|
Value getDefaultValue()
|
||||||
Type getType()
|
Type getType()
|
||||||
Text getName()
|
Text.Reader getName()
|
||||||
List[InterfaceNode.Method.Param.Annotation].Reader getAnnotations()
|
List[InterfaceNode.Method.Param.Annotation].Reader getAnnotations()
|
||||||
cppclass Builder:
|
cppclass Builder:
|
||||||
|
|
||||||
@@ -138,14 +149,14 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
void setDefaultValue(Value)
|
void setDefaultValue(Value)
|
||||||
Type getType()
|
Type getType()
|
||||||
void setType(Type)
|
void setType(Type)
|
||||||
Text getName()
|
Text.Builder getName()
|
||||||
void setName(Text)
|
void setName(Text)
|
||||||
List[InterfaceNode.Method.Param.Annotation].Builder getAnnotations()
|
List[InterfaceNode.Method.Param.Annotation].Builder getAnnotations()
|
||||||
List[InterfaceNode.Method.Param.Annotation].Builder initAnnotations(int)
|
List[InterfaceNode.Method.Param.Annotation].Builder initAnnotations(int)
|
||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
|
|
||||||
UInt16 getCodeOrder()
|
UInt16 getCodeOrder()
|
||||||
Text getName()
|
Text.Reader getName()
|
||||||
List[InterfaceNode.Method.InterfaceNode.Method.Param].Reader getParams()
|
List[InterfaceNode.Method.InterfaceNode.Method.Param].Reader getParams()
|
||||||
UInt16 getRequiredParamCount()
|
UInt16 getRequiredParamCount()
|
||||||
Type getReturnType()
|
Type getReturnType()
|
||||||
@@ -154,7 +165,7 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
|
|
||||||
UInt16 getCodeOrder()
|
UInt16 getCodeOrder()
|
||||||
void setCodeOrder(UInt16)
|
void setCodeOrder(UInt16)
|
||||||
Text getName()
|
Text.Builder getName()
|
||||||
void setName(Text)
|
void setName(Text)
|
||||||
List[InterfaceNode.Method.InterfaceNode.Method.Param].Builder getParams()
|
List[InterfaceNode.Method.InterfaceNode.Method.Param].Builder getParams()
|
||||||
List[InterfaceNode.Method.InterfaceNode.Method.Param].Builder initParams(int)
|
List[InterfaceNode.Method.InterfaceNode.Method.Param].Builder initParams(int)
|
||||||
@@ -183,7 +194,7 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
UInt32 getUint32Value()
|
UInt32 getUint32Value()
|
||||||
Float64 getFloat64Value()
|
Float64 getFloat64Value()
|
||||||
Void getVoidValue()
|
Void getVoidValue()
|
||||||
Data getDataValue()
|
Data.Reader getDataValue()
|
||||||
Object getListValue()
|
Object getListValue()
|
||||||
Int32 getInt32Value()
|
Int32 getInt32Value()
|
||||||
UInt16 getEnumValue()
|
UInt16 getEnumValue()
|
||||||
@@ -196,7 +207,7 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
UInt8 getUint8Value()
|
UInt8 getUint8Value()
|
||||||
Int64 getInt64Value()
|
Int64 getInt64Value()
|
||||||
Object getStructValue()
|
Object getStructValue()
|
||||||
Text getTextValue()
|
Text.Reader getTextValue()
|
||||||
UInt64 getUint64Value()
|
UInt64 getUint64Value()
|
||||||
Object getObjectValue()
|
Object getObjectValue()
|
||||||
cppclass Builder:
|
cppclass Builder:
|
||||||
@@ -207,7 +218,7 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
void setFloat64Value(Float64)
|
void setFloat64Value(Float64)
|
||||||
Void getVoidValue()
|
Void getVoidValue()
|
||||||
void setVoidValue(Void)
|
void setVoidValue(Void)
|
||||||
Data getDataValue()
|
Data.Builder getDataValue()
|
||||||
void setDataValue(Data)
|
void setDataValue(Data)
|
||||||
Object getListValue()
|
Object getListValue()
|
||||||
void setListValue(Object)
|
void setListValue(Object)
|
||||||
@@ -233,7 +244,7 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
void setInt64Value(Int64)
|
void setInt64Value(Int64)
|
||||||
Object getStructValue()
|
Object getStructValue()
|
||||||
void setStructValue(Object)
|
void setStructValue(Object)
|
||||||
Text getTextValue()
|
Text.Builder getTextValue()
|
||||||
void setTextValue(Text)
|
void setTextValue(Text)
|
||||||
UInt64 getUint64Value()
|
UInt64 getUint64Value()
|
||||||
void setUint64Value(UInt64)
|
void setUint64Value(UInt64)
|
||||||
@@ -344,12 +355,12 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
|
|
||||||
UInt64 getId()
|
UInt64 getId()
|
||||||
Text getName()
|
Text.Reader getName()
|
||||||
cppclass Builder:
|
cppclass Builder:
|
||||||
|
|
||||||
UInt64 getId()
|
UInt64 getId()
|
||||||
void setId(UInt64)
|
void setId(UInt64)
|
||||||
Text getName()
|
Text.Builder getName()
|
||||||
void setName(Text)
|
void setName(Text)
|
||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
|
|
||||||
@@ -393,18 +404,18 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
|
|
||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
|
|
||||||
Text getName()
|
Text.Reader getName()
|
||||||
UInt64 getId()
|
UInt64 getId()
|
||||||
cppclass Builder:
|
cppclass Builder:
|
||||||
|
|
||||||
Text getName()
|
Text.Builder getName()
|
||||||
void setName(Text)
|
void setName(Text)
|
||||||
UInt64 getId()
|
UInt64 getId()
|
||||||
void setId(UInt64)
|
void setId(UInt64)
|
||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
|
|
||||||
Node.Body getBody()
|
Node.Body getBody()
|
||||||
Text getDisplayName()
|
Text.Reader getDisplayName()
|
||||||
List[Node.Annotation].Reader getAnnotations()
|
List[Node.Annotation].Reader getAnnotations()
|
||||||
UInt64 getScopeId()
|
UInt64 getScopeId()
|
||||||
List[Node.Node.NestedNode].Reader getNestedNodes()
|
List[Node.Node.NestedNode].Reader getNestedNodes()
|
||||||
@@ -413,7 +424,7 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
|
|
||||||
Node.Body getBody()
|
Node.Body getBody()
|
||||||
void setBody(Node.Body)
|
void setBody(Node.Body)
|
||||||
Text getDisplayName()
|
Text.Builder getDisplayName()
|
||||||
void setDisplayName(Text)
|
void setDisplayName(Text)
|
||||||
List[Node.Annotation].Builder getAnnotations()
|
List[Node.Annotation].Builder getAnnotations()
|
||||||
List[Node.Annotation].Builder initAnnotations(int)
|
List[Node.Annotation].Builder initAnnotations(int)
|
||||||
@@ -476,13 +487,13 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
cppclass Reader:
|
cppclass Reader:
|
||||||
|
|
||||||
UInt16 getCodeOrder()
|
UInt16 getCodeOrder()
|
||||||
Text getName()
|
Text.Reader getName()
|
||||||
List[EnumNode.Enumerant.Annotation].Reader getAnnotations()
|
List[EnumNode.Enumerant.Annotation].Reader getAnnotations()
|
||||||
cppclass Builder:
|
cppclass Builder:
|
||||||
|
|
||||||
UInt16 getCodeOrder()
|
UInt16 getCodeOrder()
|
||||||
void setCodeOrder(UInt16)
|
void setCodeOrder(UInt16)
|
||||||
Text getName()
|
Text.Builder getName()
|
||||||
void setName(Text)
|
void setName(Text)
|
||||||
List[EnumNode.Enumerant.Annotation].Builder getAnnotations()
|
List[EnumNode.Enumerant.Annotation].Builder getAnnotations()
|
||||||
List[EnumNode.Enumerant.Annotation].Builder initAnnotations(int)
|
List[EnumNode.Enumerant.Annotation].Builder initAnnotations(int)
|
||||||
@@ -534,7 +545,7 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
UInt16 getOrdinal()
|
UInt16 getOrdinal()
|
||||||
StructNode.Member.Body getBody()
|
StructNode.Member.Body getBody()
|
||||||
UInt16 getCodeOrder()
|
UInt16 getCodeOrder()
|
||||||
Text getName()
|
Text.Reader getName()
|
||||||
List[StructNode.Member.Annotation].Reader getAnnotations()
|
List[StructNode.Member.Annotation].Reader getAnnotations()
|
||||||
cppclass Builder:
|
cppclass Builder:
|
||||||
|
|
||||||
@@ -544,7 +555,7 @@ cdef extern from "schema.capnp.h" namespace "::capnp::schema":
|
|||||||
void setBody(StructNode.Member.Body)
|
void setBody(StructNode.Member.Body)
|
||||||
UInt16 getCodeOrder()
|
UInt16 getCodeOrder()
|
||||||
void setCodeOrder(UInt16)
|
void setCodeOrder(UInt16)
|
||||||
Text getName()
|
Text.Builder getName()
|
||||||
void setName(Text)
|
void setName(Text)
|
||||||
List[StructNode.Member.Annotation].Builder getAnnotations()
|
List[StructNode.Member.Annotation].Builder getAnnotations()
|
||||||
List[StructNode.Member.Annotation].Builder initAnnotations(int)
|
List[StructNode.Member.Annotation].Builder initAnnotations(int)
|
||||||
|
|||||||
5
setup.py
5
setup.py
@@ -1,11 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
from Cython.Build import cythonize
|
from Cython.Build import cythonize
|
||||||
from jinja2 import Environment, FileSystemLoader
|
|
||||||
import os
|
|
||||||
|
|
||||||
curr_dir = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
env = Environment(loader=FileSystemLoader(curr_dir))
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = "capnp",
|
name = "capnp",
|
||||||
|
|||||||
Reference in New Issue
Block a user