| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | /* Output argument typemap for plugin output (always appends) */ |
| 8 | %typemap(in, numinputs=0) |
| 9 | (const bt_plugin **) |
| 10 | (bt_plugin *temp_plugin = NULL) { |
| 11 | $1 = &temp_plugin; |
| 12 | } |
| 13 | |
| 14 | %typemap(argout) |
| 15 | (const bt_plugin **) { |
| 16 | if (*$1) { |
| 17 | /* SWIG_Python_AppendOutput() steals the created object */ |
| 18 | $result = SWIG_Python_AppendOutput($result, |
| 19 | SWIG_NewPointerObj(SWIG_as_voidptr(*$1), |
| 20 | SWIGTYPE_p_bt_plugin, 0)); |
| 21 | } else { |
| 22 | /* SWIG_Python_AppendOutput() steals Py_None */ |
| 23 | Py_INCREF(Py_None); |
| 24 | $result = SWIG_Python_AppendOutput($result, Py_None); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | /* Output argument typemap for plugin set output (always appends) */ |
| 29 | %typemap(in, numinputs=0) |
| 30 | (const bt_plugin_set **) |
| 31 | (bt_plugin_set *temp_plugin_set = NULL) { |
| 32 | $1 = &temp_plugin_set; |
| 33 | } |
| 34 | |
| 35 | %typemap(argout) |
| 36 | (const bt_plugin_set **) { |
| 37 | if (*$1) { |
| 38 | /* SWIG_Python_AppendOutput() steals the created object */ |
| 39 | $result = SWIG_Python_AppendOutput($result, |
| 40 | SWIG_NewPointerObj(SWIG_as_voidptr(*$1), |
| 41 | SWIGTYPE_p_bt_plugin_set, 0)); |
| 42 | } else { |
| 43 | /* SWIG_Python_AppendOutput() steals Py_None */ |
| 44 | Py_INCREF(Py_None); |
| 45 | $result = SWIG_Python_AppendOutput($result, Py_None); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | %include <babeltrace2/plugin/plugin-loading.h> |
| 50 | |
| 51 | /* Helpers */ |
| 52 | |
| 53 | %{ |
| 54 | #include "native_bt_plugin.i.h" |
| 55 | %} |
| 56 | |
| 57 | bt_property_availability bt_bt2_plugin_get_version( |
| 58 | const bt_plugin *plugin, unsigned int *major, |
| 59 | unsigned int *minor, unsigned int *patch, const char **extra); |
| 60 | |
| 61 | bt_plugin_find_status bt_bt2_plugin_find(const char *plugin_name, |
| 62 | bt_bool find_in_std_env_var, bt_bool find_in_user_dir, |
| 63 | bt_bool find_in_sys_dir, bt_bool find_in_static, |
| 64 | bt_bool fail_on_load_error, const bt_plugin **plugin); |
| 65 | |
| 66 | bt_plugin_find_all_status bt_bt2_plugin_find_all(bt_bool find_in_std_env_var, |
| 67 | bt_bool find_in_user_dir, bt_bool find_in_sys_dir, |
| 68 | bt_bool find_in_static, bt_bool fail_on_load_error, |
| 69 | const bt_plugin_set **plugin_set); |
| 70 | |
| 71 | bt_plugin_find_all_from_file_status bt_bt2_plugin_find_all_from_file( |
| 72 | const char *path, bt_bool fail_on_load_error, |
| 73 | const bt_plugin_set **plugin_set); |
| 74 | |
| 75 | bt_plugin_find_all_from_dir_status bt_bt2_plugin_find_all_from_dir( |
| 76 | const char *path, bt_bool recurse, bt_bool fail_on_load_error, |
| 77 | const bt_plugin_set **plugin_set); |