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 2022/06/07 21:06:00 UTC

[thrift] 02/02: THRIFT-5593 Implement uuid for Haxe Client: hx Patch: Jens Geyer

This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch uuid-datatype
in repository https://gitbox.apache.org/repos/asf/thrift.git

commit 77ad147ab5f2c7b0ad62a044afc88f28687ca06d
Author: Jens Geyer <je...@apache.org>
AuthorDate: Sun Jun 5 11:36:40 2022 +0200

    THRIFT-5593 Implement uuid for Haxe
    Client: hx
    Patch: Jens Geyer
---
 .../cpp/src/thrift/generate/t_haxe_generator.cc    | 19 ++++++++++
 lib/haxe/haxelib.json                              |  3 +-
 lib/haxe/src/org/apache/thrift/helper/Int64Map.hx  |  4 +--
 .../{protocol/TType.hx => helper/UuidHelper.hx}    | 41 +++++++++++++---------
 .../org/apache/thrift/protocol/TBinaryProtocol.hx  | 17 +++++++++
 .../org/apache/thrift/protocol/TCompactProtocol.hx | 22 ++++++++++--
 .../org/apache/thrift/protocol/TCompactTypes.hx    |  1 +
 .../org/apache/thrift/protocol/TJSONProtocol.hx    | 17 ++++++++-
 .../src/org/apache/thrift/protocol/TProtocol.hx    |  3 +-
 lib/haxe/src/org/apache/thrift/protocol/TType.hx   |  1 +
 lib/haxe/test/cpp.hxml                             | 10 ++++--
 lib/haxe/test/csharp.hxml                          | 10 ++++--
 lib/haxe/test/flash.hxml                           | 10 ++++--
 lib/haxe/test/java.hxml                            | 10 ++++--
 lib/haxe/test/javascript.hxml                      | 10 ++++--
 lib/haxe/test/neko.hxml                            | 10 ++++--
 lib/haxe/test/php.hxml                             | 10 ++++--
 lib/haxe/test/python.hxml                          | 10 ++++--
 test/haxe/TestClientServer.hxproj                  |  6 ++--
 test/haxe/cpp.hxml                                 |  6 ++--
 test/haxe/csharp.hxml                              |  8 ++---
 test/haxe/flash.hxml                               |  8 ++---
 test/haxe/java.hxml                                |  8 ++---
 test/haxe/javascript.hxml                          |  8 ++---
 test/haxe/neko.hxml                                |  8 ++---
 test/haxe/php-web-server.hxml                      |  3 --
 test/haxe/php.hxml                                 |  3 --
 test/haxe/python.hxml                              |  8 ++---
 test/haxe/src/TestClient.hx                        | 23 ++++++++++++
 test/haxe/src/TestServerHandler.hx                 | 14 ++++++++
 tutorial/haxe/cpp.hxml                             |  6 ++--
 tutorial/haxe/csharp.hxml                          |  6 ++--
 tutorial/haxe/flash.hxml                           |  6 ++--
 tutorial/haxe/java.hxml                            |  6 ++--
 tutorial/haxe/javascript.hxml                      |  6 ++--
 tutorial/haxe/neko.hxml                            |  6 ++--
 tutorial/haxe/php-web-server.hxml                  |  3 --
 tutorial/haxe/php.hxml                             |  6 ++--
 tutorial/haxe/python.hxml                          |  6 ++--
 39 files changed, 251 insertions(+), 111 deletions(-)

