Commit | Line | Data |
---|---|---|
6945df9a | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
6945df9a SM |
3 | * |
4 | * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com> | |
6945df9a SM |
5 | */ |
6 | ||
d6bb425c | 7 | /* Parameter names seem to be required for multi-argument typemaps to match. */ |
6945df9a | 8 | %typemap(in, numinputs=0) |
43c59509 | 9 | (bt_field_class_enumeration_mapping_label_array *labels, uint64_t *count) |
6945df9a SM |
10 | (bt_field_class_enumeration_mapping_label_array temp_array, uint64_t temp_label_count = 0) { |
11 | $1 = &temp_array; | |
12 | $2 = &temp_label_count; | |
13 | } | |
14 | ||
15 | %typemap(argout) | |
43c59509 | 16 | (bt_field_class_enumeration_mapping_label_array *labels, uint64_t *count) { |
6945df9a SM |
17 | if (*$1) { |
18 | PyObject *py_label_list = PyList_New(*$2); | |
ebccea5f SM |
19 | uint64_t i; |
20 | ||
21 | for (i = 0; i < *$2; i++) { | |
6945df9a SM |
22 | PyList_SET_ITEM(py_label_list, i, PyUnicode_FromString((*$1)[i])); |
23 | } | |
24 | ||
25 | $result = SWIG_Python_AppendOutput($result, py_label_list); | |
26 | } else { | |
27 | Py_INCREF(Py_None); | |
28 | $result = SWIG_Python_AppendOutput($result, Py_None); | |
29 | } | |
30 | } | |
31 | ||
d6bb425c | 32 | %include <babeltrace2/trace-ir/field-class.h> |