Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jeremie.galarneau@efficios.com (Jérémie Galarneau)
Subject: [lttng-dev] [PATCH babeltrace 2/2] Fix: Unified types expected by the Definition Python interface.
Date: Tue, 22 Jan 2013 23:47:26 +0000	[thread overview]
Message-ID: <1358898446-1622-2-git-send-email-jeremie.galarneau@efficios.com> (raw)
In-Reply-To: <1358898446-1622-1-git-send-email-jeremie.galarneau@efficios.com>

This change makes the Python iterator test case execute successfully.

Signed-off-by: J?r?mie Galarneau <jeremie.galarneau at efficios.com>
---
 bindings/python/babeltrace.i.in | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/bindings/python/babeltrace.i.in b/bindings/python/babeltrace.i.in
index dd49ba5..a5426c8 100644
--- a/bindings/python/babeltrace.i.in
+++ b/bindings/python/babeltrace.i.in
@@ -553,8 +553,8 @@ 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 declaration *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 declaration *field);
 %rename("_bt_ctf_get_int_base") bt_ctf_get_int_base(const struct declaration *field);
@@ -572,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);
@@ -584,8 +586,8 @@ 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 declaration *def);
+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);
@@ -599,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%{
 
@@ -839,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):
 			"""
@@ -871,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):
 			"""
-- 
1.8.1.1




  reply	other threads:[~2013-01-22 23:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-22 23:47 [lttng-dev] [PATCH babeltrace 1/2] Add missing shebangs to Python examples Jérémie Galarneau
2013-01-22 23:47 ` Jérémie Galarneau [this message]
2013-01-25 16:39   ` [lttng-dev] [PATCH babeltrace 2/2] Fix: Unified types expected by the Definition Python interface Mathieu Desnoyers
2013-01-23 14:45 ` [lttng-dev] [PATCH babeltrace 1/2] Add missing shebangs to Python examples Mathieu Desnoyers
2013-01-23 17:05   ` Christian Babeux
     [not found]     ` <CA+jJMxvqEXqgK8oMmJZT5WKiKuNYm7Wws47QOi=e2wzYnaKH8A@mail.gmail.com>
2013-01-25 16:03       ` Jérémie Galarneau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1358898446-1622-2-git-send-email-jeremie.galarneau@efficios.com \
    --to=jeremie.galarneau@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox