You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2014/11/09 03:33:46 UTC

[1/5] thrift git commit: THRIFT-2806 more whitespace fixups Client: Haxe Patch: Jens Geyer

Repository: thrift
Updated Branches:
  refs/heads/master fea00ac87 -> b502832c7


http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/tutorial/haxe/src/Main.hx
----------------------------------------------------------------------
diff --git a/tutorial/haxe/src/Main.hx b/tutorial/haxe/src/Main.hx
index 41d8945..d4ba054 100644
--- a/tutorial/haxe/src/Main.hx
+++ b/tutorial/haxe/src/Main.hx
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package;
 
 import org.apache.thrift.*;
@@ -30,296 +30,297 @@ import shared.*;
 
 
 enum Prot {
-	binary;
-	json;
+    binary;
+    json;
 }
 
 enum Trns {
-	socket;
-	http;
+    socket;
+    http;
 }
 
 class Main {
-	
-	private static var server : Bool = false;
-	private static var framed : Bool = false;
-	private static var buffered : Bool = false;
-	private static var prot : Prot = binary;
-	private static var trns : Trns = socket;
-	
-	private static var targetHost : String = "localhost";
-	private static var targetPort : Int = 9090;
-	
-	static function main() {
-		#if ! (flash || js)
-		try {
-  			ParseArgs();
-		} catch (e : String) {
-			trace(e);
-			trace(GetHelp());
-			return;
-		}
-		#end
-
-		try {
-			if (server)
-				RunServer();
-			else 
-				RunClient();
-		} catch (e : String) {
-			trace(e);
-		}
-
-		trace("Completed.");
+
+    private static var server : Bool = false;
+    private static var framed : Bool = false;
+    private static var buffered : Bool = false;
+    private static var prot : Prot = binary;
+    private static var trns : Trns = socket;
+
+    private static var targetHost : String = "localhost";
+    private static var targetPort : Int = 9090;
+
+    static function main() {
+        #if ! (flash || js)
+        try {
+              ParseArgs();
+        } catch (e : String) {
+            trace(e);
+            trace(GetHelp());
+            return;
+        }
+        #end
+
+        try {
+            if (server)
+                RunServer();
+            else
+                RunClient();
+        } catch (e : String) {
+            trace(e);
+        }
+
+        trace("Completed.");
     }
 
-	
-	#if ! (flash || js)
-		
-	private static function GetHelp() : String {
-		return Sys.executablePath()+"  modus  trnsOption  transport  protocol\n"
-		+"Options:\n"
-		+"  modus:       client, server   (default: client)\n"
-		+"  trnsOption:  framed, buffered (default: none)\n"
-		+"  transport:   socket, http     (default: socket)\n"
-		+"  protocol:    binary, json     (default: binary)\n"
-		+"\n"
-		+"All arguments are optional.\n";
-	}
-	
-
-	private static function ParseArgs() : Void {
-		var step = 0;
-		for (arg in Sys.args()) {
-			
-			// server|client
-			switch(step) {
-			case 0:
-				++step;
-				if ( arg == "client") 
-					server = false;
-				else if ( arg == "server") 
-					server = true;
-				else
-					throw "First argument must be 'server' or 'client'";
-					
-			case 1:					
-				if ( arg == "framed") {
-					framed = true;
-				} else if ( arg == "buffered") {
-					buffered = true;
-				} else if ( arg == "socket") {
-					trns = socket;
-					++step;
-				} else if ( arg == "http") {
-					trns = http;
-					++step;
-				} else {
-					throw "Unknown transport "+arg;
-				}					
-
-			case 2:					
-				if ( arg == "binary") {
-					prot = binary;
-					++step;
-				} else if ( arg == "json") {
-					prot = json;
-					++step;
-				} else {
-					throw "Unknown protocol "+arg;
-				}					
-
-			default:
-				throw "Unexpected argument "+arg;
-			}
-
-			if ( framed && buffered)
-			{
-				trace("WN: framed supersedes buffered");
-			}
-
-		}
-	}
-
-	#end
-	
-	private static function ClientSetup() : Calculator {
-	 	trace("Client configuration:");
-
-		// endpoint transport
-		var transport : TTransport;
-		switch(trns)
-		{
-		case socket:
-		 	trace('- socket transport $targetHost:$targetPort');
-			transport = new TSocket( targetHost, targetPort);
+
+    #if ! (flash || js)
+
+    private static function GetHelp() : String {
+        return Sys.executablePath()+"  modus  trnsOption  transport  protocol\n"
+        +"Options:\n"
+        +"  modus:       client, server   (default: client)\n"
+        +"  trnsOption:  framed, buffered (default: none)\n"
+        +"  transport:   socket, http     (default: socket)\n"
+        +"  protocol:    binary, json     (default: binary)\n"
+        +"\n"
+        +"All arguments are optional.\n";
+    }
+
+
+    private static function ParseArgs() : Void {
+        var step = 0;
+        for (arg in Sys.args()) {
+
+            // server|client
+            switch(step) {
+            case 0:
+                ++step;
+                if ( arg == "client")
+                    server = false;
+                else if ( arg == "server")
+                    server = true;
+                else
+                    throw "First argument must be 'server' or 'client'";
+
+            case 1:
+                if ( arg == "framed") {
+                    framed = true;
+                } else if ( arg == "buffered") {
+                    buffered = true;
+                } else if ( arg == "socket") {
+                    trns = socket;
+                    ++step;
+                } else if ( arg == "http") {
+                    trns = http;
+                    ++step;
+                } else {
+                    throw "Unknown transport "+arg;
+                }
+
+            case 2:
+                if ( arg == "binary") {
+                    prot = binary;
+                    ++step;
+                } else if ( arg == "json") {
+                    prot = json;
+                    ++step;
+                } else {
+                    throw "Unknown protocol "+arg;
+                }
+
+            default:
+                throw "Unexpected argument "+arg;
+            }
+
+            if ( framed && buffered)
+            {
+                trace("WN: framed supersedes buffered");
+            }
+
+        }
+    }
+
+    #end
+
+    private static function ClientSetup() : Calculator {
+         trace("Client configuration:");
+
+        // endpoint transport
+        var transport : TTransport;
+        switch(trns)
+        {
+        case socket:
+             trace('- socket transport $targetHost:$targetPort');
+            transport = new TSocket( targetHost, targetPort);
         case http:
-		 	trace('- HTTP transport $targetHost');
-			transport = new THttpClient( targetHost);
-		default:
-			throw "Unhandled transport";
-		}
-
-		
-		// optinal layered transport
-		if ( framed) {
-		 	trace("- framed transport");
-			transport = new TFramedTransport(transport);
-		} else if ( buffered) {
-		 	trace("- buffered transport");
-			throw "TBufferedTransport not implemented yet";
-			//transport = new TBufferedTransport(transport);
-		}
-
-		
-		// protocol
-		var protocol : TProtocol;
-		switch(prot)
-		{
-		case binary:
-		 	trace("- binary protocol");
-		 	protocol = new TBinaryProtocol( transport);
+             trace('- HTTP transport $targetHost');
+            transport = new THttpClient( targetHost);
+        default:
+            throw "Unhandled transport";
+        }
+
+
+        // optinal layered transport
+        if ( framed) {
+             trace("- framed transport");
+            transport = new TFramedTransport(transport);
+        } else if ( buffered) {
+             trace("- buffered transport");
+            throw "TBufferedTransport not implemented yet";
+            //transport = new TBufferedTransport(transport);
+        }
+
+
+        // protocol
+        var protocol : TProtocol;
+        switch(prot)
+        {
+        case binary:
+             trace("- binary protocol");
+             protocol = new TBinaryProtocol( transport);
         case json:
-		 	trace("- JSON protocol");
-		 	protocol = new TJSONProtocol( transport);
-		default:
-			throw "Unhandled protocol";
-		}
-
-		
-		// put everything together
-		transport.open();	
-		return new CalculatorImpl(protocol,protocol);
-	}
-	
-	
-	private static function RunClient() : Void {
-		var client = ClientSetup();
-
-		try {
-		  	client.ping();
-			trace("ping() successful");
-		} catch(error : TException) { 
-			trace('ping() failed: $error'); 
-		} catch(error : Dynamic) { 
-			trace('ping() failed: $error'); 
-		}
-
-		try {
-			var sum = client.add( 1, 1); 
-			trace('1+1=$sum');
-		} catch(error : TException) { 
-			trace('add() failed: $error'); 
-		} catch(error : Dynamic) { 
-			trace('add() failed: $error'); 
-		}
-
-
-		var work = new tutorial.Work();
-		work.op = tutorial.Operation.DIVIDE;
-		work.num1 = 1;
-		work.num2 = 0;
-		try {
-			var quotient = client.calculate( 1, work); 
-			trace('Whoa we can divide by 0! Result = $quotient'); 
-		} catch(error : TException) { 
-			trace('calculate() failed: $error'); 
-		} catch(error : Dynamic) { 
-			trace('calculate() failed: $error'); 
-		}
-
-		work.op = tutorial.Operation.SUBTRACT;
-		work.num1 = 15;
-		work.num2 = 10;
-		try {
-			var diff = client.calculate( 1, work);
-			trace('15-10=$diff');
-		} catch(error : TException) { 
-			trace('calculate() failed: $error'); 
-		} catch(error : Dynamic) { 
-			trace('calculate() failed: $error'); 
-		}
-
-
-		try {
-			var log : SharedStruct = client.getStruct( 1);
-			var logval = log.value;
-			trace('Check log: $logval');
-		} catch(error : TException) { 
-			trace('getStruct() failed: $error'); 
-		} catch(error : Dynamic) { 
-			trace('getStruct() failed: $error'); 
-		}
-	}
-	
-	
-	private static function ServerSetup() : TServer {
-	 	trace("Server configuration:");
-
-		// endpoint transport
-		var transport : TServerTransport = null;
-		switch(trns)
-		{
-		case socket:
-			#if (flash || js)
-			throw 'current platform does not support socket servers';
-			#else
-		 	trace('- socket transport port $targetPort');
-			transport = new TServerSocket( targetPort);
-			#end
+             trace("- JSON protocol");
+             protocol = new TJSONProtocol( transport);
+        default:
+            throw "Unhandled protocol";
+        }
+
+
+        // put everything together
+        transport.open();
+        return new CalculatorImpl(protocol,protocol);
+    }
+
+
+    private static function RunClient() : Void {
+        var client = ClientSetup();
+
+        try {
+              client.ping();
+            trace("ping() successful");
+        } catch(error : TException) {
+            trace('ping() failed: $error');
+        } catch(error : Dynamic) {
+            trace('ping() failed: $error');
+        }
+
+        try {
+            var sum = client.add( 1, 1);
+            trace('1+1=$sum');
+        } catch(error : TException) {
+            trace('add() failed: $error');
+        } catch(error : Dynamic) {
+            trace('add() failed: $error');
+        }
+
+
+        var work = new tutorial.Work();
+        work.op = tutorial.Operation.DIVIDE;
+        work.num1 = 1;
+        work.num2 = 0;
+        try {
+            var quotient = client.calculate( 1, work);
+            trace('Whoa we can divide by 0! Result = $quotient');
+        } catch(error : TException) {
+            trace('calculate() failed: $error');
+        } catch(error : Dynamic) {
+            trace('calculate() failed: $error');
+        }
+
+        work.op = tutorial.Operation.SUBTRACT;
+        work.num1 = 15;
+        work.num2 = 10;
+        try {
+            var diff = client.calculate( 1, work);
+            trace('15-10=$diff');
+        } catch(error : TException) {
+            trace('calculate() failed: $error');
+        } catch(error : Dynamic) {
+            trace('calculate() failed: $error');
+        }
+
+
+        try {
+            var log : SharedStruct = client.getStruct( 1);
+            var logval = log.value;
+            trace('Check log: $logval');
+        } catch(error : TException) {
+            trace('getStruct() failed: $error');
+        } catch(error : Dynamic) {
+            trace('getStruct() failed: $error');
+        }
+    }
+
+
+    private static function ServerSetup() : TServer {
+         trace("Server configuration:");
+
+        // endpoint transport
+        var transport : TServerTransport = null;
+        switch(trns)
+        {
+        case socket:
+            #if (flash || js)
+            throw 'current platform does not support socket servers';
+            #else
+             trace('- socket transport port $targetPort');
+            transport = new TServerSocket( targetPort);
+            #end
         case http:
-			throw "HTTP server not implemented yet";
-		 	//trace("- http transport");
-		 	//transport = new THttpClient( targetHost);
-		default:
-			throw "Unhandled transport";
-		}
-		
-		// optional: layered transport
-		var transfactory : TTransportFactory = null;
-		if ( framed) {
-		 	trace("- framed transport");
-			transfactory = new TFramedTransportFactory();
-		} else if ( buffered) {
-		 	trace("- buffered transport");
-			throw "TBufferedTransport not implemented yet";
-			//transfactory = new TBufferedTransportFactory();
-		}
-		
-		// protocol
-		var protfactory : TProtocolFactory = null;
-		switch(prot)
-		{
-		case binary:
-		 	trace("- binary protocol");
-		 	protfactory = new TBinaryProtocolFactory();
+            throw "HTTP server not implemented yet";
+             //trace("- http transport");
+             //transport = new THttpClient( targetHost);
+        default:
+            throw "Unhandled transport";
+        }
+
+        // optional: layered transport
+        var transfactory : TTransportFactory = null;
+        if ( framed) {
+             trace("- framed transport");
+            transfactory = new TFramedTransportFactory();
+        } else if ( buffered) {
+             trace("- buffered transport");
+            throw "TBufferedTransport not implemented yet";
+            //transfactory = new TBufferedTransportFactory();
+        }
+
+        // protocol
+        var protfactory : TProtocolFactory = null;
+        switch(prot)
+        {
+        case binary:
+             trace("- binary protocol");
+             protfactory = new TBinaryProtocolFactory();
         case json:
-			trace("- JSON protocol");
-		 	protfactory = new TJSONProtocolFactory();
-		default:
-			throw "Unhandled protocol";
-		}
-		
-		var handler = new CalculatorHandler();
-		var processor = new CalculatorProcessor(handler);
-		var server = new TSimpleServer( processor, transport, transfactory, protfactory);
-		return server;
-	}
-	
-	
-	private static function RunServer() : Void {
-		try
-		{
-			var server = ServerSetup();
-
-			trace("\nStarting the server...");
-			server.Serve();
-		}
-		catch( e : Dynamic)
-		{
-			trace('RunServer() failed: $e');
-		}
-		trace("done.");
-	}
-	
+            trace("- JSON protocol");
+             protfactory = new TJSONProtocolFactory();
+        default:
+            throw "Unhandled protocol";
+        }
+
+        var handler = new CalculatorHandler();
+        var processor = new CalculatorProcessor(handler);
+        var server = new TSimpleServer( processor, transport, transfactory, protfactory);
+        return server;
+    }
+
+
+    private static function RunServer() : Void {
+        try
+        {
+            var server = ServerSetup();
+
+            trace("\nStarting the server...");
+            server.Serve();
+        }
+        catch( e : Dynamic)
+        {
+            trace('RunServer() failed: $e');
+        }
+        trace("done.");
+    }
+
 }
+ 
\ No newline at end of file


[4/5] thrift git commit: THRIFT-2806 more whitespace fixups Client: Haxe Patch: Jens Geyer

Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx
index 1a93332..aeed8f4 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx
@@ -47,747 +47,747 @@ import org.apache.thrift.transport.TTransport;
 */
 class TJSONProtocol implements TProtocol {
 
-	public var trans(default,null) : TTransport;
-
-	// Stack of nested contexts that we may be in
-	private var contextStack : GenericStack<JSONBaseContext> = new GenericStack<JSONBaseContext>();
-
-	// Current context that we are in
-	private var context : JSONBaseContext;
-
-	// Reader that manages a 1-byte buffer
-	private var reader : LookaheadReader;
-
-	// whether the underlying system holds Strings as UTF-8
-	// http://old.haxe.org/manual/encoding
-	private static var utf8Strings = haxe.Utf8.validate("Ç-ß-Æ-Ю-Ш");
-
-	// TJSONProtocol Constructor
-	public function new( trans : TTransport)
-	{
-		this.trans = trans;
-		this.context = new JSONBaseContext(this);
-		this.reader = new LookaheadReader(this);
-	}
-
-	public function getTransport() : TTransport {
-	  return trans;
-	}
-
-	public function writeMessageBegin(message:TMessage) : Void {
-		WriteJSONArrayStart();
-		WriteJSONInteger( JSONConstants.VERSION);
-		WriteJSONString( BytesFromString(message.name));
-		WriteJSONInteger( message.type);
-		WriteJSONInteger( message.seqid);
-	}
-
-	public function writeMessageEnd() : Void {
-		WriteJSONArrayEnd();
-	}
-
-	public function writeStructBegin(struct:TStruct) : Void {
-		WriteJSONObjectStart();
-	}
-
-	public function writeStructEnd() : Void {
-		WriteJSONObjectEnd();
-	}
-
-	public function writeFieldBegin(field:TField) : Void {
-		WriteJSONInteger( field.id );
-		WriteJSONObjectStart();
-		WriteJSONString( BytesFromString( JSONConstants.GetTypeNameForTypeID( field.type)));
-	}
-
-	public function writeFieldEnd() : Void {
-		WriteJSONObjectEnd();
-	}
-
-	public function writeFieldStop() : Void { }
-
-	public function writeMapBegin(map:TMap) : Void {
-		WriteJSONArrayStart();
-		WriteJSONString( BytesFromString( JSONConstants.GetTypeNameForTypeID( map.keyType)));
-		WriteJSONString( BytesFromString( JSONConstants.GetTypeNameForTypeID( map.valueType)));
-		WriteJSONInteger( map.size);
-		WriteJSONObjectStart();
-	}
-
-	public function writeMapEnd() : Void {
-		WriteJSONObjectEnd();
-		WriteJSONArrayEnd();
-	}
-
-	public function writeListBegin(list:TList) : Void {
-		WriteJSONArrayStart();
-		WriteJSONString( BytesFromString( JSONConstants.GetTypeNameForTypeID( list.elemType )));
-		WriteJSONInteger( list.size);
-	}
-
-	public function writeListEnd() : Void {
-		WriteJSONArrayEnd();
-	}
-
-	public function writeSetBegin(set:TSet) : Void {
-		WriteJSONArrayStart();
-		WriteJSONString( BytesFromString( JSONConstants.GetTypeNameForTypeID( set.elemType)));
-		WriteJSONInteger( set.size);
-	}
-
-	public function writeSetEnd() : Void {
-		WriteJSONArrayEnd();
-	}
-
-	public function writeBool(b : Bool) : Void {
-		if( b)
-			WriteJSONInteger( 1);
-		else
-			WriteJSONInteger( 0);
-	}
-
-	public function writeByte(b : Int) : Void {
-		WriteJSONInteger( b);
-	}
-
-	public function writeI16(i16 : Int) : Void {
-		WriteJSONInteger( i16);
-	}
-
-	public function writeI32(i32 : Int) : Void {
-		WriteJSONInteger( i32);
-	}
-
-	public function writeI64(i64 : haxe.Int64) : Void {
-		WriteJSONInt64( i64);
-	}
-
-	public function writeDouble(dub:Float) : Void {
-		WriteJSONDouble(dub);
-	}
-
-	public function writeString(str : String) : Void {
-		WriteJSONString( BytesFromString(str));
-	}
-
-	public function writeBinary(bin:Bytes) : Void {
-		WriteJSONBase64(bin);
-	}
-
-	public function readMessageBegin():TMessage {
-		var message : TMessage = new TMessage();
-		ReadJSONArrayStart();
-		if (ReadJSONInteger() != JSONConstants.VERSION)
-		{
-			throw new TProtocolException(TProtocolException.BAD_VERSION,
-										 "Message contained bad version.");
-		}
-
-		message.name = ReadJSONString(false);
-		message.type = ReadJSONInteger();
-		message.seqid = ReadJSONInteger();
-		return message;
-	}
-
-	public function readMessageEnd() : Void {
-		ReadJSONArrayEnd();
-	}
-
-	public function readStructBegin():TStruct {
-		ReadJSONObjectStart();
-		return new TStruct();
-	}
-
-	public function readStructEnd() : Void {
-		ReadJSONObjectEnd();
-	}
-
-	public function readFieldBegin() : TField {
-		var field : TField = new TField();
-		var ch = reader.Peek();
-		if (StringFromBytes(ch) == JSONConstants.RBRACE)
-		{
-			field.type = TType.STOP;
-		}
-		else
-		{
-			field.id = ReadJSONInteger();
-			ReadJSONObjectStart();
-			field.type = JSONConstants.GetTypeIDForTypeName( ReadJSONString(false));
-		}
-		return field;
-	}
-
-	public function readFieldEnd() : Void {
-		ReadJSONObjectEnd();
-	}
-
-	public function readMapBegin() : TMap {
-		ReadJSONArrayStart();
-		var KeyType = JSONConstants.GetTypeIDForTypeName( ReadJSONString(false));
-		var ValueType = JSONConstants.GetTypeIDForTypeName( ReadJSONString(false));
-		var Count : Int = ReadJSONInteger();
-		ReadJSONObjectStart();
-
-		var map = new TMap( KeyType, ValueType, Count);
-		return map;
-	}
-
-	public function readMapEnd() : Void {
-		ReadJSONObjectEnd();
-		ReadJSONArrayEnd();
-	}
-
-	public function readListBegin():TList {
-		ReadJSONArrayStart();
-		var ElementType = JSONConstants.GetTypeIDForTypeName( ReadJSONString(false));
-		var Count : Int = ReadJSONInteger();
-
-		var list = new TList( ElementType, Count);
-		return list;
-	}
-
-	public function readListEnd() : Void {
-		ReadJSONArrayEnd();
-	}
-
-	public function readSetBegin() : TSet {
-		ReadJSONArrayStart();
-		var ElementType = JSONConstants.GetTypeIDForTypeName( ReadJSONString(false));
-		var Count : Int = ReadJSONInteger();
-
-		var set = new TSet( ElementType, Count);
-		return set;
-	}
-
-	public function readSetEnd() : Void {
-		ReadJSONArrayEnd();
-	}
-
-	public function readBool() : Bool {
-		return (ReadJSONInteger() != 0);
-	}
-
-	public function readByte() : Int {
-		return ReadJSONInteger();
-	}
-
-	public function readI16() : Int {
-		return ReadJSONInteger();
-	}
-
-	public function readI32() : Int {
-		return ReadJSONInteger();
-	}
-
-	public function readI64() : haxe.Int64 {
-		return ReadJSONInt64();
-	}
-
-	public function readDouble():Float {
-		return ReadJSONDouble();
-	}
-
-	public function readString() : String {
+    public var trans(default,null) : TTransport;
+
+    // Stack of nested contexts that we may be in
+    private var contextStack : GenericStack<JSONBaseContext> = new GenericStack<JSONBaseContext>();
+
+    // Current context that we are in
+    private var context : JSONBaseContext;
+
+    // Reader that manages a 1-byte buffer
+    private var reader : LookaheadReader;
+
+    // whether the underlying system holds Strings as UTF-8
+    // http://old.haxe.org/manual/encoding
+    private static var utf8Strings = haxe.Utf8.validate("Ç-ß-Æ-Ю-Ш");
+
+    // TJSONProtocol Constructor
+    public function new( trans : TTransport)
+    {
+        this.trans = trans;
+        this.context = new JSONBaseContext(this);
+        this.reader = new LookaheadReader(this);
+    }
+
+    public function getTransport() : TTransport {
+      return trans;
+    }
+
+    public function writeMessageBegin(message:TMessage) : Void {
+        WriteJSONArrayStart();
+        WriteJSONInteger( JSONConstants.VERSION);
+        WriteJSONString( BytesFromString(message.name));
+        WriteJSONInteger( message.type);
+        WriteJSONInteger( message.seqid);
+    }
+
+    public function writeMessageEnd() : Void {
+        WriteJSONArrayEnd();
+    }
+
+    public function writeStructBegin(struct:TStruct) : Void {
+        WriteJSONObjectStart();
+    }
+
+    public function writeStructEnd() : Void {
+        WriteJSONObjectEnd();
+    }
+
+    public function writeFieldBegin(field:TField) : Void {
+        WriteJSONInteger( field.id );
+        WriteJSONObjectStart();
+        WriteJSONString( BytesFromString( JSONConstants.GetTypeNameForTypeID( field.type)));
+    }
+
+    public function writeFieldEnd() : Void {
+        WriteJSONObjectEnd();
+    }
+
+    public function writeFieldStop() : Void { }
+
+    public function writeMapBegin(map:TMap) : Void {
+        WriteJSONArrayStart();
+        WriteJSONString( BytesFromString( JSONConstants.GetTypeNameForTypeID( map.keyType)));
+        WriteJSONString( BytesFromString( JSONConstants.GetTypeNameForTypeID( map.valueType)));
+        WriteJSONInteger( map.size);
+        WriteJSONObjectStart();
+    }
+
+    public function writeMapEnd() : Void {
+        WriteJSONObjectEnd();
+        WriteJSONArrayEnd();
+    }
+
+    public function writeListBegin(list:TList) : Void {
+        WriteJSONArrayStart();
+        WriteJSONString( BytesFromString( JSONConstants.GetTypeNameForTypeID( list.elemType )));
+        WriteJSONInteger( list.size);
+    }
+
+    public function writeListEnd() : Void {
+        WriteJSONArrayEnd();
+    }
+
+    public function writeSetBegin(set:TSet) : Void {
+        WriteJSONArrayStart();
+        WriteJSONString( BytesFromString( JSONConstants.GetTypeNameForTypeID( set.elemType)));
+        WriteJSONInteger( set.size);
+    }
+
+    public function writeSetEnd() : Void {
+        WriteJSONArrayEnd();
+    }
+
+    public function writeBool(b : Bool) : Void {
+        if( b)
+            WriteJSONInteger( 1);
+        else
+            WriteJSONInteger( 0);
+    }
+
+    public function writeByte(b : Int) : Void {
+        WriteJSONInteger( b);
+    }
+
+    public function writeI16(i16 : Int) : Void {
+        WriteJSONInteger( i16);
+    }
+
+    public function writeI32(i32 : Int) : Void {
+        WriteJSONInteger( i32);
+    }
+
+    public function writeI64(i64 : haxe.Int64) : Void {
+        WriteJSONInt64( i64);
+    }
+
+    public function writeDouble(dub:Float) : Void {
+        WriteJSONDouble(dub);
+    }
+
+    public function writeString(str : String) : Void {
+        WriteJSONString( BytesFromString(str));
+    }
+
+    public function writeBinary(bin:Bytes) : Void {
+        WriteJSONBase64(bin);
+    }
+
+    public function readMessageBegin():TMessage {
+        var message : TMessage = new TMessage();
+        ReadJSONArrayStart();
+        if (ReadJSONInteger() != JSONConstants.VERSION)
+        {
+            throw new TProtocolException(TProtocolException.BAD_VERSION,
+                                         "Message contained bad version.");
+        }
+
+        message.name = ReadJSONString(false);
+        message.type = ReadJSONInteger();
+        message.seqid = ReadJSONInteger();
+        return message;
+    }
+
+    public function readMessageEnd() : Void {
+        ReadJSONArrayEnd();
+    }
+
+    public function readStructBegin():TStruct {
+        ReadJSONObjectStart();
+        return new TStruct();
+    }
+
+    public function readStructEnd() : Void {
+        ReadJSONObjectEnd();
+    }
+
+    public function readFieldBegin() : TField {
+        var field : TField = new TField();
+        var ch = reader.Peek();
+        if (StringFromBytes(ch) == JSONConstants.RBRACE)
+        {
+            field.type = TType.STOP;
+        }
+        else
+        {
+            field.id = ReadJSONInteger();
+            ReadJSONObjectStart();
+            field.type = JSONConstants.GetTypeIDForTypeName( ReadJSONString(false));
+        }
+        return field;
+    }
+
+    public function readFieldEnd() : Void {
+        ReadJSONObjectEnd();
+    }
+
+    public function readMapBegin() : TMap {
+        ReadJSONArrayStart();
+        var KeyType = JSONConstants.GetTypeIDForTypeName( ReadJSONString(false));
+        var ValueType = JSONConstants.GetTypeIDForTypeName( ReadJSONString(false));
+        var Count : Int = ReadJSONInteger();
+        ReadJSONObjectStart();
+
+        var map = new TMap( KeyType, ValueType, Count);
+        return map;
+    }
+
+    public function readMapEnd() : Void {
+        ReadJSONObjectEnd();
+        ReadJSONArrayEnd();
+    }
+
+    public function readListBegin():TList {
+        ReadJSONArrayStart();
+        var ElementType = JSONConstants.GetTypeIDForTypeName( ReadJSONString(false));
+        var Count : Int = ReadJSONInteger();
+
+        var list = new TList( ElementType, Count);
+        return list;
+    }
+
+    public function readListEnd() : Void {
+        ReadJSONArrayEnd();
+    }
+
+    public function readSetBegin() : TSet {
+        ReadJSONArrayStart();
+        var ElementType = JSONConstants.GetTypeIDForTypeName( ReadJSONString(false));
+        var Count : Int = ReadJSONInteger();
+
+        var set = new TSet( ElementType, Count);
+        return set;
+    }
+
+    public function readSetEnd() : Void {
+        ReadJSONArrayEnd();
+    }
+
+    public function readBool() : Bool {
+        return (ReadJSONInteger() != 0);
+    }
+
+    public function readByte() : Int {
+        return ReadJSONInteger();
+    }
+
+    public function readI16() : Int {
+        return ReadJSONInteger();
+    }
+
+    public function readI32() : Int {
+        return ReadJSONInteger();
+    }
+
+    public function readI64() : haxe.Int64 {
+        return ReadJSONInt64();
+    }
+
+    public function readDouble():Float {
+        return ReadJSONDouble();
+    }
+
+    public function readString() : String {
         return ReadJSONString(false);
-	}
-
-	public function readBinary() : Bytes {
-		return ReadJSONBase64();
-	}
-
-	// Push a new JSON context onto the stack.
-	private function  PushContext(c : JSONBaseContext) : Void {
-		contextStack.add(context);
-		context = c;
-	}
-
-	// Pop the last JSON context off the stack
-	private function  PopContext() : Void {
-		context = contextStack.pop();
-	}
-
-
-	// Write the bytes in array buf as a JSON characters, escaping as needed
-	private function WriteJSONString( b : Bytes) : Void {
-		context.Write();
-
-		var tmp = BytesFromString( JSONConstants.QUOTE);
-		trans.write( tmp, 0, tmp.length);
-
-		for (i in 0 ... b.length) {
-			var value = b.get(i);
-
-			if ((value & 0x00FF) >= 0x30)
-			{
-				if (String.fromCharCode(value) == JSONConstants.BACKSLASH.charAt(0))
-				{
-					tmp = BytesFromString( JSONConstants.BACKSLASH + JSONConstants.BACKSLASH);
-					trans.write( tmp, 0, tmp.length);
-				}
-				else
-				{
-					trans.write( b, i, 1);
-				}
-			}
-			else
-			{
-				var num = JSONConstants.JSON_CHAR_TABLE[value];
-				if (num == 1)
-				{
-					trans.write( b, i, 1);
-				}
-				else if (num > 1)
-				{
-					var buf = new BytesBuffer();
-					buf.addString( JSONConstants.BACKSLASH);
-					buf.addByte( num);
-					tmp = buf.getBytes();
-					trans.write( tmp, 0, tmp.length);
-				}
-				else
-				{
-					var buf = new BytesBuffer();
-					buf.addString( JSONConstants.ESCSEQ);
-					buf.addString( HexChar( (value & 0xFF000000) >> 12));
-					buf.addString( HexChar( (value & 0x00FF0000) >> 8));
-					buf.addString( HexChar( (value & 0x0000FF00) >> 4));
-					buf.addString( HexChar( value & 0x000000FF));
-					tmp = buf.getBytes();
-					trans.write( tmp, 0, tmp.length);
-				}
-			}
-		}
-
-		tmp = BytesFromString( JSONConstants.QUOTE);
-		trans.write( tmp, 0, tmp.length);
-	}
-
-	// Write out number as a JSON value. If the context dictates so,
-	// it will be wrapped in quotes to output as a JSON string.
-	private function WriteJSONInteger( num : Int) : Void {
-		context.Write();
-
-		var str : String = "";
-		var escapeNum : Bool = context.EscapeNumbers();
-
-		if (escapeNum) {
-			str += JSONConstants.QUOTE;
-		}
-
-		str += Std.string(num);
-
-		if (escapeNum) {
-			str += JSONConstants.QUOTE;
-		}
-
-		var tmp = BytesFromString( str);
-		trans.write( tmp, 0, tmp.length);
-	}
-
-	// Write out number as a JSON value. If the context dictates so,
-	// it will be wrapped in quotes to output as a JSON string.
-	private function WriteJSONInt64( num : Int64) : Void {
-		context.Write();
-
-		var str : String = "";
-		var escapeNum : Bool = context.EscapeNumbers();
-
-		if (escapeNum) {
-			str += JSONConstants.QUOTE;
-		}
-
-		str += Std.string(num);
-
-		if (escapeNum) {
-			str += JSONConstants.QUOTE;
-		}
-
-		var tmp = BytesFromString( str);
-		trans.write( tmp, 0, tmp.length);
-	}
-
-	// Write out a double as a JSON value. If it is NaN or infinity or if the
-	// context dictates escaping, Write out as JSON string.
-	private function WriteJSONDouble(num : Float) : Void {
-		context.Write();
-
-
-		var special : Bool = false;
-		var rendered : String = "";
-		if( Math.isNaN(num)) {
-			special = true;
-			rendered = JSONConstants.FLOAT_IS_NAN;
-		} else if (! Math.isFinite(num)) {
-			special = true;
-			if( num > 0) {
-				rendered = JSONConstants.FLOAT_IS_POS_INF;
-			} else {
-				rendered = JSONConstants.FLOAT_IS_NEG_INF;
-			}
-		} else {
-			rendered = Std.string(num);  // plain and simple float number
-		}
-
-		// compose output
-		var escapeNum : Bool = special || context.EscapeNumbers();
-		var str : String = "";
-		if (escapeNum) {
-			str += JSONConstants.QUOTE;
-		}
-		str += rendered;
-		if (escapeNum) {
-			str += JSONConstants.QUOTE;
-		}
-
-		var tmp = BytesFromString( str);
-		trans.write( tmp, 0, tmp.length);
-	}
-
-	// Write out contents of byte array b as a JSON string with base-64 encoded data
-	private function WriteJSONBase64( b : Bytes) : Void {
-		context.Write();
-
-		var buf = new BytesBuffer();
-		buf.addString( JSONConstants.QUOTE);
-		buf.addString( Base64.encode(b));
-		buf.addString( JSONConstants.QUOTE);
-
-		var tmp = buf.getBytes();
-		trans.write( tmp, 0, tmp.length);
-	}
-
-	private function WriteJSONObjectStart() : Void {
-		context.Write();
-		var tmp = BytesFromString( JSONConstants.LBRACE);
-		trans.write( tmp, 0, tmp.length);
-		PushContext( new JSONPairContext(this));
-	}
-
-	private function WriteJSONObjectEnd() : Void {
-		PopContext();
-		var tmp = BytesFromString( JSONConstants.RBRACE);
-		trans.write( tmp, 0, tmp.length);
-	}
-
-	private function WriteJSONArrayStart() : Void {
-		context.Write();
-		var tmp = BytesFromString( JSONConstants.LBRACKET);
-		trans.write( tmp, 0, tmp.length);
-		PushContext( new JSONListContext(this));
-	}
-
-	private function WriteJSONArrayEnd() : Void {
-		PopContext();
-		var tmp = BytesFromString( JSONConstants.RBRACKET);
-		trans.write( tmp, 0, tmp.length);
-	}
-
-
-	/**
-	 * Reading methods.
-	 */
-
-	// Read a byte that must match char, otherwise an exception is thrown.
-	public function ReadJSONSyntaxChar( char : String) : Void {
-		var b = BytesFromString( char);
-		
-		var ch = reader.Read();
-		if (ch.get(0) != b.get(0))
-		{
-			throw new TProtocolException(TProtocolException.INVALID_DATA,
-										 'Unexpected character: $ch');
-		}
-	}
-
-	// Read in a JSON string, unescaping as appropriate.
+    }
+
+    public function readBinary() : Bytes {
+        return ReadJSONBase64();
+    }
+
+    // Push a new JSON context onto the stack.
+    private function  PushContext(c : JSONBaseContext) : Void {
+        contextStack.add(context);
+        context = c;
+    }
+
+    // Pop the last JSON context off the stack
+    private function  PopContext() : Void {
+        context = contextStack.pop();
+    }
+
+
+    // Write the bytes in array buf as a JSON characters, escaping as needed
+    private function WriteJSONString( b : Bytes) : Void {
+        context.Write();
+
+        var tmp = BytesFromString( JSONConstants.QUOTE);
+        trans.write( tmp, 0, tmp.length);
+
+        for (i in 0 ... b.length) {
+            var value = b.get(i);
+
+            if ((value & 0x00FF) >= 0x30)
+            {
+                if (String.fromCharCode(value) == JSONConstants.BACKSLASH.charAt(0))
+                {
+                    tmp = BytesFromString( JSONConstants.BACKSLASH + JSONConstants.BACKSLASH);
+                    trans.write( tmp, 0, tmp.length);
+                }
+                else
+                {
+                    trans.write( b, i, 1);
+                }
+            }
+            else
+            {
+                var num = JSONConstants.JSON_CHAR_TABLE[value];
+                if (num == 1)
+                {
+                    trans.write( b, i, 1);
+                }
+                else if (num > 1)
+                {
+                    var buf = new BytesBuffer();
+                    buf.addString( JSONConstants.BACKSLASH);
+                    buf.addByte( num);
+                    tmp = buf.getBytes();
+                    trans.write( tmp, 0, tmp.length);
+                }
+                else
+                {
+                    var buf = new BytesBuffer();
+                    buf.addString( JSONConstants.ESCSEQ);
+                    buf.addString( HexChar( (value & 0xFF000000) >> 12));
+                    buf.addString( HexChar( (value & 0x00FF0000) >> 8));
+                    buf.addString( HexChar( (value & 0x0000FF00) >> 4));
+                    buf.addString( HexChar( value & 0x000000FF));
+                    tmp = buf.getBytes();
+                    trans.write( tmp, 0, tmp.length);
+                }
+            }
+        }
+
+        tmp = BytesFromString( JSONConstants.QUOTE);
+        trans.write( tmp, 0, tmp.length);
+    }
+
+    // Write out number as a JSON value. If the context dictates so,
+    // it will be wrapped in quotes to output as a JSON string.
+    private function WriteJSONInteger( num : Int) : Void {
+        context.Write();
+
+        var str : String = "";
+        var escapeNum : Bool = context.EscapeNumbers();
+
+        if (escapeNum) {
+            str += JSONConstants.QUOTE;
+        }
+
+        str += Std.string(num);
+
+        if (escapeNum) {
+            str += JSONConstants.QUOTE;
+        }
+
+        var tmp = BytesFromString( str);
+        trans.write( tmp, 0, tmp.length);
+    }
+
+    // Write out number as a JSON value. If the context dictates so,
+    // it will be wrapped in quotes to output as a JSON string.
+    private function WriteJSONInt64( num : Int64) : Void {
+        context.Write();
+
+        var str : String = "";
+        var escapeNum : Bool = context.EscapeNumbers();
+
+        if (escapeNum) {
+            str += JSONConstants.QUOTE;
+        }
+
+        str += Std.string(num);
+
+        if (escapeNum) {
+            str += JSONConstants.QUOTE;
+        }
+
+        var tmp = BytesFromString( str);
+        trans.write( tmp, 0, tmp.length);
+    }
+
+    // Write out a double as a JSON value. If it is NaN or infinity or if the
+    // context dictates escaping, Write out as JSON string.
+    private function WriteJSONDouble(num : Float) : Void {
+        context.Write();
+
+
+        var special : Bool = false;
+        var rendered : String = "";
+        if( Math.isNaN(num)) {
+            special = true;
+            rendered = JSONConstants.FLOAT_IS_NAN;
+        } else if (! Math.isFinite(num)) {
+            special = true;
+            if( num > 0) {
+                rendered = JSONConstants.FLOAT_IS_POS_INF;
+            } else {
+                rendered = JSONConstants.FLOAT_IS_NEG_INF;
+            }
+        } else {
+            rendered = Std.string(num);  // plain and simple float number
+        }
+
+        // compose output
+        var escapeNum : Bool = special || context.EscapeNumbers();
+        var str : String = "";
+        if (escapeNum) {
+            str += JSONConstants.QUOTE;
+        }
+        str += rendered;
+        if (escapeNum) {
+            str += JSONConstants.QUOTE;
+        }
+
+        var tmp = BytesFromString( str);
+        trans.write( tmp, 0, tmp.length);
+    }
+
+    // Write out contents of byte array b as a JSON string with base-64 encoded data
+    private function WriteJSONBase64( b : Bytes) : Void {
+        context.Write();
+
+        var buf = new BytesBuffer();
+        buf.addString( JSONConstants.QUOTE);
+        buf.addString( Base64.encode(b));
+        buf.addString( JSONConstants.QUOTE);
+
+        var tmp = buf.getBytes();
+        trans.write( tmp, 0, tmp.length);
+    }
+
+    private function WriteJSONObjectStart() : Void {
+        context.Write();
+        var tmp = BytesFromString( JSONConstants.LBRACE);
+        trans.write( tmp, 0, tmp.length);
+        PushContext( new JSONPairContext(this));
+    }
+
+    private function WriteJSONObjectEnd() : Void {
+        PopContext();
+        var tmp = BytesFromString( JSONConstants.RBRACE);
+        trans.write( tmp, 0, tmp.length);
+    }
+
+    private function WriteJSONArrayStart() : Void {
+        context.Write();
+        var tmp = BytesFromString( JSONConstants.LBRACKET);
+        trans.write( tmp, 0, tmp.length);
+        PushContext( new JSONListContext(this));
+    }
+
+    private function WriteJSONArrayEnd() : Void {
+        PopContext();
+        var tmp = BytesFromString( JSONConstants.RBRACKET);
+        trans.write( tmp, 0, tmp.length);
+    }
+
+
+    /**
+     * Reading methods.
+     */
+
+    // Read a byte that must match char, otherwise an exception is thrown.
+    public function ReadJSONSyntaxChar( char : String) : Void {
+        var b = BytesFromString( char);
+
+        var ch = reader.Read();
+        if (ch.get(0) != b.get(0))
+        {
+            throw new TProtocolException(TProtocolException.INVALID_DATA,
+                                         'Unexpected character: $ch');
+        }
+    }
+
+    // Read in a JSON string, unescaping as appropriate.
     // Skip Reading from the context if skipContext is true.
-	private function ReadJSONString(skipContext : Bool) : String
-	{
-		if (!skipContext)
-		{
-			context.Read();
-		}
-
-		var buffer : BytesBuffer = new BytesBuffer();
-
-		ReadJSONSyntaxChar( JSONConstants.QUOTE);
-		while (true)
-		{
-			var ch = reader.Read();
-
-			// end of string?
-			if (StringFromBytes(ch) == JSONConstants.QUOTE)
-			{
-				break;
-			}
-
-			// escaped?
-			if (StringFromBytes(ch) != JSONConstants.ESCSEQ.charAt(0))
-			{
-				buffer.addByte( ch.get(0));
-				continue;
-			}
-
-			// distinguish between \uXXXX (hex unicode) and \X (control chars)
-			ch = reader.Read();
-			if (StringFromBytes(ch) != JSONConstants.ESCSEQ.charAt(1))
-			{
-				var value = JSONConstants.ESCAPE_CHARS_TO_VALUES[ch.get(0)];
-				if( value == null)
-				{
-					throw new TProtocolException( TProtocolException.INVALID_DATA, "Expected control char");
-				}
-				buffer.addByte( value);
-				continue;
-			}
-
-
-			// it's \uXXXX
-			var hexbuf = new BytesBuffer();
-			var hexlen = trans.readAll( hexbuf, 0, 4);
-			if( hexlen != 4)
-			{
-				throw new TProtocolException( TProtocolException.INVALID_DATA, "Not enough data for \\uNNNN sequence");
-			}
-
-			var hexdigits = hexbuf.getBytes();
-			var charcode = 0;
-			charcode = (charcode << 4) + HexVal( String.fromCharCode(hexdigits.get(0)));
-			charcode = (charcode << 4) + HexVal( String.fromCharCode(hexdigits.get(1)));
-			charcode = (charcode << 4) + HexVal( String.fromCharCode(hexdigits.get(2)));
-			charcode = (charcode << 4) + HexVal( String.fromCharCode(hexdigits.get(3)));
-			buffer.addString( String.fromCharCode(charcode));
-		}
-
-		return StringFromBytes( buffer.getBytes());
-	}
-
-	// Return true if the given byte could be a valid part of a JSON number.
-	private function IsJSONNumeric(b : Int) : Bool {
-		switch (b)
-		{
-			case "+".code:  return true;
-			case "-".code:  return true;
-			case ".".code:  return true;
-			case "0".code:  return true;
-			case "1".code:  return true;
-			case "2".code:  return true;
-			case "3".code:  return true;
-			case "4".code:  return true;
-			case "5".code:  return true;
-			case "6".code:  return true;
-			case "7".code:  return true;
-			case "8".code:  return true;
-			case "9".code:  return true;
-			case "E".code:  return true;
-			case "e".code:  return true;
-		}
-		return false;
-	}
-
-	// Read in a sequence of characters that are all valid in JSON numbers. Does
-	// not do a complete regex check to validate that this is actually a number.
-	private function ReadJSONNumericChars() : String
-	{
-		var buffer : BytesBuffer = new BytesBuffer();
-		while (true)
-		{
-			var ch = reader.Peek();
-			if( ! IsJSONNumeric( ch.get(0)))
-			{
-				break;
-			}
-			buffer.addByte( reader.Read().get(0));
-		}
-		return StringFromBytes( buffer.getBytes());
-	}
-
-	// Read in a JSON number. If the context dictates, Read in enclosing quotes.
-	private function ReadJSONInteger() : Int {
-		context.Read();
-
-		if (context.EscapeNumbers()) {
-			ReadJSONSyntaxChar( JSONConstants.QUOTE);
-		}
-
-		var str : String = ReadJSONNumericChars();
-
-		if (context.EscapeNumbers()) {
-			ReadJSONSyntaxChar( JSONConstants.QUOTE);
-		}
-
-		var value = Std.parseInt(str);
-		if( value == null) {
-			throw new TProtocolException(TProtocolException.INVALID_DATA, 'Bad numeric data: $str');
-		}
-
-		return value;
-	}
-
-	// Read in a JSON number. If the context dictates, Read in enclosing quotes.
-	private function ReadJSONInt64() : haxe.Int64 {
-		context.Read();
-
-		if (context.EscapeNumbers()) {
-			ReadJSONSyntaxChar( JSONConstants.QUOTE);
-		}
-
-		var str : String = ReadJSONNumericChars();
-		if( str.length == 0) {
-			throw new TProtocolException(TProtocolException.INVALID_DATA, 'Bad numeric data: $str');
-		}
-
-		if (context.EscapeNumbers()) {
-			ReadJSONSyntaxChar( JSONConstants.QUOTE);
-		}
-
-	    // process sign
-		var bMinus = false;
-		var startAt = 0;
-		if( (str.charAt(0) == "+") || (str.charAt(0) == "-")) {
-			bMinus = (str.charAt(0) == "-");
-			startAt++;
-		}
-
-		// process digits
-		var value : Int64 = Int64.make(0,0);
-		var bGotDigits = false;
-		for( i in startAt ... str.length) {
-			var ch = str.charAt(i);
-			var digit = JSONConstants.DECIMAL_DIGITS[ch];
-			if( digit == null) {
-				throw new TProtocolException(TProtocolException.INVALID_DATA, 'Bad numeric data: $str');
-			}
-			bGotDigits = true;
-
-			// these are decimal digits
-			value = Int64.mul( value, Int64.make(0,10));
-			value = Int64.add( value, Int64.make(0,digit));
-		}
-
-		// process pending minus sign, if applicable
-		// this should also handle the edge case MIN_INT64 correctly
-		if( bMinus && (Int64.compare(value,Int64.make(0,0)) > 0)) {
-			value = Int64.neg( value);
-			bMinus = false;
-		}
-
-		if( ! bGotDigits) {
-			throw new TProtocolException(TProtocolException.INVALID_DATA, 'Bad numeric data: $str');
-		}
-			
-		return value;
-	}
-
-	// Read in a JSON double value. Throw if the value is not wrapped in quotes
-	// when expected or if wrapped in quotes when not expected.
-	private function ReadJSONDouble() : Float {
-		context.Read();
-		
-		var str : String = "";
-		if (StringFromBytes(reader.Peek()) == JSONConstants.QUOTE) {
-			str = ReadJSONString(true);
-			
-			// special cases
-			if( str == JSONConstants.FLOAT_IS_NAN) {
-				return Math.NaN;
-			}
-			if( str == JSONConstants.FLOAT_IS_POS_INF) {
-				return Math.POSITIVE_INFINITY;
-			}
-			if( str == JSONConstants.FLOAT_IS_NEG_INF) {
-				return Math.NEGATIVE_INFINITY;
-			}
-			
-			if( ! context.EscapeNumbers())	{
-				// throw - we should not be in a string in this case
-				throw new TProtocolException(TProtocolException.INVALID_DATA, "Numeric data unexpectedly quoted");
-			}
-		}
-		else
-		{
-			if( context.EscapeNumbers())	{
-				// This will throw - we should have had a quote if EscapeNumbers() == true
-				ReadJSONSyntaxChar( JSONConstants.QUOTE);
-			}
-
-			str = ReadJSONNumericChars();
-		}
-
-		// parse and check - we should have at least one valid digit
-		var dub = Std.parseFloat( str);
-		if( (str.length == 0) || Math.isNaN(dub)) {
-			throw new TProtocolException(TProtocolException.INVALID_DATA, 'Bad numeric data: $str');
-		}
-
-		return dub;
-	}
-
-	// Read in a JSON string containing base-64 encoded data and decode it.
-	private function ReadJSONBase64() : Bytes
-	{
-		var str = ReadJSONString(false);
-		return Base64.decode( str);
-	}
-
-	private function ReadJSONObjectStart() : Void {
-		context.Read();
-		ReadJSONSyntaxChar( JSONConstants.LBRACE);
-		PushContext(new JSONPairContext(this));
-	}
-
-	private function ReadJSONObjectEnd() : Void {
-		ReadJSONSyntaxChar( JSONConstants.RBRACE);
-		PopContext();
-	}
-
-	private function ReadJSONArrayStart() : Void {
-		context.Read();
-		ReadJSONSyntaxChar( JSONConstants.LBRACKET);
-		PushContext(new JSONListContext(this));
-	}
-
-	private function ReadJSONArrayEnd() : Void {
-		ReadJSONSyntaxChar( JSONConstants.RBRACKET);
-		PopContext();
-	}
-
-
-	public static function BytesFromString( str : String) : Bytes {
-		var buf = new BytesBuffer();
-		if( utf8Strings)
-			buf.addString( str);  // no need to encode on UTF8 targets, the string is just fine
-		else
-			buf.addString( Utf8.encode( str));
-		return buf.getBytes();
-	}
-
-	public static function StringFromBytes( buf : Bytes) : String {
-		var inp = new BytesInput( buf);
-		if( buf.length == 0)
-			return "";  // readString() would return null in that case, which is wrong
-		var str = inp.readString( buf.length);
-		if( utf8Strings)
-			return str;  // no need to decode on UTF8 targets, the string is just fine
-		else
-			return Utf8.decode( str);
-	}
-
-	// Convert a byte containing a hex char ('0'-'9' or 'a'-'f') into its corresponding hex value
-	private static function HexVal(char : String) : Int {
-		var value = JSONConstants.HEX_DIGITS[char];
-		if( value == null) {
-			throw new TProtocolException(TProtocolException.INVALID_DATA, 'Expected hex character: $char');
-		}
-		return value;
-	}
-
-	// Convert a byte containing a hex nibble to its corresponding hex character
-	private static function HexChar(nibble : Int) : String
-	{
-		return "0123456789abcdef".charAt(nibble & 0x0F);
-	}
+    private function ReadJSONString(skipContext : Bool) : String
+    {
+        if (!skipContext)
+        {
+            context.Read();
+        }
+
+        var buffer : BytesBuffer = new BytesBuffer();
+
+        ReadJSONSyntaxChar( JSONConstants.QUOTE);
+        while (true)
+        {
+            var ch = reader.Read();
+
+            // end of string?
+            if (StringFromBytes(ch) == JSONConstants.QUOTE)
+            {
+                break;
+            }
+
+            // escaped?
+            if (StringFromBytes(ch) != JSONConstants.ESCSEQ.charAt(0))
+            {
+                buffer.addByte( ch.get(0));
+                continue;
+            }
+
+            // distinguish between \uXXXX (hex unicode) and \X (control chars)
+            ch = reader.Read();
+            if (StringFromBytes(ch) != JSONConstants.ESCSEQ.charAt(1))
+            {
+                var value = JSONConstants.ESCAPE_CHARS_TO_VALUES[ch.get(0)];
+                if( value == null)
+                {
+                    throw new TProtocolException( TProtocolException.INVALID_DATA, "Expected control char");
+                }
+                buffer.addByte( value);
+                continue;
+            }
+
+
+            // it's \uXXXX
+            var hexbuf = new BytesBuffer();
+            var hexlen = trans.readAll( hexbuf, 0, 4);
+            if( hexlen != 4)
+            {
+                throw new TProtocolException( TProtocolException.INVALID_DATA, "Not enough data for \\uNNNN sequence");
+            }
+
+            var hexdigits = hexbuf.getBytes();
+            var charcode = 0;
+            charcode = (charcode << 4) + HexVal( String.fromCharCode(hexdigits.get(0)));
+            charcode = (charcode << 4) + HexVal( String.fromCharCode(hexdigits.get(1)));
+            charcode = (charcode << 4) + HexVal( String.fromCharCode(hexdigits.get(2)));
+            charcode = (charcode << 4) + HexVal( String.fromCharCode(hexdigits.get(3)));
+            buffer.addString( String.fromCharCode(charcode));
+        }
+
+        return StringFromBytes( buffer.getBytes());
+    }
+
+    // Return true if the given byte could be a valid part of a JSON number.
+    private function IsJSONNumeric(b : Int) : Bool {
+        switch (b)
+        {
+            case "+".code:  return true;
+            case "-".code:  return true;
+            case ".".code:  return true;
+            case "0".code:  return true;
+            case "1".code:  return true;
+            case "2".code:  return true;
+            case "3".code:  return true;
+            case "4".code:  return true;
+            case "5".code:  return true;
+            case "6".code:  return true;
+            case "7".code:  return true;
+            case "8".code:  return true;
+            case "9".code:  return true;
+            case "E".code:  return true;
+            case "e".code:  return true;
+        }
+        return false;
+    }
+
+    // Read in a sequence of characters that are all valid in JSON numbers. Does
+    // not do a complete regex check to validate that this is actually a number.
+    private function ReadJSONNumericChars() : String
+    {
+        var buffer : BytesBuffer = new BytesBuffer();
+        while (true)
+        {
+            var ch = reader.Peek();
+            if( ! IsJSONNumeric( ch.get(0)))
+            {
+                break;
+            }
+            buffer.addByte( reader.Read().get(0));
+        }
+        return StringFromBytes( buffer.getBytes());
+    }
+
+    // Read in a JSON number. If the context dictates, Read in enclosing quotes.
+    private function ReadJSONInteger() : Int {
+        context.Read();
+
+        if (context.EscapeNumbers()) {
+            ReadJSONSyntaxChar( JSONConstants.QUOTE);
+        }
+
+        var str : String = ReadJSONNumericChars();
+
+        if (context.EscapeNumbers()) {
+            ReadJSONSyntaxChar( JSONConstants.QUOTE);
+        }
+
+        var value = Std.parseInt(str);
+        if( value == null) {
+            throw new TProtocolException(TProtocolException.INVALID_DATA, 'Bad numeric data: $str');
+        }
+
+        return value;
+    }
+
+    // Read in a JSON number. If the context dictates, Read in enclosing quotes.
+    private function ReadJSONInt64() : haxe.Int64 {
+        context.Read();
+
+        if (context.EscapeNumbers()) {
+            ReadJSONSyntaxChar( JSONConstants.QUOTE);
+        }
+
+        var str : String = ReadJSONNumericChars();
+        if( str.length == 0) {
+            throw new TProtocolException(TProtocolException.INVALID_DATA, 'Bad numeric data: $str');
+        }
+
+        if (context.EscapeNumbers()) {
+            ReadJSONSyntaxChar( JSONConstants.QUOTE);
+        }
+
+        // process sign
+        var bMinus = false;
+        var startAt = 0;
+        if( (str.charAt(0) == "+") || (str.charAt(0) == "-")) {
+            bMinus = (str.charAt(0) == "-");
+            startAt++;
+        }
+
+        // process digits
+        var value : Int64 = Int64.make(0,0);
+        var bGotDigits = false;
+        for( i in startAt ... str.length) {
+            var ch = str.charAt(i);
+            var digit = JSONConstants.DECIMAL_DIGITS[ch];
+            if( digit == null) {
+                throw new TProtocolException(TProtocolException.INVALID_DATA, 'Bad numeric data: $str');
+            }
+            bGotDigits = true;
+
+            // these are decimal digits
+            value = Int64.mul( value, Int64.make(0,10));
+            value = Int64.add( value, Int64.make(0,digit));
+        }
+
+        // process pending minus sign, if applicable
+        // this should also handle the edge case MIN_INT64 correctly
+        if( bMinus && (Int64.compare(value,Int64.make(0,0)) > 0)) {
+            value = Int64.neg( value);
+            bMinus = false;
+        }
+
+        if( ! bGotDigits) {
+            throw new TProtocolException(TProtocolException.INVALID_DATA, 'Bad numeric data: $str');
+        }
+
+        return value;
+    }
+
+    // Read in a JSON double value. Throw if the value is not wrapped in quotes
+    // when expected or if wrapped in quotes when not expected.
+    private function ReadJSONDouble() : Float {
+        context.Read();
+
+        var str : String = "";
+        if (StringFromBytes(reader.Peek()) == JSONConstants.QUOTE) {
+            str = ReadJSONString(true);
+
+            // special cases
+            if( str == JSONConstants.FLOAT_IS_NAN) {
+                return Math.NaN;
+            }
+            if( str == JSONConstants.FLOAT_IS_POS_INF) {
+                return Math.POSITIVE_INFINITY;
+            }
+            if( str == JSONConstants.FLOAT_IS_NEG_INF) {
+                return Math.NEGATIVE_INFINITY;
+            }
+
+            if( ! context.EscapeNumbers())    {
+                // throw - we should not be in a string in this case
+                throw new TProtocolException(TProtocolException.INVALID_DATA, "Numeric data unexpectedly quoted");
+            }
+        }
+        else
+        {
+            if( context.EscapeNumbers())    {
+                // This will throw - we should have had a quote if EscapeNumbers() == true
+                ReadJSONSyntaxChar( JSONConstants.QUOTE);
+            }
+
+            str = ReadJSONNumericChars();
+        }
+
+        // parse and check - we should have at least one valid digit
+        var dub = Std.parseFloat( str);
+        if( (str.length == 0) || Math.isNaN(dub)) {
+            throw new TProtocolException(TProtocolException.INVALID_DATA, 'Bad numeric data: $str');
+        }
+
+        return dub;
+    }
+
+    // Read in a JSON string containing base-64 encoded data and decode it.
+    private function ReadJSONBase64() : Bytes
+    {
+        var str = ReadJSONString(false);
+        return Base64.decode( str);
+    }
+
+    private function ReadJSONObjectStart() : Void {
+        context.Read();
+        ReadJSONSyntaxChar( JSONConstants.LBRACE);
+        PushContext(new JSONPairContext(this));
+    }
+
+    private function ReadJSONObjectEnd() : Void {
+        ReadJSONSyntaxChar( JSONConstants.RBRACE);
+        PopContext();
+    }
+
+    private function ReadJSONArrayStart() : Void {
+        context.Read();
+        ReadJSONSyntaxChar( JSONConstants.LBRACKET);
+        PushContext(new JSONListContext(this));
+    }
+
+    private function ReadJSONArrayEnd() : Void {
+        ReadJSONSyntaxChar( JSONConstants.RBRACKET);
+        PopContext();
+    }
+
+
+    public static function BytesFromString( str : String) : Bytes {
+        var buf = new BytesBuffer();
+        if( utf8Strings)
+            buf.addString( str);  // no need to encode on UTF8 targets, the string is just fine
+        else
+            buf.addString( Utf8.encode( str));
+        return buf.getBytes();
+    }
+
+    public static function StringFromBytes( buf : Bytes) : String {
+        var inp = new BytesInput( buf);
+        if( buf.length == 0)
+            return "";  // readString() would return null in that case, which is wrong
+        var str = inp.readString( buf.length);
+        if( utf8Strings)
+            return str;  // no need to decode on UTF8 targets, the string is just fine
+        else
+            return Utf8.decode( str);
+    }
+
+    // Convert a byte containing a hex char ('0'-'9' or 'a'-'f') into its corresponding hex value
+    private static function HexVal(char : String) : Int {
+        var value = JSONConstants.HEX_DIGITS[char];
+        if( value == null) {
+            throw new TProtocolException(TProtocolException.INVALID_DATA, 'Expected hex character: $char');
+        }
+        return value;
+    }
+
+    // Convert a byte containing a hex nibble to its corresponding hex character
+    private static function HexChar(nibble : Int) : String
+    {
+        return "0123456789abcdef".charAt(nibble & 0x0F);
+    }
 
 
 }
@@ -795,136 +795,136 @@ class TJSONProtocol implements TProtocol {
 
 @:allow(TJSONProtocol)
 class JSONConstants {
-	public static var COMMA = ",";
-	public static var COLON = ":";
-	public static var LBRACE = "{";
-	public static var RBRACE = "}";
-	public static var LBRACKET = "[";
-	public static var RBRACKET = "]";
-	public static var QUOTE = "\"";
-	public static var BACKSLASH = "\\";
-
-	public static var ESCSEQ = "\\u";
-
-	public static var FLOAT_IS_NAN = "NaN";
-	public static var FLOAT_IS_POS_INF = "Infinity";
-	public static var FLOAT_IS_NEG_INF = "-Infinity";
-	
-	public static var VERSION = 1;
-	public static var JSON_CHAR_TABLE = [
-		0,  0,  0,  0,  0,  0,  0,  0,
-		"b".code, "t".code, "n".code,  0, "f".code, "r".code,  0,  0,
-		0,  0,  0,  0,  0,  0,  0,  0,
-		0,  0,  0,  0,  0,  0,  0,  0,
-		1,  1, "\"".code,  1,  1,  1,  1,  1,
-		1,  1,  1,  1,  1,  1,  1,  1,
-	];
-
-	public static var ESCAPE_CHARS     = ['"','\\','/','b','f','n','r','t'];
-	public static var ESCAPE_CHARS_TO_VALUES = [
-		"\"".code => 0x22,
-		"\\".code => 0x5C,
-		"/".code  => 0x2F,
-		"b".code  => 0x08,
-		"f".code  => 0x0C,
-		"n".code  => 0x0A,
-		"r".code  => 0x0D,
-		"t".code  => 0x09
-	];
-
-	public static var DECIMAL_DIGITS = [
-		"0" => 0,
-		"1" => 1,
-		"2" => 2,
-		"3" => 3,
-		"4" => 4,
-		"5" => 5,
-		"6" => 6,
-		"7" => 7,
-		"8" => 8,
-		"9" => 9
-	];
-
-	public static var HEX_DIGITS = [
-		"0" => 0,
-		"1" => 1,
-		"2" => 2,
-		"3" => 3,
-		"4" => 4,
-		"5" => 5,
-		"6" => 6,
-		"7" => 7,
-		"8" => 8,
-		"9" => 9,
-		"A" => 10,
-		"a" => 10,
-		"B" => 11,
-		"b" => 11,
-		"C" => 12,
-		"c" => 12,
-		"D" => 13,
-		"d" => 13,
-		"E" => 14,
-		"e" => 14,
-		"F" => 15,
-		"f" => 15
-	];
-
-
-	public static var DEF_STRING_SIZE = 16;
-
-	public static var NAME_BOOL   = 'tf';
-	public static var NAME_BYTE   = 'i8';
-	public static var NAME_I16    = 'i16';
-	public static var NAME_I32    = 'i32';
-	public static var NAME_I64    = 'i64';
-	public static var NAME_DOUBLE = 'dbl';
-	public static var NAME_STRUCT = 'rec';
-	public static var NAME_STRING = 'str';
-	public static var NAME_MAP    = 'map';
-	public static var NAME_LIST   = 'lst';
-	public static var NAME_SET    = 'set';
-
-	public static function GetTypeNameForTypeID(typeID : Int) : String {
-		switch (typeID)
-		{
-			case TType.BOOL:     return NAME_BOOL;
-			case TType.BYTE:     return NAME_BYTE;
-			case TType.I16:		 return NAME_I16;
-			case TType.I32:		 return NAME_I32;
-			case TType.I64:		 return NAME_I64;
-			case TType.DOUBLE:	 return NAME_DOUBLE;
-			case TType.STRING:	 return NAME_STRING;
-			case TType.STRUCT:	 return NAME_STRUCT;
-			case TType.MAP:		 return NAME_MAP;
-			case TType.SET:		 return NAME_SET;
-			case TType.LIST:	 return NAME_LIST;
-		}
-		throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized type");
-	}
-
-	private static var NAMES_TO_TYPES = [
-		NAME_BOOL   => TType.BOOL,
-		NAME_BYTE   => TType.BYTE,
-		NAME_I16    => TType.I16,
-		NAME_I32    => TType.I32,
-		NAME_I64    => TType.I64,
-		NAME_DOUBLE => TType.DOUBLE,
-		NAME_STRING => TType.STRING,
-		NAME_STRUCT => TType.STRUCT,
-		NAME_MAP    => TType.MAP,
-		NAME_SET    => TType.SET,
-		NAME_LIST   => TType.LIST
-	];
-
-	public static function GetTypeIDForTypeName(name : String) : Int
-	{
-		var type = NAMES_TO_TYPES[name];
-		if( null != type) {
-			return type;
-		}
-		throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized type");
-	}
+    public static var COMMA = ",";
+    public static var COLON = ":";
+    public static var LBRACE = "{";
+    public static var RBRACE = "}";
+    public static var LBRACKET = "[";
+    public static var RBRACKET = "]";
+    public static var QUOTE = "\"";
+    public static var BACKSLASH = "\\";
+
+    public static var ESCSEQ = "\\u";
+
+    public static var FLOAT_IS_NAN = "NaN";
+    public static var FLOAT_IS_POS_INF = "Infinity";
+    public static var FLOAT_IS_NEG_INF = "-Infinity";
+
+    public static var VERSION = 1;
+    public static var JSON_CHAR_TABLE = [
+        0,  0,  0,  0,  0,  0,  0,  0,
+        "b".code, "t".code, "n".code,  0, "f".code, "r".code,  0,  0,
+        0,  0,  0,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,  0,  0,  0,
+        1,  1, "\"".code,  1,  1,  1,  1,  1,
+        1,  1,  1,  1,  1,  1,  1,  1,
+    ];
+
+    public static var ESCAPE_CHARS     = ['"','\\','/','b','f','n','r','t'];
+    public static var ESCAPE_CHARS_TO_VALUES = [
+        "\"".code => 0x22,
+        "\\".code => 0x5C,
+        "/".code  => 0x2F,
+        "b".code  => 0x08,
+        "f".code  => 0x0C,
+        "n".code  => 0x0A,
+        "r".code  => 0x0D,
+        "t".code  => 0x09
+    ];
+
+    public static var DECIMAL_DIGITS = [
+        "0" => 0,
+        "1" => 1,
+        "2" => 2,
+        "3" => 3,
+        "4" => 4,
+        "5" => 5,
+        "6" => 6,
+        "7" => 7,
+        "8" => 8,
+        "9" => 9
+    ];
+
+    public static var HEX_DIGITS = [
+        "0" => 0,
+        "1" => 1,
+        "2" => 2,
+        "3" => 3,
+        "4" => 4,
+        "5" => 5,
+        "6" => 6,
+        "7" => 7,
+        "8" => 8,
+        "9" => 9,
+        "A" => 10,
+        "a" => 10,
+        "B" => 11,
+        "b" => 11,
+        "C" => 12,
+        "c" => 12,
+        "D" => 13,
+        "d" => 13,
+        "E" => 14,
+        "e" => 14,
+        "F" => 15,
+        "f" => 15
+    ];
+
+
+    public static var DEF_STRING_SIZE = 16;
+
+    public static var NAME_BOOL   = 'tf';
+    public static var NAME_BYTE   = 'i8';
+    public static var NAME_I16    = 'i16';
+    public static var NAME_I32    = 'i32';
+    public static var NAME_I64    = 'i64';
+    public static var NAME_DOUBLE = 'dbl';
+    public static var NAME_STRUCT = 'rec';
+    public static var NAME_STRING = 'str';
+    public static var NAME_MAP    = 'map';
+    public static var NAME_LIST   = 'lst';
+    public static var NAME_SET    = 'set';
+
+    public static function GetTypeNameForTypeID(typeID : Int) : String {
+        switch (typeID)
+        {
+            case TType.BOOL:     return NAME_BOOL;
+            case TType.BYTE:     return NAME_BYTE;
+            case TType.I16:         return NAME_I16;
+            case TType.I32:         return NAME_I32;
+            case TType.I64:         return NAME_I64;
+            case TType.DOUBLE:     return NAME_DOUBLE;
+            case TType.STRING:     return NAME_STRING;
+            case TType.STRUCT:     return NAME_STRUCT;
+            case TType.MAP:         return NAME_MAP;
+            case TType.SET:         return NAME_SET;
+            case TType.LIST:     return NAME_LIST;
+        }
+        throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized type");
+    }
+
+    private static var NAMES_TO_TYPES = [
+        NAME_BOOL   => TType.BOOL,
+        NAME_BYTE   => TType.BYTE,
+        NAME_I16    => TType.I16,
+        NAME_I32    => TType.I32,
+        NAME_I64    => TType.I64,
+        NAME_DOUBLE => TType.DOUBLE,
+        NAME_STRING => TType.STRING,
+        NAME_STRUCT => TType.STRUCT,
+        NAME_MAP    => TType.MAP,
+        NAME_SET    => TType.SET,
+        NAME_LIST   => TType.LIST
+    ];
+
+    public static function GetTypeIDForTypeName(name : String) : Int
+    {
+        var type = NAMES_TO_TYPES[name];
+        if( null != type) {
+            return type;
+        }
+        throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized type");
+    }
 
 }
 
@@ -934,19 +934,19 @@ class JSONConstants {
 @:allow(TJSONProtocol)
 class JSONBaseContext
 {
-	private var proto : TJSONProtocol;
+    private var proto : TJSONProtocol;
 
-	public function new(proto : TJSONProtocol )
-	{
-		this.proto = proto;
-	}
+    public function new(proto : TJSONProtocol )
+    {
+        this.proto = proto;
+    }
 
-	public function Write() : Void { }
-	public function Read() : Void { }
+    public function Write() : Void { }
+    public function Read() : Void { }
 
-	public function EscapeNumbers() : Bool {
-		return false;
-	}
+    public function EscapeNumbers() : Bool {
+        return false;
+    }
 }
 
 
@@ -955,36 +955,36 @@ class JSONBaseContext
 @:allow(TJSONProtocol)
 class JSONListContext extends JSONBaseContext
 {
-	public function new( proto : TJSONProtocol) {
-		super(proto);
-	}
-
-	private var first : Bool = true;
-
-	public override function Write() : Void {
-		if (first)
-		{
-			first = false;
-		}
-		else
-		{
-			var buf = new BytesBuffer();
-			buf.addString( JSONConstants.COMMA);
-			var tmp = buf.getBytes();
-			proto.trans.write( tmp, 0, tmp.length);
-		}
-	}
-
-	public override function Read() : Void {
-		if (first)
-		{
-			first = false;
-		}
-		else
-		{
-			proto.ReadJSONSyntaxChar( JSONConstants.COMMA);
-		}
-	}
+    public function new( proto : TJSONProtocol) {
+        super(proto);
+    }
+
+    private var first : Bool = true;
+
+    public override function Write() : Void {
+        if (first)
+        {
+            first = false;
+        }
+        else
+        {
+            var buf = new BytesBuffer();
+            buf.addString( JSONConstants.COMMA);
+            var tmp = buf.getBytes();
+            proto.trans.write( tmp, 0, tmp.length);
+        }
+    }
+
+    public override function Read() : Void {
+        if (first)
+        {
+            first = false;
+        }
+        else
+        {
+            proto.ReadJSONSyntaxChar( JSONConstants.COMMA);
+        }
+    }
 }
 
 
@@ -996,78 +996,78 @@ class JSONListContext extends JSONBaseContext
 @:allow(TJSONProtocol)
 class JSONPairContext extends JSONBaseContext
 {
-	public function new( proto : TJSONProtocol ) {
-		super( proto);
-	}
-
-	private var first : Bool = true;
-	private var colon : Bool  = true;
-
-	public override function Write() : Void {
-		if (first)
-		{
-			first = false;
-			colon = true;
-		}
-		else
-		{
-			var buf = new BytesBuffer();
-			buf.addString( colon ? JSONConstants.COLON : JSONConstants.COMMA);
-			var tmp = buf.getBytes();
-			proto.trans.write( tmp, 0, tmp.length);
-			colon = !colon;
-		}
-	}
-
-	public override function Read() : Void {
-		if (first)
-		{
-			first = false;
-			colon = true;
-		}
-		else
-		{
-			proto.ReadJSONSyntaxChar( colon ? JSONConstants.COLON : JSONConstants.COMMA);
-			colon = !colon;
-		}
-	}
-
-	public override function EscapeNumbers() : Bool
-	{
-		return colon;
-	}
+    public function new( proto : TJSONProtocol ) {
+        super( proto);
+    }
+
+    private var first : Bool = true;
+    private var colon : Bool  = true;
+
+    public override function Write() : Void {
+        if (first)
+        {
+            first = false;
+            colon = true;
+        }
+        else
+        {
+            var buf = new BytesBuffer();
+            buf.addString( colon ? JSONConstants.COLON : JSONConstants.COMMA);
+            var tmp = buf.getBytes();
+            proto.trans.write( tmp, 0, tmp.length);
+            colon = !colon;
+        }
+    }
+
+    public override function Read() : Void {
+        if (first)
+        {
+            first = false;
+            colon = true;
+        }
+        else
+        {
+            proto.ReadJSONSyntaxChar( colon ? JSONConstants.COLON : JSONConstants.COMMA);
+            colon = !colon;
+        }
+    }
+
+    public override function EscapeNumbers() : Bool
+    {
+        return colon;
+    }
 }
 
 // Holds up to one byte from the transport
 @:allow(TJSONProtocol)
 class LookaheadReader {
 
-	private var proto : TJSONProtocol;
-	private var data : Bytes;
-
-	public function new( proto : TJSONProtocol ) {
-		this.proto = proto;
-		data = null;
-	}
-
-	
-	// Return and consume the next byte to be Read, either taking it from the
-	// data buffer if present or getting it from the transport otherwise.
-	public function Read() : Bytes {
-		var retval = Peek();
-		data = null;
-		return retval;
-	}
-
-	// Return the next byte to be Read without consuming, filling the data
-	// buffer if it has not been filled alReady.
-	public function Peek() : Bytes {
-		if (data == null) {
-			var buf = new BytesBuffer();
-			proto.trans.readAll(buf, 0, 1);
-			data = buf.getBytes();
-		}
-		return data;
-	}
+    private var proto : TJSONProtocol;
+    private var data : Bytes;
+
+    public function new( proto : TJSONProtocol ) {
+        this.proto = proto;
+        data = null;
+    }
+
+
+    // Return and consume the next byte to be Read, either taking it from the
+    // data buffer if present or getting it from the transport otherwise.
+    public function Read() : Bytes {
+        var retval = Peek();
+        data = null;
+        return retval;
+    }
+
+    // Return the next byte to be Read without consuming, filling the data
+    // buffer if it has not been filled alReady.
+    public function Peek() : Bytes {
+        if (data == null) {
+            var buf = new BytesBuffer();
+            proto.trans.readAll(buf, 0, 1);
+            data = buf.getBytes();
+        }
+        return data;
+    }
 }
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocolFactory.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocolFactory.hx b/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocolFactory.hx
index 169629a..363558a 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocolFactory.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocolFactory.hx
@@ -26,15 +26,15 @@ import org.apache.thrift.transport.TTransport;
 * JSON Protocol Factory
 */
 class TJSONProtocolFactory implements TProtocolFactory {
-	
-	public function new() {
-	}
 
-	public function getProtocol( trans : TTransport) : TProtocol  {
-		return new TJSONProtocol( trans);
-	}
+    public function new() {
+    }
+
+    public function getProtocol( trans : TTransport) : TProtocol  {
+        return new TJSONProtocol( trans);
+    }
 }
 
 
 
-	
\ No newline at end of file
+    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TList.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TList.hx b/lib/haxe/src/org/apache/thrift/protocol/TList.hx
index d6c15c1..5a1fb55 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TList.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TList.hx
@@ -16,14 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package org.apache.thrift.protocol;
-  
+
 class TList {
 
     public var elemType : Int;
     public var size : Int;
-  
+
       public function new(t : Int = 0, s : Int = 0) {
         elemType = t;
         size = s;

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TMap.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TMap.hx b/lib/haxe/src/org/apache/thrift/protocol/TMap.hx
index 5af8c4e..f4e6288 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TMap.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TMap.hx
@@ -16,19 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package org.apache.thrift.protocol;
 
 class TMap {
-    
+
     public var keyType : Int;
     public var valueType : Int;
     public var size : Int;
-  
+
     public function new(k : Int = 0, v : Int = 0, s : Int = 0) {
       keyType = k;
       valueType = v;
       size = s;
     }
- 
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx b/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx
index 98c883b..58d71a9 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx
@@ -16,25 +16,25 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package org.apache.thrift.protocol;
-  
+
 class TMessage {
-    
+
     public var name : String;
     public var type : Int;
     public var seqid : Int;
-  
+
     public function new(n : String = "", t : Int = 0, s : Int = 0) {
       name = n;
       type = t;
       seqid = s;
     }
-    
+
     public function toString() : String {
       return "<TMessage name:'" + name + "' type: " + type + " seqid:" + seqid + ">";
     }
-    
+
     public function equals(other:TMessage) : Bool {
       return name == other.name && type == other.type && seqid == other.seqid;
     }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx b/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx
index b141940..7cb38b3 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx
@@ -16,12 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package org.apache.thrift.protocol;
-  
+
 class TMessageType {
     public static inline var CALL      : Int = 1;
-    public static inline var REPLY 	   : Int = 2;
+    public static inline var REPLY        : Int = 2;
     public static inline var EXCEPTION : Int = 3;
     public static inline var ONEWAY    : Int = 4;
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx
index 58873da..0998e92 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx
@@ -27,7 +27,7 @@ import org.apache.thrift.transport.TTransport;
 * Protocol interface definition
 */
 interface TProtocol {
-  
+
     function getTransport() : TTransport;
 
     /**
@@ -39,44 +39,44 @@ interface TProtocol {
     function writeStructEnd() : Void;
     function writeFieldBegin(field:TField) : Void;
     function writeFieldEnd() : Void;
-    function writeFieldStop() : Void;    
-    function writeMapBegin(map:TMap) : Void;    
-    function writeMapEnd() : Void;    
-    function writeListBegin(list:TList) : Void;    
-    function writeListEnd() : Void;    
-    function writeSetBegin(set:TSet) : Void;    
-    function writeSetEnd() : Void;    
-    function writeBool(b : Bool) : Void;    
-    function writeByte(b : Int) : Void;    
-    function writeI16(i16 : Int) : Void;    
-    function writeI32(i32 : Int) : Void;    
-    function writeI64(i64 : haxe.Int64) : Void;    
-    function writeDouble(dub : Float) : Void;    
-    function writeString(str : String) : Void;    
-    function writeBinary(bin : Bytes) : Void;    
-	
+    function writeFieldStop() : Void;
+    function writeMapBegin(map:TMap) : Void;
+    function writeMapEnd() : Void;
+    function writeListBegin(list:TList) : Void;
+    function writeListEnd() : Void;
+    function writeSetBegin(set:TSet) : Void;
+    function writeSetEnd() : Void;
+    function writeBool(b : Bool) : Void;
+    function writeByte(b : Int) : Void;
+    function writeI16(i16 : Int) : Void;
+    function writeI32(i32 : Int) : Void;
+    function writeI64(i64 : haxe.Int64) : Void;
+    function writeDouble(dub : Float) : Void;
+    function writeString(str : String) : Void;
+    function writeBinary(bin : Bytes) : Void;
+
     /**
      * Reading methods.
      */
-    function readMessageBegin():TMessage;   
-    function readMessageEnd() : Void;    
-    function readStructBegin():TStruct;    
-    function readStructEnd() : Void;    
-    function readFieldBegin():TField;    
-    function readFieldEnd() : Void;    
-    function readMapBegin():TMap;    
-    function readMapEnd() : Void;    
-    function readListBegin():TList;    
-    function readListEnd() : Void;    
-    function readSetBegin():TSet;    
-    function readSetEnd() : Void;    
-    function readBool() : Bool;    
-    function readByte() : Int;    
-    function readI16() : Int;    
-    function readI32() : Int;    
-    function readI64() : haxe.Int64;     
-    function readDouble() : Float;    
-    function readString() : String;    
+    function readMessageBegin():TMessage;
+    function readMessageEnd() : Void;
+    function readStructBegin():TStruct;
+    function readStructEnd() : Void;
+    function readFieldBegin():TField;
+    function readFieldEnd() : Void;
+    function readMapBegin():TMap;
+    function readMapEnd() : Void;
+    function readListBegin():TList;
+    function readListEnd() : Void;
+    function readSetBegin():TSet;
+    function readSetEnd() : Void;
+    function readBool() : Bool;
+    function readByte() : Int;
+    function readI16() : Int;
+    function readI32() : Int;
+    function readI64() : haxe.Int64;
+    function readDouble() : Float;
+    function readString() : String;
     function readBinary() : Bytes;
 
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx
index dbbcb8c..6e528cb 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx
@@ -18,11 +18,11 @@
  */
 
 package org.apache.thrift.protocol;
-  
+
 import org.apache.thrift.TException;
 
 class TProtocolException extends TException {
-    
+
     public static inline var UNKNOWN : Int = 0;
     public static inline var INVALID_DATA : Int = 1;
     public static inline var NEGATIVE_SIZE : Int = 2;
@@ -30,10 +30,10 @@ class TProtocolException extends TException {
     public static inline var BAD_VERSION : Int = 4;
     public static inline var NOT_IMPLEMENTED : Int = 5;
     public static inline var DEPTH_LIMIT : Int = 6;
-  
+
     public function new(error : Int = UNKNOWN, message : String = "") {
       super(message, error);
     }
-    
-  
-}
\ No newline at end of file
+
+
+} 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TProtocolFactory.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocolFactory.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocolFactory.hx
index d231dbe..1c2d62e 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TProtocolFactory.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocolFactory.hx
@@ -20,7 +20,7 @@
 package org.apache.thrift.protocol;
 
 import org.apache.thrift.transport.TTransport;
-  
+
 interface TProtocolFactory {
      function getProtocol(trans:TTransport):TProtocol;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TSet.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TSet.hx b/lib/haxe/src/org/apache/thrift/protocol/TSet.hx
index 77806e6..44eab36 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TSet.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TSet.hx
@@ -18,15 +18,15 @@
  */
 
 package org.apache.thrift.protocol;
-  
+
 class TSet {
 
     public var elemType : Int;
     public var size : Int;
-  
+
       public function new(t : Int = 0, s : Int = 0) {
         elemType = t;
         size = s;
       }
-      
-}
\ No newline at end of file
+
+}    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TStruct.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TStruct.hx b/lib/haxe/src/org/apache/thrift/protocol/TStruct.hx
index faeef40..9e0b7dd 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TStruct.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TStruct.hx
@@ -18,13 +18,13 @@
  */
 
 package org.apache.thrift.protocol;
-  
+
 class TStruct {
-    
+
     public var name : String;
-    
+
     public function new(n : String = "") {
       name = n;
     }
-    
-}
\ No newline at end of file
+
+}  
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TType.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TType.hx b/lib/haxe/src/org/apache/thrift/protocol/TType.hx
index 0534399..1e093c2 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TType.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TType.hx
@@ -18,9 +18,9 @@
  */
 
 package org.apache.thrift.protocol;
-  
+
 class TType {
-    
+
     public static inline var STOP : Int   = 0;
     public static inline var VOID : Int   = 1;
     public static inline var BOOL : Int   = 2;

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/server/TServer.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/server/TServer.hx b/lib/haxe/src/org/apache/thrift/server/TServer.hx
index 37105bd..e689b32 100644
--- a/lib/haxe/src/org/apache/thrift/server/TServer.hx
+++ b/lib/haxe/src/org/apache/thrift/server/TServer.hx
@@ -33,73 +33,74 @@ class TServer
     private var inputProtocolFactory : TProtocolFactory = null;
     private var outputProtocolFactory : TProtocolFactory = null;
 
-	// server events
-	public var serverEventHandler : TServerEventHandler = null;
+    // server events
+    public var serverEventHandler : TServerEventHandler = null;
 
     // Log delegation
     private var _logDelegate : Dynamic->Void  = null;
     public var logDelegate(default,set) : Dynamic->Void;
-	
+
     public function new( processor : TProcessor,
-						 serverTransport : TServerTransport,
-						 inputTransportFactory : TTransportFactory = null,
-						 outputTransportFactory : TTransportFactory = null,
-						 inputProtocolFactory : TProtocolFactory = null,
-						 outputProtocolFactory : TProtocolFactory = null,
-						 logDelegate : Dynamic->Void = null)
+                         serverTransport : TServerTransport,
+                         inputTransportFactory : TTransportFactory = null,
+                         outputTransportFactory : TTransportFactory = null,
+                         inputProtocolFactory : TProtocolFactory = null,
+                         outputProtocolFactory : TProtocolFactory = null,
+                         logDelegate : Dynamic->Void = null)
     {
       this.processor = processor;
       this.serverTransport = serverTransport;
-      this.inputTransportFactory = inputTransportFactory;	
+      this.inputTransportFactory = inputTransportFactory;
       this.outputTransportFactory = outputTransportFactory;
       this.inputProtocolFactory = inputProtocolFactory;
       this.outputProtocolFactory = outputProtocolFactory;
       this.logDelegate = logDelegate;
 
-	  ApplyMissingDefaults();
-	}
-	
-	private function ApplyMissingDefaults() {
-		if( processor == null) 
-			throw "Invalid server configuration: processor missing";
-		if( serverTransport == null)
-			throw "Invalid server configuration: serverTransport missing";
-		if( inputTransportFactory == null)
-			inputTransportFactory = new TTransportFactory();
-		if( outputTransportFactory  == null)
-			outputTransportFactory = new TTransportFactory();
-		if( inputProtocolFactory  == null)
-			inputProtocolFactory = new TBinaryProtocolFactory();
-		if( outputProtocolFactory == null)
-			outputProtocolFactory= new TBinaryProtocolFactory();
-		if( logDelegate == null)
-			logDelegate = DefaultLogDelegate;
+      ApplyMissingDefaults();
+    }
+
+    private function ApplyMissingDefaults() {
+        if( processor == null)
+            throw "Invalid server configuration: processor missing";
+        if( serverTransport == null)
+            throw "Invalid server configuration: serverTransport missing";
+        if( inputTransportFactory == null)
+            inputTransportFactory = new TTransportFactory();
+        if( outputTransportFactory  == null)
+            outputTransportFactory = new TTransportFactory();
+        if( inputProtocolFactory  == null)
+            inputProtocolFactory = new TBinaryProtocolFactory();
+        if( outputProtocolFactory == null)
+            outputProtocolFactory= new TBinaryProtocolFactory();
+        if( logDelegate == null)
+            logDelegate = DefaultLogDelegate;
     }
 
 
-	private function set_logDelegate(value : Dynamic->Void) : Dynamic->Void {
-		if(value != null) {
-			_logDelegate = value;
-		} else {
-			_logDelegate = DefaultLogDelegate; 
-		}
-		return _logDelegate;
+    private function set_logDelegate(value : Dynamic->Void) : Dynamic->Void {
+        if(value != null) {
+            _logDelegate = value;
+        } else {
+            _logDelegate = DefaultLogDelegate;
+        }
+        return _logDelegate;
     }
-    
-		
-	private function DefaultLogDelegate(value : Dynamic) : Void  {
-		trace( value);
+
+
+    private function DefaultLogDelegate(value : Dynamic) : Void  {
+        trace( value);
     }
 
-    
-		
+
+
     public function Serve() : Void {
-		throw new AbstractMethodError();
-	}
-		
-	
+        throw new AbstractMethodError();
+    }
+
+
     public function Stop() : Void {
-		throw new AbstractMethodError();
-	}
-	
+        throw new AbstractMethodError();
+    }
+
 }
+ 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/server/TServerEventHandler.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/server/TServerEventHandler.hx b/lib/haxe/src/org/apache/thrift/server/TServerEventHandler.hx
index 83bff95..9bc9927 100644
--- a/lib/haxe/src/org/apache/thrift/server/TServerEventHandler.hx
+++ b/lib/haxe/src/org/apache/thrift/server/TServerEventHandler.hx
@@ -27,15 +27,15 @@ import org.apache.thrift.protocol.*;
 // Interface implemented by server users to handle events from the server
 interface TServerEventHandler {
 
-	// Called before the server begins 
+    // Called before the server begins
     function preServe() : Void;
-	
-    // Called when a new client has connected and is about to being processing 
+
+    // Called when a new client has connected and is about to being processing
     function createContext( input : TProtocol, output : TProtocol) : Dynamic;
-    
-	// Called when a client has finished request-handling to delete server context 
+
+    // Called when a client has finished request-handling to delete server context
     function deleteContext( serverContext : Dynamic, input : TProtocol, output : TProtocol) : Void;
-    
-	// Called when a client is about to call the processor 
+
+    // Called when a client is about to call the processor
     function processContext( serverContext : Dynamic, transport : TTransport) : Void;
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx b/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
index c516b78..cb7cbd6 100644
--- a/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
+++ b/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
@@ -30,92 +30,92 @@ class TSimpleServer extends TServer  {
     private var stop : Bool = false;
 
     public function new( processor : TProcessor,
-						 serverTransport : TServerTransport,
-						 transportFactory : TTransportFactory = null,
-						 protocolFactory : TProtocolFactory = null,
-						 logDelegate : Dynamic->Void = null) {
+                         serverTransport : TServerTransport,
+                         transportFactory : TTransportFactory = null,
+                         protocolFactory : TProtocolFactory = null,
+                         logDelegate : Dynamic->Void = null) {
       super( processor, serverTransport,
-			 transportFactory, transportFactory,
-			 protocolFactory, protocolFactory,
-			 logDelegate);
+             transportFactory, transportFactory,
+             protocolFactory, protocolFactory,
+             logDelegate);
     }
 
 
-	
-    public override function Serve() : Void 
-	{
-		try
-		{
-			serverTransport.Listen();
-		}
-		catch (ttx : TTransportException)
-		{
-			logDelegate(ttx);
-			return;
-		}
 
-		// Fire the preServe server event when server is up, 
-		// but before any client connections
-		if (serverEventHandler != null) {
-			serverEventHandler.preServe();
-		}
+    public override function Serve() : Void
+    {
+        try
+        {
+            serverTransport.Listen();
+        }
+        catch (ttx : TTransportException)
+        {
+            logDelegate(ttx);
+            return;
+        }
+
+        // Fire the preServe server event when server is up,
+        // but before any client connections
+        if (serverEventHandler != null) {
+            serverEventHandler.preServe();
+        }
 
-		while( ! stop)
-		{
-			var client : TTransport = null;
-			var inputTransport : TTransport = null;
-			var outputTransport : TTransport = null;
-			var inputProtocol : TProtocol = null;
-			var outputProtocol : TProtocol = null;
-			var connectionContext : Dynamic = null;
-			try
-			{
-				client = serverTransport.Accept();
-				if (client != null) {
-					inputTransport = inputTransportFactory.getTransport( client);
-					outputTransport = outputTransportFactory.getTransport( client);
-					inputProtocol = inputProtocolFactory.getProtocol( inputTransport);
-					outputProtocol = outputProtocolFactory.getProtocol( outputTransport);
+        while( ! stop)
+        {
+            var client : TTransport = null;
+            var inputTransport : TTransport = null;
+            var outputTransport : TTransport = null;
+            var inputProtocol : TProtocol = null;
+            var outputProtocol : TProtocol = null;
+            var connectionContext : Dynamic = null;
+            try
+            {
+                client = serverTransport.Accept();
+                if (client != null) {
+                    inputTransport = inputTransportFactory.getTransport( client);
+                    outputTransport = outputTransportFactory.getTransport( client);
+                    inputProtocol = inputProtocolFactory.getProtocol( inputTransport);
+                    outputProtocol = outputProtocolFactory.getProtocol( outputTransport);
 
-					// Recover event handler (if any) and fire createContext 
-					// server event when a client connects
-					if (serverEventHandler != null) {
-						connectionContext = serverEventHandler.createContext(inputProtocol, outputProtocol);
-					}
+                    // Recover event handler (if any) and fire createContext
+                    // server event when a client connects
+                    if (serverEventHandler != null) {
+                        connectionContext = serverEventHandler.createContext(inputProtocol, outputProtocol);
+                    }
 
-					// Process client requests until client disconnects
-					while( true) {
-						// Fire processContext server event
-						// N.B. This is the pattern implemented in C++ and the event fires provisionally.
-						// That is to say it may be many minutes between the event firing and the client request
-						// actually arriving or the client may hang up without ever makeing a request.
-						if (serverEventHandler != null) {
-							serverEventHandler.processContext(connectionContext, inputTransport);
-						}
-							
-						//Process client request (blocks until transport is readable)
-						if( ! processor.process( inputProtocol, outputProtocol)) {
-							break;
-						}
-					}
-				}
-			}
-			catch( ttx : TTransportException)
-			{
-			  	// Usually a client disconnect, expected
-			}
-			catch( e : Dynamic)
-			{
-				// Unexpected
-			  	logDelegate(e); 
-			}
+                    // Process client requests until client disconnects
+                    while( true) {
+                        // Fire processContext server event
+                        // N.B. This is the pattern implemented in C++ and the event fires provisionally.
+                        // That is to say it may be many minutes between the event firing and the client request
+                        // actually arriving or the client may hang up without ever makeing a request.
+                        if (serverEventHandler != null) {
+                            serverEventHandler.processContext(connectionContext, inputTransport);
+                        }
 
-			// Fire deleteContext server event after client disconnects
-			if (serverEventHandler != null) {
-				serverEventHandler.deleteContext(connectionContext, inputProtocol, outputProtocol);
-			}
-		}
-	}
+                        //Process client request (blocks until transport is readable)
+                        if( ! processor.process( inputProtocol, outputProtocol)) {
+                            break;
+                        }
+                    }
+                }
+            }
+            catch( ttx : TTransportException)
+            {
+                  // Usually a client disconnect, expected
+            }
+            catch( e : Dynamic)
+            {
+                // Unexpected
+                  logDelegate(e);
+            }
+
+            // Fire deleteContext server event after client disconnects
+            if (serverEventHandler != null) {
+                serverEventHandler.deleteContext(connectionContext, inputProtocol, outputProtocol);
+            }
+        }
+    }
 
     public override function Stop() : Void
     {

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TFileStream.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TFileStream.hx b/lib/haxe/src/org/apache/thrift/transport/TFileStream.hx
index 03e031f..cd8ad17 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TFileStream.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TFileStream.hx
@@ -26,75 +26,76 @@ import haxe.io.Output;
 
 
 enum TFileMode {
-	CreateNew;
-	Append;
-	Read;
+    CreateNew;
+    Append;
+    Read;
 }
-	
+
 
 class TFileStream implements TStream {
 
-	public var FileName(default,null) : String;
-	
-	private var Input  : sys.io.FileInput;
-	private var Output : sys.io.FileOutput;
-	
-	
-	public function new( fname : String, mode : TFileMode) {
-		FileName = fname;	
-		switch ( mode)
-		{
-			case TFileMode.CreateNew:
-				Output = sys.io.File.write( fname, true);
-
-			case TFileMode.Append:
-				Output = sys.io.File.append( fname, true);
-
-			case TFileMode.Read:
-				Input = sys.io.File.read( fname, true);
-
-			default:
-				throw new TTransportException( TTransportException.UNKNOWN,
-											   "Unsupported mode");
-		}
-
-	}
-	
-	public function Close() : Void {
-		if( Input != null) {
-			Input.close();
-			Input = null;
-		}
-		if( Output != null) { 
-			Output.close();
-			Output = null;
-		}
-	}
-	
-	public function Peek() : Bool {
-		if( Input == null)
-			throw new TTransportException( TTransportException.NOT_OPEN, "File not open for input");
-
-		return (! Input.eof());
-	}
-	
-	public function Read( buf : Bytes, offset : Int, count : Int) : Int {
-		if( Input == null)
-			throw new TTransportException( TTransportException.NOT_OPEN, "File not open for input");
-
-		return Input.readBytes( buf, offset, count);
-	}
-	
-	public function Write( buf : Bytes, offset : Int, count : Int) : Void {
-		if( Output == null)
-			throw new TTransportException( TTransportException.NOT_OPEN, "File not open for output");
-		
-		Output.writeBytes( buf, offset, count);			
-	}
-
-	public function Flush() : Void {
-		if( Output != null) 
-			Output.flush();
-	}
-	
+    public var FileName(default,null) : String;
+
+    private var Input  : sys.io.FileInput;
+    private var Output : sys.io.FileOutput;
+
+
+    public function new( fname : String, mode : TFileMode) {
+        FileName = fname;
+        switch ( mode)
+        {
+            case TFileMode.CreateNew:
+                Output = sys.io.File.write( fname, true);
+
+            case TFileMode.Append:
+                Output = sys.io.File.append( fname, true);
+
+            case TFileMode.Read:
+                Input = sys.io.File.read( fname, true);
+
+            default:
+                throw new TTransportException( TTransportException.UNKNOWN,
+                                               "Unsupported mode");
+        }
+
+    }
+
+    public function Close() : Void {
+        if( Input != null) {
+            Input.close();
+            Input = null;
+        }
+        if( Output != null) {
+            Output.close();
+            Output = null;
+        }
+    }
+
+    public function Peek() : Bool {
+        if( Input == null)
+            throw new TTransportException( TTransportException.NOT_OPEN, "File not open for input");
+
+        return (! Input.eof());
+    }
+
+    public function Read( buf : Bytes, offset : Int, count : Int) : Int {
+        if( Input == null)
+            throw new TTransportException( TTransportException.NOT_OPEN, "File not open for input");
+
+        return Input.readBytes( buf, offset, count);
+    }
+
+    public function Write( buf : Bytes, offset : Int, count : Int) : Void {
+        if( Output == null)
+            throw new TTransportException( TTransportException.NOT_OPEN, "File not open for output");
+
+        Output.writeBytes( buf, offset, count);
+    }
+
+    public function Flush() : Void {
+        if( Output != null)
+            Output.flush();
+    }
+
 }
+ 
\ No newline at end of file


[5/5] thrift git commit: THRIFT-2806 more whitespace fixups Client: Haxe Patch: Jens Geyer

Posted by je...@apache.org.
THRIFT-2806 more whitespace fixups
Client: Haxe
Patch: Jens Geyer

This closes #254


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/b502832c
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/b502832c
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/b502832c

Branch: refs/heads/master
Commit: b502832c7930ba08700f10928cadb49c020ba93f
Parents: fea00ac
Author: Jens Geyer <je...@apache.org>
Authored: Sun Nov 9 02:38:11 2014 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Sun Nov 9 02:50:33 2014 +0100

----------------------------------------------------------------------
 .../org/apache/thrift/AbstractMethodError.hx    |   12 +-
 lib/haxe/src/org/apache/thrift/ArgumentError.hx |    8 +-
 lib/haxe/src/org/apache/thrift/Limits.hx        |   42 +-
 .../org/apache/thrift/TApplicationException.hx  |    6 +-
 lib/haxe/src/org/apache/thrift/TBase.hx         |   14 +-
 lib/haxe/src/org/apache/thrift/TException.hx    |   25 +-
 .../org/apache/thrift/TFieldRequirementType.hx  |    2 +-
 lib/haxe/src/org/apache/thrift/TProcessor.hx    |    2 +-
 .../src/org/apache/thrift/helper/Int64Map.hx    |  416 ++--
 lib/haxe/src/org/apache/thrift/helper/IntSet.hx |   94 +-
 .../src/org/apache/thrift/helper/ObjectSet.hx   |   94 +-
 .../src/org/apache/thrift/helper/StringSet.hx   |   94 +-
 .../apache/thrift/meta_data/FieldMetaData.hx    |    8 +-
 .../thrift/meta_data/FieldValueMetaData.hx      |   12 +-
 .../org/apache/thrift/meta_data/ListMetaData.hx |    9 +-
 .../org/apache/thrift/meta_data/MapMetaData.hx  |    7 +-
 .../org/apache/thrift/meta_data/SetMetaData.hx  |    6 +-
 .../apache/thrift/meta_data/StructMetaData.hx   |    4 +-
 .../apache/thrift/protocol/TBinaryProtocol.hx   |  510 ++---
 .../thrift/protocol/TBinaryProtocolFactory.hx   |   26 +-
 .../src/org/apache/thrift/protocol/TField.hx    |   16 +-
 .../org/apache/thrift/protocol/TJSONProtocol.hx | 1952 +++++++++---------
 .../thrift/protocol/TJSONProtocolFactory.hx     |   14 +-
 .../src/org/apache/thrift/protocol/TList.hx     |    6 +-
 lib/haxe/src/org/apache/thrift/protocol/TMap.hx |    8 +-
 .../src/org/apache/thrift/protocol/TMessage.hx  |   12 +-
 .../org/apache/thrift/protocol/TMessageType.hx  |    6 +-
 .../src/org/apache/thrift/protocol/TProtocol.hx |   72 +-
 .../thrift/protocol/TProtocolException.hx       |   12 +-
 .../apache/thrift/protocol/TProtocolFactory.hx  |    2 +-
 lib/haxe/src/org/apache/thrift/protocol/TSet.hx |    8 +-
 .../src/org/apache/thrift/protocol/TStruct.hx   |   10 +-
 .../src/org/apache/thrift/protocol/TType.hx     |    4 +-
 .../src/org/apache/thrift/server/TServer.hx     |   97 +-
 .../apache/thrift/server/TServerEventHandler.hx |   14 +-
 .../org/apache/thrift/server/TSimpleServer.hx   |  154 +-
 .../org/apache/thrift/transport/TFileStream.hx  |  135 +-
 .../apache/thrift/transport/TFramedTransport.hx |  100 +-
 .../thrift/transport/TFramedTransportFactory.hx |    6 +-
 .../thrift/transport/TFullDuplexHttpClient.hx   |   30 +-
 .../org/apache/thrift/transport/THttpClient.hx  |   86 +-
 .../apache/thrift/transport/TServerSocket.hx    |  188 +-
 .../apache/thrift/transport/TServerTransport.hx |   38 +-
 .../src/org/apache/thrift/transport/TSocket.hx  |  402 ++--
 .../src/org/apache/thrift/transport/TStream.hx  |   10 +-
 .../apache/thrift/transport/TStreamTransport.hx |  124 +-
 .../org/apache/thrift/transport/TTransport.hx   |   38 +-
 .../thrift/transport/TTransportException.hx     |   13 +-
 .../thrift/transport/TTransportFactory.hx       |   22 +-
 lib/haxe/test/src/Main.hx                       |   22 +-
 lib/haxe/test/src/StreamTest.hx                 |  112 +-
 lib/haxe/test/src/TestBase.hx                   |   17 +-
 test/haxe/src/Arguments.hx                      |  546 ++---
 test/haxe/src/Main.hx                           |   36 +-
 test/haxe/src/TestClient.hx                     | 1498 +++++++-------
 test/haxe/src/TestServer.hx                     |  152 +-
 test/haxe/src/TestServerEventHandler.hx         |   38 +-
 test/haxe/src/TestServerHandler.hx              |  664 +++---
 tutorial/haxe/src/CalculatorHandler.hx          |  130 +-
 tutorial/haxe/src/Main.hx                       |  563 ++---
 60 files changed, 4378 insertions(+), 4370 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/AbstractMethodError.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/AbstractMethodError.hx b/lib/haxe/src/org/apache/thrift/AbstractMethodError.hx
index 9fb9bbb..54b8153 100644
--- a/lib/haxe/src/org/apache/thrift/AbstractMethodError.hx
+++ b/lib/haxe/src/org/apache/thrift/AbstractMethodError.hx
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package org.apache.thrift;
 
 #if flash
@@ -25,16 +25,16 @@ import flash.errors.IllegalOperationError;
 import org.apache.thrift.TException;
 #end
 
-class AbstractMethodError 
+class AbstractMethodError
 #if flash
-extends IllegalOperationError 
+extends IllegalOperationError
 #else
 extends TException
 #end
 {
 
-	public function new(message : String="") {
-  		super("Attempt to call an abstract method");
-	}
+    public function new(message : String="") {
+          super("Attempt to call an abstract method");
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/ArgumentError.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/ArgumentError.hx b/lib/haxe/src/org/apache/thrift/ArgumentError.hx
index 8a5df6f..3ca04fd 100644
--- a/lib/haxe/src/org/apache/thrift/ArgumentError.hx
+++ b/lib/haxe/src/org/apache/thrift/ArgumentError.hx
@@ -16,14 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package org.apache.thrift;
 
 #if ! flash
 // predefined for flash only
 class ArgumentError extends TException {
-	public function new(msg : String = "") {
-		super(msg);
-	}
+    public function new(msg : String = "") {
+        super(msg);
+    }
 }
 #end

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/Limits.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/Limits.hx b/lib/haxe/src/org/apache/thrift/Limits.hx
index 7d2aa5d..44eec3a 100644
--- a/lib/haxe/src/org/apache/thrift/Limits.hx
+++ b/lib/haxe/src/org/apache/thrift/Limits.hx
@@ -16,29 +16,29 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package org.apache.thrift;
 
 class Limits {
-    
-	// Haxe limits are not fixed values, they depend on the target platform
-	// For example, neko limits an int to 31 bits instead of 32. So we detect 
-	// the values once during intialisation in order to
-	// (a) get the right values for the current  platform, and 
-	// (b) prevent us from dependecies to a bunch of defines
-	
-	public static var I32_MAX = {
-		var last : Int = 0;
-		var next : Int = 0;
-		for(bit in 0 ... 32) {
-			last = next;
-			next = last | (1 << bit);
-			if(next < 0) {
-				break;
-			}
-		}
-		last; // final value
-	}
 
-	// add whatever you need 
+    // Haxe limits are not fixed values, they depend on the target platform
+    // For example, neko limits an int to 31 bits instead of 32. So we detect
+    // the values once during intialisation in order to
+    // (a) get the right values for the current  platform, and
+    // (b) prevent us from dependecies to a bunch of defines
+
+    public static var I32_MAX = {
+        var last : Int = 0;
+        var next : Int = 0;
+        for(bit in 0 ... 32) {
+            last = next;
+            next = last | (1 << bit);
+            if(next < 0) {
+                break;
+            }
+        }
+        last; // final value
+    }
+
+    // add whatever you need
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/TApplicationException.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/TApplicationException.hx b/lib/haxe/src/org/apache/thrift/TApplicationException.hx
index 012a802..4287a85 100644
--- a/lib/haxe/src/org/apache/thrift/TApplicationException.hx
+++ b/lib/haxe/src/org/apache/thrift/TApplicationException.hx
@@ -30,9 +30,9 @@ import org.apache.thrift.protocol.TType;
    */
 class TApplicationException extends TException {
 
-	private static var TAPPLICATION_EXCEPTION_STRUCT = { new TStruct("TApplicationException"); };
-	private static var MESSAGE_FIELD = { new TField("message", TType.STRING, 1); };
-	private static var TYPE_FIELD = { new TField("type", TType.I32, 2); };
+    private static var TAPPLICATION_EXCEPTION_STRUCT = { new TStruct("TApplicationException"); };
+    private static var MESSAGE_FIELD = { new TField("message", TType.STRING, 1); };
+    private static var TYPE_FIELD = { new TField("type", TType.I32, 2); };
 
     public static inline var UNKNOWN : Int = 0;
     public static inline var UNKNOWN_METHOD : Int = 1;

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/TBase.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/TBase.hx b/lib/haxe/src/org/apache/thrift/TBase.hx
index 5d8bfc1..a35c752 100644
--- a/lib/haxe/src/org/apache/thrift/TBase.hx
+++ b/lib/haxe/src/org/apache/thrift/TBase.hx
@@ -26,38 +26,38 @@ import org.apache.thrift.protocol.TProtocol;
    *
    */
 interface TBase {
-  
+
     /**
      * Reads the TObject from the given input protocol.
      *
      * @param iprot Input protocol
      */
     function read(iprot:TProtocol) : Void;
-  
+
     /**
      * Writes the objects out to the protocol
      *
      * @param oprot Output protocol
      */
     function write(oprot:TProtocol) : Void;
-  
+
     /**
      * Check if a field is currently set or unset.
      *
      * @param fieldId The field's id tag as found in the IDL.
      */
     function isSet(fieldId : Int) : Bool;
-  
+
     /**
-     * Get a field's value by id. Primitive types will be wrapped in the 
+     * Get a field's value by id. Primitive types will be wrapped in the
      * appropriate "boxed" types.
      *
      * @param fieldId The field's id tag as found in the IDL.
      */
     function getFieldValue(fieldId : Int) : Dynamic;
-  
+
     /**
-     * Set a field's value by id. Primitive types must be "boxed" in the 
+     * Set a field's value by id. Primitive types must be "boxed" in the
      * appropriate object wrapper type.
      *
      * @param fieldId The field's id tag as found in the IDL.

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/TException.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/TException.hx b/lib/haxe/src/org/apache/thrift/TException.hx
index ed630ba..54fa1ff 100644
--- a/lib/haxe/src/org/apache/thrift/TException.hx
+++ b/lib/haxe/src/org/apache/thrift/TException.hx
@@ -16,20 +16,21 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package org.apache.thrift;
 
 class TException {
-    
-	@:isVar 
-	public var errorID(default,null) : Int;
-	@:isVar 
-	public var errorMsg(default,null) : String;
 
-	
-	public function new(msg : String = "", id : Int = 0) {
-		errorID = id;
-		errorMsg = msg;
-	}
-    
+    @:isVar
+    public var errorID(default,null) : Int;
+    @:isVar
+    public var errorMsg(default,null) : String;
+
+
+    public function new(msg : String = "", id : Int = 0) {
+        errorID = id;
+        errorMsg = msg;
+    }
+
 }
+ 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx b/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
index 70f698f..7c22030 100644
--- a/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
+++ b/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
@@ -27,5 +27,5 @@ class TFieldRequirementType {
     public static inline var REQUIRED : Int  = 1;
     public static inline var OPTIONAL : Int = 2;
     public static inline var DEFAULT : Int = 3;
-  
+
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/TProcessor.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/TProcessor.hx b/lib/haxe/src/org/apache/thrift/TProcessor.hx
index 78ce5a7..0cb6f7d 100644
--- a/lib/haxe/src/org/apache/thrift/TProcessor.hx
+++ b/lib/haxe/src/org/apache/thrift/TProcessor.hx
@@ -26,5 +26,5 @@ import org.apache.thrift.protocol.TProtocol;
  * writes to some output stream.
  */
 interface TProcessor {
-	function process(input:TProtocol, output:TProtocol) : Bool;
+    function process(input:TProtocol, output:TProtocol) : Bool;
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx b/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
index 8d9e4e1..6d6a6a1 100644
--- a/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
@@ -29,187 +29,187 @@ import haxe.ds.IntMap;
 
 class Int64Map<T> implements IMap< Int64, T> {
 
-	private var SubMaps : IntMap< IntMap< T>>;  // Hi -> Lo -> Value
-	
-	public function new() : Void {
-		SubMaps = new IntMap< IntMap< T>>();
-	};
-
-	private function GetSubMap( hi : haxe.Int32, canCreate : Bool) : IntMap< T> {
-		if( SubMaps.exists(hi)) {
-			return SubMaps.get(hi);
-		} 
-		
-		if( ! canCreate) {
-			return null;
-		} 
-		
-		var lomap = new IntMap< T>();
-		SubMaps.set( hi, lomap);
-		return lomap;
-	}
-	
-	/**
-		Maps `key` to `value`.
-		If `key` already has a mapping, the previous value disappears.
-		If `key` is null, the result is unspecified.
-	**/
-	public function set( key : Int64, value : T ) : Void {
-		if( key ==  null) {
-			return;
-		}
-
-		var lomap = GetSubMap( Int64.getHigh(key), true);
-		lomap.set( Int64.getLow(key), value);
-	}
-	
-
-	/**
-		Returns the current mapping of `key`.
-		If no such mapping exists, null is returned.
-		If `key` is null, the result is unspecified.
-
-		Note that a check like `map.get(key) == null` can hold for two reasons:
-
-			1. the map has no mapping for `key`
-			2. the map has a mapping with a value of `null`
-
-		If it is important to distinguish these cases, `exists()` should be
-		used.
-
-	**/
-	public function get( key : Int64) : Null<T> {
-		if( key ==  null) {
-			return null;
-		}
-		
-		var lomap = GetSubMap( Int64.getHigh(key), false);
-		if( lomap == null) {
-			return null;
-		}
-
-		return lomap.get( Int64.getLow(key));
-	}
-
-	/**
-		Returns true if `key` has a mapping, false otherwise.
-		If `key` is null, the result is unspecified.
-	**/
-	public function exists( key : Int64) : Bool {
-		if( key ==  null) {
-			return false;
-		}
-		
-		var lomap = GetSubMap( Int64.getHigh(key), false);
-		if( lomap == null) {
-			return false;
-		}
-
-		return lomap.exists( Int64.getLow(key));
-	}
-
-	/**
-		Removes the mapping of `key` and returns true if such a mapping existed,
-		false otherwise. If `key` is null, the result is unspecified.
-	**/
-	public function remove( key : Int64) : Bool {
-		if( key ==  null) {
-			return false;
-		}
-		
-		var lomap = GetSubMap( Int64.getHigh(key), false);
-		if( lomap == null) {
-			return false;
-		}
-
-		return lomap.remove( Int64.getLow(key));
-	}
-
-
-	/**
-		Returns an Iterator over the keys of `this` Map.
-		The order of keys is undefined.
-	**/
-	public function keys() : Iterator<Int64> {
-		return new Int64KeyIterator<T>(SubMaps);
-	}
-
-	/**
-		Returns an Iterator over the values of `this` Map.
-		The order of values is undefined.
-	**/
-	public function iterator() : Iterator<T> {
-		return new Int64ValueIterator<T>(SubMaps);
-	}
-
-	/**
-		Returns a String representation of `this` Map.
-		The exact representation depends on the platform and key-type.
-	**/
-	public function toString() : String {
-		var result : String = "{"; 
-
-		var first = true;
-		for( key in this.keys()) {
-			if( first) {
-				first = false;
-			} else {
-				result += ", ";
-			}
-			
-			var value = this.get(key);
-			result += Int64.toStr(key) + ' => $value';
-		}
-
-		return result + "}";
-	}
+    private var SubMaps : IntMap< IntMap< T>>;  // Hi -> Lo -> Value
+
+    public function new() : Void {
+        SubMaps = new IntMap< IntMap< T>>();
+    };
+
+    private function GetSubMap( hi : haxe.Int32, canCreate : Bool) : IntMap< T> {
+        if( SubMaps.exists(hi)) {
+            return SubMaps.get(hi);
+        }
+
+        if( ! canCreate) {
+            return null;
+        }
+
+        var lomap = new IntMap< T>();
+        SubMaps.set( hi, lomap);
+        return lomap;
+    }
+
+    /**
+        Maps `key` to `value`.
+        If `key` already has a mapping, the previous value disappears.
+        If `key` is null, the result is unspecified.
+    **/
+    public function set( key : Int64, value : T ) : Void {
+        if( key ==  null) {
+            return;
+        }
+
+        var lomap = GetSubMap( Int64.getHigh(key), true);
+        lomap.set( Int64.getLow(key), value);
+    }
+
+
+    /**
+        Returns the current mapping of `key`.
+        If no such mapping exists, null is returned.
+        If `key` is null, the result is unspecified.
+
+        Note that a check like `map.get(key) == null` can hold for two reasons:
+
+            1. the map has no mapping for `key`
+            2. the map has a mapping with a value of `null`
+
+        If it is important to distinguish these cases, `exists()` should be
+        used.
+
+    **/
+    public function get( key : Int64) : Null<T> {
+        if( key ==  null) {
+            return null;
+        }
+
+        var lomap = GetSubMap( Int64.getHigh(key), false);
+        if( lomap == null) {
+            return null;
+        }
+
+        return lomap.get( Int64.getLow(key));
+    }
+
+    /**
+        Returns true if `key` has a mapping, false otherwise.
+        If `key` is null, the result is unspecified.
+    **/
+    public function exists( key : Int64) : Bool {
+        if( key ==  null) {
+            return false;
+        }
+
+        var lomap = GetSubMap( Int64.getHigh(key), false);
+        if( lomap == null) {
+            return false;
+        }
+
+        return lomap.exists( Int64.getLow(key));
+    }
+
+    /**
+        Removes the mapping of `key` and returns true if such a mapping existed,
+        false otherwise. If `key` is null, the result is unspecified.
+    **/
+    public function remove( key : Int64) : Bool {
+        if( key ==  null) {
+            return false;
+        }
+
+        var lomap = GetSubMap( Int64.getHigh(key), false);
+        if( lomap == null) {
+            return false;
+        }
+
+        return lomap.remove( Int64.getLow(key));
+    }
+
+
+    /**
+        Returns an Iterator over the keys of `this` Map.
+        The order of keys is undefined.
+    **/
+    public function keys() : Iterator<Int64> {
+        return new Int64KeyIterator<T>(SubMaps);
+    }
+
+    /**
+        Returns an Iterator over the values of `this` Map.
+        The order of values is undefined.
+    **/
+    public function iterator() : Iterator<T> {
+        return new Int64ValueIterator<T>(SubMaps);
+    }
+
+    /**
+        Returns a String representation of `this` Map.
+        The exact representation depends on the platform and key-type.
+    **/
+    public function toString() : String {
+        var result : String = "{";
+
+        var first = true;
+        for( key in this.keys()) {
+            if( first) {
+                first = false;
+            } else {
+                result += ", ";
+            }
+
+            var value = this.get(key);
+            result += Int64.toStr(key) + ' => $value';
+        }
+
+        return result + "}";
+    }
 
 }
 
-	
+
 // internal helper class for Int64Map<T>
 // all class with matching methods can be used as iterator (duck typing)
 private class Int64MapIteratorBase<T> {
 
-	private var SubMaps : IntMap< IntMap< T>>;  // Hi -> Lo -> Value
-	
-	private var HiIterator : Iterator< Int> = null;
-	private var LoIterator : Iterator< Int> = null;
-	private var CurrentHi : Int = 0;
-	
-	public function new( data : IntMap< IntMap< T>>) : Void {
-		SubMaps = data;
-		HiIterator = SubMaps.keys();
-		LoIterator = null;
-		CurrentHi = 0;
-	};
-
-	/**
-		Returns false if the iteration is complete, true otherwise.
-
-		Usually iteration is considered to be complete if all elements of the
-		underlying data structure were handled through calls to next(). However,
-		in custom iterators any logic may be used to determine the completion
-		state.
-	**/
-	public function hasNext() : Bool {
-		
-		if( (LoIterator != null) && LoIterator.hasNext()) {
-			return true;
-		}
-		
-		while( (HiIterator != null) && HiIterator.hasNext()) {
-			CurrentHi = HiIterator.next();
-			LoIterator = SubMaps.get(CurrentHi).keys();
-			if( (LoIterator != null) && LoIterator.hasNext()) {
-				return true;
-			}
-		}
-		
-		HiIterator = null;
-		LoIterator = null;
-		return false;
-	}
+    private var SubMaps : IntMap< IntMap< T>>;  // Hi -> Lo -> Value
+
+    private var HiIterator : Iterator< Int> = null;
+    private var LoIterator : Iterator< Int> = null;
+    private var CurrentHi : Int = 0;
+
+    public function new( data : IntMap< IntMap< T>>) : Void {
+        SubMaps = data;
+        HiIterator = SubMaps.keys();
+        LoIterator = null;
+        CurrentHi = 0;
+    };
+
+    /**
+        Returns false if the iteration is complete, true otherwise.
+
+        Usually iteration is considered to be complete if all elements of the
+        underlying data structure were handled through calls to next(). However,
+        in custom iterators any logic may be used to determine the completion
+        state.
+    **/
+    public function hasNext() : Bool {
+
+        if( (LoIterator != null) && LoIterator.hasNext()) {
+            return true;
+        }
+
+        while( (HiIterator != null) && HiIterator.hasNext()) {
+            CurrentHi = HiIterator.next();
+            LoIterator = SubMaps.get(CurrentHi).keys();
+            if( (LoIterator != null) && LoIterator.hasNext()) {
+                return true;
+            }
+        }
+
+        HiIterator = null;
+        LoIterator = null;
+        return false;
+    }
 
 }
 
@@ -218,23 +218,23 @@ private class Int64MapIteratorBase<T> {
 // all class with matching methods can be used as iterator (duck typing)
 private class Int64KeyIterator<T>extends Int64MapIteratorBase<T> {
 
-	public function new( data : IntMap< IntMap< T>>) : Void {
-		super(data);
-	};
-
-	/**
-		Returns the current item of the Iterator and advances to the next one.
-
-		This method is not required to check hasNext() first. A call to this
-		method while hasNext() is false yields unspecified behavior.
-	**/
-	public function next() : Int64 {
-		if( hasNext()) {
-			return Int64.make( CurrentHi, LoIterator.next());
-		} else {
-			throw "no more elements";
-		}
-	}
+    public function new( data : IntMap< IntMap< T>>) : Void {
+        super(data);
+    };
+
+    /**
+        Returns the current item of the Iterator and advances to the next one.
+
+        This method is not required to check hasNext() first. A call to this
+        method while hasNext() is false yields unspecified behavior.
+    **/
+    public function next() : Int64 {
+        if( hasNext()) {
+            return Int64.make( CurrentHi, LoIterator.next());
+        } else {
+            throw "no more elements";
+        }
+    }
 }
 
 
@@ -242,23 +242,23 @@ private class Int64KeyIterator<T>extends Int64MapIteratorBase<T> {
 // all class with matching methods can be used as iterator (duck typing)
 private class Int64ValueIterator<T> extends Int64MapIteratorBase<T> {
 
-	public function new( data : IntMap< IntMap< T>>) : Void {
-		super(data);
-	};
-
-	/**
-		Returns the current item of the Iterator and advances to the next one.
-
-		This method is not required to check hasNext() first. A call to this
-		method while hasNext() is false yields unspecified behavior.
-	**/
-	public function next() : T {
-		if( hasNext()) {
-			return SubMaps.get(CurrentHi).get(LoIterator.next());
-		} else {
-			throw "no more elements";
-		}
-	}
+    public function new( data : IntMap< IntMap< T>>) : Void {
+        super(data);
+    };
+
+    /**
+        Returns the current item of the Iterator and advances to the next one.
+
+        This method is not required to check hasNext() first. A call to this
+        method while hasNext() is false yields unspecified behavior.
+    **/
+    public function next() : T {
+        if( hasNext()) {
+            return SubMaps.get(CurrentHi).get(LoIterator.next());
+        } else {
+            throw "no more elements";
+        }
+    }
 }
 
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/helper/IntSet.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/helper/IntSet.hx b/lib/haxe/src/org/apache/thrift/helper/IntSet.hx
index 214f3bd..91e5d8e 100644
--- a/lib/haxe/src/org/apache/thrift/helper/IntSet.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/IntSet.hx
@@ -18,79 +18,79 @@
  */
 
 package org.apache.thrift.helper;
-  
+
 import Map;
 
 
 class IntSet {
-    
+
     private var _elements = new haxe.ds.IntMap<Int>();
     private var _size : Int = 0;
     public var size(get,never) : Int;
-    
+
     public function new( values : Array<Int> = null) {
-		if ( values != null) {
-			for ( value in values) {
-				 add(value);
-			}
-		}
+        if ( values != null) {
+            for ( value in values) {
+                 add(value);
+            }
+        }
     }
 
-	public function iterator():Iterator<Int> {
-		return _elements.keys();
-	}
+    public function iterator():Iterator<Int> {
+        return _elements.keys();
+    }
 
-	public function traceAll() : Void {
-		trace('$_size entries');
-		for(entry in this) {
-			var yes = contains(entry);
-			trace('- $entry, contains() = $yes');
-		}
-	}
+    public function traceAll() : Void {
+        trace('$_size entries');
+        for(entry in this) {
+            var yes = contains(entry);
+            trace('- $entry, contains() = $yes');
+        }
+    }
 
     public function add(o : Int) : Bool {
-		if( _elements.exists(o)) {
-			return false;
-		}
+        if( _elements.exists(o)) {
+            return false;
+        }
         _size++;
         _elements.set(o,_size);
-		return true;
+        return true;
     }
 
     public function clear() : Void {
-		while( _size > 0) {
-			remove( _elements.keys().next());			
-		}
+        while( _size > 0) {
+            remove( _elements.keys().next());
+        }
     }
-    
+
     public function contains(o : Int) : Bool {
-		return _elements.exists(o);
+        return _elements.exists(o);
     }
-    
+
     public function isEmpty() : Bool {
-		return _size == 0;
+        return _size == 0;
     }
-    
+
     public function remove(o : Int) : Bool {
-		if (contains(o)) {
-			_elements.remove(o);
-			_size--;
-			return true;
-		} else {
-			return false;
-		}
+        if (contains(o)) {
+            _elements.remove(o);
+            _size--;
+            return true;
+        } else {
+            return false;
+        }
     }
-    
+
     public function toArray() : Array<Int> {
-		var ret : Array<Int> = new Array<Int>();
-		for (key in _elements.keys()) {
-			ret.push(key);
-		}
-		return ret;
+        var ret : Array<Int> = new Array<Int>();
+        for (key in _elements.keys()) {
+            ret.push(key);
+        }
+        return ret;
     }
-    
-    public function get_size() : Int {		
-		return _size;
+
+    public function get_size() : Int {
+        return _size;
     }
 }
-	
\ No newline at end of file
+    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/helper/ObjectSet.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/helper/ObjectSet.hx b/lib/haxe/src/org/apache/thrift/helper/ObjectSet.hx
index c590c75..bcf72fb 100644
--- a/lib/haxe/src/org/apache/thrift/helper/ObjectSet.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/ObjectSet.hx
@@ -18,79 +18,79 @@
  */
 
 package org.apache.thrift.helper;
-  
+
 import Map;
 
 
 class ObjectSet<K> {
-    
+
     private var _elements = new haxe.ds.ObjectMap<K,Int>();
     private var _size : Int = 0;
     public var size(get,never) : Int;
-    
+
     public function new( values : Array<K> = null) {
-		if ( values != null) {
-			for ( value in values) {
-				 add(value);
-			}
-		}
+        if ( values != null) {
+            for ( value in values) {
+                 add(value);
+            }
+        }
     }
 
-	public function iterator():Iterator<K> {
-		return _elements.keys();
-	}
+    public function iterator():Iterator<K> {
+        return _elements.keys();
+    }
 
-	public function traceAll() : Void {
-		trace('$_size entries');
-		for(entry in this) {
-			var yes = contains(entry);
-			trace('- $entry, contains() = $yes');
-		}
-	}
+    public function traceAll() : Void {
+        trace('$_size entries');
+        for(entry in this) {
+            var yes = contains(entry);
+            trace('- $entry, contains() = $yes');
+        }
+    }
 
     public function add(o : K) : Bool {
-		if( _elements.exists(o)) {
-			return false;
-		}
+        if( _elements.exists(o)) {
+            return false;
+        }
         _size++;
         _elements.set(o,_size);
-		return true;
+        return true;
     }
 
     public function clear() : Void {
-		while( _size > 0) {
-			remove( _elements.keys().next());			
-		}
+        while( _size > 0) {
+            remove( _elements.keys().next());
+        }
     }
-    
+
     public function contains(o : K) : Bool {
-		return _elements.exists(o);
+        return _elements.exists(o);
     }
-    
+
     public function isEmpty() : Bool {
-		return _size == 0;
+        return _size == 0;
     }
-    
+
     public function remove(o : K) : Bool {
-		if (contains(o)) {
-			_elements.remove(o);
-			_size--;
-			return true;
-		} else {
-			return false;
-		}
+        if (contains(o)) {
+            _elements.remove(o);
+            _size--;
+            return true;
+        } else {
+            return false;
+        }
     }
-    
+
     public function toArray() : Array<K> {
-		var ret : Array<K> = new Array<K>();
-		for (key in _elements.keys()) {
-			ret.push(key);
-		}
-		return ret;
+        var ret : Array<K> = new Array<K>();
+        for (key in _elements.keys()) {
+            ret.push(key);
+        }
+        return ret;
     }
-    
-    public function get_size() : Int {		
-		return _size;
+
+    public function get_size() : Int {
+        return _size;
     }
 }
-	
\ No newline at end of file
+    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/helper/StringSet.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/helper/StringSet.hx b/lib/haxe/src/org/apache/thrift/helper/StringSet.hx
index ee772c7..d8c0d90 100644
--- a/lib/haxe/src/org/apache/thrift/helper/StringSet.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/StringSet.hx
@@ -18,79 +18,79 @@
  */
 
 package org.apache.thrift.helper;
-  
+
 import Map;
 
 
 class StringSet {
-    
+
     private var _elements = new haxe.ds.StringMap<Int>();
     private var _size : Int = 0;
     public var size(get,never) : Int;
-    
+
     public function new( values : Array<String> = null) {
-		if ( values != null) {
-			for ( value in values) {
-				 add(value);
-			}
-		}
+        if ( values != null) {
+            for ( value in values) {
+                 add(value);
+            }
+        }
     }
 
-	public function iterator():Iterator<String> {
-		return _elements.keys();
-	}
+    public function iterator():Iterator<String> {
+        return _elements.keys();
+    }
 
-	public function traceAll() : Void {
-		trace('$_size entries');
-		for(entry in this) {
-			var yes = contains(entry);
-			trace('- $entry, contains() = $yes');
-		}
-	}
+    public function traceAll() : Void {
+        trace('$_size entries');
+        for(entry in this) {
+            var yes = contains(entry);
+            trace('- $entry, contains() = $yes');
+        }
+    }
 
     public function add(o : String) : Bool {
-		if( _elements.exists(o)) {
-			return false;
-		}
+        if( _elements.exists(o)) {
+            return false;
+        }
         _size++;
         _elements.set(o,_size);
-		return true;
+        return true;
     }
 
     public function clear() : Void {
-		while( _size > 0) {
-			remove( _elements.keys().next());			
-		}
+        while( _size > 0) {
+            remove( _elements.keys().next());
+        }
     }
-    
+
     public function contains(o : String) : Bool {
-		return _elements.exists(o);
+        return _elements.exists(o);
     }
-    
+
     public function isEmpty() : Bool {
-		return _size == 0;
+        return _size == 0;
     }
-    
+
     public function remove(o : String) : Bool {
-		if (contains(o)) {
-			_elements.remove(o);
-			_size--;
-			return true;
-		} else {
-			return false;
-		}
+        if (contains(o)) {
+            _elements.remove(o);
+            _size--;
+            return true;
+        } else {
+            return false;
+        }
     }
-    
+
     public function toArray() : Array<String> {
-		var ret : Array<String> = new Array<String>();
-		for (key in _elements.keys()) {
-			ret.push(key);
-		}
-		return ret;
+        var ret : Array<String> = new Array<String>();
+        for (key in _elements.keys()) {
+            ret.push(key);
+        }
+        return ret;
     }
-    
-    public function get_size() : String {		
-		return _size;
+
+    public function get_size() : String {
+        return _size;
     }
 }
-	
\ No newline at end of file
+    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx
index 147eed9..26db113 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx
@@ -27,19 +27,19 @@ import flash.utils.Dictionary;
 *
 */
 class FieldMetaData {
-  
+
   public var fieldName : String;
   public var requirementType : Int;
   public var valueMetaData:FieldValueMetaData;
-  
+
   private static var structMap:Dictionary = new Dictionary();
-  
+
   public function FieldMetaData(name : String, req : Int, vMetaData:FieldValueMetaData) {
     this.fieldName = name;
     this.requirementType = req;
     this.valueMetaData = vMetaData;
   }
-  
+
   public static function addStructMetaDataMap(sClass:Class, map:Dictionary) : Void{
     structMap[sClass] = map;
   }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx
index 06c7f48..8879d91 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx
@@ -26,17 +26,17 @@ import org.apache.thrift.protocol.TType;
  * the value(s) of a field
  */
 class FieldValueMetaData {
-  
-  public var type : Int;  
- 
+
+  public var type : Int;
+
   public function FieldValueMetaData(type : Int) {
     this.type = type;
   }
-  
+
   public function isStruct() : Bool {
-    return type == TType.STRUCT; 
+    return type == TType.STRUCT;
   }
-  
+
   public function isContainer() : Bool {
     return type == TType.LIST || type == TType.MAP || type == TType.SET;
   }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx
index 36bb2d1..40ca31b 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx
@@ -18,13 +18,14 @@
  */
 
 package org.apache.thrift.meta_data;
-  
+
 class ListMetaData extends FieldValueMetaData {
-    
+
     public var elemMetaData:FieldValueMetaData;
-  
+
     public function ListMetaData(type : Int, eMetaData:FieldValueMetaData) {
       super(type);
       this.elemMetaData = eMetaData;
-    }    
+    }
 }
+ 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx
index bf0502a..5463e62 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx
@@ -20,13 +20,14 @@
 package org.apache.thrift.meta_data;
 
 class MapMetaData extends FieldValueMetaData {
-  
+
     public var keyMetaData:FieldValueMetaData;
     public var valueMetaData:FieldValueMetaData;
-  
+
     public function MapMetaData(type : Int, kMetaData:FieldValueMetaData, vMetaData:FieldValueMetaData) {
       super(type);
       this.keyMetaData = kMetaData;
       this.valueMetaData = vMetaData;
     }
-}    
+}
+   
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx
index 0ee6c93..a3367f4 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx
@@ -20,11 +20,11 @@
 package org.apache.thrift.meta_data;
 
 class SetMetaData extends FieldValueMetaData {
-  
+
     public var elemMetaData:FieldValueMetaData;
-  
+
     public function SetMetaData(type : Int, eMetaData:FieldValueMetaData) {
       super(type);
-      this.elemMetaData = eMetaData; 
+      this.elemMetaData = eMetaData;
     }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx
index bbf11e7..1822dd3 100644
--- a/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx
+++ b/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx
@@ -20,9 +20,9 @@
 package org.apache.thrift.meta_data;
 
 class StructMetaData extends FieldValueMetaData {
-    
+
     public var structClass:Class;
-  
+
     public function StructMetaData(type : Int, sClass:Class) {
       super(type);
       this.structClass = sClass;

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
index 9693b35..c37b74e 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
@@ -33,264 +33,264 @@ import org.apache.thrift.transport.TTransport;
 */
 class TBinaryProtocol implements TProtocol {
 
-	private static var ANONYMOUS_STRUCT:TStruct = new TStruct();
-
-	private static inline var VERSION_MASK : haxe.Int32 = 0xffff0000;
-	private static inline var VERSION_1 : haxe.Int32 = 0x80010000;
-
-	private var strictRead_ : Bool = false;
-	private var strictWrite_ : Bool = true;
-	private var trans_ : TTransport;
-
-	/**
-	 * Constructor
-	 */
-	public function new(trans:TTransport, strictRead : Bool=false, strictWrite : Bool=true) {
-	  trans_ = trans;
-	  strictRead_ = strictRead;
-	  strictWrite_ = strictWrite;
-	}
-
-	public function getTransport():TTransport {
-	  return trans_;
-	}
-
-	public function writeMessageBegin(message:TMessage) : Void {
-		if (strictWrite_) {
-		  var version : Int = VERSION_1 | message.type;
-		  writeI32(version);
-		  writeString(message.name);
-		  writeI32(message.seqid);
-		} else {
-		  writeString(message.name);
-		  writeByte(message.type);
-		  writeI32(message.seqid);
-		}
-	}
+    private static var ANONYMOUS_STRUCT:TStruct = new TStruct();
+
+    private static inline var VERSION_MASK : haxe.Int32 = 0xffff0000;
+    private static inline var VERSION_1 : haxe.Int32 = 0x80010000;
+
+    private var strictRead_ : Bool = false;
+    private var strictWrite_ : Bool = true;
+    private var trans_ : TTransport;
+
+    /**
+     * Constructor
+     */
+    public function new(trans:TTransport, strictRead : Bool=false, strictWrite : Bool=true) {
+      trans_ = trans;
+      strictRead_ = strictRead;
+      strictWrite_ = strictWrite;
+    }
+
+    public function getTransport():TTransport {
+      return trans_;
+    }
+
+    public function writeMessageBegin(message:TMessage) : Void {
+        if (strictWrite_) {
+          var version : Int = VERSION_1 | message.type;
+          writeI32(version);
+          writeString(message.name);
+          writeI32(message.seqid);
+        } else {
+          writeString(message.name);
+          writeByte(message.type);
+          writeI32(message.seqid);
+        }
+    }
 
     public function writeMessageEnd() : Void {}
 
-	public function writeStructBegin(struct:TStruct) : Void {}
-
-	public function writeStructEnd() : Void {}
-
-	public function writeFieldBegin(field:TField) : Void {
-	  writeByte(field.type);
-	  writeI16(field.id);
-	}
-
-	public function writeFieldEnd() : Void {}
-
-	public function writeFieldStop() : Void {
-	  writeByte(TType.STOP);
-	}
-
-	public function writeMapBegin(map:TMap) : Void {
-	  writeByte(map.keyType);
-	  writeByte(map.valueType);
-	  writeI32(map.size);
-	}
-
-	public function writeMapEnd() : Void {}
-
-	public function writeListBegin(list:TList) : Void {
-		writeByte(list.elemType);
-		writeI32(list.size);
-	}
-
-	public function writeListEnd() : Void {}
-
-	public function writeSetBegin(set:TSet) : Void {
-		writeByte(set.elemType);
-		writeI32(set.size);
-	}
-
-	public function writeSetEnd() : Void {}
-
-	public function writeBool(b : Bool) : Void {
-		writeByte(b ? 1 : 0);
-	}
-
-
-	public function writeByte(b : Int) : Void {
-		var out = new BytesOutput();
-		out.bigEndian = true;
-		out.writeByte(b);
-		trans_.write(out.getBytes(), 0, 1);
-	}
-
-	public function writeI16(i16 : Int) : Void {
-		var out = new BytesOutput();
-		out.bigEndian = true;
-		out.writeInt16(i16);
-		trans_.write(out.getBytes(), 0, 2);
-	}
-
-	public function writeI32(i32 : Int) : Void {
-		var out = new BytesOutput();
-		out.bigEndian = true;
-		out.writeInt32(i32);
-		trans_.write(out.getBytes(), 0, 4);
-	}
-
-	public function writeI64(i64 : haxe.Int64) : Void {
-		var out = new BytesOutput();
-		out.bigEndian = true;
-		var hi = Int64.getHigh(i64);
-		var lo = Int64.getLow(i64);
-		out.writeInt32(hi);
-		out.writeInt32(lo);
-		trans_.write(out.getBytes(), 0, 8);
-	}
-
-	public function writeDouble(dub:Float) : Void {
-		var out = new BytesOutput();
-		out.bigEndian = true;
-		out.writeDouble(dub);
-		trans_.write(out.getBytes(), 0, 8);
-	}
-
-	public function writeString(str : String) : Void {
-		var out = new BytesOutput();
-		out.bigEndian = true;
-		out.writeString(str);
-		var bytes = out.getBytes();
-		writeI32( bytes.length);
-		trans_.write( bytes, 0, bytes.length);
-	}
-
-	public function writeBinary(bin:Bytes) : Void {
-		writeI32(bin.length);
-		trans_.write(bin, 0, bin.length);
-	}
-
-	/**
-	 * Reading methods.
-	 */
-
-	public function readMessageBegin():TMessage {
-		var size : Int = readI32();
-		if (size < 0) {
-			var version : Int = size & VERSION_MASK;
-			if (version != VERSION_1) {
-				throw new TProtocolException(TProtocolException.BAD_VERSION, "Bad version in readMessageBegin");
-			}
-			return new TMessage(readString(), size & 0x000000ff, readI32());
-		} else {
-			if (strictRead_) {
-				throw new TProtocolException(TProtocolException.BAD_VERSION, "Missing version in readMessageBegin, old client?");
-			}
-			return new TMessage(readStringBody(size), readByte(), readI32());
-		}
-	}
-
-	public function readMessageEnd() : Void {}
-
-	public function readStructBegin():TStruct {
-		return ANONYMOUS_STRUCT;
-	}
-
-	public function readStructEnd() : Void {}
-
-	public function readFieldBegin() : TField {
-		var type : Int = readByte();
-		var id : Int = 0;
-		if (type != TType.STOP)
-		{
-			id = readI16();
-		}
-		return new TField("", type, id);
-	}
-
-	public function readFieldEnd() : Void {}
-
-	public function readMapBegin() : TMap {
-		return new TMap(readByte(), readByte(), readI32());
-	}
-
-	public function readMapEnd() : Void {}
-
-	public function readListBegin():TList {
-		return new TList(readByte(), readI32());
-	}
-
-	public function readListEnd() : Void {}
-
-	public function readSetBegin() : TSet {
-	  return new TSet(readByte(), readI32());
-	}
-
-	public function readSetEnd() : Void {}
-
-	public function readBool() : Bool {
-		return (readByte() == 1);
-	}
-
-
-	public function readByte() : Int {
-		var buffer = new BytesBuffer();
-		var len = trans_.readAll( buffer, 0, 1);        
-		var inp = new BytesInput( buffer.getBytes(), 0, 1);
-		inp.bigEndian = true;
-		return inp.readByte();
-	}
-
-	public function readI16() : Int {
-		var buffer = new BytesBuffer();
-		var len = trans_.readAll( buffer, 0, 2);        
-		var inp = new BytesInput( buffer.getBytes(), 0, 2);
-		inp.bigEndian = true;
-		return inp.readInt16();
-	}
-
-	public function readI32() : Int {
-		var buffer = new BytesBuffer();
-		var len = trans_.readAll( buffer, 0, 4);        
-		var inp = new BytesInput( buffer.getBytes(), 0, 4);
-		inp.bigEndian = true;
-		return inp.readInt32();
-	}
-
-	public function readI64() : haxe.Int64 {
-		var buffer = new BytesBuffer();
-		var len = trans_.readAll( buffer, 0, 8);        
-		var inp = new BytesInput( buffer.getBytes(), 0, 8);
-		inp.bigEndian = true;
-		var hi = inp.readInt32();
-		var lo = inp.readInt32();
-		return Int64.make(hi,lo);
-	}
-
-	public function readDouble():Float {
-		var buffer = new BytesBuffer();
-		var len = trans_.readAll( buffer, 0, 8);        
-		var inp = new BytesInput( buffer.getBytes(), 0, 8);
-		inp.bigEndian = true;
-		return inp.readDouble();
-	}
-
-	public function readString() : String {
-		return readStringBody( readI32());
-	}
-
-	public function readStringBody(len : Int) : String {
-		if( len > 0) {
-			var buffer = new BytesBuffer();
-			trans_.readAll( buffer, 0, len);
-			var inp = new BytesInput( buffer.getBytes(), 0, len);
-			inp.bigEndian = true;
-			return inp.readString(len);
-		} else {
-			return "";
-		}
-	}
-
-	public function readBinary() : Bytes {
-		var len : Int = readI32();
-		var buffer = new BytesBuffer();
-		trans_.readAll( buffer, 0, len);
-		return buffer.getBytes();
-	}
+    public function writeStructBegin(struct:TStruct) : Void {}
+
+    public function writeStructEnd() : Void {}
+
+    public function writeFieldBegin(field:TField) : Void {
+      writeByte(field.type);
+      writeI16(field.id);
+    }
+
+    public function writeFieldEnd() : Void {}
+
+    public function writeFieldStop() : Void {
+      writeByte(TType.STOP);
+    }
+
+    public function writeMapBegin(map:TMap) : Void {
+      writeByte(map.keyType);
+      writeByte(map.valueType);
+      writeI32(map.size);
+    }
+
+    public function writeMapEnd() : Void {}
+
+    public function writeListBegin(list:TList) : Void {
+        writeByte(list.elemType);
+        writeI32(list.size);
+    }
+
+    public function writeListEnd() : Void {}
+
+    public function writeSetBegin(set:TSet) : Void {
+        writeByte(set.elemType);
+        writeI32(set.size);
+    }
+
+    public function writeSetEnd() : Void {}
+
+    public function writeBool(b : Bool) : Void {
+        writeByte(b ? 1 : 0);
+    }
+
+
+    public function writeByte(b : Int) : Void {
+        var out = new BytesOutput();
+        out.bigEndian = true;
+        out.writeByte(b);
+        trans_.write(out.getBytes(), 0, 1);
+    }
+
+    public function writeI16(i16 : Int) : Void {
+        var out = new BytesOutput();
+        out.bigEndian = true;
+        out.writeInt16(i16);
+        trans_.write(out.getBytes(), 0, 2);
+    }
+
+    public function writeI32(i32 : Int) : Void {
+        var out = new BytesOutput();
+        out.bigEndian = true;
+        out.writeInt32(i32);
+        trans_.write(out.getBytes(), 0, 4);
+    }
+
+    public function writeI64(i64 : haxe.Int64) : Void {
+        var out = new BytesOutput();
+        out.bigEndian = true;
+        var hi = Int64.getHigh(i64);
+        var lo = Int64.getLow(i64);
+        out.writeInt32(hi);
+        out.writeInt32(lo);
+        trans_.write(out.getBytes(), 0, 8);
+    }
+
+    public function writeDouble(dub:Float) : Void {
+        var out = new BytesOutput();
+        out.bigEndian = true;
+        out.writeDouble(dub);
+        trans_.write(out.getBytes(), 0, 8);
+    }
+
+    public function writeString(str : String) : Void {
+        var out = new BytesOutput();
+        out.bigEndian = true;
+        out.writeString(str);
+        var bytes = out.getBytes();
+        writeI32( bytes.length);
+        trans_.write( bytes, 0, bytes.length);
+    }
+
+    public function writeBinary(bin:Bytes) : Void {
+        writeI32(bin.length);
+        trans_.write(bin, 0, bin.length);
+    }
+
+    /**
+     * Reading methods.
+     */
+
+    public function readMessageBegin():TMessage {
+        var size : Int = readI32();
+        if (size < 0) {
+            var version : Int = size & VERSION_MASK;
+            if (version != VERSION_1) {
+                throw new TProtocolException(TProtocolException.BAD_VERSION, "Bad version in readMessageBegin");
+            }
+            return new TMessage(readString(), size & 0x000000ff, readI32());
+        } else {
+            if (strictRead_) {
+                throw new TProtocolException(TProtocolException.BAD_VERSION, "Missing version in readMessageBegin, old client?");
+            }
+            return new TMessage(readStringBody(size), readByte(), readI32());
+        }
+    }
+
+    public function readMessageEnd() : Void {}
+
+    public function readStructBegin():TStruct {
+        return ANONYMOUS_STRUCT;
+    }
+
+    public function readStructEnd() : Void {}
+
+    public function readFieldBegin() : TField {
+        var type : Int = readByte();
+        var id : Int = 0;
+        if (type != TType.STOP)
+        {
+            id = readI16();
+        }
+        return new TField("", type, id);
+    }
+
+    public function readFieldEnd() : Void {}
+
+    public function readMapBegin() : TMap {
+        return new TMap(readByte(), readByte(), readI32());
+    }
+
+    public function readMapEnd() : Void {}
+
+    public function readListBegin():TList {
+        return new TList(readByte(), readI32());
+    }
+
+    public function readListEnd() : Void {}
+
+    public function readSetBegin() : TSet {
+      return new TSet(readByte(), readI32());
+    }
+
+    public function readSetEnd() : Void {}
+
+    public function readBool() : Bool {
+        return (readByte() == 1);
+    }
+
+
+    public function readByte() : Int {
+        var buffer = new BytesBuffer();
+        var len = trans_.readAll( buffer, 0, 1);
+        var inp = new BytesInput( buffer.getBytes(), 0, 1);
+        inp.bigEndian = true;
+        return inp.readByte();
+    }
+
+    public function readI16() : Int {
+        var buffer = new BytesBuffer();
+        var len = trans_.readAll( buffer, 0, 2);
+        var inp = new BytesInput( buffer.getBytes(), 0, 2);
+        inp.bigEndian = true;
+        return inp.readInt16();
+    }
+
+    public function readI32() : Int {
+        var buffer = new BytesBuffer();
+        var len = trans_.readAll( buffer, 0, 4);
+        var inp = new BytesInput( buffer.getBytes(), 0, 4);
+        inp.bigEndian = true;
+        return inp.readInt32();
+    }
+
+    public function readI64() : haxe.Int64 {
+        var buffer = new BytesBuffer();
+        var len = trans_.readAll( buffer, 0, 8);
+        var inp = new BytesInput( buffer.getBytes(), 0, 8);
+        inp.bigEndian = true;
+        var hi = inp.readInt32();
+        var lo = inp.readInt32();
+        return Int64.make(hi,lo);
+    }
+
+    public function readDouble():Float {
+        var buffer = new BytesBuffer();
+        var len = trans_.readAll( buffer, 0, 8);
+        var inp = new BytesInput( buffer.getBytes(), 0, 8);
+        inp.bigEndian = true;
+        return inp.readDouble();
+    }
+
+    public function readString() : String {
+        return readStringBody( readI32());
+    }
+
+    public function readStringBody(len : Int) : String {
+        if( len > 0) {
+            var buffer = new BytesBuffer();
+            trans_.readAll( buffer, 0, len);
+            var inp = new BytesInput( buffer.getBytes(), 0, len);
+            inp.bigEndian = true;
+            return inp.readString(len);
+        } else {
+            return "";
+        }
+    }
+
+    public function readBinary() : Bytes {
+        var len : Int = readI32();
+        var buffer = new BytesBuffer();
+        trans_.readAll( buffer, 0, len);
+        return buffer.getBytes();
+    }
 
 }
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocolFactory.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocolFactory.hx b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocolFactory.hx
index 0d7c7c5..f4a9bec 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocolFactory.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocolFactory.hx
@@ -26,20 +26,20 @@ import org.apache.thrift.transport.TTransport;
 * Binary Protocol Factory
 */
 class TBinaryProtocolFactory implements TProtocolFactory {
-	
-	private var strictRead_ : Bool = false;
-	private var strictWrite_ : Bool = true;
-
-	public function new( strictRead : Bool = false, strictWrite : Bool = true) {
-		strictRead_  = strictRead;
-		strictWrite_ = strictWrite;
-	}
-
-	public function getProtocol( trans : TTransport) : TProtocol  {
-		return new TBinaryProtocol( trans, strictRead_, strictWrite_);
-	}
+
+    private var strictRead_ : Bool = false;
+    private var strictWrite_ : Bool = true;
+
+    public function new( strictRead : Bool = false, strictWrite : Bool = true) {
+        strictRead_  = strictRead;
+        strictWrite_ = strictWrite;
+    }
+
+    public function getProtocol( trans : TTransport) : TProtocol  {
+        return new TBinaryProtocol( trans, strictRead_, strictWrite_);
+    }
 }
 
 
 
-	
\ No newline at end of file
+    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/protocol/TField.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TField.hx b/lib/haxe/src/org/apache/thrift/protocol/TField.hx
index 20f3fb9..3f5498d 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TField.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TField.hx
@@ -16,28 +16,28 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package org.apache.thrift.protocol;
-    
+
 class TField {
-    
+
     public var name : String;
     public var type : Int;
     public var id : Int;
-      
+
     public function new(n : String = "", t : Int = 0, i : Int = 0) {
       name = n;
       type = t;
       id = i;
     }
-    
+
     public function toString() : String {
       return '<TField name:"$name" type:"$type" field-id:"$id">';
     }
-    
+
     public function equals( otherField : TField) : Bool {
-      return (type == otherField.type) 
+      return (type == otherField.type)
           && (id == otherField.id);
     }
-  
+
 }


[3/5] thrift git commit: THRIFT-2806 more whitespace fixups Client: Haxe Patch: Jens Geyer

Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TFramedTransport.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TFramedTransport.hx b/lib/haxe/src/org/apache/thrift/transport/TFramedTransport.hx
index 77335e7..5f0168a 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TFramedTransport.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TFramedTransport.hx
@@ -56,86 +56,86 @@ class TFramedTransport extends TTransport
      * Constructor wraps around another transport
      */
     public function new( transport : TTransport, maxLength : Int = DEFAULT_MAX_LENGTH) {
-    	transport_ = transport;
-    	maxLength_ = maxLength;
+        transport_ = transport;
+        maxLength_ = maxLength;
     }
 
     public override function open() : Void {
-    	transport_.open();
+        transport_.open();
     }
 
     public override function isOpen() : Bool {
-    	return transport_.isOpen();
+        return transport_.isOpen();
     }
 
     public override function close() : Void {
-    	transport_.close();
+        transport_.close();
     }
 
     public override function read(buf : BytesBuffer, off : Int, len : Int) : Int {
-		var data = Bytes.alloc(len);
-		
-    	if (readBuffer_ != null) {
-    		var got : Int = readBuffer_.readBytes(data, off, len);
-    		if (got > 0) {
-				buf.addBytes(data,0,got);
-    			return got;
-    		};
-    	};
-		
-    	// Read another frame of data
-    	readFrame();
-
-    	var got = readBuffer_.readBytes(data, off, len);
-		buf.addBytes(data,0,got);
-		return got;
+        var data = Bytes.alloc(len);
+
+        if (readBuffer_ != null) {
+            var got : Int = readBuffer_.readBytes(data, off, len);
+            if (got > 0) {
+                buf.addBytes(data,0,got);
+                return got;
+            };
+        };
+
+        // Read another frame of data
+        readFrame();
+
+        var got = readBuffer_.readBytes(data, off, len);
+        buf.addBytes(data,0,got);
+        return got;
     }
 
 
     function readFrameSize() : Int {
-    	var buffer = new BytesBuffer();
-    	var len = transport_.readAll( buffer, 0, 4);
-    	var inp = new BytesInput( buffer.getBytes(), 0, 4);
-    	inp.bigEndian = true;
-    	return inp.readInt32();
+        var buffer = new BytesBuffer();
+        var len = transport_.readAll( buffer, 0, 4);
+        var inp = new BytesInput( buffer.getBytes(), 0, 4);
+        inp.bigEndian = true;
+        return inp.readInt32();
     }
 
 
     function readFrame() : Void {
-    	var size : Int = readFrameSize();
-		
-    	if (size < 0) {
-    		throw new TTransportException(TTransportException.UNKNOWN, 'Read a negative frame size ($size)!');
-    	};
-    	if (size > maxLength_) {
-    		throw new TTransportException(TTransportException.UNKNOWN, 'Frame size ($size) larger than max length ($maxLength_)!');
-    	};
-
-    	var buffer = new BytesBuffer();
-    	size = transport_.readAll( buffer, 0, size);
-    	readBuffer_ = new BytesInput( buffer.getBytes(), 0, size);
-    	readBuffer_.bigEndian = true;
+        var size : Int = readFrameSize();
+
+        if (size < 0) {
+            throw new TTransportException(TTransportException.UNKNOWN, 'Read a negative frame size ($size)!');
+        };
+        if (size > maxLength_) {
+            throw new TTransportException(TTransportException.UNKNOWN, 'Frame size ($size) larger than max length ($maxLength_)!');
+        };
+
+        var buffer = new BytesBuffer();
+        size = transport_.readAll( buffer, 0, size);
+        readBuffer_ = new BytesInput( buffer.getBytes(), 0, size);
+        readBuffer_.bigEndian = true;
     }
 
     public override function write(buf : Bytes, off : Int, len : Int) : Void {
-    	writeBuffer_.writeBytes(buf, off, len);
+        writeBuffer_.writeBytes(buf, off, len);
     }
 
     function writeFrameSize(len : Int) : Void {
-		var out = new BytesOutput();
-		out.bigEndian = true;
-		out.writeInt32(len);
-		transport_.write(out.getBytes(), 0, 4);
+        var out = new BytesOutput();
+        out.bigEndian = true;
+        out.writeInt32(len);
+        transport_.write(out.getBytes(), 0, 4);
     }
 
     public override function flush( callback : Dynamic->Void =null) : Void {
-    	var buf : Bytes = writeBuffer_.getBytes();
-    	var len : Int = buf.length;
-    	writeBuffer_ = new BytesOutput();
+        var buf : Bytes = writeBuffer_.getBytes();
+        var len : Int = buf.length;
+        writeBuffer_ = new BytesOutput();
 
-		writeFrameSize(len);
-    	transport_.write(buf, 0, len);
-    	transport_.flush();
+        writeFrameSize(len);
+        transport_.write(buf, 0, len);
+        transport_.flush();
     }
 }
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TFramedTransportFactory.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TFramedTransportFactory.hx b/lib/haxe/src/org/apache/thrift/transport/TFramedTransportFactory.hx
index 3cca1f8..8d45a64 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TFramedTransportFactory.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TFramedTransportFactory.hx
@@ -27,11 +27,11 @@ class TFramedTransportFactory extends TTransportFactory {
     var maxLength_ : Int;
 
     public function new(maxLength : Int = TFramedTransport.DEFAULT_MAX_LENGTH) {
-		super();
-    	maxLength_ = maxLength;
+        super();
+        maxLength_ = maxLength;
     }
 
     public override function getTransport(base : TTransport) : TTransport {
-    	return new TFramedTransport(base, maxLength_);
+        return new TFramedTransport(base, maxLength_);
     }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx b/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx
index 4e898f8..3cd2e51 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx
@@ -73,15 +73,15 @@ import flash.events.EventDispatcher;
             socket.close()
         }
 
-    	public override function peek()  :  Bool
-    	{
-			if(socket.connected)
-			{
-				trace("Bytes remained:" + socket.bytesAvailable);
-				return socket.bytesAvailable>0;
-			}
-			return false;
-		}
+        public override function peek()  :  Bool
+        {
+            if(socket.connected)
+            {
+                trace("Bytes remained:" + socket.bytesAvailable);
+                return socket.bytesAvailable>0;
+            }
+            return false;
+        }
 
         public override function read(buf : Bytes, off  :  Int, len  :  Int)  :  Int
         {
@@ -137,11 +137,11 @@ import flash.events.EventDispatcher;
                 trace(e);
                 throw new TTransportException(TTransportException.UNKNOWN, "No more data available.");
             }
-			catch (e : TException)
-			{
-				trace('TException $e');
-				throw e;
-			}
+            catch (e : TException)
+            {
+                trace('TException $e');
+                throw e;
+            }
             catch (e : Error)
             {
                 trace(e);
@@ -217,7 +217,7 @@ import flash.events.EventDispatcher;
 
         public function socketDataHandler(event : ProgressEvent)  :  Void
         {
-        	trace("Got Data call:" +ioCallback);
+            trace("Got Data call:" +ioCallback);
             if (ioCallback != null)
             {
                 ioCallback(null);

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/THttpClient.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/THttpClient.hx b/lib/haxe/src/org/apache/thrift/transport/THttpClient.hx
index 52a9d26..79f8661 100644
--- a/lib/haxe/src/org/apache/thrift/transport/THttpClient.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/THttpClient.hx
@@ -19,7 +19,7 @@
 
 package org.apache.thrift.transport;
 
-	
+
 import haxe.io.Bytes;
 import haxe.io.BytesBuffer;
 import haxe.io.BytesOutput;
@@ -28,76 +28,76 @@ import haxe.io.BytesInput;
 import haxe.Http;
 
 
-	
+
 /**
 * HTTP implementation of the TTransport interface. Used for working with a
 * Thrift web services implementation.
 */
-	
+
 class THttpClient extends TTransport {
 
     private var requestBuffer_  : BytesOutput = new BytesOutput();
     private var responseBuffer_ : BytesInput = null;
 
-	private var request_        : Http = null;
+    private var request_        : Http = null;
+
 
-    
-	public function new( requestUrl : String) : Void {
-	  	request_ = new Http(requestUrl);
-		request_.addHeader( "contentType", "application/x-thrift");
+    public function new( requestUrl : String) : Void {
+          request_ = new Http(requestUrl);
+        request_.addHeader( "contentType", "application/x-thrift");
     }
-    
-   
+
+
     public override function open() : Void {
     }
 
     public override function close() : Void {
     }
- 
+
     public override function isOpen() : Bool {
       return true;
     }
-    
+
     public override function read(buf:BytesBuffer, off : Int, len : Int) : Int {
-		if (responseBuffer_ == null) {
-        	throw new TTransportException(TTransportException.UNKNOWN, "Response buffer is empty, no request.");
-		}
-		
+        if (responseBuffer_ == null) {
+            throw new TTransportException(TTransportException.UNKNOWN, "Response buffer is empty, no request.");
+        }
+
         var data =Bytes.alloc(len);
-		len = responseBuffer_.readBytes(data, off, len);
-		buf.addBytes(data,0,len);
-		return len;
+        len = responseBuffer_.readBytes(data, off, len);
+        buf.addBytes(data,0,len);
+        return len;
     }
 
     public override function write(buf:Bytes, off : Int, len : Int) : Void {
       requestBuffer_.writeBytes(buf, off, len);
     }
 
-	
+
     public override function flush(callback:Dynamic->Void = null) : Void {
-		var buffer = requestBuffer_;
-		requestBuffer_ = new BytesOutput();
-		responseBuffer_ = null;
-			
-		request_.onData = function(data : String) { 
-			var tmp = new BytesBuffer();
-			tmp.addString(data);
-			responseBuffer_ = new BytesInput(tmp.getBytes());
-			if( callback != null) {
-				callback(null);
-			}
-		};
-		
-		request_.onError = function(msg : String) {
-			if( callback != null) {
-				callback(new TTransportException(TTransportException.UNKNOWN, "IOError: " + msg));
-			}
-		};
-		
-		request_.setPostData(buffer.getBytes().toString());
-		request_.request(true/*POST*/);
+        var buffer = requestBuffer_;
+        requestBuffer_ = new BytesOutput();
+        responseBuffer_ = null;
+
+        request_.onData = function(data : String) {
+            var tmp = new BytesBuffer();
+            tmp.addString(data);
+            responseBuffer_ = new BytesInput(tmp.getBytes());
+            if( callback != null) {
+                callback(null);
+            }
+        };
+
+        request_.onError = function(msg : String) {
+            if( callback != null) {
+                callback(new TTransportException(TTransportException.UNKNOWN, "IOError: " + msg));
+            }
+        };
+
+        request_.setPostData(buffer.getBytes().toString());
+        request_.request(true/*POST*/);
     }
-		
+
 }
 
-	
\ No newline at end of file
+    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx b/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx
index 0eae931..f38b584 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx
@@ -19,7 +19,7 @@
 
 package org.apache.thrift.transport;
 
-import haxe.remoting.SocketProtocol;	
+import haxe.remoting.SocketProtocol;
 import haxe.io.Bytes;
 import haxe.io.BytesBuffer;
 import haxe.io.BytesInput;
@@ -29,104 +29,104 @@ import haxe.io.Output;
 import haxe.io.Eof;
 
 //import flash.net.ServerSocket; - not yet available on Haxe 3.1.3
-#if ! (flash || html5) 
-	
+#if ! (flash || html5)
+
 import sys.net.Host;
 
 
 class TServerSocket extends TServerTransport {
 
-	// Underlying server with socket
-	private var _socket : Socket= null;
-
-	// Port to listen on
-	private var _port : Int = 0;
-
-	// Timeout for client sockets from accept
-	private var _clientTimeout : Int = 0;
-
-	// Whether or not to wrap new TSocket connections in buffers
-	private var _useBufferedSockets : Bool = false;
-
-	
-	public function new( port : Int, clientTimeout : Int = 0, useBufferedSockets : Bool = false)
-	{
-		_port = port;
-		_clientTimeout = clientTimeout;
-		_useBufferedSockets = useBufferedSockets;
-
-		try
-		{
-			_socket = new Socket();
-			_socket.bind( new Host('localhost'), port);
-		}
-		catch (e : Dynamic)
-		{
-			_socket = null;
-			throw new TTransportException( TTransportException.UNKNOWN, 'Could not create ServerSocket on port $port: $e');
-		}
-	}
-
-
-	public override function Listen() : Void
-	{
-		// Make sure not to block on accept
-		if (_socket != null)	{
-			try
-			{
-				_socket.listen(1);
-			}
-			catch (e : Dynamic)
-			{
-				trace('Error $e');
-				throw new TTransportException( TTransportException.UNKNOWN, 'Could not accept on listening socket: $e');
-			}
-		}
-	}
-
-	private override function AcceptImpl() : TTransport
-	{
-		if (_socket == null) {
-			throw new TTransportException( TTransportException.NOT_OPEN, "No underlying server socket.");
-		}
-		
-		try
-		{
-			var accepted = _socket.accept();
-			var result = TSocket.fromSocket(accepted);
-			accepted.setTimeout( _clientTimeout);
-
-			if( _useBufferedSockets)
-			{
-				throw "buffered transport not yet supported";  // TODO
-				//result = new TBufferedTransport(result);
-			}
-
-			return result;
-		}
-		catch (e : Dynamic)
-		{
-			trace('Error $e');
-			throw new TTransportException( TTransportException.UNKNOWN, '$e');
-		}
-	}
-
-	public override function Close() : Void
-	{
-		if (_socket != null)
-		{
-			try
-			{
-				_socket.close();
-			}
-			catch (e : Dynamic)
-			{
-				trace('Error $e');
-				throw new TTransportException( TTransportException.UNKNOWN, 'WARNING: Could not close server socket: $e');
-			}
-			_socket = null;
-		}
-	}
+    // Underlying server with socket
+    private var _socket : Socket= null;
+
+    // Port to listen on
+    private var _port : Int = 0;
+
+    // Timeout for client sockets from accept
+    private var _clientTimeout : Int = 0;
+
+    // Whether or not to wrap new TSocket connections in buffers
+    private var _useBufferedSockets : Bool = false;
+
+
+    public function new( port : Int, clientTimeout : Int = 0, useBufferedSockets : Bool = false)
+    {
+        _port = port;
+        _clientTimeout = clientTimeout;
+        _useBufferedSockets = useBufferedSockets;
+
+        try
+        {
+            _socket = new Socket();
+            _socket.bind( new Host('localhost'), port);
+        }
+        catch (e : Dynamic)
+        {
+            _socket = null;
+            throw new TTransportException( TTransportException.UNKNOWN, 'Could not create ServerSocket on port $port: $e');
+        }
+    }
+
+
+    public override function Listen() : Void
+    {
+        // Make sure not to block on accept
+        if (_socket != null)    {
+            try
+            {
+                _socket.listen(1);
+            }
+            catch (e : Dynamic)
+            {
+                trace('Error $e');
+                throw new TTransportException( TTransportException.UNKNOWN, 'Could not accept on listening socket: $e');
+            }
+        }
+    }
+
+    private override function AcceptImpl() : TTransport
+    {
+        if (_socket == null) {
+            throw new TTransportException( TTransportException.NOT_OPEN, "No underlying server socket.");
+        }
+
+        try
+        {
+            var accepted = _socket.accept();
+            var result = TSocket.fromSocket(accepted);
+            accepted.setTimeout( _clientTimeout);
+
+            if( _useBufferedSockets)
+            {
+                throw "buffered transport not yet supported";  // TODO
+                //result = new TBufferedTransport(result);
+            }
+
+            return result;
+        }
+        catch (e : Dynamic)
+        {
+            trace('Error $e');
+            throw new TTransportException( TTransportException.UNKNOWN, '$e');
+        }
+    }
+
+    public override function Close() : Void
+    {
+        if (_socket != null)
+        {
+            try
+            {
+                _socket.close();
+            }
+            catch (e : Dynamic)
+            {
+                trace('Error $e');
+                throw new TTransportException( TTransportException.UNKNOWN, 'WARNING: Could not close server socket: $e');
+            }
+            _socket = null;
+        }
+    }
 }
 
 #end

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TServerTransport.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TServerTransport.hx b/lib/haxe/src/org/apache/thrift/transport/TServerTransport.hx
index 5819803..2189981 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TServerTransport.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TServerTransport.hx
@@ -21,23 +21,23 @@ package org.apache.thrift.transport;
 
 class TServerTransport {
 
-	public function Accept() : TTransport {
-		var transport = AcceptImpl();
-		if (transport == null) {
-		  throw new TTransportException( TTransportException.UNKNOWN, "accept() may not return NULL");
-		}
-		return transport;
-	}
-	
-	public function Listen() : Void {
-		throw new AbstractMethodError();
-	}
-	
-	public function Close() : Void {
-		throw new AbstractMethodError();
-	}
-	
-	private function AcceptImpl() : TTransport {
-		throw new AbstractMethodError();
-	}
+    public function Accept() : TTransport {
+        var transport = AcceptImpl();
+        if (transport == null) {
+          throw new TTransportException( TTransportException.UNKNOWN, "accept() may not return NULL");
+        }
+        return transport;
+    }
+
+    public function Listen() : Void {
+        throw new AbstractMethodError();
+    }
+
+    public function Close() : Void {
+        throw new AbstractMethodError();
+    }
+
+    private function AcceptImpl() : TTransport {
+        throw new AbstractMethodError();
+    }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TSocket.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TSocket.hx b/lib/haxe/src/org/apache/thrift/transport/TSocket.hx
index 306730d..9d5e2dc 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TSocket.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TSocket.hx
@@ -24,7 +24,7 @@ import flash.net.Socket;
 #elseif js
 import js.html.WebSocket;
 #else
-import haxe.remoting.SocketProtocol;	
+import haxe.remoting.SocketProtocol;
 #end
 
 import haxe.io.Bytes;
@@ -47,250 +47,250 @@ import sys.net.Host;
    */
 
 class TSocket extends TTransport  {
-	
+
     #if (flash || js)
-	private var host  :  String;
-	#else
-	private var host  :  Host;
-	#end
-	
+    private var host  :  String;
+    #else
+    private var host  :  Host;
+    #end
+
     private var port  :  Int;
 
-	#if js
+    #if js
     private var socket : WebSocket = null;
-	#else
+    #else
     private var socket : Socket = null;
-	#end
+    #end
 
-	#if js
+    #if js
     private var input : Dynamic = null;
     private var output : WebSocket = null;
-	#elseif flash
+    #elseif flash
     private var input : Socket = null;
     private var output : Socket = null;
-	#else 
-	private var input : Input = null;
+    #else
+    private var input : Input = null;
     private var output : Output = null;
-	#end
+    #end
 
-	private var obuffer : BytesOutput = new BytesOutput();
+    private var obuffer : BytesOutput = new BytesOutput();
     private var ioCallback : TException->Void = null;
-	private var readCount : Int = 0;
-	
+    private var readCount : Int = 0;
+
     public function new(host : String, port  :  Int)  :  Void  {
-		#if (flash || js)
-		this.host = host;
-		#else
-		this.host = new Host(host);
-		#end
-		this.port = port;
+        #if (flash || js)
+        this.host = host;
+        #else
+        this.host = new Host(host);
+        #end
+        this.port = port;
     }
 
-	#if ! (flash || js)
-	// used by TSocketServer
+    #if ! (flash || js)
+    // used by TSocketServer
     public static function fromSocket( socket : Socket) : TSocket  {
-		var result = new TSocket("",0);
-		result.assignSocket(socket);
-		return result;
+        var result = new TSocket("",0);
+        result.assignSocket(socket);
+        return result;
     }
-	#end
+    #end
 
     public override function close()  :  Void  {
-		input = null;
-		output = null;
-		socket.close();
+        input = null;
+        output = null;
+        socket.close();
     }
 
     public override function peek()  :  Bool  {
-		if( (input == null) || (socket == null)) {
-			return false;
-		} else {
-			#if flash 
-			return (input.bytesAvailable > 0);
-			#elseif js
-			return true;
-			#else
-			var ready = Socket.select( [socket], null, null, 0);
-			return (ready.read.length > 0);
-			#end
-		}
+        if( (input == null) || (socket == null)) {
+            return false;
+        } else {
+            #if flash
+            return (input.bytesAvailable > 0);
+            #elseif js
+            return true;
+            #else
+            var ready = Socket.select( [socket], null, null, 0);
+            return (ready.read.length > 0);
+            #end
+        }
     }
 
-	
-	public override function read( buf : BytesBuffer, off : Int, len : Int) : Int   {
-		try
-		{
-			#if flash
-
-			var remaining = len;	
-			while( remaining > 0) {
-				buf.addByte( input.readByte());
-				--remaining;
-			}
-			return len;
-			
-			#elseif js
-			
-			if( input == null) {
-				throw new TTransportException(TTransportException.UNKNOWN, "Still no data ");  // don't block
-			}
-			var nr = len;	
-			while( nr < len) {
-				buf.addByte( input.get(off+nr));
-				++nr;
-			}
-			return len;
-			
-			#else
-			
-			socket.waitForRead();
-			if(readCount < off) {
-				input.read(off-readCount);	
-				readCount = off;
-			}
-			var data = input.read(len);
-			readCount += data.length;
-			buf.add(data);
-			return data.length;
-			
-			#end
-		}
-		catch (e : Eof)
-		{
-			trace('Eof $e');
-			throw new TTransportException(TTransportException.END_OF_FILE, "No more data available.");
-		}
-		catch (e : TException)
-		{
-			trace('TException $e');
-			throw e;
-		}
-		catch (e : Dynamic)
-		{
-			trace('Error $e');
-			throw new TTransportException(TTransportException.UNKNOWN, 'Bad IO error : $e');
-		}
+
+    public override function read( buf : BytesBuffer, off : Int, len : Int) : Int   {
+        try
+        {
+            #if flash
+
+            var remaining = len;
+            while( remaining > 0) {
+                buf.addByte( input.readByte());
+                --remaining;
+            }
+            return len;
+
+            #elseif js
+
+            if( input == null) {
+                throw new TTransportException(TTransportException.UNKNOWN, "Still no data ");  // don't block
+            }
+            var nr = len;
+            while( nr < len) {
+                buf.addByte( input.get(off+nr));
+                ++nr;
+            }
+            return len;
+
+            #else
+
+            socket.waitForRead();
+            if(readCount < off) {
+                input.read(off-readCount);
+                readCount = off;
+            }
+            var data = input.read(len);
+            readCount += data.length;
+            buf.add(data);
+            return data.length;
+
+            #end
+        }
+        catch (e : Eof)
+        {
+            trace('Eof $e');
+            throw new TTransportException(TTransportException.END_OF_FILE, "No more data available.");
+        }
+        catch (e : TException)
+        {
+            trace('TException $e');
+            throw e;
+        }
+        catch (e : Dynamic)
+        {
+            trace('Error $e');
+            throw new TTransportException(TTransportException.UNKNOWN, 'Bad IO error : $e');
+        }
     }
-		
-	
+
+
     public override function write(buf : Bytes, off  :  Int, len  :  Int)  :  Void
     {
-		obuffer.writeBytes(buf, off, len);
+        obuffer.writeBytes(buf, off, len);
     }
 
 
-		
+
     public override function flush(callback : Dynamic->Void = null)  :  Void
     {
-		if( ! isOpen())
-		{
-			throw new TTransportException(TTransportException.NOT_OPEN, "Transport not open");
-		}
-
-		#if flash
-			
-		var bytes = new flash.utils.ByteArray();
-		var data = obuffer.getBytes();
-		var len = 0;
-		while( len < data.length) {
-			bytes.writeByte(data.get(len));
-			++len;
-		}
-
-		#elseif js
-		
-		var data = obuffer.getBytes();
-		var outbuf = new js.html.Int8Array(data.length);
-		var len = 0;
-		while( len < data.length) {
-			outbuf.set( [data.get(len)], len);
-			++len;
-		}
-		var bytes = outbuf.buffer;
-		
-
-		#else
-		
-		var bytes = obuffer.getBytes();
-		var len = bytes.length;
-		
-		#end
-			
-		obuffer = new BytesOutput();
-
-		
-		ioCallback = callback;
-		try {
-			readCount = 0;
-			#if js
-			output.send( bytes);
-			#else
-			output.writeBytes( bytes, 0, bytes.length);
-			#end
-			if(ioCallback != null) {
-				ioCallback(null);  // success call 
-			}
-		}
-		catch (e : TException)
-		{
-			trace('TException $e');
-			if(ioCallback != null) {
-				ioCallback(e);
-			}
-		}
-		catch (e : Dynamic) {
-			trace(e);
-			if(ioCallback != null) {
-				ioCallback(new TTransportException(TTransportException.UNKNOWN, 'Bad IO error : $e'));
-			}
-		}
+        if( ! isOpen())
+        {
+            throw new TTransportException(TTransportException.NOT_OPEN, "Transport not open");
+        }
+
+        #if flash
+
+        var bytes = new flash.utils.ByteArray();
+        var data = obuffer.getBytes();
+        var len = 0;
+        while( len < data.length) {
+            bytes.writeByte(data.get(len));
+            ++len;
+        }
+
+        #elseif js
+
+        var data = obuffer.getBytes();
+        var outbuf = new js.html.Int8Array(data.length);
+        var len = 0;
+        while( len < data.length) {
+            outbuf.set( [data.get(len)], len);
+            ++len;
+        }
+        var bytes = outbuf.buffer;
+
+
+        #else
+
+        var bytes = obuffer.getBytes();
+        var len = bytes.length;
+
+        #end
+
+        obuffer = new BytesOutput();
+
+
+        ioCallback = callback;
+        try {
+            readCount = 0;
+            #if js
+            output.send( bytes);
+            #else
+            output.writeBytes( bytes, 0, bytes.length);
+            #end
+            if(ioCallback != null) {
+                ioCallback(null);  // success call
+            }
+        }
+        catch (e : TException)
+        {
+            trace('TException $e');
+            if(ioCallback != null) {
+                ioCallback(e);
+            }
+        }
+        catch (e : Dynamic) {
+            trace(e);
+            if(ioCallback != null) {
+                ioCallback(new TTransportException(TTransportException.UNKNOWN, 'Bad IO error : $e'));
+            }
+        }
     }
 
     public override function isOpen()  :  Bool
     {
-		return (socket != null);
+        return (socket != null);
     }
 
     public override function open()  :  Void
     {
-		#if js
-		var socket = new WebSocket();
-		socket.onmessage = function( event : js.html.MessageEvent) {
-			this.input = event.data;
-		}
-		
-		#elseif flash
-			
-		var socket = new Socket();
-		socket.connect(host, port);
-
-		#else
-			
-		var socket = new Socket();
-		socket.setBlocking(true);
-		socket.setFastSend(true);
-		socket.connect(host, port);
-
-		#end
-			
-		assignSocket( socket);
+        #if js
+        var socket = new WebSocket();
+        socket.onmessage = function( event : js.html.MessageEvent) {
+            this.input = event.data;
+        }
+
+        #elseif flash
+
+        var socket = new Socket();
+        socket.connect(host, port);
+
+        #else
+
+        var socket = new Socket();
+        socket.setBlocking(true);
+        socket.setFastSend(true);
+        socket.connect(host, port);
+
+        #end
+
+        assignSocket( socket);
     }
 
-	#if js
-	private function assignSocket( socket : WebSocket)  :  Void
-	#else
-	private function assignSocket( socket : Socket)  :  Void
-	#end
+    #if js
+    private function assignSocket( socket : WebSocket)  :  Void
+    #else
+    private function assignSocket( socket : Socket)  :  Void
+    #end
     {
-		this.socket = socket;
-		
-		#if (flash || js)
-		output = socket;
-      	input = socket;
-		#else
-      	output = socket.output;
-      	input = socket.input;
-		#end
+        this.socket = socket;
+
+        #if (flash || js)
+        output = socket;
+          input = socket;
+        #else
+          output = socket.output;
+          input = socket.input;
+        #end
     }
 
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TStream.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TStream.hx b/lib/haxe/src/org/apache/thrift/transport/TStream.hx
index 0e1b52d..50b3ed3 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TStream.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TStream.hx
@@ -24,9 +24,9 @@ import haxe.io.BytesBuffer;
 
 
 interface TStream {
-	function Close() : Void;
-	function Peek() : Bool;
-	function Read( buf : Bytes, offset : Int, count : Int) : Int;
-	function Write( buf : Bytes, offset : Int, count : Int) : Void;
-	function Flush() : Void;
+    function Close() : Void;
+    function Peek() : Bool;
+    function Read( buf : Bytes, offset : Int, count : Int) : Int;
+    function Write( buf : Bytes, offset : Int, count : Int) : Void;
+    function Flush() : Void;
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TStreamTransport.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TStreamTransport.hx b/lib/haxe/src/org/apache/thrift/transport/TStreamTransport.hx
index 99203b4..31a7c14 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TStreamTransport.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TStreamTransport.hx
@@ -29,75 +29,75 @@ import haxe.io.BytesInput;
 
 
 class TStreamTransport extends TTransport {
-	
-	public var InputStream(default,null) : TStream;
-	public var OutputStream(default,null) : TStream;
-
-
-	public function new( input : TStream, output : TStream) {
-		this.InputStream = input;
-		this.OutputStream = output;
-	}
-	
-	public override function isOpen() : Bool {
-		return true;
-	}
-	
+
+    public var InputStream(default,null) : TStream;
+    public var OutputStream(default,null) : TStream;
+
+
+    public function new( input : TStream, output : TStream) {
+        this.InputStream = input;
+        this.OutputStream = output;
+    }
+
+    public override function isOpen() : Bool {
+        return true;
+    }
+
     public override function peek() : Bool {
-		return (InputStream != null);
-	}
+        return (InputStream != null);
+    }
 
     public override function open() : Void {
-	}
-
-	public override function close() : Void {
-		if (InputStream != null)
-		{
-			InputStream.Close();
-			InputStream = null;
-		}
-		if (OutputStream != null)
-		{
-			OutputStream.Close();
-			OutputStream = null;
-		}
-	}
-
-	public override function read( buf : BytesBuffer, off : Int, len : Int) : Int {
-		if (InputStream == null)
-		{
-			throw new TTransportException( TTransportException.NOT_OPEN, 
-								  		   "Cannot read from null InputStream");
-		}
-
-		var data : Bytes =  Bytes.alloc(len);
-		var size = InputStream.Read( data, off, len);
-		buf.addBytes( data, 0, size);
-		return size;
-	}
+    }
+
+    public override function close() : Void {
+        if (InputStream != null)
+        {
+            InputStream.Close();
+            InputStream = null;
+        }
+        if (OutputStream != null)
+        {
+            OutputStream.Close();
+            OutputStream = null;
+        }
+    }
+
+    public override function read( buf : BytesBuffer, off : Int, len : Int) : Int {
+        if (InputStream == null)
+        {
+            throw new TTransportException( TTransportException.NOT_OPEN,
+                                             "Cannot read from null InputStream");
+        }
+
+        var data : Bytes =  Bytes.alloc(len);
+        var size = InputStream.Read( data, off, len);
+        buf.addBytes( data, 0, size);
+        return size;
+    }
 
     public override function write(buf:Bytes, off : Int, len : Int) : Void {
-		if (OutputStream == null)
-		{
-			throw new TTransportException( TTransportException.NOT_OPEN, 
-										   "Cannot write to null OutputStream");
-		}
+        if (OutputStream == null)
+        {
+            throw new TTransportException( TTransportException.NOT_OPEN,
+                                           "Cannot write to null OutputStream");
+        }
 
-		OutputStream.Write(buf, off, len);
-	}
+        OutputStream.Write(buf, off, len);
+    }
 
     public override function flush(callback:Dynamic->Void =null) : Void {
-		if (OutputStream == null)
-		{
-			var err = new TTransportException( TTransportException.NOT_OPEN,
-											   "Cannot flush null OutputStream");
-	    	if(callback != null)
-				callback(err);
-			else
-				throw err;
-		}
-
-		OutputStream.Flush();
-	}
+        if (OutputStream == null)
+        {
+            var err = new TTransportException( TTransportException.NOT_OPEN,
+                                               "Cannot flush null OutputStream");
+            if(callback != null)
+                callback(err);
+            else
+                throw err;
+        }
+
+        OutputStream.Flush();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TTransport.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TTransport.hx b/lib/haxe/src/org/apache/thrift/transport/TTransport.hx
index 35303d5..4a3bd90 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TTransport.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TTransport.hx
@@ -22,7 +22,7 @@ package org.apache.thrift.transport;
 import haxe.io.Bytes;
 import haxe.io.BytesBuffer;
 import org.apache.thrift.AbstractMethodError;
-  
+
 class TTransport {
 
     /**
@@ -31,16 +31,16 @@ class TTransport {
      * @return True if the transport is open.
      */
     public function isOpen() : Bool {
-      	throw new AbstractMethodError();
+          throw new AbstractMethodError();
     }
-    
+
     /**
      * Is there more data to be read?
      *
      * @return True if the remote side is still alive and feeding us
      */
     public function peek() : Bool {
-      	return isOpen();
+          return isOpen();
     }
 
     /**
@@ -49,14 +49,14 @@ class TTransport {
      * @throws TTransportException if the transport could not be opened
      */
     public function open() : Void {
-      	throw new AbstractMethodError();
+          throw new AbstractMethodError();
     }
 
     /**
      * Closes the transport.
      */
     public function close() : Void {
-      	throw new AbstractMethodError();
+          throw new AbstractMethodError();
     };
 
     /**
@@ -69,7 +69,7 @@ class TTransport {
      * @throws TTransportException if there was an error reading data
      */
      public function read( buf : BytesBuffer, off : Int, len : Int) : Int {
-      	throw new AbstractMethodError();
+          throw new AbstractMethodError();
      }
 
     /**
@@ -82,14 +82,14 @@ class TTransport {
      * @throws TTransportException if there was an error reading data
      */
     public function readAll(buf : BytesBuffer, off : Int, len : Int) : Int {
-		var got : Int = 0;
-		var ret : Int = 0;
+        var got : Int = 0;
+        var ret : Int = 0;
         while (got < len) {
             ret = read(buf, off+got, len-got);
             if (ret <= 0) {
-              throw new TTransportException(TTransportException.UNKNOWN, 
-										"Cannot read. Remote side has closed. Tried to read " 
-										+ len + " bytes, but only got " + got + " bytes.");
+              throw new TTransportException(TTransportException.UNKNOWN,
+                                        "Cannot read. Remote side has closed. Tried to read "
+                                        + len + " bytes, but only got " + got + " bytes.");
             }
             got += ret;
         }
@@ -103,7 +103,7 @@ class TTransport {
      * @throws TTransportException if an error occurs writing data
      */
     public function writeAll(buf:Bytes) : Void {
-		write(buf, 0, buf.length);
+        write(buf, 0, buf.length);
     }
 
     /**
@@ -115,7 +115,7 @@ class TTransport {
      * @throws TTransportException if there was an error writing data
      */
     public function write(buf:Bytes, off : Int, len : Int) : Void {
-    	throw new AbstractMethodError();
+        throw new AbstractMethodError();
     }
 
     /**
@@ -124,10 +124,10 @@ class TTransport {
      * @throws TTransportException if there was an error writing out data.
      */
     public function flush(callback:Dynamic->Void =null) : Void {
-    	if(callback != null)
-			callback(new AbstractMethodError());
-		else
-			throw new AbstractMethodError();
+        if(callback != null)
+            callback(new AbstractMethodError());
+        else
+            throw new AbstractMethodError();
     }
- 
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx b/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx
index 3db6456..f930c52 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx
@@ -16,21 +16,22 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 package org.apache.thrift.transport;
-  
+
 import org.apache.thrift.TException;
 
 class TTransportException extends TException {
-    
+
     public static inline var UNKNOWN : Int = 0;
     public static inline var NOT_OPEN : Int = 1;
     public static inline var ALREADY_OPEN : Int = 2;
     public static inline var TIMED_OUT : Int = 3;
     public static inline var END_OF_FILE : Int = 4;
-  
+
     public function new(error : Int = UNKNOWN, message : String = "") {
-		super(message, error);
+        super(message, error);
     }
-    
+
 }
+ 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/src/org/apache/thrift/transport/TTransportFactory.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TTransportFactory.hx b/lib/haxe/src/org/apache/thrift/transport/TTransportFactory.hx
index f20321f..361f35f 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TTransportFactory.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TTransportFactory.hx
@@ -28,17 +28,17 @@ package org.apache.thrift.transport;
  */
 class TTransportFactory {
 
-	public function new() {
-	}
+    public function new() {
+    }
 
-	/**
-	* Return a wrapped instance of the base Transport.
-	*
-	* @param trans The base transport
-	* @return Wrapped Transport
-	*/
-	public function getTransport( trans : TTransport) : TTransport {
-		return trans;
-	}
+    /**
+    * Return a wrapped instance of the base Transport.
+    *
+    * @param trans The base transport
+    * @return Wrapped Transport
+    */
+    public function getTransport( trans : TTransport) : TTransport {
+        return trans;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/test/src/Main.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/test/src/Main.hx b/lib/haxe/test/src/Main.hx
index fff8be5..da0a7f5 100644
--- a/lib/haxe/test/src/Main.hx
+++ b/lib/haxe/test/src/Main.hx
@@ -31,15 +31,15 @@ class Main
 {
     static public function main()
     {
-		try
-		{
-        	StreamTest.Run();
-			
-			trace("All tests completed.");
-		}
-		catch( e: Dynamic)
-		{
-			trace('$e');
-		}
-	}
+        try
+        {
+            StreamTest.Run();
+
+            trace("All tests completed.");
+        }
+        catch( e: Dynamic)
+        {
+            trace('$e');
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/test/src/StreamTest.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/test/src/StreamTest.hx b/lib/haxe/test/src/StreamTest.hx
index b28c8e9..7500eee 100644
--- a/lib/haxe/test/src/StreamTest.hx
+++ b/lib/haxe/test/src/StreamTest.hx
@@ -31,62 +31,62 @@ import thrift.test.*;  // generated code
 
 
 class StreamTest extends TestBase {
-	
-
-	private inline static var tmpfile : String = "bin/data.tmp";
-	
-
-	private static function Expect( expr : Bool, info : String, ?pos : haxe.PosInfos) : Void {
-		if( ! expr) {
-			throw ('Test "$info" failed at '+pos.methodName+' in '+pos.fileName+':'+pos.lineNumber);
-		}			
-	}
-	
-	private static function MakeTestData() : Xtruct {
-		var data : Xtruct = new Xtruct();
-		data.string_thing = "Streamtest";
-		data.byte_thing = -128;
-		data.i32_thing = 4711;
-		data.i64_thing = Int64.make(0x12345678,0x9ABCDEF0);
-		return data;
-	}
-	
-	public static function WriteData() : Xtruct
-	{
-		var stream : TStream = new TFileStream( tmpfile, CreateNew);
-		var trans : TTransport = new TStreamTransport( null, stream);
-		var prot = new TJSONProtocol( trans);
-
-		var data = MakeTestData();	
-		data.write(prot);
-		trans.close();
-		
-		return data;
-	}
-	
-	public static function ReadData() : Xtruct
-	{
-		var stream : TStream = new TFileStream( tmpfile, Read);
-		var trans : TTransport = new TStreamTransport( stream, null);
-		var prot = new TJSONProtocol( trans);
-
-		var data : Xtruct = new Xtruct();
-		data.read(prot);
-		trans.close();
-		
-		return data;
-	}
-	
-	public static override function Run() : Void
-	{
-		var written = WriteData();
-		var read = ReadData();
-
-		Expect( read.string_thing == written.string_thing, "string data");
-		Expect( read.byte_thing == written.byte_thing, "byte data");
-		Expect( read.i32_thing == written.i32_thing, "i32 data");
-		Expect( Int64.compare( read.i64_thing, written.i64_thing) == 0, "i64 data");
-	}
+
+
+    private inline static var tmpfile : String = "bin/data.tmp";
+
+
+    private static function Expect( expr : Bool, info : String, ?pos : haxe.PosInfos) : Void {
+        if( ! expr) {
+            throw ('Test "$info" failed at '+pos.methodName+' in '+pos.fileName+':'+pos.lineNumber);
+        }
+    }
+
+    private static function MakeTestData() : Xtruct {
+        var data : Xtruct = new Xtruct();
+        data.string_thing = "Streamtest";
+        data.byte_thing = -128;
+        data.i32_thing = 4711;
+        data.i64_thing = Int64.make(0x12345678,0x9ABCDEF0);
+        return data;
+    }
+
+    public static function WriteData() : Xtruct
+    {
+        var stream : TStream = new TFileStream( tmpfile, CreateNew);
+        var trans : TTransport = new TStreamTransport( null, stream);
+        var prot = new TJSONProtocol( trans);
+
+        var data = MakeTestData();
+        data.write(prot);
+        trans.close();
+
+        return data;
+    }
+
+    public static function ReadData() : Xtruct
+    {
+        var stream : TStream = new TFileStream( tmpfile, Read);
+        var trans : TTransport = new TStreamTransport( stream, null);
+        var prot = new TJSONProtocol( trans);
+
+        var data : Xtruct = new Xtruct();
+        data.read(prot);
+        trans.close();
+
+        return data;
+    }
+
+    public static override function Run() : Void
+    {
+        var written = WriteData();
+        var read = ReadData();
+
+        Expect( read.string_thing == written.string_thing, "string data");
+        Expect( read.byte_thing == written.byte_thing, "byte data");
+        Expect( read.i32_thing == written.i32_thing, "i32 data");
+        Expect( Int64.compare( read.i64_thing, written.i64_thing) == 0, "i64 data");
+    }
 
 }
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/lib/haxe/test/src/TestBase.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/test/src/TestBase.hx b/lib/haxe/test/src/TestBase.hx
index 03b66dd..2a344d6 100644
--- a/lib/haxe/test/src/TestBase.hx
+++ b/lib/haxe/test/src/TestBase.hx
@@ -28,12 +28,13 @@ import org.apache.thrift.meta_data.*;
 import thrift.test.*;  // generated code
 
 class TestBase {
-	
-	private function new() {
-		// override, if necessary
-	}
-	
-	public static function Run() : Void {
-      	throw new AbstractMethodError();
-	}	
+
+    private function new() {
+        // override, if necessary
+    }
+
+    public static function Run() : Void {
+          throw new AbstractMethodError();
+    }
 }
+ 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/test/haxe/src/Arguments.hx
----------------------------------------------------------------------
diff --git a/test/haxe/src/Arguments.hx b/test/haxe/src/Arguments.hx
index ae23fa1..132f208 100644
--- a/test/haxe/src/Arguments.hx
+++ b/test/haxe/src/Arguments.hx
@@ -30,299 +30,299 @@ using StringTools;
 
 
 enum ProtocolType {
-	binary;
-	json;
+    binary;
+    json;
 }
 
 enum EndpointTransport {
-	socket;
-	http;	
+    socket;
+    http;
 }
 
 enum ServerType {
-	simple;
-	/*
-	threadpool;	
-	threaded;
-	nonblocking;
-	*/
+    simple;
+    /*
+    threadpool;
+    threaded;
+    nonblocking;
+    */
 }
 
 
 class Arguments
 {
-	public var printHelpOnly(default,null) : Bool = false;
-
-	public var server(default,null) : Bool = false;
-	public var servertype(default,null) : ServerType = simple;
-
-	public var host(default,null) : String = "localhost";
-	public var port(default,null) : Int = 9090;
-	
-	public var protocol(default,null) : ProtocolType = binary;
-	public var transport(default,null) : EndpointTransport = socket;
-	public var framed(default,null) : Bool = false;
-	public var buffered(default,null) : Bool = false;
-
-	public var numIterations(default,null) : Int = 1;
-	public var numThreads(default,null) : Int = 1;
-	public var skipSpeedTest(default,null) : Bool = false;
-	
-	
-	public function new() {
-		#if sys
-		try {
-  			ParseArgs();
-		} catch (e : String) {
-			trace(GetHelp());
-			throw e;
-		}
-		#else
-		trace("WN: Platform does not support program arguments, using defaults.");
-		#end
-	}
-	
-	#if sys
-		
-	private static function GetHelp() : String {
-		var sProg = Path.withoutDirectory( Sys.executablePath());
-		return "\n"
-			+sProg+"  [client|server]  [options]\n"
-			+"\n"
-			+"Modus: Either client or server, the default is client.\n"
-			+"\n"
-			+"Common options:\n"
-			+"  -h [ --help ]               produce help message\n"
-			+"  --port arg (=9090)          Port number to listen / connect to\n"
-			/* not supported yet
-			+"  --domain-socket arg         Unix Domain Socket (e.g. /tmp/ThriftTest.thrift)\n"
+    public var printHelpOnly(default,null) : Bool = false;
+
+    public var server(default,null) : Bool = false;
+    public var servertype(default,null) : ServerType = simple;
+
+    public var host(default,null) : String = "localhost";
+    public var port(default,null) : Int = 9090;
+
+    public var protocol(default,null) : ProtocolType = binary;
+    public var transport(default,null) : EndpointTransport = socket;
+    public var framed(default,null) : Bool = false;
+    public var buffered(default,null) : Bool = false;
+
+    public var numIterations(default,null) : Int = 1;
+    public var numThreads(default,null) : Int = 1;
+    public var skipSpeedTest(default,null) : Bool = false;
+
+
+    public function new() {
+        #if sys
+        try {
+              ParseArgs();
+        } catch (e : String) {
+            trace(GetHelp());
+            throw e;
+        }
+        #else
+        trace("WN: Platform does not support program arguments, using defaults.");
+        #end
+    }
+
+    #if sys
+
+    private static function GetHelp() : String {
+        var sProg = Path.withoutDirectory( Sys.executablePath());
+        return "\n"
+            +sProg+"  [client|server]  [options]\n"
+            +"\n"
+            +"Modus: Either client or server, the default is client.\n"
+            +"\n"
+            +"Common options:\n"
+            +"  -h [ --help ]               produce help message\n"
+            +"  --port arg (=9090)          Port number to listen / connect to\n"
+            /* not supported yet
+            +"  --domain-socket arg         Unix Domain Socket (e.g. /tmp/ThriftTest.thrift)\n"
             +"  --named-pipe arg            Windows Named Pipe (e.g. MyThriftPipe)\n"
-			*/
-			+"  --protocol arg (=binary)    protocol: binary, compact, json\n"
-			/* not supported yet
-			+"  --ssl                       Encrypted Transport using SSL\n"
-			*/
-			+"\n"
-			+"Server only options:\n"
+            */
+            +"  --protocol arg (=binary)    protocol: binary, compact, json\n"
+            /* not supported yet
+            +"  --ssl                       Encrypted Transport using SSL\n"
+            */
+            +"\n"
+            +"Server only options:\n"
             +"  --transport arg (=sockets)  Transport: buffered, framed, http, anonpipe\n"
-			/* not supported yet
-			+"  --processor-events          processor-events\n"
-			+"  --server-type arg (=simple) type of server, \"simple\", \"thread-pool\", \n"
-			+"                              \"threaded\", or \"nonblocking\"\n"
-			+"  -n [ --workers ] arg (=4)   Number of thread pools workers. Only valid for \n"
-			+"                              thread-pool server type\n"
-			*/
-			+"\n"
-			+"Client only options:\n"
+            /* not supported yet
+            +"  --processor-events          processor-events\n"
+            +"  --server-type arg (=simple) type of server, \"simple\", \"thread-pool\", \n"
+            +"                              \"threaded\", or \"nonblocking\"\n"
+            +"  -n [ --workers ] arg (=4)   Number of thread pools workers. Only valid for \n"
+            +"                              thread-pool server type\n"
+            */
+            +"\n"
+            +"Client only options:\n"
             +"  --host arg (=localhost)     Host to connect\n"
             +"  --transport arg (=sockets)  Transport: buffered, framed, http, evhttp\n"
-			/* not supported yet
+            /* not supported yet
             +"  --anon-pipes hRead hWrite   Windows Anonymous Pipes pair (handles)\n"
-			*/
+            */
             +"  -n [ --testloops ] arg (=1) Number of Tests\n"
             +"  -t [ --threads ] arg (=1)   Number of Test threads\n"
             +"  --skip-speed-test           Skip the speed test\n"
-			+"\n"
-			+"All arguments are optional.\n"
-			;
-	}
-	
-
-	private function ParseArgs() : Void {
-		
-		var args = Sys.args().copy();
-		if( (args == null) || (args.length <= 0)) {
-			server = false;
-			numThreads = 1;
-			return;
-		}
-		
-		var arg = args.shift();
-		if ( arg == "client") {
-			server = false;
-			numThreads = 1;
-		} 
-		else if ( arg == "server") {
-			server = true;
-			numThreads = 4;
-		} 
-		else if ( (arg == "-h") || (arg == "--help")) {
-			// -h [ --help ]               produce help message
-			Sys.println( GetHelp());
-			printHelpOnly = true;
-			return;
-		} 
-		else {
-			throw "First argument must be 'server' or 'client'";
-		}
-
-			
-		while( args.length > 0) {
-			arg = args.shift();
-			
-			if ( (arg == "-h") || (arg == "--help")) {
-				// -h [ --help ]               produce help message
-			    Sys.println( GetHelp());
-				printHelpOnly = true;
-				return;
-			} 
-			else if (arg == "--port") {		
-				// --port arg (=9090)          Port number to listen
-				arg = args.shift();
-				var tmp = Std.parseInt(arg);
-				if( tmp != null) {
-					port = tmp;
-				} else {
-					throw "Invalid port number "+arg;
-				}  
-			} 
-			else if (arg == "--domain-socket") {		
-				//   --domain-socket arg         Unix Domain Socket (e.g. /tmp/ThriftTest.thrift)
-				throw "domain sockets not supported yet";
-			} 
-			else if (arg == "--named-pipe") {		
-				//   --named-pipe arg            Windows Named Pipe (e.g. MyThriftPipe)
-				throw "named pipes not supported yet";
-			} 
-			else if (arg == "--protocol") {		
-				// --protocol arg (=binary)    protocol: binary, compact, json
-				arg = args.shift();
-				if( arg == "binary") {
-					protocol = binary;
-				} else if( arg == "compact") {
-					throw "Compact protocol not supported yet";
-				} else if( arg == "json") {
-					protocol = json;
-				} else {
-					InvalidArg(arg);
-				}
-			}  
-			else if (arg == "--ssl") {		
-				// --ssl                       Encrypted Transport using SSL
-				throw "SSL not supported yet";
-			} 
-			else {
+            +"\n"
+            +"All arguments are optional.\n"
+            ;
+    }
+
+
+    private function ParseArgs() : Void {
+
+        var args = Sys.args().copy();
+        if( (args == null) || (args.length <= 0)) {
+            server = false;
+            numThreads = 1;
+            return;
+        }
+
+        var arg = args.shift();
+        if ( arg == "client") {
+            server = false;
+            numThreads = 1;
+        }
+        else if ( arg == "server") {
+            server = true;
+            numThreads = 4;
+        }
+        else if ( (arg == "-h") || (arg == "--help")) {
+            // -h [ --help ]               produce help message
+            Sys.println( GetHelp());
+            printHelpOnly = true;
+            return;
+        }
+        else {
+            throw "First argument must be 'server' or 'client'";
+        }
+
+
+        while( args.length > 0) {
+            arg = args.shift();
+
+            if ( (arg == "-h") || (arg == "--help")) {
+                // -h [ --help ]               produce help message
+                Sys.println( GetHelp());
+                printHelpOnly = true;
+                return;
+            }
+            else if (arg == "--port") {
+                // --port arg (=9090)          Port number to listen
+                arg = args.shift();
+                var tmp = Std.parseInt(arg);
+                if( tmp != null) {
+                    port = tmp;
+                } else {
+                    throw "Invalid port number "+arg;
+                }
+            }
+            else if (arg == "--domain-socket") {
+                //   --domain-socket arg         Unix Domain Socket (e.g. /tmp/ThriftTest.thrift)
+                throw "domain sockets not supported yet";
+            }
+            else if (arg == "--named-pipe") {
+                //   --named-pipe arg            Windows Named Pipe (e.g. MyThriftPipe)
+                throw "named pipes not supported yet";
+            }
+            else if (arg == "--protocol") {
+                // --protocol arg (=binary)    protocol: binary, compact, json
+                arg = args.shift();
+                if( arg == "binary") {
+                    protocol = binary;
+                } else if( arg == "compact") {
+                    throw "Compact protocol not supported yet";
+                } else if( arg == "json") {
+                    protocol = json;
+                } else {
+                    InvalidArg(arg);
+                }
+            }
+            else if (arg == "--ssl") {
+                // --ssl                       Encrypted Transport using SSL
+                throw "SSL not supported yet";
+            }
+            else {
                 //Server only options:
-				if( server) {
-					ParseServerArgument( arg, args);
-				} else {
-					ParseClientArgument( arg, args);
-				}
-			}
-		}
-	}
-	
-
-	private function ParseServerArgument( arg : String, args : Array<String>) : Void {
-		if (arg == "--transport") {
-			//  --transport arg (=sockets)  Transport: buffered, framed, http, anonpipe
-			arg = args.shift();
-			if( arg == "buffered") {
-				buffered = true;
-			} else if( arg == "framed") {
-				framed = true;
-			} else if( arg == "http") {
-				transport = http;
-			} else if( arg == "anonpipe") {
-				throw "Anon pipes transport not supported yet";
-			} else {
-				InvalidArg(arg);
-			}  
-		}
-		else if (arg == "--processor-events") {
-			throw "Processor events not supported yet";
-		}
-		else if (arg == "--server-type") {
-			//  --server-type arg (=simple) type of server, 
-			// one of "simple", "thread-pool", "threaded", "nonblocking"
-			arg = args.shift();
-			if( arg == "simple") {
-				servertype = simple;
-			} else if( arg == "thread-pool") {
-				throw arg+" server not supported yet";
-			} else if( arg == "threaded") {
-				throw arg+" server not supported yet";
-			} else if( arg == "nonblocking") {
-				throw arg+" server not supported yet";
-			} else {
-				InvalidArg(arg);
-			}  
-		}
-		else if ((arg == "-n") || (arg == "--workers")) {
-			//  -n [ --workers ] arg (=4)   Number of thread pools workers. Only valid for 
-			//                              thread-pool server type
-			arg = args.shift();
-			var tmp = Std.parseInt(arg);
-			if( tmp != null) {
-				numThreads = tmp;
-			} else{
-				throw "Invalid number "+arg;
-			} 
-		}
-		else {
-			InvalidArg(arg);
-		}
-	}
-	
-
-	private function ParseClientArgument( arg : String, args : Array<String>) : Void {
-		if (arg == "--host") {
+                if( server) {
+                    ParseServerArgument( arg, args);
+                } else {
+                    ParseClientArgument( arg, args);
+                }
+            }
+        }
+    }
+
+
+    private function ParseServerArgument( arg : String, args : Array<String>) : Void {
+        if (arg == "--transport") {
+            //  --transport arg (=sockets)  Transport: buffered, framed, http, anonpipe
+            arg = args.shift();
+            if( arg == "buffered") {
+                buffered = true;
+            } else if( arg == "framed") {
+                framed = true;
+            } else if( arg == "http") {
+                transport = http;
+            } else if( arg == "anonpipe") {
+                throw "Anon pipes transport not supported yet";
+            } else {
+                InvalidArg(arg);
+            }
+        }
+        else if (arg == "--processor-events") {
+            throw "Processor events not supported yet";
+        }
+        else if (arg == "--server-type") {
+            //  --server-type arg (=simple) type of server,
+            // one of "simple", "thread-pool", "threaded", "nonblocking"
+            arg = args.shift();
+            if( arg == "simple") {
+                servertype = simple;
+            } else if( arg == "thread-pool") {
+                throw arg+" server not supported yet";
+            } else if( arg == "threaded") {
+                throw arg+" server not supported yet";
+            } else if( arg == "nonblocking") {
+                throw arg+" server not supported yet";
+            } else {
+                InvalidArg(arg);
+            }
+        }
+        else if ((arg == "-n") || (arg == "--workers")) {
+            //  -n [ --workers ] arg (=4)   Number of thread pools workers. Only valid for
+            //                              thread-pool server type
+            arg = args.shift();
+            var tmp = Std.parseInt(arg);
+            if( tmp != null) {
+                numThreads = tmp;
+            } else{
+                throw "Invalid number "+arg;
+            }
+        }
+        else {
+            InvalidArg(arg);
+        }
+    }
+
+
+    private function ParseClientArgument( arg : String, args : Array<String>) : Void {
+        if (arg == "--host") {
             //  --host arg (=localhost)     Host to connect
-			host = args.shift();
-		}
-		else if (arg == "--transport") {
+            host = args.shift();
+        }
+        else if (arg == "--transport") {
             //  --transport arg (=sockets)  Transport: buffered, framed, http, evhttp
-			arg = args.shift();
-			if( arg == "buffered") {
-				buffered = true;
-			} else if( arg == "framed") {
-				framed = true;
-			} else if( arg == "http") {
-				transport = http;
-			} else if( arg == "evhttp") {
-				throw "evhttp transport not supported yet";
-			} else {
-				InvalidArg(arg);
-			}  
-		}
-		else if (arg == "--anon-pipes") {
-			//  --anon-pipes hRead hWrite   Windows Anonymous Pipes pair (handles)
-			throw "Anon pipes transport not supported yet";
-		}
-		else if ((arg == "-n") || (arg == "--testloops")) {
-			//  -n [ --testloops ] arg (=1) Number of Tests
-			arg = args.shift();
-			var tmp = Std.parseInt(arg);
-			if( tmp != null) {
-				numIterations = tmp;
-			} else {
-				throw "Invalid number "+arg;
-			}  
-		}
-		else if ((arg == "-t") || (arg == "--threads")) {
-			//  -t [ --threads ] arg (=1)   Number of Test threads
-			arg = args.shift();
-			var tmp = Std.parseInt(arg);
-			if( tmp != null) {
-				numThreads = tmp;
-			} else {
-				throw "Invalid number "+arg;
-			}  
-		}
-		else if (arg == "--skip-speed-test") {
-			//  --skip-speed-test  			Skip the speed test
-			skipSpeedTest = true;
-		}			
-		else {
-			InvalidArg(arg);
-		}
-	}
-
-	
-	#end
-		
-		
-	private function InvalidArg( arg : String) : Void {
-		throw 'Invalid argument $arg';
-	}
+            arg = args.shift();
+            if( arg == "buffered") {
+                buffered = true;
+            } else if( arg == "framed") {
+                framed = true;
+            } else if( arg == "http") {
+                transport = http;
+            } else if( arg == "evhttp") {
+                throw "evhttp transport not supported yet";
+            } else {
+                InvalidArg(arg);
+            }
+        }
+        else if (arg == "--anon-pipes") {
+            //  --anon-pipes hRead hWrite   Windows Anonymous Pipes pair (handles)
+            throw "Anon pipes transport not supported yet";
+        }
+        else if ((arg == "-n") || (arg == "--testloops")) {
+            //  -n [ --testloops ] arg (=1) Number of Tests
+            arg = args.shift();
+            var tmp = Std.parseInt(arg);
+            if( tmp != null) {
+                numIterations = tmp;
+            } else {
+                throw "Invalid number "+arg;
+            }
+        }
+        else if ((arg == "-t") || (arg == "--threads")) {
+            //  -t [ --threads ] arg (=1)   Number of Test threads
+            arg = args.shift();
+            var tmp = Std.parseInt(arg);
+            if( tmp != null) {
+                numThreads = tmp;
+            } else {
+                throw "Invalid number "+arg;
+            }
+        }
+        else if (arg == "--skip-speed-test") {
+            //  --skip-speed-test              Skip the speed test
+            skipSpeedTest = true;
+        }
+        else {
+            InvalidArg(arg);
+        }
+    }
+
+
+    #end
+
+
+    private function InvalidArg( arg : String) : Void {
+        throw 'Invalid argument $arg';
+    }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/test/haxe/src/Main.hx
----------------------------------------------------------------------
diff --git a/test/haxe/src/Main.hx b/test/haxe/src/Main.hx
index 6d80c21..30c04a6 100644
--- a/test/haxe/src/Main.hx
+++ b/test/haxe/src/Main.hx
@@ -17,7 +17,7 @@
  * under the License.
  */
 
- 
+
 package;
 
 import org.apache.thrift.*;
@@ -30,22 +30,22 @@ import thrift.test.*;  // generated code
 
 class Main
 {
-	static function main() {
-		try {
-			var args = new Arguments();
-			
-			if( args.printHelpOnly) 
-				return;
-			
-			if (args.server)
-				TestServer.Execute(args);
-			else 
-				TestClient.Execute(args);
-			
-			trace("Completed.");
-		} catch (e : String) {
-			trace(e);
-		}
-	}
+    static function main() {
+        try {
+            var args = new Arguments();
+
+            if( args.printHelpOnly)
+                return;
+
+            if (args.server)
+                TestServer.Execute(args);
+            else
+                TestClient.Execute(args);
+
+            trace("Completed.");
+        } catch (e : String) {
+            trace(e);
+        }
+    }
 
 }


[2/5] thrift git commit: THRIFT-2806 more whitespace fixups Client: Haxe Patch: Jens Geyer

Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/test/haxe/src/TestClient.hx
----------------------------------------------------------------------
diff --git a/test/haxe/src/TestClient.hx b/test/haxe/src/TestClient.hx
index 3c98e6a..3f9158e 100644
--- a/test/haxe/src/TestClient.hx
+++ b/test/haxe/src/TestClient.hx
@@ -43,758 +43,758 @@ import thrift.test.*;  // generated code
 
 
 class TestResults {
-	private var successCnt : Int = 0;
-	private var errorCnt : Int = 0;
-	private var failedTests : String = "";
-	private var print_direct : Bool = false;
-	
-	public static var EXITCODE_SUCCESS            = 0x00;  // no errors bits set
-	//
-	public static var EXITCODE_FAILBIT_BASETYPES  = 0x01;
-	public static var EXITCODE_FAILBIT_STRUCTS    = 0x02;
-	public static var EXITCODE_FAILBIT_CONTAINERS = 0x04;
-	public static var EXITCODE_FAILBIT_EXCEPTIONS = 0x08;
-	//
-	public static var EXITCODE_ALL_FAILBITS 	  = 0x0F;
-	//
-	private var testsExecuted : Int = 0;
-	private var testsFailed : Int = 0;
-	private var currentTest : Int = 0;
-
-	
-	public function new(direct : Bool) {
-		print_direct = direct;
-	}
-	
-	public function StartTestGroup( groupBit : Int) : Void {
-		currentTest = groupBit;
-		testsExecuted |= groupBit;
-	}
-	
-	public function Expect( expr : Bool, msg : String) : Void {
-		if ( expr) {
-			++successCnt;
-		} else {
-			++errorCnt;
-			testsFailed |= currentTest;
-			failedTests += "\n  " + msg;
-			if( print_direct) {
-				trace('FAIL: $msg');
-			}
-		}
-	}
-
-	public function CalculateExitCode() : Int {
-		var notExecuted : Int = EXITCODE_ALL_FAILBITS & (~testsExecuted);
-		return testsFailed | notExecuted;
-	}
-
-	public function PrintSummary() : Void {
-		var total = successCnt + errorCnt;
-		var sp = (100 * successCnt) / total;
-		var ep = (100 * errorCnt) / total;
-		
-		trace('===========================');
-		trace('Tests executed    $total');
-		trace('Tests succeeded   $successCnt ($sp%)');
-		trace('Tests failed      $errorCnt ($ep%)');
-		if ( errorCnt > 0)
-		{
-			trace('===========================');
-  			trace('FAILED TESTS: $failedTests');
-		}
-		trace('===========================');
-	}
+    private var successCnt : Int = 0;
+    private var errorCnt : Int = 0;
+    private var failedTests : String = "";
+    private var print_direct : Bool = false;
+
+    public static var EXITCODE_SUCCESS            = 0x00;  // no errors bits set
+    //
+    public static var EXITCODE_FAILBIT_BASETYPES  = 0x01;
+    public static var EXITCODE_FAILBIT_STRUCTS    = 0x02;
+    public static var EXITCODE_FAILBIT_CONTAINERS = 0x04;
+    public static var EXITCODE_FAILBIT_EXCEPTIONS = 0x08;
+    //
+    public static var EXITCODE_ALL_FAILBITS       = 0x0F;
+    //
+    private var testsExecuted : Int = 0;
+    private var testsFailed : Int = 0;
+    private var currentTest : Int = 0;
+
+
+    public function new(direct : Bool) {
+        print_direct = direct;
+    }
+
+    public function StartTestGroup( groupBit : Int) : Void {
+        currentTest = groupBit;
+        testsExecuted |= groupBit;
+    }
+
+    public function Expect( expr : Bool, msg : String) : Void {
+        if ( expr) {
+            ++successCnt;
+        } else {
+            ++errorCnt;
+            testsFailed |= currentTest;
+            failedTests += "\n  " + msg;
+            if( print_direct) {
+                trace('FAIL: $msg');
+            }
+        }
+    }
+
+    public function CalculateExitCode() : Int {
+        var notExecuted : Int = EXITCODE_ALL_FAILBITS & (~testsExecuted);
+        return testsFailed | notExecuted;
+    }
+
+    public function PrintSummary() : Void {
+        var total = successCnt + errorCnt;
+        var sp = (100 * successCnt) / total;
+        var ep = (100 * errorCnt) / total;
+
+        trace('===========================');
+        trace('Tests executed    $total');
+        trace('Tests succeeded   $successCnt ($sp%)');
+        trace('Tests failed      $errorCnt ($ep%)');
+        if ( errorCnt > 0)
+        {
+            trace('===========================');
+              trace('FAILED TESTS: $failedTests');
+        }
+        trace('===========================');
+    }
 }
 
 
 class TestClient {
 
-	public static function Execute(args : Arguments) :  Void
-	{
-		var exitCode = 0xFF;
-		try
-		{
-			var difft = Timer.stamp();
-	
-			if( args.numThreads > 1) {
-				var threads = new List<Thread>();
-				for( test in 0 ... args.numThreads) {
-					threads.add( StartThread( args));
-				} 
-				exitCode = 0;
-				for( thread in threads) {
-					exitCode |= Thread.readMessage(true);
-				}
-			} else {
-				var rslt = new TestResults(true);
-				RunClient(args,rslt);
-				rslt.PrintSummary();
-				exitCode = rslt.CalculateExitCode();
-			}
-
-			difft = Timer.stamp() - difft;
-			trace('total test time: $difft seconds');
-		}
-		catch (e : TException)
-		{
-			trace('$e');
-			exitCode = 0xFF;
-		}
-		catch (e : Dynamic)
-		{
-			trace('$e');
-			exitCode = 0xFF;
-		}
-	
-		#if sys
-		Sys.exit( exitCode);
-		#end
-	}
-
-	
-	private static function StartThread(args : Arguments) : Thread {
-		var thread = Thread.create(
-			function() : Void {
-				var rslt = new TestResults(false);
-				var main : Thread = Thread.readMessage(true);
-				try 
-				{
-					RunClient(args,rslt);
-				}
-				catch (e : TException)
-				{
-					rslt.Expect( false, '$e');
-					trace('$e');
-				}
-				catch (e : Dynamic)
-				{
-					rslt.Expect( false, '$e');
-					trace('$e');
-				}					
-				main.sendMessage( rslt.CalculateExitCode());
-			});
-		
-		thread.sendMessage(Thread.current());
-		return thread;
-	}
-
-	
-	public static function RunClient(args : Arguments, rslt : TestResults)
-	{
-		var transport : TTransport = null;
-		switch (args.transport)
-		{
-			case socket:
-				transport = new TSocket(args.host, args.port);
-			case http:
-				transport = new THttpClient(args.host);
-			default:
-				throw "Unhandled transport";
-		}
-
-		// optional: layered transport
-		if ( args.framed) {
-			trace("- framed transport");
-			transport = new TFramedTransport(transport);
-		} 
-		if ( args.buffered) {
-			trace("- buffered transport");
-			throw "TBufferedTransport not implemented yet";
-			//transport = new TBufferedTransport(transport);
-		}
-
-		// protocol
-		var protocol : TProtocol = null;
-		switch( args.protocol)
-		{
-		case binary:
-			trace("- binary protocol");
-			protocol = new TBinaryProtocol(transport);
-		case json:
-			trace("- json protocol");
-			protocol = new TJSONProtocol(transport);
-		default:
-			throw "Unhandled protocol";
-		}
-
-
-		// run the test code
-		HaxeBasicsTest( args, rslt);
-		for( i in 0 ... args.numIterations) {
-			ClientTest( transport, protocol, args, rslt);
-		}
-	}
-
-
-	public static function HaxeBasicsTest( args : Arguments, rslt : TestResults) : Void
-	{
-		// We need to test a few basic things used in the ClientTest
-		// Anything else beyond this scope should go into /lib/haxe/ instead
-		rslt.StartTestGroup( 0);
-		
-		var map32 = new IntMap<Int32>();
-		var map64 = new Int64Map<Int32>();
-
-		rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #1");
-		rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #2");
-		rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #3");
-		rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #4");
-		
-		map32.set( 42, 815);
-		map64.set( Int64.make(0,42), 815);
-		map32.set( -517, 23);
-		map64.set( Int64.make(-5,17), 23);
-		map32.set( 0, -123);
-		map64.set( Int64.make(0,0), -123);
-
-		rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #10");
-		rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #11");
-		rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #12");
-		rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #13");
-		rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #14");
-		rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #15");
-		rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #16");
-		rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #Int64.make(-5,17)");
-		rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #18");
-		rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #19");
-		rslt.Expect( map32.remove( -517) == map64.remove( Int64.make(-5,17)), "Int64Map<Int32> Test #20");
-		rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #21");
-		rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #22");
-		rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #23");
-		rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #24");
-		rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #25");
-		rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #26");
-		rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #27");
-		rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #28");
-
-		map32.set( 42, 1);
-		map64.set( Int64.make(0,42), 1);
-		map32.set( -517, -2);
-		map64.set( Int64.make(-5,17), -2);
-		map32.set( 0, 3);
-		map64.set( Int64.make(0,0), 3);
-
-		var c32 = 0;
-		for (key in map32.keys()) {
-			++c32;
-		}
-		var c64 = 0;
-		for (key in map64.keys()) {
-			++c64;
-		}
-		rslt.Expect( c32 == c64, "Int64Map<Int32> Test #30");
-
-		var s32 = map32.toString();
-		var s64 = map64.toString();
-		trace("Int64Map<Int32>.toString(): " + ' ("$s32" == "$s64")');
-
-		map32.remove( 42);
-		map64.remove( Int64.make(0,42));
-		map32.remove( -517);
-		map64.remove( Int64.make(-5,17));
-		map32.remove( 0);
-		map64.remove( Int64.make(0,0));
-		
-		rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #90");
-		rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #91");
-		rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #92");
-		rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #93");
-		rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #94");
-		rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #95");
-		rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #96");
-		rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #97");
-		rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #98");
-	}
-
-
-	public static function ClientTest( transport : TTransport, protocol : TProtocol, 
-									   args : Arguments, rslt : TestResults) : Void
-	{
-		var client = new ThriftTestImpl(protocol,protocol);
-		try
-		{
-			if (!transport.isOpen())
-			{
-				transport.open();
-			}
-		}
-		catch (e : TException)
-		{
-			trace('$e');
-			return;
-		}
-		catch (e : Dynamic)
-		{
-			trace('$e');
-			return;
-		}
-
-		var start = Date.now();
-
-		rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_EXCEPTIONS);
-	
-		// if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
-		trace('testException("Xception")');
-		try {
-			client.testException("Xception");
-			rslt.Expect( false, 'testException("Xception") should throw');
-		}
-		catch (e : Xception)
-		{
-			rslt.Expect( e.message == "Xception", 'testException("Xception")  -  e.message == "Xception"');
-			rslt.Expect( e.errorCode == 1001, 'testException("Xception")  -  e.errorCode == 1001');
-		}
-		catch (e : Dynamic)
-		{
-			rslt.Expect( false, 'testException("Xception")  -  $e');
-		} 
-	
-		// if arg == "TException" throw TException
-		trace('testException("TException")');
-		try {
-			client.testException("TException");
-			rslt.Expect( false, 'testException("TException") should throw');
-		}
-		catch (e : TException)
-		{
-			rslt.Expect( true, 'testException("TException")  -  $e');
-		}
-		catch (e : Dynamic)
-		{
-			rslt.Expect( false, 'testException("TException")  -  $e');
-		} 
-	
-		// else do not throw anything
-		trace('testException("bla")');
-		try {
-			client.testException("bla");
-			rslt.Expect( true, 'testException("bla") should not throw');
-		}
-		catch (e : Dynamic)
-		{
-			rslt.Expect( false, 'testException("bla")  -  $e');
-		} 
-			
-		
-
-		rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
-		
-		trace('testVoid()');
-		client.testVoid();
-		trace(' = void');
-		rslt.Expect(true,"testVoid()");  // bump counter
-
-		trace('testString("Test")');
-		var s = client.testString("Test");
-		trace(' = "$s"');
-		rslt.Expect(s == "Test", '$s == "Test"');
-
-		trace('testByte(1)');
-		var i8 = client.testByte(1);
-		trace(' = $i8');
-		rslt.Expect(i8 == 1, '$i8 == 1');
-
-		trace('testI32(-1)');
-		var i32 = client.testI32(-1);
-		trace(' = $i32');
-		rslt.Expect(i32 == -1, '$i32 == -1');
-
-		trace('testI64(-34359738368)');
-		var i64 = client.testI64( Int64.make( 0xFFFFFFF8, 0x00000000)); // -34359738368
-		trace(' = $i64');
-		rslt.Expect( Int64.compare( i64, Int64.make( 0xFFFFFFF8, 0x00000000)) == 0, 
-		             Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0xFFFFFFF8, 0x00000000)));
-
-		// edge case: the largest negative Int64 has no positive Int64 equivalent
-		trace('testI64(-9223372036854775808)');
-		i64 = client.testI64( Int64.make( 0x80000000, 0x00000000)); // -9223372036854775808
-		trace(' = $i64');
-		rslt.Expect( Int64.compare( i64, Int64.make( 0x80000000, 0x00000000)) == 0, 
-		             Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0x80000000, 0x00000000)));
-
-		trace('testDouble(5.325098235)');
-		var dub = client.testDouble(5.325098235);
-		trace(' = $dub');
-		rslt.Expect(dub == 5.325098235, '$dub == 5.325098235');
-
-		
-		rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
-		
-		trace('testStruct({"Zero", 1, -3, -5})');
-		var o = new Xtruct();
-		o.string_thing = "Zero";
-		o.byte_thing = 1;
-		o.i32_thing = -3;
-		o.i64_thing = Int64.make(0,-5);
-		var i = client.testStruct(o);
-		trace(' = {"' + i.string_thing + '", ' + i.byte_thing +', ' 
-					  + i.i32_thing +', '+ Int64.toStr(i.i64_thing) + '}');
-		rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
-		rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
-		rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
-		rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
-
-		trace('testNest({1, {\"Zero\", 1, -3, -5}, 5})');
-		var o2 = new Xtruct2();
-		o2.byte_thing = 1;
-		o2.struct_thing = o;
-		o2.i32_thing = 5;
-		var i2 = client.testNest(o2);
-		i = i2.struct_thing;
-		trace(" = {" + i2.byte_thing + ", {\"" + i.string_thing + "\", " 
-			  + i.byte_thing + ", " + i.i32_thing + ", " + Int64.toStr(i.i64_thing) + "}, " 
-			  + i2.i32_thing + "}");
-		rslt.Expect( i2.byte_thing == o2.byte_thing, "i2.byte_thing == o2.byte_thing");
-		rslt.Expect( i2.i32_thing == o2.i32_thing, "i2.i32_thing == o2.i32_thing");
-		rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
-		rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
-		rslt.Expect( i.i32_thing == o.i32_thing, "i.i32_thing == o.i32_thing");
-		rslt.Expect( Int64.compare( i.i64_thing, o.i64_thing) == 0, "i.i64_thing == o.i64_thing");
-
-		
-		rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
-		
-		var mapout = new IntMap< haxe.Int32>();
-		for ( j in 0 ... 5)
-		{
-			mapout.set(j, j - 10);
-		}
-		trace("testMap({");
-		var first : Bool = true;
-		for( key in mapout.keys())
-		{
-			if (first)
-			{
-				first = false;
-			}
-			else
-			{
-				trace(", ");
-			}
-			trace(key + " => " + mapout.get(key));
-		}
-		trace("})");
-
-		var mapin = client.testMap(mapout);
-
-		trace(" = {");
-		first = true;
-		for( key in mapin.keys())
-		{
-			if (first)
-			{
-				first = false;
-			}
-			else
-			{
-				trace(", ");
-			}
-			trace(key + " => " + mapin.get(key));
-			rslt.Expect( mapin.get(key) == mapout.get(key), ' mapin.get($key) == mapout.get($key)');
-		}
-		trace("}");
-		for( key in mapout.keys())
-		{
-			rslt.Expect(mapin.exists(key), 'mapin.exists($key)');
-		}
-
-		var listout = new List<Int>();
-		for (j in -2 ... 3)
-		{
-			listout.add(j);
-		}
-		trace("testList({");
-		first = true;
-		for( j in listout)
-		{
-			if (first)
-			{
-				first = false;
-			}
-			else
-			{
-				trace(", ");
-			}
-			trace(j);
-		}
-		trace("})");
-
-		var listin = client.testList(listout);
-
-		trace(" = {");
-		first = true;
-		for( j in listin)
-		{
-			if (first)
-			{
-				first = false;
-			}
-			else
-			{
-				trace(", ");
-			}
-			trace(j);
-		}
-		trace("}");
-
-		rslt.Expect(listin.length == listout.length, "listin.length == listout.length");
-		var literout = listout.iterator();
-		var literin = listin.iterator();
-		while( literin.hasNext()) {
-			rslt.Expect(literin.next() == literout.next(), "literin[i] == literout[i]");
-		}
-	
-		//set
-		var setout = new IntSet();
-		for (j in -2 ... 3)
-		{
-			setout.add(j);
-		}
-		trace("testSet({");
-		first = true;
-		for( j in setout)
-		{
-			if (first)
-			{
-				first = false;
-			}
-			else
-			{
-				trace(", ");
-			}
-			trace(j);
-		}
-		trace("})");
-
-		var setin = client.testSet(setout);
-
-		trace(" = {");
-		first = true;
-		for( j in setin)
-		{
-			if (first)
-			{
-				first = false;
-			}
-			else
-			{
-				trace(", ");
-			}
-			trace(j);
-			rslt.Expect(setout.contains(j), 'setout.contains($j)');
-		}
-		trace("}");
-		rslt.Expect(setin.size == setout.size, "setin.length == setout.length");
-	
-
-		rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
-
-		trace("testEnum(ONE)");
-		var ret = client.testEnum(Numberz.ONE);
-		trace(" = " + ret);
-		rslt.Expect(ret == Numberz.ONE, '$ret == Numberz.ONE');
-
-		trace("testEnum(TWO)");
-		ret = client.testEnum(Numberz.TWO);
-		trace(" = " + ret);
-		rslt.Expect(ret == Numberz.TWO, '$ret == Numberz.TWO');
-
-		trace("testEnum(THREE)");
-		ret = client.testEnum(Numberz.THREE);
-		trace(" = " + ret);
-		rslt.Expect(ret == Numberz.THREE, '$ret == Numberz.THREE');
-
-		trace("testEnum(FIVE)");
-		ret = client.testEnum(Numberz.FIVE);
-		trace(" = " + ret);
-		rslt.Expect(ret == Numberz.FIVE, '$ret == Numberz.FIVE');
-
-		trace("testEnum(EIGHT)");
-		ret = client.testEnum(Numberz.EIGHT);
-		trace(" = " + ret);
-		rslt.Expect(ret == Numberz.EIGHT, '$ret == Numberz.EIGHT');
-
-		trace("testTypedef(309858235082523)");
-		var uid = client.testTypedef( Int64.make( 0x119D0, 0x7E08671B));  // 309858235082523
-		trace(" = " + uid);
-		rslt.Expect( Int64.compare( uid, Int64.make( 0x119D0, 0x7E08671B)) == 0,
-		             Int64.toStr(uid)+" == "+Int64.toStr(Int64.make( 0x119D0, 0x7E08671B)));
-
-
-		rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
-
-		trace("testMapMap(1)");
-		var mm = client.testMapMap(1);
-		trace(" = {");
-		for( key in mm.keys())
-		{
-			trace(key + " => {");
-			var m2 = mm.get(key);
-			for( k2 in m2.keys())
-			{
-				trace(k2 + " => " + m2.get(k2) + ", ");
-			}
-			trace("}, ");
-		}
-		trace("}");
-
-		var pos = mm.get(4);
-		var neg = mm.get(-4);
-		rslt.Expect( (pos != null) && (neg != null), "(pos != null) && (neg != null)");
-		for (i in 0 ... 5) {
-			rslt.Expect( pos.get(i) == i, 'pos.get($i) == $i');
-			rslt.Expect( neg.get(-i) == -i, 'neg.get(-$i) == -$i');
-	 	}
-
-			
-		rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
-
-		var insane = new Insanity();
-		insane.userMap = new IntMap< Int64>();
-		insane.userMap.set( Numberz.FIVE, Int64.make(0,5000));
-		var truck = new Xtruct();
-		truck.string_thing = "Truck";
-		truck.byte_thing = 8;
-		truck.i32_thing = 8;
-		truck.i64_thing = Int64.make(0,8);
-		insane.xtructs = new List<Xtruct>();
-		insane.xtructs.add(truck);
-		trace("testInsanity()");
-		var whoa = client.testInsanity(insane);
-		trace(" = {");
-		for( key in whoa.keys())
-		{
-			var val = whoa.get(key);
-			trace(key + " => {");
-
-			for( k2 in val.keys())
-			{
-				var v2 = val.get(k2);
-
-				trace(k2 + " => {");
-				var userMap = v2.userMap;
-
-				trace("{");
-				if (userMap != null)
-				{
-					for( k3 in userMap.keys())
-					{
-						trace(k3 + " => " + userMap.get(k3) + ", ");
-					}
-				}
-				else
-				{
-					trace("null");
-				}
-				trace("}, ");
-
-				var xtructs = v2.xtructs;
-
-				trace("{");
-				if (xtructs != null)
-				{
-					for( x in xtructs)
-					{
-						trace("{\"" + x.string_thing + "\", " 
-							  + x.byte_thing + ", " + x.i32_thing + ", " 
-							  + x.i32_thing + "}, ");
-					}
-				}
-				else
-				{
-					trace("null");
-				}
-				trace("}");
-
-				trace("}, ");
-			}
-			trace("}, ");
-		}
-		trace("}");
-
-
-		var first_map = whoa.get(Int64.make(0,1));
-		var second_map = whoa.get(Int64.make(0,2));
-		rslt.Expect( (first_map != null) && (second_map != null), "(first_map != null) && (second_map != null)");
-		if ((first_map != null) && (second_map != null))
-		{
-			var crazy2 = first_map.get(Numberz.TWO);
-			var crazy3 = first_map.get(Numberz.THREE);
-			var looney = second_map.get(Numberz.SIX);
-			rslt.Expect( (crazy2 != null) && (crazy3 != null) && (looney != null), 
-						"(crazy2 != null) && (crazy3 != null) && (looney != null)");
-
-			rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0, 
-						"crazy2.UserMap.get(Numberz.EIGHT) == 8");
-			rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0, 
-						"crazy3.UserMap.get(Numberz.EIGHT) == 8");
-			rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0, 
-						"crazy2.UserMap.get(Numberz.FIVE) == 5");
-			rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0, 
-						"crazy3.UserMap.get(Numberz.FIVE) == 5");
-
-			var crz2iter = crazy2.xtructs.iterator();
-			var crz3iter = crazy3.xtructs.iterator();
-			rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
-			var goodbye2 = crz2iter.next();
-			var goodbye3 = crz3iter.next();
-			rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
-			var hello2 = crz2iter.next();
-			var hello3 = crz3iter.next();
-			rslt.Expect( ! (crz2iter.hasNext() || crz3iter.hasNext()), "! (crz2iter.hasNext() || crz3iter.hasNext())");
-
-			rslt.Expect( hello2.string_thing == "Hello2", 'hello2.String_thing == "Hello2"');
-			rslt.Expect( hello2.byte_thing == 2, 'hello2.Byte_thing == 2');
-			rslt.Expect( hello2.i32_thing == 2, 'hello2.I32_thing == 2');
-			rslt.Expect( Int64.compare( hello2.i64_thing, Int64.make(0,2)) == 0, 'hello2.I64_thing == 2');
-			rslt.Expect( hello3.string_thing == "Hello2", 'hello3.String_thing == "Hello2"');
-			rslt.Expect( hello3.byte_thing == 2, 'hello3.Byte_thing == 2');
-			rslt.Expect( hello3.i32_thing == 2, 'hello3.I32_thing == 2');
-			rslt.Expect( Int64.compare( hello3.i64_thing, Int64.make(0,2)) == 0, 'hello3.I64_thing == 2');
-
-			rslt.Expect( goodbye2.string_thing == "Goodbye4", 'goodbye2.String_thing == "Goodbye4"');
-			rslt.Expect( goodbye2.byte_thing == 4, 'goodbye2.Byte_thing == 4');
-			rslt.Expect( goodbye2.i32_thing == 4, 'goodbye2.I32_thing == 4');
-			rslt.Expect( Int64.compare( goodbye2.i64_thing, Int64.make(0,4)) == 0, 'goodbye2.I64_thing == 4');
-			rslt.Expect( goodbye3.string_thing == "Goodbye4", 'goodbye3.String_thing == "Goodbye4"');
-			rslt.Expect( goodbye3.byte_thing == 4, 'goodbye3.Byte_thing == 4');
-			rslt.Expect( goodbye3.i32_thing == 4, 'goodbye3.I32_thing == 4');
-			rslt.Expect( Int64.compare( goodbye3.i64_thing, Int64.make(0,4)) == 0, 'goodbye3.I64_thing == 4');
-		}
-
-		var arg0 = 1;
-		var arg1 = 2;
-		var arg2 = Int64.make( 0x7FFFFFFF,0xFFFFFFFF);
-		var multiDict = new IntMap< String>();
-		multiDict.set(1, "one");
-		var arg4 = Numberz.FIVE;
-		var arg5 = Int64.make(0,5000000);
-		trace("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")");
-		var multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5);
-		trace(" = Xtruct(byte_thing:" + multiResponse.byte_thing + ",string_thing:" + multiResponse.string_thing
-					+ ",i32_thing:" + multiResponse.i32_thing 
-			        + ",i64_thing:" + Int64.toStr(multiResponse.i64_thing) + ")");
-
-		rslt.Expect( multiResponse.string_thing == "Hello2", 'multiResponse.String_thing == "Hello2"');
-		rslt.Expect( multiResponse.byte_thing == arg0, 'multiResponse.Byte_thing == arg0');
-		rslt.Expect( multiResponse.i32_thing == arg1, 'multiResponse.I32_thing == arg1');
-		rslt.Expect( Int64.compare( multiResponse.i64_thing, arg2) == 0, 'multiResponse.I64_thing == arg2');
-
-
-		rslt.StartTestGroup( 0);
-
-		trace("Test Oneway(1)");
-		client.testOneway(1);
-
-		if( ! args.skipSpeedTest) {
-			trace("Test Calltime()");
-			var difft = Timer.stamp();
-			for ( k in 0 ... 1000) {
-				client.testVoid();
-			}
-			difft = Timer.stamp() - difft;
-			trace('$difft ms per testVoid() call');
-		}
-	}
+    public static function Execute(args : Arguments) :  Void
+    {
+        var exitCode = 0xFF;
+        try
+        {
+            var difft = Timer.stamp();
+
+            if( args.numThreads > 1) {
+                var threads = new List<Thread>();
+                for( test in 0 ... args.numThreads) {
+                    threads.add( StartThread( args));
+                }
+                exitCode = 0;
+                for( thread in threads) {
+                    exitCode |= Thread.readMessage(true);
+                }
+            } else {
+                var rslt = new TestResults(true);
+                RunClient(args,rslt);
+                rslt.PrintSummary();
+                exitCode = rslt.CalculateExitCode();
+            }
+
+            difft = Timer.stamp() - difft;
+            trace('total test time: $difft seconds');
+        }
+        catch (e : TException)
+        {
+            trace('$e');
+            exitCode = 0xFF;
+        }
+        catch (e : Dynamic)
+        {
+            trace('$e');
+            exitCode = 0xFF;
+        }
+
+        #if sys
+        Sys.exit( exitCode);
+        #end
+    }
+
+
+    private static function StartThread(args : Arguments) : Thread {
+        var thread = Thread.create(
+            function() : Void {
+                var rslt = new TestResults(false);
+                var main : Thread = Thread.readMessage(true);
+                try
+                {
+                    RunClient(args,rslt);
+                }
+                catch (e : TException)
+                {
+                    rslt.Expect( false, '$e');
+                    trace('$e');
+                }
+                catch (e : Dynamic)
+                {
+                    rslt.Expect( false, '$e');
+                    trace('$e');
+                }
+                main.sendMessage( rslt.CalculateExitCode());
+            });
+
+        thread.sendMessage(Thread.current());
+        return thread;
+    }
+
+
+    public static function RunClient(args : Arguments, rslt : TestResults)
+    {
+        var transport : TTransport = null;
+        switch (args.transport)
+        {
+            case socket:
+                transport = new TSocket(args.host, args.port);
+            case http:
+                transport = new THttpClient(args.host);
+            default:
+                throw "Unhandled transport";
+        }
+
+        // optional: layered transport
+        if ( args.framed) {
+            trace("- framed transport");
+            transport = new TFramedTransport(transport);
+        }
+        if ( args.buffered) {
+            trace("- buffered transport");
+            throw "TBufferedTransport not implemented yet";
+            //transport = new TBufferedTransport(transport);
+        }
+
+        // protocol
+        var protocol : TProtocol = null;
+        switch( args.protocol)
+        {
+        case binary:
+            trace("- binary protocol");
+            protocol = new TBinaryProtocol(transport);
+        case json:
+            trace("- json protocol");
+            protocol = new TJSONProtocol(transport);
+        default:
+            throw "Unhandled protocol";
+        }
+
+
+        // run the test code
+        HaxeBasicsTest( args, rslt);
+        for( i in 0 ... args.numIterations) {
+            ClientTest( transport, protocol, args, rslt);
+        }
+    }
+
+
+    public static function HaxeBasicsTest( args : Arguments, rslt : TestResults) : Void
+    {
+        // We need to test a few basic things used in the ClientTest
+        // Anything else beyond this scope should go into /lib/haxe/ instead
+        rslt.StartTestGroup( 0);
+
+        var map32 = new IntMap<Int32>();
+        var map64 = new Int64Map<Int32>();
+
+        rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #1");
+        rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #2");
+        rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #3");
+        rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #4");
+
+        map32.set( 42, 815);
+        map64.set( Int64.make(0,42), 815);
+        map32.set( -517, 23);
+        map64.set( Int64.make(-5,17), 23);
+        map32.set( 0, -123);
+        map64.set( Int64.make(0,0), -123);
+
+        rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #10");
+        rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #11");
+        rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #12");
+        rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #13");
+        rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #14");
+        rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #15");
+        rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #16");
+        rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #Int64.make(-5,17)");
+        rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #18");
+        rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #19");
+        rslt.Expect( map32.remove( -517) == map64.remove( Int64.make(-5,17)), "Int64Map<Int32> Test #20");
+        rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #21");
+        rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #22");
+        rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #23");
+        rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #24");
+        rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #25");
+        rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #26");
+        rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #27");
+        rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #28");
+
+        map32.set( 42, 1);
+        map64.set( Int64.make(0,42), 1);
+        map32.set( -517, -2);
+        map64.set( Int64.make(-5,17), -2);
+        map32.set( 0, 3);
+        map64.set( Int64.make(0,0), 3);
+
+        var c32 = 0;
+        for (key in map32.keys()) {
+            ++c32;
+        }
+        var c64 = 0;
+        for (key in map64.keys()) {
+            ++c64;
+        }
+        rslt.Expect( c32 == c64, "Int64Map<Int32> Test #30");
+
+        var s32 = map32.toString();
+        var s64 = map64.toString();
+        trace("Int64Map<Int32>.toString(): " + ' ("$s32" == "$s64")');
+
+        map32.remove( 42);
+        map64.remove( Int64.make(0,42));
+        map32.remove( -517);
+        map64.remove( Int64.make(-5,17));
+        map32.remove( 0);
+        map64.remove( Int64.make(0,0));
+
+        rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #90");
+        rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #91");
+        rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #92");
+        rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #93");
+        rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #94");
+        rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #95");
+        rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #96");
+        rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #97");
+        rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #98");
+    }
+
+
+    public static function ClientTest( transport : TTransport, protocol : TProtocol,
+                                       args : Arguments, rslt : TestResults) : Void
+    {
+        var client = new ThriftTestImpl(protocol,protocol);
+        try
+        {
+            if (!transport.isOpen())
+            {
+                transport.open();
+            }
+        }
+        catch (e : TException)
+        {
+            trace('$e');
+            return;
+        }
+        catch (e : Dynamic)
+        {
+            trace('$e');
+            return;
+        }
+
+        var start = Date.now();
+
+        rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_EXCEPTIONS);
+
+        // if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
+        trace('testException("Xception")');
+        try {
+            client.testException("Xception");
+            rslt.Expect( false, 'testException("Xception") should throw');
+        }
+        catch (e : Xception)
+        {
+            rslt.Expect( e.message == "Xception", 'testException("Xception")  -  e.message == "Xception"');
+            rslt.Expect( e.errorCode == 1001, 'testException("Xception")  -  e.errorCode == 1001');
+        }
+        catch (e : Dynamic)
+        {
+            rslt.Expect( false, 'testException("Xception")  -  $e');
+        }
+
+        // if arg == "TException" throw TException
+        trace('testException("TException")');
+        try {
+            client.testException("TException");
+            rslt.Expect( false, 'testException("TException") should throw');
+        }
+        catch (e : TException)
+        {
+            rslt.Expect( true, 'testException("TException")  -  $e');
+        }
+        catch (e : Dynamic)
+        {
+            rslt.Expect( false, 'testException("TException")  -  $e');
+        }
+
+        // else do not throw anything
+        trace('testException("bla")');
+        try {
+            client.testException("bla");
+            rslt.Expect( true, 'testException("bla") should not throw');
+        }
+        catch (e : Dynamic)
+        {
+            rslt.Expect( false, 'testException("bla")  -  $e');
+        }
+
+
+
+        rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
+
+        trace('testVoid()');
+        client.testVoid();
+        trace(' = void');
+        rslt.Expect(true,"testVoid()");  // bump counter
+
+        trace('testString("Test")');
+        var s = client.testString("Test");
+        trace(' = "$s"');
+        rslt.Expect(s == "Test", '$s == "Test"');
+
+        trace('testByte(1)');
+        var i8 = client.testByte(1);
+        trace(' = $i8');
+        rslt.Expect(i8 == 1, '$i8 == 1');
+
+        trace('testI32(-1)');
+        var i32 = client.testI32(-1);
+        trace(' = $i32');
+        rslt.Expect(i32 == -1, '$i32 == -1');
+
+        trace('testI64(-34359738368)');
+        var i64 = client.testI64( Int64.make( 0xFFFFFFF8, 0x00000000)); // -34359738368
+        trace(' = $i64');
+        rslt.Expect( Int64.compare( i64, Int64.make( 0xFFFFFFF8, 0x00000000)) == 0,
+                     Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0xFFFFFFF8, 0x00000000)));
+
+        // edge case: the largest negative Int64 has no positive Int64 equivalent
+        trace('testI64(-9223372036854775808)');
+        i64 = client.testI64( Int64.make( 0x80000000, 0x00000000)); // -9223372036854775808
+        trace(' = $i64');
+        rslt.Expect( Int64.compare( i64, Int64.make( 0x80000000, 0x00000000)) == 0,
+                     Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0x80000000, 0x00000000)));
+
+        trace('testDouble(5.325098235)');
+        var dub = client.testDouble(5.325098235);
+        trace(' = $dub');
+        rslt.Expect(dub == 5.325098235, '$dub == 5.325098235');
+
+
+        rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
+
+        trace('testStruct({"Zero", 1, -3, -5})');
+        var o = new Xtruct();
+        o.string_thing = "Zero";
+        o.byte_thing = 1;
+        o.i32_thing = -3;
+        o.i64_thing = Int64.make(0,-5);
+        var i = client.testStruct(o);
+        trace(' = {"' + i.string_thing + '", ' + i.byte_thing +', '
+                      + i.i32_thing +', '+ Int64.toStr(i.i64_thing) + '}');
+        rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
+        rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
+        rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
+        rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
+
+        trace('testNest({1, {\"Zero\", 1, -3, -5}, 5})');
+        var o2 = new Xtruct2();
+        o2.byte_thing = 1;
+        o2.struct_thing = o;
+        o2.i32_thing = 5;
+        var i2 = client.testNest(o2);
+        i = i2.struct_thing;
+        trace(" = {" + i2.byte_thing + ", {\"" + i.string_thing + "\", "
+              + i.byte_thing + ", " + i.i32_thing + ", " + Int64.toStr(i.i64_thing) + "}, "
+              + i2.i32_thing + "}");
+        rslt.Expect( i2.byte_thing == o2.byte_thing, "i2.byte_thing == o2.byte_thing");
+        rslt.Expect( i2.i32_thing == o2.i32_thing, "i2.i32_thing == o2.i32_thing");
+        rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
+        rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
+        rslt.Expect( i.i32_thing == o.i32_thing, "i.i32_thing == o.i32_thing");
+        rslt.Expect( Int64.compare( i.i64_thing, o.i64_thing) == 0, "i.i64_thing == o.i64_thing");
+
+
+        rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
+
+        var mapout = new IntMap< haxe.Int32>();
+        for ( j in 0 ... 5)
+        {
+            mapout.set(j, j - 10);
+        }
+        trace("testMap({");
+        var first : Bool = true;
+        for( key in mapout.keys())
+        {
+            if (first)
+            {
+                first = false;
+            }
+            else
+            {
+                trace(", ");
+            }
+            trace(key + " => " + mapout.get(key));
+        }
+        trace("})");
+
+        var mapin = client.testMap(mapout);
+
+        trace(" = {");
+        first = true;
+        for( key in mapin.keys())
+        {
+            if (first)
+            {
+                first = false;
+            }
+            else
+            {
+                trace(", ");
+            }
+            trace(key + " => " + mapin.get(key));
+            rslt.Expect( mapin.get(key) == mapout.get(key), ' mapin.get($key) == mapout.get($key)');
+        }
+        trace("}");
+        for( key in mapout.keys())
+        {
+            rslt.Expect(mapin.exists(key), 'mapin.exists($key)');
+        }
+
+        var listout = new List<Int>();
+        for (j in -2 ... 3)
+        {
+            listout.add(j);
+        }
+        trace("testList({");
+        first = true;
+        for( j in listout)
+        {
+            if (first)
+            {
+                first = false;
+            }
+            else
+            {
+                trace(", ");
+            }
+            trace(j);
+        }
+        trace("})");
+
+        var listin = client.testList(listout);
+
+        trace(" = {");
+        first = true;
+        for( j in listin)
+        {
+            if (first)
+            {
+                first = false;
+            }
+            else
+            {
+                trace(", ");
+            }
+            trace(j);
+        }
+        trace("}");
+
+        rslt.Expect(listin.length == listout.length, "listin.length == listout.length");
+        var literout = listout.iterator();
+        var literin = listin.iterator();
+        while( literin.hasNext()) {
+            rslt.Expect(literin.next() == literout.next(), "literin[i] == literout[i]");
+        }
+
+        //set
+        var setout = new IntSet();
+        for (j in -2 ... 3)
+        {
+            setout.add(j);
+        }
+        trace("testSet({");
+        first = true;
+        for( j in setout)
+        {
+            if (first)
+            {
+                first = false;
+            }
+            else
+            {
+                trace(", ");
+            }
+            trace(j);
+        }
+        trace("})");
+
+        var setin = client.testSet(setout);
+
+        trace(" = {");
+        first = true;
+        for( j in setin)
+        {
+            if (first)
+            {
+                first = false;
+            }
+            else
+            {
+                trace(", ");
+            }
+            trace(j);
+            rslt.Expect(setout.contains(j), 'setout.contains($j)');
+        }
+        trace("}");
+        rslt.Expect(setin.size == setout.size, "setin.length == setout.length");
+
+
+        rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
+
+        trace("testEnum(ONE)");
+        var ret = client.testEnum(Numberz.ONE);
+        trace(" = " + ret);
+        rslt.Expect(ret == Numberz.ONE, '$ret == Numberz.ONE');
+
+        trace("testEnum(TWO)");
+        ret = client.testEnum(Numberz.TWO);
+        trace(" = " + ret);
+        rslt.Expect(ret == Numberz.TWO, '$ret == Numberz.TWO');
+
+        trace("testEnum(THREE)");
+        ret = client.testEnum(Numberz.THREE);
+        trace(" = " + ret);
+        rslt.Expect(ret == Numberz.THREE, '$ret == Numberz.THREE');
+
+        trace("testEnum(FIVE)");
+        ret = client.testEnum(Numberz.FIVE);
+        trace(" = " + ret);
+        rslt.Expect(ret == Numberz.FIVE, '$ret == Numberz.FIVE');
+
+        trace("testEnum(EIGHT)");
+        ret = client.testEnum(Numberz.EIGHT);
+        trace(" = " + ret);
+        rslt.Expect(ret == Numberz.EIGHT, '$ret == Numberz.EIGHT');
+
+        trace("testTypedef(309858235082523)");
+        var uid = client.testTypedef( Int64.make( 0x119D0, 0x7E08671B));  // 309858235082523
+        trace(" = " + uid);
+        rslt.Expect( Int64.compare( uid, Int64.make( 0x119D0, 0x7E08671B)) == 0,
+                     Int64.toStr(uid)+" == "+Int64.toStr(Int64.make( 0x119D0, 0x7E08671B)));
+
+
+        rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
+
+        trace("testMapMap(1)");
+        var mm = client.testMapMap(1);
+        trace(" = {");
+        for( key in mm.keys())
+        {
+            trace(key + " => {");
+            var m2 = mm.get(key);
+            for( k2 in m2.keys())
+            {
+                trace(k2 + " => " + m2.get(k2) + ", ");
+            }
+            trace("}, ");
+        }
+        trace("}");
+
+        var pos = mm.get(4);
+        var neg = mm.get(-4);
+        rslt.Expect( (pos != null) && (neg != null), "(pos != null) && (neg != null)");
+        for (i in 0 ... 5) {
+            rslt.Expect( pos.get(i) == i, 'pos.get($i) == $i');
+            rslt.Expect( neg.get(-i) == -i, 'neg.get(-$i) == -$i');
+         }
+
+
+        rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
+
+        var insane = new Insanity();
+        insane.userMap = new IntMap< Int64>();
+        insane.userMap.set( Numberz.FIVE, Int64.make(0,5000));
+        var truck = new Xtruct();
+        truck.string_thing = "Truck";
+        truck.byte_thing = 8;
+        truck.i32_thing = 8;
+        truck.i64_thing = Int64.make(0,8);
+        insane.xtructs = new List<Xtruct>();
+        insane.xtructs.add(truck);
+        trace("testInsanity()");
+        var whoa = client.testInsanity(insane);
+        trace(" = {");
+        for( key in whoa.keys())
+        {
+            var val = whoa.get(key);
+            trace(key + " => {");
+
+            for( k2 in val.keys())
+            {
+                var v2 = val.get(k2);
+
+                trace(k2 + " => {");
+                var userMap = v2.userMap;
+
+                trace("{");
+                if (userMap != null)
+                {
+                    for( k3 in userMap.keys())
+                    {
+                        trace(k3 + " => " + userMap.get(k3) + ", ");
+                    }
+                }
+                else
+                {
+                    trace("null");
+                }
+                trace("}, ");
+
+                var xtructs = v2.xtructs;
+
+                trace("{");
+                if (xtructs != null)
+                {
+                    for( x in xtructs)
+                    {
+                        trace("{\"" + x.string_thing + "\", "
+                              + x.byte_thing + ", " + x.i32_thing + ", "
+                              + x.i32_thing + "}, ");
+                    }
+                }
+                else
+                {
+                    trace("null");
+                }
+                trace("}");
+
+                trace("}, ");
+            }
+            trace("}, ");
+        }
+        trace("}");
+
+
+        var first_map = whoa.get(Int64.make(0,1));
+        var second_map = whoa.get(Int64.make(0,2));
+        rslt.Expect( (first_map != null) && (second_map != null), "(first_map != null) && (second_map != null)");
+        if ((first_map != null) && (second_map != null))
+        {
+            var crazy2 = first_map.get(Numberz.TWO);
+            var crazy3 = first_map.get(Numberz.THREE);
+            var looney = second_map.get(Numberz.SIX);
+            rslt.Expect( (crazy2 != null) && (crazy3 != null) && (looney != null),
+                        "(crazy2 != null) && (crazy3 != null) && (looney != null)");
+
+            rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0,
+                        "crazy2.UserMap.get(Numberz.EIGHT) == 8");
+            rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0,
+                        "crazy3.UserMap.get(Numberz.EIGHT) == 8");
+            rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0,
+                        "crazy2.UserMap.get(Numberz.FIVE) == 5");
+            rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0,
+                        "crazy3.UserMap.get(Numberz.FIVE) == 5");
+
+            var crz2iter = crazy2.xtructs.iterator();
+            var crz3iter = crazy3.xtructs.iterator();
+            rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
+            var goodbye2 = crz2iter.next();
+            var goodbye3 = crz3iter.next();
+            rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
+            var hello2 = crz2iter.next();
+            var hello3 = crz3iter.next();
+            rslt.Expect( ! (crz2iter.hasNext() || crz3iter.hasNext()), "! (crz2iter.hasNext() || crz3iter.hasNext())");
+
+            rslt.Expect( hello2.string_thing == "Hello2", 'hello2.String_thing == "Hello2"');
+            rslt.Expect( hello2.byte_thing == 2, 'hello2.Byte_thing == 2');
+            rslt.Expect( hello2.i32_thing == 2, 'hello2.I32_thing == 2');
+            rslt.Expect( Int64.compare( hello2.i64_thing, Int64.make(0,2)) == 0, 'hello2.I64_thing == 2');
+            rslt.Expect( hello3.string_thing == "Hello2", 'hello3.String_thing == "Hello2"');
+            rslt.Expect( hello3.byte_thing == 2, 'hello3.Byte_thing == 2');
+            rslt.Expect( hello3.i32_thing == 2, 'hello3.I32_thing == 2');
+            rslt.Expect( Int64.compare( hello3.i64_thing, Int64.make(0,2)) == 0, 'hello3.I64_thing == 2');
+
+            rslt.Expect( goodbye2.string_thing == "Goodbye4", 'goodbye2.String_thing == "Goodbye4"');
+            rslt.Expect( goodbye2.byte_thing == 4, 'goodbye2.Byte_thing == 4');
+            rslt.Expect( goodbye2.i32_thing == 4, 'goodbye2.I32_thing == 4');
+            rslt.Expect( Int64.compare( goodbye2.i64_thing, Int64.make(0,4)) == 0, 'goodbye2.I64_thing == 4');
+            rslt.Expect( goodbye3.string_thing == "Goodbye4", 'goodbye3.String_thing == "Goodbye4"');
+            rslt.Expect( goodbye3.byte_thing == 4, 'goodbye3.Byte_thing == 4');
+            rslt.Expect( goodbye3.i32_thing == 4, 'goodbye3.I32_thing == 4');
+            rslt.Expect( Int64.compare( goodbye3.i64_thing, Int64.make(0,4)) == 0, 'goodbye3.I64_thing == 4');
+        }
+
+        var arg0 = 1;
+        var arg1 = 2;
+        var arg2 = Int64.make( 0x7FFFFFFF,0xFFFFFFFF);
+        var multiDict = new IntMap< String>();
+        multiDict.set(1, "one");
+        var arg4 = Numberz.FIVE;
+        var arg5 = Int64.make(0,5000000);
+        trace("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")");
+        var multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5);
+        trace(" = Xtruct(byte_thing:" + multiResponse.byte_thing + ",string_thing:" + multiResponse.string_thing
+                    + ",i32_thing:" + multiResponse.i32_thing
+                    + ",i64_thing:" + Int64.toStr(multiResponse.i64_thing) + ")");
+
+        rslt.Expect( multiResponse.string_thing == "Hello2", 'multiResponse.String_thing == "Hello2"');
+        rslt.Expect( multiResponse.byte_thing == arg0, 'multiResponse.Byte_thing == arg0');
+        rslt.Expect( multiResponse.i32_thing == arg1, 'multiResponse.I32_thing == arg1');
+        rslt.Expect( Int64.compare( multiResponse.i64_thing, arg2) == 0, 'multiResponse.I64_thing == arg2');
+
+
+        rslt.StartTestGroup( 0);
+
+        trace("Test Oneway(1)");
+        client.testOneway(1);
+
+        if( ! args.skipSpeedTest) {
+            trace("Test Calltime()");
+            var difft = Timer.stamp();
+            for ( k in 0 ... 1000) {
+                client.testVoid();
+            }
+            difft = Timer.stamp() - difft;
+            trace('$difft ms per testVoid() call');
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/test/haxe/src/TestServer.hx
----------------------------------------------------------------------
diff --git a/test/haxe/src/TestServer.hx b/test/haxe/src/TestServer.hx
index 92fab01..e9c838f 100644
--- a/test/haxe/src/TestServer.hx
+++ b/test/haxe/src/TestServer.hx
@@ -30,87 +30,87 @@ import thrift.test.*;  // generated code
 
 class TestServer
 {
-	public static function Execute(args : Arguments) :  Void
-	{
-		try
-		{
-			// Transport
-			var transport : TServerTransport = null;
-			switch( args.transport) {
-			case socket:
-				trace("- socket port "+args.port);
-				transport = new TServerSocket( args.port);
-			case http:
-				trace("- http");
-				throw "HTTP server not implemented yet";
-		 		//transport = new THttpServer( targetHost);
-			default:
-				throw "Unhandled transport";
-			}
+    public static function Execute(args : Arguments) :  Void
+    {
+        try
+        {
+            // Transport
+            var transport : TServerTransport = null;
+            switch( args.transport) {
+            case socket:
+                trace("- socket port "+args.port);
+                transport = new TServerSocket( args.port);
+            case http:
+                trace("- http");
+                throw "HTTP server not implemented yet";
+                 //transport = new THttpServer( targetHost);
+            default:
+                throw "Unhandled transport";
+            }
 
-			// optional: layered transport
-			var transfactory : TTransportFactory = null;
-			if ( args.framed) {
-				trace("- framed transport");
-				transfactory = new TFramedTransportFactory();
-			} 
-			if ( args.buffered) {
-				trace("- buffered transport");
-				throw "TBufferedTransport not implemented yet";
-				//transfactory = new TBufferedTransportFactory();
-			}
+            // optional: layered transport
+            var transfactory : TTransportFactory = null;
+            if ( args.framed) {
+                trace("- framed transport");
+                transfactory = new TFramedTransportFactory();
+            }
+            if ( args.buffered) {
+                trace("- buffered transport");
+                throw "TBufferedTransport not implemented yet";
+                //transfactory = new TBufferedTransportFactory();
+            }
 
-			// protocol
-			var protfactory : TProtocolFactory = null;
-			switch( args.protocol)
-			{
-			case binary:
-				trace("- binary protocol");
-				protfactory = new TBinaryProtocolFactory();
-			case json:
-				trace("- json protocol");
-				protfactory = new TJSONProtocolFactory();
-			default:
-				throw "Unhandled protocol";
-			}
+            // protocol
+            var protfactory : TProtocolFactory = null;
+            switch( args.protocol)
+            {
+            case binary:
+                trace("- binary protocol");
+                protfactory = new TBinaryProtocolFactory();
+            case json:
+                trace("- json protocol");
+                protfactory = new TJSONProtocolFactory();
+            default:
+                throw "Unhandled protocol";
+            }
 
-		
-			// Processor
-			var handler = new TestServerHandler();
-			var processor = new ThriftTestProcessor(handler);
 
-			// Simple Server
-			var server : TServer = null; 
-			switch( args.servertype)
-			{
-			case simple:
-				server = new TSimpleServer( processor, transport, transfactory, protfactory);
-			default:
-				throw "Unhandled server type";
-			}
-				
+            // Processor
+            var handler = new TestServerHandler();
+            var processor = new ThriftTestProcessor(handler);
 
-			/*
-			// Server event handler
-			if( args.serverEvents) {
-				var events = new TestServerEventHandler();
-				server.setEventHandler(serverEvents);
-				handler.server = serverEngine;
-			}
-			*/
+            // Simple Server
+            var server : TServer = null;
+            switch( args.servertype)
+            {
+            case simple:
+                server = new TSimpleServer( processor, transport, transfactory, protfactory);
+            default:
+                throw "Unhandled server type";
+            }
 
-			// Run it
-			server.Serve();
-			trace("done.");
 
-		}
-		catch (x : TException)
-		{
-			trace('$x');
-		}
-		catch (x : Dynamic)
-		{
-			trace('$x');
-		}
-	}
+            /*
+            // Server event handler
+            if( args.serverEvents) {
+                var events = new TestServerEventHandler();
+                server.setEventHandler(serverEvents);
+                handler.server = serverEngine;
+            }
+            */
+
+            // Run it
+            server.Serve();
+            trace("done.");
+
+        }
+        catch (x : TException)
+        {
+            trace('$x');
+        }
+        catch (x : Dynamic)
+        {
+            trace('$x');
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/test/haxe/src/TestServerEventHandler.hx
----------------------------------------------------------------------
diff --git a/test/haxe/src/TestServerEventHandler.hx b/test/haxe/src/TestServerEventHandler.hx
index b52943a..d17567c 100644
--- a/test/haxe/src/TestServerEventHandler.hx
+++ b/test/haxe/src/TestServerEventHandler.hx
@@ -30,24 +30,24 @@ import thrift.test.*;  // generated code
 
 class TestServerEventHandler : TServerEventHandler
 {
-	public int callCount = 0;
-	public void preServe()
-	{
-		callCount++;
-	}
-	public Object createContext(Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
-	{
-		callCount++;
-		return null;
-	}
-	public void deleteContext(Object serverContext, Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
-	{
-		callCount++;
-	}
-	public void processContext(Object serverContext, Thrift.Transport.TTransport transport)
-	{
-		callCount++;
-	}
+    public int callCount = 0;
+    public void preServe()
+    {
+        callCount++;
+    }
+    public Object createContext(Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
+    {
+        callCount++;
+        return null;
+    }
+    public void deleteContext(Object serverContext, Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
+    {
+        callCount++;
+    }
+    public void processContext(Object serverContext, Thrift.Transport.TTransport transport)
+    {
+        callCount++;
+    }
 }
 
-	
\ No newline at end of file
+    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/test/haxe/src/TestServerHandler.hx
----------------------------------------------------------------------
diff --git a/test/haxe/src/TestServerHandler.hx b/test/haxe/src/TestServerHandler.hx
index e988adb..f067bde 100644
--- a/test/haxe/src/TestServerHandler.hx
+++ b/test/haxe/src/TestServerHandler.hx
@@ -43,428 +43,428 @@ class TestServerHandler implements ThriftTest {
     public function new() {
     }
 
-	/**
-	* Prints "testVoid()" and returns nothing.
-	*/
+    /**
+    * Prints "testVoid()" and returns nothing.
+    */
     public function testVoid():Void
     {
-    	trace("testVoid()");
+        trace("testVoid()");
     }
 
-	/**
-	* Prints 'testString("%s")' with thing as '%s'
-	* @param string thing - the string to print
-	* @return string - returns the string 'thing'
-	* 
-	* @param thing
-	*/
+    /**
+    * Prints 'testString("%s")' with thing as '%s'
+    * @param string thing - the string to print
+    * @return string - returns the string 'thing'
+    *
+    * @param thing
+    */
     public function testString(thing:String):String
     {
-    	trace("teststring(\"" + thing + "\")");
-    	return thing;
+        trace("teststring(\"" + thing + "\")");
+        return thing;
     }
 
-	/**
-	* Prints 'testByte("%d")' with thing as '%d'
-	* @param byte thing - the byte to print
-	* @return byte - returns the byte 'thing'
-	* 
-	* @param thing
-	*/
+    /**
+    * Prints 'testByte("%d")' with thing as '%d'
+    * @param byte thing - the byte to print
+    * @return byte - returns the byte 'thing'
+    *
+    * @param thing
+    */
     public function testByte(thing:haxe.Int32):haxe.Int32
     {
-    	trace("testByte(" + thing + ")");
-    	return thing;
+        trace("testByte(" + thing + ")");
+        return thing;
     }
 
-	/**
-	* Prints 'testI32("%d")' with thing as '%d'
-	* @param i32 thing - the i32 to print
-	* @return i32 - returns the i32 'thing'
-	* 
-	* @param thing
-	*/
+    /**
+    * Prints 'testI32("%d")' with thing as '%d'
+    * @param i32 thing - the i32 to print
+    * @return i32 - returns the i32 'thing'
+    *
+    * @param thing
+    */
     public function testI32(thing:haxe.Int32):haxe.Int32
     {
-    	trace("testI32(" + thing + ")");
-    	return thing;
+        trace("testI32(" + thing + ")");
+        return thing;
     }
 
-	/**
-	* Prints 'testI64("%d")' with thing as '%d'
-	* @param i64 thing - the i64 to print
-	* @return i64 - returns the i64 'thing'
-	* 
-	* @param thing
-	*/
+    /**
+    * Prints 'testI64("%d")' with thing as '%d'
+    * @param i64 thing - the i64 to print
+    * @return i64 - returns the i64 'thing'
+    *
+    * @param thing
+    */
     public function testI64(thing:haxe.Int64):haxe.Int64
     {
-    	trace("testI64(" + thing + ")");
-    	return thing;
+        trace("testI64(" + thing + ")");
+        return thing;
     }
 
-	/**
-	* Prints 'testDouble("%f")' with thing as '%f'
-	* @param double thing - the double to print
-	* @return double - returns the double 'thing'
-	* 
-	* @param thing
-	*/
+    /**
+    * Prints 'testDouble("%f")' with thing as '%f'
+    * @param double thing - the double to print
+    * @return double - returns the double 'thing'
+    *
+    * @param thing
+    */
     public function testDouble(thing:Float):Float
     {
-    	trace("testDouble(" + thing + ")");
-    	return thing;
+        trace("testDouble(" + thing + ")");
+        return thing;
     }
 
-	/**
-	* Prints 'testStruct("{%s}")' where thing has been formatted 
+    /**
+    * Prints 'testStruct("{%s}")' where thing has been formatted
     *  into a string of comma seperated values
-	* @param Xtruct thing - the Xtruct to print
-	* @return Xtruct - returns the Xtruct 'thing'
-	* 
-	* @param thing
-	*/
+    * @param Xtruct thing - the Xtruct to print
+    * @return Xtruct - returns the Xtruct 'thing'
+    *
+    * @param thing
+    */
     public function testStruct(thing:Xtruct):Xtruct
     {
-    	trace("testStruct({" + 
-                          "\"" + thing.string_thing + "\", " + 
-                          thing.byte_thing + ", " + 
-                          thing.i32_thing + ", " + 
+        trace("testStruct({" +
+                          "\"" + thing.string_thing + "\", " +
+                          thing.byte_thing + ", " +
+                          thing.i32_thing + ", " +
                           Int64.toStr(thing.i64_thing) + "})");
-    	return thing;
+        return thing;
     }
 
-	/**
-	* Prints 'testNest("{%s}")' where thing has been formatted 
+    /**
+    * Prints 'testNest("{%s}")' where thing has been formatted
     *  into a string of the nested struct
-	* @param Xtruct2 thing - the Xtruct2 to print
-	* @return Xtruct2 - returns the Xtruct2 'thing'
-	* 
-	* @param thing
-	*/
+    * @param Xtruct2 thing - the Xtruct2 to print
+    * @return Xtruct2 - returns the Xtruct2 'thing'
+    *
+    * @param thing
+    */
     public function testNest(nest:Xtruct2):Xtruct2
     {
-    	var thing:Xtruct = nest.struct_thing;
-    	trace("testNest({" + 
-                          nest.byte_thing + ", {" + 
-                          "\"" + thing.string_thing + "\", " + 
-                          thing.byte_thing + ", " + 
-                          thing.i32_thing + ", " + 
-                          Int64.toStr(thing.i64_thing) + "}, " + 
+        var thing:Xtruct = nest.struct_thing;
+        trace("testNest({" +
+                          nest.byte_thing + ", {" +
+                          "\"" + thing.string_thing + "\", " +
+                          thing.byte_thing + ", " +
+                          thing.i32_thing + ", " +
+                          Int64.toStr(thing.i64_thing) + "}, " +
                           nest.i32_thing + "})");
-    	return nest;
+        return nest;
     }
 
-	/**
-	* Prints 'testMap("{%s")' where thing has been formatted
+    /**
+    * Prints 'testMap("{%s")' where thing has been formatted
     *  into a string of  'key => value' pairs
-	*  seperated by commas and new lines
-	* @param map<i32,i32> thing - the map<i32,i32> to print
-	* @return map<i32,i32> - returns the map<i32,i32> 'thing'
-	* 
-	* @param thing
-	*/
+    *  seperated by commas and new lines
+    * @param map<i32,i32> thing - the map<i32,i32> to print
+    * @return map<i32,i32> - returns the map<i32,i32> 'thing'
+    *
+    * @param thing
+    */
     public function testMap(thing:IntMap<haxe.Int32>):IntMap<haxe.Int32>
     {
-    	trace("testMap({");
-    	var first:Bool = true;
-    	for (key in thing.keys()) {
-    		if (first) {
-    			first = false;
-    		} else {
-    			trace(", ");
-    		};
-    		trace(key + " => " + thing.get(key));
-    	};
-    	trace("})");
-    	return thing;
+        trace("testMap({");
+        var first:Bool = true;
+        for (key in thing.keys()) {
+            if (first) {
+                first = false;
+            } else {
+                trace(", ");
+            };
+            trace(key + " => " + thing.get(key));
+        };
+        trace("})");
+        return thing;
     }
 
-	/**
-	* Prints 'testStringMap("{%s}")' where thing has been formatted 
+    /**
+    * Prints 'testStringMap("{%s}")' where thing has been formatted
     *  into a string of  'key => value' pairs
-	*  seperated by commas and new lines
-	* @param map<string,string> thing - the map<string,string> to print
-	* @return map<string,string> - returns the map<string,string> 'thing'
-	* 
-	* @param thing
-	*/
+    *  seperated by commas and new lines
+    * @param map<string,string> thing - the map<string,string> to print
+    * @return map<string,string> - returns the map<string,string> 'thing'
+    *
+    * @param thing
+    */
     public function testStringMap(thing:StringMap<String>):StringMap<String>
     {
-    	trace("testStringMap({");
-    	var first:Bool = true;
-    	for (key in thing.keys()) {
-    		if (first) {
-    			first = false;
-    		} else {
-    			trace(", ");
-    		};
-    		trace(key + " => " + thing.get(key));
-    	};
-    	trace("})");
-    	return thing;
+        trace("testStringMap({");
+        var first:Bool = true;
+        for (key in thing.keys()) {
+            if (first) {
+                first = false;
+            } else {
+                trace(", ");
+            };
+            trace(key + " => " + thing.get(key));
+        };
+        trace("})");
+        return thing;
     }
 
-	/**
-	* Prints 'testSet("{%s}")' where thing has been formatted 
+    /**
+    * Prints 'testSet("{%s}")' where thing has been formatted
     *  into a string of  values
-	*  seperated by commas and new lines
-	* @param set<i32> thing - the set<i32> to print
-	* @return set<i32> - returns the set<i32> 'thing'
-	* 
-	* @param thing
-	*/
+    *  seperated by commas and new lines
+    * @param set<i32> thing - the set<i32> to print
+    * @return set<i32> - returns the set<i32> 'thing'
+    *
+    * @param thing
+    */
     public function testSet(thing:IntSet):IntSet
     {
-    	trace("testSet({");
-    	var first:Bool = true;
-    	for (elem in thing) {
-    		if (first) {
-    			first = false;
-    		} else {
-    			trace(", ");
-    		};
-    		trace(elem);
-    	};
-    	trace("})");
-    	return thing;
+        trace("testSet({");
+        var first:Bool = true;
+        for (elem in thing) {
+            if (first) {
+                first = false;
+            } else {
+                trace(", ");
+            };
+            trace(elem);
+        };
+        trace("})");
+        return thing;
     }
 
-	/**
-	* Prints 'testList("{%s}")' where thing has been formatted 
+    /**
+    * Prints 'testList("{%s}")' where thing has been formatted
     *  into a string of  values
-	*  seperated by commas and new lines
-	* @param list<i32> thing - the list<i32> to print
-	* @return list<i32> - returns the list<i32> 'thing'
-	* 
-	* @param thing
-	*/
+    *  seperated by commas and new lines
+    * @param list<i32> thing - the list<i32> to print
+    * @return list<i32> - returns the list<i32> 'thing'
+    *
+    * @param thing
+    */
     public function testList(thing:List<haxe.Int32>):List<haxe.Int32>
     {
-    	trace("testList({");
-    	var first:Bool = true;
-    	for (elem in thing) {
-    		if (first) {
-    			first = false;
-    		} else {
-    			trace(", ");
-    		};
-    		trace(elem);
-    	};
-    	trace("})");
-    	return thing;
+        trace("testList({");
+        var first:Bool = true;
+        for (elem in thing) {
+            if (first) {
+                first = false;
+            } else {
+                trace(", ");
+            };
+            trace(elem);
+        };
+        trace("})");
+        return thing;
     }
 
-	/**
-	* Prints 'testEnum("%d")' where thing has been formatted into it's numeric value
-	* @param Numberz thing - the Numberz to print
-	* @return Numberz - returns the Numberz 'thing'
-	* 
-	* @param thing
-	*/
+    /**
+    * Prints 'testEnum("%d")' where thing has been formatted into it's numeric value
+    * @param Numberz thing - the Numberz to print
+    * @return Numberz - returns the Numberz 'thing'
+    *
+    * @param thing
+    */
     public function testEnum(thing:Int):Int
     {
-    	trace("testEnum(" + thing + ")");
-    	return thing;
+        trace("testEnum(" + thing + ")");
+        return thing;
     }
 
-	/**
-	* Prints 'testTypedef("%d")' with thing as '%d'
-	* @param UserId thing - the UserId to print
-	* @return UserId - returns the UserId 'thing'
-	* 
-	* @param thing
-	*/
+    /**
+    * Prints 'testTypedef("%d")' with thing as '%d'
+    * @param UserId thing - the UserId to print
+    * @return UserId - returns the UserId 'thing'
+    *
+    * @param thing
+    */
     public function testTypedef(thing:haxe.Int64):haxe.Int64
     {
-    	trace("testTypedef(" + thing + ")");
-    	return thing;
+        trace("testTypedef(" + thing + ")");
+        return thing;
     }
 
-	/**
-	* Prints 'testMapMap("%d")' with hello as '%d'
-	* @param i32 hello - the i32 to print
-	* @return map<i32,map<i32,i32>> - returns a dictionary with these values:
-	*   {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 
-	*     4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, }
-	* 
-	* @param hello
-	*/
+    /**
+    * Prints 'testMapMap("%d")' with hello as '%d'
+    * @param i32 hello - the i32 to print
+    * @return map<i32,map<i32,i32>> - returns a dictionary with these values:
+    *   {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, },
+    *     4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, }
+    *
+    * @param hello
+    */
     public function testMapMap(hello:haxe.Int32):IntMap<IntMap<haxe.Int32>>
     {
-    	trace("testMapMap(" + hello + ")");
-    	var mapmap = new IntMap<IntMap<Int>>();
-    	var pos = new IntMap<Int>();
-    	var neg = new IntMap<Int>();
-    	for (i in 1 ... 5) {
-    		pos.set(i, i);
-    		neg.set(-i, -i);
-    	};
-    	mapmap.set(4, pos);
-    	mapmap.set(-4, neg);
-    	return mapmap;
+        trace("testMapMap(" + hello + ")");
+        var mapmap = new IntMap<IntMap<Int>>();
+        var pos = new IntMap<Int>();
+        var neg = new IntMap<Int>();
+        for (i in 1 ... 5) {
+            pos.set(i, i);
+            neg.set(-i, -i);
+        };
+        mapmap.set(4, pos);
+        mapmap.set(-4, neg);
+        return mapmap;
     }
 
-	/**
-	* So you think you've got this all worked, out eh?
-	* 
-	* Creates a the returned map with these values and prints it out:
-	*   { 1 => { 2 => argument,
-	*            3 => argument,
-	*          },
-	*     2 => { 6 => <empty Insanity struct>, },
-	*   }
-	* @return map<UserId, map<Numberz,Insanity>> - a map with the above values
-	* 
-	* @param argument
-	*/
+    /**
+    * So you think you've got this all worked, out eh?
+    *
+    * Creates a the returned map with these values and prints it out:
+    *   { 1 => { 2 => argument,
+    *            3 => argument,
+    *          },
+    *     2 => { 6 => <empty Insanity struct>, },
+    *   }
+    * @return map<UserId, map<Numberz,Insanity>> - a map with the above values
+    *
+    * @param argument
+    */
     public function testInsanity(argument : Insanity) : Int64Map< IntMap< Insanity>>
     {
-    	trace("testInsanity()");
-
-    	var hello = new Xtruct();
-    	hello.string_thing = "Hello2";
-    	hello.byte_thing = 2;
-    	hello.i32_thing = 2;
-    	hello.i64_thing = Int64.make(0, 2);
-
-    	var goodbye = new Xtruct();
-    	goodbye.string_thing = "Goodbye4";
-    	goodbye.byte_thing = 4;
-    	goodbye.i32_thing = 4;
-    	goodbye.i64_thing = Int64.make(0, 4);
-
-    	var crazy = new Insanity();
-		crazy.userMap = new IntMap< haxe.Int64>();
-    	crazy.userMap.set(Numberz.EIGHT, Int64.make(0,8));
-    	crazy.xtructs = new List<Xtruct>();
-    	crazy.xtructs.add(goodbye);
-
-    	var looney = new Insanity();
-    	crazy.userMap.set(Numberz.FIVE, Int64.make(0,5));
-    	crazy.xtructs.add(hello);
-
-    	var first_map = new IntMap< Insanity>();
-    	first_map.set(Numberz.TWO, crazy);
-    	first_map.set(Numberz.THREE, crazy);
-
-    	var second_map = new IntMap< Insanity>();
-    	second_map.set(Numberz.SIX, looney);
-
-		var insane = new Int64Map< IntMap< Insanity>>();
-    	insane.set( Int64.make(0,1), first_map);
-    	insane.set( Int64.make(0,2), second_map);
-
-    	return insane;
+        trace("testInsanity()");
+
+        var hello = new Xtruct();
+        hello.string_thing = "Hello2";
+        hello.byte_thing = 2;
+        hello.i32_thing = 2;
+        hello.i64_thing = Int64.make(0, 2);
+
+        var goodbye = new Xtruct();
+        goodbye.string_thing = "Goodbye4";
+        goodbye.byte_thing = 4;
+        goodbye.i32_thing = 4;
+        goodbye.i64_thing = Int64.make(0, 4);
+
+        var crazy = new Insanity();
+        crazy.userMap = new IntMap< haxe.Int64>();
+        crazy.userMap.set(Numberz.EIGHT, Int64.make(0,8));
+        crazy.xtructs = new List<Xtruct>();
+        crazy.xtructs.add(goodbye);
+
+        var looney = new Insanity();
+        crazy.userMap.set(Numberz.FIVE, Int64.make(0,5));
+        crazy.xtructs.add(hello);
+
+        var first_map = new IntMap< Insanity>();
+        first_map.set(Numberz.TWO, crazy);
+        first_map.set(Numberz.THREE, crazy);
+
+        var second_map = new IntMap< Insanity>();
+        second_map.set(Numberz.SIX, looney);
+
+        var insane = new Int64Map< IntMap< Insanity>>();
+        insane.set( Int64.make(0,1), first_map);
+        insane.set( Int64.make(0,2), second_map);
+
+        return insane;
     }
 
-	/**
-	* Prints 'testMulti()'
-	* @param byte arg0 -
-	* @param i32 arg1 -
-	* @param i64 arg2 -
-	* @param map<i16, string> arg3 -
-	* @param Numberz arg4 -
-	* @param UserId arg5 -
-	* @return Xtruct - returns an Xtruct 
+    /**
+    * Prints 'testMulti()'
+    * @param byte arg0 -
+    * @param i32 arg1 -
+    * @param i64 arg2 -
+    * @param map<i16, string> arg3 -
+    * @param Numberz arg4 -
+    * @param UserId arg5 -
+    * @return Xtruct - returns an Xtruct
     *    with string_thing = "Hello2, byte_thing = arg0, i32_thing = arg1
-	*    and i64_thing = arg2
-	* 
-	* @param arg0
-	* @param arg1
-	* @param arg2
-	* @param arg3
-	* @param arg4
-	* @param arg5
-	*/
-    public function testMulti(arg0:haxe.Int32, arg1:haxe.Int32, arg2:haxe.Int64, 
+    *    and i64_thing = arg2
+    *
+    * @param arg0
+    * @param arg1
+    * @param arg2
+    * @param arg3
+    * @param arg4
+    * @param arg5
+    */
+    public function testMulti(arg0:haxe.Int32, arg1:haxe.Int32, arg2:haxe.Int64,
         arg3:IntMap<String>, arg4:Int, arg5:haxe.Int64):Xtruct
     {
-    	trace("testMulti()");
-    	var hello = new Xtruct();
-    	hello.string_thing = "Hello2";
-    	hello.byte_thing = arg0;
-    	hello.i32_thing = arg1;
-    	hello.i64_thing = arg2;
-    	return hello;
+        trace("testMulti()");
+        var hello = new Xtruct();
+        hello.string_thing = "Hello2";
+        hello.byte_thing = arg0;
+        hello.i32_thing = arg1;
+        hello.i64_thing = arg2;
+        return hello;
     }
 
-	/**
-	* Print 'testException(%s)' with arg as '%s'
-	* @param string arg - a string indication what type of exception to throw
-	* if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
-	* elsen if arg == "TException" throw TException
-	* else do not throw anything
-	* 
-	* @param arg
-	*/
+    /**
+    * Print 'testException(%s)' with arg as '%s'
+    * @param string arg - a string indication what type of exception to throw
+    * if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
+    * elsen if arg == "TException" throw TException
+    * else do not throw anything
+    *
+    * @param arg
+    */
     public function testException(arg:String):Void
     {
-    	trace("testException(" + arg + ")");
-    	if (arg == "Xception") {
-    		var x = new Xception();
-    		x.errorCode = 1001;
-    		x.message = arg;
-    		throw x;
-    	};
-    	if (arg == "TException") {
-    		throw new TException();
-    	};		
-    	return;
+        trace("testException(" + arg + ")");
+        if (arg == "Xception") {
+            var x = new Xception();
+            x.errorCode = 1001;
+            x.message = arg;
+            throw x;
+        };
+        if (arg == "TException") {
+            throw new TException();
+        };
+        return;
     }
 
-	/**
-	* Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s'
-	* @param string arg - a string indication what type of exception to throw
-	* if arg0 == "Xception" 
-	* throw Xception with errorCode = 1001 and message = "This is an Xception"
-	* else if arg0 == "Xception2" 
-	* throw Xception2 with errorCode = 2002 and message = "This is an Xception2"
-	* else do not throw anything
-	* @return Xtruct - an Xtruct with string_thing = arg1
-	* 
-	* @param arg0
-	* @param arg1
-	*/
+    /**
+    * Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s'
+    * @param string arg - a string indication what type of exception to throw
+    * if arg0 == "Xception"
+    * throw Xception with errorCode = 1001 and message = "This is an Xception"
+    * else if arg0 == "Xception2"
+    * throw Xception2 with errorCode = 2002 and message = "This is an Xception2"
+    * else do not throw anything
+    * @return Xtruct - an Xtruct with string_thing = arg1
+    *
+    * @param arg0
+    * @param arg1
+    */
     public function testMultiException(arg0:String, arg1:String):Xtruct
     {
-    	trace("testMultiException(" + arg0 + ", " + arg1 + ")");
-    	if (arg0 == "Xception") {
-    		var x = new Xception();
-    		x.errorCode = 1001;
-    		x.message = "This is an Xception";
-    		throw x;
-    	} else if (arg0 == "Xception2") {
-    		var x = new Xception2();
-    		x.errorCode = 2002;
-    		x.struct_thing = new Xtruct();
-    		x.struct_thing.string_thing = "This is an Xception2";
-    		throw x;
-    	};
-    	var result = new Xtruct();
-    	result.string_thing = arg1;
-    	return result;
+        trace("testMultiException(" + arg0 + ", " + arg1 + ")");
+        if (arg0 == "Xception") {
+            var x = new Xception();
+            x.errorCode = 1001;
+            x.message = "This is an Xception";
+            throw x;
+        } else if (arg0 == "Xception2") {
+            var x = new Xception2();
+            x.errorCode = 2002;
+            x.struct_thing = new Xtruct();
+            x.struct_thing.string_thing = "This is an Xception2";
+            throw x;
+        };
+        var result = new Xtruct();
+        result.string_thing = arg1;
+        return result;
     }
 
-	/**
-	* Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d'
-	* sleep 'secondsToSleep'
-	* Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d'
-	* @param i32 secondsToSleep - the number of seconds to sleep
-	* 
-	* @param secondsToSleep
-	*/
+    /**
+    * Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d'
+    * sleep 'secondsToSleep'
+    * Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d'
+    * @param i32 secondsToSleep - the number of seconds to sleep
+    *
+    * @param secondsToSleep
+    */
     public function testOneway(secondsToSleep:haxe.Int32):Void
     {
-    	trace("testOneway(" + secondsToSleep + "), sleeping...");
-    	Sys.sleep(secondsToSleep);
-    	trace("testOneway finished");
+        trace("testOneway(" + secondsToSleep + "), sleeping...");
+        Sys.sleep(secondsToSleep);
+        trace("testOneway finished");
     }
 
     public function testStop():Void
     {
-    	if (server != null) {
-    		server.Stop();
-    	};
+        if (server != null) {
+            server.Stop();
+        };
     }
 }

http://git-wip-us.apache.org/repos/asf/thrift/blob/b502832c/tutorial/haxe/src/CalculatorHandler.hx
----------------------------------------------------------------------
diff --git a/tutorial/haxe/src/CalculatorHandler.hx b/tutorial/haxe/src/CalculatorHandler.hx
index ee75edd..3376fb6 100644
--- a/tutorial/haxe/src/CalculatorHandler.hx
+++ b/tutorial/haxe/src/CalculatorHandler.hx
@@ -32,70 +32,70 @@ import shared.*;
 
 
 class CalculatorHandler implements Calculator {
-	
-	private var log = new IntMap<SharedStruct>();
-	
-	public function new() {
-	}
-
-	public function ping() : Void {
-		trace("ping()");
-	}
-
-	
-	public function add( num1 : haxe.Int32, num2 : haxe.Int32) : haxe.Int32 {
-		trace('add( $num1, $num2)');
-		return num1 + num2;
-	}
-
-	public function calculate( logid : haxe.Int32, work : Work) : haxe.Int32  {
-		trace('calculate( $logid, '+work.op+","+work.num1+","+work.num2+")");
-		
-		var val : haxe.Int32 = 0;
-		switch (work.op)
-		{
-			case Operation.ADD:
-				val = work.num1 + work.num2;
-
-			case Operation.SUBTRACT:
-				val = work.num1 - work.num2;
-
-			case Operation.MULTIPLY:
-				val = work.num1 * work.num2;
-
-			case Operation.DIVIDE:
-				if (work.num2 == 0)
-				{
-					var io = new InvalidOperation();
-					io.what = work.op;
-					io.why = "Cannot divide by 0";
-					throw io;
-				}
-				val = Std.int( work.num1 / work.num2);
-
-			default:
-				var io = new InvalidOperation();
-				io.what = work.op;
-				io.why = "Unknown operation";
-				throw io;
-		}
-
-		var entry = new SharedStruct();
-		entry.key = logid;
-		entry.value = '$val';
-		log.set(logid, entry);
-
-		return val;
-	}
-
-	public function getStruct( key : haxe.Int32) : SharedStruct {
-		trace('getStruct($key)');
-		return log.get(key);
-	}
-
-	// oneway method,  no args
-	public function zip() : Void {
-		trace("zip()");
-	}
+
+    private var log = new IntMap<SharedStruct>();
+
+    public function new() {
+    }
+
+    public function ping() : Void {
+        trace("ping()");
+    }
+
+
+    public function add( num1 : haxe.Int32, num2 : haxe.Int32) : haxe.Int32 {
+        trace('add( $num1, $num2)');
+        return num1 + num2;
+    }
+
+    public function calculate( logid : haxe.Int32, work : Work) : haxe.Int32  {
+        trace('calculate( $logid, '+work.op+","+work.num1+","+work.num2+")");
+
+        var val : haxe.Int32 = 0;
+        switch (work.op)
+        {
+            case Operation.ADD:
+                val = work.num1 + work.num2;
+
+            case Operation.SUBTRACT:
+                val = work.num1 - work.num2;
+
+            case Operation.MULTIPLY:
+                val = work.num1 * work.num2;
+
+            case Operation.DIVIDE:
+                if (work.num2 == 0)
+                {
+                    var io = new InvalidOperation();
+                    io.what = work.op;
+                    io.why = "Cannot divide by 0";
+                    throw io;
+                }
+                val = Std.int( work.num1 / work.num2);
+
+            default:
+                var io = new InvalidOperation();
+                io.what = work.op;
+                io.why = "Unknown operation";
+                throw io;
+        }
+
+        var entry = new SharedStruct();
+        entry.key = logid;
+        entry.value = '$val';
+        log.set(logid, entry);
+
+        return val;
+    }
+
+    public function getStruct( key : haxe.Int32) : SharedStruct {
+        trace('getStruct($key)');
+        return log.get(key);
+    }
+
+    // oneway method,  no args
+    public function zip() : Void {
+        trace("zip()");
+    }
 
 }