Fix: Unified types expected by the Definition Python interface.
[babeltrace.git] / bindings / python / babeltrace.i.in
index c8e4923077fd0d95731d14cff97f3d84d039e204..a5426c825d9b40cb0b8248a8fd58a8d389e99d79 100644 (file)
@@ -194,9 +194,6 @@ extern struct format *bt_lookup_format(bt_intern_str qname);
 extern void bt_fprintf_format_list(FILE *fp);
 extern int bt_register_format(struct format *format);
 
-void format_init(void);
-void format_finalize(void);
-
 %pythoncode %{
 
 def print_format_list(babeltrace_file):
@@ -245,8 +242,7 @@ struct bt_iter_pos *bt_iter_create_time_pos(struct bt_iter *iter, uint64_t times
 %rename("SEEK_RESTORE") BT_SEEK_RESTORE;
 %rename("SEEK_CUR") BT_SEEK_CUR;
 %rename("SEEK_BEGIN") BT_SEEK_BEGIN;
-%rename("SEEK_END") BT_SEEK_END;
-
+%rename("SEEK_LAST") BT_SEEK_LAST;
 
 // This struct is taken from iterator.h
 // All changes to the struct must also be made here
@@ -256,7 +252,7 @@ struct bt_iter_pos {
                BT_SEEK_RESTORE,        /* uses u.restore */
                BT_SEEK_CUR,
                BT_SEEK_BEGIN,
-               BT_SEEK_END,
+               BT_SEEK_LAST
        } type;
        union {
                uint64_t seek_time;
@@ -557,16 +553,16 @@ struct bt_ctf_event *bt_ctf_iter_read_event(struct bt_ctf_iter *iter);
                const struct definition *scope, const char *field);
 %rename("_bt_ctf_get_index") bt_ctf_get_index(const struct bt_ctf_event *ctf_event,
                const struct definition *field, unsigned int index);
-%rename("_bt_ctf_field_name") bt_ctf_field_name(const struct definition *def);
-%rename("_bt_ctf_field_type") bt_ctf_field_type(const struct definition *def);
+%rename("_bt_ctf_field_name") bt_ctf_field_name(const struct definition *field);
+%rename("_bt_ctf_field_type") bt_ctf_field_type(const struct declaration *field);
 %rename("_bt_ctf_get_int_signedness") bt_ctf_get_int_signedness(
-               const struct definition *field);
-%rename("_bt_ctf_get_int_base") bt_ctf_get_int_base(const struct definition *field);
+               const struct declaration *field);
+%rename("_bt_ctf_get_int_base") bt_ctf_get_int_base(const struct declaration *field);
 %rename("_bt_ctf_get_int_byte_order") bt_ctf_get_int_byte_order(
-               const struct definition *field);
-%rename("_bt_ctf_get_int_len") bt_ctf_get_int_len(const struct definition *field);
-%rename("_bt_ctf_get_encoding") bt_ctf_get_encoding(const struct definition *field);
-%rename("_bt_ctf_get_array_len") bt_ctf_get_array_len(const struct definition *field);
+               const struct declaration *field);
+%rename("_bt_ctf_get_int_len") bt_ctf_get_int_len(const struct declaration *field);
+%rename("_bt_ctf_get_encoding") bt_ctf_get_encoding(const struct declaration *field);
+%rename("_bt_ctf_get_array_len") bt_ctf_get_array_len(const struct declaration *field);
 %rename("_bt_ctf_get_uint64") bt_ctf_get_uint64(const struct definition *field);
 %rename("_bt_ctf_get_int64") bt_ctf_get_int64(const struct definition *field);
 %rename("_bt_ctf_get_char_array") bt_ctf_get_char_array(const struct definition *field);
@@ -576,6 +572,8 @@ struct bt_ctf_event *bt_ctf_iter_read_event(struct bt_ctf_iter *iter);
                bt_ctf_event_decl *event);
 %rename("_bt_ctf_get_decl_field_name") bt_ctf_get_decl_field_name(
                const struct bt_ctf_field_decl *field);
