diff options
42 files changed, 249 insertions, 96 deletions
diff --git a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc index fdd21f2a3..8893742d4 100644 --- a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc @@ -544,6 +544,9 @@ void t_haxe_generator::render_const_value(std::ostream& out, case t_base_type::TYPE_STRING: out << '"' << get_escaped_string(value) << '"'; break; + case t_base_type::TYPE_UUID: + out << '"' << get_escaped_string(value) << '"'; + break; case t_base_type::TYPE_BOOL: out << ((value->get_integer() > 0) ? "true" : "false"); break; @@ -1443,6 +1446,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; @@ -2222,6 +2228,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; @@ -2406,6 +2415,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; @@ -2651,6 +2663,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: @@ -2686,6 +2700,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; @@ -2795,6 +2812,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 da0c83450..4775ac42a 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/helper/UuidHelper.hx b/lib/haxe/src/org/apache/thrift/helper/UuidHelper.hx new file mode 100644 index 000000000..082a9d32e --- /dev/null +++ b/lib/haxe/src/org/apache/thrift/helper/UuidHelper.hx @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.thrift.helper; + +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 28e1a017e..04a25432d 100644 --- a/lib/haxe/test/cpp.hxml +++ b/lib/haxe/test/cpp.hxml @@ -36,11 +36,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/lib/haxe/test/csharp.hxml b/lib/haxe/test/csharp.hxml index 6ddfd0767..e406ce698 100644 --- a/lib/haxe/test/csharp.hxml +++ b/lib/haxe/test/csharp.hxml @@ -33,11 +33,11 @@ #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 130ab78d4..6df1f6177 100644 --- a/lib/haxe/test/flash.hxml +++ b/lib/haxe/test/flash.hxml @@ -33,11 +33,11 @@ #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 b72d99fb9..0b214d768 100644 --- a/lib/haxe/test/java.hxml +++ b/lib/haxe/test/java.hxml @@ -33,11 +33,11 @@ #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 496e780ba..ad21d162c 100644 --- a/lib/haxe/test/javascript.hxml +++ b/lib/haxe/test/javascript.hxml @@ -39,11 +39,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 eed22bd70..51de7786a 100644 --- a/lib/haxe/test/neko.hxml +++ b/lib/haxe/test/neko.hxml @@ -33,11 +33,11 @@ #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 3af54dab5..f94e6418f 100644 --- a/lib/haxe/test/php.hxml +++ b/lib/haxe/test/php.hxml @@ -34,11 +34,11 @@ -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 58eb3cb71..dbb48e220 100644 --- a/lib/haxe/test/python.hxml +++ b/lib/haxe/test/python.hxml @@ -33,11 +33,11 @@ #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/lib/haxe/test/src/Main.hx b/lib/haxe/test/src/Main.hx index e04af78b0..5976bb087 100644 --- a/lib/haxe/test/src/Main.hx +++ b/lib/haxe/test/src/Main.hx @@ -76,9 +76,13 @@ class Main switch( tests) { case Normal: + #if sys StreamTest.Run(server); + #end case Multiplex: + #if ! (flash || html5 || js) MultiplexTest.Run(server); + #end case Constants: ConstantsTest.Run(server); default: diff --git a/lib/haxe/test/src/MultiplexTest.hx b/lib/haxe/test/src/MultiplexTest.hx index 74fa357fe..a17bf1589 100644 --- a/lib/haxe/test/src/MultiplexTest.hx +++ b/lib/haxe/test/src/MultiplexTest.hx @@ -19,6 +19,8 @@ package; +#if ! (flash || html5 || js) + import haxe.Int64; import haxe.Int32; @@ -42,7 +44,6 @@ import BenchmarkServiceImpl; import BenchmarkServiceProcessor; import Error; - class BenchmarkServiceHandler implements BenchmarkService_service { public function new() { @@ -221,4 +222,5 @@ class MultiplexTest extends TestBase { } +#end diff --git a/lib/haxe/test/src/StreamTest.hx b/lib/haxe/test/src/StreamTest.hx index 4744272a5..3e70adaf5 100644 --- a/lib/haxe/test/src/StreamTest.hx +++ b/lib/haxe/test/src/StreamTest.hx @@ -18,6 +18,7 @@ */ package; +#if sys import haxe.Int64; import sys.FileSystem; @@ -95,3 +96,4 @@ class StreamTest extends TestBase { } +#end 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; @@ -147,6 +148,19 @@ class TestServerHandler implements ThriftTest_service { } /** + * 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 * @param Xtruct thing - the Xtruct to print 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 |