You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2018/06/26 05:33:32 UTC

[1/2] qpid-proton git commit: PROTON-1868: Fix pn_handle_t python binding on Visual Studio 64 bit compiles

Repository: qpid-proton
Updated Branches:
  refs/heads/master ccb9e5a38 -> 7c0a3387a


PROTON-1868: Fix pn_handle_t python binding on Visual Studio 64 bit compiles


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/798894f6
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/798894f6
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/798894f6

Branch: refs/heads/master
Commit: 798894f63dba6a0d4eaa6e015d6f5ac64274be2f
Parents: ccb9e5a
Author: Andrew Stitcher <as...@apache.org>
Authored: Mon Jun 25 23:01:58 2018 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Jun 26 01:25:03 2018 -0400

----------------------------------------------------------------------
 c/include/proton/cproton.i | 7 +++++--
 python/CMakeLists.txt      | 2 +-
 python/cproton.i           | 8 ++++++++
 ruby/CMakeLists.txt        | 2 ++
 ruby/cproton.i             | 3 +++
 5 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/798894f6/c/include/proton/cproton.i
----------------------------------------------------------------------
diff --git a/c/include/proton/cproton.i b/c/include/proton/cproton.i
index 464e74b..31e5b77 100644
--- a/c/include/proton/cproton.i
+++ b/c/include/proton/cproton.i
@@ -26,7 +26,11 @@ typedef unsigned long int uint32_t;
 typedef long int int32_t;
 typedef unsigned long long int uint64_t;
 typedef long long int int64_t;
+#if UINTPTR_SIZE==8
+typedef unsigned long long int uintptr_t;
+#else
 typedef unsigned long int uintptr_t;
+#endif
 
 /* Parse these interface header files to generate APIs for script languages */
 
@@ -61,8 +65,7 @@ typedef unsigned long int uintptr_t;
 %immutable PN_OBJECT;
 %immutable PN_VOID;
 %immutable PN_WEAKREF;
-/* Treat pn_handle_t like uintptr_t - syntactically it is a C void* but really it's just an int */
-%apply uintptr_t { pn_handle_t };
+
 %include "proton/object.h"
 
 %ignore pn_error_format;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/798894f6/python/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 2c3f4d9..037552e 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -20,7 +20,7 @@
 # NB For python the SWIG module name must have the same name as the input .i file for CMake to generate the
 # correct dependencies
 
-set(CMAKE_SWIG_FLAGS "-threads")
+set(CMAKE_SWIG_FLAGS "-threads" "-DUINTPTR_SIZE=${CMAKE_SIZEOF_VOID_P}")
 
 include_directories (${PN_C_INCLUDE_DIR} ${PYTHON_INCLUDE_PATH})
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/798894f6/python/cproton.i
----------------------------------------------------------------------
diff --git a/python/cproton.i b/python/cproton.i
index b173dd8..3bc60ea 100644
--- a/python/cproton.i
+++ b/python/cproton.i
@@ -100,6 +100,14 @@ PN_HANDLE(PNI_PYTRACER);
 %ignore pn_message_get_correlation_id;
 %ignore pn_message_set_correlation_id;
 
