THRIFT-5370 Haxe 4 compatibility incl TConfiguration & MAX_MESSAGE_SIZE
Client: haxe
Patch: Jens Geyer

This closes #2349
diff --git a/tutorial/haxe/Tutorial.hxproj b/tutorial/haxe/Tutorial.hxproj
index 796f648..44e0efd 100644
--- a/tutorial/haxe/Tutorial.hxproj
+++ b/tutorial/haxe/Tutorial.hxproj
@@ -4,7 +4,7 @@
   <output>
     <movie outputType="Application" />
     <movie input="" />
-    <movie path="bin/HaxeTutorial" />
+    <movie path="bin\HaxeTutorial" />
     <movie fps="30" />
     <movie width="800" />
     <movie height="600" />
@@ -17,7 +17,7 @@
   <classpaths>
     <class path="src" />
     <class path="gen-haxe" />
-    <class path="../../lib/haxe/src" />
+    <class path="..\..\lib\haxe\src" />
   </classpaths>
   <!-- Build options -->
   <build>
diff --git a/tutorial/haxe/php-web-server.hxml b/tutorial/haxe/php-web-server.hxml
index 395a852..88007c1 100644
--- a/tutorial/haxe/php-web-server.hxml
+++ b/tutorial/haxe/php-web-server.hxml
@@ -27,7 +27,7 @@
 
 #PHP target
 -php bin/php-web-server/
---php-front Main-debug.php
+-D php-front=Main-debug.php
 
 #defines
 -D phpwebserver
diff --git a/tutorial/haxe/php.hxml b/tutorial/haxe/php.hxml
index c2f6887..42bbf74 100644
--- a/tutorial/haxe/php.hxml
+++ b/tutorial/haxe/php.hxml
@@ -27,7 +27,7 @@
 
 #PHP target
 -php bin/php/
---php-front Main-debug.php
+-D php-front=Main-debug.php
 
 #Add debug information
 -debug
diff --git a/tutorial/haxe/src/CalculatorHandler.hx b/tutorial/haxe/src/CalculatorHandler.hx
index e9752db..fcb06d1 100644
--- a/tutorial/haxe/src/CalculatorHandler.hx
+++ b/tutorial/haxe/src/CalculatorHandler.hx
@@ -31,7 +31,7 @@
 import shared.*;
 
 
-class CalculatorHandler implements Calculator {
+class CalculatorHandler implements Calculator_service {
 
     private var log = new IntMap<SharedStruct>();
 
diff --git a/tutorial/haxe/src/Main.hx b/tutorial/haxe/src/Main.hx
index 6bebe71..a56549f 100644
--- a/tutorial/haxe/src/Main.hx
+++ b/tutorial/haxe/src/Main.hx
@@ -32,6 +32,7 @@
 enum Prot {
     binary;
     json;
+	compact;
 }
 
 enum Trns {
@@ -112,12 +113,12 @@
     #if ! (flash || js)
 
     private static function GetHelp() : String {
-        return Sys.executablePath()+"  modus  trnsOption  transport  protocol\n"
+        return Sys.programPath+"  modus  layered  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"
+        +"  modus:       client, server          (default: client)\n"
+        +"  layered:     framed, buffered        (default: none)\n"
+        +"  transport:   socket, http            (default: socket)\n"
+        +"  protocol:    binary, json, compact   (default: binary)\n"
         +"\n"
         +"All arguments are optional.\n";
     }
@@ -160,6 +161,9 @@
                 } else if ( arg == "json") {
                     prot = json;
                     ++step;
+                } else if ( arg == "compact") {
+                    prot = compact;
+                    ++step;
                 } else {
                     throw "Unknown protocol "+arg;
                 }
@@ -217,6 +221,9 @@
         case json:
              trace("- JSON protocol");
              protocol = new TJSONProtocol( transport);
+        case compact:
+             trace("- compact protocol");
+             protocol = new TCompactProtocol( transport);
         default:
             throw "Unhandled protocol";
         }
@@ -232,7 +239,7 @@
         var client = ClientSetup();
 
         try {
-              client.ping();
+            client.ping();
             trace("ping() successful");
         } catch(error : TException) {
             trace('ping() failed: $error');
@@ -310,11 +317,12 @@
             #else
               trace("- http transport");
               transport = new TWrappingServerTransport(
-                      new TStreamTransport(
-                        new TFileStream("php://input", Read),
-                        new TFileStream("php://output", Append)
-                        )
-                      );
+                new TStreamTransport(
+                  new TFileStream("php://input", Read),
+                  new TFileStream("php://output", Append),
+                  null
+                )
+              );
 
             #end
         default:
@@ -341,11 +349,14 @@
         case json:
             trace("- JSON protocol");
              protfactory = new TJSONProtocolFactory();
+        case compact:
+            trace("- compact protocol");
+             protfactory = new TCompactProtocolFactory();
         default:
             throw "Unhandled protocol";
         }
 
-        var handler = new CalculatorHandler();
+        var handler : Calculator_service = new CalculatorHandler();
         var processor = new CalculatorProcessor(handler);
         var server = new TSimpleServer( processor, transport, transfactory, protfactory);
         #if phpwebserver