THRIFT-332. rb: Compact Protocol in Ruby

This patch includes both a pure Ruby and C-extension port of the Compact Protocol described in THRIFT-110. It also fixes a bug in struct.c that was interfering with native protocol method calls, and adds some utility classes to the Java library for serializing/deserializing to a file for the purpose of testing protocols cross-language.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@756133 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/ext/binary_protocol_accelerated.c b/lib/rb/ext/binary_protocol_accelerated.c
index fc4b675..bb4f4a3 100644
--- a/lib/rb/ext/binary_protocol_accelerated.c
+++ b/lib/rb/ext/binary_protocol_accelerated.c
@@ -3,12 +3,7 @@
 #include <stdint.h>
 #include <constants.h>
 #include <struct.h>
-
-#define GET_TRANSPORT(obj) rb_ivar_get(obj, transport_ivar_id)
-#define GET_STRICT_READ(obj) rb_ivar_get(obj, strict_read_ivar_id)
-#define GET_STRICT_WRITE(obj) rb_ivar_get(obj, strict_write_ivar_id)
-#define WRITE(obj, data, length) rb_funcall(obj, write_method_id, 1, rb_str_new(data, length))
-#define CHECK_NIL(obj) if (NIL_P(obj)) { rb_raise(rb_eStandardError, "nil argument not allowed!");}
+#include "macros.h"
 
 VALUE rb_thrift_binary_proto_native_qmark(VALUE self) {
   return Qtrue;
@@ -205,8 +200,6 @@
 // interface reading methods
 //---------------------------------------
 
-#define READ(obj, length) rb_funcall(GET_TRANSPORT(obj), read_method_id, 1, INT2FIX(length)) 
-
 VALUE rb_thrift_binary_proto_read_string(VALUE self);
 VALUE rb_thrift_binary_proto_read_byte(VALUE self);
 VALUE rb_thrift_binary_proto_read_i32(VALUE self);