Commit | Line | Data |
---|---|---|
6945df9a | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
6945df9a SM |
3 | * |
4 | * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> | |
6945df9a SM |
5 | */ |
6 | ||
9736d991 PP |
7 | /* Output argument typemap for plugin output (always appends) */ |
8 | %typemap(in, numinputs=0) | |
d6bb425c | 9 | (const bt_plugin **) |
9736d991 PP |
10 | (bt_plugin *temp_plugin = NULL) { |
11 | $1 = &temp_plugin; | |
12 | } | |
6945df9a | 13 | |
9736d991 | 14 | %typemap(argout) |
d6bb425c | 15 | (const bt_plugin **) { |
9736d991 PP |
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 | } | |
6945df9a | 27 | |
9736d991 PP |
28 | /* Output argument typemap for plugin set output (always appends) */ |
29 | %typemap(in, numinputs=0) | |
d6bb425c | 30 | (const bt_plugin_set **) |
9736d991 PP |
31 | (bt_plugin_set *temp_plugin_set = NULL) { |
32 | $1 = &temp_plugin_set; | |
33 | } | |
6945df9a | 34 | |
9736d991 | 35 | %typemap(argout) |
d6bb425c | 36 | (const bt_plugin_set **) { |
9736d991 PP |
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 | ||
43c59509 | 49 | %include <babeltrace2/plugin/plugin-loading.h> |
fdfb7f17 SM |
50 | |
51 | /* Helpers */ | |
52 | ||
4212232c PP |
53 | %{ |
54 | #include "native_bt_plugin.i.h" | |
55 | %} | |
56 | ||
d24d5663 | 57 | bt_property_availability bt_bt2_plugin_get_version( |
d6bb425c SM |
58 | const bt_plugin *plugin, unsigned int *major, |
59 | unsigned int *minor, unsigned int *patch, const char **extra); | |
fdfb7f17 | 60 | |
d24d5663 | 61 | bt_plugin_find_status bt_bt2_plugin_find(const char *plugin_name, |
577fa92f PP |
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, | |
d6bb425c | 64 | bt_bool fail_on_load_error, const bt_plugin **plugin); |
9736d991 | 65 | |
577fa92f PP |
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 | ||
d24d5663 | 71 | bt_plugin_find_all_from_file_status bt_bt2_plugin_find_all_from_file( |
9736d991 | 72 | const char *path, bt_bool fail_on_load_error, |
d6bb425c | 73 | const bt_plugin_set **plugin_set); |
9736d991 | 74 | |
d24d5663 | 75 | bt_plugin_find_all_from_dir_status bt_bt2_plugin_find_all_from_dir( |
9736d991 | 76 | const char *path, bt_bool recurse, bt_bool fail_on_load_error, |
d6bb425c | 77 | const bt_plugin_set **plugin_set); |