+%rename("_bt_ctf_get_decl_from_def") bt_ctf_get_decl_from_def(
+               const struct definition *field);
 
 const struct definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *ctf_event,
                enum bt_ctf_scope scope);
@@ -588,14 +586,14 @@ const struct definition *bt_ctf_get_field(const struct bt_ctf_event *ctf_event,
 const struct definition *bt_ctf_get_index(const struct bt_ctf_event *ctf_event,
                const struct definition *field,
                unsigned int index);
-const char *bt_ctf_field_name(const struct definition *def);
-enum ctf_type_id bt_ctf_field_type(const struct definition *def);
-int bt_ctf_get_int_signedness(const struct definition *field);
-int bt_ctf_get_int_base(const struct definition *field);
-int bt_ctf_get_int_byte_order(const struct definition *field);
-ssize_t bt_ctf_get_int_len(const struct definition *field);
-enum ctf_string_encoding bt_ctf_get_encoding(const struct definition *field);
-int bt_ctf_get_array_len(const struct definition *field);
+const char *bt_ctf_field_name(const struct definition *field);
+enum ctf_type_id bt_ctf_field_type(const struct declaration *field);
+int bt_ctf_get_int_signedness(const struct declaration *field);
+int bt_ctf_get_int_base(const struct declaration *field);
+int bt_ctf_get_int_byte_order(const struct declaration *field);
+ssize_t bt_ctf_get_int_len(const struct declaration *field);
+enum ctf_string_encoding bt_ctf_get_encoding(const struct declaration *field);
+int bt_ctf_get_array_len(const struct declaration *field);
 uint64_t bt_ctf_get_uint64(const struct definition *field);
 int64_t bt_ctf_get_int64(const struct definition *field);
 char *bt_ctf_get_char_array(const struct definition *field);
@@ -603,6 +601,7 @@ char *bt_ctf_get_string(const struct definition *field);
 int bt_ctf_field_get_error(void);
 const char *bt_ctf_get_decl_event_name(const struct bt_ctf_event_decl *event);
 const char *bt_ctf_get_decl_field_name(const struct bt_ctf_field_decl *field);
+const struct declaration *bt_ctf_get_decl_from_def(const struct definition *field);
 
 %pythoncode%{
 
@@ -843,25 +842,25 @@ class ctf:
 
                def field_type(self):
                        """Return the type of a field or -1 if unknown."""
-                       return _bt_ctf_field_type(self._d)
+                       return _bt_ctf_field_type(_bt_ctf_get_decl_from_def(self._d))
 
                def get_int_signedness(self):
                        """
                        Return the signedness of an integer:
                        0 if unsigned; 1 if signed; -1 on error.
                        """
-                       return _bt_ctf_get_int_signedness(self._d)
+                       return _bt_ctf_get_int_signedness(_bt_ctf_get_decl_from_def(self._d))
 
                def get_int_base(self):
                        """Return the base of an int or a negative value on error."""
-                       return _bt_ctf_get_int_base(self._d)
+                       return _bt_ctf_get_int_base(_bt_ctf_get_decl_from_def(self._d))
 
                def get_int_byte_order(self):
                        """
                        Return the byte order of an int or a negative
                        value on error.
                        """
-                       return _bt_ctf_get_int_byte_order(self._d)
+                       return _bt_ctf_get_int_byte_order(_bt_ctf_get_decl_from_def(self._d))
 
                def get_int_len(self):
                        """
@@ -875,14 +874,14 @@ class ctf:
                        Return the encoding of an int or a string.
                        Return a negative value on error.
                        """
-                       return _bt_ctf_get_encoding(self._d)
+                       return _bt_ctf_get_encoding(_bt_ctf_get_decl_from_def(self._d))
 
                def get_array_len(self):
                        """
                        Return the len of an array or a negative
                        value on error.
                        """
-                       return _bt_ctf_get_array_len(self._d)
+                       return _bt_ctf_get_array_len(_bt_ctf_get_decl_from_def(self._d))
 
                def get_uint64(self):
                        """
This page took 0.02602 seconds and 4 git commands to generate.