X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bindings%2Fpython%2Fpython-complements.c;h=b6f1d5a88891a98e0081409b3f6d1bfaec956fbf;hb=b94a25e94aba84459aa050ab4c67b8283da1f4be;hp=5c65fb0f0e37f2044a0518faf95d798fff364ffa;hpb=cebae8c3f3b5dba2af88242c8f17bf44fe63c715;p=babeltrace.git diff --git a/bindings/python/python-complements.c b/bindings/python/python-complements.c index 5c65fb0f..b6f1d5a8 100644 --- a/bindings/python/python-complements.c +++ b/bindings/python/python-complements.c @@ -19,6 +19,8 @@ */ #include "python-complements.h" +#include +#include /* FILE functions ---------------------------------------------------- @@ -143,3 +145,32 @@ struct definition_sequence *_bt_python_get_sequence_from_def( return NULL; } + +int _bt_python_field_integer_get_signedness(const struct bt_ctf_field *field) +{ + int ret; + + if (!field || field->type->declaration->id != CTF_TYPE_INTEGER) { + ret = -1; + goto end; + } + + const struct bt_ctf_field_type_integer *type = container_of(field->type, + const struct bt_ctf_field_type_integer, parent); + ret = type->declaration.signedness; +end: + return ret; +} + +enum ctf_type_id _bt_python_get_field_type(const struct bt_ctf_field *field) +{ + enum ctf_type_id type_id = CTF_TYPE_UNKNOWN; + + if (!field) { + goto end; + } + + type_id = field->type->declaration->id; +end: + return type_id; +}