diff --git a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
index 27f8eda6f..29bbb3e8e 100644
--- a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
@@ -625,6 +625,9 @@ string t_haxe_generator::render_const_value(string name,
     case t_base_type::TYPE_STRING:
       render << '"' << get_escaped_string(value) << '"';
       break;
+    case t_base_type::TYPE_UUID:
+      render << '"' << get_escaped_string(value) << '"';
+      break;
     case t_base_type::TYPE_BOOL:
       render << ((value->get_integer() > 0) ? "true" : "false");
       break;
@@ -1421,6 +1424,9 @@ std::string t_haxe_generator::get_haxe_type_string(t_type* type) {
     case t_base_type::TYPE_STRING:
       return "TType.STRING";
       break;
+    case t_base_type::TYPE_UUID:
+      return "TType.UUID";
+      break;
     case t_base_type::TYPE_BOOL:
       return "TType.BOOL";
       break;
@@ -2200,6 +2206,9 @@ void t_haxe_generator::generate_deserialize_field(ostream& out, t_field* tfield,
           out << "readString();";
         }
         break;
+      case t_base_type::TYPE_UUID:
+        out << "readUuid();";
+        break;
       case t_base_type::TYPE_BOOL:
         out << "readBool();";
         break;
@@ -2384,6 +2393,9 @@ void t_haxe_generator::generate_serialize_field(ostream& out, t_field* tfield, s
           out << "writeString(" << name << ");";
         }
         break;
+      case t_base_type::TYPE_UUID:
+        out << "writeUuid(" << name << ");";
+        break;
       case t_base_type::TYPE_BOOL:
         out << "writeBool(" << name << ");";
         break;
@@ -2629,6 +2641,8 @@ string t_haxe_generator::base_type_name(t_base_type* type, bool in_container) {
     } else {
       return "String";
     }
+  case t_base_type::TYPE_UUID:
+    return "String";
   case t_base_type::TYPE_BOOL:
     return "Bool";
   case t_base_type::TYPE_I8:
@@ -2664,6 +2678,9 @@ string t_haxe_generator::declare_field(t_field* tfield, bool init) {
       case t_base_type::TYPE_STRING:
         result += " = null";
         break;
+      case t_base_type::TYPE_UUID:
+        result += " = uuid.Uuid.NIL";
+        break;
       case t_base_type::TYPE_BOOL:
         result += " = false";
         break;
@@ -2773,6 +2790,8 @@ string t_haxe_generator::type_to_enum(t_type* type) {
       throw "NO T_VOID CONSTRUCT";
     case t_base_type::TYPE_STRING:
       return "TType.STRING";
+    case t_base_type::TYPE_UUID:
+      return "TType.UUID";
     case t_base_type::TYPE_BOOL:
       return "TType.BOOL";
     case t_base_type::TYPE_I8:
diff --git a/lib/haxe/haxelib.json b/lib/haxe/haxelib.json
index 5448e5f3c..45ba4a962 100644
--- a/lib/haxe/haxelib.json
+++ b/lib/haxe/haxelib.json
@@ -14,7 +14,8 @@
 	"releasenote": "Licensed under Apache License, Version 2.0. The Apache Thrift compiler needs to be installed separately.",
 	"contributors": ["ApacheThrift"],
 	"dependencies": { 
-		"crypto": ""
+		"crypto": "",
+		"uuid": ""
 	},
 	"classPath": "src"
 }
diff --git a/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx b/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
index a8e735f81..fc5cc0b76 100644
--- a/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
@@ -27,7 +27,7 @@ import haxe.ds.IntMap;
 // Int64Map allows mapping of Int64 keys to arbitrary values.
 // ObjectMap<> cannot be used, since we want to compare by value, not address
 
-class Int64Map<T> implements IMap< Int64, T> {
+class Int64Map<T> implements haxe.Constraints.IMap< Int64, T> {
 
     private var SubMaps : IntMap< IntMap< T>>;  // Hi -> Lo -> Value
 
@@ -141,7 +141,7 @@ class Int64Map<T> implements IMap< Int64, T> {
 		SubMaps.clear();
     }
 
-    public function copy() : IMap< Int64, T> {
+    public function copy() : haxe.Constraints.IMap< Int64, T> {
 		var retval = new Int64Map<T>();
 		for( key in this.keys())
 			retval.set( key, this.get(key));
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TType.hx b/lib/haxe/src/org/apache/thrift/helper/UuidHelper.hx
similarity index 51%
copy from lib/haxe/src/org/apache/thrift/protocol/TType.hx
copy to lib/haxe/src/org/apache/thrift/helper/UuidHelper.hx
index 964b26ef6..082a9d32e 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TType.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/UuidHelper.hx
@@ -17,21 +17,30 @@
  * under the License.
  */
 
-package org.apache.thrift.protocol;
+package org.apache.thrift.helper;
 
-@:enum
-abstract TType(Int)  from Int to Int  {
-    public static inline var STOP : Int   = 0;
-    public static inline var VOID_ : Int  = 1;  // VOID produces collisions with cpp targets in some cases
-    public static inline var BOOL : Int   = 2;
-    public static inline var BYTE : Int   = 3;
-    public static inline var DOUBLE : Int = 4;
-    public static inline var I16 : Int    = 6;
-    public static inline var I32 : Int    = 8;
-    public static inline var I64 : Int    = 10;
-    public static inline var STRING : Int = 11;
-    public static inline var STRUCT : Int = 12;
-    public static inline var MAP : Int    = 13;
-    public static inline var SET : Int    = 14;
-    public static inline var LIST : Int   = 15;
+import haxe.io.Bytes;
+import uuid.Uuid;
+
+class UuidHelper {
+	
+	public static function CanonicalUuid( uuid : String) : String {
+		uuid = StringTools.replace( uuid, "{", "");
+		uuid = StringTools.replace( uuid, "}", "");
+		uuid = Uuid.stringify( Uuid.parse( uuid));
+		return uuid;
+	}
+	
+	#if debug
+	
+	public static function UnitTest() : Void 
+	{
+		var guid : String = CanonicalUuid("{00112233-4455-6677-8899-AABBCCDDEEFF}");
+		if ( guid.length != 36)
+			throw 'UuidHelper Test: CanonicalUuid() failed';
+	}
+
+	#end
+	
 }
+
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
index 736a7dcff..48b8d1e5c 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TBinaryProtocol.hx
@@ -25,8 +25,11 @@ import haxe.io.BytesOutput;
 import haxe.io.BytesBuffer;
 import haxe.Int64;
 
+import uuid.Uuid;
+
 import org.apache.thrift.TException;
 import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.helper.UuidHelper;
 
 /**
 * Binary protocol implementation for thrift.
@@ -164,6 +167,12 @@ class TBinaryProtocol extends TProtocolImplBase implements TProtocol {
         Transport.write(bin, 0, bin.length);
     }
 
+    public function writeUuid(uuid : String) : Void {		
+        var bytes : Bytes = Uuid.parse(UuidHelper.CanonicalUuid(uuid));
+        Transport.write(bytes, 0, bytes.length);
+    }
+
+
     /**
      * Reading methods.
      */
@@ -300,6 +309,13 @@ class TBinaryProtocol extends TProtocolImplBase implements TProtocol {
         return buffer.getBytes();
     }
 
+    public function readUuid() : String {
+        var buffer = new BytesBuffer();
+        Transport.readAll( buffer, 0, 16);
+        var bytes : Bytes = buffer.getBytes();
+        return Uuid.stringify( bytes);
+    }
+
 	// Return the minimum number of bytes a type will consume on the wire
 	public override function GetMinSerializedSize(type : TType) : Int
 	{
@@ -318,6 +334,7 @@ class TBinaryProtocol extends TProtocolImplBase implements TProtocol {
 			case TType.MAP: return 4;  // element count
 			case TType.SET: return 4;  // element count
 			case TType.LIST: return 4;  // element count
+			case TType.UUID: return 16;  // uuid bytes
 			default: throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "unrecognized type code");
 		}
 	}
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
index bf7b8860d..d3577f1f7 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
@@ -28,11 +28,13 @@ import haxe.ds.GenericStack;
 import haxe.Int32;
 import haxe.Int64;
 
+import uuid.Uuid;
+
 import org.apache.thrift.TException;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.helper.ZigZag;
 import org.apache.thrift.helper.BitConverter;
-
+import org.apache.thrift.helper.UuidHelper;
 
 /**
 * Compact protocol implementation for thrift.
@@ -62,7 +64,8 @@ class TCompactProtocol extends TProtocolImplBase implements TProtocol {
         TType.STRUCT  => TCompactTypes.STRUCT,
         TType.MAP     => TCompactTypes.MAP,
         TType.SET     => TCompactTypes.SET,
-        TType.LIST    => TCompactTypes.LIST
+        TType.LIST    => TCompactTypes.LIST,
+        TType.UUID    => TCompactTypes.UUID
     ];
 
     private static var tcompactTypeToType = [
@@ -78,7 +81,8 @@ class TCompactProtocol extends TProtocolImplBase implements TProtocol {
         TCompactTypes.LIST          => TType.LIST,
         TCompactTypes.SET           => TType.SET,
         TCompactTypes.MAP           => TType.MAP,
-        TCompactTypes.STRUCT        => TType.STRUCT
+        TCompactTypes.STRUCT        => TType.STRUCT,
+        TCompactTypes.UUID          => TType.UUID
     ];
 
 
@@ -337,6 +341,10 @@ class TCompactProtocol extends TProtocolImplBase implements TProtocol {
         Transport.write( bin, 0, bin.length);
     }
 
+    public function writeUuid(uuid : String) : Void {
+        var bytes : Bytes = Uuid.parse(UuidHelper.CanonicalUuid(uuid));
+        Transport.write(bytes, 0, bytes.length);
+    }
 
     // These methods are called by structs, but don't actually have any wire
     // output or purpose.
@@ -616,6 +624,13 @@ class TCompactProtocol extends TProtocolImplBase implements TProtocol {
     }
 
 
+    public function readUuid() : String {
+        var buffer = new BytesBuffer();
+        Transport.readAll( buffer, 0, 16);
+        var bytes : Bytes = buffer.getBytes();
+        return Uuid.stringify( bytes);
+    }
+
     // These methods are here for the struct to call, but don't have any wire
     // encoding.
     public function readMessageEnd() : Void { }
@@ -723,6 +738,7 @@ class TCompactProtocol extends TProtocolImplBase implements TProtocol {
 			case TType.MAP:     return 1;  // element count
 			case TType.SET:    return 1;  // element count
 			case TType.LIST:    return 1;  // element count
+			case TType.UUID: return 16;  // uuid bytes
 			default: throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "unrecognized type code");
 		}
 	}
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TCompactTypes.hx b/lib/haxe/src/org/apache/thrift/protocol/TCompactTypes.hx
index cdd3d874f..a3a7aac27 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TCompactTypes.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TCompactTypes.hx
@@ -37,5 +37,6 @@ abstract TCompactTypes(Int)  from Int to Int  {
     public static inline var SET           = 0x0A;
     public static inline var MAP           = 0x0B;
     public static inline var STRUCT        = 0x0C;
+    public static inline var UUID          = 0x0D;
 }
 
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx
index 2385ca890..a47479d42 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TJSONProtocol.hx
@@ -28,6 +28,8 @@ import haxe.ds.GenericStack;
 import haxe.crypto.Base64;
 import haxe.Int64;
 
+import uuid.Uuid;
+
 import org.apache.thrift.TException;
 import org.apache.thrift.protocol.TMessage;
 import org.apache.thrift.protocol.TField;
@@ -35,6 +37,7 @@ import org.apache.thrift.protocol.TMap;
 import org.apache.thrift.protocol.TSet;
 import org.apache.thrift.protocol.TList;
 import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.helper.UuidHelper;
 
 
 
@@ -164,6 +167,10 @@ class TJSONProtocol extends TProtocolImplBase implements TProtocol {
         WriteJSONBase64(bin);
     }
 
+    public function writeUuid(uuid : String) : Void {
+		writeString( UuidHelper.CanonicalUuid(uuid)); 
+    }
+
     public function readMessageBegin():TMessage {
         var message : TMessage = new TMessage();
         ReadJSONArrayStart();
@@ -289,6 +296,10 @@ class TJSONProtocol extends TProtocolImplBase implements TProtocol {
         return ReadJSONBase64();
     }
 
+    public function readUuid() : String {
+        return UuidHelper.CanonicalUuid( readString()); 
+    }
+
     // Push a new JSON context onto the stack.
     private function  PushContext(c : JSONBaseContext) : Void {
         contextStack.add(context);
@@ -794,6 +805,7 @@ class TJSONProtocol extends TProtocolImplBase implements TProtocol {
 			case TType.MAP: return 2;  // empty map
 			case TType.SET: return 2;  // empty set
 			case TType.LIST: return 2;  // empty list
+			case TType.UUID: return 36;  // "E236974D-F0B0-4E05-8F29-0B455D41B1A1"
 			default: throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "unrecognized type code");
 		}
 	}
@@ -892,6 +904,7 @@ class JSONConstants {
     public static var NAME_MAP    = 'map';
     public static var NAME_LIST   = 'lst';
     public static var NAME_SET    = 'set';
+	public static var NAME_UUID   = 'uid';
 
     public static function GetTypeNameForTypeID(typeID : Int) : String {
         switch (typeID)
@@ -907,6 +920,7 @@ class JSONConstants {
             case TType.MAP:         return NAME_MAP;
             case TType.SET:         return NAME_SET;
             case TType.LIST:     return NAME_LIST;
+            case TType.UUID:     return NAME_UUID;
         }
         throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, "Unrecognized type");
     }
@@ -922,7 +936,8 @@ class JSONConstants {
         NAME_STRUCT => TType.STRUCT,
         NAME_MAP    => TType.MAP,
         NAME_SET    => TType.SET,
-        NAME_LIST   => TType.LIST
+        NAME_LIST   => TType.LIST,
+		NAME_UUID   => TType.UUID
     ];
 
     public static function GetTypeIDForTypeName(name : String) : Int
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx
index 316067a38..6ce5999bf 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx
@@ -20,7 +20,6 @@
 package org.apache.thrift.protocol;
 
 import haxe.io.Bytes;
-import org.apache.thrift.TException;
 import org.apache.thrift.transport.TTransport;
 
 /**
@@ -54,6 +53,7 @@ interface TProtocol {
     function writeDouble(dub : Float) : Void;
     function writeString(str : String) : Void;
     function writeBinary(bin : Bytes) : Void;
+	function writeUuid(uuid : String) : Void;
 
     /**
      * Reading methods.
@@ -78,6 +78,7 @@ interface TProtocol {
     function readDouble() : Float;
     function readString() : String;
     function readBinary() : Bytes;
+	function readUuid() : String;
 
     // recursion tracking
     function IncrementRecursionDepth() : Void;
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TType.hx b/lib/haxe/src/org/apache/thrift/protocol/TType.hx
index 964b26ef6..8e21ed7c0 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TType.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TType.hx
@@ -34,4 +34,5 @@ abstract TType(Int)  from Int to Int  {
     public static inline var MAP : Int    = 13;
     public static inline var SET : Int    = 14;
     public static inline var LIST : Int   = 15;
+	public static inline var UUID : Int   = 16;
 }
diff --git a/lib/haxe/test/cpp.hxml b/lib/haxe/test/cpp.hxml
index 73848a8bc..489e9ae79 100644
--- a/lib/haxe/test/cpp.hxml
+++ b/lib/haxe/test/cpp.hxml
@@ -25,17 +25,21 @@
 #this class wil be used as entry point for your app.
 -main Main
 
+# forced compile of all source files
+--macro include('org.apache.thrift', true)
+--macro include('thrift', true)
+
 #CPP target
 -cpp bin
 
 #To produce 64 bit binaries the file should define the HXCPP_M64 compile variable:
 #-D HXCPP_M64
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/lib/haxe/test/csharp.hxml b/lib/haxe/test/csharp.hxml
index 4c34b0d94..fcba61e08 100644
--- a/lib/haxe/test/csharp.hxml
+++ b/lib/haxe/test/csharp.hxml
@@ -25,14 +25,18 @@
 #this class wil be used as entry point for your app.
 -main Main
 
+# forced compile of all source files
+--macro include('org.apache.thrift', true)
+--macro include('thrift', true)
+
 #CSHARP target
 -cs bin/Test.exe
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/lib/haxe/test/flash.hxml b/lib/haxe/test/flash.hxml
index 8b1763190..61fb88e68 100644
--- a/lib/haxe/test/flash.hxml
+++ b/lib/haxe/test/flash.hxml
@@ -25,14 +25,18 @@
 #this class wil be used as entry point for your app.
 -main Main
 
+# forced compile of all source files
+--macro include('org.apache.thrift', true)
+--macro include('thrift', true)
+
 #Flash target
 -swf bin/Test.swf
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/lib/haxe/test/java.hxml b/lib/haxe/test/java.hxml
index c9471597c..38d21a674 100644
--- a/lib/haxe/test/java.hxml
+++ b/lib/haxe/test/java.hxml
@@ -25,14 +25,18 @@
 #this class wil be used as entry point for your app.
 -main Main
 
+# forced compile of all source files
+--macro include('org.apache.thrift', true)
+--macro include('thrift', true)
+
 #Java target
 -java bin/Test.jar
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/lib/haxe/test/javascript.hxml b/lib/haxe/test/javascript.hxml
index 18d9964c2..09b12a5a1 100644
--- a/lib/haxe/test/javascript.hxml
+++ b/lib/haxe/test/javascript.hxml
@@ -25,6 +25,10 @@
 #this class wil be used as entry point for your app.
 -main Main
 
+# forced compile of all source files
+--macro include('org.apache.thrift', true)
+--macro include('thrift', true)
+
 #JavaScript target
 -js bin/Test.js
 
@@ -34,11 +38,11 @@
 #you modify your .hx files.
 -D source-map-content
 
+# libs
+-lib uuid
+
 #Generate source map and add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/lib/haxe/test/neko.hxml b/lib/haxe/test/neko.hxml
index 2db70c8e6..52497547d 100644
--- a/lib/haxe/test/neko.hxml
+++ b/lib/haxe/test/neko.hxml
@@ -25,14 +25,18 @@
 #this class wil be used as entry point for your app.
 -main Main
 
+# forced compile of all source files
+--macro include('org.apache.thrift', true)
+--macro include('thrift', true)
+
 #neko target
 -neko bin/Test.n
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/lib/haxe/test/php.hxml b/lib/haxe/test/php.hxml
index 9fc23b6b0..9ecf3e346 100644
--- a/lib/haxe/test/php.hxml
+++ b/lib/haxe/test/php.hxml
@@ -25,15 +25,19 @@
 #this class wil be used as entry point for your app.
 -main Main
 
+# forced compile of all source files
+--macro include('org.apache.thrift', true)
+--macro include('thrift', true)
+
 #PHP target
 -php bin/php/
 #--php-front Main-debug.php
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
diff --git a/lib/haxe/test/python.hxml b/lib/haxe/test/python.hxml
index 4d6a133d6..1faf1f5da 100644
--- a/lib/haxe/test/python.hxml
+++ b/lib/haxe/test/python.hxml
@@ -25,14 +25,18 @@
 #this class wil be used as entry point for your app.
 -main Main
 
+# forced compile of all source files
+--macro include('org.apache.thrift', true)
+--macro include('thrift', true)
+
 #Python target
 -python bin/Test.py
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/test/haxe/TestClientServer.hxproj b/test/haxe/TestClientServer.hxproj
index 30fecf378..67504159a 100644
--- a/test/haxe/TestClientServer.hxproj
+++ b/test/haxe/TestClientServer.hxproj
@@ -8,9 +8,9 @@
     <movie fps="30" />
     <movie width="800" />
     <movie height="600" />
-    <movie version="1" />
+    <movie version="0" />
     <movie minorVersion="0" />
-    <movie platform="C++" />
+    <movie platform="C#" />
     <movie background="#FFFFFF" />
   </output>
   <!-- Other classes to be compiled into your SWF -->
@@ -30,7 +30,7 @@
   </build>
   <!-- haxelib libraries -->
   <haxelib>
-    <!-- example: <library name="..." /> -->
+    <library name="uuid" />
   </haxelib>
   <!-- Class files to compile (other referenced classes will automatically be included) -->
   <compileTargets>
diff --git a/test/haxe/cpp.hxml b/test/haxe/cpp.hxml
index 6adb52d7e..1b581a924 100644
--- a/test/haxe/cpp.hxml
+++ b/test/haxe/cpp.hxml
@@ -31,11 +31,11 @@
 #To produce 64 bit binaries the file should define the HXCPP_M64 compile variable:
 #-D HXCPP_M64
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/test/haxe/csharp.hxml b/test/haxe/csharp.hxml
index 295c017e7..8dd891c20 100644
--- a/test/haxe/csharp.hxml
+++ b/test/haxe/csharp.hxml
@@ -26,13 +26,13 @@
 -main Main
 
 #CSHARP target
--cs bin/Tutorial.exe
+-cs bin/ThriftTest.exe
+
+# libs
+-lib uuid
 
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/test/haxe/flash.hxml b/test/haxe/flash.hxml
index a1f0568ad..e60515ea5 100644
--- a/test/haxe/flash.hxml
+++ b/test/haxe/flash.hxml
@@ -26,7 +26,10 @@
 -main Main
 
 #Flash target
--swf bin/Tutorial.swf
+-swf bin/ThriftTest.swf
+
+# libs
+-lib uuid
 
 #Add debug information
 -debug
@@ -35,7 +38,4 @@
 # --macro allowPackage("sys")
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/test/haxe/java.hxml b/test/haxe/java.hxml
index c615565a9..807a92a89 100644
--- a/test/haxe/java.hxml
+++ b/test/haxe/java.hxml
@@ -26,13 +26,13 @@
 -main Main
 
 #Java target
--java bin/Tutorial.jar
+-java bin/ThriftTest.jar
+
+# libs
+-lib uuid
 
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/test/haxe/javascript.hxml b/test/haxe/javascript.hxml
index b2b3876cf..892e84bab 100644
--- a/test/haxe/javascript.hxml
+++ b/test/haxe/javascript.hxml
@@ -26,7 +26,7 @@
 -main Main
 
 #JavaScript target
--js bin/Tutorial.js
+-js bin/ThriftTest.js
 
 #You can use -D source-map-content (requires Haxe 3.1+) to have the .hx 
 #files directly embedded into the map file, this way you only have to 
@@ -34,11 +34,11 @@
 #you modify your .hx files.
 -D source-map-content
 
+# libs
+-lib uuid
+
 #Generate source map and add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/test/haxe/neko.hxml b/test/haxe/neko.hxml
index 6161f6977..20c1ea64a 100644
--- a/test/haxe/neko.hxml
+++ b/test/haxe/neko.hxml
@@ -26,13 +26,13 @@
 -main Main
 
 #neko target
--neko bin/Tutorial.n
+-neko bin/ThriftTest.n
+
+# libs
+-lib uuid
 
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/test/haxe/php-web-server.hxml b/test/haxe/php-web-server.hxml
index 102ae97a3..4c121fb4a 100644
--- a/test/haxe/php-web-server.hxml
+++ b/test/haxe/php-web-server.hxml
@@ -39,7 +39,4 @@
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
diff --git a/test/haxe/php.hxml b/test/haxe/php.hxml
index 4edb86cf8..6d4422766 100644
--- a/test/haxe/php.hxml
+++ b/test/haxe/php.hxml
@@ -36,7 +36,4 @@
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
diff --git a/test/haxe/python.hxml b/test/haxe/python.hxml
index f2c19fa93..0079fdbe6 100644
--- a/test/haxe/python.hxml
+++ b/test/haxe/python.hxml
@@ -26,13 +26,13 @@
 -main Main
 
 #Python target
--python bin/Tutorial.py
+-python bin/ThriftTest.py
+
+# libs
+-lib uuid
 
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/test/haxe/src/TestClient.hx b/test/haxe/src/TestClient.hx
index 579dc00a1..3a075623c 100644
--- a/test/haxe/src/TestClient.hx
+++ b/test/haxe/src/TestClient.hx
@@ -27,6 +27,8 @@ import haxe.ds.IntMap;
 import haxe.ds.StringMap;
 import haxe.ds.ObjectMap;
 
+import uuid.Uuid;
+
 import org.apache.thrift.*;
 import org.apache.thrift.helper.*;
 import org.apache.thrift.protocol.*;
@@ -366,6 +368,14 @@ class TestClient {
             rslt.Expect( false, 'ZigZag.UnitTest: $e  Test #101');
         }
 
+        try {
+            UuidHelper.UnitTest();
+            rslt.Expect( true, 'UuidHelper.UnitTest  Test #102');
+        }
+        catch( e : Dynamic) {
+            rslt.Expect( false, 'UuidHelper.UnitTest: $e  Test #102');
+        }
+
         #end
     }
 
@@ -537,6 +547,19 @@ class TestClient {
         trace(' = $dub');
         rslt.Expect(dub == 5.325098235, '$dub == 5.325098235');
 
+
+		var uuidOut : String = UuidHelper.CanonicalUuid("{00112233-4455-6677-8899-AABBCCDDEEFF}");
+        trace('testUuid(${uuidOut}');
+        try {
+            var uuidIn = client.testUuid(uuidOut);
+            trace('testUuid() = ${uuidIn}');
+            rslt.Expect( uuidIn == uuidOut, '${uuidIn} == ${uuidOut}');
+        }
+        catch (e : TApplicationException) {
+            trace('testUuid(${uuidOut}): '+e.errorMsg);  // may not be supported by the server
+        }
+
+        
         var binOut = PrepareTestData(true);
         trace('testBinary('+BytesToHex(binOut)+')');
         try {
diff --git a/test/haxe/src/TestServerHandler.hx b/test/haxe/src/TestServerHandler.hx
index 0e1910560..34e471b93 100644
--- a/test/haxe/src/TestServerHandler.hx
+++ b/test/haxe/src/TestServerHandler.hx
@@ -25,6 +25,7 @@ import org.apache.thrift.transport.*;
 import org.apache.thrift.server.*;
 import org.apache.thrift.meta_data.*;
 import org.apache.thrift.helper.*;
+import uuid.Uuid;
 
 import haxe.Int32;
 import haxe.Int64;
@@ -146,6 +147,19 @@ class TestServerHandler implements ThriftTest_service {
         return thing;
     }
 
+    /**
+     * Prints 'testUuid("%s")' 
+     * @param Uuid  thing - the uuid to print
+     * @return Uuid  - returns the uuid 'thing'
+     *
+     * @param thing
+     */
+    public function testUuid(thing : String) : String
+    {
+        trace('testUuid($thing)');
+        return thing;
+    }
+
     /**
     * Prints 'testStruct("{%s}")' where thing has been formatted
     *  into a string of comma separated values
diff --git a/tutorial/haxe/cpp.hxml b/tutorial/haxe/cpp.hxml
index 6adb52d7e..1b581a924 100644
--- a/tutorial/haxe/cpp.hxml
+++ b/tutorial/haxe/cpp.hxml
@@ -31,11 +31,11 @@
 #To produce 64 bit binaries the file should define the HXCPP_M64 compile variable:
 #-D HXCPP_M64
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/tutorial/haxe/csharp.hxml b/tutorial/haxe/csharp.hxml
index 295c017e7..41d20adcc 100644
--- a/tutorial/haxe/csharp.hxml
+++ b/tutorial/haxe/csharp.hxml
@@ -28,11 +28,11 @@
 #CSHARP target
 -cs bin/Tutorial.exe
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/tutorial/haxe/flash.hxml b/tutorial/haxe/flash.hxml
index a1f0568ad..50c4a6046 100644
--- a/tutorial/haxe/flash.hxml
+++ b/tutorial/haxe/flash.hxml
@@ -28,6 +28,9 @@
 #Flash target
 -swf bin/Tutorial.swf
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
@@ -35,7 +38,4 @@
 # --macro allowPackage("sys")
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/tutorial/haxe/java.hxml b/tutorial/haxe/java.hxml
index c615565a9..1f810c7aa 100644
--- a/tutorial/haxe/java.hxml
+++ b/tutorial/haxe/java.hxml
@@ -28,11 +28,11 @@
 #Java target
 -java bin/Tutorial.jar
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/tutorial/haxe/javascript.hxml b/tutorial/haxe/javascript.hxml
index b2b3876cf..b9a39bbb0 100644
--- a/tutorial/haxe/javascript.hxml
+++ b/tutorial/haxe/javascript.hxml
@@ -34,11 +34,11 @@
 #you modify your .hx files.
 -D source-map-content
 
+# libs
+-lib uuid
+
 #Generate source map and add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/tutorial/haxe/neko.hxml b/tutorial/haxe/neko.hxml
index 6161f6977..00b055637 100644
--- a/tutorial/haxe/neko.hxml
+++ b/tutorial/haxe/neko.hxml
@@ -28,11 +28,11 @@
 #neko target
 -neko bin/Tutorial.n
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file
diff --git a/tutorial/haxe/php-web-server.hxml b/tutorial/haxe/php-web-server.hxml
index c6e9432a3..4961cfa58 100644
--- a/tutorial/haxe/php-web-server.hxml
+++ b/tutorial/haxe/php-web-server.hxml
@@ -39,7 +39,4 @@
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
diff --git a/tutorial/haxe/php.hxml b/tutorial/haxe/php.hxml
index 42bbf7424..847da3bd2 100644
--- a/tutorial/haxe/php.hxml
+++ b/tutorial/haxe/php.hxml
@@ -29,11 +29,11 @@
 -php bin/php/
 -D php-front=Main-debug.php
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
diff --git a/tutorial/haxe/python.hxml b/tutorial/haxe/python.hxml
index f2c19fa93..e5910428f 100644
--- a/tutorial/haxe/python.hxml
+++ b/tutorial/haxe/python.hxml
@@ -28,11 +28,11 @@
 #Python target
 -python bin/Tutorial.py
 
+# libs
+-lib uuid
+
 #Add debug information
 -debug
 
 #dead code elimination : remove unused code
-#"-dce no" : do not remove unused code
-#"-dce std" : remove unused code in the std lib (default)
-#"-dce full" : remove all unused code
 -dce full
\ No newline at end of file