lib: strictly type function return status enumerations
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_component_class.i
CommitLineData
6945df9a
SM
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
d24d5663 25%include <babeltrace2/graph/component-class.h>
d6bb425c
SM
26%include <babeltrace2/graph/component-class-const.h>
27%include <babeltrace2/graph/component-class-source-const.h>
28%include <babeltrace2/graph/component-class-source.h>
29%include <babeltrace2/graph/component-class-filter-const.h>
30%include <babeltrace2/graph/component-class-filter.h>
31%include <babeltrace2/graph/component-class-sink-const.h>
32%include <babeltrace2/graph/component-class-sink.h>
33%include <babeltrace2/graph/self-component-class-source.h>
34%include <babeltrace2/graph/self-component-class-filter.h>
35%include <babeltrace2/graph/self-component-class-sink.h>
6945df9a
SM
36
37%{
38/*
39 * This hash table associates a BT component class object address to a
40 * user-defined Python class (PyObject *). The keys and values are NOT
41 * owned by this hash table. The Python class objects are owned by the
42 * Python module, which should not be unloaded until it is not possible
43 * to create a user Python component anyway.
44 *
45 * This hash table is written to when a user-defined Python component
d24d5663 46 * class is created by one of the bt_bt2_component_class_*_create()
6945df9a
SM
47 * functions.
48 *
49 * This function is read from when a user calls bt_component_create()
50 * with a component class pointer created by one of the functions above.
51 * In this case, the original Python class needs to be found to
52 * instantiate it and associate the created Python component object with
53 * a BT component object instance.
54 */
55
56static GHashTable *bt_cc_ptr_to_py_cls;
57
7744859c
SM
58static
59void register_cc_ptr_to_py_cls(struct bt_component_class *bt_cc,
6945df9a
SM
60 PyObject *py_cls)
61{
62 if (!bt_cc_ptr_to_py_cls) {
63 /*
64 * Lazy-initializing this GHashTable because GLib
65 * might not be initialized yet and it needs to be
66 * before we call g_hash_table_new()
67 */
68 BT_LOGD_STR("Creating native component class to Python component class hash table.");
69 bt_cc_ptr_to_py_cls = g_hash_table_new(g_direct_hash, g_direct_equal);
70 BT_ASSERT(bt_cc_ptr_to_py_cls);
71 }
72
73 g_hash_table_insert(bt_cc_ptr_to_py_cls, (gpointer) bt_cc,
74 (gpointer) py_cls);
75}
76
7744859c
SM
77static
78PyObject *lookup_cc_ptr_to_py_cls(const bt_component_class *bt_cc)
6945df9a
SM
79{
80 if (!bt_cc_ptr_to_py_cls) {
81 BT_LOGW("Cannot look up Python component class because hash table is NULL: "
82 "comp-cls-addr=%p", bt_cc);
83 return NULL;
84 }
85
86 return (PyObject *) g_hash_table_lookup(bt_cc_ptr_to_py_cls,
87 (gconstpointer) bt_cc);
88}
89
90
91/*
92 * Useful Python objects.
93 */
94
95static PyObject *py_mod_bt2 = NULL;
96static PyObject *py_mod_bt2_exc_error_type = NULL;
97static PyObject *py_mod_bt2_exc_try_again_type = NULL;
98static PyObject *py_mod_bt2_exc_stop_type = NULL;
5602ef81 99static PyObject *py_mod_bt2_exc_msg_iter_canceled_type = NULL;
d24d5663
PP
100static PyObject *py_mod_bt2_exc_invalid_object_type = NULL;
101static PyObject *py_mod_bt2_exc_invalid_params_type = NULL;
102static PyObject *py_mod_bt2_exc_unsupported_type = NULL;
6945df9a 103
7744859c 104static
d24d5663 105void bt_bt2_cc_init_from_bt2(void)
6945df9a
SM
106{
107 /*
108 * This is called once the bt2 package is loaded.
109 *
110 * Those modules and functions are needed while the package is
111 * used. Loading them here is safe because we know the bt2
112 * package is imported, and we know that the user cannot use the
113 * code here without importing bt2 first.
114 */
115 py_mod_bt2 = PyImport_ImportModule("bt2");
116 BT_ASSERT(py_mod_bt2);
117 py_mod_bt2_exc_error_type =
118 PyObject_GetAttrString(py_mod_bt2, "Error");
119 BT_ASSERT(py_mod_bt2_exc_error_type);
120 py_mod_bt2_exc_try_again_type =
121 PyObject_GetAttrString(py_mod_bt2, "TryAgain");
122 BT_ASSERT(py_mod_bt2_exc_try_again_type);
123 py_mod_bt2_exc_stop_type =
124 PyObject_GetAttrString(py_mod_bt2, "Stop");
125 BT_ASSERT(py_mod_bt2_exc_stop_type);
d24d5663
PP
126 py_mod_bt2_exc_invalid_object_type =
127 PyObject_GetAttrString(py_mod_bt2, "InvalidObject");
128 BT_ASSERT(py_mod_bt2_exc_invalid_object_type);
129 py_mod_bt2_exc_invalid_params_type =
130 PyObject_GetAttrString(py_mod_bt2, "InvalidParams");
131 BT_ASSERT(py_mod_bt2_exc_invalid_params_type);
132 py_mod_bt2_exc_unsupported_type =
133 PyObject_GetAttrString(py_mod_bt2, "Unsupported");
134 BT_ASSERT(py_mod_bt2_exc_unsupported_type);
6945df9a
SM
135}
136
7744859c 137static
d24d5663 138void bt_bt2_cc_exit_handler(void)
6945df9a
SM
139{
140 /*
141 * This is an exit handler (set by the bt2 package).
142 *
143 * We only give back the references that we took in
d24d5663 144 * bt_bt2_cc_init_from_bt2() here. The global variables continue
6945df9a
SM
145 * to exist for the code of this file, but they are now borrowed
146 * references. If this code is executed, it means that somehow
147 * the modules are still loaded, so it should be safe to use
148 * them even without a strong reference.
149 *
150 * We cannot do this in the library's destructor because it
151 * gets executed once Python is already finalized.
152 */
153 Py_XDECREF(py_mod_bt2);
154 Py_XDECREF(py_mod_bt2_exc_error_type);
155 Py_XDECREF(py_mod_bt2_exc_try_again_type);
156 Py_XDECREF(py_mod_bt2_exc_stop_type);
5602ef81 157 Py_XDECREF(py_mod_bt2_exc_msg_iter_canceled_type);
d24d5663
PP
158 Py_XDECREF(py_mod_bt2_exc_invalid_object_type);
159 Py_XDECREF(py_mod_bt2_exc_invalid_params_type);
6945df9a
SM
160}
161
162
163/* Library destructor */
164
165__attribute__((destructor))
7744859c 166static
d24d5663 167void native_comp_class_dtor(void) {
6945df9a
SM
168 /* Destroy component class association hash table */
169 if (bt_cc_ptr_to_py_cls) {
170 BT_LOGD_STR("Destroying native component class to Python component class hash table.");
171 g_hash_table_destroy(bt_cc_ptr_to_py_cls);
172 }
173}
174
d24d5663
PP
175static inline
176void log_exception(int log_level)
6945df9a 177{
7085eeaa 178 GString *gstr;
6945df9a
SM
179
180 BT_ASSERT(PyErr_Occurred() != NULL);
7085eeaa
PP
181 gstr = bt_py_common_format_exception(BT_LOG_OUTPUT_LEVEL);
182 if (!gstr) {
183 /* bt_py_common_format_exception() logs errors */
6945df9a
SM
184 goto end;
185 }
186
d24d5663 187 BT_LOG_WRITE(log_level, BT_LOG_TAG, "%s", gstr->str);
6945df9a
SM
188
189end:
7085eeaa
PP
190 if (gstr) {
191 g_string_free(gstr, TRUE);
6945df9a 192 }
6945df9a
SM
193}
194
d24d5663
PP
195static inline
196void loge_exception(void)
6945df9a 197{
d24d5663 198 log_exception(BT_LOG_ERROR);
6945df9a
SM
199}
200
d24d5663
PP
201static inline
202void logw_exception(void)
6945df9a 203{
d24d5663 204 log_exception(BT_LOG_WARN);
6945df9a
SM
205}
206
d24d5663
PP
207static inline
208int py_exc_to_status(void)
6945df9a 209{
d24d5663 210 int status = __BT_FUNC_STATUS_OK;
6945df9a
SM
211 PyObject *exc = PyErr_Occurred();
212
213 if (!exc) {
214 goto end;
215 }
216
217 if (PyErr_GivenExceptionMatches(exc,
d24d5663
PP
218 py_mod_bt2_exc_try_again_type)) {
219 status = __BT_FUNC_STATUS_AGAIN;
6945df9a 220 } else if (PyErr_GivenExceptionMatches(exc,
d24d5663
PP
221 py_mod_bt2_exc_stop_type)) {
222 status = __BT_FUNC_STATUS_END;
6945df9a 223 } else if (PyErr_GivenExceptionMatches(exc,
d24d5663
PP
224 py_mod_bt2_exc_invalid_object_type)) {
225 status = __BT_FUNC_STATUS_INVALID_OBJECT;
226 } else if (PyErr_GivenExceptionMatches(exc,
227 py_mod_bt2_exc_invalid_params_type)) {
228 status = __BT_FUNC_STATUS_INVALID_PARAMS;
229 } else if (PyErr_GivenExceptionMatches(exc,
230 py_mod_bt2_exc_unsupported_type)) {
231 status = __BT_FUNC_STATUS_UNSUPPORTED;
6945df9a 232 } else {
d24d5663
PP
233 /* Unknown exception: convert to general error */
234 logw_exception();
235 status = __BT_FUNC_STATUS_ERROR;
6945df9a
SM
236 }
237
238end:
239 PyErr_Clear();
240 return status;
241}
242
d24d5663
PP
243/* Component class proxy methods (delegate to the attached Python object) */
244
7744859c 245static
d24d5663 246bt_component_class_init_method_status component_class_init(
6945df9a
SM
247 bt_self_component *self_component,
248 void *self_component_v,
249 swig_type_info *self_comp_cls_type_swig_type,
250 const bt_value *params,
251 void *init_method_data)
252{
253 const bt_component *component = bt_self_component_as_component(self_component);
254 const bt_component_class *component_class = bt_component_borrow_class_const(component);
d24d5663 255 bt_component_class_init_method_status status = __BT_FUNC_STATUS_OK;
6945df9a
SM
256 PyObject *py_cls = NULL;
257 PyObject *py_comp = NULL;
258 PyObject *py_params_ptr = NULL;
259 PyObject *py_comp_ptr = NULL;
260
261 (void) init_method_data;
262
263 BT_ASSERT(self_component);
264 BT_ASSERT(self_component_v);
265 BT_ASSERT(self_comp_cls_type_swig_type);
266
267 /*
268 * Get the user-defined Python class which created this
269 * component's class in the first place (borrowed
270 * reference).
271 */
272 py_cls = lookup_cc_ptr_to_py_cls(component_class);
273 if (!py_cls) {
274 BT_LOGE("Cannot find Python class associated to native component class: "
275 "comp-cls-addr=%p", component_class);
276 goto error;
277 }
278
279 /* Parameters pointer -> SWIG pointer Python object */
280 py_params_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(params),
281 SWIGTYPE_p_bt_value, 0);
282 if (!py_params_ptr) {
283 BT_LOGE_STR("Failed to create a SWIG pointer object.");
284 goto error;
285 }
286
287 py_comp_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_component_v),
288 self_comp_cls_type_swig_type, 0);
289 if (!py_comp_ptr) {
290 BT_LOGE_STR("Failed to create a SWIG pointer object.");
291 goto error;
292 }
293
294 /*
295 * Do the equivalent of this:
296 *
297 * py_comp = py_cls._init_from_native(py_comp_ptr, py_params_ptr)
298 *
299 * _UserComponentType._init_from_native() calls the Python
300 * component object's __init__() function.
301 */
302 py_comp = PyObject_CallMethod(py_cls,
303 "_init_from_native", "(OO)", py_comp_ptr, py_params_ptr);
304 if (!py_comp) {
d24d5663 305 BT_LOGW("Failed to call Python class's _init_from_native() method: "
6945df9a 306 "py-cls-addr=%p", py_cls);
d24d5663 307 logw_exception();
6945df9a
SM
308 goto error;
309 }
310
311 /*
312 * Our user Python component object is now fully created and
313 * initialized by the user. Since we just created it, this
314 * native component is its only (persistent) owner.
315 */
316 bt_self_component_set_data(self_component, py_comp);
317 py_comp = NULL;
318 goto end;
319
320error:
d24d5663 321 status = __BT_FUNC_STATUS_ERROR;
6945df9a
SM
322
323 /*
324 * Clear any exception: we're returning a bad status anyway. If
325 * this call originated from Python (creation from a plugin's
326 * component class, for example), then the user gets an
327 * appropriate creation error.
328 */
329 PyErr_Clear();
330
331end:
332 Py_XDECREF(py_comp);
333 Py_XDECREF(py_params_ptr);
334 Py_XDECREF(py_comp_ptr);
335 return status;
336}
337
338/*
339 * Method of bt_component_class_source to initialize a bt_self_component_source
340 * of that class.
341 */
342
7744859c 343static
d24d5663 344bt_component_class_init_method_status component_class_source_init(
7744859c 345 bt_self_component_source *self_component_source,
6945df9a
SM
346 const bt_value *params, void *init_method_data)
347{
348 bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
d24d5663 349 return component_class_init(
6945df9a
SM
350 self_component,
351 self_component_source,
352 SWIGTYPE_p_bt_self_component_source,
353 params, init_method_data);
354}
355
7744859c 356static
d24d5663 357bt_component_class_init_method_status component_class_filter_init(
7744859c 358 bt_self_component_filter *self_component_filter,
6945df9a
SM
359 const bt_value *params, void *init_method_data)
360{
361 bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
d24d5663 362 return component_class_init(
6945df9a
SM
363 self_component,
364 self_component_filter,
365 SWIGTYPE_p_bt_self_component_filter,
366 params, init_method_data);
367}
368
7744859c 369static
d24d5663 370bt_component_class_init_method_status component_class_sink_init(
7744859c 371 bt_self_component_sink *self_component_sink,
6945df9a
SM
372 const bt_value *params, void *init_method_data)
373{
374 bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
d24d5663 375 return component_class_init(
6945df9a
SM
376 self_component,
377 self_component_sink,
378 SWIGTYPE_p_bt_self_component_sink,
379 params, init_method_data);
380}
381
7744859c 382static
d24d5663 383void component_class_finalize(bt_self_component *self_component)
6945df9a
SM
384{
385 PyObject *py_comp = bt_self_component_get_data(self_component);
386 BT_ASSERT(py_comp);
387
388 /* Call user's _finalize() method */
389 PyObject *py_method_result = PyObject_CallMethod(py_comp,
390 "_finalize", NULL);
391
392 if (PyErr_Occurred()) {
d24d5663
PP
393 BT_LOGW("User component's _finalize() method raised an exception: ignoring:");
394 logw_exception();
6945df9a
SM
395 }
396
397 /*
398 * Ignore any exception raised by the _finalize() method because
399 * it won't change anything at this point: the component is
400 * being destroyed anyway.
401 */
402 PyErr_Clear();
403 Py_XDECREF(py_method_result);
404 Py_DECREF(py_comp);
405}
406
7744859c 407static
d24d5663 408void component_class_source_finalize(bt_self_component_source *self_component_source)
6945df9a
SM
409{
410 bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
d24d5663 411 component_class_finalize(self_component);
6945df9a
SM
412}
413
7744859c 414static
d24d5663 415void component_class_filter_finalize(bt_self_component_filter *self_component_filter)
6945df9a
SM
416{
417 bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
d24d5663 418 component_class_finalize(self_component);
6945df9a
SM
419}
420
7744859c 421static
d24d5663 422void component_class_sink_finalize(bt_self_component_sink *self_component_sink)
6945df9a
SM
423{
424 bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
d24d5663 425 component_class_finalize(self_component);
6945df9a
SM
426}
427
f00b8d40 428static
d24d5663 429bt_bool component_class_can_seek_beginning(
f00b8d40
SM
430 bt_self_message_iterator *self_message_iterator)
431{
432 PyObject *py_iter;
433 PyObject *py_result = NULL;
434 bt_bool can_seek_beginning = false;
435
436 py_iter = bt_self_message_iterator_get_data(self_message_iterator);
437 BT_ASSERT(py_iter);
438
439 py_result = PyObject_GetAttrString(py_iter, "_can_seek_beginning_from_native");
440
441 BT_ASSERT(!py_result || PyBool_Check(py_result));
442
443 if (py_result) {
444 can_seek_beginning = PyObject_IsTrue(py_result);
445 } else {
446 /*
447 * Once can_seek_beginning can report errors, convert the
448 * exception to a status. For now, log and return false;
449 */
d24d5663 450 loge_exception();
f00b8d40
SM
451 PyErr_Clear();
452 }
453
454 Py_XDECREF(py_result);
455
456 return can_seek_beginning;
457}
458
459static
d24d5663
PP
460bt_component_class_message_iterator_seek_beginning_method_status
461component_class_seek_beginning(bt_self_message_iterator *self_message_iterator)
f00b8d40
SM
462{
463 PyObject *py_iter;
464 PyObject *py_result;
d24d5663 465 bt_component_class_message_iterator_seek_beginning_method_status status;
f00b8d40
SM
466
467 py_iter = bt_self_message_iterator_get_data(self_message_iterator);
468 BT_ASSERT(py_iter);
d24d5663
PP
469 py_result = PyObject_CallMethod(py_iter, "_seek_beginning_from_native",
470 NULL);
f00b8d40 471 BT_ASSERT(!py_result || py_result == Py_None);
d24d5663 472 status = py_exc_to_status();
f00b8d40 473 Py_XDECREF(py_result);
f00b8d40
SM
474 return status;
475}
476
7744859c 477static
d24d5663 478bt_component_class_port_connected_method_status component_class_port_connected(
6945df9a
SM
479 bt_self_component *self_component,
480 void *self_component_port,
481 swig_type_info *self_component_port_swig_type,
482 bt_port_type self_component_port_type,
483 const void *other_port,
484 swig_type_info *other_port_swig_type)
485{
d24d5663 486 bt_component_class_port_connected_method_status status;
6945df9a
SM
487 PyObject *py_comp = NULL;
488 PyObject *py_self_port_ptr = NULL;
489 PyObject *py_other_port_ptr = NULL;
490 PyObject *py_method_result = NULL;
491
492 py_comp = bt_self_component_get_data(self_component);
493 BT_ASSERT(py_comp);
6945df9a
SM
494 py_self_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_component_port),
495 self_component_port_swig_type, 0);
496 if (!py_self_port_ptr) {
497 BT_LOGF_STR("Failed to create a SWIG pointer object.");
d24d5663 498 status = __BT_FUNC_STATUS_MEMORY_ERROR;
6945df9a
SM
499 goto end;
500 }
501
502 py_other_port_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(other_port),
503 other_port_swig_type, 0);
504 if (!py_other_port_ptr) {
505 BT_LOGF_STR("Failed to create a SWIG pointer object.");
d24d5663 506 status = __BT_FUNC_STATUS_MEMORY_ERROR;
6945df9a
SM
507 goto end; }
508
509 py_method_result = PyObject_CallMethod(py_comp,
510 "_port_connected_from_native", "(OiO)", py_self_port_ptr,
511 self_component_port_type, py_other_port_ptr);
6945df9a 512 BT_ASSERT(!py_method_result || py_method_result == Py_None);
d24d5663 513 status = py_exc_to_status();
6945df9a
SM
514
515end:
516 Py_XDECREF(py_self_port_ptr);
517 Py_XDECREF(py_other_port_ptr);
518 Py_XDECREF(py_method_result);
6945df9a
SM
519 return status;
520}
521
7744859c 522static
d24d5663
PP
523bt_component_class_port_connected_method_status
524component_class_source_output_port_connected(
6945df9a
SM
525 bt_self_component_source *self_component_source,
526 bt_self_component_port_output *self_component_port_output,
527 const bt_port_input *other_port_input)
528{
529 bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
530
d24d5663 531 return component_class_port_connected(
6945df9a
SM
532 self_component,
533 self_component_port_output,
534 SWIGTYPE_p_bt_self_component_port_output,
535 BT_PORT_TYPE_OUTPUT,
536 other_port_input,
537 SWIGTYPE_p_bt_port_input);
538}
539
7744859c 540static
d24d5663
PP
541bt_component_class_port_connected_method_status
542component_class_filter_input_port_connected(
6945df9a
SM
543 bt_self_component_filter *self_component_filter,
544 bt_self_component_port_input *self_component_port_input,
545 const bt_port_output *other_port_output)
546{
547 bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
548
d24d5663 549 return component_class_port_connected(
6945df9a
SM
550 self_component,
551 self_component_port_input,
552 SWIGTYPE_p_bt_self_component_port_input,
553 BT_PORT_TYPE_INPUT,
554 other_port_output,
555 SWIGTYPE_p_bt_port_output);
556}
557
7744859c 558static
d24d5663
PP
559bt_component_class_port_connected_method_status
560component_class_filter_output_port_connected(
6945df9a
SM
561 bt_self_component_filter *self_component_filter,
562 bt_self_component_port_output *self_component_port_output,
563 const bt_port_input *other_port_input)
564{
565 bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
566
d24d5663 567 return component_class_port_connected(
6945df9a
SM
568 self_component,
569 self_component_port_output,
570 SWIGTYPE_p_bt_self_component_port_output,
571 BT_PORT_TYPE_OUTPUT,
572 other_port_input,
573 SWIGTYPE_p_bt_port_input);
574}
575
7744859c 576static
d24d5663
PP
577bt_component_class_port_connected_method_status
578component_class_sink_input_port_connected(
6945df9a
SM
579 bt_self_component_sink *self_component_sink,
580 bt_self_component_port_input *self_component_port_input,
581 const bt_port_output *other_port_output)
582{
583 bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
584
d24d5663 585 return component_class_port_connected(
6945df9a
SM
586 self_component,
587 self_component_port_input,
588 SWIGTYPE_p_bt_self_component_port_input,
589 BT_PORT_TYPE_INPUT,
590 other_port_output,
591 SWIGTYPE_p_bt_port_output);
592}
593
7744859c 594static
d24d5663
PP
595bt_component_class_sink_graph_is_configured_method_status
596component_class_sink_graph_is_configured(
7744859c 597 bt_self_component_sink *self_component_sink)
6945df9a
SM
598{
599 PyObject *py_comp = NULL;
600 PyObject *py_method_result = NULL;
d24d5663 601 bt_component_class_sink_graph_is_configured_method_status status = __BT_FUNC_STATUS_OK;
6945df9a
SM
602 bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
603
604 py_comp = bt_self_component_get_data(self_component);
605 py_method_result = PyObject_CallMethod(py_comp,
606 "_graph_is_configured_from_native", NULL);
6945df9a 607 BT_ASSERT(!py_method_result || py_method_result == Py_None);
d24d5663 608 status = py_exc_to_status();
6945df9a 609 Py_XDECREF(py_method_result);
6945df9a
SM
610 return status;
611}
612
7744859c 613static
d24d5663 614bt_component_class_query_method_status component_class_query(
6945df9a
SM
615 const bt_component_class *component_class,
616 const bt_query_executor *query_executor,
617 const char *object, const bt_value *params,
f4e38e70 618 bt_logging_level log_level,
6945df9a
SM
619 const bt_value **result)
620{
621 PyObject *py_cls = NULL;
622 PyObject *py_params_ptr = NULL;
623 PyObject *py_query_exec_ptr = NULL;
624 PyObject *py_query_func = NULL;
625 PyObject *py_object = NULL;
626 PyObject *py_results_addr = NULL;
d24d5663 627 bt_component_class_query_method_status status = __BT_FUNC_STATUS_OK;
6945df9a
SM
628
629 py_cls = lookup_cc_ptr_to_py_cls(component_class);
630 if (!py_cls) {
631 BT_LOGE("Cannot find Python class associated to native component class: "
632 "comp-cls-addr=%p", component_class);
633 goto error;
634 }
635
636 py_params_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(params),
637 SWIGTYPE_p_bt_value, 0);
638 if (!py_params_ptr) {
639 BT_LOGE_STR("Failed to create a SWIG pointer object.");
640 goto error;
641 }
642
643 py_query_exec_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(query_executor),
644 SWIGTYPE_p_bt_query_executor, 0);
645 if (!py_query_exec_ptr) {
646 BT_LOGE_STR("Failed to create a SWIG pointer object.");
647 goto error;
648 }
649
650 py_object = SWIG_FromCharPtr(object);
651 if (!py_object) {
652 BT_LOGE_STR("Failed to create a Python string.");
653 goto error;
654 }
655
656 py_results_addr = PyObject_CallMethod(py_cls,
f4e38e70
PP
657 "_query_from_native", "(OOOi)", py_query_exec_ptr,
658 py_object, py_params_ptr, (int) log_level);
6945df9a 659 if (!py_results_addr) {
d24d5663 660 BT_LOGW("Failed to call Python class's _query_from_native() method: "
6945df9a 661 "py-cls-addr=%p", py_cls);
d24d5663 662 status = py_exc_to_status();
6945df9a
SM
663 goto end;
664 }
665
666 /*
667 * The returned object, on success, is an integer object
668 * (PyLong) containing the address of a BT value object (new
669 * reference).
670 */
babe0791 671 *result = PyLong_AsVoidPtr(py_results_addr);
6945df9a
SM
672 BT_ASSERT(!PyErr_Occurred());
673 BT_ASSERT(*result);
674 goto end;
675
676error:
677 PyErr_Clear();
d24d5663 678 status = __BT_FUNC_STATUS_ERROR;
6945df9a
SM
679
680end:
681 Py_XDECREF(py_params_ptr);
682 Py_XDECREF(py_query_exec_ptr);
683 Py_XDECREF(py_query_func);
684 Py_XDECREF(py_object);
685 Py_XDECREF(py_results_addr);
686 return status;
687}
688
7744859c 689static
d24d5663 690bt_component_class_query_method_status component_class_source_query(
6945df9a
SM
691 bt_self_component_class_source *self_component_class_source,
692 const bt_query_executor *query_executor,
693 const char *object, const bt_value *params,
f4e38e70 694 bt_logging_level log_level,
6945df9a
SM
695 const bt_value **result)
696{
697 const bt_component_class_source *component_class_source = bt_self_component_class_source_as_component_class_source(self_component_class_source);
698 const bt_component_class *component_class = bt_component_class_source_as_component_class_const(component_class_source);
d24d5663
PP
699
700 return component_class_query(component_class, query_executor, object, params, log_level, result);
6945df9a
SM
701}
702
7744859c 703static
d24d5663 704bt_component_class_query_method_status component_class_filter_query(
6945df9a
SM
705 bt_self_component_class_filter *self_component_class_filter,
706 const bt_query_executor *query_executor,
707 const char *object, const bt_value *params,
f4e38e70 708 bt_logging_level log_level,
6945df9a
SM
709 const bt_value **result)
710{
711 const bt_component_class_filter *component_class_filter = bt_self_component_class_filter_as_component_class_filter(self_component_class_filter);
712 const bt_component_class *component_class = bt_component_class_filter_as_component_class_const(component_class_filter);
d24d5663
PP
713
714 return component_class_query(component_class, query_executor, object, params, log_level, result);
6945df9a
SM
715}
716
7744859c 717static
d24d5663 718bt_component_class_query_method_status component_class_sink_query(
6945df9a
SM
719 bt_self_component_class_sink *self_component_class_sink,
720 const bt_query_executor *query_executor,
721 const char *object, const bt_value *params,
f4e38e70 722 bt_logging_level log_level,
6945df9a
SM
723 const bt_value **result)
724{
725 const bt_component_class_sink *component_class_sink = bt_self_component_class_sink_as_component_class_sink(self_component_class_sink);
726 const bt_component_class *component_class = bt_component_class_sink_as_component_class_const(component_class_sink);
d24d5663
PP
727
728 return component_class_query(component_class, query_executor, object, params, log_level, result);
6945df9a
SM
729}
730
7744859c 731static
d24d5663
PP
732bt_component_class_message_iterator_init_method_status
733component_class_message_iterator_init(
6945df9a
SM
734 bt_self_message_iterator *self_message_iterator,
735 bt_self_component *self_component,
736 bt_self_component_port_output *self_component_port_output)
737{
d24d5663 738 bt_component_class_message_iterator_init_method_status status = __BT_FUNC_STATUS_OK;
6945df9a
SM
739 PyObject *py_comp_cls = NULL;
740 PyObject *py_iter_cls = NULL;
741 PyObject *py_iter_ptr = NULL;
c5f330cd 742 PyObject *py_component_port_output_ptr = NULL;
6945df9a
SM
743 PyObject *py_init_method_result = NULL;
744 PyObject *py_iter = NULL;
745 PyObject *py_comp;
746
747 py_comp = bt_self_component_get_data(self_component);
748
5602ef81 749 /* Find user's Python message iterator class */
6945df9a
SM
750 py_comp_cls = PyObject_GetAttrString(py_comp, "__class__");
751 if (!py_comp_cls) {
752 BT_LOGE_STR("Cannot get Python object's `__class__` attribute.");
753 goto error;
754 }
755
756 py_iter_cls = PyObject_GetAttrString(py_comp_cls, "_iter_cls");
757 if (!py_iter_cls) {
758 BT_LOGE_STR("Cannot get Python class's `_iter_cls` attribute.");
759 goto error;
760 }
761
762 py_iter_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(self_message_iterator),
763 SWIGTYPE_p_bt_self_message_iterator, 0);
764 if (!py_iter_ptr) {
765 BT_LOGE_STR("Failed to create a SWIG pointer object.");
766 goto error;
767 }
768
769 /*
5602ef81 770 * Create object with borrowed native message iterator
6945df9a
SM
771 * reference:
772 *
773 * py_iter = py_iter_cls.__new__(py_iter_cls, py_iter_ptr)
774 */
775 py_iter = PyObject_CallMethod(py_iter_cls, "__new__",
776 "(OO)", py_iter_cls, py_iter_ptr);
777 if (!py_iter) {
778 BT_LOGE("Failed to call Python class's __new__() method: "
779 "py-cls-addr=%p", py_iter_cls);
d24d5663 780 loge_exception();
6945df9a
SM
781 goto error;
782 }
783
784 /*
785 * Initialize object:
786 *
c5f330cd
SM
787 * py_iter.__init__(self_output_port)
788 *
789 * through the _init_for_native helper static method.
6945df9a
SM
790 *
791 * At this point, py_iter._ptr is set, so this initialization
792 * function has access to self._component (which gives it the
793 * user Python component object from which the iterator was
794 * created).
795 */
d24d5663
PP
796 py_component_port_output_ptr = SWIG_NewPointerObj(
797 SWIG_as_voidptr(self_component_port_output),
c5f330cd
SM
798 SWIGTYPE_p_bt_self_component_port_output, 0);
799 if (!py_component_port_output_ptr) {
800 BT_LOGE_STR("Failed to create a SWIG pointer object.");
801 goto error;
802 }
803
d24d5663
PP
804 py_init_method_result = PyObject_CallMethod(py_iter,
805 "_init_from_native", "O", py_component_port_output_ptr);
6945df9a 806 if (!py_init_method_result) {
d24d5663
PP
807 BT_LOGW_STR("User's __init__() method failed:");
808 logw_exception();
6945df9a
SM
809 goto error;
810 }
811
812 /*
813 * Since the Python code can never instantiate a user-defined
5602ef81
SM
814 * message iterator class, the native message iterator
815 * object does NOT belong to a user Python message iterator
6945df9a 816 * object (borrowed reference). However this Python object is
5602ef81 817 * owned by this native message iterator object.
6945df9a 818 *
5602ef81
SM
819 * In the Python world, the lifetime of the native message
820 * iterator is managed by a _GenericMessageIterator
6945df9a
SM
821 * instance:
822 *
5602ef81
SM
823 * _GenericMessageIterator instance:
824 * owns a native bt_message_iterator object (iter)
6945df9a
SM
825 * owns a _UserMessageIterator instance (py_iter)
826 * self._ptr is a borrowed reference to the
5602ef81 827 * native bt_private_connection_private_message_iterator
6945df9a
SM
828 * object (iter)
829 */
830 bt_self_message_iterator_set_data(self_message_iterator, py_iter);
831 py_iter = NULL;
832 goto end;
833
834error:
d24d5663
PP
835 status = py_exc_to_status();
836 if (status == __BT_FUNC_STATUS_OK) {
6945df9a
SM
837 /*
838 * Looks like there wasn't any exception from the Python
839 * side, but we're still in an error state here.
840 */
d24d5663 841 status = __BT_FUNC_STATUS_ERROR;
6945df9a
SM
842 }
843
844 /*
845 * Clear any exception: we're returning a bad status anyway. If
846 * this call originated from Python, then the user gets an
847 * appropriate creation error.
848 */
849 PyErr_Clear();
850
851end:
852 Py_XDECREF(py_comp_cls);
853 Py_XDECREF(py_iter_cls);
854 Py_XDECREF(py_iter_ptr);
c5f330cd 855 Py_XDECREF(py_component_port_output_ptr);
6945df9a
SM
856 Py_XDECREF(py_init_method_result);
857 Py_XDECREF(py_iter);
858 return status;
859}
860
7744859c 861static
d24d5663
PP
862bt_component_class_message_iterator_init_method_status
863component_class_source_message_iterator_init(
6945df9a
SM
864 bt_self_message_iterator *self_message_iterator,
865 bt_self_component_source *self_component_source,
866 bt_self_component_port_output *self_component_port_output)
867{
868 bt_self_component *self_component = bt_self_component_source_as_self_component(self_component_source);
d24d5663
PP
869
870 return component_class_message_iterator_init(self_message_iterator, self_component, self_component_port_output);
6945df9a
SM
871}
872
7744859c 873static
d24d5663
PP
874bt_component_class_message_iterator_init_method_status
875component_class_filter_message_iterator_init(
6945df9a
SM
876 bt_self_message_iterator *self_message_iterator,
877 bt_self_component_filter *self_component_filter,
878 bt_self_component_port_output *self_component_port_output)
879{
880 bt_self_component *self_component = bt_self_component_filter_as_self_component(self_component_filter);
d24d5663
PP
881
882 return component_class_message_iterator_init(self_message_iterator, self_component, self_component_port_output);
6945df9a
SM
883}
884
7744859c 885static
d24d5663 886void component_class_message_iterator_finalize(
6945df9a
SM
887 bt_self_message_iterator *message_iterator)
888{
889 PyObject *py_message_iter = bt_self_message_iterator_get_data(message_iterator);
890 PyObject *py_method_result = NULL;
891
892 BT_ASSERT(py_message_iter);
893
894 /* Call user's _finalize() method */
895 py_method_result = PyObject_CallMethod(py_message_iter,
896 "_finalize", NULL);
897
898 if (PyErr_Occurred()) {
d24d5663
PP
899 BT_LOGW("User's _finalize() method raised an exception: ignoring:");
900 logw_exception();
6945df9a
SM
901 }
902
903 /*
904 * Ignore any exception raised by the _finalize() method because
905 * it won't change anything at this point: the component is
906 * being destroyed anyway.
907 */
908 PyErr_Clear();
909 Py_XDECREF(py_method_result);
910 Py_DECREF(py_message_iter);
911}
912
913/* Valid for both sources and filters. */
914
7744859c 915static
d24d5663
PP
916bt_component_class_message_iterator_next_method_status
917component_class_message_iterator_next(
7744859c
SM
918 bt_self_message_iterator *message_iterator,
919 bt_message_array_const msgs, uint64_t capacity,
920 uint64_t *count)
6945df9a 921{
d24d5663 922 bt_component_class_message_iterator_next_method_status status = __BT_FUNC_STATUS_OK;
6945df9a
SM
923 PyObject *py_message_iter = bt_self_message_iterator_get_data(message_iterator);
924 PyObject *py_method_result = NULL;
925
926 BT_ASSERT(py_message_iter);
927 py_method_result = PyObject_CallMethod(py_message_iter,
928 "_next_from_native", NULL);
929 if (!py_method_result) {
d24d5663
PP
930 status = py_exc_to_status();
931 BT_ASSERT(status != __BT_FUNC_STATUS_OK);
6945df9a
SM
932 goto end;
933 }
934
935 /*
936 * The returned object, on success, is an integer object
5602ef81 937 * (PyLong) containing the address of a native message
6945df9a
SM
938 * object (which is now ours).
939 */
babe0791 940 msgs[0] = PyLong_AsVoidPtr(py_method_result);
6945df9a
SM
941 *count = 1;
942
943 /* Clear potential overflow error; should never happen */
944 BT_ASSERT(!PyErr_Occurred());
945 goto end;
946
947end:
948 Py_XDECREF(py_method_result);
949 return status;
950}
951
7744859c 952static
d24d5663
PP
953bt_component_class_sink_consume_method_status
954component_class_sink_consume(bt_self_component_sink *self_component_sink)
6945df9a
SM
955{
956 bt_self_component *self_component = bt_self_component_sink_as_self_component(self_component_sink);
957 PyObject *py_comp = bt_self_component_get_data(self_component);
958 PyObject *py_method_result = NULL;
d24d5663 959 bt_component_class_sink_consume_method_status status;
6945df9a
SM
960
961 BT_ASSERT(py_comp);
962 py_method_result = PyObject_CallMethod(py_comp,
963 "_consume", NULL);
d24d5663
PP
964 status = py_exc_to_status();
965 if (!py_method_result && status == __BT_FUNC_STATUS_OK) {
6945df9a
SM
966 /* Pretty sure this should never happen, but just in case */
967 BT_LOGE("User's _consume() method failed without raising an exception: "
968 "status=%d", status);
d24d5663 969 status = __BT_FUNC_STATUS_ERROR;
6945df9a
SM
970 }
971
972 Py_XDECREF(py_method_result);
973 return status;
974}
975
976static
d24d5663 977int component_class_set_help_and_desc(
6945df9a
SM
978 bt_component_class *component_class,
979 const char *description, const char *help)
980{
981 int ret;
982
983 if (description) {
984 ret = bt_component_class_set_description(component_class, description);
985 if (ret) {
986 BT_LOGE("Cannot set component class's description: "
987 "comp-cls-addr=%p", component_class);
988 goto end;
989 }
990 }
991
992 if (help) {
993 ret = bt_component_class_set_help(component_class, help);
994 if (ret) {
995 BT_LOGE("Cannot set component class's help text: "
996 "comp-cls-addr=%p", component_class);
997 goto end;
998 }
999 }
1000
1001 ret = 0;
1002
1003end:
1004 return ret;
1005}
1006
1007static
d24d5663 1008bt_component_class_source *bt_bt2_component_class_source_create(
6945df9a
SM
1009 PyObject *py_cls, const char *name, const char *description,
1010 const char *help)
1011{
1012 bt_component_class_source *component_class_source;
1013 bt_component_class *component_class;
1014 int ret;
1015
1016 BT_ASSERT(py_cls);
6945df9a 1017 component_class_source = bt_component_class_source_create(name,
d24d5663 1018 component_class_message_iterator_next);
6945df9a
SM
1019 if (!component_class_source) {
1020 BT_LOGE_STR("Cannot create source component class.");
1021 goto end;
1022 }
1023
1024 component_class = bt_component_class_source_as_component_class(component_class_source);
1025
d24d5663 1026 if (component_class_set_help_and_desc(component_class, description, help)) {
6945df9a
SM
1027 goto end;
1028 }
1029
d24d5663 1030 ret = bt_component_class_source_set_init_method(component_class_source, component_class_source_init);
6945df9a 1031 BT_ASSERT(ret == 0);
d24d5663 1032 ret = bt_component_class_source_set_finalize_method(component_class_source, component_class_source_finalize);
f00b8d40
SM
1033 BT_ASSERT(ret == 0);
1034 ret = bt_component_class_source_set_message_iterator_can_seek_beginning_method(component_class_source,
d24d5663 1035 component_class_can_seek_beginning);
f00b8d40
SM
1036 BT_ASSERT(ret == 0);
1037 ret = bt_component_class_source_set_message_iterator_seek_beginning_method(component_class_source,
d24d5663 1038 component_class_seek_beginning);
6945df9a 1039 BT_ASSERT(ret == 0);
6945df9a 1040 ret = bt_component_class_source_set_output_port_connected_method(component_class_source,
d24d5663 1041 component_class_source_output_port_connected);
6945df9a 1042 BT_ASSERT(ret == 0);
d24d5663 1043 ret = bt_component_class_source_set_query_method(component_class_source, component_class_source_query);
6945df9a
SM
1044 BT_ASSERT(ret == 0);
1045 ret = bt_component_class_source_set_message_iterator_init_method(
d24d5663 1046 component_class_source, component_class_source_message_iterator_init);
6945df9a
SM
1047 BT_ASSERT(ret == 0);
1048 ret = bt_component_class_source_set_message_iterator_finalize_method(
d24d5663 1049 component_class_source, component_class_message_iterator_finalize);
6945df9a 1050 BT_ASSERT(ret == 0);
6945df9a
SM
1051 register_cc_ptr_to_py_cls(component_class, py_cls);
1052
1053end:
1054 return component_class_source;
1055}
1056
1057static
d24d5663 1058bt_component_class_filter *bt_bt2_component_class_filter_create(
6945df9a
SM
1059 PyObject *py_cls, const char *name, const char *description,
1060 const char *help)
1061{
1062 bt_component_class *component_class;
1063 bt_component_class_filter *component_class_filter;
1064 int ret;
1065
1066 BT_ASSERT(py_cls);
6945df9a 1067 component_class_filter = bt_component_class_filter_create(name,
d24d5663 1068 component_class_message_iterator_next);
6945df9a
SM
1069 if (!component_class_filter) {
1070 BT_LOGE_STR("Cannot create filter component class.");
1071 goto end;
1072 }
1073
1074 component_class = bt_component_class_filter_as_component_class(component_class_filter);
1075
d24d5663 1076 if (component_class_set_help_and_desc(component_class, description, help)) {
6945df9a
SM
1077 goto end;
1078 }
1079
d24d5663 1080 ret = bt_component_class_filter_set_init_method(component_class_filter, component_class_filter_init);
6945df9a 1081 BT_ASSERT(ret == 0);
d24d5663 1082 ret = bt_component_class_filter_set_finalize_method (component_class_filter, component_class_filter_finalize);
6945df9a 1083 BT_ASSERT(ret == 0);
f00b8d40 1084 ret = bt_component_class_filter_set_message_iterator_can_seek_beginning_method(component_class_filter,
d24d5663 1085 component_class_can_seek_beginning);
f00b8d40
SM
1086 BT_ASSERT(ret == 0);
1087 ret = bt_component_class_filter_set_message_iterator_seek_beginning_method(component_class_filter,
d24d5663 1088 component_class_seek_beginning);
f00b8d40 1089 BT_ASSERT(ret == 0);
6945df9a 1090 ret = bt_component_class_filter_set_input_port_connected_method(component_class_filter,
d24d5663 1091 component_class_filter_input_port_connected);
6945df9a
SM
1092 BT_ASSERT(ret == 0);
1093 ret = bt_component_class_filter_set_output_port_connected_method(component_class_filter,
d24d5663 1094 component_class_filter_output_port_connected);
6945df9a 1095 BT_ASSERT(ret == 0);
d24d5663 1096 ret = bt_component_class_filter_set_query_method(component_class_filter, component_class_filter_query);
6945df9a
SM
1097 BT_ASSERT(ret == 0);
1098 ret = bt_component_class_filter_set_message_iterator_init_method(
d24d5663 1099 component_class_filter, component_class_filter_message_iterator_init);
6945df9a
SM
1100 BT_ASSERT(ret == 0);
1101 ret = bt_component_class_filter_set_message_iterator_finalize_method(
d24d5663 1102 component_class_filter, component_class_message_iterator_finalize);
6945df9a 1103 BT_ASSERT(ret == 0);
6945df9a
SM
1104 register_cc_ptr_to_py_cls(component_class, py_cls);
1105
1106end:
1107 return component_class_filter;
1108}
1109
1110static
d24d5663 1111bt_component_class_sink *bt_bt2_component_class_sink_create(
6945df9a
SM
1112 PyObject *py_cls, const char *name, const char *description,
1113 const char *help)
1114{
1115 bt_component_class_sink *component_class_sink;
1116 bt_component_class *component_class;
1117 int ret;
1118
1119 BT_ASSERT(py_cls);
d24d5663 1120 component_class_sink = bt_component_class_sink_create(name, component_class_sink_consume);
6945df9a
SM
1121
1122 if (!component_class_sink) {
1123 BT_LOGE_STR("Cannot create sink component class.");
1124 goto end;
1125 }
1126
1127 component_class = bt_component_class_sink_as_component_class(component_class_sink);
1128
d24d5663 1129 if (component_class_set_help_and_desc(component_class, description, help)) {
6945df9a
SM
1130 goto end;
1131 }
1132
d24d5663 1133 ret = bt_component_class_sink_set_init_method(component_class_sink, component_class_sink_init);
6945df9a 1134 BT_ASSERT(ret == 0);
d24d5663 1135 ret = bt_component_class_sink_set_finalize_method(component_class_sink, component_class_sink_finalize);
6945df9a 1136 BT_ASSERT(ret == 0);
6945df9a 1137 ret = bt_component_class_sink_set_input_port_connected_method(component_class_sink,
d24d5663 1138 component_class_sink_input_port_connected);
6945df9a
SM
1139 BT_ASSERT(ret == 0);
1140 ret = bt_component_class_sink_set_graph_is_configured_method(component_class_sink,
d24d5663 1141 component_class_sink_graph_is_configured);
6945df9a 1142 BT_ASSERT(ret == 0);
d24d5663 1143 ret = bt_component_class_sink_set_query_method(component_class_sink, component_class_sink_query);
6945df9a 1144 BT_ASSERT(ret == 0);
6945df9a
SM
1145 register_cc_ptr_to_py_cls(component_class, py_cls);
1146
1147end:
1148 return component_class_sink;
1149}
1150%}
1151
d24d5663 1152struct bt_component_class_source *bt_bt2_component_class_source_create(
6945df9a
SM
1153 PyObject *py_cls, const char *name, const char *description,
1154 const char *help);
d24d5663 1155struct bt_component_class_filter *bt_bt2_component_class_filter_create(
6945df9a
SM
1156 PyObject *py_cls, const char *name, const char *description,
1157 const char *help);
d24d5663 1158struct bt_component_class_sink *bt_bt2_component_class_sink_create(
6945df9a
SM
1159 PyObject *py_cls, const char *name, const char *description,
1160 const char *help);
d24d5663
PP
1161void bt_bt2_cc_init_from_bt2(void);
1162void bt_bt2_cc_exit_handler(void);
This page took 0.083213 seconds and 4 git commands to generate.