+%typemap(in) pn_handle_t {
+  $1 = PyLong_AsVoidPtr($input);
+}
+
+%typemap(out) pn_handle_t {
+  $result = PyLong_FromVoidPtr((void*)$1);
+}
+
 %typemap(in) pn_bytes_t {
   if ($input == Py_None) {
     $1.start = NULL;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/798894f6/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/ruby/CMakeLists.txt b/ruby/CMakeLists.txt
index 1dc106c..a27a67a 100644
--- a/ruby/CMakeLists.txt
+++ b/ruby/CMakeLists.txt
@@ -28,6 +28,8 @@ list(APPEND SWIG_MODULE_cproton-ruby_EXTRA_DEPS
     ${PROTON_HEADERS}
     )
 
+set(CMAKE_SWIG_FLAGS "-DUINTPTR_SIZE=${CMAKE_SIZEOF_VOID_P}")
+
 include_directories(${PN_C_INCLUDE_DIR} ${RUBY_INCLUDE_PATH})
 
 swig_add_library(cproton-ruby LANGUAGE ruby SOURCES cproton.i)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/798894f6/ruby/cproton.i
----------------------------------------------------------------------
diff --git a/ruby/cproton.i b/ruby/cproton.i
index a9c731a..1de88f0 100644
--- a/ruby/cproton.i
+++ b/ruby/cproton.i
@@ -52,6 +52,9 @@ Keep preprocessor directives and macro expansions in the normal header section.
 #endif
 %}
 
+/* Treat pn_handle_t like uintptr_t - syntactically it is a C void* but really it's just an int */
+%apply uintptr_t { pn_handle_t };
+
 %typemap(in) pn_bytes_t {
   if ($input == Qnil) {
     $1.start = NULL;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[2/2] qpid-proton git commit: PROTON-1869: Fix some SWIG Python Win64 type/pointer conversion problems

Posted by as...@apache.org.
PROTON-1869: Fix some SWIG Python Win64 type/pointer conversion problems


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/7c0a3387
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/7c0a3387
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/7c0a3387

Branch: refs/heads/master
Commit: 7c0a3387a5096d86541dbddfeb55f36eb0b85dd8
Parents: 798894f
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Jun 26 01:06:00 2018 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Jun 26 01:25:16 2018 -0400

----------------------------------------------------------------------
 python/cproton.i | 60 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 57 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7c0a3387/python/cproton.i
----------------------------------------------------------------------
diff --git a/python/cproton.i b/python/cproton.i
index 3bc60ea..276eace 100644
--- a/python/cproton.i
+++ b/python/cproton.i
@@ -100,6 +100,60 @@ PN_HANDLE(PNI_PYTRACER);
 %ignore pn_message_get_correlation_id;
 %ignore pn_message_set_correlation_id;
 
+%ignore pn_list;
+%ignore pn_list_size;
+%ignore pn_list_get;
+%ignore pn_list_set;
+%ignore pn_list_add;
+%ignore pn_list_pop;
+%ignore pn_list_index;
+%ignore pn_list_remove;
+%ignore pn_list_del;
+%ignore pn_list_clear;
+%ignore pn_list_iterator;
+%ignore pn_list_minpush;
+%ignore pn_list_minpop;
+
+%ignore pn_map;
+%ignore pn_map_size;
+%ignore pn_map_put;
+%ignore pn_map_get;
+%ignore pn_map_del;
+%ignore pn_map_head;
+%ignore pn_map_next;
+%ignore pn_map_key;
+%ignore pn_map_value;
+
+%ignore pn_hash;
+%ignore pn_hash_size;
+%ignore pn_hash_put;
+%ignore pn_hash_get;
+%ignore pn_hash_del;
+%ignore pn_hash_head;
+%ignore pn_hash_next;
+%ignore pn_hash_key;
+%ignore pn_hash_value;
+
+%ignore pn_stringn;
+%ignore pn_string_size;
+%ignore pn_string_set;
+%ignore pn_string_setn;
+%ignore pn_string_put;
+%ignore pn_string_clear;
+%ignore pn_string_format;
+%ignore pn_string_vformat;
+%ignore pn_string_addf;
+%ignore pn_string_vaddf;
+%ignore pn_string_grow;
+%ignore pn_string_buffer;
+%ignore pn_string_capacity;
+%ignore pn_string_resize;
+%ignore pn_string_copy;
+
+%ignore pn_iterator;
+%ignore pn_iterator_start;
+%ignore pn_iterator_next;
+
 %typemap(in) pn_handle_t {
   $1 = PyLong_AsVoidPtr($input);
 }
@@ -161,7 +215,7 @@ ssize_t pn_link_send(pn_link_t *transport, const char *BIN_IN, size_t BIN_LEN);
 
 %rename(pn_link_recv) wrap_pn_link_recv;
 %inline %{
-  int wrap_pn_link_recv(pn_link_t *link, char *BIN_OUT, size_t *BIN_SIZE) {
+  ssize_t wrap_pn_link_recv(pn_link_t *link, char *BIN_OUT, size_t *BIN_SIZE) {
     ssize_t sz = pn_link_recv(link, BIN_OUT, *BIN_SIZE);
     if (sz >= 0) {
       *BIN_SIZE = sz;
@@ -178,7 +232,7 @@ ssize_t pn_transport_push(pn_transport_t *transport, const char *BIN_IN, size_t
 
 %rename(pn_transport_peek) wrap_pn_transport_peek;
 %inline %{
-  int wrap_pn_transport_peek(pn_transport_t *transport, char *BIN_OUT, size_t *BIN_SIZE) {
+  ssize_t wrap_pn_transport_peek(pn_transport_t *transport, char *BIN_OUT, size_t *BIN_SIZE) {
     ssize_t sz = pn_transport_peek(transport, BIN_OUT, *BIN_SIZE);
     if (sz >= 0) {
       *BIN_SIZE = sz;
@@ -214,7 +268,7 @@ ssize_t pn_data_decode(pn_data_t *data, const char *BIN_IN, size_t BIN_LEN);
 
 %rename(pn_data_encode) wrap_pn_data_encode;
 %inline %{
-  int wrap_pn_data_encode(pn_data_t *data, char *BIN_OUT, size_t *BIN_SIZE) {
+  ssize_t wrap_pn_data_encode(pn_data_t *data, char *BIN_OUT, size_t *BIN_SIZE) {
     ssize_t sz = pn_data_encode(data, BIN_OUT, *BIN_SIZE);
     if (sz >= 0) {
       *BIN_SIZE = sz;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org