Browse Source

Hash -> haxe.ds.StringMap

Simon Krajewski 12 years ago
parent
commit
3348f996d8
59 changed files with 692 additions and 192 deletions
  1. 1 1
      interp.ml
  2. 1 1
      parser.ml
  3. 3 3
      std/Map.hx
  4. 1 1
      std/Sys.hx
  5. 2 2
      std/cpp/_std/Sys.hx
  6. 3 1
      std/cpp/_std/haxe/ds/StringMap.hx
  7. 1 1
      std/cs/_std/Hash.hx
  8. 3 3
      std/cs/_std/Sys.hx
  9. 2 2
      std/cs/_std/Xml.hx
  10. 488 0
      std/cs/_std/haxe/ds/StringMap.hx
  11. 3 1
      std/flash/_std/haxe/ds/StringMap.hx
  12. 3 1
      std/flash8/_std/haxe/ds/StringMap.hx
  13. 26 26
      std/haxe/Http.hx
  14. 3 3
      std/haxe/Json.hx
  15. 11 11
      std/haxe/Resource.hx
  16. 4 4
      std/haxe/Serializer.hx
  17. 1 1
      std/haxe/Unserializer.hx
  18. 4 1
      std/haxe/ds/StringMap.hx
  19. 2 2
      std/haxe/macro/Compiler.hx
  20. 6 6
      std/haxe/macro/Context.hx
  21. 4 4
      std/haxe/macro/ExampleJSGenerator.hx
  22. 1 1
      std/haxe/macro/Type.hx
  23. 2 2
      std/haxe/remoting/Context.hx
  24. 1 1
      std/haxe/remoting/ExternalConnection.hx
  25. 1 1
      std/haxe/remoting/FlashJsConnection.hx
  26. 1 1
      std/haxe/rtti/CType.hx
  27. 1 1
      std/haxe/rtti/XmlParser.hx
  28. 3 3
      std/haxe/web/Dispatch.hx
  29. 3 3
      std/haxe/web/Request.hx
  30. 1 1
      std/haxe/xml/Proxy.hx
  31. 3 3
      std/java/_std/Sys.hx
  32. 2 2
      std/java/_std/Xml.hx
  33. 3 25
      std/java/_std/haxe/ds/StringMap.hx
  34. 2 2
      std/js/Cookie.hx
  35. 2 2
      std/js/_std/Xml.hx
  36. 3 1
      std/js/_std/haxe/ds/StringMap.hx
  37. 4 4
      std/neko/Web.hx
  38. 2 2
      std/neko/_std/Sys.hx
  39. 3 1
      std/neko/_std/haxe/ds/StringMap.hx
  40. 3 3
      std/neko/db/Manager.hx
  41. 2 2
      std/neko/vm/Loader.hx
  42. 2 2
      std/neko/vm/Module.hx
  43. 5 5
      std/php/Lib.hx
  44. 7 7
      std/php/Web.hx
  45. 1 1
      std/php/_std/Sys.hx
  46. 2 2
      std/php/_std/Xml.hx
  47. 3 1
      std/php/_std/haxe/ds/StringMap.hx
  48. 3 3
      std/php/db/Manager.hx
  49. 2 2
      std/sys/db/Manager.hx
  50. 1 1
      std/sys/db/SpodInfos.hx
  51. 11 11
      std/sys/db/SpodMacros.hx
  52. 7 7
      tests/unit/MyAbstract.hx
  53. 4 4
      tests/unit/TestBasetypes.hx
  54. 6 6
      tests/unit/TestReflect.hx
  55. 2 2
      tests/unit/TestSerialize.hx
  56. 1 1
      tests/unit/TestType.hx
  57. 1 1
      tests/unit/compile.hxml
  58. 14 0
      tests/unit/unitstd/IntIterator.hx
  59. 5 0
      tests/unit/unitstd/haxe/macro/ComplexTypeTools.macro.unit.hx

+ 1 - 1
interp.ml

@@ -3438,7 +3438,7 @@ let enc_array l =
 	]
 	]
 
 
 let enc_string s =
 let enc_string s =
-	enc_inst ["String"] [
+	enc_inst ["haxe";"ds";"String"] [
 		"__s", VString s;
 		"__s", VString s;
 		"length", VInt (String.length s)
 		"length", VInt (String.length s)
 	]
 	]

+ 1 - 1
parser.ml

@@ -253,7 +253,7 @@ and parse_type_decl s =
 				d_flags = flags @ sl;
 				d_flags = flags @ sl;
 				d_data = fl;
 				d_data = fl;
 			},punion p1 p2)
 			},punion p1 p2)
-			
+
 and parse_class meta cflags need_name s =
 and parse_class meta cflags need_name s =
 	let opt_name = if need_name then type_name else (fun s -> match popt type_name s with None -> "" | Some n -> n) in
 	let opt_name = if need_name then type_name else (fun s -> match popt type_name s with None -> "" | Some n -> n) in
 	match s with parser
 	match s with parser

+ 3 - 3
std/Map.hx

