OLD | NEW |
| (Empty) |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 # distutils: language = c++ | |
6 | |
7 from cpython.buffer cimport PyBUF_CONTIG | |
8 from cpython.buffer cimport PyBUF_CONTIG_RO | |
9 from cpython.buffer cimport Py_buffer | |
10 from cpython.buffer cimport PyBuffer_FillInfo | |
11 from cpython.buffer cimport PyBuffer_Release | |
12 from cpython.buffer cimport PyObject_GetBuffer | |
13 from cpython.mem cimport PyMem_Malloc, PyMem_Free | |
14 from libc.stdint cimport int32_t, int64_t, uint32_t, uint64_t, uintptr_t | |
15 | |
16 cdef extern from "mojo/public/c/system/core.h" nogil: | |
17 # types.h | |
18 ctypedef int64_t MojoTimeTicks | |
19 | |
20 ctypedef uint32_t MojoHandle | |
21 const MojoHandle MOJO_HANDLE_INVALID | |
22 | |
23 ctypedef int32_t MojoResult | |
24 const MojoResult MOJO_RESULT_OK | |
25 const MojoResult MOJO_RESULT_CANCELLED | |
26 const MojoResult MOJO_RESULT_UNKNOWN | |
27 const MojoResult MOJO_RESULT_INVALID_ARGUMENT | |
28 const MojoResult MOJO_RESULT_DEADLINE_EXCEEDED | |
29 const MojoResult MOJO_RESULT_NOT_FOUND | |
30 const MojoResult MOJO_RESULT_ALREADY_EXISTS | |
31 const MojoResult MOJO_RESULT_PERMISSION_DENIED | |
32 const MojoResult MOJO_RESULT_RESOURCE_EXHAUSTED | |
33 const MojoResult MOJO_RESULT_FAILED_PRECONDITION | |
34 const MojoResult MOJO_RESULT_ABORTED | |
35 const MojoResult MOJO_RESULT_OUT_OF_RANGE | |
36 const MojoResult MOJO_RESULT_UNIMPLEMENTED | |
37 const MojoResult MOJO_RESULT_INTERNAL | |
38 const MojoResult MOJO_RESULT_UNAVAILABLE | |
39 const MojoResult MOJO_RESULT_DATA_LOSS | |
40 const MojoResult MOJO_RESULT_BUSY | |
41 const MojoResult MOJO_RESULT_SHOULD_WAIT | |
42 | |
43 ctypedef uint64_t MojoDeadline | |
44 const MojoDeadline MOJO_DEADLINE_INDEFINITE | |
45 | |
46 ctypedef uint32_t MojoHandleSignals | |
47 const MojoHandleSignals MOJO_HANDLE_SIGNAL_NONE | |
48 const MojoHandleSignals MOJO_HANDLE_SIGNAL_READABLE | |
49 const MojoHandleSignals MOJO_HANDLE_SIGNAL_WRITABLE | |
50 const MojoHandleSignals MOJO_HANDLE_SIGNAL_PEER_CLOSED | |
51 | |
52 cdef struct MojoHandleSignalsState: | |
53 MojoHandleSignals satisfied_signals | |
54 MojoHandleSignals satisfiable_signals | |
55 | |
56 # functions.h | |
57 MojoTimeTicks MojoGetTimeTicksNow() | |
58 MojoResult MojoClose(MojoHandle handle) | |
59 MojoResult MojoWait "MojoWait"(MojoHandle handle, | |
60 MojoHandleSignals signals, | |
61 MojoDeadline deadline, | |
62 MojoHandleSignalsState* signals_state) | |
63 MojoResult MojoWaitMany "MojoWaitMany"(const MojoHandle* handles, | |
64 const MojoHandleSignals* signals, | |
65 uint32_t num_handles, | |
66 MojoDeadline deadline, | |
67 uint32_t* result_index, | |
68 MojoHandleSignalsState* signals_states) | |
69 | |
70 # message_pipe.h | |
71 ctypedef uint32_t MojoCreateMessagePipeOptionsFlags | |
72 const MojoCreateMessagePipeOptionsFlags MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_
NONE | |
73 | |
74 ctypedef uint32_t MojoWriteMessageFlags | |
75 const MojoWriteMessageFlags MOJO_WRITE_MESSAGE_FLAG_NONE | |
76 | |
77 ctypedef uint32_t MojoReadMessageFlags | |
78 const MojoReadMessageFlags MOJO_READ_MESSAGE_FLAG_NONE | |
79 const MojoReadMessageFlags MOJO_READ_MESSAGE_FLAG_MAY_DISCARD | |
80 | |
81 cdef struct MojoCreateMessagePipeOptions: | |
82 uint32_t struct_size | |
83 MojoCreateMessagePipeOptionsFlags flags | |
84 | |
85 MojoResult MojoCreateMessagePipe( | |
86 const MojoCreateMessagePipeOptions* options, | |
87 MojoHandle* message_pipe_handle0, | |
88 MojoHandle* message_pipe_handle1) | |
89 | |
90 MojoResult MojoWriteMessage( | |
91 MojoHandle message_pipe_handle, | |
92 const void* bytes, | |
93 uint32_t num_bytes, | |
94 const MojoHandle* handles, | |
95 uint32_t num_handles, | |
96 MojoWriteMessageFlags flags) | |
97 | |
98 MojoResult MojoReadMessage( | |
99 MojoHandle message_pipe_handle, | |
100 void* bytes, | |
101 uint32_t* num_bytes, | |
102 MojoHandle* handles, | |
103 uint32_t* num_handles, | |
104 MojoReadMessageFlags flags) | |
105 | |
106 # data_pipe.h | |
107 ctypedef uint32_t MojoCreateDataPipeOptionsFlags | |
108 const MojoCreateDataPipeOptionsFlags MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE | |
109 const MojoCreateDataPipeOptionsFlags MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DI
SCARD | |
110 | |
111 cdef struct MojoCreateDataPipeOptions: | |
112 uint32_t struct_size | |
113 MojoCreateDataPipeOptionsFlags flags | |
114 uint32_t element_num_bytes | |
115 uint32_t capacity_num_bytes | |
116 | |
117 ctypedef uint32_t MojoWriteDataFlags | |
118 | |
119 const MojoWriteDataFlags MOJO_WRITE_DATA_FLAG_NONE | |
120 const MojoWriteDataFlags MOJO_WRITE_DATA_FLAG_ALL_OR_NONE | |
121 | |
122 ctypedef uint32_t MojoReadDataFlags | |
123 | |
124 const MojoReadDataFlags MOJO_READ_DATA_FLAG_NONE | |
125 const MojoReadDataFlags MOJO_READ_DATA_FLAG_ALL_OR_NONE | |
126 const MojoReadDataFlags MOJO_READ_DATA_FLAG_DISCARD | |
127 const MojoReadDataFlags MOJO_READ_DATA_FLAG_QUERY | |
128 const MojoReadDataFlags MOJO_READ_DATA_FLAG_PEEK | |
129 | |
130 MojoResult MojoCreateDataPipe( | |
131 const MojoCreateDataPipeOptions* options, | |
132 MojoHandle* data_pipe_producer_handle, | |
133 MojoHandle* data_pipe_consumer_handle) | |
134 | |
135 MojoResult MojoWriteData( | |
136 MojoHandle data_pipe_producer_handle, | |
137 const void* elements, | |
138 uint32_t* num_bytes, | |
139 MojoWriteDataFlags flags) | |
140 | |
141 MojoResult MojoBeginWriteData( | |
142 MojoHandle data_pipe_producer_handle, | |
143 void** buffer, | |
144 uint32_t* buffer_num_bytes, | |
145 MojoWriteDataFlags flags) | |
146 | |
147 MojoResult MojoEndWriteData( | |
148 MojoHandle data_pipe_producer_handle, | |
149 uint32_t num_bytes_written) | |
150 | |
151 MojoResult MojoReadData( | |
152 MojoHandle data_pipe_consumer_handle, | |
153 void* elements, | |
154 uint32_t* num_bytes, | |
155 MojoReadDataFlags flags) | |
156 | |
157 MojoResult MojoBeginReadData( | |
158 MojoHandle data_pipe_consumer_handle, | |
159 const void** buffer, | |
160 uint32_t* buffer_num_bytes, | |
161 MojoReadDataFlags flags) | |
162 | |
163 MojoResult MojoEndReadData( | |
164 MojoHandle data_pipe_consumer_handle, | |
165 uint32_t num_bytes_read) | |
166 | |
167 # buffer.h | |
168 ctypedef uint32_t MojoCreateSharedBufferOptionsFlags | |
169 const MojoCreateSharedBufferOptionsFlags MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLA
G_NONE | |
170 | |
171 cdef struct MojoCreateSharedBufferOptions: | |
172 uint32_t struct_size | |
173 MojoCreateSharedBufferOptionsFlags flags | |
174 | |
175 ctypedef uint32_t MojoDuplicateBufferHandleOptionsFlags | |
176 const MojoDuplicateBufferHandleOptionsFlags MOJO_DUPLICATE_BUFFER_HANDLE_OPTIO
NS_FLAG_NONE | |
177 | |
178 cdef struct MojoDuplicateBufferHandleOptions: | |
179 uint32_t struct_size | |
180 MojoDuplicateBufferHandleOptionsFlags flags | |
181 | |
182 ctypedef uint32_t MojoMapBufferFlags | |
183 const MojoMapBufferFlags MOJO_MAP_BUFFER_FLAG_NONE | |
184 | |
185 MojoResult MojoCreateSharedBuffer( | |
186 const MojoCreateSharedBufferOptions* options, | |
187 uint64_t num_bytes, | |
188 MojoHandle* shared_buffer_handle) | |
189 | |
190 MojoResult MojoDuplicateBufferHandle( | |
191 MojoHandle buffer_handle, | |
192 const MojoDuplicateBufferHandleOptions* options, | |
193 MojoHandle* new_buffer_handle) | |
194 | |
195 MojoResult MojoMapBuffer(MojoHandle buffer_handle, | |
196 uint64_t offset, | |
197 uint64_t num_bytes, | |
198 void** buffer, | |
199 MojoMapBufferFlags flags) | |
200 | |
201 MojoResult MojoUnmapBuffer(void* buffer) | |
OLD | NEW |