PROTON-949: fix proton build with ccache swig

Moved macro calls and preprocessor directives out of %inline sections, seems to fix the problem.

NOTE: According to ccache-swig man page: "Known problems are using
preprocessor directives within %inline blocks and the use of ’#pragma SWIG’."
This includes using any macros in an %inline section.
diff --git a/proton-c/bindings/python/cproton.i b/proton-c/bindings/python/cproton.i
index 0ead44d..f7f56e3 100644
--- a/proton-c/bindings/python/cproton.i
+++ b/proton-c/bindings/python/cproton.i
@@ -25,11 +25,22 @@
 #include <proton/engine.h>
 #include <proton/url.h>
 #include <proton/message.h>
+#include <proton/object.h>
 #include <proton/sasl.h>
 #include <proton/messenger.h>
 #include <proton/ssl.h>
 #include <proton/reactor.h>
 #include <proton/handlers.h>
+
+/*
+NOTE: According to ccache-swig man page: "Known problems are using
+preprocessor directives within %inline blocks and the use of ’#pragma SWIG’."
+This includes using macros in an %inline section.
+
+Do any preprocessor work or macro expansions here before we get into the %inline sections.
+*/
+PN_HANDLE(PNI_PYTRACER);
+
 %}
 
 %include <cstring.i>
@@ -354,8 +365,6 @@
     return chandler;
   }
 
-  PN_HANDLE(PNI_PYTRACER);
-
   void pn_pytracer(pn_transport_t *transport, const char *message) {
     PyObject *pytracer = (PyObject *) pn_record_get(pn_transport_attachments(transport), PNI_PYTRACER);
     SWIG_PYTHON_THREAD_BEGIN_BLOCK;
diff --git a/proton-c/bindings/ruby/ruby.i b/proton-c/bindings/ruby/ruby.i
index dbbd719..eddd529 100644
--- a/proton-c/bindings/ruby/ruby.i
+++ b/proton-c/bindings/ruby/ruby.i
@@ -28,6 +28,47 @@
 #include <proton/url.h>
 #include <proton/reactor.h>
 #include <proton/handlers.h>
+
+
+/*
+NOTE: According to ccache-swig man page: "Known problems are using
+preprocessor directives within %inline blocks and the use of ’#pragma SWIG’."
+This includes using any macros in an %inline section.
+
+Do any preprocessor work or macro expansions here before we get into the %inline sections.
+*/
+
+#define CID_Pn_rbkey CID_pn_void
+
+typedef struct {
+  void *registry;
+  char *method;
+  char *key_value;
+} Pn_rbkey_t;
+
+void Pn_rbkey_initialize(Pn_rbkey_t *rbkey) {
+  assert(rbkey);
+  rbkey->registry = NULL;
+  rbkey->method = NULL;
+  rbkey->key_value = NULL;
+}
+
+void Pn_rbkey_finalize(Pn_rbkey_t *rbkey) {
+  if(rbkey && rbkey->registry && rbkey->method && rbkey->key_value) {
+    rb_funcall((VALUE )rbkey->registry, rb_intern(rbkey->method), 1, rb_str_new2(rbkey->key_value));
+  }
+  if(rbkey->key_value) {
+    free(rbkey->key_value);
+    rbkey->key_value = NULL;
+  }
+}
+
+#define Pn_rbkey_inspect NULL
+#define Pn_rbkey_compare NULL
+#define Pn_rbkey_hashcode NULL
+
+PN_CLASSDEF(Pn_rbkey)
+
 %}
 
 %include <cstring.i>
@@ -465,37 +506,6 @@
 
 %inline %{
 
-#define CID_Pn_rbkey CID_pn_void
-
-typedef struct {
-  void *registry;
-  char *method;
-  char *key_value;
-} Pn_rbkey_t;
-
-void Pn_rbkey_initialize(Pn_rbkey_t *rbkey) {
-  assert(rbkey);
-  rbkey->registry = NULL;
-  rbkey->method = NULL;
-  rbkey->key_value = NULL;
-}
-
-void Pn_rbkey_finalize(Pn_rbkey_t *rbkey) {
-  if(rbkey && rbkey->registry && rbkey->method && rbkey->key_value) {
-    rb_funcall((VALUE )rbkey->registry, rb_intern(rbkey->method), 1, rb_str_new2(rbkey->key_value));
-  }
-  if(rbkey->key_value) {
-    free(rbkey->key_value);
-    rbkey->key_value = NULL;
-  }
-}
-
-#define Pn_rbkey_inspect NULL
-#define Pn_rbkey_compare NULL
-#define Pn_rbkey_hashcode NULL
-
-PN_CLASSDEF(Pn_rbkey)
-
 void Pn_rbkey_set_registry(Pn_rbkey_t *rbkey, void *registry) {
   assert(rbkey);
   rbkey->registry = registry;
@@ -569,7 +579,8 @@
   }
 
   VALUE pni_ruby_get_from_registry(VALUE key) {
-    rb_funcall(pni_ruby_get_proton_module(), rb_intern("get_from_registry"), 1, key);
+
+      return rb_funcall(pni_ruby_get_proton_module(), rb_intern("get_from_registry"), 1, key);
   }
 
   void pni_ruby_delete_from_registry(VALUE stored_key) {