@@ -11,14 +11,14 @@ typedef IMap < K, V > = {
 abstract Map(IMap < K, V > )<K,V> {
 abstract Map(IMap < K, V > )<K,V> {
 	public function new();
 	public function new();
 
 
-	@:to static inline function toHash(t:IMap < String, V > ):Hash<V> {
-		return new Hash<V>();
+	@:to static inline function toHash(t:IMap < String, V > ):haxe.ds.StringMap<V> {
+		return new haxe.ds.StringMap<V>();
 	}
 	}
 
 
 	@:to static inline function toIntHash(t:IMap < Int, V > ):haxe.ds.IntMap<V> {
 	@:to static inline function toIntHash(t:IMap < Int, V > ):haxe.ds.IntMap<V> {
 		return new haxe.ds.IntMap<V>();
 		return new haxe.ds.IntMap<V>();
 	}
 	}
-	
+
 	@:to static inline function toHashMap<K:{ function hashCode():Int; }>(t:IMap < K, V >):haxe.ds.HashMap<K,V> {
 	@:to static inline function toHashMap<K:{ function hashCode():Int; }>(t:IMap < K, V >):haxe.ds.HashMap<K,V> {
 		return new haxe.ds.HashMap<K, V>();
 		return new haxe.ds.HashMap<K, V>();
 	}
 	}

+ 1 - 1
std/Sys.hx

@@ -53,7 +53,7 @@ extern class Sys {
 	/**
 	/**
 		Returns the whole environement variables.
 		Returns the whole environement variables.
 	**/
 	**/
-	static function environment() : Hash<String>;
+	static function environment() : haxe.ds.StringMap<String>;
 
 
 	/**
 	/**
 		Suspend the current execution for the given time (in seconds).
 		Suspend the current execution for the given time (in seconds).

+ 2 - 2
std/cpp/_std/Sys.hx

@@ -120,9 +120,9 @@
 		return new String(sys_exe_path());
 		return new String(sys_exe_path());
 	}
 	}
 
 
-	public static function environment() : Hash<String> {
+	public static function environment() : haxe.ds.StringMap<String> {
 		var vars:Array<String> = sys_env();
 		var vars:Array<String> = sys_env();
-		var result = new Hash<String>();
+		var result = new haxe.ds.StringMap<String>();
 		var i = 0;
 		var i = 0;
 		while(i<vars.length) {
 		while(i<vars.length) {
 			result.set( vars[i], vars[i+1] );
 			result.set( vars[i], vars[i+1] );

+ 3 - 1
std/cpp/_std/Hash.hx → std/cpp/_std/haxe/ds/StringMap.hx

@@ -19,7 +19,9 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
-@:coreApi class Hash<T>  {
+package haxe.ds;
+
+@:coreApi class StringMap<T>  {
 	private var __Internal : Dynamic;
 	private var __Internal : Dynamic;
 
 
 	public function new() : Void {
 	public function new() : Void {

+ 1 - 1
std/cs/_std/Hash.hx

@@ -45,7 +45,7 @@ import cs.NativeArray;
  * DAMAGE.
  * DAMAGE.
  */
  */
 
 
-@:coreApi class Hash<T>
+@:coreApi class StringMap<T>
 {
 {
 	@:extern private static inline var HASH_UPPER = 0.77;
 	@:extern private static inline var HASH_UPPER = 0.77;
 	@:extern private static inline var FLAG_EMPTY = 0;
 	@:extern private static inline var FLAG_EMPTY = 0;

+ 3 - 3
std/cs/_std/Sys.hx

@@ -52,7 +52,7 @@ import cs.system.threading.Thread;
 **/
 **/
 @:coreApi
 @:coreApi
 class Sys {
 class Sys {
-	private static var _env:Hash<String>;
+	private static var _env:haxe.ds.StringMap<String>;
 	private static var _args:Array<String>;
 	private static var _args:Array<String>;
 
 
 	/**
 	/**
@@ -106,11 +106,11 @@ class Sys {
 	/**
 	/**
 		Returns the whole environement variables.
 		Returns the whole environement variables.
 	**/
 	**/
-	public static function environment() : Hash<String>
+	public static function environment() : haxe.ds.StringMap<String>
 	{
 	{
 		if (_env == null)
 		if (_env == null)
 		{
 		{
-			var e = _env = new Hash();
+			var e = _env = new haxe.ds.StringMap();
 			var nenv = Environment.GetEnvironmentVariables().GetEnumerator();
 			var nenv = Environment.GetEnvironmentVariables().GetEnumerator();
 			while (nenv.MoveNext())
 			while (nenv.MoveNext())
 			{
 			{

+ 2 - 2
std/cs/_std/Xml.hx

@@ -50,7 +50,7 @@ private enum RealXmlType {
 
 
 	var _nodeName : String;
 	var _nodeName : String;
 	var _nodeValue : String;
 	var _nodeValue : String;
-	var _attributes : Hash<String>;
+	var _attributes : haxe.ds.StringMap<String>;
 	var _children : Array<Xml>;
 	var _children : Array<Xml>;
 	var _parent : Xml;
 	var _parent : Xml;
 
 
@@ -65,7 +65,7 @@ private enum RealXmlType {
 		var r = new Xml();
 		var r = new Xml();
 		r.nodeType = Xml.Element;
 		r.nodeType = Xml.Element;
 		r._children = new Array();
 		r._children = new Array();
-		r._attributes = new Hash();
+		r._attributes = new haxe.ds.StringMap();
 		r.set_nodeName( name );
 		r.set_nodeName( name );
 		return r;
 		return r;
 	}
 	}

+ 488 - 0
std/cs/_std/haxe/ds/StringMap.hx

@@ -0,0 +1,488 @@
+/*
+ * Copyright (C)2005-2012 Haxe Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+package haxe.ds;
+
+import cs.NativeArray;
+
+@:coreApi class StringMap<T>
+{
+	@:extern private static inline var HASH_UPPER = 0.77;
+	@:extern private static inline var FLAG_EMPTY = 0;
+	@:extern private static inline var FLAG_DEL = 1;
+
+	/**
+	 * This is the most important structure here and the reason why it's so fast.
+	 * It's an array of all the hashes contained in the table. These hashes cannot be 0 nor 1,
+	 * which stand for "empty" and "deleted" states.
+	 *
+	 * The lookup algorithm will keep looking until a 0 or the key wanted is found;
+	 * The insertion algorithm will do the same but will also break when FLAG_DEL is found;
+	 */
+	private var hashes:NativeArray<HashType>;
+	private var _keys:NativeArray<String>;
+	private var vals:NativeArray<T>;
+
+	private var nBuckets:Int;
+	private var size:Int;
+	private var nOccupied:Int;
+	private var upperBound:Int;
+
+	private var cachedKey:String;
+	private var cachedIndex:Int;
+
+#if DEBUG_HASHTBL
+	private var totalProbes:Int;
+	private var probeTimes:Int;
+	private var sameHash:Int;
+	private var maxProbe:Int;
+#end
+
+	public function new() : Void
+	{
+		cachedIndex = -1;
+	}
+
+	public function set( key : String, value : T ) : Void
+	{
+		var x:Int, k:Int;
+		if (nOccupied >= upperBound)
+		{
+			if (nBuckets > (size << 1))
+				resize(nBuckets - 1); //clear "deleted" elements
+			else
+				resize(nBuckets + 2);
+		}
+
+		var hashes = hashes, keys = _keys, hashes = hashes;
+		{
+			var mask = (nBuckets == 0) ? 0 : nBuckets - 1;
+			var site = x = nBuckets;
+			k = hash(key);
+			var i = k & mask, nProbes = 0;
+
+			//for speed up
+			if (isEither(hashes[i])) {
+				x = i;
+			} else {
+				//var inc = getInc(k, mask);
+				var last = i, flag;
+				while(! (isEither(flag = hashes[i]) || (flag == k && _keys[i] == key)) )
+				{
+					i = (i + ++nProbes) & mask;
+#if DEBUG_HASHTBL
+					probeTimes++;
+					if (i == last)
+						throw "assert";
+#end
+				}
+				x = i;
+			}
+
+#if DEBUG_HASHTBL
+			if (nProbes > maxProbe)
+				maxProbe = nProbes;
+			totalProbes++;
+#end
+		}
+
+		var flag = hashes[x];
+		if (isEmpty(flag))
+		{
+			keys[x] = key;
+			vals[x] = value;
+			hashes[x] = k;
+			size++;
+			nOccupied++;
+		} else if (isDel(flag)) {
+			keys[x] = key;
+			vals[x] = value;
+			hashes[x] = k;
+			size++;
+		} else {
+			assert(_keys[x] == key);
+			vals[x] = value;
+		}
+
+		cachedIndex = x;
+		cachedKey = key;
+	}
+
+	@:final private function lookup( key : String ) : Int
+	{
+		if (nBuckets != 0)
+		{
+			var hashes = hashes, keys = _keys;
+
+			var mask = nBuckets - 1, hash = hash(key), k = hash, nProbes = 0;
+			var i = k & mask;
+			var last = i, flag;
+			//var inc = getInc(k, mask);
+			while (!isEmpty(flag = hashes[i]) && (isDel(flag) || flag != k || keys[i] != key))
+			{
+				i = (i + ++nProbes) & mask;
+#if DEBUG_HASHTBL
+				probeTimes++;
+				if (i == last)
+					throw "assert";
+#end
+			}
+
+#if DEBUG_HASHTBL
+			if (nProbes > maxProbe)
+				maxProbe = nProbes;
+			totalProbes++;
+#end
+			return isEither(flag) ? -1 : i;
+		}
+
+		return -1;
+	}
+
+	@:final @:private function resize(newNBuckets:Int) : Void
+	{
+		//This function uses 0.25*n_bucktes bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets.
+		var newHash = null;
+		var j = 1;
+		{
+			newNBuckets = roundUp(newNBuckets);
+			if (newNBuckets < 4) newNBuckets = 4;
+			if (size >= (newNBuckets * HASH_UPPER + 0.5)) /* requested size is too small */
+			{
+				j = 0;
+			} else { /* hash table size to be changed (shrink or expand); rehash */
+				var nfSize = newNBuckets;
+				newHash = new NativeArray( nfSize );
+				if (nBuckets < newNBuckets) //expand
+				{
+					var k = new NativeArray(newNBuckets);
+					if (_keys != null)
+						arrayCopy(_keys, 0, k, 0, nBuckets);
+					_keys = k;
+
+					var v = new NativeArray(newNBuckets);
+					if (vals != null)
+						arrayCopy(vals, 0, v, 0, nBuckets);
+					vals = v;
+				} //otherwise shrink
+			}
+		}
+
+		if (j != 0)
+		{ //rehashing is required
+			//resetting cache
+			cachedKey = null;
+			cachedIndex = -1;
+
+			j = -1;
+			var nBuckets = nBuckets, _keys = _keys, vals = vals, hashes = hashes;
+
+			var newMask = newNBuckets - 1;
+			while (++j < nBuckets)
+			{
+				var k;
+				if (!isEither(k = hashes[j]))
+				{
+					var key = _keys[j];
+					var val = vals[j];
+
+					hashes[j] = FLAG_DEL;
+					while (true) /* kick-out process; sort of like in Cuckoo hashing */
+					{
+						var nProbes = 0;
+						//var inc = getInc(k, newMask);
+						var i = k & newMask;
+
+						while (!isEmpty(newHash[i]))
+							i = (i + ++nProbes) & newMask;
+
+						newHash[i] = k;
+
+						if (i < nBuckets && !isEither(k = hashes[i])) /* kick out the existing element */
+						{
+							{
+								var tmp = _keys[i];
+								_keys[i] = key;
+								key = tmp;
+							}
+							{
+								var tmp = vals[i];
+								vals[i] = val;
+								val = tmp;
+							}
+
+							hashes[i] = FLAG_DEL; /* mark it as deleted in the old hash table */
+						} else { /* write the element and jump out of the loop */
+							_keys[i] = key;
+							vals[i] = val;
+							break;
+						}
+					}
+				}
+			}
+
+			if (nBuckets > newNBuckets) /* shrink the hash table */
+			{
+				{
+					var k = new NativeArray(newNBuckets);
+					arrayCopy(_keys, 0, k, 0, newNBuckets);
+					this._keys = k;
+				}
+				{
+					var v = new NativeArray(newNBuckets);
+					arrayCopy(vals, 0, v, 0, newNBuckets);
+					this.vals = v;
+				}
+			}
+
+			this.hashes = newHash;
+			this.nBuckets = newNBuckets;
+			this.nOccupied = size;
+			this.upperBound = Std.int(newNBuckets * HASH_UPPER + .5);
+		}
+	}
+
+	public function get( key : String ) : Null<T>
+	{
+		var idx = -1;
+		if (cachedKey == key && ( (idx = cachedIndex) != -1 ))
+		{
+			return vals[idx];
+		}
+
+		idx = lookup(key);
+		if (idx != -1)
+		{
+			cachedKey = key;
+			cachedIndex = idx;
+
+			return vals[idx];
+		}
+
+		return null;
+	}
+
+	private function getDefault( key : String, def : T ) : T
+	{
+		var idx = -1;
+		if (cachedKey == key && ( (idx = cachedIndex) != -1 ))
+		{
+			return vals[idx];
+		}
+
+		idx = lookup(key);
+		if (idx != -1)
+		{
+			cachedKey = key;
+			cachedIndex = idx;
+
+			return vals[idx];
+		}
+
+		return def;
+	}
+
+	public function exists( key : String ) : Bool
+	{
+		var idx = -1;
+		if (cachedKey == key && ( (idx = cachedIndex) != -1 ))
+		{
+			return true;
+		}
+
+		idx = lookup(key);
+		if (idx != -1)
+		{
+			cachedKey = key;
+			cachedIndex = idx;
+
+			return true;
+		}
+
+		return false;
+	}
+
+	public function remove( key : String ) : Bool
+	{
+		var idx = -1;
+		if (! (cachedKey == key && ( (idx = cachedIndex) != -1 )))
+		{
+			idx = lookup(key);
+		}
+
+		if (idx == -1)
+		{
+			return false;
+		} else {
+			if (cachedKey == key)
+				cachedIndex = -1;
+
+			hashes[idx] = FLAG_EMPTY;
+			_keys[idx] = null;
+			vals[idx] = null;
+			--size;
+
+			return true;
+		}
+	}
+
+	/**
+		Returns an iterator of all keys in the hashtable.
+		Implementation detail: Do not set() any new value while iterating, as it may cause a resize, which will break iteration
+	**/
+	public function keys() : Iterator<String>
+	{
+		var i = 0;
+		var len = nBuckets;
+		return {
+			hasNext: function() {
+				for (j in i...len)
+				{
+					if (!isEither(hashes[j]))
+					{
+						i = j;
+						return true;
+					}
+				}
+				return false;
+			},
+			next: function() {
+				var ret = _keys[i];
+				cachedIndex = i;
+				cachedKey = ret;
+
+				i = i + 1;
+				return ret;
+			}
+		};
+	}
+
+	/**
+		Returns an iterator of all values in the hashtable.
+		Implementation detail: Do not set() any new value while iterating, as it may cause a resize, which will break iteration
+	**/
+	public function iterator() : Iterator<T>
+	{
+		var i = 0;
+		var len = nBuckets;
+		return {
+			hasNext: function() {
+				for (j in i...len)
+				{
+					if (!isEither(hashes[j]))
+					{
+						i = j;
+						return true;
+					}
+				}
+				return false;
+			},
+			next: function() {
+				var ret = vals[i];
+				i = i + 1;
+				return ret;
+			}
+		};
+	}
+
+	/**
+		Returns an displayable representation of the hashtable content.
+	**/
+
+	public function toString() : String {
+		var s = new StringBuf();
+		s.add("{");
+		var it = keys();
+		for( i in it ) {
+			s.add(i);
+			s.add(" => ");
+			s.add(Std.string(get(i)));
+			if( it.hasNext() )
+				s.add(", ");
+		}
+		s.add("}");
+		return s.toString();
+	}
+
+	@:extern private static inline function roundUp(x:Int):Int
+	{
+		--x;
+		x |= (x) >>> 1;
+		x |= (x) >>> 2;
+		x |= (x) >>> 4;
+		x |= (x) >>> 8;
+		x |= (x) >>> 16;
+		return ++x;
+	}
+
+	@:extern private static inline function getInc(k:Int, mask:Int):Int //return 1 for linear probing
+		return (((k) >> 3 ^ (k) << 3) | 1) & (mask)
+
+	@:extern private static inline function isEither(v:HashType):Bool
+		return (v & 0xFFFFFFFE) == 0
+
+	@:extern private static inline function isEmpty(v:HashType):Bool
+		return v == FLAG_EMPTY
+
+	@:extern private static inline function isDel(v:HashType):Bool
+		return v == FLAG_DEL
+
+	//guarantee: Whatever this function is, it will never return 0 nor 1
+	@:extern private static inline function hash(s:String):HashType
+	{
+		var k:Int = untyped s.GetHashCode();
+		//k *= 357913941;
+		//k ^= k << 24;
+		//k += ~357913941;
+		//k ^= k >> 31;
+		//k ^= k << 31;
+
+		k = (k+0x7ed55d16) + (k<<12);
+		k = (k^0xc761c23c) ^ (k>>19);
+		k = (k+0x165667b1) + (k<<5);
+		k = (k+0xd3a2646c) ^ (k<<9);
+		k = (k+0xfd7046c5) + (k<<3);
+		k = (k^0xb55a4f09) ^ (k>>16);
+
+		var ret = k;
+		if (isEither(ret))
+		{
+			if (ret == 0)
+				ret = 2;
+			else
+				ret = 0xFFFFFFFF;
+		}
+
+		return ret;
+	}
+
+	@:extern private static inline function arrayCopy(sourceArray:cs.system.Array, sourceIndex:Int, destinationArray:cs.system.Array, destinationIndex:Int, length:Int):Void
+		cs.system.Array.Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length)
+
+	@:extern private static inline function assert(x:Bool):Void
+	{
+#if DEBUG_HASHTBL
+		if (!x) throw "assert failed";
+#end
+	}
+}
+
+private typedef HashType = Int;

+ 3 - 1
std/flash/_std/Hash.hx → std/flash/_std/haxe/ds/StringMap.hx

@@ -19,7 +19,9 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
-@:coreApi class Hash<T> {
+package haxe.ds;
+
+@:coreApi class StringMap<T> {
 
 
 	private var h :flash.utils.Dictionary;
 	private var h :flash.utils.Dictionary;
 
 

+ 3 - 1
std/flash8/_std/Hash.hx → std/flash8/_std/haxe/ds/StringMap.hx

@@ -19,7 +19,9 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
-@:coreApi class Hash<T> {
+package haxe.ds;
+
+@:coreApi class StringMap<T> {
 
 
 	private var h : Dynamic;
 	private var h : Dynamic;
 
 

+ 26 - 26
std/haxe/Http.hx

@@ -57,7 +57,7 @@ class Http {
 #if sys
 #if sys
 	public var noShutdown : Bool;
 	public var noShutdown : Bool;
 	public var cnxTimeout : Float;
 	public var cnxTimeout : Float;
-	public var responseHeaders : Hash<String>;
+	public var responseHeaders : haxe.ds.StringMap<String>;
 	var chunk_size : Null<Int>;
 	var chunk_size : Null<Int>;
 	var chunk_buf : haxe.io.Bytes;
 	var chunk_buf : haxe.io.Bytes;
 	var file : { param : String, filename : String, io : haxe.io.Input, size : Int };
 	var file : { param : String, filename : String, io : haxe.io.Input, size : Int };
@@ -65,8 +65,8 @@ class Http {
 	public var async : Bool;
 	public var async : Bool;
 #end
 #end
 	var postData : String;
 	var postData : String;
-	var headers : Hash<String>;
-	var params : Hash<String>;
+	var headers : haxe.ds.StringMap<String>;
+	var params : haxe.ds.StringMap<String>;
 
 
 	#if sys
 	#if sys
 	public static var PROXY : { host : String, port : Int, auth : { user : String, pass : String } } = null;
 	public static var PROXY : { host : String, port : Int, auth : { user : String, pass : String } } = null;
@@ -74,19 +74,19 @@ class Http {
 
 
 	/**
 	/**
 		Creates a new Http instance with [url] as parameter.
 		Creates a new Http instance with [url] as parameter.
-		
+
 		This does not do a request until request() is called.
 		This does not do a request until request() is called.
-		
+
 		If [url] is null, the field url must be set to a value before making the
 		If [url] is null, the field url must be set to a value before making the
 		call to request(), or the result is unspecified.
 		call to request(), or the result is unspecified.
-		
+
 		(Php) Https (SSL) connections are allowed only if the OpenSSL extension
 		(Php) Https (SSL) connections are allowed only if the OpenSSL extension
 		is enabled.
 		is enabled.
 	**/
 	**/
 	public function new( url : String ) {
 	public function new( url : String ) {
 		this.url = url;
 		this.url = url;
-		headers = new Hash();
-		params = new Hash();
+		headers = new haxe.ds.StringMap();
+		params = new haxe.ds.StringMap();
 		#if js
 		#if js
 		async = true;
 		async = true;
 		#elseif sys
 		#elseif sys
@@ -99,9 +99,9 @@ class Http {
 
 
 	/**
 	/**
 		Sets the header identified as [header] to value [value].
 		Sets the header identified as [header] to value [value].
-		
+
 		If [header] or [value] are null, the result is unspecified.
 		If [header] or [value] are null, the result is unspecified.
-		
+
 		This method provides a fluent interface.
 		This method provides a fluent interface.
 	**/
 	**/
 	public function setHeader( header : String, value : String ):Http {
 	public function setHeader( header : String, value : String ):Http {
@@ -111,9 +111,9 @@ class Http {
 
 
 	/**
 	/**
 		Sets the parameter identified as [param] to value [value].
 		Sets the parameter identified as [param] to value [value].
-		
+
 		If [header] or [value] are null, the result is unspecified.
 		If [header] or [value] are null, the result is unspecified.
-		
+
 		This method provides a fluent interface.
 		This method provides a fluent interface.
 	**/
 	**/
 	public function setParameter( param : String, value : String ):Http {
 	public function setParameter( param : String, value : String ):Http {
@@ -124,12 +124,12 @@ class Http {
 	#if !flash8
 	#if !flash8
 	/**
 	/**
 		Sets the post data of [this] Http request to [data].
 		Sets the post data of [this] Http request to [data].
-		
+
 		There can only be one post data per request. Subsequent calls overwrite
 		There can only be one post data per request. Subsequent calls overwrite
 		the previously set value.
 		the previously set value.
-		
+
 		If [data] is null, the post data is considered to be absent.
 		If [data] is null, the post data is considered to be absent.
-		
+
 		This method provides a fluent interface.
 		This method provides a fluent interface.
 	**/
 	**/
 	public function setPostData( data : String ):Http {
 	public function setPostData( data : String ):Http {
@@ -140,18 +140,18 @@ class Http {
 
 
 	/**
 	/**
 		Sends [this] Http request to the Url specified by [this].url.
 		Sends [this] Http request to the Url specified by [this].url.
-		
+
 		If [post] is true, the request is sent as POST request, otherwise it is
 		If [post] is true, the request is sent as POST request, otherwise it is
 		sent as GET request.
 		sent as GET request.
-		
+
 		Depending on the outcome of the request, this method calls the
 		Depending on the outcome of the request, this method calls the
 		onStatus(), onError() or onData() callback functions.
 		onStatus(), onError() or onData() callback functions.
-		
+
 		If [this].url is null, the result is unspecified.
 		If [this].url is null, the result is unspecified.
-		
+
 		If [this].url is an invalid or inaccessible Url, the onError() callback
 		If [this].url is an invalid or inaccessible Url, the onError() callback
 		function is called.
 		function is called.
-		
+
 		(Js) If [this].async is false, the callback functions are called before
 		(Js) If [this].async is false, the callback functions are called before
 		this method returns.
 		this method returns.
 	**/
 	**/
@@ -559,7 +559,7 @@ class Http {
 		// remove the two lasts \r\n\r\n
 		// remove the two lasts \r\n\r\n
 		headers.pop();
 		headers.pop();
 		headers.pop();
 		headers.pop();
-		responseHeaders = new Hash();
+		responseHeaders = new haxe.ds.StringMap();
 		var size = null;
 		var size = null;
 		var chunked = false;
 		var chunked = false;
 		for( hline in headers ) {
 		for( hline in headers ) {
@@ -683,7 +683,7 @@ class Http {
 	/**
 	/**
 		This method is called upon a successful request, with [data] containing
 		This method is called upon a successful request, with [data] containing
 		the result String.
 		the result String.
-		
+
 		The intended usage is to bind it to a custom function:
 		The intended usage is to bind it to a custom function:
 			httpInstance.onData = function(data) { // handle result }
 			httpInstance.onData = function(data) { // handle result }
 	**/
 	**/
@@ -693,7 +693,7 @@ class Http {
 	/**
 	/**
 		This method is called upon a request error, with [msg] containing the
 		This method is called upon a request error, with [msg] containing the
 		error description.
 		error description.
-		
+
 		The intended usage is to bind it to a custom function:
 		The intended usage is to bind it to a custom function:
 			httpInstance.onError = function(msg) { // handle error }
 			httpInstance.onError = function(msg) { // handle error }
 	**/
 	**/
@@ -703,7 +703,7 @@ class Http {
 	/**
 	/**
 		This method is called upon a Http status change, with [status] being the
 		This method is called upon a Http status change, with [status] being the
 		new status.
 		new status.
-		
+
 		The intended usage is to bind it to a custom function:
 		The intended usage is to bind it to a custom function:
 			httpInstance.onStatus = function(status) { // handle status }
 			httpInstance.onStatus = function(status) { // handle status }
 	**/
 	**/
@@ -713,10 +713,10 @@ class Http {
 #if !flash
 #if !flash
 	/**
 	/**
 		Makes a synchronous request to [url].
 		Makes a synchronous request to [url].
-		
+
 		This creates a new Http instance and makes a GET request by calling its
 		This creates a new Http instance and makes a GET request by calling its
 		request(false) method.
 		request(false) method.
-		
+
 		If [url] is null, the result is unspecified.
 		If [url] is null, the result is unspecified.
 	**/
 	**/
 	public static function requestUrl( url : String ) : String {
 	public static function requestUrl( url : String ) : String {

+ 3 - 3
std/haxe/Json.hx

@@ -121,8 +121,8 @@ class Json {
 					}
 					}
 				}
 				}
 				addChar(']'.code);
 				addChar(']'.code);
-			} else if( c == Hash ) {
-				var v : Hash<Dynamic> = v;
+			} else if( c == haxe.ds.StringMap ) {
+				var v : haxe.ds.StringMap<Dynamic> = v;
 				var o = {};
 				var o = {};
 				for( k in v.keys() )
 				for( k in v.keys() )
 					Reflect.setField(o,k,v.get(k));
 					Reflect.setField(o,k,v.get(k));
@@ -457,7 +457,7 @@ class Json {
 				case "Date" : return Std.string(val); //.split(" ").join("T"); //better with "T"?
 				case "Date" : return Std.string(val); //.split(" ").join("T"); //better with "T"?
 				case "HList" : arr = php.Lib.toPhpArray(Lambda.array(val)); //convert List to array?
 				case "HList" : arr = php.Lib.toPhpArray(Lambda.array(val)); //convert List to array?
 				case "_hx_enum" : return Type.enumIndex(val);
 				case "_hx_enum" : return Type.enumIndex(val);
-				case "Hash", "IntMap" : arr = php.Lib.associativeArrayOfHash(val);
+				case "StringMap", "IntMap" : arr = php.Lib.associativeArrayOfHash(val);
 				default : arr = php.Lib.associativeArrayOfObject(val);
 				default : arr = php.Lib.associativeArrayOfObject(val);
 			}
 			}
 		}
 		}

+ 11 - 11
std/haxe/Resource.hx

@@ -24,28 +24,28 @@ package haxe;
 /**
 /**
 	Resource can be used to access resources that were added through the
 	Resource can be used to access resources that were added through the
 	-resource file@name command line parameter.
 	-resource file@name command line parameter.
-	
+
 	Depending on their type they can be obtained as String through
 	Depending on their type they can be obtained as String through
 	getString(name), or as binary data through getBytes(name).
 	getString(name), or as binary data through getBytes(name).
-	
+
 	A list of all available resource names can be obtained from listNames().
 	A list of all available resource names can be obtained from listNames().
 **/
 **/
 class Resource {
 class Resource {
-	
+
 	#if (java || cs)
 	#if (java || cs)
 	static var content : Array<String>;
 	static var content : Array<String>;
 	#else
 	#else
 	static var content : Array<{ name : String, data : String, str : String }>;
 	static var content : Array<{ name : String, data : String, str : String }>;
 	#end
 	#end
-	
+
 	#if cs
 	#if cs
-	static var paths : Hash<String>;
-	
-	#if cs @:keep #end private static function getPaths():Hash<String>
+	static var paths : haxe.ds.StringMap<String>;
+
+	#if cs @:keep #end private static function getPaths():haxe.ds.StringMap<String>
 	{
 	{
 		if (paths != null)
 		if (paths != null)
 			return paths;
 			return paths;
-		var p = new Hash();
+		var p = new haxe.ds.StringMap();
 		var all:cs.NativeArray<String> = untyped __cs__("typeof(haxe.Resource).Assembly.GetManifestResourceNames()");
 		var all:cs.NativeArray<String> = untyped __cs__("typeof(haxe.Resource).Assembly.GetManifestResourceNames()");
 		for (i in 0...all.Length)
 		for (i in 0...all.Length)
 		{
 		{
@@ -53,7 +53,7 @@ class Resource {
 			var name = path.substr(path.indexOf("Resources.") + 10);
 			var name = path.substr(path.indexOf("Resources.") + 10);
 			p.set(name, path);
 			p.set(name, path);
 		}
 		}
-		
+
 		return paths = p;
 		return paths = p;
 	}
 	}
 	#end
 	#end
@@ -76,7 +76,7 @@ class Resource {
 
 
 	/**
 	/**
 		Retrieves the resource identified by [name] as a String.
 		Retrieves the resource identified by [name] as a String.
-		
+
 		If [name] does not match any resource name, null is returned.
 		If [name] does not match any resource name, null is returned.
 	**/
 	**/
 	public static function getString( name : String ) : String {
 	public static function getString( name : String ) : String {
@@ -109,7 +109,7 @@ class Resource {
 	/**
 	/**
 		Retrieves the resource identified by [name] as an instance of
 		Retrieves the resource identified by [name] as an instance of
 		haxe.io.Bytes.
 		haxe.io.Bytes.
-		
+
 		If [name] does not match any resource name, null is returned.
 		If [name] does not match any resource name, null is returned.
 	**/
 	**/
 	public static function getBytes( name : String ) : haxe.io.Bytes {
 	public static function getBytes( name : String ) : haxe.io.Bytes {

+ 4 - 4
std/haxe/Serializer.hx

@@ -69,7 +69,7 @@ class Serializer {
 
 
 	var buf : StringBuf;
 	var buf : StringBuf;
 	var cache : Array<Dynamic>;
 	var cache : Array<Dynamic>;
-	var shash : Hash<Int>;
+	var shash : haxe.ds.StringMap<Int>;
 	var scount : Int;
 	var scount : Int;
 
 
 	/**
 	/**
@@ -101,7 +101,7 @@ class Serializer {
 		cache = new Array();
 		cache = new Array();
 		useCache = USE_CACHE;
 		useCache = USE_CACHE;
 		useEnumIndex = USE_ENUM_INDEX;
 		useEnumIndex = USE_ENUM_INDEX;
-		shash = new Hash();
+		shash = new haxe.ds.StringMap();
 		scount = 0;
 		scount = 0;
 	}
 	}
 
 
@@ -291,9 +291,9 @@ class Serializer {
 				var d : Date = v;
 				var d : Date = v;
 				buf.add("v");
 				buf.add("v");
 				buf.add(d.toString());
 				buf.add(d.toString());
-			case #if (neko || cs) "Hash" #else cast Hash #end:
+			case #if (neko || cs) "haxe.ds.StringMap" #else cast haxe.ds.StringMap #end:
 				buf.add("b");
 				buf.add("b");
-				var v : Hash<Dynamic> = v;
+				var v : haxe.ds.StringMap<Dynamic> = v;
 				for( k in v.keys() ) {
 				for( k in v.keys() ) {
 					serializeString(k);
 					serializeString(k);
 					serialize(v.get(k));
 					serialize(v.get(k));

+ 1 - 1
std/haxe/Unserializer.hx

@@ -325,7 +325,7 @@ class Unserializer {
 			pos++;
 			pos++;
 			return l;
 			return l;
 		case "b".code:
 		case "b".code:
-			var h = new Hash();
+			var h = new haxe.ds.StringMap();
 			cache.push(h);
 			cache.push(h);
 			var buf = buf;
 			var buf = buf;
 			while( get(pos) != "h".code ) {
 			while( get(pos) != "h".code ) {

+ 4 - 1
std/Hash.hx → std/haxe/ds/StringMap.hx

@@ -19,12 +19,15 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
+
+package haxe.ds;
+
 /**
 /**
 	Hashtable over a set of elements, using [String] as keys.
 	Hashtable over a set of elements, using [String] as keys.
 	Other kind of keys are not possible on all platforms since they
 	Other kind of keys are not possible on all platforms since they
 	can't always be implemented efficiently.
 	can't always be implemented efficiently.
 **/
 **/
-extern class Hash<T> {
+extern class StringMap<T> {
 
 
 	/**
 	/**
 		Creates a new empty hashtable.
 		Creates a new empty hashtable.

+ 2 - 2
std/haxe/macro/Compiler.hx

@@ -150,7 +150,7 @@ class Compiler {
 	public static function excludeFile( fileName : String ) {
 	public static function excludeFile( fileName : String ) {
 		fileName = Context.resolvePath(fileName);
 		fileName = Context.resolvePath(fileName);
 		var f = sys.io.File.read(fileName,true);
 		var f = sys.io.File.read(fileName,true);
-		var classes = new Hash();
+		var classes = new haxe.ds.StringMap();
 		try {
 		try {
 			while( true ) {
 			while( true ) {
 				var l = StringTools.trim(f.readLine());
 				var l = StringTools.trim(f.readLine());
@@ -268,7 +268,7 @@ class Compiler {
 	public static function setCustomJSGenerator( callb : JSGenApi -> Void ) {
 	public static function setCustomJSGenerator( callb : JSGenApi -> Void ) {
 		load("custom_js",1)(callb);
 		load("custom_js",1)(callb);
 	}
 	}
-	
+
 	static function load( f, nargs ) : Dynamic {
 	static function load( f, nargs ) : Dynamic {
 		#if macro
 		#if macro
 		return neko.Lib.load("macro", f, nargs);
 		return neko.Lib.load("macro", f, nargs);

+ 6 - 6
std/haxe/macro/Context.hx

@@ -104,11 +104,11 @@ class Context {
 	public static function getLocalUsing() :  Array<Type.Ref<Type.ClassType>> {
 	public static function getLocalUsing() :  Array<Type.Ref<Type.ClassType>> {
 		return load("local_using", 0)();
 		return load("local_using", 0)();
 	}
 	}
-	
+
 	/**
 	/**
 		Returns local variables accessible where the macro was called
 		Returns local variables accessible where the macro was called
 	**/
 	**/
-	public static function getLocalVars() : Hash<Type> {
+	public static function getLocalVars() : haxe.ds.StringMap<Type> {
 		return load("local_vars", 0)();
 		return load("local_vars", 0)();
 	}
 	}
 
 
@@ -118,7 +118,7 @@ class Context {
 	public static function defined( s : String ) : Bool {
 	public static function defined( s : String ) : Bool {
 		return load("defined", 1)(untyped s.__s);
 		return load("defined", 1)(untyped s.__s);
 	}
 	}
-	
+
 	/**
 	/**
 		Returns the value defined through -D key=value
 		Returns the value defined through -D key=value
 	**/
 	**/
@@ -174,7 +174,7 @@ class Context {
 	public static function onGenerate( callb : Array<Type> -> Void ) {
 	public static function onGenerate( callb : Array<Type> -> Void ) {
 		load("on_generate",1)(callb);
 		load("on_generate",1)(callb);
 	}
 	}
-	
+
 	/**
 	/**
 		Set a callback function that will be called when a type cannot be found.
 		Set a callback function that will be called when a type cannot be found.
 	**/
 	**/
@@ -195,14 +195,14 @@ class Context {
 	public static function toComplexType( t : Type ) : Null<ComplexType> {
 	public static function toComplexType( t : Type ) : Null<ComplexType> {
 		return load("to_complex", 1)(t);
 		return load("to_complex", 1)(t);
 	}
 	}
-	
+
 	/**
 	/**
 		Returns true if t1 and t2 unify, false otherwise
 		Returns true if t1 and t2 unify, false otherwise
 	**/
 	**/
 	public static function unify( t1 : Type, t2 : Type) : Bool {
 	public static function unify( t1 : Type, t2 : Type) : Bool {
 		return load("unify", 2)(t1, t2);
 		return load("unify", 2)(t1, t2);
 	}
 	}
-	
+
 	/**
 	/**
 		Follow all typedefs to reach the actual real type
 		Follow all typedefs to reach the actual real type
 	**/
 	**/

+ 4 - 4
std/haxe/macro/ExampleJSGenerator.hx

@@ -30,16 +30,16 @@ class ExampleJSGenerator {
 	var buf : StringBuf;
 	var buf : StringBuf;
 	var inits : List<TypedExpr>;
 	var inits : List<TypedExpr>;
 	var statics : List<{ c : ClassType, f : ClassField }>;
 	var statics : List<{ c : ClassType, f : ClassField }>;
-	var packages : Hash<Bool>;
-	var forbidden : Hash<Bool>;
+	var packages : haxe.ds.StringMap<Bool>;
+	var forbidden : haxe.ds.StringMap<Bool>;
 
 
 	public function new(api) {
 	public function new(api) {
 		this.api = api;
 		this.api = api;
 		buf = new StringBuf();
 		buf = new StringBuf();
 		inits = new List();
 		inits = new List();
 		statics = new List();
 		statics = new List();
-		packages = new Hash();
-		forbidden = new Hash();
+		packages = new haxe.ds.StringMap();
+		forbidden = new haxe.ds.StringMap();
 		for( x in ["prototype", "__proto__", "constructor"] )
 		for( x in ["prototype", "__proto__", "constructor"] )
 			forbidden.set(x, true);
 			forbidden.set(x, true);
 		api.setTypeAccessor(getType);
 		api.setTypeAccessor(getType);

+ 1 - 1
std/haxe/macro/Type.hx

@@ -103,7 +103,7 @@ typedef EnumField = {
 }
 }
 
 
 typedef EnumType = {> BaseType,
 typedef EnumType = {> BaseType,
-	var constructs : Hash<EnumField>;
+	var constructs : haxe.ds.StringMap<EnumField>;
 	var names : Array<String>;
 	var names : Array<String>;
 }
 }
 
 

+ 2 - 2
std/haxe/remoting/Context.hx

@@ -23,10 +23,10 @@ package haxe.remoting;
 
 
 class Context {
 class Context {
 
 
-	var objects : Hash<{ obj : Dynamic, rec : Bool }>;
+	var objects : haxe.ds.StringMap<{ obj : Dynamic, rec : Bool }>;
 
 
 	public function new() {
 	public function new() {
-		objects = new Hash();
+		objects = new haxe.ds.StringMap();
 	}
 	}
 
 
 	public function addObject( name : String, obj : {}, ?recursive ) {
 	public function addObject( name : String, obj : {}, ?recursive ) {

+ 1 - 1
std/haxe/remoting/ExternalConnection.hx

@@ -91,7 +91,7 @@ class ExternalConnection implements Connection, implements Dynamic<Connection> {
 		return new haxe.Unserializer(data).unserialize();
 		return new haxe.Unserializer(data).unserialize();
 	}
 	}
 
 
-	static var connections = new Hash<ExternalConnection>();
+	static var connections = new haxe.ds.StringMap<ExternalConnection>();
 
 
 	@:keep
 	@:keep
 	static function doCall( name : String, path : String, params : String ) : String {
 	static function doCall( name : String, path : String, params : String ) : String {

+ 1 - 1
std/haxe/remoting/FlashJsConnection.hx

@@ -87,7 +87,7 @@ class FlashJsConnection #if flash implements AsyncConnection, implements Dynamic
 		}
 		}
 	}
 	}
 
 
-	static var connections = new Hash<FlashJsConnection>();
+	static var connections = new haxe.ds.StringMap<FlashJsConnection>();
 
 
 	static function escapeString( s : String ) {
 	static function escapeString( s : String ) {
 		#if flash9
 		#if flash9

+ 1 - 1
std/haxe/rtti/CType.hx

@@ -104,7 +104,7 @@ typedef Enumdef = {> TypeInfos,
 
 
 typedef Typedef = {> TypeInfos,
 typedef Typedef = {> TypeInfos,
 	var type : CType;
 	var type : CType;
-	var types : Hash<CType>; // by platform
+	var types : haxe.ds.StringMap<CType>; // by platform
 }
 }
 
 
 typedef Abstractdef = {> TypeInfos,
 typedef Abstractdef = {> TypeInfos,

+ 1 - 1
std/haxe/rtti/XmlParser.hx

@@ -508,7 +508,7 @@ class XmlParser {
 				meta = xmeta(c);
 				meta = xmeta(c);
 			else
 			else
 				t = xtype(c);
 				t = xtype(c);
-		var types = new Hash();
+		var types = new haxe.ds.StringMap();
 		if( curplatform != null )
 		if( curplatform != null )
 			types.set(curplatform,t);
 			types.set(curplatform,t);
 		return {
 		return {

+ 3 - 3
std/haxe/web/Dispatch.hx

@@ -67,7 +67,7 @@ private class Redirect {
 class Dispatch {
 class Dispatch {
 
 
 	public var parts : Array<String>;
 	public var parts : Array<String>;
-	public var params : Hash<String>;
+	public var params : haxe.ds.StringMap<String>;
 	public var name : String;
 	public var name : String;
 	public var cfg : DispatchConfig;
 	public var cfg : DispatchConfig;
 	var subDispatch : Bool;
 	var subDispatch : Bool;
@@ -133,7 +133,7 @@ class Dispatch {
 		}
 		}
 	}
 	}
 
 
-	public function redirect( url : String, ?params : Hash<String> ) {
+	public function redirect( url : String, ?params : haxe.ds.StringMap<String> ) {
 		parts = url.split("/");
 		parts = url.split("/");
 		if( parts[0] == "" ) parts.shift();
 		if( parts[0] == "" ) parts.shift();
 		if( params != null ) this.params = params;
 		if( params != null ) this.params = params;
@@ -432,7 +432,7 @@ class Dispatch {
 		return makeConfig(obj);
 		return makeConfig(obj);
 	}
 	}
 
 
-	public static macro function run( url : ExprOf<String>, params : ExprOf<Hash<String>>, obj : ExprOf<{}> ) : ExprOf<Void> {
+	public static macro function run( url : ExprOf<String>, params : ExprOf<haxe.ds.StringMap<String>>, obj : ExprOf<{}> ) : ExprOf<Void> {
 		var p = Context.currentPos();
 		var p = Context.currentPos();
 		var cfg = makeConfig(obj);
 		var cfg = makeConfig(obj);
 		return { expr : ECall({ expr : EField({ expr : ENew({ name : "Dispatch", pack : ["haxe","web"], params : [], sub : null },[url,params]), pos : p },"runtimeDispatch"), pos : p },[cfg]), pos : p };
 		return { expr : ECall({ expr : EField({ expr : ENew({ name : "Dispatch", pack : ["haxe","web"], params : [], sub : null },[url,params]), pos : p },"runtimeDispatch"), pos : p },[cfg]), pos : p };

+ 3 - 3
std/haxe/web/Request.hx

@@ -26,14 +26,14 @@ class Request {
 	/**
 	/**
 		Returns the current page GET and POST parameters (only GET parameters for Javascript)
 		Returns the current page GET and POST parameters (only GET parameters for Javascript)
 	**/
 	**/
-	public static function getParams() : Hash<String> {
+	public static function getParams() : haxe.ds.StringMap<String> {
 		#if neko
 		#if neko
 		return neko.Web.getParams();
 		return neko.Web.getParams();
 		#elseif php
 		#elseif php
 		return php.Web.getParams();
 		return php.Web.getParams();
 		#elseif js
 		#elseif js
 		var get : String = untyped window.location.search.substr(1);
 		var get : String = untyped window.location.search.substr(1);
-		var params = new Hash();
+		var params = new haxe.ds.StringMap();
 		for( p in ~/[&;]/g.split(get) ) {
 		for( p in ~/[&;]/g.split(get) ) {
 			var pl = p.split("=");
 			var pl = p.split("=");
 			if( pl.length < 2 ) continue;
 			if( pl.length < 2 ) continue;
@@ -69,5 +69,5 @@ class Request {
 		return untyped window.location.pathname;
 		return untyped window.location.pathname;
 		#end
 		#end
 	}
 	}
-	
+
 }
 }

+ 1 - 1
std/haxe/xml/Proxy.hx

@@ -30,7 +30,7 @@ package haxe.xml;
 	class MyXml extends haxe.xml.Proxy<"my.xml",MyStructure> {
 	class MyXml extends haxe.xml.Proxy<"my.xml",MyStructure> {
 	}
 	}
 	...
 	...
-	var h = new Hash<MyStructure>();
+	var h = new haxe.ds.StringMap<MyStructure>();
 	// ... fill h with "my.xml" content
 	// ... fill h with "my.xml" content
 	var m = new MyXml(h.get);
 	var m = new MyXml(h.get);
 	trace(m.myNode.structField);
 	trace(m.myNode.structField);

+ 3 - 3
std/java/_std/Sys.hx

@@ -51,7 +51,7 @@ import sys.io.Process;
 **/
 **/
 @:coreApi class Sys {
 @:coreApi class Sys {
 	private static var _args:java.NativeArray<String>;
 	private static var _args:java.NativeArray<String>;
-	private static var _env:Hash<String>;
+	private static var _env:haxe.ds.StringMap<String>;
 	private static var _sysName:String;
 	private static var _sysName:String;
 
 
 	/**
 	/**
@@ -101,11 +101,11 @@ import sys.io.Process;
 	/**
 	/**
 		Returns the whole environement variables.
 		Returns the whole environement variables.
 	**/
 	**/
-	public static function environment() : Hash<String>
+	public static function environment() : haxe.ds.StringMap<String>
 	{
 	{
 		if (_env != null)
 		if (_env != null)
 			return _env;
 			return _env;
-		var _env = _env = new Hash();
+		var _env = _env = new haxe.ds.StringMap();
 		for (mv in java.lang.System.getenv().entrySet())
 		for (mv in java.lang.System.getenv().entrySet())
 		{
 		{
 			_env.set(mv.getKey(), mv.getValue());
 			_env.set(mv.getKey(), mv.getValue());

+ 2 - 2
std/java/_std/Xml.hx

@@ -50,7 +50,7 @@ private enum RealXmlType {
 
 
 	var _nodeName : String;
 	var _nodeName : String;
 	var _nodeValue : String;
 	var _nodeValue : String;
-	var _attributes : Hash<String>;
+	var _attributes : haxe.ds.StringMap<String>;
 	var _children : Array<Xml>;
 	var _children : Array<Xml>;
 	var _parent : Xml;
 	var _parent : Xml;
 
 
@@ -65,7 +65,7 @@ private enum RealXmlType {
 		var r = new Xml();
 		var r = new Xml();
 		r.nodeType = Xml.Element;
 		r.nodeType = Xml.Element;
 		r._children = new Array();
 		r._children = new Array();
-		r._attributes = new Hash();
+		r._attributes = new haxe.ds.StringMap();
 		r.set_nodeName( name );
 		r.set_nodeName( name );
 		return r;
 		return r;
 	}
 	}

+ 3 - 25
std/java/_std/Hash.hx → std/java/_std/haxe/ds/StringMap.hx

@@ -19,33 +19,11 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
+package haxe.ds;
+
 import java.NativeArray;
 import java.NativeArray;
-/*
- * Copyright (c) 2005, The haXe Project Contributors
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *   - Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *   - Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- */
 
 
-@:coreApi class Hash<T>
+@:coreApi class StringMap<T>
 {
 {
 	@:extern private static inline var HASH_UPPER = 0.77;
 	@:extern private static inline var HASH_UPPER = 0.77;
 	@:extern private static inline var FLAG_EMPTY = 0;
 	@:extern private static inline var FLAG_EMPTY = 0;

+ 2 - 2
std/js/Cookie.hx

@@ -45,7 +45,7 @@ class Cookie {
 		Returns all cookies
 		Returns all cookies
 	**/
 	**/
 	public static function all(){
 	public static function all(){
-		var h = new Hash();
+		var h = new haxe.ds.StringMap();
 		var a = Browser.document.cookie.split(";");
 		var a = Browser.document.cookie.split(";");
 		for( e in a ){
 		for( e in a ){
 			e = StringTools.ltrim(e);
 			e = StringTools.ltrim(e);
@@ -63,7 +63,7 @@ class Cookie {
 	public static function get( name : String ){
 	public static function get( name : String ){
 		return all().get(name);
 		return all().get(name);
 	}
 	}
-	
+
 	/**
 	/**
 		Returns true if a cookie [name] exists
 		Returns true if a cookie [name] exists
 	**/
 	**/

+ 2 - 2
std/js/_std/Xml.hx

@@ -39,7 +39,7 @@ enum XmlType {
 
 
 	var _nodeName : String;
 	var _nodeName : String;
 	var _nodeValue : String;
 	var _nodeValue : String;
-	var _attributes : Hash<String>;
+	var _attributes : haxe.ds.StringMap<String>;
 	var _children : Array<Xml>;
 	var _children : Array<Xml>;
 	var _parent : Xml;
 	var _parent : Xml;
 
 
@@ -54,7 +54,7 @@ enum XmlType {
 		var r = new Xml();
 		var r = new Xml();
 		r.nodeType = Xml.Element;
 		r.nodeType = Xml.Element;
 		r._children = new Array();
 		r._children = new Array();
-		r._attributes = new Hash();
+		r._attributes = new haxe.ds.StringMap();
 		r.set_nodeName( name );
 		r.set_nodeName( name );
 		return r;
 		return r;
 	}
 	}

+ 3 - 1
std/js/_std/Hash.hx → std/js/_std/haxe/ds/StringMap.hx

@@ -19,7 +19,9 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
-@:coreApi class Hash<T> {
+package haxe.ds;
+
+@:coreApi class StringMap<T> {
 
 
 	private var h : Dynamic;
 	private var h : Dynamic;
 
 

+ 4 - 4
std/neko/Web.hx

@@ -32,7 +32,7 @@ class Web {
 	**/
 	**/
 	public static function getParams() {
 	public static function getParams() {
 		var p = _get_params();
 		var p = _get_params();
-		var h = new Hash<String>();
+		var h = new haxe.ds.StringMap<String>();
 		var k = "";
 		var k = "";
 		while( p != null ) {
 		while( p != null ) {
 			untyped k.__s = p[0];
 			untyped k.__s = p[0];
@@ -166,7 +166,7 @@ class Web {
 	**/
 	**/
 	public static function getCookies() {
 	public static function getCookies() {
 		var p = _get_cookies();
 		var p = _get_cookies();
-		var h = new Hash<String>();
+		var h = new haxe.ds.StringMap<String>();
 		var k = "";
 		var k = "";
 		while( p != null ) {
 		while( p != null ) {
 			untyped k.__s = p[0];
 			untyped k.__s = p[0];
@@ -236,8 +236,8 @@ class Web {
 		Get the multipart parameters as an hashtable. The data
 		Get the multipart parameters as an hashtable. The data
 		cannot exceed the maximum size specified.
 		cannot exceed the maximum size specified.
 	**/
 	**/
-	public static function getMultipart( maxSize : Int ) : Hash<String> {
-		var h = new Hash();
+	public static function getMultipart( maxSize : Int ) : haxe.ds.StringMap<String> {
+		var h = new haxe.ds.StringMap();
 		var buf : haxe.io.BytesBuffer = null;
 		var buf : haxe.io.BytesBuffer = null;
 		var curname = null;
 		var curname = null;
 		parseMultipart(function(p,_) {
 		parseMultipart(function(p,_) {

+ 2 - 2
std/neko/_std/Sys.hx

@@ -130,9 +130,9 @@
 		return new String(sys_exe_path());
 		return new String(sys_exe_path());
 	}
 	}
 
 
-	public static function environment() : Hash<String> {
+	public static function environment() : haxe.ds.StringMap<String> {
 		var l : Array<Dynamic> = sys_env();
 		var l : Array<Dynamic> = sys_env();
-		var h = new Hash();
+		var h = new haxe.ds.StringMap();
 		while( l != null ) {
 		while( l != null ) {
 			h.set(new String(l[0]),new String(l[1]));
 			h.set(new String(l[0]),new String(l[1]));
 			l = l[2];
 			l = l[2];

+ 3 - 1
std/neko/_std/Hash.hx → std/neko/_std/haxe/ds/StringMap.hx

@@ -19,7 +19,9 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
-@:coreApi class Hash<T> {
+package haxe.ds;
+
+@:coreApi class StringMap<T> {
 
 
 	private var h : Dynamic;
 	private var h : Dynamic;
 
 

+ 3 - 3
std/neko/db/Manager.hx

@@ -41,13 +41,13 @@ class Manager<T : Object> {
 
 
 	/* ----------------------------- STATICS ------------------------------ */
 	/* ----------------------------- STATICS ------------------------------ */
 	public static var cnx(default,set) : Connection;
 	public static var cnx(default,set) : Connection;
-	private static var object_cache : Hash<Object> = new Hash();
+	private static var object_cache : haxe.ds.StringMap<Object> = new haxe.ds.StringMap();
 	private static var init_list : List<Manager<Object>> = new List();
 	private static var init_list : List<Manager<Object>> = new List();
 	private static var cache_field = "__cache__";
 	private static var cache_field = "__cache__";
 	private static var no_update : Dynamic = function() { throw "Cannot update not locked object"; }
 	private static var no_update : Dynamic = function() { throw "Cannot update not locked object"; }
 	private static var LOCKS = ["","",""];
 	private static var LOCKS = ["","",""];
 	private static var KEYWORDS = {
 	private static var KEYWORDS = {
-		var h = new Hash();
+		var h = new haxe.ds.StringMap();
 		for( k in ["read","write","desc","out","group","version","option",
 		for( k in ["read","write","desc","out","group","version","option",
 				"primary","exists","from","key","keys","limit","lock","use",
 				"primary","exists","from","key","keys","limit","lock","use",
 				"create","order","range"] )
 				"create","order","range"] )
@@ -451,7 +451,7 @@ class Manager<T : Object> {
 	}
 	}
 
 
 	public static function cleanup() {
 	public static function cleanup() {
-		object_cache = new Hash();
+		object_cache = new haxe.ds.StringMap();
 	}
 	}
 
 
 	function initRelation(r : { prop : String, key : String, manager : Manager<Object>, lock : Bool } ) {
 	function initRelation(r : { prop : String, key : String, manager : Manager<Object>, lock : Bool } ) {

+ 2 - 2
std/neko/vm/Loader.hx

@@ -82,8 +82,8 @@ class Loader {
 		but with different names, for example with two relatives paths reprensenting
 		but with different names, for example with two relatives paths reprensenting
 		the same file, since the cache is done on a by-name basic.
 		the same file, since the cache is done on a by-name basic.
 	**/
 	**/
-	public function getCache() : Hash<Module> {
-		var h = new Hash<Module>();
+	public function getCache() : haxe.ds.StringMap<Module> {
+		var h = new haxe.ds.StringMap<Module>();
 		var cache = untyped l.cache;
 		var cache = untyped l.cache;
 		for( f in Reflect.fields(cache) )
 		for( f in Reflect.fields(cache) )
 			h.set(f,new Module(Reflect.field(cache,f)));
 			h.set(f,new Module(Reflect.field(cache,f)));

+ 2 - 2
std/neko/vm/Module.hx

@@ -105,8 +105,8 @@ class Module {
 		Each Module has an export table which can be useful to transfert
 		Each Module has an export table which can be useful to transfert
 		values between modules.
 		values between modules.
 	**/
 	**/
-	public function getExports() : Hash<Dynamic> {
-		var h = new Hash();
+	public function getExports() : haxe.ds.StringMap<Dynamic> {
+		var h = new haxe.ds.StringMap();
 		var exp = _module_exports(m);
 		var exp = _module_exports(m);
 		for( f in Reflect.fields(exp) )
 		for( f in Reflect.fields(exp) )
 			h.set(f,Reflect.field(exp,f));
 			h.set(f,Reflect.field(exp,f));

+ 5 - 5
std/php/Lib.hx

@@ -76,13 +76,13 @@ class Lib {
 		return untyped __call__("new _hx_array", a);
 		return untyped __call__("new _hx_array", a);
 	}
 	}
 
 
-	public static function hashOfAssociativeArray<T>(arr : NativeArray) : Hash<T> {
-		var h = new Hash<T>();
+	public static function hashOfAssociativeArray<T>(arr : NativeArray) : haxe.ds.StringMap<T> {
+		var h = new haxe.ds.StringMap<T>();
 		untyped h.h = arr;
 		untyped h.h = arr;
 		return h;
 		return h;
 	}
 	}
 
 
-	public static function associativeArrayOfHash(hash : Hash<Dynamic>) : NativeArray {
+	public static function associativeArrayOfHash(hash : haxe.ds.StringMap<Dynamic>) : NativeArray {
 		return untyped hash.h;
 		return untyped hash.h;
 	}
 	}
 
 
@@ -96,9 +96,9 @@ class Lib {
 	public static function associativeArrayOfObject(ob : Dynamic) : NativeArray {
 	public static function associativeArrayOfObject(ob : Dynamic) : NativeArray {
 		return untyped __php__("(array) $ob");
 		return untyped __php__("(array) $ob");
 	}
 	}
-	
+
 	/**
 	/**
-	 * See the documentation for the equivalent PHP function for details on usage: 
+	 * See the documentation for the equivalent PHP function for details on usage:
 	 * http://php.net/manual/en/function.mail.php
 	 * http://php.net/manual/en/function.mail.php
 	 * @param	to
 	 * @param	to
 	 * @param	subject
 	 * @param	subject

+ 7 - 7
std/php/Web.hx

@@ -79,9 +79,9 @@ class Web {
 		}
 		}
 		explore(StringTools.replace(getParamsString(), ";", "&"));
 		explore(StringTools.replace(getParamsString(), ";", "&"));
 		explore(getPostData());
 		explore(getPostData());
-		
+
         if (res.length == 0) {
         if (res.length == 0) {
-            var post:Hash<Dynamic> = Lib.hashOfAssociativeArray(untyped __php__("$_POST"));
+            var post:haxe.ds.StringMap<Dynamic> = Lib.hashOfAssociativeArray(untyped __php__("$_POST"));
             var data = post.get(param);
             var data = post.get(param);
             var k = 0, v = "";
             var k = 0, v = "";
             if (untyped __call__("is_array", data)) {
             if (untyped __call__("is_array", data)) {
@@ -90,7 +90,7 @@ class Web {
                 untyped __php__(" } ");
                 untyped __php__(" } ");
             }
             }
         }
         }
-		
+
 		if (res.length == 0)
 		if (res.length == 0)
 			return null;
 			return null;
 		return res;
 		return res;
@@ -289,8 +289,8 @@ class Web {
 		Get the multipart parameters as an hashtable. The data
 		Get the multipart parameters as an hashtable. The data
 		cannot exceed the maximum size specified.
 		cannot exceed the maximum size specified.
 	**/
 	**/
-	public static function getMultipart( maxSize : Int ) : Hash<String> {
-		var h = new Hash();
+	public static function getMultipart( maxSize : Int ) : haxe.ds.StringMap<String> {
+		var h = new haxe.ds.StringMap();
 		var buf : StringBuf = null;
 		var buf : StringBuf = null;
 		var curname = null;
 		var curname = null;
 		parseMultipart(function(p,_) {
 		parseMultipart(function(p,_) {
@@ -323,14 +323,14 @@ class Web {
 		if(untyped __call__("get_magic_quotes_gpc"))
 		if(untyped __call__("get_magic_quotes_gpc"))
 			untyped __php__("reset($a); while(list($k, $v) = each($a)) $a[$k] = stripslashes((string)$v)");
 			untyped __php__("reset($a); while(list($k, $v) = each($a)) $a[$k] = stripslashes((string)$v)");
 		var post = Lib.hashOfAssociativeArray(a);
 		var post = Lib.hashOfAssociativeArray(a);
-		
+
 		for (key in post.keys())
 		for (key in post.keys())
 		{
 		{
 			onPart(key, "");
 			onPart(key, "");
 			var v = post.get(key);
 			var v = post.get(key);
 			onData(Bytes.ofString(v), 0, untyped __call__("strlen", v));
 			onData(Bytes.ofString(v), 0, untyped __call__("strlen", v));
 		}
 		}
-		
+
 		if(!untyped __call__("isset", __php__("$_FILES"))) return;
 		if(!untyped __call__("isset", __php__("$_FILES"))) return;
 		var parts : Array<String> = untyped __call__("new _hx_array",__call__("array_keys", __php__("$_FILES")));
 		var parts : Array<String> = untyped __call__("new _hx_array",__call__("array_keys", __php__("$_FILES")));
 		for(part in parts) {
 		for(part in parts) {

+ 1 - 1
std/php/_std/Sys.hx

@@ -110,7 +110,7 @@
 		return untyped __php__("$_SERVER['SCRIPT_FILENAME']");
 		return untyped __php__("$_SERVER['SCRIPT_FILENAME']");
 	}
 	}
 
 
-	public static function environment() : Hash<String> {
+	public static function environment() : haxe.ds.StringMap<String> {
 		return php.Lib.hashOfAssociativeArray(untyped __php__("$_SERVER"));
 		return php.Lib.hashOfAssociativeArray(untyped __php__("$_SERVER"));
 	}
 	}
 
 

+ 2 - 2
std/php/_std/Xml.hx

@@ -65,7 +65,7 @@ enum XmlType {
 
 
 	var _nodeName : String;
 	var _nodeName : String;
 	var _nodeValue : String;
 	var _nodeValue : String;
-	var _attributes : Hash<String>;
+	var _attributes : haxe.ds.StringMap<String>;
 	var _children : Array<Xml>;
 	var _children : Array<Xml>;
 	var _parent : Xml;
 	var _parent : Xml;
 
 
@@ -160,7 +160,7 @@ enum XmlType {
 		var r = new Xml();
 		var r = new Xml();
 		r.nodeType = Xml.Element;
 		r.nodeType = Xml.Element;
 		r._children = new Array();
 		r._children = new Array();
-		r._attributes = new Hash();
+		r._attributes = new haxe.ds.StringMap();
 		r.set_nodeName( name );
 		r.set_nodeName( name );
 		return r;
 		return r;
 	}
 	}

+ 3 - 1
std/php/_std/Hash.hx → std/php/_std/haxe/ds/StringMap.hx

@@ -19,7 +19,9 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
-@:coreApi class Hash<T> implements php.IteratorAggregate<T> {
+package haxe.ds;
+
+@:coreApi class StringMap<T> implements php.IteratorAggregate<T> {
 	private var h : ArrayAccess<T>;
 	private var h : ArrayAccess<T>;
 
 
 	public function new() : Void {
 	public function new() : Void {

+ 3 - 3
std/php/db/Manager.hx

@@ -32,11 +32,11 @@ class Manager<T : Object> {
 
 
 	/* ----------------------------- STATICS ------------------------------ */
 	/* ----------------------------- STATICS ------------------------------ */
 	public static var cnx(default,set) : Connection;
 	public static var cnx(default,set) : Connection;
-	private static var object_cache : Hash<Object> = new Hash();
+	private static var object_cache : haxe.ds.StringMap<Object> = new haxe.ds.StringMap();
 	private static var cache_field = "__cache__";
 	private static var cache_field = "__cache__";
 	private static var FOR_UPDATE = "";
 	private static var FOR_UPDATE = "";
 
 
-	public static var managers = new Hash<Manager<Dynamic>>();
+	public static var managers = new haxe.ds.StringMap<Manager<Dynamic>>();
 
 
 	private static dynamic function set_cnx( c : Connection ) {
 	private static dynamic function set_cnx( c : Connection ) {
 		Reflect.setField(Manager,"cnx",c);
 		Reflect.setField(Manager,"cnx",c);
@@ -444,7 +444,7 @@ class Manager<T : Object> {
 	}
 	}
 
 
 	public static function cleanup() {
 	public static function cleanup() {
-		object_cache = new Hash();
+		object_cache = new haxe.ds.StringMap();
 	}
 	}
 
 
 	function initRelation(o : Dynamic, r : { prop : String, key : String, manager : Manager<Object>, lock : Bool } ) {
 	function initRelation(o : Dynamic, r : { prop : String, key : String, manager : Manager<Object>, lock : Bool } ) {

File diff suppressed because it is too large
+ 2 - 2
std/sys/db/Manager.hx


+ 1 - 1
std/sys/db/SpodInfos.hx

@@ -78,7 +78,7 @@ typedef SpodInfos = {
 	var name : String;
 	var name : String;
 	var key : Array<String>;
 	var key : Array<String>;
 	var fields : Array<SpodField>;
 	var fields : Array<SpodField>;
-	var hfields : Hash<SpodField>;
+	var hfields : haxe.ds.StringMap<SpodField>;
 	var relations : Array<SpodRelation>;
 	var relations : Array<SpodRelation>;
 	var indexes : Array<{ keys : Array<String>, unique : Bool }>;
 	var indexes : Array<{ keys : Array<String>, unique : Bool }>;
 }
 }

+ 11 - 11
std/sys/db/SpodMacros.hx

@@ -43,9 +43,9 @@ class SpodMacros {
 	var manager : Expr;
 	var manager : Expr;
 	var inf : SpodInfos;
 	var inf : SpodInfos;
 	var g : {
 	var g : {
-		var cache : Hash<SpodInfos>;
-		var types : Hash<SpodType>;
-		var functions : Hash<SqlFunction>;
+		var cache : haxe.ds.StringMap<SpodInfos>;
+		var types : haxe.ds.StringMap<SpodType>;
+		var functions : haxe.ds.StringMap<SqlFunction>;
 	};
 	};
 
 
 	function new(c) {
 	function new(c) {
@@ -60,15 +60,15 @@ class SpodMacros {
 
 
 	function initGlobals()
 	function initGlobals()
 	{
 	{
-		var cache = new Hash();
-		var types = new Hash();
+		var cache = new haxe.ds.StringMap();
+		var types = new haxe.ds.StringMap();
 		for( c in Type.getEnumConstructs(SpodType) ) {
 		for( c in Type.getEnumConstructs(SpodType) ) {
 			var e : Dynamic = Reflect.field(SpodType, c);
 			var e : Dynamic = Reflect.field(SpodType, c);
 			if( Std.is(e, SpodType) )
 			if( Std.is(e, SpodType) )
 				types.set("S"+c.substr(1), e);
 				types.set("S"+c.substr(1), e);
 		}
 		}
 		types.remove("SNull");
 		types.remove("SNull");
-		var functions = new Hash();
+		var functions = new haxe.ds.StringMap();
 		for( f in [
 		for( f in [
 			{ name : "now", params : [], ret : DDateTime, sql : "NOW($)" },
 			{ name : "now", params : [], ret : DDateTime, sql : "NOW($)" },
 			{ name : "curDate", params : [], ret : DDate, sql : "CURDATE($)" },
 			{ name : "curDate", params : [], ret : DDate, sql : "CURDATE($)" },
@@ -274,12 +274,12 @@ class SpodMacros {
 			key : null,
 			key : null,
 			name : cname.split(".").pop(), // remove package name
 			name : cname.split(".").pop(), // remove package name
 			fields : [],
 			fields : [],
-			hfields : new Hash(),
+			hfields : new haxe.ds.StringMap(),
 			relations : [],
 			relations : [],
 			indexes : [],
 			indexes : [],
 		};
 		};
 		var c = c.get();
 		var c = c.get();
-		var fieldsPos = new Hash();
+		var fieldsPos = new haxe.ds.StringMap();
 		var fields = c.fields.get();
 		var fields = c.fields.get();
 		var csup = c.superClass;
 		var csup = c.superClass;
 		while( csup != null ) {
 		while( csup != null ) {
@@ -409,7 +409,7 @@ class SpodMacros {
 	}
 	}
 
 
 	function quoteField( f : String ) {
 	function quoteField( f : String ) {
-		var m : { private var KEYWORDS : Hash<Bool>; } = Manager;
+		var m : { private var KEYWORDS : haxe.ds.StringMap<Bool>; } = Manager;
 		return m.KEYWORDS.exists(f.toLowerCase()) ? "`"+f+"`" : f;
 		return m.KEYWORDS.exists(f.toLowerCase()) ? "`"+f+"`" : f;
 	}
 	}
 
 
@@ -654,7 +654,7 @@ class SpodMacros {
 		case EObjectDecl(fl):
 		case EObjectDecl(fl):
 			var first = true;
 			var first = true;
 			var sql = makeString("(", p);
 			var sql = makeString("(", p);
-			var fields = new Hash();
+			var fields = new haxe.ds.StringMap();
 			for( f in fl ) {
 			for( f in fl ) {
 				var fi = getField(f);
 				var fi = getField(f);
 				if( first )
 				if( first )
@@ -978,7 +978,7 @@ class SpodMacros {
 
 
 	function buildOptions( eopt : Expr ) {
 	function buildOptions( eopt : Expr ) {
 		var p = eopt.pos;
 		var p = eopt.pos;
-		var opts = new Hash();
+		var opts = new haxe.ds.StringMap();
 		var opt = { limit : null, orderBy : null, forceIndex : null };
 		var opt = { limit : null, orderBy : null, forceIndex : null };
 		switch( eopt.expr ) {
 		switch( eopt.expr ) {
 		case EObjectDecl(fields):
 		case EObjectDecl(fields):

+ 7 - 7
tests/unit/MyAbstract.hx

@@ -55,9 +55,9 @@ abstract Kilometer(Float) from Float to Float {
 		return new Kilometer(m.get() / 1000.)
 		return new Kilometer(m.get() / 1000.)
 }
 }
 
 
-abstract MyHash(Hash<V>)<V> {
+abstract MyHash(haxe.ds.StringMap<V>)<V> {
 	private inline function new() {
 	private inline function new() {
-		this = new Hash<V>();
+		this = new haxe.ds.StringMap<V>();
 	}
 	}
 	public inline function set(k:String, v:V)
 	public inline function set(k:String, v:V)
 		this.set(k, v)
 		this.set(k, v)
@@ -121,21 +121,21 @@ abstract MyVector(MyPoint3) from MyPoint3 to MyPoint3 {
 	@:op(A + B) static public inline function add(lhs:MyVector, rhs:MyVector):MyVector {
 	@:op(A + B) static public inline function add(lhs:MyVector, rhs:MyVector):MyVector {
 		return new MyPoint3(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z);
 		return new MyPoint3(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z);
 	}
 	}
-	
+
 	@:op(A *= B) static public inline function scalarAssign(lhs:MyVector, rhs:Float):MyVector {
 	@:op(A *= B) static public inline function scalarAssign(lhs:MyVector, rhs:Float):MyVector {
 		lhs.x *= rhs;
 		lhs.x *= rhs;
 		lhs.y *= rhs;
 		lhs.y *= rhs;
 		lhs.z *= rhs;
 		lhs.z *= rhs;
 		return lhs;
 		return lhs;
 	}
 	}
-	
+
 	@:op(A * B) static public inline function scalar(lhs:MyVector, rhs:Float):MyVector {
 	@:op(A * B) static public inline function scalar(lhs:MyVector, rhs:Float):MyVector {
 		return new MyPoint3(lhs.x * rhs, lhs.y * rhs, lhs.z * rhs);
 		return new MyPoint3(lhs.x * rhs, lhs.y * rhs, lhs.z * rhs);
 	}
 	}
-					
+
 	public inline function get():MyPoint3
 	public inline function get():MyPoint3
 		return this
 		return this
-		
+
 	@:to public inline function toString():String
 	@:to public inline function toString():String
 		return untyped '(${this.x},${this.y},${this.z})'
 		return untyped '(${this.x},${this.y},${this.z})'
 }
 }
@@ -143,7 +143,7 @@ abstract MyVector(MyPoint3) from MyPoint3 to MyPoint3 {
 abstract MyInt(Int) from Int to Int {
 abstract MyInt(Int) from Int to Int {
 	// MyInt + MyInt can be used as is, and returns a MyInt
 	// MyInt + MyInt can be used as is, and returns a MyInt
 	@:op(A + B) static public function add(lhs:MyInt, rhs:MyInt):MyInt;
 	@:op(A + B) static public function add(lhs:MyInt, rhs:MyInt):MyInt;
-	
+
 	@:commutative @:op(A * B) static public function repeat(lhs:MyInt, rhs:String):String {
 	@:commutative @:op(A * B) static public function repeat(lhs:MyInt, rhs:String):String {
 		var s:StringBuf = new StringBuf();
 		var s:StringBuf = new StringBuf();
 		for (i in 0...lhs)
 		for (i in 0...lhs)

+ 4 - 4
tests/unit/TestBasetypes.hx

@@ -177,8 +177,8 @@ class TestBasetypes extends Test {
 		eq( Math.fround( -10000000000.7), -10000000001. );
 		eq( Math.fround( -10000000000.7), -10000000001. );
 	}
 	}
 
 
-	function testHash() {
-		var h = new Hash<Null<Int>>();
+	function testStringMap() {
+		var h = new haxe.ds.StringMap<Null<Int>>();
 		h.set("x", -1);
 		h.set("x", -1);
 		h.set("abcd", 8546);
 		h.set("abcd", 8546);
 		eq( h.get("x"), -1);
 		eq( h.get("x"), -1);
@@ -372,7 +372,7 @@ class TestBasetypes extends Test {
 		eq("Distance: 12.5km", "Distance: " + km);
 		eq("Distance: 12.5km", "Distance: " + km);
 		eq("Distance: 12.5m", "Distance: " + m);
 		eq("Distance: 12.5m", "Distance: " + m);
 	}
 	}
-	
+
 	function testAbstractOperatorOverload() {
 	function testAbstractOperatorOverload() {
 		var v1:unit.MyAbstract.MyVector = new unit.MyAbstract.MyPoint3(1, 1, 1);
 		var v1:unit.MyAbstract.MyVector = new unit.MyAbstract.MyPoint3(1, 1, 1);
 		var v2:unit.MyAbstract.MyVector = new unit.MyAbstract.MyPoint3(1, 2, 3);
 		var v2:unit.MyAbstract.MyVector = new unit.MyAbstract.MyPoint3(1, 2, 3);
@@ -385,7 +385,7 @@ class TestBasetypes extends Test {
 		var v3 = v1 * 2.;
 		var v3 = v1 * 2.;
 		eq("(4,4,4)", v3);
 		eq("(4,4,4)", v3);
 		f(v1 == v3);
 		f(v1 == v3);
-		
+
 		var i:unit.MyAbstract.MyInt = 1;
 		var i:unit.MyAbstract.MyInt = 1;
 		eq(2, i + i);
 		eq(2, i + i);
 		i = i + i;
 		i = i + i;

+ 6 - 6
tests/unit/TestReflect.hx

@@ -61,7 +61,7 @@ class TestReflect extends Test {
 
 
 	static var TYPES : Array<Dynamic> = [
 	static var TYPES : Array<Dynamic> = [
 		null,Int,String,Bool,Float,
 		null,Int,String,Bool,Float,
-		Array,Hash,List,Date,Xml,Math,
+		Array,haxe.ds.StringMap,List,Date,Xml,Math,
 		unit.MyEnum,unit.MyClass,unit.MySubClass,
 		unit.MyEnum,unit.MyClass,unit.MySubClass,
 		Class,Enum,Dynamic,unit.MyInterface
 		Class,Enum,Dynamic,unit.MyInterface
 	];
 	];
@@ -85,7 +85,7 @@ class TestReflect extends Test {
 
 
 	static var TNAMES = [
 	static var TNAMES = [
 		"null","Int","String","Bool","Float",
 		"null","Int","String","Bool","Float",
-		"Array",u("Hash"),u("List"),"Date","Xml","Math",
+		"Array",u("haxe.ds.StringMap"),u("List"),"Date","Xml","Math",
 		u2("unit","MyEnum"),u2("unit","MyClass"),u2("unit","MySubClass"),
 		u2("unit","MyEnum"),u2("unit","MyClass"),u2("unit","MySubClass"),
 		#if !flash9 u #end("Class"), u("Enum"), u("Dynamic"),
 		#if !flash9 u #end("Class"), u("Enum"), u("Dynamic"),
 		u2("unit","MyInterface")
 		u2("unit","MyInterface")
@@ -130,7 +130,7 @@ class TestReflect extends Test {
 		is("",String);
 		is("",String);
 		is([],Array);
 		is([],Array);
 		is(new List(),List);
 		is(new List(),List);
-		is(new Hash(),Hash);
+		is(new haxe.ds.StringMap(),haxe.ds.StringMap);
 		is(new MyClass(0),MyClass);
 		is(new MyClass(0),MyClass);
 		is(new MySubClass(0),MyClass,MySubClass);
 		is(new MySubClass(0),MyClass,MySubClass);
 		is(MyEnum.A,MyEnum);
 		is(MyEnum.A,MyEnum);
@@ -170,7 +170,7 @@ class TestReflect extends Test {
 		typeof("",TClass(String));
 		typeof("",TClass(String));
 		typeof([],TClass(Array));
 		typeof([],TClass(Array));
 		typeof(new List(),TClass(List));
 		typeof(new List(),TClass(List));
-		typeof(new Hash(),TClass(Hash));
+		typeof(new haxe.ds.StringMap(),TClass(haxe.ds.StringMap));
 		typeof(new MyClass(0),TClass(MyClass));
 		typeof(new MyClass(0),TClass(MyClass));
 		typeof(new MySubClass(0),TClass(MySubClass));
 		typeof(new MySubClass(0),TClass(MySubClass));
 		typeof(MyEnum.A,TEnum(MyEnum));
 		typeof(MyEnum.A,TEnum(MyEnum));
@@ -245,7 +245,7 @@ class TestReflect extends Test {
 		/*
 		/*
 			Comparison between a method and a closure :
 			Comparison between a method and a closure :
 			Not widely supported atm to justify officiel support
 			Not widely supported atm to justify officiel support
-			
+
 			var fadd : Dynamic = Reflect.field(a, "add");
 			var fadd : Dynamic = Reflect.field(a, "add");
 			var fget : Dynamic = Reflect.field(a, "get");
 			var fget : Dynamic = Reflect.field(a, "get");
 			t( Reflect.compareMethods(fadd, fadd) );
 			t( Reflect.compareMethods(fadd, fadd) );
@@ -270,7 +270,7 @@ class TestReflect extends Test {
 		Reflect.setProperty(c, "x", 10);
 		Reflect.setProperty(c, "x", 10);
 		eq( c.x, 10);
 		eq( c.x, 10);
 		eq( Reflect.getProperty(c, "x"), 10);
 		eq( Reflect.getProperty(c, "x"), 10);
-		
+
 		var c : InterfWithProp = new ClassWithProp();
 		var c : InterfWithProp = new ClassWithProp();
 		eq( c.x, 5);
 		eq( c.x, 5);
 
 

+ 2 - 2
tests/unit/TestSerialize.hx

@@ -54,11 +54,11 @@ class TestSerialize extends Test {
 		doTestEnums();
 		doTestEnums();
 
 
 		// hash
 		// hash
-		var h = new Hash();
+		var h = new haxe.ds.StringMap();
 		h.set("keya",2);
 		h.set("keya",2);
 		h.set("kéyb",-465);
 		h.set("kéyb",-465);
 		var h2 = id(h);
 		var h2 = id(h);
-		t( Std.is(h2,Hash) );
+		t( Std.is(h2,haxe.ds.StringMap) );
 		eq( h2.get("keya"), 2 );
 		eq( h2.get("keya"), 2 );
 		eq( h2.get("kéyb"), -465 );
 		eq( h2.get("kéyb"), -465 );
 		eq( Lambda.count(h2), 2 );
 		eq( Lambda.count(h2), 2 );

+ 1 - 1
tests/unit/TestType.hx

@@ -689,7 +689,7 @@ class TestType extends Test {
 	function testAbstractGeneric() {
 	function testAbstractGeneric() {
 		var map = new Map();
 		var map = new Map();
 		map.set("foo", 1);
 		map.set("foo", 1);
-		t(Std.is(map, Hash));
+		t(Std.is(map, haxe.ds.StringMap));
 
 
 		var map = new Map();
 		var map = new Map();
 		_mapMe(map); // infer from function call
 		_mapMe(map); // infer from function call

+ 1 - 1
tests/unit/compile.hxml

@@ -62,7 +62,7 @@ unit.Test
 --next
 --next
 -main unit.Test
 -main unit.Test
 -as3 as3
 -as3 as3
-#-cmd mxmlc -static-link-runtime-shared-libraries=true -debug as3/__main__.as --output unit9_as3.swf
+-cmd mxmlc -static-link-runtime-shared-libraries=true -debug as3/__main__.as --output unit9_as3.swf
 
 
 #cpp
 #cpp
 --next
 --next

+ 14 - 0
tests/unit/unitstd/IntIterator.hx

@@ -0,0 +1,14 @@
+var ii = new IntIterator(0, 2);
+ii.hasNext() == true;
+ii.next() == 0;
+ii.hasNext() == true;
+ii.next() == 1;
+ii.hasNext() == false;
+var ii = new IntIterator(0, 2);
+var r = [];
+for (i in ii)
+	r.push(i);
+r == [1, 2];
+for (i in ii)
+	r.push(i);
+r == [1, 2];

+ 5 - 0
tests/unit/unitstd/haxe/macro/ComplexTypeTools.macro.unit.hx

@@ -0,0 +1,5 @@
+#if macro
+var tt = function(c) return Std.string(haxe.macro.ComplexTypeTools.toType(c));
+tt(macro : String) == "String";
+tt(macro : Int) == "String";
+#end

Some files were not shown because too many files changed in this diff