Bläddra i källkod

Reformat std (#8408)

* reformat root std classes

* reformat std sys classes

* reformat std haxe classes

* reformat eval classes

* reformat cpp classes

* reformat cs classes

* reformat hl classes

* reformat java classes

* reformat js classes

* reformat jvm classes

* reformat lua classes

* reformat neko classes

* reformat non-extern flash classes

* reformat php classes

* reformat python classes

* remove cs WeakMap

* merge reformat

* fix loadLazy format in cpp.Lib

* fix Lambda.flatten format

* post-merge reformat

* fix

* fix 2

* fix 3

* fix 4 ...

* fix 5 .....

* fix 7 .........
Aurel 6 år sedan
förälder
incheckning
8616359ff7
100 ändrade filer med 3823 tillägg och 3294 borttagningar
  1. 8 3
      std/Any.hx
  2. 24 24
      std/Array.hx
  3. 2 2
      std/Class.hx
  4. 60 65
      std/Date.hx
  5. 72 60
      std/DateTools.hx
  6. 11 12
      std/EReg.hx
  7. 1 2
      std/Enum.hx
  8. 4 6
      std/IntIterator.hx
  9. 41 43
      std/Lambda.hx
  10. 22 1
      std/List.hx
  11. 22 1
      std/Map.hx
  12. 35 47
      std/Math.hx
  13. 18 19
      std/Reflect.hx
  14. 8 9
      std/Std.hx
  15. 16 18
      std/StdTypes.hx
  16. 14 14
      std/String.hx
  17. 7 8
      std/StringBuf.hx
  18. 150 132
      std/StringTools.hx
  19. 70 50
      std/Sys.hx
  20. 22 27
      std/Type.hx
  21. 88 62
      std/UInt.hx
  22. 94 85
      std/UnicodeString.hx
  23. 51 36
      std/Xml.hx
  24. 8 9
      std/cpp/ArrayBase.hx
  25. 38 12
      std/cpp/AtomicInt.hx
  26. 2 1
      std/cpp/AutoCast.hx
  27. 44 30
      std/cpp/Callable.hx
  28. 11 9
      std/cpp/CastCharStar.hx
  29. 2 1
      std/cpp/Char.hx
  30. 12 11
      std/cpp/ConstCharStar.hx
  31. 31 34
      std/cpp/ConstPointer.hx
  32. 5 3
      std/cpp/ConstStar.hx
  33. 54 25
      std/cpp/EnumBase.hx
  34. 11 13
      std/cpp/ErrorConstants.hx
  35. 1 2
      std/cpp/FILE.hx
  36. 2 3
      std/cpp/FastIterator.hx
  37. 32 10
      std/cpp/Finalizable.hx
  38. 2 1
      std/cpp/Float32.hx
  39. 2 1
      std/cpp/Float64.hx
  40. 31 30
      std/cpp/Function.hx
  41. 2 1
      std/cpp/Int16.hx
  42. 2 1
      std/cpp/Int32.hx
  43. 2 1
      std/cpp/Int64.hx
  44. 2 1
      std/cpp/Int8.hx
  45. 35 38
      std/cpp/Lib.hx
  46. 77 89
      std/cpp/Native.hx
  47. 27 8
      std/cpp/NativeArc.hx
  48. 51 59
      std/cpp/NativeArray.hx
  49. 53 46
      std/cpp/NativeFile.hx
  50. 46 40
      std/cpp/NativeGc.hx
  51. 42 24
      std/cpp/NativeMath.hx
  52. 43 30
      std/cpp/NativeProcess.hx
  53. 31 16
      std/cpp/NativeRandom.hx
  54. 101 113
      std/cpp/NativeSocket.hx
  55. 95 75
      std/cpp/NativeSsl.hx
  56. 27 30
      std/cpp/NativeString.hx
  57. 77 83
      std/cpp/NativeSys.hx
  58. 437 464
      std/cpp/NativeXml.hx
  59. 21 0
      std/cpp/NativeXmlImport.cpp
  60. 2 2
      std/cpp/Object.hx
  61. 36 16
      std/cpp/ObjectType.hx
  62. 42 48
      std/cpp/Pointer.hx
  63. 76 81
      std/cpp/Prime.hx
  64. 7 8
      std/cpp/Random.hx
  65. 5 5
      std/cpp/RawConstPointer.hx
  66. 5 5
      std/cpp/RawPointer.hx
  67. 5 4
      std/cpp/Reference.hx
  68. 3 3
      std/cpp/SizeT.hx
  69. 5 3
      std/cpp/Star.hx
  70. 37 19
      std/cpp/StdString.hx
  71. 29 9
      std/cpp/StdStringRef.hx
  72. 12 14
      std/cpp/Stdio.hx
  73. 33 36
      std/cpp/Stdlib.hx
  74. 4 4
      std/cpp/Struct.hx
  75. 2 1
      std/cpp/UInt16.hx
  76. 2 1
      std/cpp/UInt32.hx
  77. 2 1
      std/cpp/UInt64.hx
  78. 2 1
      std/cpp/UInt8.hx
  79. 5 4
      std/cpp/VarArg.hx
  80. 115 61
      std/cpp/VirtualArray.hx
  81. 3 3
      std/cpp/Void.hx
  82. 41 27
      std/cpp/_std/Date.hx
  83. 118 119
      std/cpp/_std/EReg.hx
  84. 83 69
      std/cpp/_std/Reflect.hx
  85. 12 12
      std/cpp/_std/Std.hx
  86. 66 62
      std/cpp/_std/StringBuf.hx
  87. 34 34
      std/cpp/_std/Sys.hx
  88. 106 92
      std/cpp/_std/Type.hx
  89. 244 209
      std/cpp/_std/haxe/Int64.hx
  90. 15 15
      std/cpp/_std/haxe/Log.hx
  91. 8 6
      std/cpp/_std/haxe/Resource.hx
  92. 31 34
      std/cpp/_std/haxe/Utf8.hx
  93. 51 28
      std/cpp/_std/haxe/ds/IntMap.hx
  94. 51 27
      std/cpp/_std/haxe/ds/ObjectMap.hx
  95. 51 27
      std/cpp/_std/haxe/ds/StringMap.hx
  96. 19 18
      std/cpp/_std/haxe/ds/WeakMap.hx
  97. 23 23
      std/cpp/_std/haxe/zip/Compress.hx
  98. 22 20
      std/cpp/_std/haxe/zip/Uncompress.hx
  99. 35 22
      std/cpp/_std/sys/FileSystem.hx
  100. 82 81
      std/cpp/_std/sys/db/Mysql.hx

+ 8 - 3
std/Any.hx

@@ -32,7 +32,12 @@
 	to another type.
 	to another type.
 **/
 **/
 abstract Any(Dynamic) {
 abstract Any(Dynamic) {
-	@:noCompletion @:to extern inline function __promote<T>():T return this;
-	@:noCompletion @:from extern inline static function __cast<T>(value:T):Any return cast value;
-	@:noCompletion extern inline function toString():String return Std.string(this);
+	@:noCompletion @:to extern inline function __promote<T>():T
+		return this;
+
+	@:noCompletion @:from extern inline static function __cast<T>(value:T):Any
+		return cast value;
+
+	@:noCompletion extern inline function toString():String
+		return Std.string(this);
 }
 }

+ 24 - 24
std/Array.hx

@@ -19,6 +19,7 @@
  * 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.
  */
  */
+
 /**
 /**
 	An Array is a storage for values. You can access it using indexes or
 	An Array is a storage for values. You can access it using indexes or
 	with its API.
 	with its API.
@@ -27,16 +28,15 @@
 	@see https://haxe.org/manual/lf-array-comprehension.html
 	@see https://haxe.org/manual/lf-array-comprehension.html
 **/
 **/
 extern class Array<T> {
 extern class Array<T> {
-
 	/**
 	/**
 		The length of `this` Array.
 		The length of `this` Array.
 	**/
 	**/
-	var length(default,null) : Int;
+	var length(default, null):Int;
 
 
 	/**
 	/**
 		Creates a new Array.
 		Creates a new Array.
 	**/
 	**/
-	function new() : Void;
+	function new():Void;
 
 
 	/**
 	/**
 		Returns a new Array by appending the elements of `a` to the elements of
 		Returns a new Array by appending the elements of `a` to the elements of
@@ -51,7 +51,7 @@ extern class Array<T> {
 
 
 		If `a` is `null`, the result is unspecified.
 		If `a` is `null`, the result is unspecified.
 	**/
 	**/
-	function concat( a : Array<T> ) : Array<T>;
+	function concat(a:Array<T>):Array<T>;
 
 
 	/**
 	/**
 		Returns a string representation of `this` Array, with `sep` separating
 		Returns a string representation of `this` Array, with `sep` separating
@@ -66,7 +66,7 @@ extern class Array<T> {
 
 
 		If `sep` is null, the result is unspecified.
 		If `sep` is null, the result is unspecified.
 	**/
 	**/
-	function join( sep : String ) : String;
+	function join(sep:String):String;
 
 
 	/**
 	/**
 		Removes the last element of `this` Array and returns it.
 		Removes the last element of `this` Array and returns it.
@@ -78,7 +78,7 @@ extern class Array<T> {
 		If `this` is the empty Array `[]`, null is returned and the length
 		If `this` is the empty Array `[]`, null is returned and the length
 		remains 0.
 		remains 0.
 	**/
 	**/
-	function pop() : Null<T>;
+	function pop():Null<T>;
 
 
 	/**
 	/**
 		Adds the element `x` at the end of `this` Array and returns the new
 		Adds the element `x` at the end of `this` Array and returns the new
@@ -88,7 +88,7 @@ extern class Array<T> {
 
 
 		`this.length` increases by 1.
 		`this.length` increases by 1.
 	**/
 	**/
-	function push(x : T) : Int;
+	function push(x:T):Int;
 
 
 	/**
 	/**
 		Reverse the order of elements of `this` Array.
 		Reverse the order of elements of `this` Array.
@@ -97,7 +97,7 @@ extern class Array<T> {
 
 
 		If `this.length < 2`, `this` remains unchanged.
 		If `this.length < 2`, `this` remains unchanged.
 	**/
 	**/
-	function reverse() : Void;
+	function reverse():Void;
 
 
 	/**
 	/**
 		Removes the first element of `this` Array and returns it.
 		Removes the first element of `this` Array and returns it.
@@ -110,7 +110,7 @@ extern class Array<T> {
 		If `this` is the empty Array `[]`, `null` is returned and the length
 		If `this` is the empty Array `[]`, `null` is returned and the length
 		remains 0.
 		remains 0.
 	**/
 	**/
-	function shift() : Null<T>;
+	function shift():Null<T>;
 
 
 	/**
 	/**
 		Creates a shallow copy of the range of `this` Array, starting at and
 		Creates a shallow copy of the range of `this` Array, starting at and
@@ -130,7 +130,7 @@ extern class Array<T> {
 		If `pos` exceeds `this.length` or if `end` is less than or equals
 		If `pos` exceeds `this.length` or if `end` is less than or equals
 		`pos`, the result is `[]`.
 		`pos`, the result is `[]`.
 	**/
 	**/
-	function slice( pos : Int, ?end : Int ) : Array<T>;
+	function slice(pos:Int, ?end:Int):Array<T>;
 
 
 	/**
 	/**
 		Sorts `this` Array according to the comparison function `f`, where
 		Sorts `this` Array according to the comparison function `f`, where
@@ -145,7 +145,7 @@ extern class Array<T> {
 
 
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
-	function sort( f : T -> T -> Int ) : Void;
+	function sort(f:T->T->Int):Void;
 
 
 	/**
 	/**
 		Removes `len` elements from `this` Array, starting at and including
 		Removes `len` elements from `this` Array, starting at and including
@@ -153,7 +153,7 @@ extern class Array<T> {
 
 
 		This operation modifies `this` Array in place.
 		This operation modifies `this` Array in place.
 
 
-		If `len` is < 0 or `pos` exceeds `this`.length, an empty Array [] is 
+		If `len` is < 0 or `pos` exceeds `this`.length, an empty Array [] is
 		returned and `this` Array is unchanged.
 		returned and `this` Array is unchanged.
 
 
 		If `pos` is negative, its value is calculated from the end	of `this`
 		If `pos` is negative, its value is calculated from the end	of `this`
@@ -169,7 +169,7 @@ extern class Array<T> {
 		words, each element of the original `this` Array either remains in
 		words, each element of the original `this` Array either remains in
 		`this` Array or becomes an element of the returned Array.
 		`this` Array or becomes an element of the returned Array.
 	**/
 	**/
-	function splice( pos : Int, len : Int ) : Array<T>;
+	function splice(pos:Int, len:Int):Array<T>;
 
 
 	/**
 	/**
 		Returns a string representation of `this` Array.
 		Returns a string representation of `this` Array.
@@ -179,7 +179,7 @@ extern class Array<T> {
 		use `Std.string()` to get a String representation that is consistent
 		use `Std.string()` to get a String representation that is consistent
 		across platforms.
 		across platforms.
 	**/
 	**/
-	function toString() : String;
+	function toString():String;
 
 
 	/**
 	/**
 		Adds the element `x` at the start of `this` Array.
 		Adds the element `x` at the start of `this` Array.
@@ -188,7 +188,7 @@ extern class Array<T> {
 
 
 		`this.length` and the index of each Array element increases by 1.
 		`this.length` and the index of each Array element increases by 1.
 	**/
 	**/
-	function unshift( x : T ) : Void;
+	function unshift(x:T):Void;
 
 
 	/**
 	/**
 		Inserts the element `x` at the position `pos`.
 		Inserts the element `x` at the position `pos`.
@@ -207,7 +207,7 @@ extern class Array<T> {
 		and including that offset to the end of `this` Array are moved one index
 		and including that offset to the end of `this` Array are moved one index
 		ahead.
 		ahead.
 	**/
 	**/
-	function insert( pos : Int, x : T ) : Void;
+	function insert(pos:Int, x:T):Void;
 
 
 	/**
 	/**
 		Removes the first occurrence of `x` in `this` Array.
 		Removes the first occurrence of `x` in `this` Array.
@@ -221,7 +221,7 @@ extern class Array<T> {
 		If `x` is not found, `this` Array is not changed and the function
 		If `x` is not found, `this` Array is not changed and the function
 		returns false.
 		returns false.
 	**/
 	**/
-	function remove( x : T ) : Bool;
+	function remove(x:T):Bool;
 
 
 	/**
 	/**
 		Returns position of the first occurrence of `x` in `this` Array, searching front to back.
 		Returns position of the first occurrence of `x` in `this` Array, searching front to back.
@@ -236,7 +236,7 @@ extern class Array<T> {
 		starting index is less than 0, the whole array will be searched, if it is greater than
 		starting index is less than 0, the whole array will be searched, if it is greater than
 		or equal to the length of `this` Array, the function returns -1.
 		or equal to the length of `this` Array, the function returns -1.
 	**/
 	**/
-	function indexOf( x : T, ?fromIndex:Int ) : Int;
+	function indexOf(x:T, ?fromIndex:Int):Int;
 
 
 	/**
 	/**
 		Returns position of the last occurrence of `x` in `this` Array, searching back to front.
 		Returns position of the last occurrence of `x` in `this` Array, searching back to front.
@@ -251,7 +251,7 @@ extern class Array<T> {
 		given or computed starting index is greater than or equal to the length of `this` Array,
 		given or computed starting index is greater than or equal to the length of `this` Array,
 		the whole array will be searched, if it is less than 0, the function returns -1.
 		the whole array will be searched, if it is less than 0, the function returns -1.
 	**/
 	**/
-	function lastIndexOf( x : T, ?fromIndex:Int ) : Int;
+	function lastIndexOf(x:T, ?fromIndex:Int):Int;
 
 
 	/**
 	/**
 		Returns a shallow copy of `this` Array.
 		Returns a shallow copy of `this` Array.
@@ -260,12 +260,12 @@ extern class Array<T> {
 		`a[i] == a.copy()[i]` is true for any valid `i`. However,
 		`a[i] == a.copy()[i]` is true for any valid `i`. However,
 		`a == a.copy()` is always false.
 		`a == a.copy()` is always false.
 	**/
 	**/
-	function copy() : Array<T>;
+	function copy():Array<T>;
 
 
 	/**
 	/**
 		Returns an iterator of the Array values.
 		Returns an iterator of the Array values.
 	**/
 	**/
-	function iterator() : Iterator<T>;
+	function iterator():Iterator<T>;
 
 
 	/**
 	/**
 		Creates a new Array by applying function `f` to all elements of `this`.
 		Creates a new Array by applying function `f` to all elements of `this`.
@@ -274,7 +274,7 @@ extern class Array<T> {
 
 
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
-	function map<S>( f : T -> S ) : Array<S>;
+	function map<S>(f:T->S):Array<S>;
 
 
 	/**
 	/**
 		Returns an Array containing those elements of `this` for which `f`
 		Returns an Array containing those elements of `this` for which `f`
@@ -284,7 +284,7 @@ extern class Array<T> {
 
 
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
-	function filter( f : T -> Bool ) : Array<T>;
+	function filter(f:T->Bool):Array<T>;
 
 
 	/**
 	/**
 		Set the length of the Array.
 		Set the length of the Array.
@@ -298,5 +298,5 @@ extern class Array<T> {
 		- 0, 0.0 or false for Int, Float and Bool respectively on static targets
 		- 0, 0.0 or false for Int, Float and Bool respectively on static targets
 		- null for other types on static targets
 		- null for other types on static targets
 	**/
 	**/
-	function resize( len : Int ) : Void;
+	function resize(len:Int):Void;
 }
 }

+ 2 - 2
std/Class.hx

@@ -19,6 +19,7 @@
  * 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.
  */
  */
+
 /**
 /**
 	An abstract type that represents a Class.
 	An abstract type that represents a Class.
 
 
@@ -26,5 +27,4 @@
 
 
 	@see https://haxe.org/manual/types-class-instance.html
 	@see https://haxe.org/manual/types-class-instance.html
 **/
 **/
-@:coreType @:runtimeValue abstract Class<T> {
-}
+@:coreType @:runtimeValue abstract Class<T> {}

+ 60 - 65
std/Date.hx

@@ -20,7 +20,7 @@
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
 
 
- /**
+/**
 	The Date class provides a basic structure for date and time related
 	The Date class provides a basic structure for date and time related
 	information. Date instances can be created by
 	information. Date instances can be created by
 
 
@@ -34,8 +34,7 @@
 	In the context of Haxe dates, a timestamp is defined as the number of
 	In the context of Haxe dates, a timestamp is defined as the number of
 	milliseconds elapsed since 1st January 1970.
 	milliseconds elapsed since 1st January 1970.
 **/
 **/
-extern class Date
-{
+extern class Date {
 	/**
 	/**
 		Creates a new date object from the given arguments.
 		Creates a new date object from the given arguments.
 
 
@@ -48,7 +47,7 @@ extern class Date
 		- min: 0 to 59
 		- min: 0 to 59
 		- sec: 0 to 59
 		- sec: 0 to 59
 	**/
 	**/
-	function new(year : Int, month : Int, day : Int, hour : Int, min : Int, sec : Int ) : Void;
+	function new(year:Int, month:Int, day:Int, hour:Int, min:Int, sec:Int):Void;
 
 
 	/**
 	/**
 		Returns the timestamp (in milliseconds) of the date. It might
 		Returns the timestamp (in milliseconds) of the date. It might
@@ -57,42 +56,42 @@ extern class Date
 		For measuring time differences with millisecond accuracy on
 		For measuring time differences with millisecond accuracy on
 		all platforms, see `haxe.Timer.stamp`.
 		all platforms, see `haxe.Timer.stamp`.
 	**/
 	**/
-	function getTime() : Float;
+	function getTime():Float;
 
 
 	/**
 	/**
 		Returns the hours of `this` Date (0-23 range).
 		Returns the hours of `this` Date (0-23 range).
 	**/
 	**/
-	function getHours() : Int;
+	function getHours():Int;
 
 
 	/**
 	/**
 		Returns the minutes of `this` Date (0-59 range).
 		Returns the minutes of `this` Date (0-59 range).
 	**/
 	**/
-	function getMinutes() : Int;
+	function getMinutes():Int;
 
 
 	/**
 	/**
 		Returns the seconds of `this` Date (0-59 range).
 		Returns the seconds of `this` Date (0-59 range).
 	**/
 	**/
-	function getSeconds() : Int;
+	function getSeconds():Int;
 
 
 	/**
 	/**
 		Returns the full year of `this` Date (4-digits).
 		Returns the full year of `this` Date (4-digits).
 	**/
 	**/
-	function getFullYear() : Int;
+	function getFullYear():Int;
 
 
 	/**
 	/**
 		Returns the month of `this` Date (0-11 range).
 		Returns the month of `this` Date (0-11 range).
 	**/
 	**/
-	function getMonth() : Int;
+	function getMonth():Int;
 
 
 	/**
 	/**
 		Returns the day of `this` Date (1-31 range).
 		Returns the day of `this` Date (1-31 range).
 	**/
 	**/
-	function getDate() : Int;
+	function getDate():Int;
 
 
 	/**
 	/**
 		Returns the day of the week of `this` Date (0-6 range) where `0` is Sunday.
 		Returns the day of the week of `this` Date (0-6 range) where `0` is Sunday.
 	**/
 	**/
-	function getDay() : Int;
+	function getDay():Int;
 
 
 	/**
 	/**
 		Returns a string representation of `this` Date, by using the
 		Returns a string representation of `this` Date, by using the
@@ -104,12 +103,12 @@ extern class Date
 	/**
 	/**
 		Returns a Date representing the current local time.
 		Returns a Date representing the current local time.
 	**/
 	**/
-	static function now() : Date;
+	static function now():Date;
 
 
 	/**
 	/**
 		Returns a Date from timestamp (in milliseconds) `t`.
 		Returns a Date from timestamp (in milliseconds) `t`.
 	**/
 	**/
-	static function fromTime( t : Float ) : Date;
+	static function fromTime(t:Float):Date;
 
 
 	/**
 	/**
 		Returns a Date from a formatted string `s`, with the following accepted
 		Returns a Date from a formatted string `s`, with the following accepted
@@ -122,56 +121,52 @@ extern class Date
 		The first two formats are expressed in local time, the third in UTC
 		The first two formats are expressed in local time, the third in UTC
 		Epoch.
 		Epoch.
 	**/
 	**/
-	static function fromString( s : String ) : Date;
-
-
-#if flash
-	private static function __init__() : Void untyped {
-		var d : Dynamic = Date;
-		d.now = function() {
-			return __new__(Date);
-		};
-		d.fromTime = function(t){
-			var d : Date = __new__(Date);
-			d.setTime(t);
-			return d;
-		};
-		d.fromString = function(s : String) {
-			switch( s.length ) {
-			case 8: // hh:mm:ss
-				var k = s.split(":");
-				var d : Date = __new__(Date);
-				d.setTime(0);
-				d.setUTCHours(k[0]);
-				d.setUTCMinutes(k[1]);
-				d.setUTCSeconds(k[2]);
+	static function fromString(s:String):Date;
+
+	#if flash
+	private static function __init__():Void
+		untyped {
+			var d:Dynamic = Date;
+			d.now = function() {
+				return __new__(Date);
+			};
+			d.fromTime = function(t) {
+				var d:Date = __new__(Date);
+				d.setTime(t);
 				return d;
 				return d;
-			case 10: // YYYY-MM-DD
-				var k = s.split("-");
-				return new Date(cast k[0],cast k[1] - 1,cast k[2],0,0,0);
-			case 19: // YYYY-MM-DD hh:mm:ss
-				var k = s.split(" ");
-				var y = k[0].split("-");
-				var t = k[1].split(":");
-				return new Date(cast y[0],cast y[1] - 1,cast y[2],cast t[0],cast t[1],cast t[2]);
-			default:
-				throw "Invalid date format : " + s;
-			}
-		};
-		d.prototype[#if (as3 || no_flash_override) "toStringHX" #else "toString" #end] = function() {
-			var date : Date = __this__;
-			var m = date.getMonth() + 1;
-			var d = date.getDate();
-			var h = date.getHours();
-			var mi = date.getMinutes();
-			var s = date.getSeconds();
-			return date.getFullYear()
-				+"-"+(if( m < 10 ) "0"+m else ""+m)
-				+"-"+(if( d < 10 ) "0"+d else ""+d)
-				+" "+(if( h < 10 ) "0"+h else ""+h)
-				+":"+(if( mi < 10 ) "0"+mi else ""+mi)
-				+":"+(if( s < 10 ) "0"+s else ""+s);
-		};
-	}
-#end
+			};
+			d.fromString = function(s:String) {
+				switch (s.length) {
+					case 8: // hh:mm:ss
+						var k = s.split(":");
+						var d:Date = __new__(Date);
+						d.setTime(0);
+						d.setUTCHours(k[0]);
+						d.setUTCMinutes(k[1]);
+						d.setUTCSeconds(k[2]);
+						return d;
+					case 10: // YYYY-MM-DD
+						var k = s.split("-");
+						return new Date(cast k[0], cast k[1] - 1, cast k[2], 0, 0, 0);
+					case 19: // YYYY-MM-DD hh:mm:ss
+						var k = s.split(" ");
+						var y = k[0].split("-");
+						var t = k[1].split(":");
+						return new Date(cast y[0], cast y[1] - 1, cast y[2], cast t[0], cast t[1], cast t[2]);
+					default:
+						throw "Invalid date format : " + s;
+				}
+			};
+			d.prototype[#if (as3 || no_flash_override) "toStringHX" #else "toString" #end] = function() {
+				var date:Date = __this__;
+				var m = date.getMonth() + 1;
+				var d = date.getDate();
+				var h = date.getHours();
+				var mi = date.getMinutes();
+				var s = date.getSeconds();
+				return date.getFullYear() + "-" + (if (m < 10) "0" + m else "" + m) + "-" + (if (d < 10) "0" + d else "" + d) + " "
+					+ (if (h < 10) "0" + h else "" + h) + ":" + (if (mi < 10) "0" + mi else "" + mi) + ":" + (if (s < 10) "0" + s else "" + s);
+			};
+		}
+	#end
 }
 }

+ 72 - 60
std/DateTools.hx

@@ -28,93 +28,99 @@
 	milliseconds elapsed since 1st January 1970.
 	milliseconds elapsed since 1st January 1970.
 **/
 **/
 class DateTools {
 class DateTools {
-
 	#if php
 	#if php
 	#elseif (neko && !(macro || interp))
 	#elseif (neko && !(macro || interp))
-	static var date_format = neko.Lib.load("std","date_format",2);
+	static var date_format = neko.Lib.load("std", "date_format", 2);
 	#else
 	#else
 	static var DAY_SHORT_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
 	static var DAY_SHORT_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
 	static var DAY_NAMES = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
 	static var DAY_NAMES = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
-	static var MONTH_SHORT_NAMES = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
-	static var MONTH_NAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
+	static var MONTH_SHORT_NAMES = [
+		"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+	];
+	static var MONTH_NAMES = [
+		"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+	];
 
 
-	private static function __format_get( d : Date, e : String ) : String {
-		return switch( e ){
+	private static function __format_get(d:Date, e:String):String {
+		return switch (e) {
 			case "%":
 			case "%":
 				"%";
 				"%";
 			case "a":
 			case "a":
 				DAY_SHORT_NAMES[d.getDay()];
 				DAY_SHORT_NAMES[d.getDay()];
 			case "A":
 			case "A":
 				DAY_NAMES[d.getDay()];
 				DAY_NAMES[d.getDay()];
-			case "b","h":
+			case "b", "h":
 				MONTH_SHORT_NAMES[d.getMonth()];
 				MONTH_SHORT_NAMES[d.getMonth()];
 			case "B":
 			case "B":
 				MONTH_NAMES[d.getMonth()];
 				MONTH_NAMES[d.getMonth()];
 			case "C":
 			case "C":
-				untyped StringTools.lpad(Std.string(Std.int(d.getFullYear()/100)),"0",2);
+				untyped StringTools.lpad(Std.string(Std.int(d.getFullYear() / 100)), "0", 2);
 			case "d":
 			case "d":
-				untyped StringTools.lpad(Std.string(d.getDate()),"0",2);
+				untyped StringTools.lpad(Std.string(d.getDate()), "0", 2);
 			case "D":
 			case "D":
-				__format(d,"%m/%d/%y");
+				__format(d, "%m/%d/%y");
 			case "e":
 			case "e":
 				untyped Std.string(d.getDate());
 				untyped Std.string(d.getDate());
 			case "F":
 			case "F":
-				__format(d,"%Y-%m-%d");
-			case "H","k":
-				untyped StringTools.lpad(Std.string(d.getHours()),if( e == "H" ) "0" else " ",2);
-			case "I","l":
-				var hour = d.getHours()%12;
-				untyped StringTools.lpad(Std.string(hour == 0 ? 12 : hour),if( e == "I" ) "0" else " ",2);
+				__format(d, "%Y-%m-%d");
+			case "H", "k":
+				untyped StringTools.lpad(Std.string(d.getHours()), if (e == "H") "0" else " ", 2);
+			case "I", "l":
+				var hour = d.getHours() % 12;
+				untyped StringTools.lpad(Std.string(hour == 0 ? 12 : hour), if (e == "I") "0" else " ", 2);
 			case "m":
 			case "m":
-				untyped StringTools.lpad(Std.string(d.getMonth()+1),"0",2);
+				untyped StringTools.lpad(Std.string(d.getMonth() + 1), "0", 2);
 			case "M":
 			case "M":
-				untyped StringTools.lpad(Std.string(d.getMinutes()),"0",2);
+				untyped StringTools.lpad(Std.string(d.getMinutes()), "0", 2);
 			case "n":
 			case "n":
 				"\n";
 				"\n";
 			case "p":
 			case "p":
-				untyped if( d.getHours() > 11 ) "PM"; else "AM";
+				untyped if (d.getHours() > 11) "PM"; else "AM";
 			case "r":
 			case "r":
-				__format(d,"%I:%M:%S %p");
+				__format(d, "%I:%M:%S %p");
 			case "R":
 			case "R":
-				__format(d,"%H:%M");
+				__format(d, "%H:%M");
 			case "s":
 			case "s":
-				Std.string(Std.int(d.getTime()/1000));
+				Std.string(Std.int(d.getTime() / 1000));
 			case "S":
 			case "S":
-				untyped StringTools.lpad(Std.string(d.getSeconds()),"0",2);
+				untyped StringTools.lpad(Std.string(d.getSeconds()), "0", 2);
 			case "t":
 			case "t":
 				"\t";
 				"\t";
 			case "T":
 			case "T":
-				__format(d,"%H:%M:%S");
+				__format(d, "%H:%M:%S");
 			case "u":
 			case "u":
-				untyped{
+				untyped {
 					var t = d.getDay();
 					var t = d.getDay();
-					if( t == 0 ) "7"; else Std.string(t);
+					if (t == 0)
+						"7";
+					else
+						Std.string(t);
 				}
 				}
 			case "w":
 			case "w":
 				untyped Std.string(d.getDay());
 				untyped Std.string(d.getDay());
 			case "y":
 			case "y":
-				untyped StringTools.lpad(Std.string(d.getFullYear()%100),"0",2);
+				untyped StringTools.lpad(Std.string(d.getFullYear() % 100), "0", 2);
 			case "Y":
 			case "Y":
 				untyped Std.string(d.getFullYear());
 				untyped Std.string(d.getFullYear());
 			default:
 			default:
-				throw "Date.format %"+e+"- not implemented yet.";
+				throw "Date.format %" + e + "- not implemented yet.";
 		}
 		}
 	}
 	}
 
 
-	private static function __format( d : Date, f : String ) : String {
+	private static function __format(d:Date, f:String):String {
 		var r = new StringBuf();
 		var r = new StringBuf();
 		var p = 0;
 		var p = 0;
-		while( true ){
+		while (true) {
 			var np = f.indexOf("%", p);
 			var np = f.indexOf("%", p);
-			if( np < 0 )
+			if (np < 0)
 				break;
 				break;
 
 
-			r.addSub(f,p,np-p);
-			r.add( __format_get(d, f.substr(np+1,1) ) );
+			r.addSub(f, p, np - p);
+			r.add(__format_get(d, f.substr(np + 1, 1)));
 
 
-			p = np+2;
+			p = np + 2;
 		}
 		}
-		r.addSub(f,p,f.length-p);
+		r.addSub(f, p, f.length - p);
 		return r.toString();
 		return r.toString();
 	}
 	}
 	#end
 	#end
@@ -140,13 +146,13 @@ class DateTools {
 		// 2016-07-08
 		// 2016-07-08
 		```
 		```
 	**/
 	**/
-	public static function format( d : Date, f : String ) : String {
+	public static function format(d:Date, f:String):String {
 		#if (neko && !(macro || interp))
 		#if (neko && !(macro || interp))
-			return new String(untyped date_format(d.__t, f.__s));
+		return new String(untyped date_format(d.__t, f.__s));
 		#elseif php
 		#elseif php
-			return php.Global.strftime(f, php.Syntax.int(@:privateAccess d.__t));
+		return php.Global.strftime(f, php.Syntax.int(@:privateAccess d.__t));
 		#else
 		#else
-			return __format(d,f);
+		return __format(d, f);
 		#end
 		#end
 	}
 	}
 
 
@@ -156,8 +162,8 @@ class DateTools {
 		This is a convenience function for calling
 		This is a convenience function for calling
 		`Date.fromTime(d.getTime() + t)`.
 		`Date.fromTime(d.getTime() + t)`.
 	**/
 	**/
-	public static inline function delta( d : Date, t : Float ) : Date {
-		return Date.fromTime( d.getTime() + t );
+	public static inline function delta(d:Date, t:Float):Date {
+		return Date.fromTime(d.getTime() + t);
 	}
 	}
 
 
 	static var DAYS_OF_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
 	static var DAYS_OF_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
@@ -167,7 +173,7 @@ class DateTools {
 
 
 		This method handles leap years.
 		This method handles leap years.
 	**/
 	**/
-	public static function getMonthDays( d : Date ) : Int {
+	public static function getMonthDays(d:Date):Int {
 		var month = d.getMonth();
 		var month = d.getMonth();
 		var year = d.getFullYear();
 		var year = d.getFullYear();
 
 
@@ -181,51 +187,57 @@ class DateTools {
 	/**
 	/**
 		Converts a number of seconds to a timestamp.
 		Converts a number of seconds to a timestamp.
 	**/
 	**/
-	public static inline function seconds( n : Float ) : Float {
+	public static inline function seconds(n:Float):Float {
 		return n * 1000.0;
 		return n * 1000.0;
 	}
 	}
 
 
 	/**
 	/**
 		Converts a number of minutes to a timestamp.
 		Converts a number of minutes to a timestamp.
 	**/
 	**/
-	#if as3 extern #end public static inline function minutes( n : Float ) : Float {
+	#if as3 extern #end public static inline function minutes(n:Float):Float {
 		return n * 60.0 * 1000.0;
 		return n * 60.0 * 1000.0;
 	}
 	}
 
 
 	/**
 	/**
 		Converts a number of hours to a timestamp.
 		Converts a number of hours to a timestamp.
 	**/
 	**/
-	public static inline function hours( n : Float ) : Float {
+	public static inline function hours(n:Float):Float {
 		return n * 60.0 * 60.0 * 1000.0;
 		return n * 60.0 * 60.0 * 1000.0;
 	}
 	}
 
 
 	/**
 	/**
 		Converts a number of days to a timestamp.
 		Converts a number of days to a timestamp.
 	**/
 	**/
-	public static inline function days( n : Float ) : Float {
+	public static inline function days(n:Float):Float {
 		return n * 24.0 * 60.0 * 60.0 * 1000.0;
 		return n * 24.0 * 60.0 * 60.0 * 1000.0;
 	}
 	}
 
 
 	/**
 	/**
 		Separate a date-time into several components
 		Separate a date-time into several components
 	**/
 	**/
-	public static function parse( t : Float ) {
+	public static function parse(t:Float) {
 		var s = t / 1000;
 		var s = t / 1000;
 		var m = s / 60;
 		var m = s / 60;
 		var h = m / 60;
 		var h = m / 60;
 		return {
 		return {
-			ms : t % 1000,
-			seconds : Std.int(s % 60),
-			minutes : Std.int(m % 60),
-			hours : Std.int(h % 24),
-			days : Std.int(h / 24),
+			ms: t % 1000,
+			seconds: Std.int(s % 60),
+			minutes: Std.int(m % 60),
+			hours: Std.int(h % 24),
+			days: Std.int(h / 24),
 		};
 		};
 	}
 	}
 
 
 	/**
 	/**
 		Build a date-time from several components
 		Build a date-time from several components
 	**/
 	**/
-	public static function make( o : { ms : Float, seconds : Int, minutes : Int, hours : Int, days : Int } ) {
+	public static function make(o:{
+		ms:Float,
+		seconds:Int,
+		minutes:Int,
+		hours:Int,
+		days:Int
+	}) {
 		return o.ms + 1000.0 * (o.seconds + 60.0 * (o.minutes + 60.0 * (o.hours + 24.0 * o.days)));
 		return o.ms + 1000.0 * (o.seconds + 60.0 * (o.minutes + 60.0 * (o.hours + 24.0 * o.days)));
 	}
 	}
 
 
@@ -233,16 +245,16 @@ class DateTools {
 	/**
 	/**
 		Retrieve Unix timestamp value from Date components. Takes same argument sequence as the Date constructor.
 		Retrieve Unix timestamp value from Date components. Takes same argument sequence as the Date constructor.
 	**/
 	**/
-	public static #if (js || flash || php) inline #end function makeUtc(year : Int, month : Int, day : Int, hour : Int, min : Int, sec : Int ):Float {
-	    #if (js || flash || python)
-		   return untyped Date.UTC(year, month, day, hour, min, sec);
+	public static #if (js || flash || php) inline #end function makeUtc(year:Int, month:Int, day:Int, hour:Int, min:Int, sec:Int):Float {
+		#if (js || flash || python)
+		return untyped Date.UTC(year, month, day, hour, min, sec);
 		#elseif php
 		#elseif php
-		   return php.Global.gmmktime(hour, min, sec, month + 1, day, year) * 1000;
+		return php.Global.gmmktime(hour, min, sec, month + 1, day, year) * 1000;
 		#elseif cpp
 		#elseif cpp
-		  return untyped __global__.__hxcpp_utc_date(year,month,day,hour,min,sec)*1000.0 ;
+		return untyped __global__.__hxcpp_utc_date(year, month, day, hour, min, sec) * 1000.0;
 		#else
 		#else
-			//TODO
-		   return 0.;
+		// TODO
+		return 0.;
 		#end
 		#end
 	}
 	}
 	#end
 	#end

+ 11 - 12
std/EReg.hx

@@ -37,7 +37,6 @@
 	<https://haxe.org/manual/std-regex.html>
 	<https://haxe.org/manual/std-regex.html>
 **/
 **/
 class EReg {
 class EReg {
-
 	/**
 	/**
 		Creates a new regular expression with pattern `r` and modifiers `opt`.
 		Creates a new regular expression with pattern `r` and modifiers `opt`.
 
 
@@ -45,7 +44,7 @@ class EReg {
 
 
 		If `r` or `opt` are null, the result is unspecified.
 		If `r` or `opt` are null, the result is unspecified.
 	**/
 	**/
-	public function new( r : String, opt : String ) {
+	public function new(r:String, opt:String) {
 		throw "Regular expressions are not implemented for this platform";
 		throw "Regular expressions are not implemented for this platform";
 	}
 	}
 
 
@@ -56,7 +55,7 @@ class EReg {
 
 
 		If `s` is `null`, the result is unspecified.
 		If `s` is `null`, the result is unspecified.
 	**/
 	**/
-	public function match( s : String ) : Bool {
+	public function match(s:String):Bool {
 		return false;
 		return false;
 	}
 	}
 
 
@@ -71,7 +70,7 @@ class EReg {
 
 
 		If `n` equals 0, the whole matched substring is returned.
 		If `n` equals 0, the whole matched substring is returned.
 	**/
 	**/
-	public function matched( n : Int ) : String {
+	public function matched(n:Int):String {
 		return null;
 		return null;
 	}
 	}
 
 
@@ -86,7 +85,7 @@ class EReg {
 
 
 		The result does not include the matched part.
 		The result does not include the matched part.
 	**/
 	**/
-	public function matchedLeft() : String {
+	public function matchedLeft():String {
 		return null;
 		return null;
 	}
 	}
 
 
@@ -101,7 +100,7 @@ class EReg {
 
 
 		The result does not include the matched part.
 		The result does not include the matched part.
 	**/
 	**/
-	public function matchedRight() : String {
+	public function matchedRight():String {
 		return null;
 		return null;
 	}
 	}
 
 
@@ -116,7 +115,7 @@ class EReg {
 		If the global g modifier was in place for the matching, the position and
 		If the global g modifier was in place for the matching, the position and
 		length of the leftmost substring is returned.
 		length of the leftmost substring is returned.
 	**/
 	**/
-	public function matchedPos() : { pos : Int, len : Int } {
+	public function matchedPos():{pos:Int, len:Int} {
 		return null;
 		return null;
 	}
 	}
 
 
@@ -131,7 +130,7 @@ class EReg {
 
 
 		If `s` is null, the result is unspecified.
 		If `s` is null, the result is unspecified.
 	**/
 	**/
-	public function matchSub( s : String, pos : Int, len : Int = -1):Bool {
+	public function matchSub(s:String, pos:Int, len:Int = -1):Bool {
 		return false;
 		return false;
 	}
 	}
 
 
@@ -153,7 +152,7 @@ class EReg {
 
 
 		If `s` is null, the result is unspecified.
 		If `s` is null, the result is unspecified.
 	**/
 	**/
-	public function split( s : String ) : Array<String> {
+	public function split(s:String):Array<String> {
 		return null;
 		return null;
 	}
 	}
 
 
@@ -171,7 +170,7 @@ class EReg {
 
 
 		If `s` or `by` are null, the result is unspecified.
 		If `s` or `by` are null, the result is unspecified.
 	**/
 	**/
-	public function replace( s : String, by : String ) : String {
+	public function replace(s:String, by:String):String {
 		return null;
 		return null;
 	}
 	}
 
 
@@ -189,7 +188,7 @@ class EReg {
 
 
 		If `s` or `f` are null, the result is unspecified.
 		If `s` or `f` are null, the result is unspecified.
 	**/
 	**/
-	public function map( s : String, f : EReg -> String ) : String {
+	public function map(s:String, f:EReg->String):String {
 		return null;
 		return null;
 	}
 	}
 
 
@@ -198,7 +197,7 @@ class EReg {
 
 
 		If `s` is null, the result is unspecified.
 		If `s` is null, the result is unspecified.
 	**/
 	**/
-	public static function escape( s : String ) : String {
+	public static function escape(s:String):String {
 		return null;
 		return null;
 	}
 	}
 }
 }

+ 1 - 2
std/Enum.hx

@@ -29,5 +29,4 @@
 
 
 	@see https://haxe.org/manual/types-enum-instance.html
 	@see https://haxe.org/manual/types-enum-instance.html
 **/
 **/
-@:coreType @:runtimeValue abstract Enum<T> {
-}
+@:coreType @:runtimeValue abstract Enum<T> {}

+ 4 - 6
std/IntIterator.hx

@@ -20,7 +20,7 @@
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
 
 
- /**
+/**
 	IntIterator is used for implementing interval iterations.
 	IntIterator is used for implementing interval iterations.
 
 
 	It is usually not used explicitly, but through its special syntax:
 	It is usually not used explicitly, but through its special syntax:
@@ -34,16 +34,15 @@
 	@see https://haxe.org/manual/lf-iterators.html
 	@see https://haxe.org/manual/lf-iterators.html
 **/
 **/
 class IntIterator {
 class IntIterator {
-
-	var min : Int;
-	var max : Int;
+	var min:Int;
+	var max:Int;
 
 
 	/**
 	/**
 		Iterates from `min` (inclusive) to `max` (exclusive).
 		Iterates from `min` (inclusive) to `max` (exclusive).
 
 
 		If `max <= min`, the iterator will not act as a countdown.
 		If `max <= min`, the iterator will not act as a countdown.
 	**/
 	**/
-	public inline function new( min : Int, max : Int ) {
+	public inline function new(min:Int, max:Int) {
 		this.min = min;
 		this.min = min;
 		this.max = max;
 		this.max = max;
 	}
 	}
@@ -63,5 +62,4 @@ class IntIterator {
 	public inline function next() {
 	public inline function next() {
 		return min++;
 		return min++;
 	}
 	}
-
 }
 }

+ 41 - 43
std/Lambda.hx

@@ -1,4 +1,3 @@
-import haxe.ds.List;
 /*
 /*
  * Copyright (C)2005-2019 Haxe Foundation
  * Copyright (C)2005-2019 Haxe Foundation
  *
  *
@@ -21,6 +20,8 @@ import haxe.ds.List;
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  */
  */
 
 
+import haxe.ds.List;
+
 /**
 /**
 	The `Lambda` class is a collection of methods to support functional
 	The `Lambda` class is a collection of methods to support functional
 	programming. It is ideally used with `using Lambda` and then acts as an
 	programming. It is ideally used with `using Lambda` and then acts as an
@@ -35,18 +36,15 @@ import haxe.ds.List;
 
 
 	@see https://haxe.org/manual/std-Lambda.html
 	@see https://haxe.org/manual/std-Lambda.html
 **/
 **/
-
 class Lambda {
 class Lambda {
-
-
 	/**
 	/**
 		Creates an Array from Iterable `it`.
 		Creates an Array from Iterable `it`.
 
 
 		If `it` is an Array, this function returns a copy of it.
 		If `it` is an Array, this function returns a copy of it.
 	**/
 	**/
-	public static function array<A>( it : Iterable<A> ) : Array<A> {
+	public static function array<A>(it:Iterable<A>):Array<A> {
 		var a = new Array<A>();
 		var a = new Array<A>();
-		for(i in it)
+		for (i in it)
 			a.push(i);
 			a.push(i);
 		return a;
 		return a;
 	}
 	}
@@ -56,9 +54,9 @@ class Lambda {
 
 
 		If `it` is a List, this function returns a copy of it.
 		If `it` is a List, this function returns a copy of it.
 	**/
 	**/
-	public static function list<A>( it : Iterable<A> ) : List<A> {
+	public static function list<A>(it:Iterable<A>):List<A> {
 		var l = new List<A>();
 		var l = new List<A>();
-		for(i in it)
+		for (i in it)
 			l.add(i);
 			l.add(i);
 		return l;
 		return l;
 	}
 	}
@@ -68,7 +66,7 @@ class Lambda {
 		The order of elements is preserved.
 		The order of elements is preserved.
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
-	public static inline function map<A,B>( it : Iterable<A>, f : A -> B ) : Array<B> {
+	public static inline function map<A, B>(it:Iterable<A>, f:A->B):Array<B> {
 		return [for (x in it) f(x)];
 		return [for (x in it) f(x)];
 	}
 	}
 
 
@@ -77,7 +75,7 @@ class Lambda {
 		The order of elements is preserved.
 		The order of elements is preserved.
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
-	public static inline function mapi<A,B>( it : Iterable<A>, f : Int -> A -> B ) : Array<B> {
+	public static inline function mapi<A, B>(it:Iterable<A>, f:Int->A->B):Array<B> {
 		var i = 0;
 		var i = 0;
 		return [for (x in it) f(i++, x)];
 		return [for (x in it) f(i++, x)];
 	}
 	}
@@ -86,7 +84,7 @@ class Lambda {
 		Concatenate a list of iterables.
 		Concatenate a list of iterables.
 		The order of elements is preserved.
 		The order of elements is preserved.
 	**/
 	**/
-	public static inline function flatten<A>( it : Iterable<Iterable<A>> ) : Array<A> {
+	public static inline function flatten<A>(it:Iterable<Iterable<A>>):Array<A> {
 		return [for (e in it) for (x in e) x];
 		return [for (e in it) for (x in e) x];
 	}
 	}
 
 
@@ -95,7 +93,7 @@ class Lambda {
 		The order of elements is preserved.
 		The order of elements is preserved.
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
-	public static inline function flatMap<A,B>( it : Iterable<A>, f: A -> Iterable<B> ) : Array<B> {
+	public static inline function flatMap<A, B>(it:Iterable<A>, f:A->Iterable<B>):Array<B> {
 		return Lambda.flatten(Lambda.map(it, f));
 		return Lambda.flatten(Lambda.map(it, f));
 	}
 	}
 
 
@@ -107,9 +105,9 @@ class Lambda {
 
 
 		If no such element is found, the result is false.
 		If no such element is found, the result is false.
 	**/
 	**/
-	public static function has<A>( it : Iterable<A>, elt : A ) : Bool {
-		for( x in it )
-			if( x == elt )
+	public static function has<A>(it:Iterable<A>, elt:A):Bool {
+		for (x in it)
+			if (x == elt)
 				return true;
 				return true;
 		return false;
 		return false;
 	}
 	}
@@ -124,9 +122,9 @@ class Lambda {
 
 
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
-	public static function exists<A>( it : Iterable<A>, f : A -> Bool ) {
-		for( x in it )
-			if( f(x) )
+	public static function exists<A>(it:Iterable<A>, f:A->Bool) {
+		for (x in it)
+			if (f(x))
 				return true;
 				return true;
 		return false;
 		return false;
 	}
 	}
@@ -143,9 +141,9 @@ class Lambda {
 
 
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
-	public static function foreach<A>( it : Iterable<A>, f : A -> Bool ) {
-		for( x in it )
-			if( !f(x) )
+	public static function foreach<A>(it:Iterable<A>, f:A->Bool) {
+		for (x in it)
+			if (!f(x))
 				return false;
 				return false;
 		return true;
 		return true;
 	}
 	}
@@ -155,8 +153,8 @@ class Lambda {
 
 
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
-	public static function iter<A>( it : Iterable<A>, f : A -> Void ) {
-		for( x in it )
+	public static function iter<A>(it:Iterable<A>, f:A->Void) {
+		for (x in it)
 			f(x);
 			f(x);
 	}
 	}
 
 
@@ -166,7 +164,7 @@ class Lambda {
 		If `it` is empty, the result is the empty Array even if `f` is null.
 		If `it` is empty, the result is the empty Array even if `f` is null.
 		Otherwise if `f` is null, the result is unspecified.
 		Otherwise if `f` is null, the result is unspecified.
 	**/
 	**/
-	public static function filter<A>( it : Iterable<A>, f : A -> Bool ) {
+	public static function filter<A>(it:Iterable<A>, f:A->Bool) {
 		return [for (x in it) if (f(x)) x];
 		return [for (x in it) if (f(x)) x];
 	}
 	}
 
 
@@ -182,9 +180,9 @@ class Lambda {
 
 
 		If `it` or `f` are null, the result is unspecified.
 		If `it` or `f` are null, the result is unspecified.
 	**/
 	**/
-	public static function fold<A,B>( it : Iterable<A>, f : A -> B -> B, first : B ) : B {
-		for( x in it )
-			first = f(x,first);
+	public static function fold<A, B>(it:Iterable<A>, f:A->B->B, first:B):B {
+		for (x in it)
+			first = f(x, first);
 		return first;
 		return first;
 	}
 	}
 
 
@@ -194,14 +192,14 @@ class Lambda {
 
 
 		This function traverses all elements.
 		This function traverses all elements.
 	**/
 	**/
-	public static function count<A>( it : Iterable<A>, ?pred : A -> Bool ) {
+	public static function count<A>(it:Iterable<A>, ?pred:A->Bool) {
 		var n = 0;
 		var n = 0;
-		if( pred == null )
-			for( _ in it )
+		if (pred == null)
+			for (_ in it)
 				n++;
 				n++;
 		else
 		else
-			for( x in it )
-				if( pred(x) )
+			for (x in it)
+				if (pred(x))
 					n++;
 					n++;
 		return n;
 		return n;
 	}
 	}
@@ -209,7 +207,7 @@ class Lambda {
 	/**
 	/**
 		Tells if Iterable `it` does not contain any element.
 		Tells if Iterable `it` does not contain any element.
 	**/
 	**/
-	public static function empty<T>( it : Iterable<T> ) : Bool {
+	public static function empty<T>(it:Iterable<T>):Bool {
 		return !it.iterator().hasNext();
 		return !it.iterator().hasNext();
 	}
 	}
 
 
@@ -220,10 +218,10 @@ class Lambda {
 
 
 		If `v` does not exist in `it`, the result is -1.
 		If `v` does not exist in `it`, the result is -1.
 	**/
 	**/
-	public static function indexOf<T>( it : Iterable<T>, v : T ) : Int {
+	public static function indexOf<T>(it:Iterable<T>, v:T):Int {
 		var i = 0;
 		var i = 0;
-		for( v2 in it ) {
-			if( v == v2 )
+		for (v2 in it) {
+			if (v == v2)
 				return i;
 				return i;
 			i++;
 			i++;
 		}
 		}
@@ -240,9 +238,10 @@ class Lambda {
 
 
 		If `f` is null, the result is unspecified.
 		If `f` is null, the result is unspecified.
 	**/
 	**/
-	public static function find<T>( it : Iterable<T>, f : T -> Bool ) : Null<T> {
-		for( v in it ) {
-			if(f(v)) return v;
+	public static function find<T>(it:Iterable<T>, f:T->Bool):Null<T> {
+		for (v in it) {
+			if (f(v))
+				return v;
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -253,13 +252,12 @@ class Lambda {
 
 
 		If `a` or `b` are null, the result is unspecified.
 		If `a` or `b` are null, the result is unspecified.
 	**/
 	**/
-	public static function concat<T>( a : Iterable<T>, b : Iterable<T> ) : Array<T> {
+	public static function concat<T>(a:Iterable<T>, b:Iterable<T>):Array<T> {
 		var l = new Array();
 		var l = new Array();
-		for( x in a )
+		for (x in a)
 			l.push(x);
 			l.push(x);
-		for( x in b )
+		for (x in b)
 			l.push(x);
 			l.push(x);
 		return l;
 		return l;
 	}
 	}
-
 }
 }

+ 22 - 1
std/List.hx

@@ -1 +1,22 @@
-typedef List<T> = haxe.ds.List<T>;
+/*
+ * Copyright (C)2005-2019 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.
+ */
+typedef List<T> = haxe.ds.List<T>;

+ 22 - 1
std/Map.hx

@@ -1,5 +1,26 @@
+/*
+ * Copyright (C)2005-2019 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.
+ */
 typedef Map<K, V> = haxe.ds.Map<K, V>;
 typedef Map<K, V> = haxe.ds.Map<K, V>;
 
 
 @:dox(hide)
 @:dox(hide)
 @:deprecated
 @:deprecated
-typedef IMap<K, V> = haxe.Constraints.IMap<K, V>;
+typedef IMap<K, V> = haxe.Constraints.IMap<K, V>;

+ 35 - 47
std/Math.hx

@@ -19,20 +19,22 @@
  * 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.
  */
  */
+
 /**
 /**
 	This class defines mathematical functions and constants.
 	This class defines mathematical functions and constants.
 
 
 	@see https://haxe.org/manual/std-math.html
 	@see https://haxe.org/manual/std-math.html
 **/
 **/
-#if cpp @:include("hxMath.h") #end
+#if cpp
+@:include("hxMath.h")
+#end
 @:pure
 @:pure
-extern class Math
-{
+extern class Math {
 	/**
 	/**
 		Represents the ratio of the circumference of a circle to its diameter,
 		Represents the ratio of the circumference of a circle to its diameter,
 		specified by the constant, π. `PI` is approximately 3.141592653589793.
 		specified by the constant, π. `PI` is approximately 3.141592653589793.
 	**/
 	**/
-	static var PI(default,null) : Float;
+	static var PI(default, null):Float;
 
 
 	/**
 	/**
 		A special `Float` constant which denotes negative infinity.
 		A special `Float` constant which denotes negative infinity.
@@ -45,7 +47,7 @@ extern class Math
 		If this constant is converted to an `Int`, e.g. through `Std.int()`, the
 		If this constant is converted to an `Int`, e.g. through `Std.int()`, the
 		result is unspecified.
 		result is unspecified.
 	**/
 	**/
-	static var NEGATIVE_INFINITY(default, null) : Float;
+	static var NEGATIVE_INFINITY(default, null):Float;
 
 
 	/**
 	/**
 		A special `Float` constant which denotes positive infinity.
 		A special `Float` constant which denotes positive infinity.
@@ -58,7 +60,7 @@ extern class Math
 		If this constant is converted to an `Int`, e.g. through `Std.int()`, the
 		If this constant is converted to an `Int`, e.g. through `Std.int()`, the
 		result is unspecified.
 		result is unspecified.
 	**/
 	**/
-	static var POSITIVE_INFINITY(default,null) : Float;
+	static var POSITIVE_INFINITY(default, null):Float;
 
 
 	/**
 	/**
 		A special `Float` constant which denotes an invalid number.
 		A special `Float` constant which denotes an invalid number.
@@ -74,7 +76,7 @@ extern class Math
 
 
 		In order to test if a value is `NaN`, you should use `Math.isNaN()` function.
 		In order to test if a value is `NaN`, you should use `Math.isNaN()` function.
 	**/
 	**/
-	static var NaN(default, null) : Float;
+	static var NaN(default, null):Float;
 
 
 	/**
 	/**
 		Returns the absolute value of `v`.
 		Returns the absolute value of `v`.
@@ -229,7 +231,7 @@ extern class Math
 		Returns a pseudo-random number which is greater than or equal to 0.0,
 		Returns a pseudo-random number which is greater than or equal to 0.0,
 		and less than 1.0.
 		and less than 1.0.
 	**/
 	**/
-	static function random() : Float;
+	static function random():Float;
 
 
 	#if ((flash && !as3) || cpp || eval)
 	#if ((flash && !as3) || cpp || eval)
 	/**
 	/**
@@ -238,7 +240,7 @@ extern class Math
 		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		the result is unspecified.
 		the result is unspecified.
 	**/
 	**/
-	static function ffloor( v : Float ) : Float;
+	static function ffloor(v:Float):Float;
 
 
 	/**
 	/**
 		Returns the smallest integer value that is not less than `v`, as a `Float`.
 		Returns the smallest integer value that is not less than `v`, as a `Float`.
@@ -246,7 +248,7 @@ extern class Math
 		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		the result is unspecified.
 		the result is unspecified.
 	**/
 	**/
-	static function fceil( v : Float ) : Float;
+	static function fceil(v:Float):Float;
 
 
 	/**
 	/**
 		Rounds `v` to the nearest integer value, as a Float.
 		Rounds `v` to the nearest integer value, as a Float.
@@ -256,32 +258,28 @@ extern class Math
 		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		the result is unspecified.
 		the result is unspecified.
 	**/
 	**/
-	static function fround( v : Float ) : Float;
-
+	static function fround(v:Float):Float;
 	#else
 	#else
-
-	static inline function ffloor( v : Float ) : Float {
+	static inline function ffloor(v:Float):Float {
 		return floor(v);
 		return floor(v);
 	}
 	}
 
 
-	static inline function fceil( v : Float ) : Float {
+	static inline function fceil(v:Float):Float {
 		return ceil(v);
 		return ceil(v);
 	}
 	}
 
 
-	static inline function fround( v : Float ) : Float {
+	static inline function fround(v:Float):Float {
 		return round(v);
 		return round(v);
 	}
 	}
-
 	#end
 	#end
 
 
-
 	/**
 	/**
 		Tells if `f` is a finite number.
 		Tells if `f` is a finite number.
 
 
 		If `f` is `POSITIVE_INFINITY`, `NEGATIVE_INFINITY` or `NaN`, the result
 		If `f` is `POSITIVE_INFINITY`, `NEGATIVE_INFINITY` or `NaN`, the result
 		is `false`, otherwise the result is `true`.
 		is `false`, otherwise the result is `true`.
 	**/
 	**/
-	static function isFinite( f : Float ) : Bool;
+	static function isFinite(f:Float):Bool;
 
 
 	/**
 	/**
 		Tells if `f` is not a valid number.
 		Tells if `f` is not a valid number.
@@ -290,38 +288,28 @@ extern class Math
 		In particular, both `POSITIVE_INFINITY` and `NEGATIVE_INFINITY` are
 		In particular, both `POSITIVE_INFINITY` and `NEGATIVE_INFINITY` are
 		not considered `NaN`.
 		not considered `NaN`.
 	**/
 	**/
-	static function isNaN( f : Float ) : Bool;
+	static function isNaN(f:Float):Bool;
 
 
 	#if !eval
 	#if !eval
-	private static function __init__() : Void untyped {
-	#if flash
-		NaN = __global__["Number"].NaN;
-		NEGATIVE_INFINITY = __global__["Number"].NEGATIVE_INFINITY;
-		POSITIVE_INFINITY = __global__["Number"].POSITIVE_INFINITY;
-	#else
-		//TODO: Abandoned code block? Js has its own _std/Math.hx
-		Math.__name__ = ["Math"];
-		Math.NaN = Number["NaN"];
-		Math.NEGATIVE_INFINITY = Number["NEGATIVE_INFINITY"];
-		Math.POSITIVE_INFINITY = Number["POSITIVE_INFINITY"];
-	#end
-		Math.isFinite = function(i) {
-			return
-			#if flash
-			__global__["isFinite"](i);
-			#else
-			false;
-			#end
-		};
-		Math.isNaN = function(i) {
-			return
+	private static function __init__():Void
+		untyped {
 			#if flash
 			#if flash
-			__global__["isNaN"](i);
+			NaN = __global__["Number"].NaN;
+			NEGATIVE_INFINITY = __global__["Number"].NEGATIVE_INFINITY;
+			POSITIVE_INFINITY = __global__["Number"].POSITIVE_INFINITY;
 			#else
 			#else
-			false;
+			// TODO: Abandoned code block? Js has its own _std/Math.hx
+			Math.__name__ = ["Math"];
+			Math.NaN = Number["NaN"];
+			Math.NEGATIVE_INFINITY = Number["NEGATIVE_INFINITY"];
+			Math.POSITIVE_INFINITY = Number["POSITIVE_INFINITY"];
 			#end
 			#end
-		};
-	}
+			Math.isFinite = function(i) {
+				return #if flash __global__["isFinite"](i); #else false; #end
+			};
+			Math.isNaN = function(i) {
+				return #if flash __global__["isNaN"](i); #else false; #end
+			};
+		}
 	#end
 	#end
-
 }
 }

+ 18 - 19
std/Reflect.hx

@@ -19,6 +19,7 @@
  * 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.
  */
  */
+
 /**
 /**
 	The Reflect API is a way to manipulate values dynamically through an
 	The Reflect API is a way to manipulate values dynamically through an
 	abstract interface in an untyped manner. Use with care.
 	abstract interface in an untyped manner. Use with care.
@@ -26,7 +27,6 @@
 	@see https://haxe.org/manual/std-reflection.html
 	@see https://haxe.org/manual/std-reflection.html
 **/
 **/
 extern class Reflect {
 extern class Reflect {
-
 	/**
 	/**
 		Tells if structure `o` has a field named `field`.
 		Tells if structure `o` has a field named `field`.
 
 
@@ -35,7 +35,7 @@ extern class Reflect {
 
 
 		If `o` or `field` are null, the result is unspecified.
 		If `o` or `field` are null, the result is unspecified.
 	**/
 	**/
-	public static function hasField( o : Dynamic, field : String ) : Bool;
+	public static function hasField(o:Dynamic, field:String):Bool;
 
 
 	/**
 	/**
 		Returns the value of the field named `field` on object `o`.
 		Returns the value of the field named `field` on object `o`.
@@ -51,7 +51,7 @@ extern class Reflect {
 		(As3) If used on a property field, the getter will be invoked. It is
 		(As3) If used on a property field, the getter will be invoked. It is
 		not possible to obtain the value directly.
 		not possible to obtain the value directly.
 	**/
 	**/
-	public static function field( o : Dynamic, field : String ) : Dynamic;
+	public static function field(o:Dynamic, field:String):Dynamic;
 
 
 	/**
 	/**
 		Sets the field named `field` of object `o` to value `value`.
 		Sets the field named `field` of object `o` to value `value`.
@@ -64,7 +64,7 @@ extern class Reflect {
 		(As3) If used on a property field, the setter will be invoked. It is
 		(As3) If used on a property field, the setter will be invoked. It is
 		not possible to set the value directly.
 		not possible to set the value directly.
 	**/
 	**/
-	public static function setField( o : Dynamic, field : String, value : Dynamic ) : Void;
+	public static function setField(o:Dynamic, field:String, value:Dynamic):Void;
 
 
 	/**
 	/**
 		Returns the value of the field named `field` on object `o`, taking
 		Returns the value of the field named `field` on object `o`, taking
@@ -75,7 +75,7 @@ extern class Reflect {
 
 
 		If `o` or `field` are null, the result is unspecified.
 		If `o` or `field` are null, the result is unspecified.
 	**/
 	**/
-	public static function getProperty( o : Dynamic, field : String ) : Dynamic;
+	public static function getProperty(o:Dynamic, field:String):Dynamic;
 
 
 	/**
 	/**
 		Sets the field named `field` of object `o` to value `value`, taking
 		Sets the field named `field` of object `o` to value `value`, taking
@@ -86,7 +86,7 @@ extern class Reflect {
 
 
 		If `field` is null, the result is unspecified.
 		If `field` is null, the result is unspecified.
 	**/
 	**/
-	public static function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void;
+	public static function setProperty(o:Dynamic, field:String, value:Dynamic):Void;
 
 
 	/**
 	/**
 		Call a method `func` with the given arguments `args`.
 		Call a method `func` with the given arguments `args`.
@@ -97,11 +97,11 @@ extern class Reflect {
 		* (neko) Allows switching the context to `o` in all cases.
 		* (neko) Allows switching the context to `o` in all cases.
 		* (macro) Same as neko for Haxe 3. No context switching in Haxe 4.
 		* (macro) Same as neko for Haxe 3. No context switching in Haxe 4.
 		* (js, lua) Require the `o` argument if `func` does not, but should have a context.
 		* (js, lua) Require the `o` argument if `func` does not, but should have a context.
-		    This can occur by accessing a function field natively, e.g. through `Reflect.field`
+			This can occur by accessing a function field natively, e.g. through `Reflect.field`
 			or by using `(object : Dynamic).field`. However, if `func` has a context, `o` is
 			or by using `(object : Dynamic).field`. However, if `func` has a context, `o` is
 			ignored like on other targets.
 			ignored like on other targets.
 	**/
 	**/
-	public static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array<Dynamic> ) : Dynamic;
+	public static function callMethod(o:Dynamic, func:haxe.Constraints.Function, args:Array<Dynamic>):Dynamic;
 
 
 	/**
 	/**
 		Returns the fields of structure `o`.
 		Returns the fields of structure `o`.
@@ -111,14 +111,14 @@ extern class Reflect {
 
 
 		If `o` is null, the result is unspecified.
 		If `o` is null, the result is unspecified.
 	**/
 	**/
-	public static function fields( o : Dynamic ) : Array<String>;
+	public static function fields(o:Dynamic):Array<String>;
 
 
 	/**
 	/**
 		Returns true if `f` is a function, false otherwise.
 		Returns true if `f` is a function, false otherwise.
 
 
 		If `f` is null, the result is false.
 		If `f` is null, the result is false.
 	**/
 	**/
-	public static function isFunction( f : Dynamic ) : Bool;
+	public static function isFunction(f:Dynamic):Bool;
 
 
 	/**
 	/**
 		Compares `a` and `b`.
 		Compares `a` and `b`.
@@ -141,7 +141,7 @@ extern class Reflect {
 		If `a` and `b` are null, the result is 0. If only one of them is null,
 		If `a` and `b` are null, the result is 0. If only one of them is null,
 		the result is unspecified.
 		the result is unspecified.
 	**/
 	**/
-	public static function compare<T>( a : T, b : T ) : Int;
+	public static function compare<T>(a:T, b:T):Int;
 
 
 	/**
 	/**
 		Compares the functions `f1` and `f2`.
 		Compares the functions `f1` and `f2`.
@@ -155,7 +155,7 @@ extern class Reflect {
 		If `f1` or `f2` are member method closures, the result is true if they
 		If `f1` or `f2` are member method closures, the result is true if they
 		are closures of the same method on the same object value, false otherwise.
 		are closures of the same method on the same object value, false otherwise.
 	**/
 	**/
-	public static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool;
+	public static function compareMethods(f1:Dynamic, f2:Dynamic):Bool;
 
 
 	/**
 	/**
 		Tells if `v` is an object.
 		Tells if `v` is an object.
@@ -169,7 +169,7 @@ extern class Reflect {
 
 
 		Otherwise, including if `v` is null, the result is false.
 		Otherwise, including if `v` is null, the result is false.
 	**/
 	**/
-	public static function isObject( v : Dynamic ) : Bool;
+	public static function isObject(v:Dynamic):Bool;
 
 
 	/**
 	/**
 		Tells if `v` is an enum value.
 		Tells if `v` is an enum value.
@@ -179,7 +179,7 @@ extern class Reflect {
 
 
 		Otherwise, including if `v` is null, the result is false.
 		Otherwise, including if `v` is null, the result is false.
 	**/
 	**/
-	public static function isEnumValue( v : Dynamic ) : Bool;
+	public static function isEnumValue(v:Dynamic):Bool;
 
 
 	/**
 	/**
 		Removes the field named `field` from structure `o`.
 		Removes the field named `field` from structure `o`.
@@ -188,7 +188,7 @@ extern class Reflect {
 
 
 		If `o` or `field` are null, the result is unspecified.
 		If `o` or `field` are null, the result is unspecified.
 	**/
 	**/
-	public static function deleteField( o : Dynamic, field : String ) : Bool;
+	public static function deleteField(o:Dynamic, field:String):Bool;
 
 
 	/**
 	/**
 		Copies the fields of structure `o`.
 		Copies the fields of structure `o`.
@@ -197,13 +197,12 @@ extern class Reflect {
 
 
 		If `o` is null, the result is `null`.
 		If `o` is null, the result is `null`.
 	**/
 	**/
-	public static function copy<T>( o : Null<T> ) : Null<T>;
+	public static function copy<T>(o:Null<T>):Null<T>;
 
 
 	/**
 	/**
 		Transform a function taking an array of arguments into a function that can
 		Transform a function taking an array of arguments into a function that can
 		be called with any number of arguments.
 		be called with any number of arguments.
 	**/
 	**/
-	@:overload(function( f : Array<Dynamic> -> Void ) : Dynamic {})
-	public static function makeVarArgs( f : Array<Dynamic> -> Dynamic ) : Dynamic;
-
+	@:overload(function(f:Array<Dynamic>->Void):Dynamic {})
+	public static function makeVarArgs(f:Array<Dynamic>->Dynamic):Dynamic;
 }
 }

+ 8 - 9
std/Std.hx

@@ -27,11 +27,10 @@
 	The Std class provides standard methods for manipulating basic types.
 	The Std class provides standard methods for manipulating basic types.
 **/
 **/
 extern class Std {
 extern class Std {
-
 	/**
 	/**
 		Tells if a value `v` is of the type `t`. Returns `false` if `v` or `t` are null.
 		Tells if a value `v` is of the type `t`. Returns `false` if `v` or `t` are null.
 	**/
 	**/
-	public static function is( v : Dynamic, t : Dynamic ) : Bool;
+	public static function is(v:Dynamic, t:Dynamic):Bool;
 
 
 	/**
 	/**
 		Checks if object `value` is an instance of class or interface `c`.
 		Checks if object `value` is an instance of class or interface `c`.
@@ -49,10 +48,10 @@ extern class Std {
 		If `value` is null, the result is null. If `c` is null, the result is
 		If `value` is null, the result is null. If `c` is null, the result is
 		unspecified.
 		unspecified.
 	**/
 	**/
-	public static function downcast<T:{},S:T>( value : T, c : Class<S> ) : S;
+	public static function downcast<T:{}, S:T>(value:T, c:Class<S>):S;
 
 
 	@:deprecated('Std.instance() is deprecated. Use Std.downcast() instead.')
 	@:deprecated('Std.instance() is deprecated. Use Std.downcast() instead.')
-	public static function instance<T:{},S:T>( value : T, c : Class<S> ) : S;
+	public static function instance<T:{}, S:T>(value:T, c:Class<S>):S;
 
 
 	/**
 	/**
 		Converts any value to a String.
 		Converts any value to a String.
@@ -72,14 +71,14 @@ extern class Std {
 
 
 		If s is null, "null" is returned.
 		If s is null, "null" is returned.
 	**/
 	**/
-	public static function string( s : Dynamic ) : String;
+	public static function string(s:Dynamic):String;
 
 
 	/**
 	/**
 		Converts a `Float` to an `Int`, rounded towards 0.
 		Converts a `Float` to an `Int`, rounded towards 0.
 
 
 		If `x` is outside of the signed Int32 range, or is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, the result is unspecified.
 		If `x` is outside of the signed Int32 range, or is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, the result is unspecified.
 	**/
 	**/
-	public static function int( x : Float ) : Int;
+	public static function int(x:Float):Int;
 
 
 	/**
 	/**
 		Converts a `String` to an `Int`.
 		Converts a `String` to an `Int`.
@@ -102,7 +101,7 @@ extern class Std {
 		If `x` is null, the result is unspecified.
 		If `x` is null, the result is unspecified.
 		If `x` cannot be parsed as integer, the result is `null`.
 		If `x` cannot be parsed as integer, the result is `null`.
 	**/
 	**/
-	public static function parseInt( x : String ) : Null<Int>;
+	public static function parseInt(x:String):Null<Int>;
 
 
 	/**
 	/**
 		Converts a `String` to a `Float`.
 		Converts a `String` to a `Float`.
@@ -112,12 +111,12 @@ extern class Std {
 
 
 		Additionally, decimal notation may contain a single `.` to denote the start of the fractions.
 		Additionally, decimal notation may contain a single `.` to denote the start of the fractions.
 	**/
 	**/
-	public static function parseFloat( x : String ) : Float;
+	public static function parseFloat(x:String):Float;
 
 
 	/**
 	/**
 		Return a random integer between 0 included and `x` excluded.
 		Return a random integer between 0 included and `x` excluded.
 
 
 		If `x <= 1`, the result is always 0.
 		If `x <= 1`, the result is always 0.
 	**/
 	**/
-	public static function random( x : Int ) : Int;
+	public static function random(x:Int):Int;
 }
 }

+ 16 - 18
std/StdTypes.hx

@@ -26,8 +26,10 @@
 
 
 	@see https://haxe.org/manual/types-void.html
 	@see https://haxe.org/manual/types-void.html
 **/
 **/
-#if jvm @:runtimeValue #end
-@:coreType abstract Void { }
+#if jvm
+@:runtimeValue
+#end
+@:coreType abstract Void {}
 
 
 /**
 /**
 	The standard `Float` type, this is a double-precision IEEE 64bit float.
 	The standard `Float` type, this is a double-precision IEEE 64bit float.
@@ -41,7 +43,7 @@
 	@see https://haxe.org/manual/types-basic-types.html
 	@see https://haxe.org/manual/types-basic-types.html
 	@see https://haxe.org/manual/types-nullability.html
 	@see https://haxe.org/manual/types-nullability.html
 **/
 **/
-@:coreType @:notNull @:runtimeValue abstract Float { }
+@:coreType @:notNull @:runtimeValue abstract Float {}
 
 
 /**
 /**
 	The standard `Int` type. Its precision depends on the platform.
 	The standard `Int` type. Its precision depends on the platform.
@@ -56,7 +58,7 @@
 	@see https://haxe.org/manual/std-math-integer-math.html
 	@see https://haxe.org/manual/std-math-integer-math.html
 	@see https://haxe.org/manual/types-nullability.html
 	@see https://haxe.org/manual/types-nullability.html
 **/
 **/
-@:coreType @:notNull @:runtimeValue abstract Int to Float { }
+@:coreType @:notNull @:runtimeValue abstract Int to Float {}
 
 
 #if (java || cs || hl || cpp)
 #if (java || cs || hl || cpp)
 /**
 /**
@@ -78,7 +80,7 @@
 **/
 **/
 @:forward
 @:forward
 @:coreType
 @:coreType
-abstract Null<T> from T to T { }
+abstract Null<T> from T to T {}
 
 
 /**
 /**
 	The standard Boolean type, which can either be `true` or `false`.
 	The standard Boolean type, which can either be `true` or `false`.
@@ -89,8 +91,7 @@ abstract Null<T> from T to T { }
 	@see https://haxe.org/manual/types-bool.html
 	@see https://haxe.org/manual/types-bool.html
 	@see https://haxe.org/manual/types-nullability.html
 	@see https://haxe.org/manual/types-nullability.html
 **/
 **/
-@:coreType @:notNull @:runtimeValue abstract Bool {
-}
+@:coreType @:notNull @:runtimeValue abstract Bool {}
 
 
 /**
 /**
 	`Dynamic` is a special type which is compatible with all other types.
 	`Dynamic` is a special type which is compatible with all other types.
@@ -101,8 +102,7 @@ abstract Null<T> from T to T { }
 
 
 	@see https://haxe.org/manual/types-dynamic.html
 	@see https://haxe.org/manual/types-dynamic.html
 **/
 **/
-@:coreType @:runtimeValue abstract Dynamic<T> {
-}
+@:coreType @:runtimeValue abstract Dynamic<T> {}
 
 
 /**
 /**
 	An `Iterator` is a structure that permits iteration over elements of type `T`.
 	An `Iterator` is a structure that permits iteration over elements of type `T`.
@@ -114,7 +114,6 @@ abstract Null<T> from T to T { }
 	@see https://haxe.org/manual/lf-iterators.html
 	@see https://haxe.org/manual/lf-iterators.html
 **/
 **/
 typedef Iterator<T> = {
 typedef Iterator<T> = {
-
 	/**
 	/**
 		Returns `false` if the iteration is complete, `true` otherwise.
 		Returns `false` if the iteration is complete, `true` otherwise.
 
 
@@ -123,7 +122,7 @@ typedef Iterator<T> = {
 		in custom iterators any logic may be used to determine the completion
 		in custom iterators any logic may be used to determine the completion
 		state.
 		state.
 	**/
 	**/
-	function hasNext() : Bool;
+	function hasNext():Bool;
 
 
 	/**
 	/**
 		Returns the current item of the `Iterator` and advances to the next one.
 		Returns the current item of the `Iterator` and advances to the next one.
@@ -134,8 +133,7 @@ typedef Iterator<T> = {
 		On the other hand, iterators should not require a call to `hasNext()`
 		On the other hand, iterators should not require a call to `hasNext()`
 		before the first call to `next()` if an element is available.
 		before the first call to `next()` if an element is available.
 	**/
 	**/
-	function next() : T;
-
+	function next():T;
 }
 }
 
 
 /**
 /**
@@ -145,20 +143,20 @@ typedef Iterator<T> = {
 	@see https://haxe.org/manual/lf-iterators.html
 	@see https://haxe.org/manual/lf-iterators.html
 **/
 **/
 typedef Iterable<T> = {
 typedef Iterable<T> = {
-	function iterator() : Iterator<T>;
+	function iterator():Iterator<T>;
 }
 }
 
 
 /**
 /**
 	A `KeyValueIterator` is an `Iterator` that has a key and a value.
 	A `KeyValueIterator` is an `Iterator` that has a key and a value.
 **/
 **/
-typedef KeyValueIterator<K,V> = Iterator<{key:K, value:V}>;
+typedef KeyValueIterator<K, V> = Iterator<{key:K, value:V}>;
 
 
 /**
 /**
 	A `KeyValueIterable` is a data structure which has a `keyValueIterator()`
 	A `KeyValueIterable` is a data structure which has a `keyValueIterator()`
 	method to iterate over key-value-pairs.
 	method to iterate over key-value-pairs.
 **/
 **/
-typedef KeyValueIterable<K,V> = {
-    function keyValueIterator():KeyValueIterator<K,V>;
+typedef KeyValueIterable<K, V> = {
+	function keyValueIterator():KeyValueIterator<K, V>;
 }
 }
 
 
 /**
 /**
@@ -171,4 +169,4 @@ typedef KeyValueIterable<K,V> = {
 
 
 	@see https://haxe.org/manual/types-abstract-array-access.html
 	@see https://haxe.org/manual/types-abstract-array-access.html
 **/
 **/
-extern interface ArrayAccess<T> { }
+extern interface ArrayAccess<T> {}

+ 14 - 14
std/String.hx

@@ -19,6 +19,7 @@
  * 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.
  */
  */
+
 /**
 /**
 	The basic String class.
 	The basic String class.
 
 
@@ -33,26 +34,25 @@
 	@see https://haxe.org/manual/std-String.html
 	@see https://haxe.org/manual/std-String.html
 **/
 **/
 extern class String {
 extern class String {
-
 	/**
 	/**
 		The number of characters in `this` String.
 		The number of characters in `this` String.
 	**/
 	**/
-	var length(default,null) : Int;
+	var length(default, null):Int;
 
 
 	/**
 	/**
 		Creates a copy from a given String.
 		Creates a copy from a given String.
 	**/
 	**/
-	function new(string:String) : Void;
+	function new(string:String):Void;
 
 
 	/**
 	/**
 		Returns a String where all characters of `this` String are upper case.
 		Returns a String where all characters of `this` String are upper case.
 	**/
 	**/
-	function toUpperCase() : String;
+	function toUpperCase():String;
 
 
 	/**
 	/**
 		Returns a String where all characters of `this` String are lower case.
 		Returns a String where all characters of `this` String are lower case.
 	**/
 	**/
-	function toLowerCase() : String;
+	function toLowerCase():String;
 
 
 	/**
 	/**
 		Returns the character at position `index` of `this` String.
 		Returns the character at position `index` of `this` String.
@@ -60,7 +60,7 @@ extern class String {
 		If `index` is negative or exceeds `this.length`, the empty String `""`
 		If `index` is negative or exceeds `this.length`, the empty String `""`
 		is returned.
 		is returned.
 	**/
 	**/
-	function charAt(index : Int) : String;
+	function charAt(index:Int):String;
 
 
 	/**
 	/**
 		Returns the character code at position `index` of `this` String.
 		Returns the character code at position `index` of `this` String.
@@ -71,7 +71,7 @@ extern class String {
 		used instead to inline the character code at compile time. Note that
 		used instead to inline the character code at compile time. Note that
 		this only works on String literals of length 1.
 		this only works on String literals of length 1.
 	**/
 	**/
-	function charCodeAt( index : Int) : Null<Int>;
+	function charCodeAt(index:Int):Null<Int>;
 
 
 	/**
 	/**
 		Returns the position of the leftmost occurrence of `str` within `this`
 		Returns the position of the leftmost occurrence of `str` within `this`
@@ -88,7 +88,7 @@ extern class String {
 
 
 		If `str` cannot be found, -1 is returned.
 		If `str` cannot be found, -1 is returned.
 	**/
 	**/
-	function indexOf( str : String, ?startIndex : Int ) : Int;
+	function indexOf(str:String, ?startIndex:Int):Int;
 
 
 	/**
 	/**
 		Returns the position of the rightmost occurrence of `str` within `this`
 		Returns the position of the rightmost occurrence of `str` within `this`
@@ -101,7 +101,7 @@ extern class String {
 
 
 		If `str` cannot be found, -1 is returned.
 		If `str` cannot be found, -1 is returned.
 	**/
 	**/
-	function lastIndexOf( str : String, ?startIndex : Int ) : Int;
+	function lastIndexOf(str:String, ?startIndex:Int):Int;
 
 
 	/**
 	/**
 		Splits `this` String at each occurrence of `delimiter`.
 		Splits `this` String at each occurrence of `delimiter`.
@@ -123,7 +123,7 @@ extern class String {
 		result `Array` contains a leading (or trailing) empty String `""` element.
 		result `Array` contains a leading (or trailing) empty String `""` element.
 		Two subsequent delimiters also result in an empty String `""` element.
 		Two subsequent delimiters also result in an empty String `""` element.
 	**/
 	**/
-	function split( delimiter : String ) : Array<String>;
+	function split(delimiter:String):Array<String>;
 
 
 	/**
 	/**
 		Returns `len` characters of `this` String, starting at position `pos`.
 		Returns `len` characters of `this` String, starting at position `pos`.
@@ -140,7 +140,7 @@ extern class String {
 
 
 		If `len` is negative, the result is unspecified.
 		If `len` is negative, the result is unspecified.
 	**/
 	**/
-	function substr( pos : Int, ?len : Int ) : String;
+	function substr(pos:Int, ?len:Int):String;
 
 
 	/**
 	/**
 		Returns the part of `this` String from `startIndex` to but not including `endIndex`.
 		Returns the part of `this` String from `startIndex` to but not including `endIndex`.
@@ -155,12 +155,12 @@ extern class String {
 		If the (possibly swapped) `startIndex` exceeds `this.length`, the empty
 		If the (possibly swapped) `startIndex` exceeds `this.length`, the empty
 		String `""` is returned.
 		String `""` is returned.
 	**/
 	**/
-	function substring( startIndex : Int, ?endIndex : Int ) : String;
+	function substring(startIndex:Int, ?endIndex:Int):String;
 
 
 	/**
 	/**
 		Returns the String itself.
 		Returns the String itself.
 	**/
 	**/
-	function toString() : String;
+	function toString():String;
 
 
 	/**
 	/**
 		Returns the String corresponding to the character code `code`.
 		Returns the String corresponding to the character code `code`.
@@ -168,5 +168,5 @@ extern class String {
 		If `code` is negative or has another invalid value, the result is
 		If `code` is negative or has another invalid value, the result is
 		unspecified.
 		unspecified.
 	**/
 	**/
-	@:pure static function fromCharCode( code : Int ) : String;
+	@:pure static function fromCharCode(code:Int):String;
 }
 }

+ 7 - 8
std/StringBuf.hx

@@ -19,6 +19,7 @@
  * 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.
  */
  */
+
 /**
 /**
 	A String buffer is an efficient way to build a big string by appending small
 	A String buffer is an efficient way to build a big string by appending small
 	elements together.
 	elements together.
@@ -31,13 +32,12 @@
 	values. However, the internal buffer cannot be modified.
 	values. However, the internal buffer cannot be modified.
 **/
 **/
 class StringBuf {
 class StringBuf {
-
 	var b:String;
 	var b:String;
 
 
 	/**
 	/**
 		The length of `this` StringBuf in characters.
 		The length of `this` StringBuf in characters.
 	**/
 	**/
-	public var length(get,never) : Int;
+	public var length(get, never):Int;
 
 
 	/**
 	/**
 		Creates a new StringBuf instance.
 		Creates a new StringBuf instance.
@@ -48,7 +48,7 @@ class StringBuf {
 		b = "";
 		b = "";
 	}
 	}
 
 
-	inline function get_length() : Int {
+	inline function get_length():Int {
 		return b.length;
 		return b.length;
 	}
 	}
 
 
@@ -61,7 +61,7 @@ class StringBuf {
 
 
 		If `x` is null, the String "null" is appended.
 		If `x` is null, the String "null" is appended.
 	**/
 	**/
-	public inline function add<T>( x : T ) : Void {
+	public inline function add<T>(x:T):Void {
 		b += x;
 		b += x;
 	}
 	}
 
 
@@ -71,7 +71,7 @@ class StringBuf {
 		If `c` is negative or has another invalid value, the result is
 		If `c` is negative or has another invalid value, the result is
 		unspecified.
 		unspecified.
 	**/
 	**/
-	public inline function addChar( c : Int ) : Void {
+	public inline function addChar(c:Int):Void {
 		b += String.fromCharCode(c);
 		b += String.fromCharCode(c);
 	}
 	}
 
 
@@ -87,7 +87,7 @@ class StringBuf {
 		If `len` is omitted or null, the substring ranges from `pos` to the end
 		If `len` is omitted or null, the substring ranges from `pos` to the end
 		of `s`.
 		of `s`.
 	**/
 	**/
-	public inline function addSub( s : String, pos : Int, ?len : Int) : Void {
+	public inline function addSub(s:String, pos:Int, ?len:Int):Void {
 		b += (len == null ? s.substr(pos) : s.substr(pos, len));
 		b += (len == null ? s.substr(pos) : s.substr(pos, len));
 	}
 	}
 
 
@@ -96,8 +96,7 @@ class StringBuf {
 
 
 		The buffer is not emptied by this operation.
 		The buffer is not emptied by this operation.
 	**/
 	**/
-	public inline function toString() : String {
+	public inline function toString():String {
 		return b;
 		return b;
 	}
 	}
-
 }
 }

+ 150 - 132
std/StringTools.hx

@@ -39,105 +39,105 @@ class StringTools {
 	/**
 	/**
 		Encode an URL by using the standard format.
 		Encode an URL by using the standard format.
 	**/
 	**/
-	#if (!java && !cpp && !lua && !eval) inline #end public static function urlEncode( s : String ) : String {
+	#if (!java && !cpp && !lua && !eval) inline #end public static function urlEncode(s:String):String {
 		#if flash
 		#if flash
-			return untyped __global__["encodeURIComponent"](s);
+		return untyped __global__["encodeURIComponent"](s);
 		#elseif neko
 		#elseif neko
-			return untyped new String(_urlEncode(s.__s));
+		return untyped new String(_urlEncode(s.__s));
 		#elseif js
 		#elseif js
-			return untyped encodeURIComponent(s);
+		return untyped encodeURIComponent(s);
 		#elseif cpp
 		#elseif cpp
-			return untyped s.__URLEncode();
+		return untyped s.__URLEncode();
 		#elseif java
 		#elseif java
-			return postProcessUrlEncode(java.net.URLEncoder.encode(s, "UTF-8"));
+		return postProcessUrlEncode(java.net.URLEncoder.encode(s, "UTF-8"));
 		#elseif cs
 		#elseif cs
-			return untyped cs.system.Uri.EscapeDataString(s);
+		return untyped cs.system.Uri.EscapeDataString(s);
 		#elseif python
 		#elseif python
-			return python.lib.urllib.Parse.quote(s, "");
+		return python.lib.urllib.Parse.quote(s, "");
 		#elseif hl
 		#elseif hl
-			var len = 0;
-			var b = @:privateAccess s.bytes.urlEncode(len);
-			return @:privateAccess String.__alloc__(b,len);
+		var len = 0;
+		var b = @:privateAccess s.bytes.urlEncode(len);
+		return @:privateAccess String.__alloc__(b, len);
 		#elseif lua
 		#elseif lua
-			s = lua.NativeStringTools.gsub(s, "\n", "\r\n");
-			s = lua.NativeStringTools.gsub(s, "([^%w %-%_%.%~])", function (c) {
-				return lua.NativeStringTools.format("%%%02X", lua.NativeStringTools.byte(c) + '');
-			});
-			s = lua.NativeStringTools.gsub(s, " ", "+");
-			return s;
+		s = lua.NativeStringTools.gsub(s, "\n", "\r\n");
+		s = lua.NativeStringTools.gsub(s, "([^%w %-%_%.%~])", function(c) {
+			return lua.NativeStringTools.format("%%%02X", lua.NativeStringTools.byte(c) + '');
+		});
+		s = lua.NativeStringTools.gsub(s, " ", "+");
+		return s;
 		#else
 		#else
-			return null;
+		return null;
 		#end
 		#end
 	}
 	}
 
 
-#if java
-	private static function postProcessUrlEncode( s : String ) : String {
+	#if java
+	private static function postProcessUrlEncode(s:String):String {
 		var ret = new StringBuf();
 		var ret = new StringBuf();
-		var i = 0,
-		    len = s.length;
+		var i = 0, len = s.length;
 		while (i < len) {
 		while (i < len) {
-			switch(_charAt(s, i++)) {
-			case '+'.code:
-				ret.add('%20');
-			case '%'.code if (i <= len - 2):
-				var c1 = _charAt(s, i++),
-				    c2 = _charAt(s, i++);
-				switch[c1, c2] {
-				case ['2'.code, '1'.code]:
-					ret.addChar('!'.code);
-				case ['2'.code, '7'.code]:
-					ret.addChar('\''.code);
-				case ['2'.code, '8'.code]:
-					ret.addChar('('.code);
-				case ['2'.code, '9'.code]:
-					ret.addChar(')'.code);
-				case ['7'.code, 'E'.code] | ['7'.code, 'e'.code]:
-					ret.addChar('~'.code);
-				case _:
-					ret.addChar('%'.code);
-					ret.addChar(cast c1);
-					ret.addChar(cast c2);
-				}
-			case var chr:
-				ret.addChar(cast chr);
+			switch (_charAt(s, i++)) {
+				case '+'.code:
+					ret.add('%20');
+				case '%'.code if (i <= len - 2):
+					var c1 = _charAt(s, i++), c2 = _charAt(s, i++);
+					switch [c1, c2] {
+						case ['2'.code, '1'.code]:
+							ret.addChar('!'.code);
+						case ['2'.code, '7'.code]:
+							ret.addChar('\''.code);
+						case ['2'.code, '8'.code]:
+							ret.addChar('('.code);
+						case ['2'.code, '9'.code]:
+							ret.addChar(')'.code);
+						case ['7'.code, 'E'.code] | ['7'.code, 'e'.code]:
+							ret.addChar('~'.code);
+						case _:
+							ret.addChar('%'.code);
+							ret.addChar(cast c1);
+							ret.addChar(cast c2);
+					}
+				case var chr:
+					ret.addChar(cast chr);
 			}
 			}
 		}
 		}
 		return ret.toString();
 		return ret.toString();
 	}
 	}
-#end
+	#end
 
 
 	/**
 	/**
 		Decode an URL using the standard format.
 		Decode an URL using the standard format.
 	**/
 	**/
-	#if (!java && !cpp && !lua && !eval) inline #end public static function urlDecode( s : String ) : String {
+	#if (!java && !cpp && !lua && !eval) inline #end public static function urlDecode(s:String):String {
 		#if flash
 		#if flash
-			return untyped __global__["decodeURIComponent"](s.split("+").join(" "));
+		return untyped __global__["decodeURIComponent"](s.split("+").join(" "));
 		#elseif neko
 		#elseif neko
-			return untyped new String(_urlDecode(s.__s));
+		return untyped new String(_urlDecode(s.__s));
 		#elseif js
 		#elseif js
-			return untyped decodeURIComponent(s.split("+").join(" "));
+		return untyped decodeURIComponent(s.split("+").join(" "));
 		#elseif cpp
 		#elseif cpp
-			return untyped s.__URLDecode();
+		return untyped s.__URLDecode();
 		#elseif java
 		#elseif java
-			try
-				return java.net.URLDecoder.decode(s, "UTF-8")
-			catch (e:Dynamic) throw e;
+		try
+			return java.net.URLDecoder.decode(s, "UTF-8")
+		catch (e:Dynamic)
+			throw e;
 		#elseif cs
 		#elseif cs
-			return untyped cs.system.Uri.UnescapeDataString(s);
+		return untyped cs.system.Uri.UnescapeDataString(s);
 		#elseif python
 		#elseif python
-			return python.lib.urllib.Parse.unquote(s);
+		return python.lib.urllib.Parse.unquote(s);
 		#elseif hl
 		#elseif hl
-			var len = 0;
-			var b = @:privateAccess s.bytes.urlDecode(len);
-			return @:privateAccess String.__alloc__(b,len);
+		var len = 0;
+		var b = @:privateAccess s.bytes.urlDecode(len);
+		return @:privateAccess String.__alloc__(b, len);
 		#elseif lua
 		#elseif lua
-			s = lua.NativeStringTools.gsub (s, "+", " ");
-			s = lua.NativeStringTools.gsub (s, "%%(%x%x)",
-				function(h) {return lua.NativeStringTools.char(lua.Lua.tonumber(h,16));});
-			s = lua.NativeStringTools.gsub (s, "\r\n", "\n");
-			return s;
+		s = lua.NativeStringTools.gsub(s, "+", " ");
+		s = lua.NativeStringTools.gsub(s, "%%(%x%x)", function(h) {
+			return lua.NativeStringTools.char(lua.Lua.tonumber(h, 16));
+		});
+		s = lua.NativeStringTools.gsub(s, "\r\n", "\n");
+		return s;
 		#else
 		#else
-			return null;
+		return null;
 		#end
 		#end
 	}
 	}
 
 
@@ -155,16 +155,22 @@ class StringTools {
 		- `"` becomes `&quot`;
 		- `"` becomes `&quot`;
 		- `'` becomes `&#039`;
 		- `'` becomes `&#039`;
 	**/
 	**/
-	public static function htmlEscape( s : String, ?quotes : Bool ) : String {
+	public static function htmlEscape(s:String, ?quotes:Bool):String {
 		var buf = new StringBuf();
 		var buf = new StringBuf();
 		for (code in new haxe.iterators.StringIteratorUnicode(s)) {
 		for (code in new haxe.iterators.StringIteratorUnicode(s)) {
 			switch (code) {
 			switch (code) {
-				case '&'.code: buf.add("&amp;");
-				case '<'.code: buf.add("&lt;");
-				case '>'.code: buf.add("&gt;");
-				case '"'.code if (quotes): buf.add("&quot;");
-				case '\''.code if (quotes): buf.add("&#039;");
-				case _: buf.addChar(code);
+				case '&'.code:
+					buf.add("&amp;");
+				case '<'.code:
+					buf.add("&lt;");
+				case '>'.code:
+					buf.add("&gt;");
+				case '"'.code if (quotes):
+					buf.add("&quot;");
+				case '\''.code if (quotes):
+					buf.add("&#039;");
+				case _:
+					buf.addChar(code);
 			}
 			}
 		}
 		}
 		return buf.toString();
 		return buf.toString();
@@ -184,8 +190,17 @@ class StringTools {
 		- `&quot;` becomes `"`
 		- `&quot;` becomes `"`
 		- `&#039;` becomes `'`
 		- `&#039;` becomes `'`
 	**/
 	**/
-	public static function htmlUnescape( s : String ) : String {
-		return s.split("&gt;").join(">").split("&lt;").join("<").split("&quot;").join('"').split("&#039;").join("'").split("&amp;").join("&");
+	public static function htmlUnescape(s:String):String {
+		return s.split("&gt;")
+			.join(">")
+			.split("&lt;")
+			.join("<")
+			.split("&quot;")
+			.join('"')
+			.split("&#039;")
+			.join("'")
+			.split("&amp;")
+			.join("&");
 	}
 	}
 
 
 	/**
 	/**
@@ -193,7 +208,7 @@ class StringTools {
 
 
 		When `value` is `null`, the result is unspecified.
 		When `value` is `null`, the result is unspecified.
 	**/
 	**/
-	public static inline function contains(s : String, value : String) : Bool {
+	public static inline function contains(s:String, value:String):Bool {
 		return s.indexOf(value) != -1;
 		return s.indexOf(value) != -1;
 	}
 	}
 
 
@@ -204,26 +219,26 @@ class StringTools {
 
 
 		If `start` is the empty String `""`, the result is true.
 		If `start` is the empty String `""`, the result is true.
 	**/
 	**/
-	public static #if (cs || java || python) inline #end function startsWith( s : String, start : String ) : Bool {
+	public static #if (cs || java || python) inline #end function startsWith(s:String, start:String):Bool {
 		#if java
 		#if java
 		return (cast s : java.NativeString).startsWith(start);
 		return (cast s : java.NativeString).startsWith(start);
 		#elseif cs
 		#elseif cs
 		return untyped s.StartsWith(start);
 		return untyped s.StartsWith(start);
 		#elseif cpp
 		#elseif cpp
-		if (s.length<start.length)
+		if (s.length < start.length)
 			return false;
 			return false;
 		var p0 = s.c_str();
 		var p0 = s.c_str();
 		var p1 = start.c_str();
 		var p1 = start.c_str();
-		for(i in 0...start.length)
-			if ( p0.at(i) != p1.at(i) )
+		for (i in 0...start.length)
+			if (p0.at(i) != p1.at(i))
 				return false;
 				return false;
 		return true;
 		return true;
 		#elseif hl
 		#elseif hl
-		return @:privateAccess (s.length >= start.length && s.bytes.compare(0,start.bytes,0,start.length<<1) == 0);
+		return @:privateAccess (s.length >= start.length && s.bytes.compare(0, start.bytes, 0, start.length << 1) == 0);
 		#elseif python
 		#elseif python
 		return python.NativeStringTools.startswith(s, start);
 		return python.NativeStringTools.startswith(s, start);
 		#else
 		#else
-		return( s.length >= start.length && s.lastIndexOf(start, 0) == 0 );
+		return (s.length >= start.length && s.lastIndexOf(start, 0) == 0);
 		#end
 		#end
 	}
 	}
 
 
@@ -234,18 +249,18 @@ class StringTools {
 
 
 		If `end` is the empty String `""`, the result is true.
 		If `end` is the empty String `""`, the result is true.
 	**/
 	**/
-	public static #if (cs || java || python) inline #end function endsWith( s : String, end : String ) : Bool {
+	public static #if (cs || java || python) inline #end function endsWith(s:String, end:String):Bool {
 		#if java
 		#if java
 		return (cast s : java.NativeString).endsWith(end);
 		return (cast s : java.NativeString).endsWith(end);
 		#elseif cs
 		#elseif cs
 		return untyped s.EndsWith(end);
 		return untyped s.EndsWith(end);
 		#elseif cpp
 		#elseif cpp
-		if (s.length<end.length)
+		if (s.length < end.length)
 			return false;
 			return false;
-		var p0 = s.c_str().add( s.length-end.length );
+		var p0 = s.c_str().add(s.length - end.length);
 		var p1 = end.c_str();
 		var p1 = end.c_str();
-		for(i in 0...end.length)
-			if ( p0.at(i) != p1.at(i) )
+		for (i in 0...end.length)
+			if (p0.at(i) != p1.at(i))
 				return false;
 				return false;
 		return true;
 		return true;
 		#elseif hl
 		#elseif hl
@@ -257,7 +272,7 @@ class StringTools {
 		#else
 		#else
 		var elen = end.length;
 		var elen = end.length;
 		var slen = s.length;
 		var slen = s.length;
-		return( slen >= elen && s.indexOf(end, (slen - elen)) == (slen - elen) );
+		return (slen >= elen && s.indexOf(end, (slen - elen)) == (slen - elen));
 		#end
 		#end
 	}
 	}
 
 
@@ -270,11 +285,12 @@ class StringTools {
 		If `s` is the empty String `""`, or if pos is not a valid position within
 		If `s` is the empty String `""`, or if pos is not a valid position within
 		`s`, the result is false.
 		`s`, the result is false.
 	**/
 	**/
-	public static function isSpace( s : String, pos : Int ) : Bool {
+	public static function isSpace(s:String, pos:Int):Bool {
 		#if (python || lua)
 		#if (python || lua)
-		if (s.length == 0 || pos < 0 || pos >= s.length) return false;
+		if (s.length == 0 || pos < 0 || pos >= s.length)
+			return false;
 		#end
 		#end
-		var c = s.charCodeAt( pos );
+		var c = s.charCodeAt(pos);
 		return (c > 8 && c < 14) || c == 32;
 		return (c > 8 && c < 14) || c == 32;
 	}
 	}
 
 
@@ -287,17 +303,17 @@ class StringTools {
 		If `s` is the empty String `""` or consists only of space characters, the
 		If `s` is the empty String `""` or consists only of space characters, the
 		result is the empty String `""`.
 		result is the empty String `""`.
 	**/
 	**/
-	public #if cs inline #end static function ltrim( s : String ) : String {
+	public #if cs inline #end static function ltrim(s:String):String {
 		#if cs
 		#if cs
 		return untyped s.TrimStart();
 		return untyped s.TrimStart();
 		#else
 		#else
 		var l = s.length;
 		var l = s.length;
 		var r = 0;
 		var r = 0;
-		while( r < l && isSpace(s,r) ){
+		while (r < l && isSpace(s, r)) {
 			r++;
 			r++;
 		}
 		}
-		if( r > 0 )
-			return s.substr(r, l-r);
+		if (r > 0)
+			return s.substr(r, l - r);
 		else
 		else
 			return s;
 			return s;
 		#end
 		#end
@@ -312,18 +328,18 @@ class StringTools {
 		If `s` is the empty String `""` or consists only of space characters, the
 		If `s` is the empty String `""` or consists only of space characters, the
 		result is the empty String `""`.
 		result is the empty String `""`.
 	**/
 	**/
-	public #if cs inline #end static function rtrim( s : String ) : String {
+	public #if cs inline #end static function rtrim(s:String):String {
 		#if cs
 		#if cs
 		return untyped s.TrimEnd();
 		return untyped s.TrimEnd();
 		#else
 		#else
 		var l = s.length;
 		var l = s.length;
 		var r = 0;
 		var r = 0;
-		while( r < l && isSpace(s,l-r-1) ){
+		while (r < l && isSpace(s, l - r - 1)) {
 			r++;
 			r++;
 		}
 		}
-		if( r > 0 ){
-			return s.substr(0, l-r);
-		}else{
+		if (r > 0) {
+			return s.substr(0, l - r);
+		} else {
 			return s;
 			return s;
 		}
 		}
 		#end
 		#end
@@ -334,7 +350,7 @@ class StringTools {
 
 
 		This is a convenience function for `ltrim(rtrim(s))`.
 		This is a convenience function for `ltrim(rtrim(s))`.
 	**/
 	**/
-	public #if (cs || java) inline #end static function trim( s : String ) : String {
+	public #if (cs || java) inline #end static function trim(s:String):String {
 		#if cs
 		#if cs
 		return untyped s.Trim();
 		return untyped s.Trim();
 		#elseif java
 		#elseif java
@@ -356,7 +372,7 @@ class StringTools {
 
 
 		If `c` is null, the result is unspecified.
 		If `c` is null, the result is unspecified.
 	**/
 	**/
-	public static function lpad( s : String, c : String, l : Int ) : String {
+	public static function lpad(s:String, c:String, l:Int):String {
 		if (c.length <= 0)
 		if (c.length <= 0)
 			return s;
 			return s;
 
 
@@ -381,7 +397,7 @@ class StringTools {
 
 
 		If `c` is null, the result is unspecified.
 		If `c` is null, the result is unspecified.
 	**/
 	**/
-	public static function rpad( s : String, c : String, l : Int ) : String {
+	public static function rpad(s:String, c:String, l:Int):String {
 		if (c.length <= 0)
 		if (c.length <= 0)
 			return s;
 			return s;
 
 
@@ -403,7 +419,7 @@ class StringTools {
 
 
 		If `sub` or `by` are null, the result is unspecified.
 		If `sub` or `by` are null, the result is unspecified.
 	**/
 	**/
-	public static function replace( s : String, sub : String, by : String ) : String {
+	public static function replace(s:String, sub:String, by:String):String {
 		#if java
 		#if java
 		if (sub.length == 0)
 		if (sub.length == 0)
 			return s.split(sub).join(by);
 			return s.split(sub).join(by);
@@ -425,18 +441,18 @@ class StringTools {
 		If `digits` is specified, the resulting String is padded with "0" until
 		If `digits` is specified, the resulting String is padded with "0" until
 		its `length` equals `digits`.
 		its `length` equals `digits`.
 	**/
 	**/
-	public static function hex( n : Int, ?digits : Int ) {
+	public static function hex(n:Int, ?digits:Int) {
 		#if flash
 		#if flash
-			var n : UInt = n;
-			var s : String = untyped n.toString(16);
-			s = s.toUpperCase();
+		var n:UInt = n;
+		var s:String = untyped n.toString(16);
+		s = s.toUpperCase();
 		#else
 		#else
-			var s = "";
-			var hexChars = "0123456789ABCDEF";
-			do {
-				s = hexChars.charAt(n&15) + s;
-				n >>>= 4;
-			} while( n > 0 );
+		var s = "";
+		var hexChars = "0123456789ABCDEF";
+		do {
+			s = hexChars.charAt(n & 15) + s;
+			n >>>= 4;
+		} while (n > 0);
 		#end
 		#end
 		#if python
 		#if python
 		if (digits != null && s.length < digits) {
 		if (digits != null && s.length < digits) {
@@ -446,9 +462,9 @@ class StringTools {
 			}
 			}
 		}
 		}
 		#else
 		#else
-		if( digits != null )
-			while( s.length < digits )
-				s = "0"+s;
+		if (digits != null)
+			while (s.length < digits)
+				s = "0" + s;
 		#end
 		#end
 		return s;
 		return s;
 	}
 	}
@@ -467,7 +483,7 @@ class StringTools {
 		This operation is not guaranteed to work if `s` contains the `\0`
 		This operation is not guaranteed to work if `s` contains the `\0`
 		character.
 		character.
 	**/
 	**/
-	public static #if !eval inline #end function fastCodeAt( s : String, index : Int ) : Int {
+	public static #if !eval inline #end function fastCodeAt(s:String, index:Int):Int {
 		#if neko
 		#if neko
 		return untyped __dollar__sget(s.__s, index);
 		return untyped __dollar__sget(s.__s, index);
 		#elseif cpp
 		#elseif cpp
@@ -475,9 +491,9 @@ class StringTools {
 		#elseif flash
 		#elseif flash
 		return untyped s.cca(index);
 		return untyped s.cca(index);
 		#elseif java
 		#elseif java
-		return ( index < s.length ) ? cast(_charAt(s, index), Int) : -1;
+		return (index < s.length) ? cast(_charAt(s, index), Int) : -1;
 		#elseif cs
 		#elseif cs
-		return ( cast(index, UInt) < s.length ) ? cast(s[index], Int) : -1;
+		return (cast(index, UInt) < s.length) ? cast(s[index], Int) : -1;
 		#elseif js
 		#elseif js
 		return (cast s).charCodeAt(index);
 		return (cast s).charCodeAt(index);
 		#elseif python
 		#elseif python
@@ -485,11 +501,11 @@ class StringTools {
 		#elseif hl
 		#elseif hl
 		return @:privateAccess s.bytes.getUI16(index << 1);
 		return @:privateAccess s.bytes.getUI16(index << 1);
 		#elseif lua
 		#elseif lua
-			#if lua_vanilla
-			return lua.NativeStringTools.byte(s,index+1);
-			#else
-			return lua.lib.luautf8.Utf8.byte(s,index+1);
-			#end
+		#if lua_vanilla
+		return lua.NativeStringTools.byte(s, index + 1);
+		#else
+		return lua.lib.luautf8.Utf8.byte(s, index + 1);
+		#end
 		#else
 		#else
 		return untyped s.cca(index);
 		return untyped s.cca(index);
 		#end
 		#end
@@ -502,7 +518,7 @@ class StringTools {
 		internal encoding of strings in different runtimes.
 		internal encoding of strings in different runtimes.
 		For the consistent cross-platform UTF8 char codes see `haxe.iterators.StringIteratorUnicode`.
 		For the consistent cross-platform UTF8 char codes see `haxe.iterators.StringIteratorUnicode`.
 	**/
 	**/
-	public static inline function iterator( s : String ) : StringIterator {
+	public static inline function iterator(s:String):StringIterator {
 		return new StringIterator(s);
 		return new StringIterator(s);
 	}
 	}
 
 
@@ -513,14 +529,14 @@ class StringTools {
 		internal encoding of strings in different of runtimes.
 		internal encoding of strings in different of runtimes.
 		For the consistent cross-platform UTF8 char codes see `haxe.iterators.StringKeyValueIteratorUnicode`.
 		For the consistent cross-platform UTF8 char codes see `haxe.iterators.StringKeyValueIteratorUnicode`.
 	**/
 	**/
-	public static inline function keyValueIterator( s : String ) : StringKeyValueIterator {
+	public static inline function keyValueIterator(s:String):StringKeyValueIterator {
 		return new StringKeyValueIterator(s);
 		return new StringKeyValueIterator(s);
 	}
 	}
 
 
 	/**
 	/**
 		Tells if `c` represents the end-of-file (EOF) character.
 		Tells if `c` represents the end-of-file (EOF) character.
 	**/
 	**/
-	@:noUsing public static inline function isEof( c : Int ) : Bool {
+	@:noUsing public static inline function isEof(c:Int):Bool {
 		#if (flash || cpp || hl)
 		#if (flash || cpp || hl)
 		return c == 0;
 		return c == 0;
 		#elseif js
 		#elseif js
@@ -572,20 +588,22 @@ class StringTools {
 	}
 	}
 
 
 	#if java
 	#if java
-	private static inline function _charAt(str:String, idx:Int):java.StdTypes.Char16 return (cast str : java.NativeString).charAt(idx);
+	private static inline function _charAt(str:String, idx:Int):java.StdTypes.Char16
+		return (cast str : java.NativeString).charAt(idx);
 	#end
 	#end
 
 
 	#if neko
 	#if neko
-	private static var _urlEncode = neko.Lib.load("std","url_encode",1);
-	private static var _urlDecode = neko.Lib.load("std","url_decode",1);
+	private static var _urlEncode = neko.Lib.load("std", "url_encode", 1);
+	private static var _urlDecode = neko.Lib.load("std", "url_decode", 1);
 	#end
 	#end
 
 
 	#if utf16
 	#if utf16
 	static inline var MIN_SURROGATE_CODE_POINT = 65536;
 	static inline var MIN_SURROGATE_CODE_POINT = 65536;
+
 	static inline function utf16CodePointAt(s:String, index:Int):Int {
 	static inline function utf16CodePointAt(s:String, index:Int):Int {
 		var c = StringTools.fastCodeAt(s, index);
 		var c = StringTools.fastCodeAt(s, index);
 		if (c >= 0xD800 && c <= 0xDBFF) {
 		if (c >= 0xD800 && c <= 0xDBFF) {
-			c = ((c -0xD7C0) << 10) | (StringTools.fastCodeAt(s, index + 1) & 0x3FF);
+			c = ((c - 0xD7C0) << 10) | (StringTools.fastCodeAt(s, index + 1) & 0x3FF);
 		}
 		}
 		return c;
 		return c;
 	}
 	}

+ 70 - 50
std/Sys.hx

@@ -19,133 +19,153 @@
  * 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.
  */
  */
+
 /**
 /**
-	This class gives you access to many base functionalities of system platforms. Looks in `sys` sub packages for more system APIs.
+	This class provides access to various base functions of system platforms.
+	Look in the `sys` package for more system APIs.
 **/
 **/
 @:require(sys)
 @:require(sys)
 extern class Sys {
 extern class Sys {
-
 	/**
 	/**
-		Print any value on the standard output.
+		Prints any value to the standard output.
 	**/
 	**/
-	static function print( v : Dynamic ) : Void;
+	static function print(v:Dynamic):Void;
 
 
 	/**
 	/**
-		Print any value on the standard output, followed by a newline.
+		Prints any value to the standard output, followed by a newline.
+		On Windows, this function outputs a CRLF newline.
+		LF newlines are printed on all other platforms.
 	**/
 	**/
-	static function println( v : Dynamic ) : Void;
+	static function println(v:Dynamic):Void;
 
 
 	/**
 	/**
-		Returns all the arguments that were passed by the command line.
+		Returns all the arguments that were passed in the command line.
+		This does not include the interpreter or the name of the program file.
+
+		(java)(eval) On Windows, non-ASCII Unicode arguments will not work correctly.
+
+		(cs) Non-ASCII Unicode arguments will not work correctly.
 	**/
 	**/
-	static function args() : Array<String>;
+	static function args():Array<String>;
 
 
 	/**
 	/**
-		Returns the value of the given environment variable.
+		Returns the value of the given environment variable, or `null` if it
+		doesn't exist.
 	**/
 	**/
-	static function getEnv( s : String ) : String;
+	static function getEnv(s:String):String;
 
 
 	/**
 	/**
-		Set the value of the given environment variable.
+		Sets the value of the given environment variable.
+
+		(java) This functionality is not available on Java; calling this function will throw.
 	**/
 	**/
-	static function putEnv( s : String, v : String ) : Void;
+	static function putEnv(s:String, v:String):Void;
 
 
 	/**
 	/**
 		Returns all environment variables.
 		Returns all environment variables.
 	**/
 	**/
-	static function environment() : Map<String,String>;
+	static function environment():Map<String, String>;
 
 
 	/**
 	/**
-		Suspend the current execution for the given time (in seconds).
+		Suspends execution for the given length of time (in seconds).
 	**/
 	**/
-	static function sleep( seconds : Float ) : Void;
+	static function sleep(seconds:Float):Void;
 
 
 	/**
 	/**
-		Change the current time locale, which will affect `DateTools.format` date formating.
-		Returns true if the locale was successfully changed
+		Changes the current time locale, which will affect `DateTools.format` date formating.
+		Returns `true` if the locale was successfully changed.
 	**/
 	**/
-	static function setTimeLocale( loc : String ) : Bool;
+	static function setTimeLocale(loc:String):Bool;
 
 
 	/**
 	/**
-		Get the current working directory (usually the one in which the program was started)
+		Gets the current working directory (usually the one in which the program was started).
 	**/
 	**/
-	static function getCwd() : String;
+	static function getCwd():String;
 
 
 	/**
 	/**
-		Change the current working directory.
+		Changes the current working directory.
+
+		(java) This functionality is not available on Java; calling this function will throw.
 	**/
 	**/
-	static function setCwd( s : String ) : Void;
+	static function setCwd(s:String):Void;
 
 
 	/**
 	/**
-		Returns the name of the system you are running on. For instance :
-			"Windows", "Linux", "BSD" and "Mac" depending on your desktop OS.
+		Returns the type of the current system. Possible values are:
+		 - `"Windows"`
+		 - `"Linux"`
+		 - `"BSD"`
+		 - `"Mac"`
 	**/
 	**/
-	static function systemName() : String;
+	static function systemName():String;
 
 
 	/**
 	/**
-		Run the given command. The command output will be printed on the same output as the current process.
-		The current process will block until the command terminates and it will return the command result (0 if there was no error).
+		Runs the given command. The command output will be printed to the same output as the current process.
+		The current process will block until the command terminates.
+		The return value is the exit code of the command (usually `0` indicates no error).
 
 
-		Command arguments can be passed in two ways: 1. using `args`, 2. appending to `cmd` and leaving `args` as `null`.
+		Command arguments can be passed in two ways:
 
 
-		 1. When using `args` to pass command arguments, each argument will be automatically quoted, and shell meta-characters will be escaped if needed.
-		`cmd` should be an executable name that can be located in the `PATH` environment variable, or a path to an executable.
+		 1. Using `args` to pass command arguments. Each argument will be automatically quoted and shell meta-characters will be escaped if needed.
+		`cmd` should be an executable name that can be located in the `PATH` environment variable, or a full path to an executable.
 
 
 		 2. When `args` is not given or is `null`, command arguments can be appended to `cmd`. No automatic quoting/escaping will be performed. `cmd` should be formatted exactly as it would be when typed at the command line.
 		 2. When `args` is not given or is `null`, command arguments can be appended to `cmd`. No automatic quoting/escaping will be performed. `cmd` should be formatted exactly as it would be when typed at the command line.
 		It can run executables, as well as shell commands that are not executables (e.g. on Windows: `dir`, `cd`, `echo` etc).
 		It can run executables, as well as shell commands that are not executables (e.g. on Windows: `dir`, `cd`, `echo` etc).
 
 
-		Read the `sys.io.Process` api for a more complete way to start background processes.
+		Use the `sys.io.Process` API for more complex tasks, such as background processes, or providing input to the command.
 	**/
 	**/
-	static function command( cmd : String, ?args : Array<String> ) : Int;
+	static function command(cmd:String, ?args:Array<String>):Int;
 
 
 	/**
 	/**
-		Exit the current process with the given error code.
+		Exits the current process with the given exit code.
 
 
 		(macro)(eval) Being invoked in a macro or eval context (e.g. with `-x` or `--run`) immediately terminates
 		(macro)(eval) Being invoked in a macro or eval context (e.g. with `-x` or `--run`) immediately terminates
-		the compilation process also preventing the execution of any `--next` section of compilation arguments.
+		the compilation process, which also prevents the execution of any `--next` sections of compilation arguments.
 	**/
 	**/
-	static function exit( code : Int ) : Void;
+	static function exit(code:Int):Void;
 
 
 	/**
 	/**
-		Gives the most precise timestamp value (in seconds).
+		Gives the most precise timestamp value available (in seconds).
 	**/
 	**/
-	static function time() : Float;
+	static function time():Float;
 
 
 	/**
 	/**
-		Gives the most precise timestamp value (in seconds) but only account for the actual time spent running on the CPU for the current thread/process.
+		Gives the most precise timestamp value available (in seconds),
+		but only accounts for the actual time spent running on the CPU for the current thread/process.
 	**/
 	**/
-	static function cpuTime() : Float;
+	static function cpuTime():Float;
 
 
 	/**
 	/**
 		Returns the path to the current executable that we are running.
 		Returns the path to the current executable that we are running.
 	**/
 	**/
-	@:deprecated("Use programPath instead") static function executablePath() : String;
+	@:deprecated("Use programPath instead") static function executablePath():String;
 
 
 	/**
 	/**
 		Returns the absolute path to the current program file that we are running.
 		Returns the absolute path to the current program file that we are running.
 		Concretely, for an executable binary, it returns the path to the binary.
 		Concretely, for an executable binary, it returns the path to the binary.
 		For a script (e.g. a PHP file), it returns the path to the script.
 		For a script (e.g. a PHP file), it returns the path to the script.
 	**/
 	**/
-	static function programPath() : String;
+	static function programPath():String;
 
 
 	/**
 	/**
-		Read a single input character from the standard input and returns it. Setting `echo` to true will also display it on the output.
+		Reads a single input character from the standard input and returns it.
+		Setting `echo` to `true` will also display the character on the output.
 	**/
 	**/
-	static function getChar( echo : Bool ) : Int;
+	static function getChar(echo:Bool):Int;
 
 
 	/**
 	/**
-		Returns the process standard input, from which you can read what user enters. Usually it will block until the user send a full input line. See `getChar` for an alternative.
+		Returns the standard input of the process, from which user input can be read.
+		Usually it will block until the user sends a full input line.
+		See `getChar` for an alternative.
 	**/
 	**/
-	static function stdin() : haxe.io.Input;
+	static function stdin():haxe.io.Input;
 
 
 	/**
 	/**
-		Returns the process standard output on which you can write.
+		Returns the standard output of the process, to which program output can be written.
 	**/
 	**/
-	static function stdout() : haxe.io.Output;
+	static function stdout():haxe.io.Output;
 
 
 	/**
 	/**
-		Returns the process standard error on which you can write.
+		Returns the standard error of the process, to which program errors can be written.
 	**/
 	**/
-	static function stderr() : haxe.io.Output;
-
+	static function stderr():haxe.io.Output;
 }
 }

+ 22 - 27
std/Type.hx

@@ -30,7 +30,6 @@
 	@see https://haxe.org/manual/std-reflection.html
 	@see https://haxe.org/manual/std-reflection.html
 **/
 **/
 extern class Type {
 extern class Type {
-
 	/**
 	/**
 		Returns the class of `o`, if `o` is a class instance.
 		Returns the class of `o`, if `o` is a class instance.
 
 
@@ -38,7 +37,7 @@ extern class Type {
 
 
 		In general, type parameter information cannot be obtained at runtime.
 		In general, type parameter information cannot be obtained at runtime.
 	**/
 	**/
-	public static function getClass<T>( o : T ) : Class<T>;
+	public static function getClass<T>(o:T):Class<T>;
 
 
 	/**
 	/**
 		Returns the enum of enum instance `o`.
 		Returns the enum of enum instance `o`.
@@ -50,8 +49,7 @@ extern class Type {
 
 
 		In general, type parameter information cannot be obtained at runtime.
 		In general, type parameter information cannot be obtained at runtime.
 	**/
 	**/
-	public static function getEnum( o : EnumValue ) : Enum<Dynamic>;
-
+	public static function getEnum(o:EnumValue):Enum<Dynamic>;
 
 
 	/**
 	/**
 		Returns the super-class of class `c`.
 		Returns the super-class of class `c`.
@@ -62,8 +60,7 @@ extern class Type {
 
 
 		In general, type parameter information cannot be obtained at runtime.
 		In general, type parameter information cannot be obtained at runtime.
 	**/
 	**/
-	public static function getSuperClass( c : Class<Dynamic> ) : Class<Dynamic>;
-
+	public static function getSuperClass(c:Class<Dynamic>):Class<Dynamic>;
 
 
 	/**
 	/**
 		Returns the name of class `c`, including its path.
 		Returns the name of class `c`, including its path.
@@ -80,7 +77,7 @@ extern class Type {
 
 
 		The class name does not include any type parameters.
 		The class name does not include any type parameters.
 	**/
 	**/
-	public static function getClassName( c : Class<Dynamic> ) : String;
+	public static function getClassName(c:Class<Dynamic>):String;
 
 
 	/**
 	/**
 		Returns the name of enum `e`, including its path.
 		Returns the name of enum `e`, including its path.
@@ -97,7 +94,7 @@ extern class Type {
 
 
 		The enum name does not include any type parameters.
 		The enum name does not include any type parameters.
 	**/
 	**/
-	public static function getEnumName( e : Enum<Dynamic> ) : String;
+	public static function getEnumName(e:Enum<Dynamic>):String;
 
 
 	/**
 	/**
 		Resolves a class by name.
 		Resolves a class by name.
@@ -111,7 +108,7 @@ extern class Type {
 
 
 		The class name must not include any type parameters.
 		The class name must not include any type parameters.
 	**/
 	**/
-	public static function resolveClass( name : String ) : Class<Dynamic>;
+	public static function resolveClass(name:String):Class<Dynamic>;
 
 
 	/**
 	/**
 		Resolves an enum by name.
 		Resolves an enum by name.
@@ -126,7 +123,7 @@ extern class Type {
 
 
 		The enum name must not include any type parameters.
 		The enum name must not include any type parameters.
 	**/
 	**/
-	public static function resolveEnum( name : String ) : Enum<Dynamic>;
+	public static function resolveEnum(name:String):Enum<Dynamic>;
 
 
 	/**
 	/**
 		Creates an instance of class `cl`, using `args` as arguments to the
 		Creates an instance of class `cl`, using `args` as arguments to the
@@ -145,7 +142,7 @@ extern class Type {
 		In particular, default values of constructor arguments are not
 		In particular, default values of constructor arguments are not
 		guaranteed to be taken into account.
 		guaranteed to be taken into account.
 	**/
 	**/
-	public static function createInstance<T>( cl : Class<T>, args : Array<Dynamic> ) : T;
+	public static function createInstance<T>(cl:Class<T>, args:Array<Dynamic>):T;
 
 
 	/**
 	/**
 		Creates an instance of class `cl`.
 		Creates an instance of class `cl`.
@@ -154,7 +151,7 @@ extern class Type {
 
 
 		If `cl` is null, the result is unspecified.
 		If `cl` is null, the result is unspecified.
 	**/
 	**/
-	public static function createEmptyInstance<T>( cl : Class<T> ) : T;
+	public static function createEmptyInstance<T>(cl:Class<T>):T;
 
 
 	/**
 	/**
 		Creates an instance of enum `e` by calling its constructor `constr` with
 		Creates an instance of enum `e` by calling its constructor `constr` with
@@ -165,7 +162,7 @@ extern class Type {
 		expected number of constructor arguments, or if any argument has an
 		expected number of constructor arguments, or if any argument has an
 		invalid type, the result is unspecified.
 		invalid type, the result is unspecified.
 	**/
 	**/
-	public static function createEnum<T>( e : Enum<T>, constr : String, ?params : Array<Dynamic> ) : T;
+	public static function createEnum<T>(e:Enum<T>, constr:String, ?params:Array<Dynamic>):T;
 
 
 	/**
 	/**
 		Creates an instance of enum `e` by calling its constructor number
 		Creates an instance of enum `e` by calling its constructor number
@@ -179,7 +176,7 @@ extern class Type {
 		expected number of constructor arguments, or if any argument has an
 		expected number of constructor arguments, or if any argument has an
 		invalid type, the result is unspecified.
 		invalid type, the result is unspecified.
 	**/
 	**/
-	public static function createEnumIndex<T>( e : Enum<T>, index : Int, ?params : Array<Dynamic> ) : T;
+	public static function createEnumIndex<T>(e:Enum<T>, index:Int, ?params:Array<Dynamic>):T;
 
 
 	/**
 	/**
 		Returns a list of the instance fields of class `c`, including
 		Returns a list of the instance fields of class `c`, including
@@ -195,7 +192,7 @@ extern class Type {
 
 
 		(As3) This method only returns instance fields that are public.
 		(As3) This method only returns instance fields that are public.
 	**/
 	**/
-	public static function getInstanceFields( c : Class<Dynamic> ) : Array<String>;
+	public static function getInstanceFields(c:Class<Dynamic>):Array<String>;
 
 
 	/**
 	/**
 		Returns a list of static fields of class `c`.
 		Returns a list of static fields of class `c`.
@@ -208,7 +205,7 @@ extern class Type {
 
 
 		(As3) This method only returns class fields that are public.
 		(As3) This method only returns class fields that are public.
 	**/
 	**/
-	public static function getClassFields( c : Class<Dynamic> ) : Array<String>;
+	public static function getClassFields(c:Class<Dynamic>):Array<String>;
 
 
 	/**
 	/**
 		Returns a list of the names of all constructors of enum `e`.
 		Returns a list of the names of all constructors of enum `e`.
@@ -218,7 +215,7 @@ extern class Type {
 
 
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
-	public static function getEnumConstructs( e : Enum<Dynamic> ) : Array<String>;
+	public static function getEnumConstructs(e:Enum<Dynamic>):Array<String>;
 
 
 	/**
 	/**
 		Returns the runtime type of value `v`.
 		Returns the runtime type of value `v`.
@@ -227,7 +224,7 @@ extern class Type {
 		per platform. Assumptions regarding this should be minimized to avoid
 		per platform. Assumptions regarding this should be minimized to avoid
 		surprises.
 		surprises.
 	**/
 	**/
-	public static function typeof( v : Dynamic ) : ValueType;
+	public static function typeof(v:Dynamic):ValueType;
 
 
 	/**
 	/**
 		Recursively compares two enum instances `a` and `b` by value.
 		Recursively compares two enum instances `a` and `b` by value.
@@ -237,7 +234,7 @@ extern class Type {
 
 
 		If `a` or `b` are null, the result is unspecified.
 		If `a` or `b` are null, the result is unspecified.
 	**/
 	**/
-	public static function enumEq<T:EnumValue>( a : T, b : T ) : Bool;
+	public static function enumEq<T:EnumValue>(a:T, b:T):Bool;
 
 
 	/**
 	/**
 		Returns the constructor name of enum instance `e`.
 		Returns the constructor name of enum instance `e`.
@@ -246,7 +243,7 @@ extern class Type {
 
 
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
-	public static function enumConstructor( e : EnumValue ) : String;
+	public static function enumConstructor(e:EnumValue):String;
 
 
 	/**
 	/**
 		Returns a list of the constructor arguments of enum instance `e`.
 		Returns a list of the constructor arguments of enum instance `e`.
@@ -258,7 +255,7 @@ extern class Type {
 
 
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
-	public static function enumParameters( e : EnumValue ) : Array<Dynamic>;
+	public static function enumParameters(e:EnumValue):Array<Dynamic>;
 
 
 	/**
 	/**
 		Returns the index of enum instance `e`.
 		Returns the index of enum instance `e`.
@@ -268,7 +265,7 @@ extern class Type {
 
 
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
-	public static function enumIndex( e : EnumValue ) : Int;
+	public static function enumIndex(e:EnumValue):Int;
 
 
 	/**
 	/**
 		Returns a list of all constructors of enum `e` that require no
 		Returns a list of all constructors of enum `e` that require no
@@ -283,11 +280,9 @@ extern class Type {
 
 
 		If `e` is null, the result is unspecified.
 		If `e` is null, the result is unspecified.
 	**/
 	**/
-	public static function allEnums<T>( e : Enum<T> ) : Array<T>;
-
+	public static function allEnums<T>(e:Enum<T>):Array<T>;
 }
 }
 
 
-
 /**
 /**
 	The different possible runtime types of a value.
 	The different possible runtime types of a value.
 **/
 **/
@@ -298,7 +293,7 @@ enum ValueType {
 	TBool;
 	TBool;
 	TObject;
 	TObject;
 	TFunction;
 	TFunction;
-	TClass( c : Class<Dynamic> );
-	TEnum( e : Enum<Dynamic> );
+	TClass(c:Class<Dynamic>);
+	TEnum(e:Enum<Dynamic>);
 	TUnknown;
 	TUnknown;
 }
 }

+ 88 - 62
std/UInt.hx

@@ -19,7 +19,6 @@
  * 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.
  */
  */
-
 #if ((flash || flash9doc || cs || hl) && !doc_gen)
 #if ((flash || flash9doc || cs || hl) && !doc_gen)
 /**
 /**
 	The unsigned `Int` type is only defined for Flash and C#. It's currently
 	The unsigned `Int` type is only defined for Flash and C#. It's currently
@@ -31,68 +30,100 @@
 @:notNull
 @:notNull
 @:runtimeValue
 @:runtimeValue
 @:analyzer(no_const_propagation)
 @:analyzer(no_const_propagation)
-abstract UInt to Int from Int
-{
-	@:commutative @:op(A+B) private static function addI(lhs:UInt, rhs:Int):UInt;
-	@:commutative @:op(A+B) private static function addF(lhs:UInt, rhs:Float):Float;
-	@:op(A+B) private static function add(lhs:UInt, rhs:UInt):UInt;
-
-	@:commutative @:op(A*B) private static function mulI(lhs:UInt, rhs:Int):UInt;
-	@:commutative @:op(A*B) private static function mulF(lhs:UInt, rhs:Float):Float;
-	@:op(A*B) private static function mul(lhs:UInt, rhs:UInt):UInt;
-
-	@:op(A%B) private static function modI(lhs:UInt, rhs:Int):UInt;
-	@:op(A%B) private static function modF(lhs:UInt, rhs:Float):Float;
-	@:op(A%B) private static function mod(lhs:UInt, rhs:UInt):UInt;
-
-	@:op(A-B) private static function subI(lhs:UInt, rhs:Int):UInt;
-	@:op(A-B) private static function subF(lhs:UInt, rhs:Float):Float;
-	@:op(A-B) private static function sub(lhs:UInt, rhs:UInt):UInt;
-
-	@:op(A/B) private static function divI(lhs:UInt, rhs:Int):Float;
-	@:op(A/B) private static function divF(lhs:UInt, rhs:Float):Float;
-	@:op(A/B) private static function div(lhs:UInt, rhs:UInt):Float;
-
-	@:commutative @:op(A|B) private static function orI(lhs:UInt, rhs:Int):UInt;
-	@:op(A|B) private static function or(lhs:UInt, rhs:UInt):UInt;
-
-	@:commutative @:op(A^B) private static function xorI(lhs:UInt, rhs:Int):UInt;
-	@:op(A^B) private static function xor(lhs:UInt, rhs:UInt):UInt;
-
-	@:commutative @:op(A&B) private static function andI(lhs:UInt, rhs:Int):UInt;
-	@:op(A&B) private static function and(lhs:UInt, rhs:UInt):UInt;
-
-	@:op(A<<B) private static function shl(lhs:UInt, rhs:Int):UInt;
-	@:op(A>>B) private static inline function shr(lhs:UInt, rhs:Int):UInt return lhs >>> rhs;
-	@:op(A>>>B) private static function ushr(lhs:UInt, rhs:Int):UInt;
-
-	@:op(A>B) private static function gt(lhs:UInt, rhs:UInt):Bool;
-	@:op(A>=B) private static function gte(lhs:UInt, rhs:UInt):Bool;
-	@:op(A<B) private static function lt(lhs:UInt, rhs:UInt):Bool;
-	@:op(A<=B) private static function lte(lhs:UInt, rhs:UInt):Bool;
-
-	@:op(A>B) private static function gtf(lhs:UInt, rhs:Float):Bool;
-	@:op(A>B) private static function gtf2(lhs:Float, rhs:UInt):Bool;
-	@:op(A>=B) private static function gtef(lhs:UInt, rhs:Float):Bool;
-	@:op(A>=B) private static function gtef2(lhs:Float, rhs:UInt):Bool;
-	@:op(A<B) private static function ltf(lhs:UInt, rhs:Float):Bool;
-	@:op(A<B) private static function ltf2(lhs:Float, rhs:UInt):Bool;
-	@:op(A<=B) private static function ltef(lhs:UInt, rhs:Float):Bool;
-	@:op(A<=B) private static function ltef2(lhs:Float, rhs:UInt):Bool;
+abstract UInt to Int from Int {
+	@:commutative @:op(A + B) private static function addI(lhs:UInt, rhs:Int):UInt;
+
+	@:commutative @:op(A + B) private static function addF(lhs:UInt, rhs:Float):Float;
+
+	@:op(A + B) private static function add(lhs:UInt, rhs:UInt):UInt;
+
+	@:commutative @:op(A * B) private static function mulI(lhs:UInt, rhs:Int):UInt;
+
+	@:commutative @:op(A * B) private static function mulF(lhs:UInt, rhs:Float):Float;
+
+	@:op(A * B) private static function mul(lhs:UInt, rhs:UInt):UInt;
+
+	@:op(A % B) private static function modI(lhs:UInt, rhs:Int):UInt;
+
+	@:op(A % B) private static function modF(lhs:UInt, rhs:Float):Float;
+
+	@:op(A % B) private static function mod(lhs:UInt, rhs:UInt):UInt;
+
+	@:op(A - B) private static function subI(lhs:UInt, rhs:Int):UInt;
+
+	@:op(A - B) private static function subF(lhs:UInt, rhs:Float):Float;
+
+	@:op(A - B) private static function sub(lhs:UInt, rhs:UInt):UInt;
+
+	@:op(A / B) private static function divI(lhs:UInt, rhs:Int):Float;
+
+	@:op(A / B) private static function divF(lhs:UInt, rhs:Float):Float;
+
+	@:op(A / B) private static function div(lhs:UInt, rhs:UInt):Float;
+
+	@:commutative @:op(A | B) private static function orI(lhs:UInt, rhs:Int):UInt;
+
+	@:op(A | B) private static function or(lhs:UInt, rhs:UInt):UInt;
+
+	@:commutative @:op(A ^ B) private static function xorI(lhs:UInt, rhs:Int):UInt;
+
+	@:op(A ^ B) private static function xor(lhs:UInt, rhs:UInt):UInt;
+
+	@:commutative @:op(A & B) private static function andI(lhs:UInt, rhs:Int):UInt;
+
+	@:op(A & B) private static function and(lhs:UInt, rhs:UInt):UInt;
+
+	@:op(A << B) private static function shl(lhs:UInt, rhs:Int):UInt;
+
+	@:op(A >> B) private static inline function shr(lhs:UInt, rhs:Int):UInt
+		return lhs >>> rhs;
+
+	@:op(A >>> B) private static function ushr(lhs:UInt, rhs:Int):UInt;
+
+	@:op(A > B) private static function gt(lhs:UInt, rhs:UInt):Bool;
+
+	@:op(A >= B) private static function gte(lhs:UInt, rhs:UInt):Bool;
+
+	@:op(A < B) private static function lt(lhs:UInt, rhs:UInt):Bool;
+
+	@:op(A <= B) private static function lte(lhs:UInt, rhs:UInt):Bool;
+
+	@:op(A > B) private static function gtf(lhs:UInt, rhs:Float):Bool;
+
+	@:op(A > B) private static function gtf2(lhs:Float, rhs:UInt):Bool;
+
+	@:op(A >= B) private static function gtef(lhs:UInt, rhs:Float):Bool;
+
+	@:op(A >= B) private static function gtef2(lhs:Float, rhs:UInt):Bool;
+
+	@:op(A < B) private static function ltf(lhs:UInt, rhs:Float):Bool;
+
+	@:op(A < B) private static function ltf2(lhs:Float, rhs:UInt):Bool;
+
+	@:op(A <= B) private static function ltef(lhs:UInt, rhs:Float):Bool;
+
+	@:op(A <= B) private static function ltef2(lhs:Float, rhs:UInt):Bool;
 
 
 	@:op(~A) private static function bneg(t:UInt):UInt;
 	@:op(~A) private static function bneg(t:UInt):UInt;
 
 
 	@:commutative @:op(A == B) private static function equalsInt<T:Int>(a:UInt, b:T):Bool;
 	@:commutative @:op(A == B) private static function equalsInt<T:Int>(a:UInt, b:T):Bool;
+
 	@:commutative @:op(A != B) private static function notEqualsInt<T:Int>(a:UInt, b:T):Bool;
 	@:commutative @:op(A != B) private static function notEqualsInt<T:Int>(a:UInt, b:T):Bool;
+
 	@:commutative @:op(A == B) private static function equalsFloat<T:Float>(a:UInt, b:T):Bool;
 	@:commutative @:op(A == B) private static function equalsFloat<T:Float>(a:UInt, b:T):Bool;
+
 	@:commutative @:op(A != B) private static function notEqualsFloat<T:Float>(a:UInt, b:T):Bool;
 	@:commutative @:op(A != B) private static function notEqualsFloat<T:Float>(a:UInt, b:T):Bool;
 
 
 	@:op(++A) private function prefixIncrement():UInt;
 	@:op(++A) private function prefixIncrement():UInt;
+
 	@:op(A++) private function postfixIncrement():UInt;
 	@:op(A++) private function postfixIncrement():UInt;
+
 	@:op(--A) private function prefixDecrement():UInt;
 	@:op(--A) private function prefixDecrement():UInt;
+
 	@:op(A--) private function postfixDecrement():UInt;
 	@:op(A--) private function postfixDecrement():UInt;
 }
 }
 #else
 #else
+
 /**
 /**
 	The unsigned `Int` type is only defined for Flash and C#.
 	The unsigned `Int` type is only defined for Flash and C#.
 	Simulate it for other platforms.
 	Simulate it for other platforms.
@@ -100,7 +131,6 @@ abstract UInt to Int from Int
 	@see https://haxe.org/manual/types-basic-types.html
 	@see https://haxe.org/manual/types-basic-types.html
 **/
 **/
 abstract UInt(Int) from Int to Int {
 abstract UInt(Int) from Int to Int {
-
 	@:op(A + B) private static inline function add(a:UInt, b:UInt):UInt {
 	@:op(A + B) private static inline function add(a:UInt, b:UInt):UInt {
 		return a.toInt() + b.toInt();
 		return a.toInt() + b.toInt();
 	}
 	}
@@ -117,20 +147,18 @@ abstract UInt(Int) from Int to Int {
 		return a.toInt() - b.toInt();
 		return a.toInt() - b.toInt();
 	}
 	}
 
 
-	@:op(A > B) private static #if !js inline #end function gt(a:UInt, b:UInt):Bool {
+	@:op(A > B)
+	private static #if !js inline #end function gt(a:UInt, b:UInt):Bool {
 		var aNeg = a.toInt() < 0;
 		var aNeg = a.toInt() < 0;
 		var bNeg = b.toInt() < 0;
 		var bNeg = b.toInt() < 0;
-		return
-			if( aNeg != bNeg ) aNeg;
-			else a.toInt() > b.toInt();
+		return if (aNeg != bNeg) aNeg; else a.toInt() > b.toInt();
 	}
 	}
 
 
-	@:op(A >= B) private static #if !js inline #end function gte(a:UInt, b:UInt):Bool {
+	@:op(A >= B)
+	private static #if !js inline #end function gte(a:UInt, b:UInt):Bool {
 		var aNeg = a.toInt() < 0;
 		var aNeg = a.toInt() < 0;
 		var bNeg = b.toInt() < 0;
 		var bNeg = b.toInt() < 0;
-		return
-			if( aNeg != bNeg ) aNeg;
-			else a.toInt() >= b.toInt();
+		return if (aNeg != bNeg) aNeg; else a.toInt() >= b.toInt();
 	}
 	}
 
 
 	@:op(A < B) private static inline function lt(a:UInt, b:UInt):Bool {
 	@:op(A < B) private static inline function lt(a:UInt, b:UInt):Bool {
@@ -166,7 +194,7 @@ abstract UInt(Int) from Int to Int {
 	}
 	}
 
 
 	@:op(A % B) private static inline function mod(a:UInt, b:UInt):UInt {
 	@:op(A % B) private static inline function mod(a:UInt, b:UInt):UInt {
-		return Std.int( a.toFloat() % b.toFloat() );
+		return Std.int(a.toFloat() % b.toFloat());
 	}
 	}
 
 
 	@:commutative @:op(A + B) private static inline function addWithFloat(a:UInt, b:Float):Float {
 	@:commutative @:op(A + B) private static inline function addWithFloat(a:UInt, b:Float):Float {
@@ -217,7 +245,6 @@ abstract UInt(Int) from Int to Int {
 		return a.toFloat() >= b;
 		return a.toFloat() >= b;
 	}
 	}
 
 
-
 	@:op(A > B) private static inline function floatGt(a:Float, b:UInt):Bool {
 	@:op(A > B) private static inline function floatGt(a:Float, b:UInt):Bool {
 		return a > b.toFloat();
 		return a > b.toFloat();
 	}
 	}
@@ -283,8 +310,7 @@ abstract UInt(Int) from Int to Int {
 		var int = toInt();
 		var int = toInt();
 		if (int < 0) {
 		if (int < 0) {
 			return 4294967296.0 + int;
 			return 4294967296.0 + int;
-		}
-		else {
+		} else {
 			// + 0.0 here to make sure we promote to Float on some platforms
 			// + 0.0 here to make sure we promote to Float on some platforms
 			// In particular, PHP was having issues when comparing to Int in the == op.
 			// In particular, PHP was having issues when comparing to Int in the == op.
 			return int + 0.0;
 			return int + 0.0;

+ 94 - 85
std/UnicodeString.hx

@@ -33,68 +33,72 @@ import haxe.iterators.StringKeyValueIteratorUnicode;
 @:forward
 @:forward
 @:access(StringTools)
 @:access(StringTools)
 abstract UnicodeString(String) from String to String {
 abstract UnicodeString(String) from String to String {
-
 	/**
 	/**
 		Tells if `b` is a correctly encoded UTF8 byte sequence.
 		Tells if `b` is a correctly encoded UTF8 byte sequence.
 	**/
 	**/
 	static public function validate(b:Bytes, encoding:Encoding):Bool {
 	static public function validate(b:Bytes, encoding:Encoding):Bool {
-		switch(encoding) {
-			case RawNative: throw "UnicodeString.validate: RawNative encoding is not supported";
+		switch (encoding) {
+			case RawNative:
+				throw "UnicodeString.validate: RawNative encoding is not supported";
 			case UTF8:
 			case UTF8:
 				var data = b.getData();
 				var data = b.getData();
 				var pos = 0;
 				var pos = 0;
 				var max = b.length;
 				var max = b.length;
-				while(pos < max) {
+				while (pos < max) {
 					var c:Int = Bytes.fastGet(data, pos++);
 					var c:Int = Bytes.fastGet(data, pos++);
-					if(c < 0x80) {
-					} else if(c < 0xC2) {
+					if (c < 0x80) {} else if (c < 0xC2) {
 						return false;
 						return false;
-					} else if(c < 0xE0) {
-						if(pos + 1 > max) {
+					} else if (c < 0xE0) {
+						if (pos + 1 > max) {
 							return false;
 							return false;
 						}
 						}
 						var c2:Int = Bytes.fastGet(data, pos++);
 						var c2:Int = Bytes.fastGet(data, pos++);
-						if(c2 < 0x80 || c2 > 0xBF) {
+						if (c2 < 0x80 || c2 > 0xBF) {
 							return false;
 							return false;
 						}
 						}
-					} else if(c < 0xF0) {
-						if(pos + 2 > max) {
+					} else if (c < 0xF0) {
+						if (pos + 2 > max) {
 							return false;
 							return false;
 						}
 						}
 						var c2:Int = Bytes.fastGet(data, pos++);
 						var c2:Int = Bytes.fastGet(data, pos++);
-						if(c == 0xE0) {
-							if(c2 < 0xA0 || c2 > 0xBF) return false;
+						if (c == 0xE0) {
+							if (c2 < 0xA0 || c2 > 0xBF)
+								return false;
 						} else {
 						} else {
-							if(c2 < 0x80 || c2 > 0xBF) return false;
+							if (c2 < 0x80 || c2 > 0xBF)
+								return false;
 						}
 						}
 						var c3:Int = Bytes.fastGet(data, pos++);
 						var c3:Int = Bytes.fastGet(data, pos++);
-						if(c3 < 0x80 || c3 > 0xBF) {
+						if (c3 < 0x80 || c3 > 0xBF) {
 							return false;
 							return false;
 						}
 						}
 						c = (c << 16) | (c2 << 8) | c3;
 						c = (c << 16) | (c2 << 8) | c3;
-						if(0xEDA080 <= c && c <= 0xEDBFBF) { //surrogate pairs
+						if (0xEDA080 <= c && c <= 0xEDBFBF) { // surrogate pairs
 							return false;
 							return false;
 						}
 						}
-					} else if(c > 0xF4) {
+					} else if (c > 0xF4) {
 						return false;
 						return false;
 					} else {
 					} else {
-						if(pos + 3 > max) {
+						if (pos + 3 > max) {
 							return false;
 							return false;
 						}
 						}
 						var c2:Int = Bytes.fastGet(data, pos++);
 						var c2:Int = Bytes.fastGet(data, pos++);
-						if(c == 0xF0) {
-							if(c2 < 0x90 || c2 > 0xBF) return false;
-						} else if(c == 0xF4) {
-							if(c2 < 0x80 || c2 > 0x8F) return false;
+						if (c == 0xF0) {
+							if (c2 < 0x90 || c2 > 0xBF)
+								return false;
+						} else if (c == 0xF4) {
+							if (c2 < 0x80 || c2 > 0x8F)
+								return false;
 						} else {
 						} else {
-							if(c2 < 0x80 || c2 > 0xBF) return false;
+							if (c2 < 0x80 || c2 > 0xBF)
+								return false;
 						}
 						}
 						var c3:Int = Bytes.fastGet(data, pos++);
 						var c3:Int = Bytes.fastGet(data, pos++);
-						if(c3 < 0x80 || c3 > 0xBF) {
+						if (c3 < 0x80 || c3 > 0xBF) {
 							return false;
 							return false;
 						}
 						}
 						var c4:Int = Bytes.fastGet(data, pos++);
 						var c4:Int = Bytes.fastGet(data, pos++);
-						if(c4 < 0x80 || c4 > 0xBF) {
+						if (c4 < 0x80 || c4 > 0xBF) {
 							return false;
 							return false;
 						}
 						}
 					}
 					}
@@ -103,8 +107,7 @@ abstract UnicodeString(String) from String to String {
 		}
 		}
 	}
 	}
 
 
-#if target.unicode
-
+	#if target.unicode
 	/**
 	/**
 		Creates an instance of UnicodeString.
 		Creates an instance of UnicodeString.
 	**/
 	**/
@@ -127,11 +130,10 @@ abstract UnicodeString(String) from String to String {
 	}
 	}
 
 
 	#if target.utf16
 	#if target.utf16
-
 	/**
 	/**
 		The number of characters in `this` String.
 		The number of characters in `this` String.
 	**/
 	**/
-	public var length(get,never):Int;
+	public var length(get, never):Int;
 
 
 	/**
 	/**
 		Returns the character at position `index` of `this` String.
 		Returns the character at position `index` of `this` String.
@@ -140,15 +142,16 @@ abstract UnicodeString(String) from String to String {
 		is returned.
 		is returned.
 	**/
 	**/
 	public function charAt(index:Int):String {
 	public function charAt(index:Int):String {
-		if(index < 0) return '';
+		if (index < 0)
+			return '';
 		var unicodeOffset = 0;
 		var unicodeOffset = 0;
 		var nativeOffset = 0;
 		var nativeOffset = 0;
-		while(nativeOffset < this.length) {
+		while (nativeOffset < this.length) {
 			var c = StringTools.utf16CodePointAt(this, nativeOffset++);
 			var c = StringTools.utf16CodePointAt(this, nativeOffset++);
-			if(unicodeOffset == index) {
+			if (unicodeOffset == index) {
 				return String.fromCharCode(c);
 				return String.fromCharCode(c);
 			}
 			}
-			if(c >= StringTools.MIN_SURROGATE_CODE_POINT) {
+			if (c >= StringTools.MIN_SURROGATE_CODE_POINT) {
 				nativeOffset++;
 				nativeOffset++;
 			}
 			}
 			unicodeOffset++;
 			unicodeOffset++;
@@ -162,15 +165,16 @@ abstract UnicodeString(String) from String to String {
 		If `index` is negative or exceeds `this.length`, `null` is returned.
 		If `index` is negative or exceeds `this.length`, `null` is returned.
 	**/
 	**/
 	public function charCodeAt(index:Int):Null<Int> {
 	public function charCodeAt(index:Int):Null<Int> {
-		if(index < 0) return null;
+		if (index < 0)
+			return null;
 		var unicodeOffset = 0;
 		var unicodeOffset = 0;
 		var nativeOffset = 0;
 		var nativeOffset = 0;
-		while(nativeOffset < this.length) {
+		while (nativeOffset < this.length) {
 			var c = StringTools.utf16CodePointAt(this, nativeOffset++);
 			var c = StringTools.utf16CodePointAt(this, nativeOffset++);
-			if(unicodeOffset == index) {
+			if (unicodeOffset == index) {
 				return c;
 				return c;
 			}
 			}
-			if(c >= StringTools.MIN_SURROGATE_CODE_POINT) {
+			if (c >= StringTools.MIN_SURROGATE_CODE_POINT) {
 				nativeOffset++;
 				nativeOffset++;
 			}
 			}
 			unicodeOffset++;
 			unicodeOffset++;
@@ -194,11 +198,11 @@ abstract UnicodeString(String) from String to String {
 		If `str` cannot be found, -1 is returned.
 		If `str` cannot be found, -1 is returned.
 	**/
 	**/
 	public function indexOf(str:String, ?startIndex:Int):Int {
 	public function indexOf(str:String, ?startIndex:Int):Int {
-		if(startIndex == null) {
+		if (startIndex == null) {
 			startIndex = 0;
 			startIndex = 0;
 		} else {
 		} else {
-			if(startIndex < 0) {
-				startIndex = (this:UnicodeString).length + startIndex;
+			if (startIndex < 0) {
+				startIndex = (this : UnicodeString).length + startIndex;
 			}
 			}
 		}
 		}
 
 
@@ -206,23 +210,23 @@ abstract UnicodeString(String) from String to String {
 		var nativeOffset = 0;
 		var nativeOffset = 0;
 		var matchingOffset = 0;
 		var matchingOffset = 0;
 		var result = -1;
 		var result = -1;
-		while(nativeOffset <= this.length) {
+		while (nativeOffset <= this.length) {
 			var c = StringTools.utf16CodePointAt(this, nativeOffset);
 			var c = StringTools.utf16CodePointAt(this, nativeOffset);
 
 
-			if(unicodeOffset >= startIndex) {
+			if (unicodeOffset >= startIndex) {
 				var c2 = StringTools.utf16CodePointAt(str, matchingOffset);
 				var c2 = StringTools.utf16CodePointAt(str, matchingOffset);
-				if(c == c2) {
-					if(matchingOffset == 0) {
+				if (c == c2) {
+					if (matchingOffset == 0) {
 						result = unicodeOffset;
 						result = unicodeOffset;
 					}
 					}
 					matchingOffset++;
 					matchingOffset++;
-					if(c2 >= StringTools.MIN_SURROGATE_CODE_POINT) {
+					if (c2 >= StringTools.MIN_SURROGATE_CODE_POINT) {
 						matchingOffset++;
 						matchingOffset++;
 					}
 					}
-					if(matchingOffset == str.length) {
+					if (matchingOffset == str.length) {
 						return result;
 						return result;
 					}
 					}
-				} else if(matchingOffset != 0) {
+				} else if (matchingOffset != 0) {
 					result = -1;
 					result = -1;
 					matchingOffset = 0;
 					matchingOffset = 0;
 					continue;
 					continue;
@@ -230,7 +234,7 @@ abstract UnicodeString(String) from String to String {
 			}
 			}
 
 
 			nativeOffset++;
 			nativeOffset++;
-			if(c >= StringTools.MIN_SURROGATE_CODE_POINT) {
+			if (c >= StringTools.MIN_SURROGATE_CODE_POINT) {
 				nativeOffset++;
 				nativeOffset++;
 			}
 			}
 			unicodeOffset++;
 			unicodeOffset++;
@@ -250,9 +254,9 @@ abstract UnicodeString(String) from String to String {
 		If `str` cannot be found, -1 is returned.
 		If `str` cannot be found, -1 is returned.
 	**/
 	**/
 	public function lastIndexOf(str:String, ?startIndex:Int):Int {
 	public function lastIndexOf(str:String, ?startIndex:Int):Int {
-		if(startIndex == null) {
+		if (startIndex == null) {
 			startIndex = this.length;
 			startIndex = this.length;
-		} else if(startIndex < 0) {
+		} else if (startIndex < 0) {
 			startIndex = 0;
 			startIndex = 0;
 		}
 		}
 
 
@@ -261,31 +265,31 @@ abstract UnicodeString(String) from String to String {
 		var result = -1;
 		var result = -1;
 		var lastIndex = -1;
 		var lastIndex = -1;
 		var matchingOffset = 0;
 		var matchingOffset = 0;
-		var strUnicodeLength = (str:UnicodeString).length;
-		while(nativeOffset < this.length && unicodeOffset < startIndex + strUnicodeLength) {
+		var strUnicodeLength = (str : UnicodeString).length;
+		while (nativeOffset < this.length && unicodeOffset < startIndex + strUnicodeLength) {
 			var c = StringTools.utf16CodePointAt(this, nativeOffset);
 			var c = StringTools.utf16CodePointAt(this, nativeOffset);
 
 
 			var c2 = StringTools.utf16CodePointAt(str, matchingOffset);
 			var c2 = StringTools.utf16CodePointAt(str, matchingOffset);
-			if(c == c2) {
-				if(matchingOffset == 0) {
+			if (c == c2) {
+				if (matchingOffset == 0) {
 					lastIndex = unicodeOffset;
 					lastIndex = unicodeOffset;
 				}
 				}
 				matchingOffset++;
 				matchingOffset++;
-				if(c2 >= StringTools.MIN_SURROGATE_CODE_POINT) {
+				if (c2 >= StringTools.MIN_SURROGATE_CODE_POINT) {
 					matchingOffset++;
 					matchingOffset++;
 				}
 				}
-				if(matchingOffset == str.length) {
+				if (matchingOffset == str.length) {
 					result = lastIndex;
 					result = lastIndex;
 					lastIndex = -1;
 					lastIndex = -1;
 				}
 				}
-			} else if(matchingOffset != 0) {
+			} else if (matchingOffset != 0) {
 				lastIndex = -1;
 				lastIndex = -1;
 				matchingOffset = 0;
 				matchingOffset = 0;
 				continue;
 				continue;
 			}
 			}
 
 
 			nativeOffset++;
 			nativeOffset++;
-			if(c >= StringTools.MIN_SURROGATE_CODE_POINT) {
+			if (c >= StringTools.MIN_SURROGATE_CODE_POINT) {
 				nativeOffset++;
 				nativeOffset++;
 			}
 			}
 			unicodeOffset++;
 			unicodeOffset++;
@@ -309,17 +313,17 @@ abstract UnicodeString(String) from String to String {
 		If `len` is negative, the result is unspecified.
 		If `len` is negative, the result is unspecified.
 	**/
 	**/
 	public function substr(pos:Int, ?len:Int):String {
 	public function substr(pos:Int, ?len:Int):String {
-		if(pos < 0) {
-			pos = (this:UnicodeString).length + pos;
-			if(pos < 0) {
+		if (pos < 0) {
+			pos = (this : UnicodeString).length + pos;
+			if (pos < 0) {
 				pos = 0;
 				pos = 0;
 			}
 			}
 		}
 		}
-		if(len != null) {
-			if(len < 0) {
-				len = (this:UnicodeString).length + len;
+		if (len != null) {
+			if (len < 0) {
+				len = (this : UnicodeString).length + len;
 			}
 			}
-			if(len <= 0) {
+			if (len <= 0) {
 				return "";
 				return "";
 			}
 			}
 		}
 		}
@@ -327,18 +331,18 @@ abstract UnicodeString(String) from String to String {
 		var nativeOffset = 0;
 		var nativeOffset = 0;
 		var fromOffset = -1;
 		var fromOffset = -1;
 		var subLength = 0;
 		var subLength = 0;
-		while(nativeOffset < this.length) {
+		while (nativeOffset < this.length) {
 			var c = StringTools.utf16CodePointAt(this, nativeOffset);
 			var c = StringTools.utf16CodePointAt(this, nativeOffset);
 
 
-			if(unicodeOffset >= pos) {
-				if(fromOffset < 0) {
-					if(len == null) {
+			if (unicodeOffset >= pos) {
+				if (fromOffset < 0) {
+					if (len == null) {
 						return this.substr(nativeOffset);
 						return this.substr(nativeOffset);
 					}
 					}
 					fromOffset = nativeOffset;
 					fromOffset = nativeOffset;
 				}
 				}
 				subLength++;
 				subLength++;
-				if(subLength >= len) {
+				if (subLength >= len) {
 					var lastOffset = (c < StringTools.MIN_SURROGATE_CODE_POINT ? nativeOffset : nativeOffset + 1);
 					var lastOffset = (c < StringTools.MIN_SURROGATE_CODE_POINT ? nativeOffset : nativeOffset + 1);
 					return this.substr(fromOffset, lastOffset - fromOffset + 1);
 					return this.substr(fromOffset, lastOffset - fromOffset + 1);
 				}
 				}
@@ -364,17 +368,17 @@ abstract UnicodeString(String) from String to String {
 		String `""` is returned.
 		String `""` is returned.
 	**/
 	**/
 	public function substring(startIndex:Int, ?endIndex:Int):String {
 	public function substring(startIndex:Int, ?endIndex:Int):String {
-		if(startIndex < 0) {
+		if (startIndex < 0) {
 			startIndex = 0;
 			startIndex = 0;
 		}
 		}
-		if(endIndex != null) {
-			if(endIndex < 0) {
+		if (endIndex != null) {
+			if (endIndex < 0) {
 				endIndex = 0;
 				endIndex = 0;
 			}
 			}
-			if(startIndex == endIndex) {
+			if (startIndex == endIndex) {
 				return "";
 				return "";
 			}
 			}
-			if(startIndex > endIndex) {
+			if (startIndex > endIndex) {
 				var tmp = startIndex;
 				var tmp = startIndex;
 				startIndex = endIndex;
 				startIndex = endIndex;
 				endIndex = tmp;
 				endIndex = tmp;
@@ -385,18 +389,18 @@ abstract UnicodeString(String) from String to String {
 		var nativeOffset = 0;
 		var nativeOffset = 0;
 		var fromOffset = -1;
 		var fromOffset = -1;
 		var subLength = 0;
 		var subLength = 0;
-		while(nativeOffset < this.length) {
+		while (nativeOffset < this.length) {
 			var c = StringTools.utf16CodePointAt(this, nativeOffset);
 			var c = StringTools.utf16CodePointAt(this, nativeOffset);
 
 
-			if(startIndex <= unicodeOffset) {
-				if(fromOffset < 0) {
-					if(endIndex == null) {
+			if (startIndex <= unicodeOffset) {
+				if (fromOffset < 0) {
+					if (endIndex == null) {
 						return this.substr(nativeOffset);
 						return this.substr(nativeOffset);
 					}
 					}
 					fromOffset = nativeOffset;
 					fromOffset = nativeOffset;
 				}
 				}
 				subLength++;
 				subLength++;
-				if(subLength >= endIndex - startIndex) {
+				if (subLength >= endIndex - startIndex) {
 					var lastOffset = (c < StringTools.MIN_SURROGATE_CODE_POINT ? nativeOffset : nativeOffset + 1);
 					var lastOffset = (c < StringTools.MIN_SURROGATE_CODE_POINT ? nativeOffset : nativeOffset + 1);
 					return this.substr(fromOffset, lastOffset - fromOffset + 1);
 					return this.substr(fromOffset, lastOffset - fromOffset + 1);
 				}
 				}
@@ -410,25 +414,30 @@ abstract UnicodeString(String) from String to String {
 
 
 	function get_length():Int {
 	function get_length():Int {
 		var l = 0;
 		var l = 0;
-		for(c in new StringIteratorUnicode(this)) {
+		for (c in new StringIteratorUnicode(this)) {
 			l++;
 			l++;
 		}
 		}
 		return l;
 		return l;
 	}
 	}
-
 	#end
 	#end
-
-#end
-
+	#end
 	@:op(A < B) static function lt(a:UnicodeString, b:UnicodeString):Bool;
 	@:op(A < B) static function lt(a:UnicodeString, b:UnicodeString):Bool;
+
 	@:op(A <= B) static function lte(a:UnicodeString, b:UnicodeString):Bool;
 	@:op(A <= B) static function lte(a:UnicodeString, b:UnicodeString):Bool;
+
 	@:op(A > B) static function gt(a:UnicodeString, b:UnicodeString):Bool;
 	@:op(A > B) static function gt(a:UnicodeString, b:UnicodeString):Bool;
+
 	@:op(A >= B) static function gte(a:UnicodeString, b:UnicodeString):Bool;
 	@:op(A >= B) static function gte(a:UnicodeString, b:UnicodeString):Bool;
+
 	@:op(A == B) static function eq(a:UnicodeString, b:UnicodeString):Bool;
 	@:op(A == B) static function eq(a:UnicodeString, b:UnicodeString):Bool;
+
 	@:op(A != B) static function neq(a:UnicodeString, b:UnicodeString):Bool;
 	@:op(A != B) static function neq(a:UnicodeString, b:UnicodeString):Bool;
+
 	@:op(A + B) static function add(a:UnicodeString, b:UnicodeString):UnicodeString;
 	@:op(A + B) static function add(a:UnicodeString, b:UnicodeString):UnicodeString;
+
 	@:op(A += B) static function assignAdd(a:UnicodeString, b:UnicodeString):UnicodeString;
 	@:op(A += B) static function assignAdd(a:UnicodeString, b:UnicodeString):UnicodeString;
 
 
 	@:op(A + B) @:commutative static function add(a:UnicodeString, b:String):UnicodeString;
 	@:op(A + B) @:commutative static function add(a:UnicodeString, b:String):UnicodeString;
+
 	@:op(A += B) @:commutative static function assignAdd(a:UnicodeString, b:String):UnicodeString;
 	@:op(A += B) @:commutative static function assignAdd(a:UnicodeString, b:String):UnicodeString;
 }
 }

+ 51 - 36
std/Xml.hx

@@ -30,26 +30,32 @@ enum abstract XmlType(Int) {
 		Represents an XML element type.
 		Represents an XML element type.
 	**/
 	**/
 	var Element = 0;
 	var Element = 0;
+
 	/**
 	/**
 		Represents XML parsed character data type.
 		Represents XML parsed character data type.
 	**/
 	**/
 	var PCData = 1;
 	var PCData = 1;
+
 	/**
 	/**
 		Represents XML character data type.
 		Represents XML character data type.
 	**/
 	**/
 	var CData = 2;
 	var CData = 2;
+
 	/**
 	/**
 		Represents an XML comment type.
 		Represents an XML comment type.
 	**/
 	**/
 	var Comment = 3;
 	var Comment = 3;
+
 	/**
 	/**
 		Represents an XML doctype element type.
 		Represents an XML doctype element type.
 	**/
 	**/
 	var DocType = 4;
 	var DocType = 4;
+
 	/**
 	/**
-	 	Represents an XML processing instruction type.
+		Represents an XML processing instruction type.
 	**/
 	**/
 	var ProcessingInstruction = 5;
 	var ProcessingInstruction = 5;
+
 	/**
 	/**
 		Represents an XML document type.
 		Represents an XML document type.
 	**/
 	**/
@@ -77,36 +83,42 @@ class Xml {
 	/**
 	/**
 		XML element type.
 		XML element type.
 	**/
 	**/
-	static public var Element(default,never) = XmlType.Element;
+	static public var Element(default, never) = XmlType.Element;
+
 	/**
 	/**
 		XML parsed character data type.
 		XML parsed character data type.
 	**/
 	**/
-	static public var PCData(default,never) = XmlType.PCData;
+	static public var PCData(default, never) = XmlType.PCData;
+
 	/**
 	/**
 		XML character data type.
 		XML character data type.
 	**/
 	**/
-	static public var CData(default,never) = XmlType.CData;
+	static public var CData(default, never) = XmlType.CData;
+
 	/**
 	/**
 		XML comment type.
 		XML comment type.
 	**/
 	**/
-	static public var Comment(default,never) = XmlType.Comment;
+	static public var Comment(default, never) = XmlType.Comment;
+
 	/**
 	/**
 		XML doctype element type.
 		XML doctype element type.
 	**/
 	**/
-	static public var DocType(default,never) = XmlType.DocType;
+	static public var DocType(default, never) = XmlType.DocType;
+
 	/**
 	/**
-	 	XML processing instruction type.
+		XML processing instruction type.
 	**/
 	**/
-	static public var ProcessingInstruction(default,never) = XmlType.ProcessingInstruction;
+	static public var ProcessingInstruction(default, never) = XmlType.ProcessingInstruction;
+
 	/**
 	/**
 		XML document type.
 		XML document type.
 	**/
 	**/
-	static public var Document(default,never) = XmlType.Document;
+	static public var Document(default, never) = XmlType.Document;
 
 
 	/**
 	/**
 		Parses the String into an Xml document.
 		Parses the String into an Xml document.
 	**/
 	**/
-	static public function parse( str : String ) : Xml {
+	static public function parse(str:String):Xml {
 		return haxe.xml.Parser.parse(str);
 		return haxe.xml.Parser.parse(str);
 	}
 	}
 
 
@@ -115,23 +127,23 @@ class Xml {
 		accessing other functions since some might raise an exception
 		accessing other functions since some might raise an exception
 		if the node type is not correct.
 		if the node type is not correct.
 	**/
 	**/
-	public var nodeType(default, null) : XmlType;
+	public var nodeType(default, null):XmlType;
 
 
 	/**
 	/**
 		Returns the node name of an Element.
 		Returns the node name of an Element.
 	**/
 	**/
-	@:isVar public var nodeName(get, set) : String;
+	@:isVar public var nodeName(get, set):String;
 
 
 	/**
 	/**
 		Returns the node value. Only works if the Xml node is not an Element or a Document.
 		Returns the node value. Only works if the Xml node is not an Element or a Document.
 	**/
 	**/
-	@:isVar public var nodeValue(get, set) : String;
+	@:isVar public var nodeValue(get, set):String;
 
 
 	/**
 	/**
 		Returns the parent object in the Xml hierarchy.
 		Returns the parent object in the Xml hierarchy.
 		The parent can be `null`, an Element or a Document.
 		The parent can be `null`, an Element or a Document.
 	**/
 	**/
-	public var parent(default, null) : Xml;
+	public var parent(default, null):Xml;
 
 
 	var children:Array<Xml>;
 	var children:Array<Xml>;
 	var attributeMap:Map<String, String>;
 	var attributeMap:Map<String, String>;
@@ -167,7 +179,7 @@ class Xml {
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
 	**/
 	**/
-	static public function createElement( name : String ) : Xml {
+	static public function createElement(name:String):Xml {
 		var xml = new Xml(Element);
 		var xml = new Xml(Element);
 		xml.nodeName = name;
 		xml.nodeName = name;
 		return xml;
 		return xml;
@@ -176,7 +188,7 @@ class Xml {
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
 	**/
 	**/
-	static public function createPCData( data : String ) : Xml {
+	static public function createPCData(data:String):Xml {
 		var xml = new Xml(PCData);
 		var xml = new Xml(PCData);
 		xml.nodeValue = data;
 		xml.nodeValue = data;
 		return xml;
 		return xml;
@@ -185,7 +197,7 @@ class Xml {
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
 	**/
 	**/
-	static public function createCData( data : String ) : Xml {
+	static public function createCData(data:String):Xml {
 		var xml = new Xml(CData);
 		var xml = new Xml(CData);
 		xml.nodeValue = data;
 		xml.nodeValue = data;
 		return xml;
 		return xml;
@@ -194,7 +206,7 @@ class Xml {
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
 	**/
 	**/
-	static public function createComment( data : String ) : Xml {
+	static public function createComment(data:String):Xml {
 		var xml = new Xml(Comment);
 		var xml = new Xml(Comment);
 		xml.nodeValue = data;
 		xml.nodeValue = data;
 		return xml;
 		return xml;
@@ -203,7 +215,7 @@ class Xml {
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
 	**/
 	**/
-	static public function createDocType( data : String ) : Xml {
+	static public function createDocType(data:String):Xml {
 		var xml = new Xml(DocType);
 		var xml = new Xml(DocType);
 		xml.nodeValue = data;
 		xml.nodeValue = data;
 		return xml;
 		return xml;
@@ -212,7 +224,7 @@ class Xml {
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
 	**/
 	**/
-	static public function createProcessingInstruction( data : String ) : Xml {
+	static public function createProcessingInstruction(data:String):Xml {
 		var xml = new Xml(ProcessingInstruction);
 		var xml = new Xml(ProcessingInstruction);
 		xml.nodeValue = data;
 		xml.nodeValue = data;
 		return xml;
 		return xml;
@@ -221,7 +233,7 @@ class Xml {
 	/**
 	/**
 		Creates a node of the given type.
 		Creates a node of the given type.
 	**/
 	**/
-	static public function createDocument() : Xml {
+	static public function createDocument():Xml {
 		return new Xml(Document);
 		return new Xml(Document);
 	}
 	}
 
 
@@ -229,7 +241,7 @@ class Xml {
 		Get the given attribute of an Element node. Returns `null` if not found.
 		Get the given attribute of an Element node. Returns `null` if not found.
 		Attributes are case-sensitive.
 		Attributes are case-sensitive.
 	**/
 	**/
-	public function get( att : String ) : String {
+	public function get(att:String):String {
 		if (nodeType != Element) {
 		if (nodeType != Element) {
 			throw 'Bad node type, expected Element but found $nodeType';
 			throw 'Bad node type, expected Element but found $nodeType';
 		}
 		}
@@ -240,7 +252,7 @@ class Xml {
 		Set the given attribute value for an Element node.
 		Set the given attribute value for an Element node.
 		Attributes are case-sensitive.
 		Attributes are case-sensitive.
 	**/
 	**/
-	public function set( att : String, value : String ) : Void {
+	public function set(att:String, value:String):Void {
 		if (nodeType != Element) {
 		if (nodeType != Element) {
 			throw 'Bad node type, expected Element but found $nodeType';
 			throw 'Bad node type, expected Element but found $nodeType';
 		}
 		}
@@ -251,7 +263,7 @@ class Xml {
 		Removes an attribute for an Element node.
 		Removes an attribute for an Element node.
 		Attributes are case-sensitive.
 		Attributes are case-sensitive.
 	**/
 	**/
-	public function remove( att : String ) : Void {
+	public function remove(att:String):Void {
 		if (nodeType != Element) {
 		if (nodeType != Element) {
 			throw 'Bad node type, expected Element but found $nodeType';
 			throw 'Bad node type, expected Element but found $nodeType';
 		}
 		}
@@ -262,7 +274,7 @@ class Xml {
 		Tells if the Element node has a given attribute.
 		Tells if the Element node has a given attribute.
 		Attributes are case-sensitive.
 		Attributes are case-sensitive.
 	**/
 	**/
-	public function exists( att : String ) : Bool {
+	public function exists(att:String):Bool {
 		if (nodeType != Element) {
 		if (nodeType != Element) {
 			throw 'Bad node type, expected Element but found $nodeType';
 			throw 'Bad node type, expected Element but found $nodeType';
 		}
 		}
@@ -272,7 +284,7 @@ class Xml {
 	/**
 	/**
 		Returns an `Iterator` on all the attribute names.
 		Returns an `Iterator` on all the attribute names.
 	**/
 	**/
-	public function attributes() : Iterator<String> {
+	public function attributes():Iterator<String> {
 		if (nodeType != Element) {
 		if (nodeType != Element) {
 			throw 'Bad node type, expected Element but found $nodeType';
 			throw 'Bad node type, expected Element but found $nodeType';
 		}
 		}
@@ -283,7 +295,7 @@ class Xml {
 		Returns an iterator of all child nodes.
 		Returns an iterator of all child nodes.
 		Only works if the current node is an Element or a Document.
 		Only works if the current node is an Element or a Document.
 	**/
 	**/
-	public #if !cppia inline #end function iterator() : Iterator<Xml> {
+	public #if !cppia inline #end function iterator():Iterator<Xml> {
 		ensureElementType();
 		ensureElementType();
 		return children.iterator();
 		return children.iterator();
 	}
 	}
@@ -292,7 +304,7 @@ class Xml {
 		Returns an iterator of all child nodes which are Elements.
 		Returns an iterator of all child nodes which are Elements.
 		Only works if the current node is an Element or a Document.
 		Only works if the current node is an Element or a Document.
 	**/
 	**/
-	public function elements() : Iterator<Xml> {
+	public function elements():Iterator<Xml> {
 		ensureElementType();
 		ensureElementType();
 		var ret = [for (child in children) if (child.nodeType == Element) child];
 		var ret = [for (child in children) if (child.nodeType == Element) child];
 		return ret.iterator();
 		return ret.iterator();
@@ -302,16 +314,19 @@ class Xml {
 		Returns an iterator of all child nodes which are Elements with the given nodeName.
 		Returns an iterator of all child nodes which are Elements with the given nodeName.
 		Only works if the current node is an Element or a Document.
 		Only works if the current node is an Element or a Document.
 	**/
 	**/
-	public function elementsNamed( name : String ) : Iterator<Xml> {
+	public function elementsNamed(name:String):Iterator<Xml> {
 		ensureElementType();
 		ensureElementType();
-		var ret = [for (child in children) if (child.nodeType == Element && child.nodeName == name) child];
+		var ret = [
+			for (child in children)
+				if (child.nodeType == Element && child.nodeName == name) child
+		];
 		return ret.iterator();
 		return ret.iterator();
 	}
 	}
 
 
 	/**
 	/**
 		Returns the first child node.
 		Returns the first child node.
 	**/
 	**/
-	public #if !cppia inline #end function firstChild() : Xml {
+	public #if !cppia inline #end function firstChild():Xml {
 		ensureElementType();
 		ensureElementType();
 		return children[0];
 		return children[0];
 	}
 	}
@@ -319,7 +334,7 @@ class Xml {
 	/**
 	/**
 		Returns the first child node which is an Element.
 		Returns the first child node which is an Element.
 	**/
 	**/
-	public function firstElement() : Xml {
+	public function firstElement():Xml {
 		ensureElementType();
 		ensureElementType();
 		for (child in children) {
 		for (child in children) {
 			if (child.nodeType == Element) {
 			if (child.nodeType == Element) {
@@ -335,7 +350,7 @@ class Xml {
 		If the child is already inside this Document or Element, it will be moved to the last position among the Document or Element's children.
 		If the child is already inside this Document or Element, it will be moved to the last position among the Document or Element's children.
 		If the child node was previously inside a different node, it will be moved to this Document or Element.
 		If the child node was previously inside a different node, it will be moved to this Document or Element.
 	**/
 	**/
-	public function addChild( x : Xml ) : Void {
+	public function addChild(x:Xml):Void {
 		ensureElementType();
 		ensureElementType();
 		if (x.parent != null) {
 		if (x.parent != null) {
 			x.parent.removeChild(x);
 			x.parent.removeChild(x);
@@ -348,7 +363,7 @@ class Xml {
 		Removes a child from the Document or Element.
 		Removes a child from the Document or Element.
 		Returns true if the child was successfuly removed.
 		Returns true if the child was successfuly removed.
 	**/
 	**/
-	public function removeChild( x : Xml ) : Bool {
+	public function removeChild(x:Xml):Bool {
 		ensureElementType();
 		ensureElementType();
 		if (children.remove(x)) {
 		if (children.remove(x)) {
 			x.parent = null;
 			x.parent = null;
@@ -363,7 +378,7 @@ class Xml {
 		If the child is already inside this Document or Element, it will be moved to the new position among the Document or Element's children.
 		If the child is already inside this Document or Element, it will be moved to the new position among the Document or Element's children.
 		If the child node was previously inside a different node, it will be moved to this Document or Element.
 		If the child node was previously inside a different node, it will be moved to this Document or Element.
 	**/
 	**/
-	public function insertChild( x : Xml, pos : Int ) : Void {
+	public function insertChild(x:Xml, pos:Int):Void {
 		ensureElementType();
 		ensureElementType();
 		if (x.parent != null) {
 		if (x.parent != null) {
 			x.parent.children.remove(x);
 			x.parent.children.remove(x);
@@ -375,7 +390,7 @@ class Xml {
 	/**
 	/**
 		Returns a String representation of the Xml node.
 		Returns a String representation of the Xml node.
 	**/
 	**/
-	public #if !cppia inline #end function toString() : String {
+	public #if !cppia inline #end function toString():String {
 		return haxe.xml.Printer.print(this);
 		return haxe.xml.Printer.print(this);
 	}
 	}
 
 

+ 8 - 9
std/cpp/ArrayBase.hx

@@ -19,14 +19,13 @@
  * 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 cpp;
 
 
-extern class ArrayBase
-{
-   // Length is number of elements
-   public var length(default,null):Int;
-   public function getElementSize():Int;
-   public function getByteCount():Int;
-   public function getBase():RawPointer<Char>;
-}
+package cpp;
 
 
+extern class ArrayBase {
+	// Length is number of elements
+	public var length(default, null):Int;
+	public function getElementSize():Int;
+	public function getByteCount():Int;
+	public function getBase():RawPointer<Char>;
+}

+ 38 - 12
std/cpp/AtomicInt.hx

@@ -1,18 +1,44 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 @:scalar @:coreType
 @:scalar @:coreType
-extern abstract AtomicInt from(Int) to(Int)
-{
-   // returns true if exchange took place
-   @:native("_hx_atomic_exchange_if")
-   public static function exchangeIf(ioValue:Pointer<AtomicInt>, test:Int, newVal:Int) : Bool;
+extern abstract AtomicInt from(Int) to(Int) {
+	/**
+		Returns true if exchange took place.
+	**/
+	@:native("_hx_atomic_exchange_if")
+	public static function exchangeIf(ioValue:Pointer<AtomicInt>, test:Int, newVal:Int):Bool;
 
 
-   // returns value before increment
-   @:native("_hx_atomic_inc")
-   public static function atomicInc(ioValue:Pointer<AtomicInt>) : Int;
+	/**
+		Returns value before increment.
+	**/
+	@:native("_hx_atomic_inc")
+	public static function atomicInc(ioValue:Pointer<AtomicInt>):Int;
 
 
-   // returns value before decrement
-   @:native("_hx_atomic_dec")
-   public static function atomicDec(ioValue:Pointer<AtomicInt>) : Int;
+	/**
+		Returns value before decrement.
+	**/
+	@:native("_hx_atomic_dec")
+	public static function atomicDec(ioValue:Pointer<AtomicInt>):Int;
 }
 }
-

+ 2 - 1
std/cpp/AutoCast.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
 package cpp;
 
 
-extern class AutoCast { }
+extern class AutoCast {}

+ 44 - 30
std/cpp/Callable.hx

@@ -19,40 +19,54 @@
  * 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 cpp;
 
 
+package cpp;
 
 
 @:noPackageRestrict @:callable
 @:noPackageRestrict @:callable
 typedef CallableData<T> = T;
 typedef CallableData<T> = T;
 
 
-// The generator intercepts this type and converts it to a cpp.Function<T> on cpp
-@:noPackageRestrict @:callable
-#if cpp extern #end
-abstract Callable<T>( CallableData<T> )
-{
-   inline public function new(inValue:T) this = inValue;
-   public var call(get,never):CallableData<T>;
-   inline function get_call():CallableData<T> return this;
-
-   #if cpp
-   @:from
-   inline static public function fromFunction<F>( func:Function<F,cpp.abi.Abi> ) : Callable<F>
-       return new Callable<F>(cast func);
-   @:to
-   inline public function toFunction() : Function<T,cpp.abi.Abi> return cast this;
-
-
-   inline public static function getProcAddress<T,ABI:cpp.abi.Abi>(inModule:String, inFunction:String) : Function<T,ABI>
-      return Function.getProcAddress(inModule, inFunction);
-
-   inline public static function fromStaticFunction<T>(inStaticFunction:T) : Callable<T>
-      return Function.fromStaticFunction(inStaticFunction);
-
-   inline public function lt(inOther:Callable<T>):Bool return toFunction().lt(inOther.toFunction());
-   inline public function leq(inOther:Callable<T>):Bool return toFunction().leq(inOther.toFunction());
-   inline public function gt(inOther:Callable<T>):Bool return toFunction().gt(inOther.toFunction());
-   inline public function geq(inOther:Callable<T>):Bool return toFunction().geq(inOther.toFunction());
-   #end
-}
+/**
+	The generator intercepts this type and converts it to a cpp.Function<T> on cpp.
+**/
+@:noPackageRestrict
+@:callable
+#if cpp
+extern
+#end
+abstract Callable<T>(CallableData<T>) {
+	inline public function new(inValue:T)
+		this = inValue;
+
+	public var call(get, never):CallableData<T>;
+
+	inline function get_call():CallableData<T>
+		return this;
+
+	#if cpp
+	@:from
+	inline static public function fromFunction<F>(func:Function<F, cpp.abi.Abi>):Callable<F>
+		return new Callable<F>(cast func);
 
 
+	@:to
+	inline public function toFunction():Function<T, cpp.abi.Abi>
+		return cast this;
 
 
+	inline public static function getProcAddress<T, ABI:cpp.abi.Abi>(inModule:String, inFunction:String):Function<T, ABI>
+		return Function.getProcAddress(inModule, inFunction);
+
+	inline public static function fromStaticFunction<T>(inStaticFunction:T):Callable<T>
+		return Function.fromStaticFunction(inStaticFunction);
+
+	inline public function lt(inOther:Callable<T>):Bool
+		return toFunction().lt(inOther.toFunction());
+
+	inline public function leq(inOther:Callable<T>):Bool
+		return toFunction().leq(inOther.toFunction());
+
+	inline public function gt(inOther:Callable<T>):Bool
+		return toFunction().gt(inOther.toFunction());
+
+	inline public function geq(inOther:Callable<T>):Bool
+		return toFunction().geq(inOther.toFunction());
+	#end
+}

+ 11 - 9
std/cpp/CastCharStar.hx

@@ -19,16 +19,18 @@
  * 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 cpp;
 
 
-abstract CastCharStar( RawPointer<Char> ) to(RawPointer<Char>)
-{
-   inline function new(s:String) this = cast untyped s.__s;
+package cpp;
 
 
-   @:from
-   static public inline function fromString(s:String) return new CastCharStar(s);
+abstract CastCharStar(RawPointer<Char>) to(RawPointer<Char>) {
+	inline function new(s:String)
+		this = cast untyped s.__s;
 
 
-    @:to
-    public inline function toPointer() return this;
-}
+	@:from
+	static public inline function fromString(s:String)
+		return new CastCharStar(s);
 
 
+	@:to
+	public inline function toPointer()
+		return this;
+}

+ 2 - 1
std/cpp/Char.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract Char from Int to Int {}
 @:coreType @:notNull @:runtimeValue abstract Char from Int to Int {}

+ 12 - 11
std/cpp/ConstCharStar.hx

@@ -19,19 +19,20 @@
  * 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 cpp;
 
 
-extern abstract ConstCharStar( RawConstPointer<Char> ) to(RawConstPointer<Char>)
-{
-   inline function new(s:String) this = untyped s.__s;
+package cpp;
 
 
-   @:from
-   static public inline function fromString(s:String):ConstCharStar return new ConstCharStar(s);
+extern abstract ConstCharStar(RawConstPointer<Char>) to(RawConstPointer<Char>) {
+	inline function new(s:String)
+		this = untyped s.__s;
 
 
-   @:to extern
-   public inline function toString():String return new String(untyped this);
+	@:from
+	static public inline function fromString(s:String):ConstCharStar
+		return new ConstCharStar(s);
 
 
-    @:to extern
-    public inline function toPointer():RawConstPointer<Char> return this;
-}
+	@:to extern public inline function toString():String
+		return new String(untyped this);
 
 
+	@:to extern public inline function toPointer():RawConstPointer<Char>
+		return this;
+}

+ 31 - 34
std/cpp/ConstPointer.hx

@@ -19,54 +19,51 @@
  * 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 cpp;
 
 
-@:coreType @:include("cpp/Pointer.h") @:native("cpp.Pointer") @:semantics(variable)
-extern class ConstPointer<T>
-{
-   // ptr actually returns the pointer - not strictly a 'T' - for pointers to smart pointers
-   // Use value or ref to get dereferenced value
-   public var ptr:Star<T>;
-
-   public var value(get,never):T;
+package cpp;
 
 
-   // Typecast to non-const
-   public var raw(get,never):RawPointer<T>;
+@:coreType @:include("cpp/Pointer.h") @:native("cpp.Pointer") @:semantics(variable)
+extern class ConstPointer<T> {
+	// ptr actually returns the pointer - not strictly a 'T' - for pointers to smart pointers
+	// Use value or ref to get dereferenced value
+	public var ptr:Star<T>;
 
 
-   // const version
-   public var constRaw(get,never):RawConstPointer<T>;
+	public var value(get, never):T;
 
 
-   public function get_value() : Reference<T>;
+	// Typecast to non-const
+	public var raw(get, never):RawPointer<T>;
 
 
-   public function get_constRaw() : RawConstPointer<T>;
-   public function get_raw() : RawPointer<T>;
+	// const version
+	public var constRaw(get, never):RawConstPointer<T>;
 
 
+	public function get_value():Reference<T>;
 
 
-   public function lt(inOther:ConstPointer<T>):Bool;
-   public function leq(inOther:ConstPointer<T>):Bool;
-   public function gt(inOther:ConstPointer<T>):Bool;
-   public function geq(inOther:ConstPointer<T>):Bool;
+	public function get_constRaw():RawConstPointer<T>;
+	public function get_raw():RawPointer<T>;
 
 
-   public function setRaw<O>(ptr:RawPointer<O>) : Void;
+	public function lt(inOther:ConstPointer<T>):Bool;
+	public function leq(inOther:ConstPointer<T>):Bool;
+	public function gt(inOther:ConstPointer<T>):Bool;
+	public function geq(inOther:ConstPointer<T>):Bool;
 
 
-   public static function fromRaw<T>(ptr:RawConstPointer<T>) : ConstPointer<T>;
+	public function setRaw<O>(ptr:RawPointer<O>):Void;
 
 
-   @:native("::cpp::Pointer_obj::fromRaw")
-   public static function fromStar<T>(star:Star<T>) : ConstPointer<T>;
+	public static function fromRaw<T>(ptr:RawConstPointer<T>):ConstPointer<T>;
 
 
-   public static function fromPointer<T>(inNativePointer:Dynamic) : ConstPointer<T>;
+	@:native("::cpp::Pointer_obj::fromRaw")
+	public static function fromStar<T>(star:Star<T>):ConstPointer<T>;
 
 
-   public function reinterpret<Other>():Pointer<Other>;
+	public static function fromPointer<T>(inNativePointer:Dynamic):ConstPointer<T>;
 
 
-   public function rawCast<Other>():RawPointer<Other>;
+	public function reinterpret<Other>():Pointer<Other>;
 
 
-   public function at(inIndex:Int):Reference<T>;
+	public function rawCast<Other>():RawPointer<Other>;
 
 
-   public function inc():ConstPointer<T>;
-   public function dec():ConstPointer<T>;
-   public function postIncVal():Reference<T>;
-   public function incBy(inT:Int):ConstPointer<T>;
-   public function add(inT:Int):ConstPointer<T>;
+	public function at(inIndex:Int):Reference<T>;
 
 
+	public function inc():ConstPointer<T>;
+	public function dec():ConstPointer<T>;
+	public function postIncVal():Reference<T>;
+	public function incBy(inT:Int):ConstPointer<T>;
+	public function add(inT:Int):ConstPointer<T>;
 }
 }
-

+ 5 - 3
std/cpp/ConstStar.hx

@@ -19,9 +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 cpp;
 package cpp;
 
 
-// Allows haxe to type result correctly, and hxcpp can recognise this use the correct type
+/**
+	Allows haxe to type the result correctly, and hxcpp can recognise this uses
+	the correct type.
+**/
 typedef ConstStar<T> = Null<T>;
 typedef ConstStar<T> = Null<T>;
-
-

+ 54 - 25
std/cpp/EnumBase.hx

@@ -1,31 +1,60 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 @:native("hx.EnumBase")
 @:native("hx.EnumBase")
-extern class EnumBase
-{
-   #if (hxcpp_api_level >= 330)
-   public function _hx_getIndex():Int;
-   public function _hx_getTag():String;
-   public function _hx_getParamCount():Int;
-   public function _hx_getParamI(inIndex:Int):Dynamic;
-   public function _hx_getParameters():Array<Dynamic>;
-
-   inline public function getIndex():Int return _hx_getIndex();
-   inline public function getTag():String return _hx_getTag();
-   inline public function getParamCount():Int return _hx_getParamCount();
-   inline public function getParamI(inIndex:Int):Dynamic return _hx_getParamI(inIndex);
-   inline public function getParameters():Array<Dynamic> return _hx_getParameters();
-   #else
-   public function __EnumParams():Array<Dynamic>;
-   public function __Tag():String;
-   public function __Index():Int;
+extern class EnumBase {
+	#if (hxcpp_api_level >= 330)
+	public function _hx_getIndex():Int;
+	public function _hx_getTag():String;
+	public function _hx_getParamCount():Int;
+	public function _hx_getParamI(inIndex:Int):Dynamic;
+	public function _hx_getParameters():Array<Dynamic>;
 
 
-   inline public function _hx_getIndex():Int  return untyped __Index();
-   inline public function _hx_getTag():String  return untyped __Tag();
-   inline public function _hx_getParamCount():Int return untyped __EnumParams()==null ? 0 : __EnumParams().length;
-   inline public function _hx_getParamI(inIndex:Int):Dynamic return untyped __EnumParams()[inIndex];
-   inline public function _hx_getParameters():Array<Dynamic> return __EnumParams()==null ? [] : __EnumParams();
+	inline public function getIndex():Int
+		return _hx_getIndex();
+	inline public function getTag():String
+		return _hx_getTag();
+	inline public function getParamCount():Int
+		return _hx_getParamCount();
+	inline public function getParamI(inIndex:Int):Dynamic
+		return _hx_getParamI(inIndex);
+	inline public function getParameters():Array<Dynamic>
+		return _hx_getParameters();
+	#else
+	public function __EnumParams():Array<Dynamic>;
+	public function __Tag():String;
+	public function __Index():Int;
 
 
-   #end
+	inline public function _hx_getIndex():Int
+		return untyped __Index();
+	inline public function _hx_getTag():String
+		return untyped __Tag();
+	inline public function _hx_getParamCount():Int
+		return untyped __EnumParams() == null ? 0 : __EnumParams().length;
+	inline public function _hx_getParamI(inIndex:Int):Dynamic
+		return untyped __EnumParams()[inIndex];
+	inline public function _hx_getParameters():Array<Dynamic>
+		return __EnumParams() == null ? [] : __EnumParams();
+	#end
 }
 }
-

+ 11 - 13
std/cpp/ErrorConstants.hx

@@ -22,21 +22,19 @@
 
 
 package cpp;
 package cpp;
 
 
-extern class ErrorConstants
-{
-   @:native("HX_INVALID_CAST")
-   public static var invalidCast:Dynamic;
+extern class ErrorConstants {
+	@:native("HX_INVALID_CAST")
+	public static var invalidCast:Dynamic;
 
 
-   @:native("HX_INDEX_OUT_OF_BOUNDS")
-   public static var indexOutOfBounds:Dynamic;
+	@:native("HX_INDEX_OUT_OF_BOUNDS")
+	public static var indexOutOfBounds:Dynamic;
 
 
-   @:native("HX_INVALID_OBJECT")
-   public static var invalidObject:Dynamic;
+	@:native("HX_INVALID_OBJECT")
+	public static var invalidObject:Dynamic;
 
 
-   @:native("HX_INVALID_ARG_COUNT")
-   public static var invalidArgCount:Dynamic;
+	@:native("HX_INVALID_ARG_COUNT")
+	public static var invalidArgCount:Dynamic;
 
 
-   @:native("HX_NULL_FUNCTION_POINTER")
-   public static var nullFunctionPointer:Dynamic;
+	@:native("HX_NULL_FUNCTION_POINTER")
+	public static var nullFunctionPointer:Dynamic;
 }
 }
-

+ 1 - 2
std/cpp/FILE.hx

@@ -24,5 +24,4 @@ package cpp;
 
 
 @:include("stdio.h")
 @:include("stdio.h")
 @:native(" ::cpp::Pointer<FILE>")
 @:native(" ::cpp::Pointer<FILE>")
-extern class FILE { }
-
+extern class FILE {}

+ 2 - 3
std/cpp/FastIterator.hx

@@ -19,11 +19,10 @@
  * 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 cpp;
 package cpp;
 
 
-extern class FastIterator<T>
-{
+extern class FastIterator<T> {
 	public function hasNext():Bool;
 	public function hasNext():Bool;
 	public function next():T;
 	public function next():T;
 }
 }
-

+ 32 - 10
std/cpp/Finalizable.hx

@@ -1,14 +1,36 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
-// This is just a helper class.  You do not actually need to inherit from this to use
-//  NativeGc.addFinalizable(this,inPin), you just need a function called "finalize"
-class Finalizable
-{
-   public function new(inPin = false)
-   {
-      NativeGc.addFinalizable(this,inPin);
-   }
+/**
+	This is just a helper class. It is not actually required to inherit from this
+	to use `NativeGc.addFinalizable(this,inPin)`, only a function called
+	`finalize` is needed.
+**/
+class Finalizable {
+	public function new(inPin = false) {
+		NativeGc.addFinalizable(this, inPin);
+	}
 
 
-   public function finalize():Void { }
+	public function finalize():Void {}
 }
 }
-

+ 2 - 1
std/cpp/Float32.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract Float32 from Float to Float {}
 @:coreType @:notNull @:runtimeValue abstract Float32 from Float to Float {}

+ 2 - 1
std/cpp/Float64.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract Float64 from Float to Float {}
 @:coreType @:notNull @:runtimeValue abstract Float64 from Float to Float {}

+ 31 - 30
std/cpp/Function.hx

@@ -19,41 +19,42 @@
  * 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 cpp;
 package cpp;
 
 
 @:callable
 @:callable
-typedef FunctionData<T,ABI> = T;
-
+typedef FunctionData<T, ABI> = T;
 
 
 @:include("cpp/Pointer.h") @:callable
 @:include("cpp/Pointer.h") @:callable
-extern abstract Function<T, ABI:cpp.abi.Abi>( FunctionData<T,ABI> )
-{
-   inline public function new(inValue:T) this = inValue;
-
-   // Legacy Api
-   public var call(get,never):FunctionData<T,ABI>;
-   inline function get_call():FunctionData<T,ABI> return this;
-
-
-   @:native("::cpp::Function_obj::getProcAddress")
-   extern static function nativeGetProcAddress<T,ABI:cpp.abi.Abi>(inModule:String, inFunction:String) : AutoCast;
-   inline public static function getProcAddress<T,ABI:cpp.abi.Abi>(inModule:String, inFunction:String) : Function<T,ABI>
-   {
-      return cast nativeGetProcAddress(inModule, inFunction);
-   }
-
-   @:native("::cpp::Function_obj::fromStaticFunction")
-   extern static function nativeFromStaticFunction<T>(inStaticFunction:T) : AutoCast;
-   inline public static function fromStaticFunction<T>(inStaticFunction:T) : Callable<T>
-   {
-      return cast nativeFromStaticFunction(inStaticFunction);
-   }
-
-	extern public function lt(inOther:Function<T,ABI>):Bool;
-	extern public function leq(inOther:Function<T,ABI>):Bool;
-	extern public function gt(inOther:Function<T,ABI>):Bool;
-	extern public function geq(inOther:Function<T,ABI>):Bool;
-}
+extern abstract Function<T, ABI:cpp.abi.Abi>(FunctionData<T, ABI>) {
+	inline public function new(inValue:T)
+		this = inValue;
+
+	// Legacy Api
+	public var call(get, never):FunctionData<T, ABI>;
+
+	inline function get_call():FunctionData<T, ABI>
+		return this;
+
+	@:native("::cpp::Function_obj::getProcAddress")
+	extern static function nativeGetProcAddress<T, ABI:cpp.abi.Abi>(inModule:String, inFunction:String):AutoCast;
 
 
+	inline public static function getProcAddress<T, ABI:cpp.abi.Abi>(inModule:String, inFunction:String):Function<T, ABI> {
+		return cast nativeGetProcAddress(inModule, inFunction);
+	}
 
 
+	@:native("::cpp::Function_obj::fromStaticFunction")
+	extern static function nativeFromStaticFunction<T>(inStaticFunction:T):AutoCast;
 
 
+	inline public static function fromStaticFunction<T>(inStaticFunction:T):Callable<T> {
+		return cast nativeFromStaticFunction(inStaticFunction);
+	}
+
+	extern public function lt(inOther:Function<T, ABI>):Bool;
+
+	extern public function leq(inOther:Function<T, ABI>):Bool;
+
+	extern public function gt(inOther:Function<T, ABI>):Bool;
+
+	extern public function geq(inOther:Function<T, ABI>):Bool;
+}

+ 2 - 1
std/cpp/Int16.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract Int16 from Int to Int {}
 @:coreType @:notNull @:runtimeValue abstract Int16 from Int to Int {}

+ 2 - 1
std/cpp/Int32.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract Int32 from Int to Int {}
 @:coreType @:notNull @:runtimeValue abstract Int32 from Int to Int {}

+ 2 - 1
std/cpp/Int64.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract Int64 from Int to Int {}
 @:coreType @:notNull @:runtimeValue abstract Int64 from Int to Int {}

+ 2 - 1
std/cpp/Int8.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract Int8 from Int to Int {}
 @:coreType @:notNull @:runtimeValue abstract Int8 from Int to Int {}

+ 35 - 38
std/cpp/Lib.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
 package cpp;
 
 
 /**
 /**
@@ -27,15 +28,14 @@ package cpp;
 	and vice-versa.
 	and vice-versa.
 **/
 **/
 class Lib {
 class Lib {
-
 	/**
 	/**
 		Load and return a Cpp primitive from a DLL library.
 		Load and return a Cpp primitive from a DLL library.
 	**/
 	**/
-	public static function load( lib : String, prim : String, nargs : Int ) : Dynamic {
+	public static function load(lib:String, prim:String, nargs:Int):Dynamic {
 		#if (iphone || emscripten)
 		#if (iphone || emscripten)
-		return loadLazy(lib,prim,nargs);
+		return loadLazy(lib, prim, nargs);
 		#else
 		#else
-		return untyped __global__.__loadprim(lib,prim,nargs);
+		return untyped __global__.__loadprim(lib, prim, nargs);
 		#end
 		#end
 	}
 	}
 
 
@@ -43,40 +43,37 @@ class Lib {
 		Unloaded all dynamic libraries in reverse order of loading.
 		Unloaded all dynamic libraries in reverse order of loading.
 		Returns the number of libraries unloaded.
 		Returns the number of libraries unloaded.
 	**/
 	**/
-	public static function unloadAllLibraries() : Int {
+	public static function unloadAllLibraries():Int {
 		return untyped __global__.__hxcpp_unload_all_libraries();
 		return untyped __global__.__hxcpp_unload_all_libraries();
 	}
 	}
 
 
-	public static function _loadPrime( lib : String, prim : String, signature : String, quietFail = false ) : Dynamic {
-		var factory:Callable< ConstCharStar -> Object > =
-		untyped __global__.__hxcpp_cast_get_proc_address(lib, prim + "__prime", quietFail);
-		if (factory!=null)
-		{
+	public static function _loadPrime(lib:String, prim:String, signature:String, quietFail = false):Dynamic {
+		var factory:Callable<ConstCharStar->Object> = untyped __global__.__hxcpp_cast_get_proc_address(lib, prim + "__prime", quietFail);
+		if (factory != null) {
 			var func:Dynamic = factory.call(signature);
 			var func:Dynamic = factory.call(signature);
-			if (func==null && !quietFail)
+			if (func == null && !quietFail)
 				throw '$prim does not have signature $signature';
 				throw '$prim does not have signature $signature';
 			return func;
 			return func;
 		}
 		}
 		return null;
 		return null;
 	}
 	}
 
 
-
 	/**
 	/**
 		Tries to load, and always returns a valid function, but the function may throw
 		Tries to load, and always returns a valid function, but the function may throw
 		if called.
 		if called.
 	**/
 	**/
-	public static function loadLazy(lib:String, prim:String, nargs:Int) : Dynamic {
+	public static function loadLazy(lib:String, prim:String, nargs:Int):Dynamic {
 		try {
 		try {
-			return untyped __global__.__loadprim(lib,prim,nargs);
-		} catch( e : Dynamic ) {
-			switch(nargs) {
-			case 0 : return function() { throw e; };
-			case 2 : return function(_1,_2) { throw e; };
-			case 3 : return function(_1,_2,_3) { throw e; };
-			case 4 : return function(_1,_2,_3,_4) { throw e; };
-			case 5 : return function(_1,_2,_3,_4,_5) { throw e; };
-			default : return function(_1) { throw e; };
-			}
+			return untyped __global__.__loadprim(lib, prim, nargs);
+		} catch (e:Dynamic) {
+			return switch (nargs) {
+				case 0: () -> throw e;
+				case 2: (_, _) -> throw e;
+				case 3: (_, _, _) -> throw e;
+				case 4: (_, _, _, _) -> throw e;
+				case 5: (_, _, _, _, _) -> throw e;
+				default: _ -> throw e;
+			};
 		}
 		}
 		return null;
 		return null;
 	}
 	}
@@ -84,23 +81,24 @@ class Lib {
 	@:noDebug @:native("HX_STACK_DO_RETHROW")
 	@:noDebug @:native("HX_STACK_DO_RETHROW")
 	extern static function do_rethrow(inExp:Dynamic);
 	extern static function do_rethrow(inExp:Dynamic);
 
 
-	@:noDebug #if(!cppia) inline #end
-	public static function rethrow(inExp:Dynamic) { do_rethrow(inExp); }
+	@:noDebug #if (!cppia) inline #end
+	public static function rethrow(inExp:Dynamic) {
+		do_rethrow(inExp);
+	}
 
 
-	public static function stringReference(inBytes:haxe.io.Bytes) : String
-	{
+	public static function stringReference(inBytes:haxe.io.Bytes):String {
 		var result:String = "";
 		var result:String = "";
 		untyped __global__.__hxcpp_string_of_bytes(inBytes.b, result, 0, 0, true);
 		untyped __global__.__hxcpp_string_of_bytes(inBytes.b, result, 0, 0, true);
 		return result;
 		return result;
 	}
 	}
 
 
-	public static function pushDllSearchPath(inPath:String) : Void
+	public static function pushDllSearchPath(inPath:String):Void
 		untyped __global__.__hxcpp_push_dll_path(inPath);
 		untyped __global__.__hxcpp_push_dll_path(inPath);
 
 
-	public static function getDllExtension() : String
+	public static function getDllExtension():String
 		return untyped __global__.__hxcpp_get_dll_extension();
 		return untyped __global__.__hxcpp_get_dll_extension();
 
 
-	public static function getBinDirectory() : String
+	public static function getBinDirectory():String
 		return untyped __global__.__hxcpp_get_bin_dir();
 		return untyped __global__.__hxcpp_get_bin_dir();
 
 
 	/**
 	/**
@@ -109,7 +107,7 @@ class Lib {
 		Changing one string can cause others to change unexpectedly.
 		Changing one string can cause others to change unexpectedly.
 		Only really safe if you are using it read-only or if it comes from stringReference above
 		Only really safe if you are using it read-only or if it comes from stringReference above
 	**/
 	**/
-	public inline static function bytesReference( s : String ) : haxe.io.Bytes {
+	public inline static function bytesReference(s:String):haxe.io.Bytes {
 		var bytes = new haxe.io.BytesData();
 		var bytes = new haxe.io.BytesData();
 		untyped bytes.__unsafeStringReference(s);
 		untyped bytes.__unsafeStringReference(s);
 		return haxe.io.Bytes.ofData(bytes);
 		return haxe.io.Bytes.ofData(bytes);
@@ -118,7 +116,7 @@ class Lib {
 	/**
 	/**
 		Print the specified value on the default output.
 		Print the specified value on the default output.
 	**/
 	**/
-	public static function print( v : Dynamic ) : Void {
+	public static function print(v:Dynamic):Void {
 		untyped __global__.__hxcpp_print(v);
 		untyped __global__.__hxcpp_print(v);
 	}
 	}
 
 
@@ -126,7 +124,7 @@ class Lib {
 		This function is used to make porting from neko to cpp easy.
 		This function is used to make porting from neko to cpp easy.
 		It does not need to do anything because the c-code can work with any Dynamic
 		It does not need to do anything because the c-code can work with any Dynamic
 	**/
 	**/
-	public static function haxeToNeko( v : Dynamic ) : Dynamic {
+	public static function haxeToNeko(v:Dynamic):Dynamic {
 		return v;
 		return v;
 	}
 	}
 
 
@@ -134,19 +132,18 @@ class Lib {
 		This function is used to make porting from neko to cpp easy.
 		This function is used to make porting from neko to cpp easy.
 		It does not need to do anything because the c-code can work with any Dynamic
 		It does not need to do anything because the c-code can work with any Dynamic
 	**/
 	**/
-	public static function nekoToHaxe( v : Dynamic ) : Dynamic {
+	public static function nekoToHaxe(v:Dynamic):Dynamic {
 		return v;
 		return v;
 	}
 	}
+
 	/**
 	/**
 		Print the specified value on the default output followed by a newline character.
 		Print the specified value on the default output followed by a newline character.
 	**/
 	**/
-	public static function println( v : Dynamic ) : Void {
+	public static function println(v:Dynamic):Void {
 		untyped __global__.__hxcpp_println(v);
 		untyped __global__.__hxcpp_println(v);
 	}
 	}
 
 
-	public static function setFloatFormat(inFormat:String):Void
-	{
+	public static function setFloatFormat(inFormat:String):Void {
 		untyped __global__.__hxcpp_set_float_format(inFormat);
 		untyped __global__.__hxcpp_set_float_format(inFormat);
 	}
 	}
-
 }
 }

+ 77 - 89
std/cpp/Native.hx

@@ -23,93 +23,81 @@
 package cpp;
 package cpp;
 
 
 @:include("stdlib.h")
 @:include("stdlib.h")
-extern class Native
-{
-   @:native("malloc")
-   public static function nativeMalloc(bytes:Int) : cpp.Star<cpp.Void>;
-   @:native("calloc")
-   public static function nativeCalloc(bytes:Int) : cpp.Star<cpp.Void>;
-   @:native("realloc")
-   public static function nativeRealloc(inPtr:cpp.Star<cpp.Void>,bytes:Int) : cpp.RawPointer<cpp.Void>;
-   @:native("free")
-   public static function nativeFree(ptr:cpp.Star<cpp.Void>) : Void;
-   @:native("memcpy")
-   public static function nativeMemcpy(dest:cpp.Star<cpp.Void>, src:cpp.Star<cpp.Void>, bytes:Int) : Void;
-
-   @:native("hx::ClassSizeOf") @:templatedCall
-   public static function sizeof<T>(t:T) : Int;
-
-   #if !cppia
-   @:native("hx::Dereference")
-   public static function star<T>(ptr:cpp.Star<T>) : cpp.Reference<T>;
-
-   @:generic
-   public static inline function set<T>(ptr:cpp.Star<T>,value:T) : Void
-   {
-      var ref: cpp.Reference<T> = star(ptr);
-      ref = value;
-   }
-   @:generic
-   public static inline function get<T>(ptr:cpp.Star<T>) : T
-   {
-      var ref: cpp.Reference<T> = star(ptr);
-      return ref;
-   }
-
-   @:generic
-   public static inline function memcpy<DEST,SRC>(dest:cpp.Star<DEST>, src:cpp.Star<SRC>, bytes:Int) : Void
-      nativeMemcpy(cast dest,cast src, bytes);
-
-   @:generic
-   public static inline function malloc<T>(bytes:Int) : cpp.Star<T>
-      return cast nativeMalloc(bytes);
-
-   @:generic
-   public static inline function calloc<T>(bytes:Int) : cpp.Star<T>
-      return cast nativeCalloc(bytes);
-
-   @:generic
-   public static inline function realloc<T>(ioPtr:cpp.Star<T>, bytes:Int) : cpp.Star<T>
-      return cast nativeRealloc(cast ioPtr, bytes);
-
-   @:generic
-   public static inline function free<T>(ptr:cpp.Star<T>) : Void
-   {
-      if (ptr!=null)
-         nativeFree(cast ptr);
-   }
-
-   @:native("hx::StarOf")
-   public static function addressOf<T>(inVariable:Reference<T>) : Star<T>;
-
-   #else
-
-   public static inline function addressOf<T>(inVariable:Reference<T>) : Star<T>
-   {
-      throw "Native.addressOf not available in cppia";
-   }
-   public static inline function star<T>(ptr:cpp.Star<T>) : cpp.Reference<T>
-   {
-      throw "Native.star not available in cppia";
-   }
-
-   public static inline function set<T>(ptr:cpp.Star<T>,value:T) : Void
-   {
-      throw "Native.set not available in cppia";
-   }
-   public static inline function get<T>(ptr:cpp.Star<T>) : T
-   {
-      throw "Native.get not available in cppia";
-      var d:Dynamic = null;
-      return d;
-   }
-
-   public static function memcpy<DEST,SRC>(dest:cpp.Star<DEST>, src:cpp.Star<SRC>, bytes:Int) : Void;
-   public static function malloc<T>(bytes:Int) : cpp.Star<T>;
-   public static function calloc<T>(bytes:Int) : cpp.Star<T>;
-   public static function realloc<T>(ioPtr:cpp.Star<T>, bytes:Int) : cpp.Star<T>;
-   public static function free<T>(ptr:cpp.Star<T>) : Void;
-   #end
-
+extern class Native {
+	@:native("malloc")
+	public static function nativeMalloc(bytes:Int):cpp.Star<cpp.Void>;
+	@:native("calloc")
+	public static function nativeCalloc(bytes:Int):cpp.Star<cpp.Void>;
+	@:native("realloc")
+	public static function nativeRealloc(inPtr:cpp.Star<cpp.Void>, bytes:Int):cpp.RawPointer<cpp.Void>;
+	@:native("free")
+	public static function nativeFree(ptr:cpp.Star<cpp.Void>):Void;
+	@:native("memcpy")
+	public static function nativeMemcpy(dest:cpp.Star<cpp.Void>, src:cpp.Star<cpp.Void>, bytes:Int):Void;
+
+	@:native("hx::ClassSizeOf") @:templatedCall
+	public static function sizeof<T>(t:T):Int;
+
+	#if !cppia
+	@:native("hx::Dereference")
+	public static function star<T>(ptr:cpp.Star<T>):cpp.Reference<T>;
+
+	@:generic
+	public static inline function set<T>(ptr:cpp.Star<T>, value:T):Void {
+		var ref:cpp.Reference<T> = star(ptr);
+		ref = value;
+	}
+	@:generic
+	public static inline function get<T>(ptr:cpp.Star<T>):T {
+		var ref:cpp.Reference<T> = star(ptr);
+		return ref;
+	}
+
+	@:generic
+	public static inline function memcpy<DEST, SRC>(dest:cpp.Star<DEST>, src:cpp.Star<SRC>, bytes:Int):Void
+		nativeMemcpy(cast dest, cast src, bytes);
+
+	@:generic
+	public static inline function malloc<T>(bytes:Int):cpp.Star<T>
+		return cast nativeMalloc(bytes);
+
+	@:generic
+	public static inline function calloc<T>(bytes:Int):cpp.Star<T>
+		return cast nativeCalloc(bytes);
+
+	@:generic
+	public static inline function realloc<T>(ioPtr:cpp.Star<T>, bytes:Int):cpp.Star<T>
+		return cast nativeRealloc(cast ioPtr, bytes);
+
+	@:generic
+	public static inline function free<T>(ptr:cpp.Star<T>):Void {
+		if (ptr != null)
+			nativeFree(cast ptr);
+	}
+
+	@:native("hx::StarOf")
+	public static function addressOf<T>(inVariable:Reference<T>):Star<T>;
+	#else
+	public static inline function addressOf<T>(inVariable:Reference<T>):Star<T> {
+		throw "Native.addressOf not available in cppia";
+	}
+	public static inline function star<T>(ptr:cpp.Star<T>):cpp.Reference<T> {
+		throw "Native.star not available in cppia";
+	}
+
+	public static inline function set<T>(ptr:cpp.Star<T>, value:T):Void {
+		throw "Native.set not available in cppia";
+	}
+	public static inline function get<T>(ptr:cpp.Star<T>):T {
+		throw "Native.get not available in cppia";
+		var d:Dynamic = null;
+		return d;
+	}
+
+	public static function memcpy<DEST, SRC>(dest:cpp.Star<DEST>, src:cpp.Star<SRC>, bytes:Int):Void;
+	public static function malloc<T>(bytes:Int):cpp.Star<T>;
+	public static function calloc<T>(bytes:Int):cpp.Star<T>;
+	public static function realloc<T>(ioPtr:cpp.Star<T>, bytes:Int):cpp.Star<T>;
+	public static function free<T>(ptr:cpp.Star<T>):Void;
+	#end
 }
 }
-

+ 27 - 8
std/cpp/NativeArc.hx

@@ -1,12 +1,31 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
-extern class NativeArc
-{
-   @:native("(__bridge_transfer id)")
-   public static function _bridgeTransfer<T>(ptr:cpp.RawPointer<cpp.Void> ):cpp.RawPointer<T>;
+extern class NativeArc {
+	@:native("(__bridge_transfer id)")
+	public static function _bridgeTransfer<T>(ptr:cpp.RawPointer<cpp.Void>):cpp.RawPointer<T>;
 
 
-   public static inline function bridgeTransfer<T>(ptr:cpp.RawPointer<cpp.Void> ):T return cast _bridgeTransfer(ptr);
+	public static inline function bridgeTransfer<T>(ptr:cpp.RawPointer<cpp.Void>):T
+		return cast _bridgeTransfer(ptr);
 }
 }
-
-
-

+ 51 - 59
std/cpp/NativeArray.hx

@@ -19,87 +19,79 @@
  * 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 cpp;
 
 
-extern class NativeArray {
-
-   #if cppia
-   public static inline function create<T>(length:Int):Array<T>
-   {
-      var result = new Array<T>();
-      NativeArray.setSize(result,length);
-      return result;
-   }
-
-   #else
+package cpp;
 
 
-   @:native("_hx_create_array_length")
-   public static function create<T>(length:Int):Array<T>;
-   #end
+extern class NativeArray {
+	#if cppia
+	public static inline function create<T>(length:Int):Array<T> {
+		var result = new Array<T>();
+		NativeArray.setSize(result, length);
+		return result;
+	}
+	#else
+	@:native("_hx_create_array_length")
+	public static function create<T>(length:Int):Array<T>;
+	#end
 
 
-   public static inline function blit<T>( ioDestArray:Array<T>,
-		inDestElement:Int, inSourceArray:Array<T>,
-		inSourceElement:Int, inElementCount:Int ): Void  {
-	untyped ioDestArray.blit(inDestElement, inSourceArray, inSourceElement, inElementCount);
+	public static inline function blit<T>(ioDestArray:Array<T>, inDestElement:Int, inSourceArray:Array<T>, inSourceElement:Int, inElementCount:Int):Void {
+		untyped ioDestArray.blit(inDestElement, inSourceArray, inSourceElement, inElementCount);
 	};
 	};
 
 
-	public static inline function getBase( inArray:Array<Dynamic> ) : ArrayBase {
-      return untyped inArray;
-   }
-
-   @:nativeStaticExtension
-	public static function reserve<T>( inArray:Array<T>,inElements:Int ) : Void;
+	public static inline function getBase(inArray:Array<Dynamic>):ArrayBase {
+		return untyped inArray;
+	}
 
 
-   @:nativeStaticExtension
-	public static function capacity<T>( inArray:Array<T> ) : Int;
+	@:nativeStaticExtension
+	public static function reserve<T>(inArray:Array<T>, inElements:Int):Void;
 
 
-   @:nativeStaticExtension
-	public static function getElementSize<T>( inArray:Array<T> ) : Int;
+	@:nativeStaticExtension
+	public static function capacity<T>(inArray:Array<T>):Int;
 
 
-	public static inline function address<T>( inArray:Array<T>,inIndex:Int ) : Pointer<T> {
-      return Pointer.arrayElem(inArray,inIndex);
-   }
+	@:nativeStaticExtension
+	public static function getElementSize<T>(inArray:Array<T>):Int;
 
 
-   @:nativeStaticExtension
-	public static function setData<T>( inArray:Array<T>,inData:Pointer<T>,inElementCount:Int ) : Void;
+	public static inline function address<T>(inArray:Array<T>, inIndex:Int):Pointer<T> {
+		return Pointer.arrayElem(inArray, inIndex);
+	}
 
 
-   @:nativeStaticExtension
-	public static function setUnmanagedData<T>( inArray:Array<T>,inData:ConstPointer<T>,inElementCount:Int ) : Void;
+	@:nativeStaticExtension
+	public static function setData<T>(inArray:Array<T>, inData:Pointer<T>, inElementCount:Int):Void;
 
 
-   @:nativeStaticExtension
-	public static function zero<T>( ioDestArray:Array<T>, ?inFirst:Int, ?inElements:Int ) : Void;
+	@:nativeStaticExtension
+	public static function setUnmanagedData<T>(inArray:Array<T>, inData:ConstPointer<T>, inElementCount:Int):Void;
 
 
-   @:nativeStaticExtension
-	public static function memcmp<T>( inArrayA:Array<T>, inArrayB:Array<T>) : Int;
+	@:nativeStaticExtension
+	public static function zero<T>(ioDestArray:Array<T>, ?inFirst:Int, ?inElements:Int):Void;
 
 
-   @:native("_hx_reslove_virtual_array")
-	public static function resolveVirtualArray( inArray:Array<Dynamic>) : Dynamic;
+	@:nativeStaticExtension
+	public static function memcmp<T>(inArrayA:Array<T>, inArrayB:Array<T>):Int;
 
 
+	@:native("_hx_reslove_virtual_array")
+	public static function resolveVirtualArray(inArray:Array<Dynamic>):Dynamic;
 
 
-   #if cppia
-	public static inline function unsafeGet<T>( inDestArray:Array<T>, inIndex:Int) : T {
+	#if cppia
+	public static inline function unsafeGet<T>(inDestArray:Array<T>, inIndex:Int):T {
 		return untyped inDestArray.__unsafe_get(inIndex);
 		return untyped inDestArray.__unsafe_get(inIndex);
 	}
 	}
 
 
-	public static inline function unsafeSet<T>( ioDestArray:Array<T>, inIndex:Int, inValue:T) : T {
-		return untyped ioDestArray.__unsafe_set(inIndex,inValue);
+	public static inline function unsafeSet<T>(ioDestArray:Array<T>, inIndex:Int, inValue:T):T {
+		return untyped ioDestArray.__unsafe_set(inIndex, inValue);
 	}
 	}
 
 
-	public static inline function setSize<T>( ioArray:Array<T>, inSize:Int) : Array<T> {
+	public static inline function setSize<T>(ioArray:Array<T>, inSize:Int):Array<T> {
 		return untyped ioArray.__SetSizeExact(inSize);
 		return untyped ioArray.__SetSizeExact(inSize);
-   }
-
-   #else
-   @:native("_hx_array_unsafe_get")
-	public static function unsafeGet<T>( inDestArray:Array<T>, inIndex:Int) : T;
-
-   @:native("_hx_array_unsafe_set")
-	public static inline function unsafeSet<T>( ioDestArray:Array<T>, inIndex:Int, inValue:T) : T {
-		return untyped ioDestArray.__unsafe_set(inIndex,inValue);
 	}
 	}
+	#else
+	@:native("_hx_array_unsafe_get")
+	public static function unsafeGet<T>(inDestArray:Array<T>, inIndex:Int):T;
 
 
-   @:native("_hx_array_set_size_exact")
-	public static function setSize<T>( ioArray:Array<T>, inSize:Int) : Array<T>;
-   #end
+	@:native("_hx_array_unsafe_set")
+	public static inline function unsafeSet<T>(ioDestArray:Array<T>, inIndex:Int, inValue:T):T {
+		return untyped ioDestArray.__unsafe_set(inIndex, inValue);
+	}
 
 
+	@:native("_hx_array_set_size_exact")
+	public static function setSize<T>(ioArray:Array<T>, inSize:Int):Array<T>;
+	#end
 }
 }

+ 53 - 46
std/cpp/NativeFile.hx

@@ -1,64 +1,71 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
-extern class NativeFile
-{
-   @:native("_hx_std_file_open")
-   extern public static function file_open(fname:String,r:String) : Dynamic;
-
-   @:native("_hx_std_file_close")
-   extern public static function file_close(handle:Dynamic) : Void;
-
-
-   @:native("_hx_std_file_write")
-   extern public static function file_write(handle:Dynamic,s:haxe.io.BytesData,p:Int,n:Int) : Int;
-
-
-   @:native("_hx_std_file_write_char")
-   extern public static function file_write_char(handle:Dynamic,c:Int) : Void;
-
-
-   @:native("_hx_std_file_read")
-   extern public static function file_read(handle:Dynamic,s:haxe.io.BytesData,p:Int,n:Int) : Int;
-
-
-   @:native("_hx_std_file_read_char")
-   extern public static function file_read_char(handle:Dynamic) : Int;
-
-
-   @:native("_hx_std_file_seek")
-   extern public static function file_seek(handle:Dynamic,pos:Int,kind:Int) : Void;
-
-
-   @:native("_hx_std_file_tell")
-   extern public static function file_tell(handle:Dynamic) : Int;
-
+extern class NativeFile {
+	@:native("_hx_std_file_open")
+	extern public static function file_open(fname:String, r:String):Dynamic;
 
 
-   @:native("_hx_std_file_eof")
-   extern public static function file_eof(handle:Dynamic) : Bool;
+	@:native("_hx_std_file_close")
+	extern public static function file_close(handle:Dynamic):Void;
 
 
+	@:native("_hx_std_file_write")
+	extern public static function file_write(handle:Dynamic, s:haxe.io.BytesData, p:Int, n:Int):Int;
 
 
-   @:native("_hx_std_file_flush")
-   extern public static function file_flush(handle:Dynamic) : Void;
+	@:native("_hx_std_file_write_char")
+	extern public static function file_write_char(handle:Dynamic, c:Int):Void;
 
 
+	@:native("_hx_std_file_read")
+	extern public static function file_read(handle:Dynamic, s:haxe.io.BytesData, p:Int, n:Int):Int;
 
 
-   @:native("_hx_std_file_contents_string")
-   extern public static function file_contents_string(name:String) : String;
+	@:native("_hx_std_file_read_char")
+	extern public static function file_read_char(handle:Dynamic):Int;
 
 
+	@:native("_hx_std_file_seek")
+	extern public static function file_seek(handle:Dynamic, pos:Int, kind:Int):Void;
 
 
-   @:native("_hx_std_file_contents_bytes")
-   extern public static function file_contents_bytes(name:String) : haxe.io.BytesData;
+	@:native("_hx_std_file_tell")
+	extern public static function file_tell(handle:Dynamic):Int;
 
 
+	@:native("_hx_std_file_eof")
+	extern public static function file_eof(handle:Dynamic):Bool;
 
 
-   @:native("_hx_std_file_stdin")
-   extern public static function file_stdin() : Dynamic;
+	@:native("_hx_std_file_flush")
+	extern public static function file_flush(handle:Dynamic):Void;
 
 
+	@:native("_hx_std_file_contents_string")
+	extern public static function file_contents_string(name:String):String;
 
 
-   @:native("_hx_std_file_stdout")
-   extern public static function file_stdout() : Dynamic;
+	@:native("_hx_std_file_contents_bytes")
+	extern public static function file_contents_bytes(name:String):haxe.io.BytesData;
 
 
+	@:native("_hx_std_file_stdin")
+	extern public static function file_stdin():Dynamic;
 
 
-   @:native("_hx_std_file_stderr")
-   extern public static function file_stderr() : Dynamic;
+	@:native("_hx_std_file_stdout")
+	extern public static function file_stdout():Dynamic;
 
 
+	@:native("_hx_std_file_stderr")
+	extern public static function file_stderr():Dynamic;
 }
 }

+ 46 - 40
std/cpp/NativeGc.hx

@@ -1,59 +1,65 @@
-package cpp;
+/*
+ * Copyright (C)2005-2019 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.
+ */
 
 
-extern class NativeGc
-{
-   @:native("__hxcpp_gc_mem_info")
-   static public function memInfo(inWhatInfo:Int) : Float;
+package cpp;
 
 
-   @:native("_hx_allocate_extended") @:templatedCall
-   static public function allocateExtended<T>(cls:Class<T>, size:Int) : T;
+extern class NativeGc {
+	@:native("__hxcpp_gc_mem_info")
+	static public function memInfo(inWhatInfo:Int):Float;
 
 
-   @:native("_hx_add_finalizable")
-   public static function addFinalizable( instance:{ function finalize():Void; }, inPin:Bool ): Void;
+	@:native("_hx_allocate_extended") @:templatedCall
+	static public function allocateExtended<T>(cls:Class<T>, size:Int):T;
 
 
-   @:native("hx::InternalNew")
-   public static function allocGcBytesRaw( inBytes : Int, isContainer:Bool ): RawPointer<cpp.Void>;
+	@:native("_hx_add_finalizable")
+	public static function addFinalizable(instance:{function finalize():Void;}, inPin:Bool):Void;
 
 
-   inline public static function allocGcBytes( inBytes : Int ): Pointer<cpp.Void>
-   {
-      return Pointer.fromRaw( allocGcBytesRaw(inBytes, false) );
-   }
+	@:native("hx::InternalNew")
+	public static function allocGcBytesRaw(inBytes:Int, isContainer:Bool):RawPointer<cpp.Void>;
 
 
+	inline public static function allocGcBytes(inBytes:Int):Pointer<cpp.Void> {
+		return Pointer.fromRaw(allocGcBytesRaw(inBytes, false));
+	}
 
 
-   @:native("__hxcpp_enable") extern
-   static public function enable(inEnable:Bool) : Void;
+	@:native("__hxcpp_enable") extern static public function enable(inEnable:Bool):Void;
 
 
-   @:native("__hxcpp_collect") extern
-   static public function run(major:Bool) : Void;
+	@:native("__hxcpp_collect") extern static public function run(major:Bool):Void;
 
 
-   @:native("__hxcpp_gc_compact") extern
-   static public function compact() : Void;
+	@:native("__hxcpp_gc_compact") extern static public function compact():Void;
 
 
-   @:native("__hxcpp_gc_trace") extern
-   static public function nativeTrace(sought:Class<Dynamic>,printInstances:Bool) : Int;
+	@:native("__hxcpp_gc_trace") extern static public function nativeTrace(sought:Class<Dynamic>, printInstances:Bool):Int;
 
 
-   @:native("__hxcpp_gc_do_not_kill") extern
-   static public function doNotKill(inObject:Dynamic) : Void;
+	@:native("__hxcpp_gc_do_not_kill") extern static public function doNotKill(inObject:Dynamic):Void;
 
 
-   @:native("__hxcpp_get_next_zombie") extern
-   static public function getNextZombie() : Dynamic;
+	@:native("__hxcpp_get_next_zombie") extern static public function getNextZombie():Dynamic;
 
 
-   @:native("__hxcpp_gc_safe_point") extern
-   static public function safePoint() : Void;
+	@:native("__hxcpp_gc_safe_point") extern static public function safePoint():Void;
 
 
-   @:native("__hxcpp_enter_gc_free_zone") extern
-   static public function enterGCFreeZone() : Void;
+	@:native("__hxcpp_enter_gc_free_zone") extern static public function enterGCFreeZone():Void;
 
 
-   @:native("__hxcpp_exit_gc_free_zone") extern
-   static public function exitGCFreeZone() : Void;
+	@:native("__hxcpp_exit_gc_free_zone") extern static public function exitGCFreeZone():Void;
 
 
-   @:native("__hxcpp_set_minimum_free_space") extern
-   static public function setMinimumFreeSpace(inBytes:Int) : Void;
+	@:native("__hxcpp_set_minimum_free_space") extern static public function setMinimumFreeSpace(inBytes:Int):Void;
 
 
-   @:native("__hxcpp_set_target_free_space_percentage") extern
-   static public function setTargetFreeSpacePercentage(inPercentage:Int) : Void;
+	@:native("__hxcpp_set_target_free_space_percentage") extern static public function setTargetFreeSpacePercentage(inPercentage:Int):Void;
 
 
-   @:native("__hxcpp_set_minimum_working_memory") extern
-   static public function setMinimumWorkingMemory(inBytes:Int) : Void;
+	@:native("__hxcpp_set_minimum_working_memory") extern static public function setMinimumWorkingMemory(inBytes:Int):Void;
 }
 }
-

+ 42 - 24
std/cpp/NativeMath.hx

@@ -1,31 +1,49 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 @:noPackageRestrict
 @:noPackageRestrict
-extern class NativeMath
-{
-#if (cpp && !cppia)
-   @:native("_hx_idiv")
-   public static function idiv(num:Int,denom:Int):Int;
-   @:native("_hx_imod")
-   public static function imod(num:Int,denom:Int):Int;
-   @:native("_hx_cast_int")
-   public static function castInt(f:Float):Int;
-   @:native("_hx_fast_floor")
-   public static function fastInt(f:Float):Int;
-
-#else
-
-   public static inline function imod(num:Int,denom:Int):Int
-      return num%denom;
-
-   public static inline function idiv(num:Int,denom:Int):Int
-      return Std.int(num/denom);
+extern class NativeMath {
+	#if (cpp && !cppia)
+	@:native("_hx_idiv")
+	public static function idiv(num:Int, denom:Int):Int;
+	@:native("_hx_imod")
+	public static function imod(num:Int, denom:Int):Int;
+	@:native("_hx_cast_int")
+	public static function castInt(f:Float):Int;
+	@:native("_hx_fast_floor")
+	public static function fastInt(f:Float):Int;
+	#else
+	public static inline function imod(num:Int, denom:Int):Int
+		return num % denom;
 
 
-   public static inline function castInt(f:Float):Int
-      return Std.int(f);
+	public static inline function idiv(num:Int, denom:Int):Int
+		return Std.int(num / denom);
 
 
-   public static inline function fastInt(f:Float):Int
-      return Std.int(f);
+	public static inline function castInt(f:Float):Int
+		return Std.int(f);
 
 
-#end
+	public static inline function fastInt(f:Float):Int
+		return Std.int(f);
+	#end
 }
 }

+ 43 - 30
std/cpp/NativeProcess.hx

@@ -1,43 +1,56 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
-extern class NativeProcess
-{
-
-   @:native("_hx_std_process_run")
-   public static function process_run(cmd:String,vargs:Array<String>) : Dynamic;
-
-   @:native("_hx_std_process_run")
-   public static function process_run_with_show(cmd:String,vargs:Array<String>,inShow:Int) : Dynamic;
-
-   @:native("_hx_std_process_stdout_read")
-   public static function process_stdout_read(handle:Dynamic,buf:haxe.io.BytesData,pos:Int,len:Int) : Int;
-
-
-   @:native("_hx_std_process_stderr_read")
-   public static function process_stderr_read(handle:Dynamic,buf:haxe.io.BytesData,pos:Int,len:Int) : Int;
-
-
-   @:native("_hx_std_process_stdin_write")
-   public static function process_stdin_write(handle:Dynamic,buf:haxe.io.BytesData,pos:Int,len:Int) : Int;
-
+extern class NativeProcess {
+	@:native("_hx_std_process_run")
+	public static function process_run(cmd:String, vargs:Array<String>):Dynamic;
 
 
-   @:native("_hx_std_process_stdin_close")
-   public static function process_stdin_close(handle:Dynamic) : Void;
+	@:native("_hx_std_process_run")
+	public static function process_run_with_show(cmd:String, vargs:Array<String>, inShow:Int):Dynamic;
 
 
+	@:native("_hx_std_process_stdout_read")
+	public static function process_stdout_read(handle:Dynamic, buf:haxe.io.BytesData, pos:Int, len:Int):Int;
 
 
-   @:native("_hx_std_process_exit")
-   public static function process_exit(handle:Dynamic) : Int;
+	@:native("_hx_std_process_stderr_read")
+	public static function process_stderr_read(handle:Dynamic, buf:haxe.io.BytesData, pos:Int, len:Int):Int;
 
 
+	@:native("_hx_std_process_stdin_write")
+	public static function process_stdin_write(handle:Dynamic, buf:haxe.io.BytesData, pos:Int, len:Int):Int;
 
 
-   @:native("_hx_std_process_pid")
-   public static function process_pid(handle:Dynamic) : Int;
+	@:native("_hx_std_process_stdin_close")
+	public static function process_stdin_close(handle:Dynamic):Void;
 
 
-   @:native("_hx_std_process_kill")
-   public static function process_kill(handle:Dynamic) : Void;
+	@:native("_hx_std_process_exit")
+	public static function process_exit(handle:Dynamic):Int;
 
 
+	@:native("_hx_std_process_pid")
+	public static function process_pid(handle:Dynamic):Int;
 
 
-   @:native("_hx_std_process_close")
-   public static function process_close(handle:Dynamic) : Void;
+	@:native("_hx_std_process_kill")
+	public static function process_kill(handle:Dynamic):Void;
 
 
+	@:native("_hx_std_process_close")
+	public static function process_close(handle:Dynamic):Void;
 }
 }

+ 31 - 16
std/cpp/NativeRandom.hx

@@ -1,23 +1,38 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
-extern class NativeRandom
-{
-
-   @:native("_hx_std_random_new")
-   public static function random_new() : Dynamic;
-
-
-   @:native("_hx_std_random_set_seed")
-   public static function random_set_seed(handle:Dynamic,v:Int) : Void;
+extern class NativeRandom {
+	@:native("_hx_std_random_new")
+	public static function random_new():Dynamic;
 
 
+	@:native("_hx_std_random_set_seed")
+	public static function random_set_seed(handle:Dynamic, v:Int):Void;
 
 
-   @:native("_hx_std_random_int")
-   public static function random_int(handle:Dynamic,max:Int) : Int;
-
-   @:native("_hx_std_random_float")
-   public static function random_float(handle:Dynamic) : Float;
-
+	@:native("_hx_std_random_int")
+	public static function random_int(handle:Dynamic, max:Int):Int;
 
 
+	@:native("_hx_std_random_float")
+	public static function random_float(handle:Dynamic):Float;
 }
 }
-

+ 101 - 113
std/cpp/NativeSocket.hx

@@ -1,157 +1,145 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 import sys.net.Socket;
 import sys.net.Socket;
 
 
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
-extern class NativeSocket
-{
-   @:native("_hx_std_socket_init")
-   public static function socket_init() : Void;
-
-
-   @:native("_hx_std_socket_new")
-   public static function socket_new(udp:Bool) : Dynamic;
-
-   @:native("_hx_std_socket_new")
-   public static function socket_new_ip(udp:Bool,ipv6:Bool) : Dynamic;
-
-
-   @:native("_hx_std_socket_close")
-   public static function socket_close(handle:Dynamic) : Void;
-
-
-   @:native("_hx_std_socket_bind")
-   public static function socket_bind(o:Dynamic,host:Int,port:Int) : Void;
-
-   @:native("_hx_std_socket_bind_ipv6")
-   public static function socket_bind_ipv6(o:Dynamic,host:haxe.io.BytesData,port:Int) : Void;
-
-
-   @:native("_hx_std_socket_send_char")
-   public static function socket_send_char(o:Dynamic,c:Int) : Void;
-
-
-   @:native("_hx_std_socket_send")
-   public static function socket_send(o:Dynamic,buf:haxe.io.BytesData,p:Int,l:Int) : Int;
-
-
-   @:native("_hx_std_socket_recv")
-   public static function socket_recv(o:Dynamic,buf:haxe.io.BytesData,p:Int,l:Int) : Int;
-
-
-   @:native("_hx_std_socket_recv_char")
-   public static function socket_recv_char(o:Dynamic) : Int;
-
+extern class NativeSocket {
+	@:native("_hx_std_socket_init")
+	public static function socket_init():Void;
 
 
-   @:native("_hx_std_socket_write")
-   public static function socket_write(o:Dynamic,buf:haxe.io.BytesData) : Void;
+	@:native("_hx_std_socket_new")
+	public static function socket_new(udp:Bool):Dynamic;
 
 
+	@:native("_hx_std_socket_new")
+	public static function socket_new_ip(udp:Bool, ipv6:Bool):Dynamic;
 
 
-   @:native("_hx_std_socket_read")
-   public static function socket_read(o:Dynamic) : haxe.io.BytesData;
+	@:native("_hx_std_socket_close")
+	public static function socket_close(handle:Dynamic):Void;
 
 
-   @:native("_hx_std_host_resolve_ipv6")
-   public static function host_resolve_ipv6(host:String) : haxe.io.BytesData;
+	@:native("_hx_std_socket_bind")
+	public static function socket_bind(o:Dynamic, host:Int, port:Int):Void;
 
 
+	@:native("_hx_std_socket_bind_ipv6")
+	public static function socket_bind_ipv6(o:Dynamic, host:haxe.io.BytesData, port:Int):Void;
 
 
-   @:native("_hx_std_host_resolve")
-   public static function host_resolve(host:String) : Int;
+	@:native("_hx_std_socket_send_char")
+	public static function socket_send_char(o:Dynamic, c:Int):Void;
 
 
+	@:native("_hx_std_socket_send")
+	public static function socket_send(o:Dynamic, buf:haxe.io.BytesData, p:Int, l:Int):Int;
 
 
-   @:native("_hx_std_host_to_string")
-   public static function host_to_string(ip:Int) : String;
+	@:native("_hx_std_socket_recv")
+	public static function socket_recv(o:Dynamic, buf:haxe.io.BytesData, p:Int, l:Int):Int;
 
 
-   @:native("_hx_std_host_to_string_ipv6")
-   public static function host_to_string_ipv6(ipv6:haxe.io.BytesData) : String;
+	@:native("_hx_std_socket_recv_char")
+	public static function socket_recv_char(o:Dynamic):Int;
 
 
+	@:native("_hx_std_socket_write")
+	public static function socket_write(o:Dynamic, buf:haxe.io.BytesData):Void;
 
 
-   @:native("_hx_std_host_reverse")
-   public static function host_reverse(host:Int) : String;
+	@:native("_hx_std_socket_read")
+	public static function socket_read(o:Dynamic):haxe.io.BytesData;
 
 
-   @:native("_hx_std_host_reverse_ipv6")
-   public static function host_reverse_ipv6(ipv6:haxe.io.BytesData) : String;
+	@:native("_hx_std_host_resolve_ipv6")
+	public static function host_resolve_ipv6(host:String):haxe.io.BytesData;
 
 
+	@:native("_hx_std_host_resolve")
+	public static function host_resolve(host:String):Int;
 
 
-   @:native("_hx_std_host_local")
-   public static function host_local() : String;
+	@:native("_hx_std_host_to_string")
+	public static function host_to_string(ip:Int):String;
 
 
-   inline public static function host_local_ipv6() : String return "::1";
+	@:native("_hx_std_host_to_string_ipv6")
+	public static function host_to_string_ipv6(ipv6:haxe.io.BytesData):String;
 
 
+	@:native("_hx_std_host_reverse")
+	public static function host_reverse(host:Int):String;
 
 
-   @:native("_hx_std_socket_connect")
-   public static function socket_connect(o:Dynamic,host:Int,port:Int) : Void;
+	@:native("_hx_std_host_reverse_ipv6")
+	public static function host_reverse_ipv6(ipv6:haxe.io.BytesData):String;
 
 
-   @:native("_hx_std_socket_connect_ipv6")
-   public static function socket_connect_ipv6(o:Dynamic,host:haxe.io.BytesData,port:Int) : Void;
+	@:native("_hx_std_host_local")
+	public static function host_local():String;
 
 
+	inline public static function host_local_ipv6():String
+		return "::1";
 
 
-   @:native("_hx_std_socket_listen")
-   public static function socket_listen(o:Dynamic,n:Int) : Void;
+	@:native("_hx_std_socket_connect")
+	public static function socket_connect(o:Dynamic, host:Int, port:Int):Void;
 
 
+	@:native("_hx_std_socket_connect_ipv6")
+	public static function socket_connect_ipv6(o:Dynamic, host:haxe.io.BytesData, port:Int):Void;
 
 
-   @:native("_hx_std_socket_select")
-   public static function socket_select(rs:Array<Dynamic>,ws:Array<Dynamic>,es:Array<Dynamic>,timeout:Dynamic) : Array<Dynamic>;
+	@:native("_hx_std_socket_listen")
+	public static function socket_listen(o:Dynamic, n:Int):Void;
 
 
+	@:native("_hx_std_socket_select")
+	public static function socket_select(rs:Array<Dynamic>, ws:Array<Dynamic>, es:Array<Dynamic>, timeout:Dynamic):Array<Dynamic>;
 
 
-   @:native("_hx_std_socket_fast_select")
-   public static function socket_fast_select(rs:Array<Dynamic>,ws:Array<Dynamic>,es:Array<Dynamic>,timeout:Dynamic) : Void;
+	@:native("_hx_std_socket_fast_select")
+	public static function socket_fast_select(rs:Array<Dynamic>, ws:Array<Dynamic>, es:Array<Dynamic>, timeout:Dynamic):Void;
 
 
+	@:native("_hx_std_socket_accept")
+	public static function socket_accept(o:Dynamic):Dynamic;
 
 
-   @:native("_hx_std_socket_accept")
-   public static function socket_accept(o:Dynamic) : Dynamic;
+	@:native("_hx_std_socket_peer")
+	public static function socket_peer(o:Dynamic):Array<Int>;
 
 
+	@:native("_hx_std_socket_host")
+	public static function socket_host(o:Dynamic):Array<Int>;
 
 
-   @:native("_hx_std_socket_peer")
-   public static function socket_peer(o:Dynamic) : Array<Int>;
+	@:native("_hx_std_socket_set_timeout")
+	public static function socket_set_timeout(o:Dynamic, t:Dynamic):Void;
 
 
+	@:native("_hx_std_socket_shutdown")
+	public static function socket_shutdown(o:Dynamic, r:Bool, w:Bool):Void;
 
 
-   @:native("_hx_std_socket_host")
-   public static function socket_host(o:Dynamic) : Array<Int>;
+	@:native("_hx_std_socket_set_blocking")
+	public static function socket_set_blocking(o:Dynamic, b:Bool):Void;
 
 
+	@:native("_hx_std_socket_set_fast_send")
+	public static function socket_set_fast_send(o:Dynamic, b:Bool):Void;
 
 
-   @:native("_hx_std_socket_set_timeout")
-   public static function socket_set_timeout(o:Dynamic,t:Dynamic) : Void;
+	@:native("_hx_std_socket_set_broadcast")
+	public static function socket_set_broadcast(o:Dynamic, b:Bool):Void;
 
 
+	@:native("_hx_std_socket_poll_alloc")
+	public static function socket_poll_alloc(nsocks:Int):Dynamic;
 
 
-   @:native("_hx_std_socket_shutdown")
-   public static function socket_shutdown(o:Dynamic,r:Bool,w:Bool) : Void;
+	@:native("_hx_std_socket_poll_prepare")
+	public static function socket_poll_prepare(pdata:Dynamic, rsocks:Array<Socket>, wsocks:Array<Socket>):Array<Array<Int>>;
 
 
+	@:native("_hx_std_socket_poll_events")
+	public static function socket_poll_events(pdata:Dynamic, timeout:Float):Void;
 
 
-   @:native("_hx_std_socket_set_blocking")
-   public static function socket_set_blocking(o:Dynamic,b:Bool) : Void;
-
-
-   @:native("_hx_std_socket_set_fast_send")
-   public static function socket_set_fast_send(o:Dynamic,b:Bool) : Void;
-
-   @:native("_hx_std_socket_set_broadcast")
-   public static function socket_set_broadcast(o:Dynamic,b:Bool) : Void;
-
-   @:native("_hx_std_socket_poll_alloc")
-   public static function socket_poll_alloc(nsocks:Int) : Dynamic;
-
-
-   @:native("_hx_std_socket_poll_prepare")
-   public static function socket_poll_prepare(pdata:Dynamic,rsocks:Array<Socket>,wsocks:Array<Socket>) : Array< Array<Int> >;
-
-
-   @:native("_hx_std_socket_poll_events")
-   public static function socket_poll_events(pdata:Dynamic,timeout:Float) : Void;
-
-
-   @:native("_hx_std_socket_poll")
-   public static function socket_poll(socks:Array<Socket>,pdata:Dynamic,timeout:Float) : Array<Socket>;
-
-
-   @:native("_hx_std_socket_send_to")
-   public static function socket_send_to(o:Dynamic,buf:haxe.io.BytesData,p:Int,l:Int,inAddr:Dynamic) : Int;
-
-
-   @:native("_hx_std_socket_recv_from")
-   public static function socket_recv_from(o:Dynamic,buf:haxe.io.BytesData,p:Int,l:Int,outAddr:Dynamic) : Int;
-
+	@:native("_hx_std_socket_poll")
+	public static function socket_poll(socks:Array<Socket>, pdata:Dynamic, timeout:Float):Array<Socket>;
 
 
+	@:native("_hx_std_socket_send_to")
+	public static function socket_send_to(o:Dynamic, buf:haxe.io.BytesData, p:Int, l:Int, inAddr:Dynamic):Int;
 
 
+	@:native("_hx_std_socket_recv_from")
+	public static function socket_recv_from(o:Dynamic, buf:haxe.io.BytesData, p:Int, l:Int, outAddr:Dynamic):Int;
 }
 }
-
-

+ 95 - 75
std/cpp/NativeSsl.hx

@@ -1,114 +1,134 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 @:buildXml('<include name="${HXCPP}/src/hx/libs/ssl/Build.xml"/>')
 @:buildXml('<include name="${HXCPP}/src/hx/libs/ssl/Build.xml"/>')
-extern class NativeSsl
-{
-   @:native("_hx_ssl_new")
-   public static function ssl_new( conf : Dynamic ) : Dynamic;
-
-   @:native("_hx_ssl_close")
-   public static function ssl_close( ctx : Dynamic ) : Void;
+extern class NativeSsl {
+	@:native("_hx_ssl_new")
+	public static function ssl_new(conf:Dynamic):Dynamic;
 
 
-   @:native("_hx_ssl_handshake")
-   public static function ssl_handshake( ctx : Dynamic ) : Void;
+	@:native("_hx_ssl_close")
+	public static function ssl_close(ctx:Dynamic):Void;
 
 
-   @:native("_hx_ssl_set_socket")
-   public static function ssl_set_socket( ctx : Dynamic, socket : Dynamic ) : Void;
+	@:native("_hx_ssl_handshake")
+	public static function ssl_handshake(ctx:Dynamic):Void;
 
 
-   @:native("_hx_ssl_set_hostname")
-   public static function ssl_set_hostname( ctx : Dynamic, hostname : String ) : Void;
+	@:native("_hx_ssl_set_socket")
+	public static function ssl_set_socket(ctx:Dynamic, socket:Dynamic):Void;
 
 
-   @:native("_hx_ssl_get_peer_certificate")
-   public static function ssl_get_peer_certificate( ctx : Dynamic ) : Dynamic;
+	@:native("_hx_ssl_set_hostname")
+	public static function ssl_set_hostname(ctx:Dynamic, hostname:String):Void;
 
 
-   @:native("_hx_ssl_get_verify_result")
-   public static function ssl_get_verify_result( ctx : Dynamic ) : Bool;
+	@:native("_hx_ssl_get_peer_certificate")
+	public static function ssl_get_peer_certificate(ctx:Dynamic):Dynamic;
 
 
-   @:native("_hx_ssl_send_char")
-   public static function ssl_send_char( ctx : Dynamic, char : Int ) : Void;
+	@:native("_hx_ssl_get_verify_result")
+	public static function ssl_get_verify_result(ctx:Dynamic):Bool;
 
 
-   @:native("_hx_ssl_send")
-   public static function ssl_send( ctx : Dynamic, buf : haxe.io.BytesData, p : Int, l : Int ) : Int;
+	@:native("_hx_ssl_send_char")
+	public static function ssl_send_char(ctx:Dynamic, char:Int):Void;
 
 
-   @:native("_hx_ssl_write")
-   public static function ssl_write( ctx : Dynamic, data : haxe.io.BytesData ) : Void;
+	@:native("_hx_ssl_send")
+	public static function ssl_send(ctx:Dynamic, buf:haxe.io.BytesData, p:Int, l:Int):Int;
 
 
-   @:native("_hx_ssl_recv_char")
-   public static function ssl_recv_char( ctx : Dynamic ) : Int;
+	@:native("_hx_ssl_write")
+	public static function ssl_write(ctx:Dynamic, data:haxe.io.BytesData):Void;
 
 
-   @:native("_hx_ssl_recv")
-   public static function ssl_recv( ctx : Dynamic, buf : haxe.io.BytesData, p : Int, l : Int ) : Int;
+	@:native("_hx_ssl_recv_char")
+	public static function ssl_recv_char(ctx:Dynamic):Int;
 
 
-   @:native("_hx_ssl_read")
-   public static function ssl_read( ctx : Dynamic ) : haxe.io.BytesData;
+	@:native("_hx_ssl_recv")
+	public static function ssl_recv(ctx:Dynamic, buf:haxe.io.BytesData, p:Int, l:Int):Int;
 
 
-   @:native("_hx_ssl_conf_new")
-   public static function conf_new( server : Bool ) : Dynamic;
+	@:native("_hx_ssl_read")
+	public static function ssl_read(ctx:Dynamic):haxe.io.BytesData;
 
 
-   @:native("_hx_ssl_conf_close")
-   public static function conf_close( conf : Dynamic ) : Void;
+	@:native("_hx_ssl_conf_new")
+	public static function conf_new(server:Bool):Dynamic;
 
 
-   @:native("_hx_ssl_conf_set_ca")
-   public static function conf_set_ca( conf : Dynamic, cert : Dynamic ) : Void;
+	@:native("_hx_ssl_conf_close")
+	public static function conf_close(conf:Dynamic):Void;
 
 
-   @:native("_hx_ssl_conf_set_verify")
-   public static function conf_set_verify( conf : Dynamic, mode : Int ) : Void;
+	@:native("_hx_ssl_conf_set_ca")
+	public static function conf_set_ca(conf:Dynamic, cert:Dynamic):Void;
 
 
-   @:native("_hx_ssl_conf_set_cert")
-   public static function conf_set_cert( conf : Dynamic, cert : Dynamic, pkey : Dynamic ) : Void;
+	@:native("_hx_ssl_conf_set_verify")
+	public static function conf_set_verify(conf:Dynamic, mode:Int):Void;
 
 
-   @:native("_hx_ssl_conf_set_servername_callback")
-   public static function conf_set_servername_callback( conf : Dynamic, cb : Dynamic ) : Void;
+	@:native("_hx_ssl_conf_set_cert")
+	public static function conf_set_cert(conf:Dynamic, cert:Dynamic, pkey:Dynamic):Void;
 
 
-   @:native("_hx_ssl_cert_load_defaults")
-   public static function cert_load_defaults() : Dynamic;
+	@:native("_hx_ssl_conf_set_servername_callback")
+	public static function conf_set_servername_callback(conf:Dynamic, cb:Dynamic):Void;
 
 
-   @:native("_hx_ssl_cert_load_file")
-   public static function cert_load_file( file : String ) : Dynamic;
+	@:native("_hx_ssl_cert_load_defaults")
+	public static function cert_load_defaults():Dynamic;
 
 
-   @:native("_hx_ssl_cert_load_path")
-   public static function cert_load_path( path : String ) : Dynamic;
+	@:native("_hx_ssl_cert_load_file")
+	public static function cert_load_file(file:String):Dynamic;
 
 
-   @:native("_hx_ssl_cert_get_subject")
-   public static function cert_get_subject( cert : Dynamic, field : String ) : String;
+	@:native("_hx_ssl_cert_load_path")
+	public static function cert_load_path(path:String):Dynamic;
 
 
-   @:native("_hx_ssl_cert_get_issuer")
-   public static function cert_get_issuer( cert : Dynamic, field : String ) : String;
+	@:native("_hx_ssl_cert_get_subject")
+	public static function cert_get_subject(cert:Dynamic, field:String):String;
 
 
-   @:native("_hx_ssl_cert_get_altnames")
-   public static function cert_get_altnames( cert : Dynamic ) : Array<String>;
+	@:native("_hx_ssl_cert_get_issuer")
+	public static function cert_get_issuer(cert:Dynamic, field:String):String;
 
 
-   @:native("_hx_ssl_cert_get_notbefore")
-   public static function cert_get_notbefore( cert : Dynamic ) : Array<Int>;
+	@:native("_hx_ssl_cert_get_altnames")
+	public static function cert_get_altnames(cert:Dynamic):Array<String>;
 
 
-   @:native("_hx_ssl_cert_get_notafter")
-   public static function cert_get_notafter( cert : Dynamic ) : Array<Int>;
+	@:native("_hx_ssl_cert_get_notbefore")
+	public static function cert_get_notbefore(cert:Dynamic):Array<Int>;
 
 
-   @:native("_hx_ssl_cert_get_next")
-   public static function cert_get_next( cert : Dynamic ) : Dynamic;
+	@:native("_hx_ssl_cert_get_notafter")
+	public static function cert_get_notafter(cert:Dynamic):Array<Int>;
 
 
-   @:native("_hx_ssl_cert_add_pem")
-   public static function cert_add_pem( cert : Dynamic, data : String ) : Dynamic;
+	@:native("_hx_ssl_cert_get_next")
+	public static function cert_get_next(cert:Dynamic):Dynamic;
 
 
-   @:native("_hx_ssl_cert_add_der")
-   public static function cert_add_der( cert : Dynamic, data : haxe.io.BytesData ) : Dynamic;
+	@:native("_hx_ssl_cert_add_pem")
+	public static function cert_add_pem(cert:Dynamic, data:String):Dynamic;
 
 
-   @:native("_hx_ssl_key_from_der")
-   public static function key_from_der( data : haxe.io.BytesData, pub : Bool ) : Dynamic;
+	@:native("_hx_ssl_cert_add_der")
+	public static function cert_add_der(cert:Dynamic, data:haxe.io.BytesData):Dynamic;
 
 
-   @:native("_hx_ssl_key_from_pem")
-   public static function key_from_pem( data : String, pub : Bool, pass : String ) : Dynamic;
+	@:native("_hx_ssl_key_from_der")
+	public static function key_from_der(data:haxe.io.BytesData, pub:Bool):Dynamic;
 
 
-   @:native("_hx_ssl_dgst_make")
-   public static function dgst_make( data : haxe.io.BytesData, alg : String ) : haxe.io.BytesData;
+	@:native("_hx_ssl_key_from_pem")
+	public static function key_from_pem(data:String, pub:Bool, pass:String):Dynamic;
 
 
-   @:native("_hx_ssl_dgst_sign")
-   public static function dgst_sign( data : haxe.io.BytesData, key : Dynamic, alg : String ) : haxe.io.BytesData;
+	@:native("_hx_ssl_dgst_make")
+	public static function dgst_make(data:haxe.io.BytesData, alg:String):haxe.io.BytesData;
 
 
-   @:native("_hx_ssl_dgst_verify")
-   public static function dgst_verify( data : haxe.io.BytesData, sign : haxe.io.BytesData, key : Dynamic, alg : String ) : Bool;
+	@:native("_hx_ssl_dgst_sign")
+	public static function dgst_sign(data:haxe.io.BytesData, key:Dynamic, alg:String):haxe.io.BytesData;
 
 
-   @:native("_hx_ssl_init")
-   public static function init() : Void;
+	@:native("_hx_ssl_dgst_verify")
+	public static function dgst_verify(data:haxe.io.BytesData, sign:haxe.io.BytesData, key:Dynamic, alg:String):Bool;
 
 
+	@:native("_hx_ssl_init")
+	public static function init():Void;
 }
 }

+ 27 - 30
std/cpp/NativeString.hx

@@ -19,44 +19,41 @@
  * 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 cpp;
 
 
-extern class NativeString {
+package cpp;
 
 
-	public static inline function raw( inString:String ) : RawConstPointer<Char> {
-      return untyped inString.raw_ptr();
-   }
-	public static inline function c_str( inString:String ) : ConstPointer<Char> {
+extern class NativeString {
+	public static inline function raw(inString:String):RawConstPointer<Char> {
+		return untyped inString.raw_ptr();
+	}
+	public static inline function c_str(inString:String):ConstPointer<Char> {
 		return cpp.ConstPointer.fromPointer(untyped inString.c_str());
 		return cpp.ConstPointer.fromPointer(untyped inString.c_str());
-   }
-	public static inline function fromPointer(inPtr:ConstPointer<Char> ) : String {
-      return untyped __global__.String(inPtr.ptr);
-   }
-	public static inline function fromGcPointer(inPtr:ConstPointer<Char>, inLen:Int ) : String {
-      return untyped __global__.String(inPtr.ptr,inLen);
-   }
-
+	}
+	public static inline function fromPointer(inPtr:ConstPointer<Char>):String {
+		return untyped __global__.String(inPtr.ptr);
+	}
+	public static inline function fromGcPointer(inPtr:ConstPointer<Char>, inLen:Int):String {
+		return untyped __global__.String(inPtr.ptr, inLen);
+	}
 
 
-   @:native("_hx_string_compare")
-   public static function compare(inString0:String, inString1:String) : Int;
+	@:native("_hx_string_compare")
+	public static function compare(inString0:String, inString1:String):Int;
 
 
-   @:native("_hx_utf8_char_code_at")
-   public static function utf8CharCodeAt(inString:String, inIndex:Int) : Int;
+	@:native("_hx_utf8_char_code_at")
+	public static function utf8CharCodeAt(inString:String, inIndex:Int):Int;
 
 
-   @:native("_hx_utf8_length")
-   public static function utf8Length(inString:String) : Int;
+	@:native("_hx_utf8_length")
+	public static function utf8Length(inString:String):Int;
 
 
-   @:native("_hx_utf8_is_valid")
-   public static function utf8IsValid(inString:String) : Bool;
+	@:native("_hx_utf8_is_valid")
+	public static function utf8IsValid(inString:String):Bool;
 
 
-   @:native("_hx_utf8_sub")
-   public static function utf8Sub(inString:String,charStart:Int, inLen:Int) : String;
+	@:native("_hx_utf8_sub")
+	public static function utf8Sub(inString:String, charStart:Int, inLen:Int):String;
 
 
-   @:native("_hx_string_create")
-   public static function fromPointerLen(inPtr:ConstPointer<Char>, len:Int ) : String;
-
-   @:native("_hx_utf8_decode_advance")
-   public static function utf8DecodeAdvance(reference:Char) : Int ;
+	@:native("_hx_string_create")
+	public static function fromPointerLen(inPtr:ConstPointer<Char>, len:Int):String;
 
 
+	@:native("_hx_utf8_decode_advance")
+	public static function utf8DecodeAdvance(reference:Char):Int;
 }
 }
-

+ 77 - 83
std/cpp/NativeSys.hx

@@ -1,113 +1,107 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
-extern class NativeSys
-{
-   @:native("__hxcpp_print")
-   public static function print( v : Dynamic ) : Void;
-
-   @:native("__hxcpp_println")
-   public static function println( v : Dynamic ) : Void;
-
-   @:native("_hx_std_get_env")
-   extern public static function get_env(v:String) : String;
-
-
-   @:native("_hx_std_put_env")
-   extern public static function put_env(e:String,v:String) : Void;
-
-
-   @:native("_hx_std_sys_sleep")
-   extern public static function sys_sleep(f:Float) : Void;
-
-
-   @:native("_hx_std_set_time_locale")
-   extern public static function set_time_locale(l:String) : Bool;
-
-
-   @:native("_hx_std_get_cwd")
-   extern public static function get_cwd() : String;
-
-
-   @:native("_hx_std_set_cwd")
-   extern public static function set_cwd(d:String) : Void;
-
+extern class NativeSys {
+	@:native("__hxcpp_print")
+	public static function print(v:Dynamic):Void;
 
 
-   @:native("_hx_std_sys_string")
-   extern public static function sys_string() : String;
+	@:native("__hxcpp_println")
+	public static function println(v:Dynamic):Void;
 
 
+	@:native("_hx_std_get_env")
+	extern public static function get_env(v:String):String;
 
 
-   @:native("_hx_std_sys_is64")
-   extern public static function sys_is64() : Bool;
+	@:native("_hx_std_put_env")
+	extern public static function put_env(e:String, v:String):Void;
 
 
+	@:native("_hx_std_sys_sleep")
+	extern public static function sys_sleep(f:Float):Void;
 
 
-   @:native("_hx_std_sys_command")
-   extern public static function sys_command(cmd:String) : Int;
+	@:native("_hx_std_set_time_locale")
+	extern public static function set_time_locale(l:String):Bool;
 
 
+	@:native("_hx_std_get_cwd")
+	extern public static function get_cwd():String;
 
 
-   @:native("_hx_std_sys_exit")
-   extern public static function sys_exit(code:Int) : Void;
+	@:native("_hx_std_set_cwd")
+	extern public static function set_cwd(d:String):Void;
 
 
+	@:native("_hx_std_sys_string")
+	extern public static function sys_string():String;
 
 
-   @:native("_hx_std_sys_exists")
-   extern public static function sys_exists(path:String) : Bool;
+	@:native("_hx_std_sys_is64")
+	extern public static function sys_is64():Bool;
 
 
+	@:native("_hx_std_sys_command")
+	extern public static function sys_command(cmd:String):Int;
 
 
-   @:native("_hx_std_file_delete")
-   extern public static function file_delete(path:String) : Void;
+	@:native("_hx_std_sys_exit")
+	extern public static function sys_exit(code:Int):Void;
 
 
+	@:native("_hx_std_sys_exists")
+	extern public static function sys_exists(path:String):Bool;
 
 
-   @:native("_hx_std_sys_rename")
-   extern public static function sys_rename(path:String,newname:String) : Bool;
+	@:native("_hx_std_file_delete")
+	extern public static function file_delete(path:String):Void;
 
 
+	@:native("_hx_std_sys_rename")
+	extern public static function sys_rename(path:String, newname:String):Bool;
 
 
-   @:native("_hx_std_sys_stat")
-   extern public static function sys_stat(path:String) : Dynamic;
+	@:native("_hx_std_sys_stat")
+	extern public static function sys_stat(path:String):Dynamic;
 
 
+	@:native("_hx_std_sys_file_type")
+	extern public static function sys_file_type(path:String):String;
 
 
-   @:native("_hx_std_sys_file_type")
-   extern public static function sys_file_type(path:String) : String;
+	@:native("_hx_std_sys_create_dir")
+	extern public static function sys_create_dir(path:String, mode:Int):Bool;
 
 
+	@:native("_hx_std_sys_remove_dir")
+	extern public static function sys_remove_dir(path:String):Void;
 
 
-   @:native("_hx_std_sys_create_dir")
-   extern public static function sys_create_dir(path:String,mode:Int) : Bool;
+	@:native("_hx_std_sys_time")
+	extern public static function sys_time():Float;
 
 
+	@:native("_hx_std_sys_cpu_time")
+	extern public static function sys_cpu_time():Float;
 
 
-   @:native("_hx_std_sys_remove_dir")
-   extern public static function sys_remove_dir(path:String) : Void;
+	@:native("_hx_std_sys_read_dir")
+	extern public static function sys_read_dir(p:String):Array<String>;
 
 
+	@:native("_hx_std_file_full_path")
+	extern public static function file_full_path(path:String):String;
 
 
-   @:native("_hx_std_sys_time")
-   extern public static function sys_time() : Float;
+	@:native("_hx_std_sys_exe_path")
+	extern public static function sys_exe_path():String;
 
 
+	@:native("_hx_std_sys_env")
+	extern public static function sys_env():Array<String>;
 
 
-   @:native("_hx_std_sys_cpu_time")
-   extern public static function sys_cpu_time() : Float;
-
-
-   @:native("_hx_std_sys_read_dir")
-   extern public static function sys_read_dir(p:String) : Array<String>;
-
-
-   @:native("_hx_std_file_full_path")
-   extern public static function file_full_path(path:String) : String;
-
-
-   @:native("_hx_std_sys_exe_path")
-   extern public static function sys_exe_path() : String;
-
-
-   @:native("_hx_std_sys_env")
-   extern public static function sys_env() : Array<String>;
-
-
-   @:native("_hx_std_sys_getch")
-   extern public static function sys_getch(b:Bool) : Int;
-
-
-   @:native("_hx_std_sys_get_pid")
-   extern public static function sys_get_pid() : Int;
+	@:native("_hx_std_sys_getch")
+	extern public static function sys_getch(b:Bool):Int;
 
 
+	@:native("_hx_std_sys_get_pid")
+	extern public static function sys_get_pid():Int;
 }
 }
-
-

+ 437 - 464
std/cpp/NativeXml.hx

@@ -19,482 +19,455 @@
  * 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 cpp;
 package cpp;
 
 
 enum abstract XmlType(Int) {
 enum abstract XmlType(Int) {
-   /**
-      Represents an XML element type.
-   **/
-   var Element = 0;
-   /**
-      Represents XML parsed character data type.
-   **/
-   var PCData = 1;
-   /**
-      Represents XML character data type.
-   **/
-   var CData = 2;
-   /**
-      Represents an XML comment type.
-   **/
-   var Comment = 3;
-   /**
-      Represents an XML doctype element type.
-   **/
-   var DocType = 4;
-   /**
-       Represents an XML processing instruction type.
-   **/
-   var ProcessingInstruction = 5;
-   /**
-      Represents an XML document type.
-   **/
-   var Document = 6;
+	/**
+		Represents an XML element type.
+	**/
+	var Element = 0;
+
+	/**
+		Represents XML parsed character data type.
+	**/
+	var PCData = 1;
+
+	/**
+		Represents XML character data type.
+	**/
+	var CData = 2;
+
+	/**
+		Represents an XML comment type.
+	**/
+	var Comment = 3;
+
+	/**
+		Represents an XML doctype element type.
+	**/
+	var DocType = 4;
+
+	/**
+		Represents an XML processing instruction type.
+	**/
+	var ProcessingInstruction = 5;
+
+	/**
+		Represents an XML document type.
+	**/
+	var Document = 6;
 }
 }
 
 
-class NativeXmlState
-{
-   var cur : Xml;
-
-   public function new(x:Xml)
-   {
-      x._children = new Array<Xml>();
-      cur = x;
-   }
-
-
-   @:keep
-   public function xml(name:String, att:Dynamic<String>)
-   {
-      var x = new Xml();
-      x._parent = cur;
-      x.nodeType = Xml.Element;
-      x._nodeName = name;
-      x._attributes = att;
-      x._children = new Array<Xml>();
-      cur.addChild(x);
-      cur = x;
-   }
-
-   @:keep
-   public function cdata(text:String)
-   {
-      var x = new Xml();
-      x._parent = cur;
-      x.nodeType = Xml.CData;
-      x._nodeValue = text;
-      cur.addChild(x);
-   }
-
-   @:keep
-   public function pcdata(text:String)
-   {
-      var x = new Xml();
-      x._parent = cur;
-      x.nodeType = Xml.PCData;
-      x._nodeValue = text;
-      cur.addChild(x);
-   }
-
-   @:keep
-   public function comment(text:String)
-   {
-      var x = new Xml();
-      x._parent = cur;
-      if( text.length>1 && StringTools.fastCodeAt(text,0) == 63 )
-      {
-         x.nodeType = Xml.ProcessingInstruction;
-         text = text.substr(1, text.length - 2);
-      }
-      else
-      {
-         x.nodeType = Xml.Comment;
-      }
-      x._nodeValue = text;
-      cur.addChild(x);
-   }
-
-   @:keep
-   public function doctype(text:String)
-   {
-      var x = new Xml();
-      x._parent = cur;
-      x.nodeType = Xml.DocType;
-      x._nodeValue = text.substr(1);
-      cur.addChild(x);
-   }
-
-   @:keep
-   public function done()
-   {
-     cur = cur._parent;
-   }
+class NativeXmlState {
+	var cur:Xml;
+
+	public function new(x:Xml) {
+		x._children = new Array<Xml>();
+		cur = x;
+	}
+
+	@:keep
+	public function xml(name:String, att:Dynamic<String>) {
+		var x = new Xml();
+		x._parent = cur;
+		x.nodeType = Xml.Element;
+		x._nodeName = name;
+		x._attributes = att;
+		x._children = new Array<Xml>();
+		cur.addChild(x);
+		cur = x;
+	}
+
+	@:keep
+	public function cdata(text:String) {
+		var x = new Xml();
+		x._parent = cur;
+		x.nodeType = Xml.CData;
+		x._nodeValue = text;
+		cur.addChild(x);
+	}
+
+	@:keep
+	public function pcdata(text:String) {
+		var x = new Xml();
+		x._parent = cur;
+		x.nodeType = Xml.PCData;
+		x._nodeValue = text;
+		cur.addChild(x);
+	}
+
+	@:keep
+	public function comment(text:String) {
+		var x = new Xml();
+		x._parent = cur;
+		if (text.length > 1 && StringTools.fastCodeAt(text, 0) == 63) {
+			x.nodeType = Xml.ProcessingInstruction;
+			text = text.substr(1, text.length - 2);
+		} else {
+			x.nodeType = Xml.Comment;
+		}
+		x._nodeValue = text;
+		cur.addChild(x);
+	}
+
+	@:keep
+	public function doctype(text:String) {
+		var x = new Xml();
+		x._parent = cur;
+		x.nodeType = Xml.DocType;
+		x._nodeValue = text.substr(1);
+		cur.addChild(x);
+	}
+
+	@:keep
+	public function done() {
+		cur = cur._parent;
+	}
 }
 }
 
 
-private class NativeXmlIterator
-{
-   var cur = 0;
-   var children:Array<Xml>;
-
-   public function new(inChildren:Array<Xml>)
-   {
-      children = inChildren;
-      cur = 0;
-   }
-
-   public function hasNext() : Bool
-   {
-      var k = cur;
-      var l = children.length;
-      while( k < l )
-      {
-         if (children[k].nodeType == Xml.Element)
-            break;
-         k += 1;
-      }
-      cur = k;
-      return k < l;
-   }
-
-   public function next():Xml
-   {
-      var k = cur;
-      var l = children.length;
-      while( k < l )
-      {
-         var n = children[k];
-         k += 1;
-         if( n.nodeType == Xml.Element )
-         {
-            cur = k;
-            return n;
-         }
-      }
-      return null;
-   }
+private class NativeXmlIterator {
+	var cur = 0;
+	var children:Array<Xml>;
+
+	public function new(inChildren:Array<Xml>) {
+		children = inChildren;
+		cur = 0;
+	}
+
+	public function hasNext():Bool {
+		var k = cur;
+		var l = children.length;
+		while (k < l) {
+			if (children[k].nodeType == Xml.Element)
+				break;
+			k += 1;
+		}
+		cur = k;
+		return k < l;
+	}
+
+	public function next():Xml {
+		var k = cur;
+		var l = children.length;
+		while (k < l) {
+			var n = children[k];
+			k += 1;
+			if (n.nodeType == Xml.Element) {
+				cur = k;
+				return n;
+			}
+		}
+		return null;
+	}
 }
 }
 
 
-private class NativeXmlNamedIterator
-{
-   var cur = 0;
-   var children:Array<Xml>;
-   var name:String;
-
-   public function new(inChildren:Array<Xml>, inName:String)
-   {
-      children = inChildren;
-      name = inName;
-      cur = 0;
-   }
-
-
-   public function hasNext() : Bool
-   {
-      var k = cur;
-      var l = children.length;
-      while( k < l )
-      {
-         var n = children[k];
-         if( n.nodeType == Xml.Element && n._nodeName == name )
-            break;
-         k++;
-     }
-     cur = k;
-     return k < l;
-   }
-
-   public function next():Xml
-   {
-      var k = cur;
-      var l = children.length;
-      while( k < l )
-      {
-         var n = children[k];
-         k++;
-         if( n.nodeType == Xml.Element && n._nodeName == name ) {
-            cur = k;
-            return n;
-         }
-      }
-      return null;
-   }
+private class NativeXmlNamedIterator {
+	var cur = 0;
+	var children:Array<Xml>;
+	var name:String;
+
+	public function new(inChildren:Array<Xml>, inName:String) {
+		children = inChildren;
+		name = inName;
+		cur = 0;
+	}
+
+	public function hasNext():Bool {
+		var k = cur;
+		var l = children.length;
+		while (k < l) {
+			var n = children[k];
+			if (n.nodeType == Xml.Element && n._nodeName == name)
+				break;
+			k++;
+		}
+		cur = k;
+		return k < l;
+	}
+
+	public function next():Xml {
+		var k = cur;
+		var l = children.length;
+		while (k < l) {
+			var n = children[k];
+			k++;
+			if (n.nodeType == Xml.Element && n._nodeName == name) {
+				cur = k;
+				return n;
+			}
+		}
+		return null;
+	}
 }
 }
 
 
-
-
-
 @:cppInclude("./NativeXmlImport.cpp")
 @:cppInclude("./NativeXmlImport.cpp")
 @:allow(cpp.NativeXmlState) @:allow(cpp.NativeXmlIterator) @:allow(cpp.NativeXmlNamedIterator)
 @:allow(cpp.NativeXmlState) @:allow(cpp.NativeXmlIterator) @:allow(cpp.NativeXmlNamedIterator)
 class Xml {
 class Xml {
-   static inline var Element = XmlType.Element;
-   static inline var PCData = XmlType.PCData;
-   static inline var CData = XmlType.CData;
-   static inline var Comment = XmlType.Comment;
-   static inline var DocType = XmlType.DocType;
-   static inline var ProcessingInstruction = XmlType.ProcessingInstruction;
-   static inline var Document = XmlType.Document;
-
-
-   private var _nodeName : String;
-   private var _nodeValue : String;
-   private var _attributes : Dynamic<String>;
-   private var _children : Array<Xml>;
-   private var _parent : Xml;
-
-   function new() : Void {
-   }
-
-   @:native("parse_xml")
-   extern static function parse_xml(str:String, state:NativeXmlState);
-
-   public static function parse( str : String ) : Xml
-   {
-      var x = new Xml();
-      var state = new NativeXmlState(x);
-      parse_xml(str,state);
-      x.nodeType = Xml.Document;
-      return x;
-   }
-
-
-   public static function createElement( name : String ) : Xml {
-      var r = new Xml();
-      r.nodeType = Xml.Element;
-      r._nodeName = name;
-      r._attributes = null;
-      r._children = new Array();
-      return r;
-   }
-
-   public static function createPCData( data : String ) : Xml {
-      var r = new Xml();
-      r.nodeType = Xml.PCData;
-      r._nodeValue = data;
-      return r;
-   }
-
-   public static function createCData( data : String ) : Xml {
-      var r = new Xml();
-      r.nodeType = Xml.CData;
-      r._nodeValue = data;
-      return r;
-   }
-
-   public static function createComment( data : String ) : Xml {
-      var r = new Xml();
-      r.nodeType = Xml.Comment;
-      r._nodeValue = data;
-      return r;
-   }
-
-   public static function createDocType( data : String ) : Xml {
-      var r = new Xml();
-      r.nodeType = Xml.DocType;
-      r._nodeValue = data;
-      return r;
-   }
-
-   public static function createProcessingInstruction( data : String ) : Xml {
-      var r = new Xml();
-      r.nodeType = Xml.ProcessingInstruction;
-      r._nodeValue = data;
-      return r;
-   }
-
-   public static function createDocument() : Xml {
-      var r = new Xml();
-      r.nodeType = Xml.Document;
-      r._children = new Array();
-      return r;
-   }
-
-   public var nodeType(default,null) : XmlType;
-
-   public var nodeName(get,set) : String;
-
-   public var nodeValue(get,set) : String;
-
-
-   private function get_nodeName() : String {
-      if( nodeType != Xml.Element )
-         throw "bad nodeType";
-      return _nodeName;
-   }
-
-   private function set_nodeName( n : String ) : String {
-      if( nodeType != Xml.Element )
-         throw "bad nodeType";
-      return _nodeName = n;
-   }
-
-   private function get_nodeValue() : String {
-      if( nodeType == Xml.Element || nodeType == Xml.Document )
-         throw "bad nodeType";
-      return _nodeValue;
-   }
-
-   private function set_nodeValue( v : String ) : String {
-      if( nodeType == Xml.Element || nodeType == Xml.Document )
-         throw "bad nodeType";
-      return _nodeValue = v;
-   }
-
-   public var parent(get,null) : Xml;
-   private function get_parent() : Xml {
-      return _parent;
-   }
-
-   public function get( att : String ) : String {
-      if( nodeType != Xml.Element )
-         throw "bad nodeType";
-      return Reflect.field( _attributes, att );
-   }
-
-   public function set( att : String, value : String ) : Void {
-      if( nodeType != Xml.Element )
-         throw "bad nodeType";
-      if (_attributes==null)
-         _attributes = {};
-      Reflect.setField (_attributes, att, value );
-      return;
-   }
-
-   public function remove( att : String ) : Void{
-      if( nodeType != Xml.Element )
-         throw "bad nodeType";
-      Reflect.deleteField( _attributes, att );
-      return;
-   }
-
-   public function exists( att : String ) : Bool {
-      if( nodeType != Xml.Element )
-         throw "bad nodeType";
-      return Reflect.hasField( _attributes, att );
-   }
-
-   public function attributes() : Iterator<String> {
-      if( nodeType != Xml.Element )
-         throw "bad nodeType";
-      return Reflect.fields( _attributes ).iterator();
-   }
-
-   public function iterator() : Iterator<Xml> {
-      if( _children == null )
-         throw "bad nodetype";
-      return untyped _children.iterator();
-   }
-
-
-   public function elements(): Iterator<Xml>
-   {
-      if( _children == null )
-         throw "bad nodetype";
-      return new NativeXmlIterator(_children);
-   }
-
-   public function elementsNamed( name : String ) : Iterator<Xml>
-   {
-      if( _children == null )
-         throw "bad nodetype";
-      return new NativeXmlNamedIterator(_children,name);
-   }
-
-   public function firstChild() : Xml {
-      if( _children == null )
-         throw "bad nodetype";
-      return _children[0];
-   }
-
-   public function firstElement() : Xml {
-      if( _children == null )
-         throw "bad nodetype";
-      for( cur in 0..._children.length ) {
-         var n:Xml = _children[cur];
-         if( n.nodeType == Xml.Element )
-            return n;
-      }
-      return null;
-   }
-
-   public function addChild( x : Xml ) : Void {
-      if( _children == null )
-         throw "bad nodetype";
-      if( x._parent != null ) x._parent._children.remove(x);
-      x._parent = this;
-      _children.push( x );
-      return;
-   }
-
-   public function removeChild( x : Xml ) : Bool {
-      if( _children == null )
-         throw "bad nodetype";
-      var b = _children.remove( x );
-      if( b ) x._parent = null;
-      return b;
-   }
-
-   public function insertChild( x : Xml, pos : Int ) : Void {
-      if( _children == null )
-         throw "bad nodetype";
-      if( x._parent != null ) x._parent._children.remove(x);
-      x._parent = this;
-      _children.insert( pos, x );
-      return;
-   }
-
-   public function toString() : String {
-      var s = new StringBuf();
-      toStringRec(s);
-      return s.toString();
-   }
-
-   private function toStringRec(s: StringBuf) : Void {
-      switch( nodeType ) {
-      case Xml.Document:
-         for( x in _children )
-            x.toStringRec(s);
-      case Xml.Element:
-         s.addChar("<".code);
-         s.add(_nodeName);
-         for( k in Reflect.fields(_attributes) ) {
-            s.addChar(" ".code);
-            s.add(k);
-            s.addChar("=".code);
-            s.addChar("\"".code);
-            s.add(Reflect.field(_attributes,k));
-            s.addChar("\"".code);
-         }
-         if( _children.length == 0 ) {
-            s.addChar("/".code);
-            s.addChar(">".code);
-            return;
-         }
-         s.addChar(">".code);
-         for( x in _children )
-            x.toStringRec(s);
-         s.addChar("<".code);
-         s.addChar("/".code);
-         s.add(_nodeName);
-         s.addChar(">".code);
-      case Xml.PCData:
-         s.add(StringTools.htmlEscape(_nodeValue));
-      case Xml.CData:
-         s.add("<![CDATA[");
-         s.add(_nodeValue);
-         s.add("]]>");
-      case Xml.Comment:
-         s.add("<!--");
-         s.add(_nodeValue);
-         s.add("-->");
-      case Xml.DocType:
-         s.add("<!DOCTYPE ");
-         s.add(_nodeValue);
-         s.add(">");
-      case Xml.ProcessingInstruction:
-         s.add("<?");
-         s.add(_nodeValue);
-         s.add("?>");
-      }
-   }
-
+	static inline var Element = XmlType.Element;
+	static inline var PCData = XmlType.PCData;
+	static inline var CData = XmlType.CData;
+	static inline var Comment = XmlType.Comment;
+	static inline var DocType = XmlType.DocType;
+	static inline var ProcessingInstruction = XmlType.ProcessingInstruction;
+	static inline var Document = XmlType.Document;
+
+	private var _nodeName:String;
+	private var _nodeValue:String;
+	private var _attributes:Dynamic<String>;
+	private var _children:Array<Xml>;
+	private var _parent:Xml;
+
+	function new():Void {}
+
+	@:native("parse_xml")
+	extern static function parse_xml(str:String, state:NativeXmlState);
+
+	public static function parse(str:String):Xml {
+		var x = new Xml();
+		var state = new NativeXmlState(x);
+		parse_xml(str, state);
+		x.nodeType = Xml.Document;
+		return x;
+	}
+
+	public static function createElement(name:String):Xml {
+		var r = new Xml();
+		r.nodeType = Xml.Element;
+		r._nodeName = name;
+		r._attributes = null;
+		r._children = new Array();
+		return r;
+	}
+
+	public static function createPCData(data:String):Xml {
+		var r = new Xml();
+		r.nodeType = Xml.PCData;
+		r._nodeValue = data;
+		return r;
+	}
+
+	public static function createCData(data:String):Xml {
+		var r = new Xml();
+		r.nodeType = Xml.CData;
+		r._nodeValue = data;
+		return r;
+	}
+
+	public static function createComment(data:String):Xml {
+		var r = new Xml();
+		r.nodeType = Xml.Comment;
+		r._nodeValue = data;
+		return r;
+	}
+
+	public static function createDocType(data:String):Xml {
+		var r = new Xml();
+		r.nodeType = Xml.DocType;
+		r._nodeValue = data;
+		return r;
+	}
+
+	public static function createProcessingInstruction(data:String):Xml {
+		var r = new Xml();
+		r.nodeType = Xml.ProcessingInstruction;
+		r._nodeValue = data;
+		return r;
+	}
+
+	public static function createDocument():Xml {
+		var r = new Xml();
+		r.nodeType = Xml.Document;
+		r._children = new Array();
+		return r;
+	}
+
+	public var nodeType(default, null):XmlType;
+
+	public var nodeName(get, set):String;
+
+	public var nodeValue(get, set):String;
+
+	private function get_nodeName():String {
+		if (nodeType != Xml.Element)
+			throw "bad nodeType";
+		return _nodeName;
+	}
+
+	private function set_nodeName(n:String):String {
+		if (nodeType != Xml.Element)
+			throw "bad nodeType";
+		return _nodeName = n;
+	}
+
+	private function get_nodeValue():String {
+		if (nodeType == Xml.Element || nodeType == Xml.Document)
+			throw "bad nodeType";
+		return _nodeValue;
+	}
+
+	private function set_nodeValue(v:String):String {
+		if (nodeType == Xml.Element || nodeType == Xml.Document)
+			throw "bad nodeType";
+		return _nodeValue = v;
+	}
+
+	public var parent(get, null):Xml;
+
+	private function get_parent():Xml {
+		return _parent;
+	}
+
+	public function get(att:String):String {
+		if (nodeType != Xml.Element)
+			throw "bad nodeType";
+		return Reflect.field(_attributes, att);
+	}
+
+	public function set(att:String, value:String):Void {
+		if (nodeType != Xml.Element)
+			throw "bad nodeType";
+		if (_attributes == null)
+			_attributes = {};
+		Reflect.setField(_attributes, att, value);
+		return;
+	}
+
+	public function remove(att:String):Void {
+		if (nodeType != Xml.Element)
+			throw "bad nodeType";
+		Reflect.deleteField(_attributes, att);
+		return;
+	}
+
+	public function exists(att:String):Bool {
+		if (nodeType != Xml.Element)
+			throw "bad nodeType";
+		return Reflect.hasField(_attributes, att);
+	}
+
+	public function attributes():Iterator<String> {
+		if (nodeType != Xml.Element)
+			throw "bad nodeType";
+		return Reflect.fields(_attributes).iterator();
+	}
+
+	public function iterator():Iterator<Xml> {
+		if (_children == null)
+			throw "bad nodetype";
+		return untyped _children.iterator();
+	}
+
+	public function elements():Iterator<Xml> {
+		if (_children == null)
+			throw "bad nodetype";
+		return new NativeXmlIterator(_children);
+	}
+
+	public function elementsNamed(name:String):Iterator<Xml> {
+		if (_children == null)
+			throw "bad nodetype";
+		return new NativeXmlNamedIterator(_children, name);
+	}
+
+	public function firstChild():Xml {
+		if (_children == null)
+			throw "bad nodetype";
+		return _children[0];
+	}
+
+	public function firstElement():Xml {
+		if (_children == null)
+			throw "bad nodetype";
+		for (cur in 0..._children.length) {
+			var n:Xml = _children[cur];
+			if (n.nodeType == Xml.Element)
+				return n;
+		}
+		return null;
+	}
+
+	public function addChild(x:Xml):Void {
+		if (_children == null)
+			throw "bad nodetype";
+		if (x._parent != null)
+			x._parent._children.remove(x);
+		x._parent = this;
+		_children.push(x);
+		return;
+	}
+
+	public function removeChild(x:Xml):Bool {
+		if (_children == null)
+			throw "bad nodetype";
+		var b = _children.remove(x);
+		if (b)
+			x._parent = null;
+		return b;
+	}
+
+	public function insertChild(x:Xml, pos:Int):Void {
+		if (_children == null)
+			throw "bad nodetype";
+		if (x._parent != null)
+			x._parent._children.remove(x);
+		x._parent = this;
+		_children.insert(pos, x);
+		return;
+	}
+
+	public function toString():String {
+		var s = new StringBuf();
+		toStringRec(s);
+		return s.toString();
+	}
+
+	private function toStringRec(s:StringBuf):Void {
+		switch (nodeType) {
+			case Xml.Document:
+				for (x in _children)
+					x.toStringRec(s);
+			case Xml.Element:
+				s.addChar("<".code);
+				s.add(_nodeName);
+				for (k in Reflect.fields(_attributes)) {
+					s.addChar(" ".code);
+					s.add(k);
+					s.addChar("=".code);
+					s.addChar("\"".code);
+					s.add(Reflect.field(_attributes, k));
+					s.addChar("\"".code);
+				}
+				if (_children.length == 0) {
+					s.addChar("/".code);
+					s.addChar(">".code);
+					return;
+				}
+				s.addChar(">".code);
+				for (x in _children)
+					x.toStringRec(s);
+				s.addChar("<".code);
+				s.addChar("/".code);
+				s.add(_nodeName);
+				s.addChar(">".code);
+			case Xml.PCData:
+				s.add(StringTools.htmlEscape(_nodeValue));
+			case Xml.CData:
+				s.add("<![CDATA[");
+				s.add(_nodeValue);
+				s.add("]]>");
+			case Xml.Comment:
+				s.add("<!--");
+				s.add(_nodeValue);
+				s.add("-->");
+			case Xml.DocType:
+				s.add("<!DOCTYPE ");
+				s.add(_nodeValue);
+				s.add(">");
+			case Xml.ProcessingInstruction:
+				s.add("<?");
+				s.add(_nodeValue);
+				s.add("?>");
+		}
+	}
 }
 }

+ 21 - 0
std/cpp/NativeXmlImport.cpp

@@ -1,3 +1,24 @@
+/*
+ * Copyright (C)2005-2019 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.
+ */
 
 
 #ifdef EPPC
 #ifdef EPPC
 #include <memory>
 #include <memory>

+ 2 - 2
std/cpp/Object.hx

@@ -19,8 +19,8 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:noPackageRestrict
 @:noPackageRestrict
 typedef Object = Dynamic;
 typedef Object = Dynamic;
-

+ 36 - 16
std/cpp/ObjectType.hx

@@ -1,19 +1,39 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
-extern class ObjectType
-{
-   public inline static var vtUnknown = -1;
-   public inline static var vtInt = 0xff;
-   public inline static var vtNull = 0;
-   public inline static var vtFloat = 1;
-   public inline static var vtBool = 2;
-   public inline static var vtString = 3;
-   public inline static var vtObject = 4;
-   public inline static var vtArray = 5;
-   public inline static var vtFunction = 6;
-   public inline static var vtEnum = 7;
-   public inline static var vtClass = 8;
-   public inline static var vtInt64 = 9;
-   public inline static var vtAbstractBase = 0x100;
+extern class ObjectType {
+	public inline static var vtUnknown = -1;
+	public inline static var vtInt = 0xff;
+	public inline static var vtNull = 0;
+	public inline static var vtFloat = 1;
+	public inline static var vtBool = 2;
+	public inline static var vtString = 3;
+	public inline static var vtObject = 4;
+	public inline static var vtArray = 5;
+	public inline static var vtFunction = 6;
+	public inline static var vtEnum = 7;
+	public inline static var vtClass = 8;
+	public inline static var vtInt64 = 9;
+	public inline static var vtAbstractBase = 0x100;
 }
 }
-

+ 42 - 48
std/cpp/Pointer.hx

@@ -19,72 +19,66 @@
  * 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 cpp;
+
+package cpp;
 
 
 import haxe.extern.AsVar;
 import haxe.extern.AsVar;
 
 
 @:coreType
 @:coreType
 @:semantics(variable)
 @:semantics(variable)
-extern class Pointer<T> extends ConstPointer<T> implements ArrayAccess<T>
-{
-   public var ref(get,set):Reference<T>;
-
-   public function get_ref() : Reference<T>;
-   public function set_ref(t:T) : Reference<T>;
+extern class Pointer<T> extends ConstPointer<T> implements ArrayAccess<T> {
+	public var ref(get, set):Reference<T>;
 
 
-   public function setAt(inIndex:Int, value:T):Void;
+	public function get_ref():Reference<T>;
+	public function set_ref(t:T):Reference<T>;
 
 
-   public static function fromRaw<T>(ptr:RawPointer<T>) : Pointer<T>;
+	public function setAt(inIndex:Int, value:T):Void;
 
 
-   @:native("::cpp::Pointer_obj::fromRaw")
-   public static function fromStar<T>(star:Star<T>) : Pointer<T>;
+	public static function fromRaw<T>(ptr:RawPointer<T>):Pointer<T>;
 
 
-   @:native("::cpp::Pointer_obj::fromHandle")
-   static function nativeFromHandle<T>(inHandle:Dynamic,?inKind:String):AutoCast;
-   inline public static function fromHandle<T>(inHandle:Dynamic,?inKind:String) : Pointer<T>
-   {
-     return cast nativeFromHandle(inHandle,inKind);
-   }
+	@:native("::cpp::Pointer_obj::fromRaw")
+	public static function fromStar<T>(star:Star<T>):Pointer<T>;
 
 
-   public static function fromPointer<T>(inNativePointer:Dynamic) : Pointer<T>;
+	@:native("::cpp::Pointer_obj::fromHandle")
+	static function nativeFromHandle<T>(inHandle:Dynamic, ?inKind:String):AutoCast;
+	inline public static function fromHandle<T>(inHandle:Dynamic, ?inKind:String):Pointer<T> {
+		return cast nativeFromHandle(inHandle, inKind);
+	}
 
 
-   public static function addressOf<T>(inVariable:cpp.Reference<T>) : Pointer<T>;
+	public static function fromPointer<T>(inNativePointer:Dynamic):Pointer<T>;
 
 
-   public static function endOf<T:{}>(inVariable:T) : Pointer<cpp.Void>;
+	public static function addressOf<T>(inVariable:cpp.Reference<T>):Pointer<T>;
 
 
-   @:native("::cpp::Pointer_obj::arrayElem")
-   static function nativeArrayElem<T>(array:Array<T>, inElem:Int):AutoCast;
-   inline static function arrayElem<T>(array:Array<T>, inElem:Int):Pointer<T>
-   {
-      return cast nativeArrayElem(array,inElem);
-   }
+	public static function endOf<T:{}>(inVariable:T):Pointer<cpp.Void>;
 
 
-   @:native("::cpp::Pointer_obj::ofArray")
-   static function nativeOfArray<T>(array:Array<T>):AutoCast;
-   inline public static function ofArray<T>(array:Array<T>):Pointer<T>
-   {
-     return cast nativeOfArray(array);
-   }
+	@:native("::cpp::Pointer_obj::arrayElem")
+	static function nativeArrayElem<T>(array:Array<T>, inElem:Int):AutoCast;
+	inline static function arrayElem<T>(array:Array<T>, inElem:Int):Pointer<T> {
+		return cast nativeArrayElem(array, inElem);
+	}
 
 
-   inline public function toUnmanagedArray(elementCount:Int) : Array<T>
-   {
-      var result = new Array<T>();
-      NativeArray.setUnmanagedData(result,this,elementCount);
-      return result;
-   }
+	@:native("::cpp::Pointer_obj::ofArray")
+	static function nativeOfArray<T>(array:Array<T>):AutoCast;
+	inline public static function ofArray<T>(array:Array<T>):Pointer<T> {
+		return cast nativeOfArray(array);
+	}
 
 
-   inline public function toUnmanagedVector(elementCount:Int) : haxe.ds.Vector<T>
-      return cast toUnmanagedArray(elementCount);
+	inline public function toUnmanagedArray(elementCount:Int):Array<T> {
+		var result = new Array<T>();
+		NativeArray.setUnmanagedData(result, this, elementCount);
+		return result;
+	}
 
 
+	inline public function toUnmanagedVector(elementCount:Int):haxe.ds.Vector<T>
+		return cast toUnmanagedArray(elementCount);
 
 
-   override public function inc():Pointer<T>;
-   override public function dec():Pointer<T>;
-   override public function incBy(inT:Int):Pointer<T>;
-   override public function add(inT:Int):Pointer<T>;
+	override public function inc():Pointer<T>;
+	override public function dec():Pointer<T>;
+	override public function incBy(inT:Int):Pointer<T>;
+	override public function add(inT:Int):Pointer<T>;
 
 
-   public function postIncRef():Reference<T>;
+	public function postIncRef():Reference<T>;
 
 
-   public function destroy():Void;
-   public function destroyArray():Void;
+	public function destroy():Void;
+	public function destroyArray():Void;
 }
 }
-

+ 76 - 81
std/cpp/Prime.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
 package cpp;
 
 
 #if macro
 #if macro
@@ -29,94 +30,88 @@ import haxe.macro.Expr;
 
 
 @:noPackageRestrict
 @:noPackageRestrict
 class Prime {
 class Prime {
-
-   #if (!macro && cpp)
-
-	public static function _loadPrime( lib : String, prim : String, signature : String, quietFail = false ) : Dynamic {
-		var factory:Callable< ConstCharStar -> Object > =
-               untyped __global__.__hxcpp_cast_get_proc_address(lib, prim + "__prime", quietFail);
-      if (factory!=null)
-      {
-         var func:Dynamic = factory.call(signature);
-         if (func==null && !quietFail)
-            throw '$prim does not have signature $signature';
-         return func;
-      }
-      return null;
+	#if (!macro && cpp)
+	public static function _loadPrime(lib:String, prim:String, signature:String, quietFail = false):Dynamic {
+		var factory:Callable<ConstCharStar->Object> = untyped __global__.__hxcpp_cast_get_proc_address(lib, prim + "__prime", quietFail);
+		if (factory != null) {
+			var func:Dynamic = factory.call(signature);
+			if (func == null && !quietFail)
+				throw '$prim does not have signature $signature';
+			return func;
+		}
+		return null;
 	}
 	}
-   #end
-
-   #if (macro)
-   static function codeToType(code:String,forCpp:Bool) : String
-   {
-      if (code=="c" && !forCpp)
-         throw "const char * type only supported in cpp mode";
-
-      switch(code)
-      {
-         case "b" : return "Bool";
-         case "i" : return "Int";
-         case "d" : return "Float";
-         case "s" : return "String";
-         case "f" : return forCpp ? "cpp.Float32" : "Float";
-         case "o" : return forCpp ? "cpp.Object" : "Dynamic";
-         case "v" : return forCpp ? "cpp.Void" : "Dynamic";
-         case "c" : return "cpp.ConstCharStar";
-         default:
-            throw "Unknown signature type :" + code;
-      }
-   }
-   #end
+	#end
 
 
-   public static function nekoInit(inModuleName:String) : Bool
-   {
-      #if neko
-      var init = neko.Lib.load(inModuleName, "neko_init", 5);
+	#if (macro)
+	static function codeToType(code:String, forCpp:Bool):String {
+		if (code == "c" && !forCpp)
+			throw "const char * type only supported in cpp mode";
 
 
-      if (init != null)
-      {
-         init( function(s) return new String(s),
-               function(len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; },
-               null,
-               true,
-               false);
-         return true;
-
-      }
-      #end
-      return false;
-   }
+		switch (code) {
+			case "b":
+				return "Bool";
+			case "i":
+				return "Int";
+			case "d":
+				return "Float";
+			case "s":
+				return "String";
+			case "f":
+				return forCpp ? "cpp.Float32" : "Float";
+			case "o":
+				return forCpp ? "cpp.Object" : "Dynamic";
+			case "v":
+				return forCpp ? "cpp.Void" : "Dynamic";
+			case "c":
+				return "cpp.ConstCharStar";
+			default:
+				throw "Unknown signature type :" + code;
+		}
+	}
+	#end
 
 
+	public static function nekoInit(inModuleName:String):Bool {
+		#if neko
+		var init = neko.Lib.load(inModuleName, "neko_init", 5);
 
 
-   public static macro function load(inModule:String, inName:String, inSig:String,inAllowFail:Bool = false)
-   {
-      var parts = inSig.split("");
-      if (parts.length<1)
-         throw "Invalid function signature " + inSig;
-      var argCount = parts.length-1;
+		if (init != null) {
+			init(function(s) return new String(s), function(len:Int) {
+				var r = [];
+				if (len > 0)
+					r[len - 1] = null;
+				return r;
+			}, null, true, false);
+			return true;
+		}
+		#end
+		return false;
+	}
 
 
-      var cppiaMode = Context.defined("cppia");
-      var cppMode = Context.defined("cpp") && !cppiaMode;
+	public static macro function load(inModule:String, inName:String, inSig:String, inAllowFail:Bool = false) {
+		var parts = inSig.split("");
+		if (parts.length < 1)
+			throw "Invalid function signature " + inSig;
+		var argCount = parts.length - 1;
 
 
-      var typeString = parts.length==1 ? "Void" : codeToType(parts.shift(),cppMode);
-      for(p in parts)
-         typeString += "->" + codeToType(p,cppMode);
+		var cppiaMode = Context.defined("cppia");
+		var cppMode = Context.defined("cpp") && !cppiaMode;
 
 
-      if (cppMode)
-      {
-         typeString = "cpp.Callable<" + typeString + ">";
-         var expr = 'new $typeString(cpp.Prime._loadPrime("$inModule","$inName","$inSig",$inAllowFail))';
-         return Context.parse( expr, Context.currentPos() );
-      }
-      else
-      {
-         if (argCount>5)
-            argCount = -1;
-         var lazy = inAllowFail ? "loadLazy" : "load";
-         var lib = cppiaMode ? "cpp" : "neko";
-         var expr = 'new cpp.Callable<$typeString>($lib.Lib.$lazy("$inModule","$inName",$argCount))';
-         return Context.parse( expr, Context.currentPos() );
-      }
-   }
+		var typeString = parts.length == 1 ? "Void" : codeToType(parts.shift(), cppMode);
+		for (p in parts)
+			typeString += "->" + codeToType(p, cppMode);
 
 
+		if (cppMode) {
+			typeString = "cpp.Callable<" + typeString + ">";
+			var expr = 'new $typeString(cpp.Prime._loadPrime("$inModule","$inName","$inSig",$inAllowFail))';
+			return Context.parse(expr, Context.currentPos());
+		} else {
+			if (argCount > 5)
+				argCount = -1;
+			var lazy = inAllowFail ? "loadLazy" : "load";
+			var lib = cppiaMode ? "cpp" : "neko";
+			var expr = 'new cpp.Callable<$typeString>($lib.Lib.$lazy("$inModule","$inName",$argCount))';
+			return Context.parse(expr, Context.currentPos());
+		}
+	}
 }
 }

+ 7 - 8
std/cpp/Random.hx

@@ -19,26 +19,25 @@
  * 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 cpp;
 package cpp;
 
 
 class Random {
 class Random {
-
-	var r : Dynamic;
+	var r:Dynamic;
 
 
 	public function new() {
 	public function new() {
 		r = cpp.NativeRandom.random_new();
 		r = cpp.NativeRandom.random_new();
 	}
 	}
 
 
-	public function setSeed( s : Int ) {
-		cpp.NativeRandom.random_set_seed(r,s);
+	public function setSeed(s:Int) {
+		cpp.NativeRandom.random_set_seed(r, s);
 	}
 	}
 
 
-	public function int( max : Int ) : Int {
-		return cpp.NativeRandom.random_int(r,max);
+	public function int(max:Int):Int {
+		return cpp.NativeRandom.random_int(r, max);
 	}
 	}
 
 
-	public function float() : Float {
+	public function float():Float {
 		return cpp.NativeRandom.random_float(r);
 		return cpp.NativeRandom.random_float(r);
 	}
 	}
-
 }
 }

+ 5 - 5
std/cpp/RawConstPointer.hx

@@ -19,11 +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 cpp;
+
+package cpp;
 
 
 @:unreflective
 @:unreflective
-extern class RawConstPointer<T> implements ArrayAccess<T>
-{
-   @:native("hx::AddressOf")
-   public static function addressOf<T>(t:T) : RawConstPointer<T>;
+extern class RawConstPointer<T> implements ArrayAccess<T> {
+	@:native("hx::AddressOf")
+	public static function addressOf<T>(t:T):RawConstPointer<T>;
 }
 }

+ 5 - 5
std/cpp/RawPointer.hx

@@ -19,11 +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 cpp;
+
+package cpp;
 
 
 @:unreflective
 @:unreflective
-extern class RawPointer<T> extends RawConstPointer<T>
-{
-   @:native("hx::AddressOf")
-   public static function addressOf<T>(t:T) : RawPointer<T>;
+extern class RawPointer<T> extends RawConstPointer<T> {
+	@:native("hx::AddressOf")
+	public static function addressOf<T>(t:T):RawPointer<T>;
 }
 }

+ 5 - 4
std/cpp/Reference.hx

@@ -19,11 +19,12 @@
  * 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 cpp;
 package cpp;
 
 
-// Allows haxe to type result correctly, and hxcpp can recognise this and prevent
-//  unwanted casting
+/**
+	Allows haxe to type result correctly, and hxcpp can recognise this and
+	prevent unwanted casting.
+**/
 @:semantics(reference)
 @:semantics(reference)
 typedef Reference<T> = T;
 typedef Reference<T> = T;
-
-

+ 3 - 3
std/cpp/SizeT.hx

@@ -19,9 +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.
  */
  */
- package cpp;
+
+package cpp;
 
 
 @:native("size_t")
 @:native("size_t")
 @:scalar @:coreType @:notNull
 @:scalar @:coreType @:notNull
-extern abstract SizeT from(Int) to(Int) {
-}
+extern abstract SizeT from(Int) to(Int) {}

+ 5 - 3
std/cpp/Star.hx

@@ -19,9 +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 cpp;
 package cpp;
 
 
-// Allows haxe to type result correctly, and hxcpp can recognise this use the correct type
+/**
+	Allows haxe to type result correctly, and hxcpp can recognise this use the
+	correct type.
+**/
 typedef Star<T> = Null<T>;
 typedef Star<T> = Null<T>;
-
-

+ 37 - 19
std/cpp/StdString.hx

@@ -1,3 +1,25 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 using cpp.NativeString;
 using cpp.NativeString;
@@ -7,25 +29,21 @@ using cpp.NativeString;
 @:stackOnly
 @:stackOnly
 @:structAccess
 @:structAccess
 @:unreflective
 @:unreflective
-extern class StdString
-{
-   @:native("std::string::npos")
-   public static var npos(default,null):Int;
-
-   //public function new(inData:StdStringData);
+extern class StdString {
+	@:native("std::string::npos")
+	public static var npos(default, null):Int;
 
 
-   @:native("hx::StdString")
-   static public function ofString(s:String) : StdString;
-   //public function toString():String;
-   //public function find(s:String):Int;
-   //public function substr(pos:Int, len:Int):StdString;
-
-   public function c_str() : ConstPointer<Char>;
-   public function size() : Int;
-   public function find(s:String):Int;
-   public function substr(pos:Int, len:Int):StdString;
-   public function toString():String;
-   public function toStdString():StdString;
+	// public function new(inData:StdStringData);
+	@:native("hx::StdString")
+	static public function ofString(s:String):StdString;
 
 
+	// public function toString():String;
+	// public function find(s:String):Int;
+	// public function substr(pos:Int, len:Int):StdString;
+	public function c_str():ConstPointer<Char>;
+	public function size():Int;
+	public function find(s:String):Int;
+	public function substr(pos:Int, len:Int):StdString;
+	public function toString():String;
+	public function toStdString():StdString;
 }
 }
-

+ 29 - 9
std/cpp/StdStringRef.hx

@@ -1,3 +1,25 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 using cpp.NativeString;
 using cpp.NativeString;
@@ -5,13 +27,11 @@ using cpp.NativeString;
 @:native("hx::StdString const &")
 @:native("hx::StdString const &")
 @:include("hx/StdString.h")
 @:include("hx/StdString.h")
 @:structAccess
 @:structAccess
-extern class StdStringRef
-{
-   public function c_str() : ConstPointer<Char>;
-   public function size() : Int;
-   public function find(s:String):Int;
-   public function substr(pos:Int, len:Int):StdString;
-   public function toString():String;
-   public function toStdString():StdString;
+extern class StdStringRef {
+	public function c_str():ConstPointer<Char>;
+	public function size():Int;
+	public function find(s:String):Int;
+	public function substr(pos:Int, len:Int):StdString;
+	public function toString():String;
+	public function toStdString():StdString;
 }
 }
-

+ 12 - 14
std/cpp/Stdio.hx

@@ -19,27 +19,25 @@
  * 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 cpp;
 package cpp;
 
 
 import haxe.extern.Rest;
 import haxe.extern.Rest;
 
 
 @:include("stdio.h")
 @:include("stdio.h")
-extern class Stdio
-{
-   @:native("printf")
-   public static function printf(format:ConstCharStar, rest:Rest<VarArg>):Void;
-
-   @:native("fopen")
-   public static function fopen(filename:ConstCharStar, mode:ConstCharStar) : FILE;
+extern class Stdio {
+	@:native("printf")
+	public static function printf(format:ConstCharStar, rest:Rest<VarArg>):Void;
 
 
-   @:native("fwrite")
-   public static function fwrite<T>(data:RawPointer<T>, elemSize:SizeT, elemCount:SizeT, file:FILE ) : SizeT;
+	@:native("fopen")
+	public static function fopen(filename:ConstCharStar, mode:ConstCharStar):FILE;
 
 
-   @:native("fclose")
-   public static function fclose(file:FILE) : Int;
+	@:native("fwrite")
+	public static function fwrite<T>(data:RawPointer<T>, elemSize:SizeT, elemCount:SizeT, file:FILE):SizeT;
 
 
+	@:native("fclose")
+	public static function fclose(file:FILE):Int;
 
 
-   @:native("fprintf")
-   public static function fprintf(file:FILE,format:ConstCharStar, rest:Rest<VarArg>):Void;
+	@:native("fprintf")
+	public static function fprintf(file:FILE, format:ConstCharStar, rest:Rest<VarArg>):Void;
 }
 }
-

+ 33 - 36
std/cpp/Stdlib.hx

@@ -23,40 +23,37 @@
 package cpp;
 package cpp;
 
 
 @:include("stdlib.h")
 @:include("stdlib.h")
-extern class Stdlib
-{
-   @:native("malloc")
-   public static function nativeMalloc(bytes:Int) : cpp.RawPointer<cpp.Void>;
-   @:native("calloc")
-   public static function nativeCalloc(bytes:Int) : cpp.RawPointer<cpp.Void>;
-   @:native("realloc")
-   public static function nativeRealloc(inPtr:cpp.RawPointer<cpp.Void>,bytes:Int) : cpp.RawPointer<cpp.Void>;
-   @:native("free")
-   public static function nativeFree(ptr:cpp.RawPointer<cpp.Void>) : Void;
-   @:native("memcpy")
-   public static function nativeMemcpy(dest:cpp.RawPointer<cpp.Void>, src:cpp.RawConstPointer<cpp.Void>, bytes:Int) : Void;
-
-   @:native("hx::ClassSizeOf") @:templatedCall
-   public static function sizeof<T>(t:T) : Int;
-
-   inline public static function memcpy<DEST,SRC>(dest:cpp.Pointer<DEST>, src:cpp.ConstPointer<SRC>, bytes:Int) : Void
-      nativeMemcpy(cast dest.ptr, cast src.ptr, bytes);
-
-   inline public static function malloc<T>(bytes:Int) : cpp.Pointer<T>
-      return cast nativeMalloc(bytes);
-
-   inline public static function calloc<T>(bytes:Int) : cpp.Pointer<T>
-      return cast nativeCalloc(bytes);
-
-   inline public static function realloc<T>(ioPtr:cpp.Pointer<T>, bytes:Int) : Void
-      ioPtr.setRaw( nativeRealloc(cast ioPtr.ptr, bytes) );
-
-   inline public static function free<T>(ptr:cpp.Pointer<T>) : Void
-   {
-      if (ptr!=null)
-      {
-         nativeFree(cast ptr.ptr);
-         ptr.ptr = null;
-      }
-   }
+extern class Stdlib {
+	@:native("malloc")
+	public static function nativeMalloc(bytes:Int):cpp.RawPointer<cpp.Void>;
+	@:native("calloc")
+	public static function nativeCalloc(bytes:Int):cpp.RawPointer<cpp.Void>;
+	@:native("realloc")
+	public static function nativeRealloc(inPtr:cpp.RawPointer<cpp.Void>, bytes:Int):cpp.RawPointer<cpp.Void>;
+	@:native("free")
+	public static function nativeFree(ptr:cpp.RawPointer<cpp.Void>):Void;
+	@:native("memcpy")
+	public static function nativeMemcpy(dest:cpp.RawPointer<cpp.Void>, src:cpp.RawConstPointer<cpp.Void>, bytes:Int):Void;
+
+	@:native("hx::ClassSizeOf") @:templatedCall
+	public static function sizeof<T>(t:T):Int;
+
+	inline public static function memcpy<DEST, SRC>(dest:cpp.Pointer<DEST>, src:cpp.ConstPointer<SRC>, bytes:Int):Void
+		nativeMemcpy(cast dest.ptr, cast src.ptr, bytes);
+
+	inline public static function malloc<T>(bytes:Int):cpp.Pointer<T>
+		return cast nativeMalloc(bytes);
+
+	inline public static function calloc<T>(bytes:Int):cpp.Pointer<T>
+		return cast nativeCalloc(bytes);
+
+	inline public static function realloc<T>(ioPtr:cpp.Pointer<T>, bytes:Int):Void
+		ioPtr.setRaw(nativeRealloc(cast ioPtr.ptr, bytes));
+
+	inline public static function free<T>(ptr:cpp.Pointer<T>):Void {
+		if (ptr != null) {
+			nativeFree(cast ptr.ptr);
+			ptr.ptr = null;
+		}
+	}
 }
 }

+ 4 - 4
std/cpp/Struct.hx

@@ -19,10 +19,10 @@
  * 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 cpp;
 package cpp;
 
 
-// Wrap external types with a class that integrates with Dynamic
+/**
+	Wraps external types with a class that integrates with Dynamic.
+**/
 typedef Struct<T> = T;
 typedef Struct<T> = T;
-
-
-

+ 2 - 1
std/cpp/UInt16.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract UInt16 from Int to Int {}
 @:coreType @:notNull @:runtimeValue abstract UInt16 from Int to Int {}

+ 2 - 1
std/cpp/UInt32.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract UInt32 from Int to Int {}
 @:coreType @:notNull @:runtimeValue abstract UInt32 from Int to Int {}

+ 2 - 1
std/cpp/UInt64.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract UInt64 from Int to Int {}
 @:coreType @:notNull @:runtimeValue abstract UInt64 from Int to Int {}

+ 2 - 1
std/cpp/UInt8.hx

@@ -19,6 +19,7 @@
  * 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 cpp;
+
+package cpp;
 
 
 @:coreType @:notNull @:runtimeValue abstract UInt8 from Int to Int {}
 @:coreType @:notNull @:runtimeValue abstract UInt8 from Int to Int {}

+ 5 - 4
std/cpp/VarArg.hx

@@ -19,10 +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 cpp;
 package cpp;
 
 
-// Allows haxe to type params correctly, and hxcpp can recognise this use the correct type
+/**
+	Allows haxe to type params correctly, and hxcpp can recognise this use the
+	correct type.
+**/
 typedef VarArg = Dynamic;
 typedef VarArg = Dynamic;
-
-
-

+ 115 - 61
std/cpp/VirtualArray.hx

@@ -1,78 +1,132 @@
+/*
+ * Copyright (C)2005-2019 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 cpp;
 package cpp;
 
 
 @:native("cpp::VirtualArray")
 @:native("cpp::VirtualArray")
-@:coreType extern class NativeVirtualArray implements ArrayAccess<Dynamic>
-{
-   public function new() : Void;
-   public var length(get,null) : Int;
-   // concat<T>( a:Array<T> ) : Array<T> ?
-   public function concat( a : VirtualArray ) : VirtualArray;
-   public function join( sep : String ) : String;
-   public function pop() : Dynamic;
-   public function push(x : Dynamic) : Int;
-   public function reverse() : Void;
-   public function shift() : Dynamic;
-   public function slice( pos : Int, ?end : Int ) : VirtualArray;
-   public function sort( f : Dynamic -> Dynamic -> Int ) : Void;
-   public function splice( pos : Int, len : Int ) : VirtualArray;
-   public function toString() : String;
-   public function unshift( x : Dynamic ) : Void;
-   public function insert( pos : Int, x : Dynamic ) : Void;
-   public function remove( x : Dynamic ) : Bool;
-   public function indexOf( x : Dynamic, ?fromIndex:Int ) : Int;
-   public function lastIndexOf( x : Dynamic, ?fromIndex:Int ) : Int;
-   public function copy() : VirtualArray;
-   public function iterator() : Iterator<Dynamic>;
-   public function map<S>( f : Dynamic -> S ) : VirtualArray;
-   public function filter( f : Dynamic -> Bool ) : VirtualArray;
-   public function resize( len : Int ) : Void;
+@:coreType extern class NativeVirtualArray implements ArrayAccess<Dynamic> {
+	public function new():Void;
+	public var length(get, null):Int;
+	// concat<T>( a:Array<T> ) : Array<T> ?
+	public function concat(a:VirtualArray):VirtualArray;
+	public function join(sep:String):String;
+	public function pop():Dynamic;
+	public function push(x:Dynamic):Int;
+	public function reverse():Void;
+	public function shift():Dynamic;
+	public function slice(pos:Int, ?end:Int):VirtualArray;
+	public function sort(f:Dynamic->Dynamic->Int):Void;
+	public function splice(pos:Int, len:Int):VirtualArray;
+	public function toString():String;
+	public function unshift(x:Dynamic):Void;
+	public function insert(pos:Int, x:Dynamic):Void;
+	public function remove(x:Dynamic):Bool;
+	public function indexOf(x:Dynamic, ?fromIndex:Int):Int;
+	public function lastIndexOf(x:Dynamic, ?fromIndex:Int):Int;
+	public function copy():VirtualArray;
+	public function iterator():Iterator<Dynamic>;
+	public function map<S>(f:Dynamic->S):VirtualArray;
+	public function filter(f:Dynamic->Bool):VirtualArray;
+	public function resize(len:Int):Void;
 }
 }
 
 
+abstract VirtualArray(NativeVirtualArray) {
+	// Add these two functions...
+	@:from extern inline static public function fromArray<T>(a:Array<T>):VirtualArray
+		return untyped a;
 
 
-abstract VirtualArray(NativeVirtualArray)
-{
-   // Add these two functions...
-   @:from extern inline static public function fromArray<T>(a:Array<T>) : VirtualArray
-      return untyped a;
-   @:to extern inline public function toArray<T>() : Array<T>
-      return untyped this;
+	@:to extern inline public function toArray<T>():Array<T>
+		return untyped this;
 
 
+	// The rest is just boiler-plate
+	inline public function new()
+		this = new NativeVirtualArray();
 
 
+	@:arrayAccess extern inline function get(idx:Int):Dynamic
+		return untyped this[idx];
 
 
+	@:arrayAccess extern inline function set<T>(pos:Int, value:T):T
+		return untyped this[idx] = value;
 
 
-   // The rest is just boiler-plate
-   inline public function new() this=new NativeVirtualArray();
+	public var length(get, never):Int;
 
 
-   @:arrayAccess extern inline function get(idx:Int) : Dynamic
-      return untyped this[idx];
+	extern inline public function get_length():Int
+		return this.length;
 
 
-   @:arrayAccess extern inline function set<T>(pos:Int, value:T ) : T
-      return untyped this[idx] = value;
+	// concat<T>( a:Array<T> ) : Array<T> ?
+	extern inline public function concat(a:VirtualArray):VirtualArray
+		return this.concat(a);
 
 
-   public var length(get,never) : Int;
-   extern inline public function get_length() : Int return this.length;
+	extern inline public function join(sep:String):String
+		return this.join(sep);
 
 
+	extern inline public function pop():Dynamic
+		return this.pop();
 
 
+	extern inline public function push(x:Dynamic):Int
+		return this.push(x);
 
 
-   // concat<T>( a:Array<T> ) : Array<T> ?
-   extern inline public function concat( a : VirtualArray ) : VirtualArray return this.concat(a);
-   extern inline public function join( sep : String ) : String return this.join(sep);
-   extern inline public function pop() : Dynamic return this.pop();
-   extern inline public function push(x : Dynamic) : Int return this.push(x);
-   extern inline public function reverse() : Void this.reverse();
-   extern inline public function shift() : Dynamic return this.shift();
-   extern inline public function slice( pos : Int, ?end : Int ) : VirtualArray return this.slice(pos,end);
-   extern inline public function sort( f : Dynamic -> Dynamic -> Int ) : Void this.sort(f);
-   extern inline public function splice( pos : Int, len : Int ) : VirtualArray return this.slice(pos,len);
-   extern inline public function unshift( x : Dynamic ) : Void this.unshift(x);
-   extern inline public function insert( pos : Int, x : Dynamic ) : Void this.insert(pos,x);
-   extern inline public function remove( x : Dynamic ) : Bool return this.remove(x);
-   extern inline public function indexOf( x : Dynamic, ?fromIndex:Int ) : Int return this.indexOf(x,fromIndex);
-   extern inline public function lastIndexOf( x : Dynamic, ?fromIndex:Int ) : Int return this.lastIndexOf(x,fromIndex);
-   extern inline public function copy() : VirtualArray return this.copy();
-   extern inline public function iterator() : Iterator<Dynamic> return this.iterator();
-   extern inline public function map<S>( f : Dynamic -> S ) : VirtualArray return this.map(f);
-   extern inline public function filter( f : Dynamic -> Bool ) : VirtualArray return this.filter(f);
-   extern inline public function resize( len : Int ) : Void return this.resize(len);
-}
+	extern inline public function reverse():Void
+		this.reverse();
+
+	extern inline public function shift():Dynamic
+		return this.shift();
+
+	extern inline public function slice(pos:Int, ?end:Int):VirtualArray
+		return this.slice(pos, end);
+
+	extern inline public function sort(f:Dynamic->Dynamic->Int):Void
+		this.sort(f);
+
+	extern inline public function splice(pos:Int, len:Int):VirtualArray
+		return this.slice(pos, len);
+
+	extern inline public function unshift(x:Dynamic):Void
+		this.unshift(x);
+
+	extern inline public function insert(pos:Int, x:Dynamic):Void
+		this.insert(pos, x);
 
 
+	extern inline public function remove(x:Dynamic):Bool
+		return this.remove(x);
+
+	extern inline public function indexOf(x:Dynamic, ?fromIndex:Int):Int
+		return this.indexOf(x, fromIndex);
+
+	extern inline public function lastIndexOf(x:Dynamic, ?fromIndex:Int):Int
+		return this.lastIndexOf(x, fromIndex);
+
+	extern inline public function copy():VirtualArray
+		return this.copy();
+
+	extern inline public function iterator():Iterator<Dynamic>
+		return this.iterator();
+
+	extern inline public function map<S>(f:Dynamic->S):VirtualArray
+		return this.map(f);
+
+	extern inline public function filter(f:Dynamic->Bool):VirtualArray
+		return this.filter(f);
+
+	extern inline public function resize(len:Int):Void
+		return this.resize(len);
+}

+ 3 - 3
std/cpp/Void.hx

@@ -19,8 +19,8 @@
  * 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 cpp;
 
 
-@:native("void")
-extern class Void { }
+package cpp;
 
 
+@:native("void")
+extern class Void {}

+ 41 - 27
std/cpp/_std/Date.hx

@@ -19,65 +19,79 @@
  * 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 Date {
-
+@:coreApi class Date {
 	private var mSeconds:Float;
 	private var mSeconds:Float;
 
 
-	public function new(year : Int, month : Int, day : Int, hour : Int, min : Int, sec : Int ) : Void	{
-		mSeconds = untyped __global__.__hxcpp_new_date(year,month,day,hour,min,sec);
+	public function new(year:Int, month:Int, day:Int, hour:Int, min:Int, sec:Int):Void {
+		mSeconds = untyped __global__.__hxcpp_new_date(year, month, day, hour, min, sec);
 	}
 	}
 
 
-	public function getTime() : Float {
+	public function getTime():Float {
 		return mSeconds * 1000.0;
 		return mSeconds * 1000.0;
 	}
 	}
 
 
-	public function getHours() : Int { return untyped __global__.__hxcpp_get_hours(mSeconds); }
+	public function getHours():Int {
+		return untyped __global__.__hxcpp_get_hours(mSeconds);
+	}
 
 
-	public function getMinutes() : Int { return untyped __global__.__hxcpp_get_minutes(mSeconds); }
+	public function getMinutes():Int {
+		return untyped __global__.__hxcpp_get_minutes(mSeconds);
+	}
 
 
-	public function getSeconds() : Int { return untyped __global__.__hxcpp_get_seconds(mSeconds); }
+	public function getSeconds():Int {
+		return untyped __global__.__hxcpp_get_seconds(mSeconds);
+	}
 
 
-	public function getFullYear() : Int { return untyped __global__.__hxcpp_get_year(mSeconds); }
+	public function getFullYear():Int {
+		return untyped __global__.__hxcpp_get_year(mSeconds);
+	}
 
 
-	public function getMonth() : Int { return untyped __global__.__hxcpp_get_month(mSeconds); }
+	public function getMonth():Int {
+		return untyped __global__.__hxcpp_get_month(mSeconds);
+	}
 
 
-	public function getDate() : Int { return untyped __global__.__hxcpp_get_date(mSeconds); }
+	public function getDate():Int {
+		return untyped __global__.__hxcpp_get_date(mSeconds);
+	}
 
 
-	public function getDay() : Int { return untyped __global__.__hxcpp_get_day(mSeconds); }
+	public function getDay():Int {
+		return untyped __global__.__hxcpp_get_day(mSeconds);
+	}
 
 
-	public function toString():String { return untyped __global__.__hxcpp_to_string(mSeconds); }
+	public function toString():String {
+		return untyped __global__.__hxcpp_to_string(mSeconds);
+	}
 
 
-	public static function now() : Date {
-		return fromTime( untyped __global__.__hxcpp_date_now()*1000.0);
+	public static function now():Date {
+		return fromTime(untyped __global__.__hxcpp_date_now() * 1000.0);
 	}
 	}
-  	private static function new1(t : Dynamic) : Date {
-		return  new Date(2005,1,1,0,0,0);
+
+	private static function new1(t:Dynamic):Date {
+		return new Date(2005, 1, 1, 0, 0, 0);
 	}
 	}
 
 
-	public static function fromTime( t : Float ) : Date {
-		var result = new Date(0,0,0,0,0,0);
-		result.mSeconds = t*0.001;
+	public static function fromTime(t:Float):Date {
+		var result = new Date(0, 0, 0, 0, 0, 0);
+		result.mSeconds = t * 0.001;
 		return result;
 		return result;
 	}
 	}
 
 
-	public static function fromString( s : String ) : Date {
-		switch( s.length ) {
+	public static function fromString(s:String):Date {
+		switch (s.length) {
 			case 8: // hh:mm:ss
 			case 8: // hh:mm:ss
 				var k = s.split(":");
 				var k = s.split(":");
-				var d : Date = new Date(0,0,0,Std.parseInt(k[0]),Std.parseInt(k[1]),Std.parseInt(k[2]));
+				var d:Date = new Date(0, 0, 0, Std.parseInt(k[0]), Std.parseInt(k[1]), Std.parseInt(k[2]));
 				return d;
 				return d;
 			case 10: // YYYY-MM-DD
 			case 10: // YYYY-MM-DD
 				var k = s.split("-");
 				var k = s.split("-");
-				return new Date(Std.parseInt(k[0]),Std.parseInt(k[1])-1,Std.parseInt(k[2]),0,0,0);
+				return new Date(Std.parseInt(k[0]), Std.parseInt(k[1]) - 1, Std.parseInt(k[2]), 0, 0, 0);
 			case 19: // YYYY-MM-DD hh:mm:ss
 			case 19: // YYYY-MM-DD hh:mm:ss
 				var k = s.split(" ");
 				var k = s.split(" ");
 				var y = k[0].split("-");
 				var y = k[0].split("-");
 				var t = k[1].split(":");
 				var t = k[1].split(":");
-				return new Date(Std.parseInt(y[0]),Std.parseInt(y[1]) - 1,Std.parseInt(y[2]),
-					Std.parseInt(t[0]),Std.parseInt(t[1]),Std.parseInt(t[2]));
+				return new Date(Std.parseInt(y[0]), Std.parseInt(y[1]) - 1, Std.parseInt(y[2]), Std.parseInt(t[0]), Std.parseInt(t[1]), Std.parseInt(t[2]));
 			default:
 			default:
 				throw "Invalid date format : " + s;
 				throw "Invalid date format : " + s;
 		}
 		}
 	}
 	}
 }
 }
-

+ 118 - 119
std/cpp/_std/EReg.hx

@@ -19,136 +19,134 @@
  * 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.
  */
  */
-
 @:buildXml('<include name="${HXCPP}/src/hx/libs/regexp/Build.xml"/>')
 @:buildXml('<include name="${HXCPP}/src/hx/libs/regexp/Build.xml"/>')
 @:coreApi class EReg {
 @:coreApi class EReg {
-
-	var r : Dynamic;
-	var last : String;
-	var global : Bool;
-
-	public function new( r : String, opt : String ) : Void {
-			var a = opt.split("g");
-			global = a.length > 1;
-			if( global )
-				opt = a.join("");
-			this.r = _hx_regexp_new_options(r, opt);
+	var r:Dynamic;
+	var last:String;
+	var global:Bool;
+
+	public function new(r:String, opt:String):Void {
+		var a = opt.split("g");
+		global = a.length > 1;
+		if (global)
+			opt = a.join("");
+		this.r = _hx_regexp_new_options(r, opt);
 	}
 	}
 
 
-	public function match( s : String ) : Bool {
-			var p = _hx_regexp_match(r,s,0,s.length);
-			if( p )
-				last = s;
-			else
-				last = null;
-			return p;
+	public function match(s:String):Bool {
+		var p = _hx_regexp_match(r, s, 0, s.length);
+		if (p)
+			last = s;
+		else
+			last = null;
+		return p;
 	}
 	}
 
 
-	public function matched( n : Int ) : String {
-			var m = _hx_regexp_matched(r,n);
-			return m;
+	public function matched(n:Int):String {
+		var m = _hx_regexp_matched(r, n);
+		return m;
 	}
 	}
 
 
-	public function matchedLeft() : String {
-			var p = _hx_regexp_matched_pos(r,0);
-			return last.substr(0,p.pos);
+	public function matchedLeft():String {
+		var p = _hx_regexp_matched_pos(r, 0);
+		return last.substr(0, p.pos);
 	}
 	}
 
 
-	public function matchedRight() : String {
-			var p = _hx_regexp_matched_pos(r,0);
-			var sz = p.pos+p.len;
-			return last.substr(sz,last.length-sz);
+	public function matchedRight():String {
+		var p = _hx_regexp_matched_pos(r, 0);
+		var sz = p.pos + p.len;
+		return last.substr(sz, last.length - sz);
 	}
 	}
 
 
-	public function matchedPos() : { pos : Int, len : Int } {
-			return _hx_regexp_matched_pos(r,0);
+	public function matchedPos():{pos:Int, len:Int} {
+		return _hx_regexp_matched_pos(r, 0);
 	}
 	}
 
 
-	public function matchSub( s : String, pos : Int, len : Int = -1):Bool {
-			var p = _hx_regexp_match(r, s, pos, len < 0 ? s.length - pos : len);
-			if (p)
-				last = s;
-			else
-				last = null;
-			return p;
+	public function matchSub(s:String, pos:Int, len:Int = -1):Bool {
+		var p = _hx_regexp_match(r, s, pos, len < 0 ? s.length - pos : len);
+		if (p)
+			last = s;
+		else
+			last = null;
+		return p;
 	}
 	}
 
 
-	public function split( s : String ) : Array<String> {
-			var pos = 0;
-			var len = s.length;
-			var a = new Array();
-			var first = true;
-			do {
-				if( !_hx_regexp_match(r,s,pos,len) )
+	public function split(s:String):Array<String> {
+		var pos = 0;
+		var len = s.length;
+		var a = new Array();
+		var first = true;
+		do {
+			if (!_hx_regexp_match(r, s, pos, len))
+				break;
+			var p = _hx_regexp_matched_pos(r, 0);
+			if (p.len == 0 && !first) {
+				if (p.pos == s.length)
 					break;
 					break;
-				var p = _hx_regexp_matched_pos(r,0);
-				if( p.len == 0 && !first ) {
-					if( p.pos == s.length )
-						break;
-					p.pos += 1;
-				}
-				a.push(s.substr(pos,p.pos - pos));
-				var tot = p.pos + p.len - pos;
-				pos += tot;
-				len -= tot;
-				first = false;
-			} while( global );
-			a.push(s.substr(pos,len));
-			return a;
+				p.pos += 1;
+			}
+			a.push(s.substr(pos, p.pos - pos));
+			var tot = p.pos + p.len - pos;
+			pos += tot;
+			len -= tot;
+			first = false;
+		} while (global);
+		a.push(s.substr(pos, len));
+		return a;
 	}
 	}
 
 
-	public function replace( s : String, by : String ) : String {
-			var b = new StringBuf();
-			var pos = 0;
-			var len = s.length;
-			var a = by.split("$");
-			var first = true;
-			do {
-				if( !_hx_regexp_match(r,s,pos,len) )
+	public function replace(s:String, by:String):String {
+		var b = new StringBuf();
+		var pos = 0;
+		var len = s.length;
+		var a = by.split("$");
+		var first = true;
+		do {
+			if (!_hx_regexp_match(r, s, pos, len))
+				break;
+			var p = _hx_regexp_matched_pos(r, 0);
+			if (p.len == 0 && !first) {
+				if (p.pos == s.length)
 					break;
 					break;
-				var p = _hx_regexp_matched_pos(r,0);
-				if( p.len == 0 && !first ) {
-					if( p.pos == s.length )
-						break;
-					p.pos += 1;
-				}
-				b.addSub(s,pos,p.pos-pos);
-				if( a.length > 0 )
-					b.add(a[0]);
-				var i = 1;
-				while( i < a.length ) {
-					var k = a[i];
-					var c = k.charCodeAt(0);
-					// 1...9
-					if( c >= 49 && c <= 57 ) {
-						var p = try _hx_regexp_matched_pos(r,Std.int(c)-48) catch( e : String ) null;
-						if( p == null ){
-							b.add("$");
-							b.add(k);
-						}else{
-						b.addSub(s,p.pos,p.len);
-						b.addSub(k,1,k.length - 1);
-						}
-					} else if( c == null ) {
+				p.pos += 1;
+			}
+			b.addSub(s, pos, p.pos - pos);
+			if (a.length > 0)
+				b.add(a[0]);
+			var i = 1;
+			while (i < a.length) {
+				var k = a[i];
+				var c = k.charCodeAt(0);
+				// 1...9
+				if (c >= 49 && c <= 57) {
+					var p = try _hx_regexp_matched_pos(r, Std.int(c) - 48) catch (e:String) null;
+					if (p == null) {
 						b.add("$");
 						b.add("$");
-						i++;
-						var k2 = a[i];
-						if( k2 != null && k2.length > 0 )
-							b.add(k2);
-					} else
-						b.add("$"+k);
+						b.add(k);
+					} else {
+						b.addSub(s, p.pos, p.len);
+						b.addSub(k, 1, k.length - 1);
+					}
+				} else if (c == null) {
+					b.add("$");
 					i++;
 					i++;
-				}
-				var tot = p.pos + p.len - pos;
-				pos += tot;
-				len -= tot;
-				first = false;
-			} while( global );
-			b.addSub(s,pos,len);
-			return b.toString();
+					var k2 = a[i];
+					if (k2 != null && k2.length > 0)
+						b.add(k2);
+				} else
+					b.add("$" + k);
+				i++;
+			}
+			var tot = p.pos + p.len - pos;
+			pos += tot;
+			len -= tot;
+			first = false;
+		} while (global);
+		b.addSub(s, pos, len);
+		return b.toString();
 	}
 	}
 
 
-	public function map( s : String, f : EReg -> String ) : String {
+	public function map(s:String, f:EReg->String):String {
 		var offset = 0;
 		var offset = 0;
 		var buf = new StringBuf();
 		var buf = new StringBuf();
 		do {
 		do {
@@ -158,14 +156,13 @@
 				buf.add(s.substr(offset));
 				buf.add(s.substr(offset));
 				break;
 				break;
 			}
 			}
-			var p = _hx_regexp_matched_pos(r,0);
+			var p = _hx_regexp_matched_pos(r, 0);
 			buf.add(s.substr(offset, p.pos - offset));
 			buf.add(s.substr(offset, p.pos - offset));
 			buf.add(f(this));
 			buf.add(f(this));
 			if (p.len == 0) {
 			if (p.len == 0) {
 				buf.add(s.substr(p.pos, 1));
 				buf.add(s.substr(p.pos, 1));
 				offset = p.pos + 1;
 				offset = p.pos + 1;
-			}
-			else
+			} else
 				offset = p.pos + p.len;
 				offset = p.pos + p.len;
 		} while (global);
 		} while (global);
 		if (!global && offset > 0 && offset < s.length)
 		if (!global && offset > 0 && offset < s.length)
@@ -173,22 +170,24 @@
 		return buf.toString();
 		return buf.toString();
 	}
 	}
 
 
-	public static function escape( s : String ) : String {
+	public static function escape(s:String):String {
 		return escapeRegExpRe.map(s, function(r) return "\\" + r.matched(0));
 		return escapeRegExpRe.map(s, function(r) return "\\" + r.matched(0));
 	}
 	}
+
 	static var escapeRegExpRe = ~/[\[\]{}()*+?.\\\^$|]/g;
 	static var escapeRegExpRe = ~/[\[\]{}()*+?.\\\^$|]/g;
 
 
-   function toString():String return 'EReg($r)';
+	function toString():String
+		return 'EReg($r)';
 
 
-   @:native("_hx_regexp_new_options")
-	extern static function _hx_regexp_new_options(s:String, options:String) : Dynamic;
+	@:native("_hx_regexp_new_options")
+	extern static function _hx_regexp_new_options(s:String, options:String):Dynamic;
 
 
-   @:native("_hx_regexp_match")
-	extern static function _hx_regexp_match(handler: Dynamic, string:String, pos:Int, len:Int) : Bool;
+	@:native("_hx_regexp_match")
+	extern static function _hx_regexp_match(handler:Dynamic, string:String, pos:Int, len:Int):Bool;
 
 
-   @:native("_hx_regexp_matched")
-	extern static function _hx_regexp_matched(handle:Dynamic, pos:Int) : String;
+	@:native("_hx_regexp_matched")
+	extern static function _hx_regexp_matched(handle:Dynamic, pos:Int):String;
 
 
-   @:native("_hx_regexp_matched_pos")
-	extern static function _hx_regexp_matched_pos(handle:Dynamic, match:Int) : {pos:Int, len:Int};
+	@:native("_hx_regexp_matched_pos")
+	extern static function _hx_regexp_matched_pos(handle:Dynamic, match:Int):{pos:Int, len:Int};
 }
 }

+ 83 - 69
std/cpp/_std/Reflect.hx

@@ -25,91 +25,105 @@ import cpp.ObjectType;
 @:coreApi
 @:coreApi
 @:analyzer(ignore)
 @:analyzer(ignore)
 class Reflect {
 class Reflect {
-
-	public  static function hasField( o : Dynamic, field : String ) : Bool untyped {
-		return o!=null && o.__HasField(field);
-	}
-
-	public static function field( o : Dynamic, field : String ) : Dynamic untyped {
-		return (o==null) ? null : o.__Field(field,untyped __cpp__("hx::paccNever") );
-	}
-
-	public static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {
-		if (o!=null)
-			o.__SetField(field,value,untyped __cpp__("hx::paccNever") );
+	public static function hasField(o:Dynamic, field:String):Bool
+		untyped {
+			return o != null && o.__HasField(field);
+		}
+
+	public static function field(o:Dynamic, field:String):Dynamic
+		untyped {
+			return (o == null) ? null : o.__Field(field, untyped __cpp__("hx::paccNever"));
+		}
+
+	public static function setField(o:Dynamic, field:String, value:Dynamic):Void
+		untyped {
+			if (o != null)
+				o.__SetField(field, value, untyped __cpp__("hx::paccNever"));
+		}
+
+	public static function getProperty(o:Dynamic, field:String):Dynamic {
+		return (o == null) ? null : o.__Field(field, untyped __cpp__("hx::paccAlways"));
 	}
 	}
 
 
-	public static function getProperty( o : Dynamic, field : String ) : Dynamic {
-		return (o==null) ? null : o.__Field(field,untyped __cpp__("hx::paccAlways") );
+	public static function setProperty(o:Dynamic, field:String, value:Dynamic):Void {
+		if (o != null)
+			o.__SetField(field, value, untyped __cpp__("hx::paccAlways"));
 	}
 	}
 
 
-	public static function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void {
-		if (o!=null)
-			o.__SetField(field,value,untyped __cpp__("hx::paccAlways") );
-	}
-
-	public static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array<Dynamic> ) : Dynamic untyped {
-			if (func!=null && func.__GetType()==ObjectType.vtString) {
-				if (o==null) throw cpp.ErrorConstants.invalidObject;
-				func = o.__Field(func,untyped __cpp__("hx::paccDynamic"));
+	public static function callMethod(o:Dynamic, func:haxe.Constraints.Function, args:Array<Dynamic>):Dynamic
+		untyped {
+			if (func != null && func.__GetType() == ObjectType.vtString) {
+				if (o == null)
+					throw cpp.ErrorConstants.invalidObject;
+				func = o.__Field(func, untyped __cpp__("hx::paccDynamic"));
 			}
 			}
-			if (func==null) throw cpp.ErrorConstants.nullFunctionPointer;
+			if (func == null)
+				throw cpp.ErrorConstants.nullFunctionPointer;
 			untyped func.__SetThis(o);
 			untyped func.__SetThis(o);
-         return untyped func.__Run(args);
+			return untyped func.__Run(args);
+		}
+
+	public static function fields(o:Dynamic):Array<String>
+		untyped {
+			if (o == null)
+				return new Array();
+			var a:Array<String> = [];
+			o.__GetFields(a);
+			return a;
+		}
+
+	public static function isFunction(f:Dynamic):Bool
+		untyped {
+			return f != null && f.__GetType() == ObjectType.vtFunction;
+		}
+
+	public static function compare<T>(a:T, b:T):Int {
+		return (a == b) ? 0 : (((a : Dynamic) > (b : Dynamic)) ? 1 : -1);
 	}
 	}
 
 
-	public static function fields( o : Dynamic ) : Array<String> untyped {
-		if( o == null ) return new Array();
-		var a : Array<String> = [];
-		o.__GetFields(a);
-		return a;
-	}
-
-	public static function isFunction( f : Dynamic ) : Bool untyped {
-		return f!=null && f.__GetType() ==  ObjectType.vtFunction;
-	}
-
-	public static function compare<T>( a : T, b : T ) : Int {
-		return ( a == b ) ? 0 : (((a:Dynamic) > (b:Dynamic)) ? 1 : -1);
-	}
-
-	public static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {
-		if( f1 == f2 )
+	public static function compareMethods(f1:Dynamic, f2:Dynamic):Bool {
+		if (f1 == f2)
 			return true;
 			return true;
-		if( !isFunction(f1) || !isFunction(f2) )
+		if (!isFunction(f1) || !isFunction(f2))
 			return false;
 			return false;
-		return untyped __global__.__hxcpp_same_closure(f1,f2);
-	}
-
-	public static function isObject( v : Dynamic ) : Bool untyped {
-		if (v==null) return false;
-		var t:Int = v.__GetType();
-		return t ==  ObjectType.vtObject || t==ObjectType.vtClass || t==ObjectType.vtString ||
-				t==ObjectType.vtArray;
-	}
-
-	public static function isEnumValue( v : Dynamic ) : Bool untyped {
-		return v!=null && v.__GetType() == ObjectType.vtEnum;
-	}
-
-	public static function deleteField( o : Dynamic, field : String ) : Bool untyped {
-		if (o==null) return false;
-		return untyped __global__.__hxcpp_anon_remove(o,field);
+		return untyped __global__.__hxcpp_same_closure(f1, f2);
 	}
 	}
 
 
-	public static function copy<T>( o : Null<T> ) : Null<T> {
-		if (o==null) return null;
-		if(untyped o.__GetType()==ObjectType.vtString ) return o;
-		if(untyped o.__GetType()==ObjectType.vtArray )
+	public static function isObject(v:Dynamic):Bool
+		untyped {
+			if (v == null)
+				return false;
+			var t:Int = v.__GetType();
+			return t == ObjectType.vtObject || t == ObjectType.vtClass || t == ObjectType.vtString || t == ObjectType.vtArray;
+		}
+
+	public static function isEnumValue(v:Dynamic):Bool
+		untyped {
+			return v != null && v.__GetType() == ObjectType.vtEnum;
+		}
+
+	public static function deleteField(o:Dynamic, field:String):Bool
+		untyped {
+			if (o == null)
+				return false;
+			return untyped __global__.__hxcpp_anon_remove(o, field);
+		}
+
+	public static function copy<T>(o:Null<T>):Null<T> {
+		if (o == null)
+			return null;
+		if (untyped o.__GetType() == ObjectType.vtString)
+			return o;
+		if (untyped o.__GetType() == ObjectType.vtArray)
 			return untyped o.__Field("copy", untyped __cpp__("hx::paccDynamic"))();
 			return untyped o.__Field("copy", untyped __cpp__("hx::paccDynamic"))();
-		var o2 : Dynamic = {};
-		for( f in Reflect.fields(o) )
-			Reflect.setField(o2,f,Reflect.field(o,f));
+		var o2:Dynamic = {};
+		for (f in Reflect.fields(o))
+			Reflect.setField(o2, f, Reflect.field(o, f));
 		return o2;
 		return o2;
 	}
 	}
 
 
-	@:overload(function( f : Array<Dynamic> -> Void ) : Dynamic {})
-	public static function makeVarArgs( f : Array<Dynamic> -> Dynamic ) : Dynamic {
+	@:overload(function(f:Array<Dynamic>->Void):Dynamic {})
+	public static function makeVarArgs(f:Array<Dynamic>->Dynamic):Dynamic {
 		return untyped __global__.__hxcpp_create_var_args(f);
 		return untyped __global__.__hxcpp_create_var_args(f);
 	}
 	}
 }
 }

+ 12 - 12
std/cpp/_std/Std.hx

@@ -19,40 +19,40 @@
  * 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.
  */
  */
-
 @:headerClassCode("\t\tstatic inline String string(String &s) { return s; }")
 @:headerClassCode("\t\tstatic inline String string(String &s) { return s; }")
 @:coreApi class Std {
 @:coreApi class Std {
-	@:keep public static function is( v : Dynamic, t : Dynamic ) : Bool {
-		return untyped __global__.__instanceof(v,t);
+	@:keep public static function is(v:Dynamic, t:Dynamic):Bool {
+		return untyped __global__.__instanceof(v, t);
 	}
 	}
 
 
-	@:keep public static function downcast<T:{},S:T>( value : T, c : Class<S> ) : S {
+	@:keep public static function downcast<T:{}, S:T>(value:T, c:Class<S>):S {
 		return Std.is(value, c) ? cast value : null;
 		return Std.is(value, c) ? cast value : null;
 	}
 	}
 
 
 	@:deprecated('Std.instance() is deprecated. Use Std.downcast() instead.')
 	@:deprecated('Std.instance() is deprecated. Use Std.downcast() instead.')
-	@:keep public static function instance<T:{},S:T>( value : T, c : Class<S> ) : S {
+	@:keep public static function instance<T:{}, S:T>(value:T, c:Class<S>):S {
 		return inline downcast(value, c);
 		return inline downcast(value, c);
 	}
 	}
 
 
-	@:keep public static function string( s : Dynamic ) : String {
-		return untyped s==null ? "null" : s.toString();
+	@:keep public static function string(s:Dynamic):String {
+		return untyped s == null ? "null" : s.toString();
 	}
 	}
 
 
-	@:keep public static function int( x : Float ) : Int {
+	@:keep public static function int(x:Float):Int {
 		return untyped __global__.__int__(x);
 		return untyped __global__.__int__(x);
 	}
 	}
 
 
-	@:keep public static function parseInt( x : String ) : Null<Int> {
+	@:keep public static function parseInt(x:String):Null<Int> {
 		return untyped __global__.__hxcpp_parse_int(x);
 		return untyped __global__.__hxcpp_parse_int(x);
 	}
 	}
 
 
-	@:keep public static function parseFloat( x : String ) : Float {
+	@:keep public static function parseFloat(x:String):Float {
 		return untyped __global__.__hxcpp_parse_float(x);
 		return untyped __global__.__hxcpp_parse_float(x);
 	}
 	}
 
 
-	@:keep public static function random( x : Int ) : Int {
-		if (x <= 0) return 0;
+	@:keep public static function random(x:Int):Int {
+		if (x <= 0)
+			return 0;
 		return untyped __global__.__hxcpp_irand(x);
 		return untyped __global__.__hxcpp_irand(x);
 	}
 	}
 }
 }

+ 66 - 62
std/cpp/_std/StringBuf.hx

@@ -19,79 +19,83 @@
  * 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.
  */
  */
+
 import cpp.NativeString;
 import cpp.NativeString;
+
 using cpp.NativeArray;
 using cpp.NativeArray;
 
 
 @:coreApi
 @:coreApi
 class StringBuf {
 class StringBuf {
-   private var b : Array<String>;
-   public var length(get,never) : Int;
-   var charBuf:Array<cpp.Char>;
+	private var b:Array<String>;
+
+	public var length(get, never):Int;
+
+	var charBuf:Array<cpp.Char>;
 
 
-   public function new() : Void {
-   }
+	public function new():Void {}
 
 
-   private function charBufAsString() : String
-   {
-      var len = charBuf.length;
-      charBuf.push(0);
-      return NativeString.fromGcPointer( charBuf.address(0), len );
-   }
+	private function charBufAsString():String {
+		var len = charBuf.length;
+		charBuf.push(0);
+		return NativeString.fromGcPointer(charBuf.address(0), len);
+	}
 
 
-   private function flush() : Void{
-      if (b==null)
-         b = [charBufAsString()];
-      else
-         b.push( charBufAsString() );
-      charBuf = null;
-   }
-   function get_length() : Int {
-      var len = 0;
-      if (charBuf!=null)
-         len = charBuf.length;
-      if (b!=null)
-         for(s in b)
-            len += s==null ? 4 : s.length;
-      return len;
-   }
+	private function flush():Void {
+		if (b == null)
+			b = [charBufAsString()];
+		else
+			b.push(charBufAsString());
+		charBuf = null;
+	}
 
 
-   public inline function add<T>( x : T ) : Void {
-      if (charBuf!=null) flush();
-      if (b==null)
-         b = [Std.string(x)];
-      else
-         b.push(Std.string(x));
-   }
+	function get_length():Int {
+		var len = 0;
+		if (charBuf != null)
+			len = charBuf.length;
+		if (b != null)
+			for (s in b)
+				len += s == null ? 4 : s.length;
+		return len;
+	}
 
 
-   public #if !cppia inline #end function addSub( s : String, pos : Int, ?len : Int ) : Void {
-      if (charBuf!=null) flush();
-      if (b==null)
-         b = [s.substr(pos,len)];
-      else
-         b.push(s.substr(pos,len));
-   }
+	public inline function add<T>(x:T):Void {
+		if (charBuf != null)
+			flush();
+		if (b == null)
+			b = [Std.string(x)];
+		else
+			b.push(Std.string(x));
+	}
 
 
-   public #if !cppia inline #end function addChar( c : Int ) : Void {
-      #if hxcpp_smart_strings
-      if (c>=127)
-         add(String.fromCharCode(c));
-      else
-      #end
-      {
-      if (charBuf==null)
-          charBuf = new Array<cpp.Char>();
-      charBuf.push(c);
-      }
-   }
+	public #if !cppia inline #end function addSub(s:String, pos:Int, ?len:Int):Void {
+		if (charBuf != null)
+			flush();
+		if (b == null)
+			b = [s.substr(pos, len)];
+		else
+			b.push(s.substr(pos, len));
+	}
 
 
-   public function toString() : String {
-      if (charBuf!=null)
-         flush();
-      if (b==null || b.length==0)
-         return "";
-      if (b.length==1)
-         return b[0];
-      return b.join("");
-   }
+	public #if !cppia inline #end function addChar(c:Int):Void {
+		#if hxcpp_smart_strings
+		if (c >= 127)
+			add(String.fromCharCode(c));
+		else
+		#end
+		{
+			if (charBuf == null)
+				charBuf = new Array<cpp.Char>();
+			charBuf.push(c);
+		}
+	}
 
 
+	public function toString():String {
+		if (charBuf != null)
+			flush();
+		if (b == null || b.length == 0)
+			return "";
+		if (b.length == 1)
+			return b[0];
+		return b.join("");
+	}
 }
 }

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

@@ -19,74 +19,75 @@
  * 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.
  */
  */
+
 import cpp.NativeSys;
 import cpp.NativeSys;
 import haxe.SysTools;
 import haxe.SysTools;
 
 
 @:coreApi class Sys {
 @:coreApi class Sys {
-
-	public static function print( v : Dynamic ) : Void {
+	public static function print(v:Dynamic):Void {
 		untyped __global__.__hxcpp_print(v);
 		untyped __global__.__hxcpp_print(v);
 	}
 	}
 
 
-	public static function println( v : Dynamic ) : Void {
+	public static function println(v:Dynamic):Void {
 		untyped __global__.__hxcpp_println(v);
 		untyped __global__.__hxcpp_println(v);
 	}
 	}
 
 
-   @:access(sys.io.FileInput)
-	public static function stdin() : haxe.io.Input {
+	@:access(sys.io.FileInput)
+	public static function stdin():haxe.io.Input {
 		return new sys.io.FileInput(cpp.NativeFile.file_stdin());
 		return new sys.io.FileInput(cpp.NativeFile.file_stdin());
 	}
 	}
 
 
-   @:access(sys.io.FileOutput)
-	public static function stdout() : haxe.io.Output {
+	@:access(sys.io.FileOutput)
+	public static function stdout():haxe.io.Output {
 		return new sys.io.FileOutput(cpp.NativeFile.file_stdout());
 		return new sys.io.FileOutput(cpp.NativeFile.file_stdout());
 	}
 	}
 
 
-   @:access(sys.io.FileOutput)
-	public static function stderr() : haxe.io.Output {
+	@:access(sys.io.FileOutput)
+	public static function stderr():haxe.io.Output {
 		return new sys.io.FileOutput(cpp.NativeFile.file_stderr());
 		return new sys.io.FileOutput(cpp.NativeFile.file_stderr());
 	}
 	}
 
 
-	public static function getChar( echo : Bool ) : Int {
+	public static function getChar(echo:Bool):Int {
 		return NativeSys.sys_getch(echo);
 		return NativeSys.sys_getch(echo);
 	}
 	}
 
 
-	public static function args() : Array<String> untyped {
-		return __global__.__get_args();
-	}
+	public static function args():Array<String>
+		untyped {
+			return __global__.__get_args();
+		}
 
 
-	public static function getEnv( s : String ):String {
+	public static function getEnv(s:String):String {
 		var v = NativeSys.get_env(s);
 		var v = NativeSys.get_env(s);
-		if( v == null )
+		if (v == null)
 			return null;
 			return null;
 		return v;
 		return v;
 	}
 	}
 
 
-	public static function putEnv( s : String, v : String ) : Void {
-		NativeSys.put_env(s,v);
+	public static function putEnv(s:String, v:String):Void {
+		NativeSys.put_env(s, v);
 	}
 	}
 
 
-	public static function sleep( seconds : Float ) : Void {
+	public static function sleep(seconds:Float):Void {
 		NativeSys.sys_sleep(seconds);
 		NativeSys.sys_sleep(seconds);
 	}
 	}
 
 
-	public static function setTimeLocale( loc : String ) : Bool {
+	public static function setTimeLocale(loc:String):Bool {
 		return NativeSys.set_time_locale(loc);
 		return NativeSys.set_time_locale(loc);
 	}
 	}
 
 
-	public static function getCwd() : String {
+	public static function getCwd():String {
 		return NativeSys.get_cwd();
 		return NativeSys.get_cwd();
 	}
 	}
 
 
-	public static function setCwd( s : String ) : Void {
+	public static function setCwd(s:String):Void {
 		NativeSys.set_cwd(s);
 		NativeSys.set_cwd(s);
 	}
 	}
 
 
-	public static function systemName() : String {
+	public static function systemName():String {
 		return NativeSys.sys_string();
 		return NativeSys.sys_string();
 	}
 	}
 
 
-	public static function command( cmd : String, ?args : Array<String> ) : Int {
+	public static function command(cmd:String, ?args:Array<String>):Int {
 		if (args == null) {
 		if (args == null) {
 			return NativeSys.sys_command(cmd);
 			return NativeSys.sys_command(cmd);
 		} else {
 		} else {
@@ -94,7 +95,7 @@ import haxe.SysTools;
 				case "Windows":
 				case "Windows":
 					cmd = [
 					cmd = [
 						for (a in [StringTools.replace(cmd, "/", "\\")].concat(args))
 						for (a in [StringTools.replace(cmd, "/", "\\")].concat(args))
-						SysTools.quoteWinArg(a, true)
+							SysTools.quoteWinArg(a, true)
 					].join(" ");
 					].join(" ");
 					return NativeSys.sys_command(cmd);
 					return NativeSys.sys_command(cmd);
 				case _:
 				case _:
@@ -104,35 +105,34 @@ import haxe.SysTools;
 		}
 		}
 	}
 	}
 
 
-	public static function exit( code : Int ) : Void {
+	public static function exit(code:Int):Void {
 		untyped __global__.__hxcpp_exit(code);
 		untyped __global__.__hxcpp_exit(code);
 	}
 	}
 
 
-	public static function time() : Float {
+	public static function time():Float {
 		return NativeSys.sys_time();
 		return NativeSys.sys_time();
 	}
 	}
 
 
-	public static function cpuTime() : Float {
+	public static function cpuTime():Float {
 		return NativeSys.sys_cpu_time();
 		return NativeSys.sys_cpu_time();
 	}
 	}
 
 
-	@:deprecated("Use programPath instead") public static function executablePath() : String {
+	@:deprecated("Use programPath instead") public static function executablePath():String {
 		return NativeSys.sys_exe_path();
 		return NativeSys.sys_exe_path();
 	}
 	}
 
 
-	public static function programPath() : String {
+	public static function programPath():String {
 		return NativeSys.sys_exe_path();
 		return NativeSys.sys_exe_path();
 	}
 	}
 
 
-	public static function environment() : Map<String,String> {
+	public static function environment():Map<String, String> {
 		var vars:Array<String> = NativeSys.sys_env();
 		var vars:Array<String> = NativeSys.sys_env();
 		var result = new haxe.ds.StringMap<String>();
 		var result = new haxe.ds.StringMap<String>();
 		var i = 0;
 		var i = 0;
-		while(i<vars.length) {
-			result.set( vars[i], vars[i+1] );
-			i+=2;
+		while (i < vars.length) {
+			result.set(vars[i], vars[i + 1]);
+			i += 2;
 		}
 		}
 		return result;
 		return result;
 	}
 	}
-
 }
 }

+ 106 - 92
std/cpp/_std/Type.hx

@@ -19,7 +19,6 @@
  * 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.
  */
  */
-
 enum ValueType {
 enum ValueType {
 	TNull;
 	TNull;
 	TInt;
 	TInt;
@@ -27,140 +26,155 @@ enum ValueType {
 	TBool;
 	TBool;
 	TObject;
 	TObject;
 	TFunction;
 	TFunction;
-	TClass( c : Class<Dynamic> );
-	TEnum( e : Enum<Dynamic> );
+	TClass(c:Class<Dynamic>);
+	TEnum(e:Enum<Dynamic>);
 	TUnknown;
 	TUnknown;
 }
 }
 
 
 @:coreApi class Type {
 @:coreApi class Type {
-	public static function getClass<T>( o : T ) : Class<T> untyped {
-			if (o==null || !Reflect.isObject(o))  return null;
+	public static function getClass<T>(o:T):Class<T>
+		untyped {
+			if (o == null || !Reflect.isObject(o))
+				return null;
 			var c = o.__GetClass();
 			var c = o.__GetClass();
-			switch(c.toString())
-			{
-				case "__Anon" : return null;
-				case "Class" : return null;
+			switch (c.toString()) {
+				case "__Anon":
+					return null;
+				case "Class":
+					return null;
 			}
 			}
 			return c;
 			return c;
-	}
-
-	public static function getEnum( o : EnumValue ) : Enum<Dynamic> untyped {
-		if (o==null) return null;
-		return untyped o.__GetClass();
-	}
-
-
-	public static function getSuperClass( c : Class<Dynamic> ) : Class<Dynamic> untyped {
-		return c.GetSuper();
-	}
-
-	public static function getClassName( c : Class<Dynamic> ) : String {
-		if( c == null )
+		}
+
+	public static function getEnum(o:EnumValue):Enum<Dynamic>
+		untyped {
+			if (o == null)
+				return null;
+			return untyped o.__GetClass();
+		}
+
+	public static function getSuperClass(c:Class<Dynamic>):Class<Dynamic>
+		untyped {
+			return c.GetSuper();
+		}
+
+	public static function getClassName(c:Class<Dynamic>):String {
+		if (c == null)
 			return null;
 			return null;
 		return untyped c.mName;
 		return untyped c.mName;
 	}
 	}
 
 
-	public static function getEnumName( e : Enum<Dynamic> ) : String {
+	public static function getEnumName(e:Enum<Dynamic>):String {
 		return untyped e.__ToString();
 		return untyped e.__ToString();
 	}
 	}
 
 
-	public static function resolveClass( name : String ) : Class<Dynamic> untyped {
-		var result:Class<Dynamic> = Class.Resolve(name);
-		if (result!=null && result.__IsEnum() )
-			return null;
-		return result;
-	}
-
-	public static function resolveEnum( name : String ) : Enum<Dynamic> untyped {
-		var result:Class<Dynamic> = Class.Resolve(name);
-		if (result!=null && !result.__IsEnum() )
+	public static function resolveClass(name:String):Class<Dynamic>
+		untyped {
+			var result:Class<Dynamic> = Class.Resolve(name);
+			if (result != null && result.__IsEnum())
+				return null;
+			return result;
+		}
+
+	public static function resolveEnum(name:String):Enum<Dynamic>
+		untyped {
+			var result:Class<Dynamic> = Class.Resolve(name);
+			if (result != null && !result.__IsEnum())
+				return null;
+			return result;
+		}
+
+	public static function createInstance<T>(cl:Class<T>, args:Array<Dynamic>):T
+		untyped {
+			if (cl != null)
+				return cl.ConstructArgs(args);
 			return null;
 			return null;
-		return result;
-	}
+		}
 
 
-	public static function createInstance<T>( cl : Class<T>, args : Array<Dynamic> ) : T untyped {
-		if (cl!=null)
-			return cl.ConstructArgs(args);
-		return null;
-	}
-
-	public static function createEmptyInstance<T>( cl : Class<T> ) : T untyped {
-		return cl.ConstructEmpty();
-	}
+	public static function createEmptyInstance<T>(cl:Class<T>):T
+		untyped {
+			return cl.ConstructEmpty();
+		}
 
 
-	public static function createEnum<T>( e : Enum<T>, constr : String, ?params : Array<Dynamic> ) : T {
-		return untyped e.ConstructEnum(constr,params);
+	public static function createEnum<T>(e:Enum<T>, constr:String, ?params:Array<Dynamic>):T {
+		return untyped e.ConstructEnum(constr, params);
 	}
 	}
 
 
-	public static function createEnumIndex<T>( e : Enum<T>, index : Int, ?params : Array<Dynamic> ) : T {
+	public static function createEnumIndex<T>(e:Enum<T>, index:Int, ?params:Array<Dynamic>):T {
 		var c = Type.getEnumConstructs(e)[index];
 		var c = Type.getEnumConstructs(e)[index];
-		if( c == null ) throw index+" is not a valid enum constructor index";
-		return createEnum(e,c,params);
+		if (c == null)
+			throw index + " is not a valid enum constructor index";
+		return createEnum(e, c, params);
 	}
 	}
 
 
-	public static function getInstanceFields( c : Class<Dynamic> ) : Array<String> {
+	public static function getInstanceFields(c:Class<Dynamic>):Array<String> {
 		return untyped c.GetInstanceFields();
 		return untyped c.GetInstanceFields();
 	}
 	}
 
 
-	public static function getClassFields( c : Class<Dynamic> ) : Array<String> {
-			return untyped c.GetClassFields();
+	public static function getClassFields(c:Class<Dynamic>):Array<String> {
+		return untyped c.GetClassFields();
 	}
 	}
 
 
-	public static function getEnumConstructs( e : Enum<Dynamic> ) : Array<String> untyped {
+	public static function getEnumConstructs(e:Enum<Dynamic>):Array<String>
+		untyped {
 			return untyped e.GetClassFields();
 			return untyped e.GetClassFields();
-	}
+		}
 
 
-	public static function typeof( v : Dynamic ) : ValueType untyped {
-			if (v==null) return TNull;
+	public static function typeof(v:Dynamic):ValueType
+		untyped {
+			if (v == null)
+				return TNull;
 			var t:Int = untyped v.__GetType();
 			var t:Int = untyped v.__GetType();
-			switch(t)
-			{
-				case 2 : return TBool;
-				case 0xFF : return TInt;
-				case 1 : return TFloat;
-				case 6 : return TFunction;
-				case 4 : return TObject;
-				case 7 : return TEnum(v.__GetClass());
+			switch (t) {
+				case 2:
+					return TBool;
+				case 0xFF:
+					return TInt;
+				case 1:
+					return TFloat;
+				case 6:
+					return TFunction;
+				case 4:
+					return TObject;
+				case 7:
+					return TEnum(v.__GetClass());
 				default:
 				default:
 					return untyped TClass(v.__GetClass());
 					return untyped TClass(v.__GetClass());
 			}
 			}
-	}
+		}
 
 
-	public static function enumEq<T>( a : T, b : T ) : Bool untyped {
-			return a==b;
-	}
+	public static function enumEq<T>(a:T, b:T):Bool
+		untyped {
+			return a == b;
+		}
 
 
-	public static function enumConstructor( e : EnumValue ) : String {
-			var value:cpp.EnumBase = cast e;
-			return value._hx_getTag();
+	public static function enumConstructor(e:EnumValue):String {
+		var value:cpp.EnumBase = cast e;
+		return value._hx_getTag();
 	}
 	}
 
 
-	public static function enumParameters( e : EnumValue ) : Array<Dynamic> {
-			var value:cpp.EnumBase = cast e;
-			return value._hx_getParameters();
+	public static function enumParameters(e:EnumValue):Array<Dynamic> {
+		var value:cpp.EnumBase = cast e;
+		return value._hx_getParameters();
 	}
 	}
 
 
-    @:native("_hx_getEnumValueIndex")
-	extern private static function getEnumValueIndex( e : EnumValue ) : Int;
+	@:native("_hx_getEnumValueIndex")
+	extern private static function getEnumValueIndex(e:EnumValue):Int;
 
 
-	#if !cppia inline #end public static function enumIndex( e : EnumValue ) : Int {
-			return getEnumValueIndex(e);
+	#if !cppia inline #end public static function enumIndex(e:EnumValue):Int {
+		return getEnumValueIndex(e);
 	}
 	}
 
 
-	public static function allEnums<T>( e : Enum<T> ) : Array<T> {
-      var names:Array<String> =  untyped e.GetClassFields();
+	public static function allEnums<T>(e:Enum<T>):Array<T> {
+		var names:Array<String> = untyped e.GetClassFields();
 		var enums = new Array<T>();
 		var enums = new Array<T>();
-      for(name in names)
-      {
-         try {
-            var result:T = untyped e.ConstructEnum(name,null);
-            if (result!=null)
-               enums.push( result );
-         } catch ( invalidArgCount:String) {
-         }
-      }
+		for (name in names) {
+			try {
+				var result:T = untyped e.ConstructEnum(name, null);
+				if (result != null)
+					enums.push(result);
+			} catch (invalidArgCount:String) {}
+		}
 		return enums;
 		return enums;
 	}
 	}
-
 }
 }
-

+ 244 - 209
std/cpp/_std/haxe/Int64.hx

@@ -19,148 +19,145 @@
  * 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;
 package haxe;
 
 
 import haxe.Int64Helper;
 import haxe.Int64Helper;
 
 
 @:notNull
 @:notNull
-
-
 @:include("cpp/Int64.h")
 @:include("cpp/Int64.h")
 @:native("cpp::Int64Struct")
 @:native("cpp::Int64Struct")
 private extern class ___Int64 {
 private extern class ___Int64 {
-   public function get():cpp.Int64;
-
-   @:native("_hx_int64_make")
-   public static function make(high:Int32, low:Int32): __Int64;
+	public function get():cpp.Int64;
 
 
-   @:native(" ::cpp::Int64Struct")
-   public static function ofInt(value:Int): __Int64;
+	@:native("_hx_int64_make")
+	public static function make(high:Int32, low:Int32):__Int64;
 
 
-   @:native(" ::cpp::Int64Struct::is")
-   public static function is(d:Dynamic):Bool;
+	@:native(" ::cpp::Int64Struct")
+	public static function ofInt(value:Int):__Int64;
 
 
-   @:native("_hx_int64_is_neg")
-   public static function isNeg(a:__Int64):Bool;
+	@:native(" ::cpp::Int64Struct::is")
+	public static function is(d:Dynamic):Bool;
 
 
-   @:native("_hx_int64_is_zero")
-   public static function isZero(a:__Int64):Bool;
+	@:native("_hx_int64_is_neg")
+	public static function isNeg(a:__Int64):Bool;
 
 
-   @:native("_hx_int64_compare")
-   public static function compare(a:__Int64, b:__Int64):Int;
+	@:native("_hx_int64_is_zero")
+	public static function isZero(a:__Int64):Bool;
 
 
-   @:native("_hx_int64_ucompare")
-   public static function ucompare(a:__Int64, b:__Int64):Int;
+	@:native("_hx_int64_compare")
+	public static function compare(a:__Int64, b:__Int64):Int;
 
 
-   @:native("_hx_int64_to_string")
-   public static function toString(a:__Int64):String;
+	@:native("_hx_int64_ucompare")
+	public static function ucompare(a:__Int64, b:__Int64):Int;
 
 
-   @:native("_hx_int64_neg")
-   public static function neg(a:__Int64): __Int64;
+	@:native("_hx_int64_to_string")
+	public static function toString(a:__Int64):String;
 
 
-   @:native("_hx_int64_pre_increment")
-   public static function preIncrement(a:__Int64): __Int64;
+	@:native("_hx_int64_neg")
+	public static function neg(a:__Int64):__Int64;
 
 
-   @:native("_hx_int64_post_increment")
-   public static function postIncrement(a:__Int64): __Int64;
+	@:native("_hx_int64_pre_increment")
+	public static function preIncrement(a:__Int64):__Int64;
 
 
-   @:native("_hx_int64_pre_decrement")
-   public static function preDecrement(a:__Int64): __Int64;
+	@:native("_hx_int64_post_increment")
+	public static function postIncrement(a:__Int64):__Int64;
 
 
-   @:native("_hx_int64_post_decrement")
-   public static function postDecrement(a:__Int64): __Int64;
+	@:native("_hx_int64_pre_decrement")
+	public static function preDecrement(a:__Int64):__Int64;
 
 
-   @:native("_hx_int64_add")
-   public static function add(a:__Int64, b:__Int64): __Int64;
+	@:native("_hx_int64_post_decrement")
+	public static function postDecrement(a:__Int64):__Int64;
 
 
-   @:native("_hx_int64_add")
-   public static function addInt(a:__Int64, b:Int): __Int64;
+	@:native("_hx_int64_add")
+	public static function add(a:__Int64, b:__Int64):__Int64;
 
 
-   @:native("_hx_int64_sub")
-   public static function sub(a:__Int64, b:__Int64): __Int64;
+	@:native("_hx_int64_add")
+	public static function addInt(a:__Int64, b:Int):__Int64;
 
 
-   @:native("_hx_int64_sub")
-   public static function subInt(a:__Int64, b:Int): __Int64;
+	@:native("_hx_int64_sub")
+	public static function sub(a:__Int64, b:__Int64):__Int64;
 
 
-   @:native("_hx_int64_sub")
-   public static function intSub(a:Int, b:__Int64): __Int64;
+	@:native("_hx_int64_sub")
+	public static function subInt(a:__Int64, b:Int):__Int64;
 
 
-   @:native("_hx_int64_mul")
-   public static function mul(a:__Int64, b:__Int64): __Int64;
+	@:native("_hx_int64_sub")
+	public static function intSub(a:Int, b:__Int64):__Int64;
 
 
-   @:native("_hx_int64_div")
-   public static function div(a:__Int64, b:__Int64): __Int64;
+	@:native("_hx_int64_mul")
+	public static function mul(a:__Int64, b:__Int64):__Int64;
 
 
-   @:native("_hx_int64_mod")
-   public static function mod(a:__Int64, b:__Int64): __Int64;
+	@:native("_hx_int64_div")
+	public static function div(a:__Int64, b:__Int64):__Int64;
 
 
-   @:native("_hx_int64_eq")
-   public static function eq(a:__Int64, b:__Int64): Bool;
+	@:native("_hx_int64_mod")
+	public static function mod(a:__Int64, b:__Int64):__Int64;
 
 
-   @:native("_hx_int64_eq")
-   public static function eqInt(a:__Int64, b:Int): Bool;
+	@:native("_hx_int64_eq")
+	public static function eq(a:__Int64, b:__Int64):Bool;
 
 
-   @:native("_hx_int64_neq")
-   public static function neq(a:__Int64, b:__Int64): Bool;
+	@:native("_hx_int64_eq")
+	public static function eqInt(a:__Int64, b:Int):Bool;
 
 
-   @:native("_hx_int64_neq")
-   public static function neqInt(a:__Int64, b:Int): Bool;
+	@:native("_hx_int64_neq")
+	public static function neq(a:__Int64, b:__Int64):Bool;
 
 
-   @:native("_hx_int64_complement")
-   public static function complement(a:__Int64): __Int64;
+	@:native("_hx_int64_neq")
+	public static function neqInt(a:__Int64, b:Int):Bool;
 
 
-   @:native("_hx_int64_and")
-   public static function bitAnd(a:__Int64, b:__Int64): __Int64;
+	@:native("_hx_int64_complement")
+	public static function complement(a:__Int64):__Int64;
 
 
-   @:native("_hx_int64_or")
-   public static function bitOr(a:__Int64, b:__Int64): __Int64;
+	@:native("_hx_int64_and")
+	public static function bitAnd(a:__Int64, b:__Int64):__Int64;
 
 
-   @:native("_hx_int64_xor")
-   public static function bitXor(a:__Int64, b:__Int64): __Int64;
+	@:native("_hx_int64_or")
+	public static function bitOr(a:__Int64, b:__Int64):__Int64;
 
 
-   @:native("_hx_int64_shl")
-   public static function shl(a:__Int64, b:Int): __Int64;
+	@:native("_hx_int64_xor")
+	public static function bitXor(a:__Int64, b:__Int64):__Int64;
 
 
-   @:native("_hx_int64_shr")
-   public static function shr(a:__Int64, b:Int): __Int64;
+	@:native("_hx_int64_shl")
+	public static function shl(a:__Int64, b:Int):__Int64;
 
 
-   @:native("_hx_int64_ushr")
-   public static function ushr(a:__Int64, b:Int): __Int64;
+	@:native("_hx_int64_shr")
+	public static function shr(a:__Int64, b:Int):__Int64;
 
 
-   @:native("_hx_int64_high")
-   public static function high(a:__Int64):Int32;
+	@:native("_hx_int64_ushr")
+	public static function ushr(a:__Int64, b:Int):__Int64;
 
 
-   @:native("_hx_int64_low")
-   public static function low(a:__Int64):Int32;
+	@:native("_hx_int64_high")
+	public static function high(a:__Int64):Int32;
 
 
+	@:native("_hx_int64_low")
+	public static function low(a:__Int64):Int32;
 }
 }
 
 
 private typedef __Int64 = ___Int64;
 private typedef __Int64 = ___Int64;
 
 
 @:coreApi
 @:coreApi
-abstract Int64( __Int64 ) from __Int64 to __Int64
-{
-   /**
+abstract Int64(__Int64) from __Int64 to __Int64 {
+	/**
 		Makes a copy of `this` Int64.
 		Makes a copy of `this` Int64.
 	**/
 	**/
-	public #if !cppia inline #end function copy():Int64 return this;
-
+	public #if !cppia inline #end function copy():Int64
+		return this;
 
 
-	public static #if !cppia inline #end function make( high : Int32, low : Int32 ) : Int64 {
-      return __Int64.make(high,low);
+	public static #if !cppia inline #end function make(high:Int32, low:Int32):Int64 {
+		return __Int64.make(high, low);
 	}
 	}
 
 
-	@:from public static #if !cppia inline #end function ofInt( x : Int ) : Int64 {
-      return __Int64.ofInt(x);
+	@:from
+	public static #if !cppia inline #end function ofInt(x:Int):Int64 {
+		return __Int64.ofInt(x);
 	}
 	}
 
 
-
 	/**
 	/**
 		Returns an Int with the value of the Int64 `x`.
 		Returns an Int with the value of the Int64 `x`.
 		Throws an exception  if `x` cannot be represented in 32 bits.
 		Throws an exception  if `x` cannot be represented in 32 bits.
 	**/
 	**/
-	public static #if !cppia inline #end function toInt( x : Int64 ) : Int {
-		if( x.high != x.low >> 31 )
+	public static #if !cppia inline #end function toInt(x:Int64):Int {
+		if (x.high != x.low >> 31)
 			throw "Overflow";
 			throw "Overflow";
 
 
 		return x.low;
 		return x.low;
@@ -169,296 +166,334 @@ abstract Int64( __Int64 ) from __Int64 to __Int64
 	/**
 	/**
 		Returns whether the value `val` is of type `haxe.Int64`
 		Returns whether the value `val` is of type `haxe.Int64`
 	**/
 	**/
-	public static #if !cppia inline #end function is( val : Dynamic ) : Bool
-      return __Int64.is(val);
+	public static #if !cppia inline #end function is(val:Dynamic):Bool
+		return __Int64.is(val);
 
 
 	/**
 	/**
 		Returns the high 32-bit word of `x`.
 		Returns the high 32-bit word of `x`.
 	**/
 	**/
 	@:deprecated("Use high instead")
 	@:deprecated("Use high instead")
-	public static #if !cppia inline #end function getHigh( x : Int64 ) : Int32
+	public static #if !cppia inline #end function getHigh(x:Int64):Int32
 		return x.high;
 		return x.high;
 
 
 	/**
 	/**
 		Returns the low 32-bit word of `x`.
 		Returns the low 32-bit word of `x`.
 	**/
 	**/
 	@:deprecated("Use low instead")
 	@:deprecated("Use low instead")
-	public static #if !cppia inline #end function getLow( x : Int64 ) : Int32
+	public static #if !cppia inline #end function getLow(x:Int64):Int32
 		return x.low;
 		return x.low;
 
 
 	/**
 	/**
 		Returns `true` if `x` is less than zero.
 		Returns `true` if `x` is less than zero.
 	**/
 	**/
-	public static #if !cppia inline #end function isNeg( x : Int64) : Bool
-      return __Int64.isNeg(x);
+	public static #if !cppia inline #end function isNeg(x:Int64):Bool
+		return __Int64.isNeg(x);
 
 
 	/**
 	/**
 		Returns `true` if `x` is exactly zero.
 		Returns `true` if `x` is exactly zero.
 	**/
 	**/
-	public static #if !cppia inline #end function isZero( x : Int64 ) : Bool
-      return __Int64.isZero(x);
+	public static #if !cppia inline #end function isZero(x:Int64):Bool
+		return __Int64.isZero(x);
 
 
 	/**
 	/**
 		Compares `a` and `b` in signed mode.
 		Compares `a` and `b` in signed mode.
 		Returns a negative value if `a < b`, positive if `a > b`,
 		Returns a negative value if `a < b`, positive if `a > b`,
 		or 0 if `a == b`.
 		or 0 if `a == b`.
 	**/
 	**/
-	public static #if !cppia inline #end function compare( a : Int64, b : Int64 ) : Int
-      return __Int64.compare(a,b);
+	public static #if !cppia inline #end function compare(a:Int64, b:Int64):Int
+		return __Int64.compare(a, b);
 
 
 	/**
 	/**
 		Compares `a` and `b` in unsigned mode.
 		Compares `a` and `b` in unsigned mode.
 		Returns a negative value if `a < b`, positive if `a > b`,
 		Returns a negative value if `a < b`, positive if `a > b`,
 		or 0 if `a == b`.
 		or 0 if `a == b`.
 	**/
 	**/
-	public static #if !cppia inline #end function ucompare( a : Int64, b : Int64 ) : Int
-      return __Int64.ucompare(a,b);
+	public static #if !cppia inline #end function ucompare(a:Int64, b:Int64):Int
+		return __Int64.ucompare(a, b);
 
 
 	/**
 	/**
 		Returns a signed decimal `String` representation of `x`.
 		Returns a signed decimal `String` representation of `x`.
 	**/
 	**/
-	public static #if !cppia inline #end function toStr(x:Int64) : String
+	public static #if !cppia inline #end function toStr(x:Int64):String
 		return x.toString();
 		return x.toString();
 
 
-	private #if !cppia inline #end function toString() : String
-      return __Int64.toString(this);
+	private #if !cppia inline #end function toString():String
+		return __Int64.toString(this);
 
 
-	public static function parseString( sParam : String ) : Int64 {
-		return Int64Helper.parseString( sParam );
+	public static function parseString(sParam:String):Int64 {
+		return Int64Helper.parseString(sParam);
 	}
 	}
 
 
-	public static function fromFloat( f : Float ) : Int64 {
-		return Int64Helper.fromFloat( f );
+	public static function fromFloat(f:Float):Int64 {
+		return Int64Helper.fromFloat(f);
 	}
 	}
 
 
 	/**
 	/**
 		Performs signed integer divison of `dividend` by `divisor`.
 		Performs signed integer divison of `dividend` by `divisor`.
 		Returns `{ quotient : Int64, modulus : Int64 }`.
 		Returns `{ quotient : Int64, modulus : Int64 }`.
 	**/
 	**/
-	public static function divMod( dividend : Int64, divisor : Int64 ) : { quotient : Int64, modulus : Int64 }
-	{
-      var q = dividend/divisor;
+	public static function divMod(dividend:Int64, divisor:Int64):{quotient:Int64, modulus:Int64} {
+		var q = dividend / divisor;
 
 
-      if (isZero(divisor))
-	       throw "divide by zero";
+		if (isZero(divisor))
+			throw "divide by zero";
 
 
-      var m = dividend - q*divisor;
+		var m = dividend - q * divisor;
 
 
-      return { quotient : q, modulus : m };
+		return {quotient: q, modulus: m};
 	}
 	}
 
 
 	/**
 	/**
 		Returns the negative of `x`.
 		Returns the negative of `x`.
 	**/
 	**/
-	@:op(-A) public static #if !cppia inline #end function neg( x : Int64 ) : Int64
-      return __Int64.neg(x);
-
-	@:op(++A) private inline  function preIncrement() : Int64 {
-      #if cppia
-      this = this + make(0,1);
-      return this;
-      #else
+	@:op(-A)
+	public static #if !cppia inline #end function neg(x:Int64):Int64
+		return __Int64.neg(x);
+
+	@:op(++A) private inline function preIncrement():Int64 {
+		#if cppia
+		this = this + make(0, 1);
+		return this;
+		#else
 		return __Int64.preIncrement(this);
 		return __Int64.preIncrement(this);
-      #end
+		#end
 	}
 	}
 
 
-	@:op(A++) private inline function postIncrement() : Int64 {
-      #if cppia
-      var result = this;
-      this = this + make(0,1);
-      return result;
-      #else
+	@:op(A++) private inline function postIncrement():Int64 {
+		#if cppia
+		var result = this;
+		this = this + make(0, 1);
+		return result;
+		#else
 		return __Int64.postIncrement(this);
 		return __Int64.postIncrement(this);
-      #end
+		#end
 	}
 	}
 
 
-	@:op(--A) private inline function preDecrement() : Int64 {
-      #if cppia
-      untyped this = this - make(0,1);
-      return this;
-      #else
+	@:op(--A) private inline function preDecrement():Int64 {
+		#if cppia
+		untyped this = this - make(0, 1);
+		return this;
+		#else
 		return __Int64.preDecrement(this);
 		return __Int64.preDecrement(this);
-      #end
+		#end
 	}
 	}
 
 
-	@:op(A--) private inline function postDecrement() : Int64 {
-      #if cppia
-      var result = this;
-      this = this - make(0,1);
-      return result;
-      #else
+	@:op(A--) private inline function postDecrement():Int64 {
+		#if cppia
+		var result = this;
+		this = this - make(0, 1);
+		return result;
+		#else
 		return __Int64.postDecrement(this);
 		return __Int64.postDecrement(this);
-      #end
+		#end
 	}
 	}
 
 
 	/**
 	/**
 		Returns the sum of `a` and `b`.
 		Returns the sum of `a` and `b`.
 	**/
 	**/
-	@:op(A + B) public static #if !cppia inline #end function add( a : Int64, b : Int64 ) : Int64
-      return __Int64.add(a,b);
+	@:op(A + B)
+	public static #if !cppia inline #end function add(a:Int64, b:Int64):Int64
+		return __Int64.add(a, b);
 
 
-	@:op(A + B) @:commutative private static #if !cppia inline #end function addInt( a : Int64, b : Int ) : Int64
-      return __Int64.addInt(a,b);
+	@:op(A + B)
+	@:commutative
+	private static #if !cppia inline #end function addInt(a:Int64, b:Int):Int64
+		return __Int64.addInt(a, b);
 
 
 	/**
 	/**
 		Returns `a` minus `b`.
 		Returns `a` minus `b`.
 	**/
 	**/
-	@:op(A - B) public static #if !cppia inline #end function sub( a : Int64, b : Int64 ) : Int64 {
-      return __Int64.sub(a,b);
+	@:op(A - B)
+	public static #if !cppia inline #end function sub(a:Int64, b:Int64):Int64 {
+		return __Int64.sub(a, b);
 	}
 	}
 
 
-	@:op(A - B) private static #if !cppia inline #end function subInt( a : Int64, b : Int ) : Int64
-		return __Int64.subInt( a, b );
+	@:op(A - B)
+	private static #if !cppia inline #end function subInt(a:Int64, b:Int):Int64
+		return __Int64.subInt(a, b);
 
 
-	@:op(A - B) private static #if !cppia inline #end function intSub( a : Int, b : Int64 ) : Int64
-		return __Int64.intSub( a, b );
+	@:op(A - B)
+	private static #if !cppia inline #end function intSub(a:Int, b:Int64):Int64
+		return __Int64.intSub(a, b);
 
 
 	/**
 	/**
 		Returns the product of `a` and `b`.
 		Returns the product of `a` and `b`.
 	**/
 	**/
-	@:op(A * B) public static #if !cppia inline #end function mul( a : Int64, b : Int64 ) : Int64
-		return __Int64.mul( a, b );
+	@:op(A * B)
+	public static #if !cppia inline #end function mul(a:Int64, b:Int64):Int64
+		return __Int64.mul(a, b);
 
 
-	@:op(A * B) @:commutative private static #if !cppia inline #end function mulInt( a : Int64, b : Int ) : Int64
-		return mul( a, b );
+	@:op(A * B)
+	@:commutative
+	private static #if !cppia inline #end function mulInt(a:Int64, b:Int):Int64
+		return mul(a, b);
 
 
 	/**
 	/**
 		Returns the quotient of `a` divided by `b`.
 		Returns the quotient of `a` divided by `b`.
 	**/
 	**/
-	@:op(A / B) public static #if !cppia inline #end function div( a : Int64, b : Int64 ) : Int64 {
+	@:op(A / B)
+	public static #if !cppia inline #end function div(a:Int64, b:Int64):Int64 {
 		if (__Int64.isZero(b))
 		if (__Int64.isZero(b))
 			throw "divide by zero";
 			throw "divide by zero";
-		return __Int64.div(a,b);
+		return __Int64.div(a, b);
 	}
 	}
 
 
+	@:op(A / B)
+	private static #if !cppia inline #end function divInt(a:Int64, b:Int):Int64
+		return div(a, b);
 
 
-	@:op(A / B) private static #if !cppia inline #end function divInt( a : Int64, b : Int ) : Int64
-		return div( a, b );
-
-	@:op(A / B) private static #if !cppia inline #end function intDiv( a : Int, b : Int64 ) : Int64
-		return toInt(div( a, b ));
+	@:op(A / B)
+	private static #if !cppia inline #end function intDiv(a:Int, b:Int64):Int64
+		return toInt(div(a, b));
 
 
 	/**
 	/**
 		Returns the modulus of `a` divided by `b`.
 		Returns the modulus of `a` divided by `b`.
 	**/
 	**/
-	@:op(A % B) public static #if !cppia inline #end function mod( a : Int64, b : Int64 ) : Int64
-   {
+	@:op(A % B)
+	public static #if !cppia inline #end function mod(a:Int64, b:Int64):Int64 {
 		if (__Int64.isZero(b))
 		if (__Int64.isZero(b))
 			throw "divide by zero";
 			throw "divide by zero";
 		return __Int64.mod(a, b);
 		return __Int64.mod(a, b);
-   }
+	}
 
 
-	@:op(A % B) private static #if !cppia inline #end function modInt( a : Int64, b : Int ) : Int64
-		return toInt(mod( a, b ));
+	@:op(A % B)
+	private static #if !cppia inline #end function modInt(a:Int64, b:Int):Int64
+		return toInt(mod(a, b));
 
 
-	@:op(A % B) private static #if !cppia inline #end function intMod( a : Int, b : Int64 ) : Int64
-		return toInt(mod( a, b ));
+	@:op(A % B)
+	private static #if !cppia inline #end function intMod(a:Int, b:Int64):Int64
+		return toInt(mod(a, b));
 
 
 	/**
 	/**
 		Returns `true` if `a` is equal to `b`.
 		Returns `true` if `a` is equal to `b`.
 	**/
 	**/
-	@:op(A == B) public static #if !cppia inline #end function eq( a : Int64, b : Int64 ) : Bool
-      return __Int64.eq(a,b);
+	@:op(A == B)
+	public static #if !cppia inline #end function eq(a:Int64, b:Int64):Bool
+		return __Int64.eq(a, b);
 
 
-	@:op(A == B) @:commutative private static #if !cppia inline #end function eqInt( a : Int64, b : Int ) : Bool
-		return __Int64.eqInt( a, b );
+	@:op(A == B)
+	@:commutative
+	private static #if !cppia inline #end function eqInt(a:Int64, b:Int):Bool
+		return __Int64.eqInt(a, b);
 
 
 	/**
 	/**
 		Returns `true` if `a` is not equal to `b`.
 		Returns `true` if `a` is not equal to `b`.
 	**/
 	**/
-	@:op(A != B) public static #if !cppia inline #end function neq( a : Int64, b : Int64 ) : Bool
-		return __Int64.neq( a, b );
+	@:op(A != B)
+	public static #if !cppia inline #end function neq(a:Int64, b:Int64):Bool
+		return __Int64.neq(a, b);
 
 
-	@:op(A != B) @:commutative private static #if !cppia inline #end function neqInt( a : Int64, b : Int ) : Bool
-		return neq( a, b );
+	@:op(A != B)
+	@:commutative
+	private static #if !cppia inline #end function neqInt(a:Int64, b:Int):Bool
+		return neq(a, b);
 
 
-	@:op(A < B) private static #if !cppia inline #end function lt( a : Int64, b : Int64 ) : Bool
+	@:op(A < B)
+	private static #if !cppia inline #end function lt(a:Int64, b:Int64):Bool
 		return compare(a, b) < 0;
 		return compare(a, b) < 0;
 
 
-	@:op(A < B) private static #if !cppia inline #end function ltInt( a : Int64, b : Int ) : Bool
+	@:op(A < B)
+	private static #if !cppia inline #end function ltInt(a:Int64, b:Int):Bool
 		return lt(a, b);
 		return lt(a, b);
 
 
-	@:op(A < B) private static #if !cppia inline #end function intLt( a : Int, b : Int64 ) : Bool
+	@:op(A < B)
+	private static #if !cppia inline #end function intLt(a:Int, b:Int64):Bool
 		return lt(a, b);
 		return lt(a, b);
 
 
-	@:op(A <= B) private static #if !cppia inline #end function lte( a : Int64, b : Int64 ) : Bool
+	@:op(A <= B)
+	private static #if !cppia inline #end function lte(a:Int64, b:Int64):Bool
 		return compare(a, b) <= 0;
 		return compare(a, b) <= 0;
 
 
-	@:op(A <= B) private static #if !cppia inline #end function lteInt( a : Int64, b : Int ) : Bool
+	@:op(A <= B)
+	private static #if !cppia inline #end function lteInt(a:Int64, b:Int):Bool
 		return lte(a, b);
 		return lte(a, b);
 
 
-	@:op(A <= B) private static #if !cppia inline #end function intLte( a : Int, b : Int64 ) : Bool
+	@:op(A <= B)
+	private static #if !cppia inline #end function intLte(a:Int, b:Int64):Bool
 		return lte(a, b);
 		return lte(a, b);
 
 
-	@:op(A > B) private static #if !cppia inline #end function gt( a : Int64, b : Int64 ) : Bool
+	@:op(A > B)
+	private static #if !cppia inline #end function gt(a:Int64, b:Int64):Bool
 		return compare(a, b) > 0;
 		return compare(a, b) > 0;
 
 
-	@:op(A > B) private static #if !cppia inline #end function gtInt( a : Int64, b : Int ) : Bool
+	@:op(A > B)
+	private static #if !cppia inline #end function gtInt(a:Int64, b:Int):Bool
 		return gt(a, b);
 		return gt(a, b);
 
 
-	@:op(A > B) private static #if !cppia inline #end function intGt( a : Int, b : Int64 ) : Bool
-		return gt( a, b );
+	@:op(A > B)
+	private static #if !cppia inline #end function intGt(a:Int, b:Int64):Bool
+		return gt(a, b);
 
 
-	@:op(A >= B) private static #if !cppia inline #end function gte( a : Int64, b : Int64 ) : Bool
+	@:op(A >= B)
+	private static #if !cppia inline #end function gte(a:Int64, b:Int64):Bool
 		return compare(a, b) >= 0;
 		return compare(a, b) >= 0;
 
 
-	@:op(A >= B) private static #if !cppia inline #end function gteInt( a : Int64, b : Int ) : Bool
+	@:op(A >= B)
+	private static #if !cppia inline #end function gteInt(a:Int64, b:Int):Bool
 		return gte(a, b);
 		return gte(a, b);
 
 
-	@:op(A >= B) private static #if !cppia inline #end function intGte( a : Int, b : Int64 ) : Bool
+	@:op(A >= B)
+	private static #if !cppia inline #end function intGte(a:Int, b:Int64):Bool
 		return gte(a, b);
 		return gte(a, b);
 
 
 	/**
 	/**
 		Returns the bitwise NOT of `a`.
 		Returns the bitwise NOT of `a`.
 	**/
 	**/
-	@:op(~A) private static #if !cppia inline #end function complement( a : Int64 ) : Int64
-      return __Int64.complement(a);
+	@:op(~A)
+	private static #if !cppia inline #end function complement(a:Int64):Int64
+		return __Int64.complement(a);
 
 
 	/**
 	/**
 		Returns the bitwise AND of `a` and `b`.
 		Returns the bitwise AND of `a` and `b`.
 	**/
 	**/
-	@:op(A & B) public static #if !cppia inline #end function and( a : Int64, b : Int64 ) : Int64
-      return __Int64.bitAnd(a,b);
+	@:op(A & B)
+	public static #if !cppia inline #end function and(a:Int64, b:Int64):Int64
+		return __Int64.bitAnd(a, b);
 
 
 	/**
 	/**
 		Returns the bitwise OR of `a` and `b`.
 		Returns the bitwise OR of `a` and `b`.
 	**/
 	**/
-	@:op(A | B) public static #if !cppia inline #end function or( a : Int64, b : Int64 ) : Int64
-      return __Int64.bitOr(a,b);
+	@:op(A | B)
+	public static #if !cppia inline #end function or(a:Int64, b:Int64):Int64
+		return __Int64.bitOr(a, b);
 
 
 	/**
 	/**
 		Returns the bitwise XOR of `a` and `b`.
 		Returns the bitwise XOR of `a` and `b`.
 	**/
 	**/
-	@:op(A ^ B) public static #if !cppia inline #end function xor( a : Int64, b : Int64 ) : Int64
-      return __Int64.bitXor(a,b);
+	@:op(A ^ B)
+	public static #if !cppia inline #end function xor(a:Int64, b:Int64):Int64
+		return __Int64.bitXor(a, b);
 
 
 	/**
 	/**
 		Returns `a` left-shifted by `b` bits.
 		Returns `a` left-shifted by `b` bits.
 	**/
 	**/
-	@:op(A << B) public static #if !cppia inline #end function shl( a : Int64, b : Int ) : Int64
-      return __Int64.shl(a,b);
+	@:op(A << B)
+	public static #if !cppia inline #end function shl(a:Int64, b:Int):Int64
+		return __Int64.shl(a, b);
 
 
 	/**
 	/**
 		Returns `a` right-shifted by `b` bits in signed mode.
 		Returns `a` right-shifted by `b` bits in signed mode.
 		`a` is sign-extended.
 		`a` is sign-extended.
 	**/
 	**/
-	@:op(A >> B) public static #if !cppia inline #end function shr( a : Int64, b : Int) : Int64
-      return __Int64.shr(a,b);
+	@:op(A >> B)
+	public static #if !cppia inline #end function shr(a:Int64, b:Int):Int64
+		return __Int64.shr(a, b);
 
 
 	/**
 	/**
 		Returns `a` right-shifted by `b` bits in unsigned mode.
 		Returns `a` right-shifted by `b` bits in unsigned mode.
 		`a` is padded with zeroes.
 		`a` is padded with zeroes.
 	**/
 	**/
-	@:op(A >>> B) public static #if !cppia inline #end function ushr( a : Int64, b : Int ) : Int64
-      return __Int64.ushr(a,b);
+	@:op(A >>> B)
+	public static #if !cppia inline #end function ushr(a:Int64, b:Int):Int64
+		return __Int64.ushr(a, b);
 
 
-	public var high(get, never) : Int32;
-	private #if !cppia inline #end function get_high() : Int32
-      return __Int64.high(this);
+	public var high(get, never):Int32;
 
 
-	public var low(get, never) : Int32;
-	private #if !cppia inline #end function get_low() : Int32
-      return __Int64.low(this);
+	private #if !cppia inline #end function get_high():Int32
+		return __Int64.high(this);
 
 
-}
+	public var low(get, never):Int32;
 
 
+	private #if !cppia inline #end function get_low():Int32
+		return __Int64.low(this);
+}

+ 15 - 15
std/cpp/_std/haxe/Log.hx

@@ -19,31 +19,31 @@
  * 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;
 package haxe;
 
 
 @:coreApi class Log {
 @:coreApi class Log {
+	@:native("__trace")
+	extern private static function nativeTrace(message:String, posInfo:Dynamic):Void;
 
 
-   @:native("__trace")
-   extern private static function nativeTrace(message:String, posInfo:Dynamic) : Void;
-
-	public static dynamic function trace( v : Dynamic, ?infos : PosInfos ) : Void {
-		if (infos!=null && infos.customParams!=null) {
+	public static dynamic function trace(v:Dynamic, ?infos:PosInfos):Void {
+		if (infos != null && infos.customParams != null) {
 			var extra:String = "";
 			var extra:String = "";
-			for( v in infos.customParams )
+			for (v in infos.customParams)
 				extra += "," + v;
 				extra += "," + v;
-			nativeTrace(v + extra,infos);
-		}
-		else
-			nativeTrace(v,infos);
+			nativeTrace(v + extra, infos);
+		} else
+			nativeTrace(v, infos);
 	}
 	}
 
 
-	public static function formatOutput( v : Dynamic, infos : PosInfos ) : String {
+	public static function formatOutput(v:Dynamic, infos:PosInfos):String {
 		var str = Std.string(v);
 		var str = Std.string(v);
-		if( infos == null )
+		if (infos == null)
 			return str;
 			return str;
 		var pstr = infos.fileName + ":" + infos.lineNumber;
 		var pstr = infos.fileName + ":" + infos.lineNumber;
-		if( infos != null && infos.customParams != null ) for( v in infos.customParams ) str += ", " + Std.string(v);
-		return pstr+": "+str;
+		if (infos != null && infos.customParams != null)
+			for (v in infos.customParams)
+				str += ", " + Std.string(v);
+		return pstr + ": " + str;
 	}
 	}
-
 }
 }

+ 8 - 6
std/cpp/_std/haxe/Resource.hx

@@ -19,21 +19,23 @@
  * 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;
 package haxe;
 
 
 @:coreApi
 @:coreApi
 class Resource {
 class Resource {
-
-	public static function listNames() : Array<String> {
+	public static function listNames():Array<String> {
 		return untyped __global__.__hxcpp_resource_names();
 		return untyped __global__.__hxcpp_resource_names();
 	}
 	}
-	public static function getString(name:String) : String {
+
+	public static function getString(name:String):String {
 		return untyped __global__.__hxcpp_resource_string(name);
 		return untyped __global__.__hxcpp_resource_string(name);
 	}
 	}
-	public static function getBytes(name:String) : haxe.io.Bytes {
+
+	public static function getBytes(name:String):haxe.io.Bytes {
 		var array:haxe.io.BytesData = untyped __global__.__hxcpp_resource_bytes(name);
 		var array:haxe.io.BytesData = untyped __global__.__hxcpp_resource_bytes(name);
-		if (array==null) return null;
+		if (array == null)
+			return null;
 		return haxe.io.Bytes.ofData(array);
 		return haxe.io.Bytes.ofData(array);
 	}
 	}
-
 }
 }

+ 31 - 34
std/cpp/_std/haxe/Utf8.hx

@@ -19,70 +19,67 @@
  * 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;
 package haxe;
 
 
 using cpp.NativeString;
 using cpp.NativeString;
 
 
 @:coreApi
 @:coreApi
 @:deprecated('haxe.Utf8 is deprecated. Use UnicodeString instead.')
 @:deprecated('haxe.Utf8 is deprecated. Use UnicodeString instead.')
-class Utf8
-{
-   var __s:Array<Int>;
+class Utf8 {
+	var __s:Array<Int>;
 
 
-	public function new( ?size : Null<Int> ) : Void {
-      __s = new Array<Int>();
-      if (size!=null && size>0)
-         cpp.NativeArray.reserve(__s,size);
+	public function new(?size:Null<Int>):Void {
+		__s = new Array<Int>();
+		if (size != null && size > 0)
+			cpp.NativeArray.reserve(__s, size);
 	}
 	}
 
 
-	public function addChar( c : Int ) : Void {
-      __s.push(c);
+	public function addChar(c:Int):Void {
+		__s.push(c);
 	}
 	}
 
 
-	public function toString() : String {
+	public function toString():String {
 		return untyped __global__.__hxcpp_char_array_to_utf8_string(__s);
 		return untyped __global__.__hxcpp_char_array_to_utf8_string(__s);
 	}
 	}
 
 
-   // Incoming string is array of bytes containing possibly invalid utf8 chars
-   // Result is the same string with the bytes expanded into utf8 sequences
-	public static function encode( s : String ) : String {
+	// Incoming string is array of bytes containing possibly invalid utf8 chars
+	// Result is the same string with the bytes expanded into utf8 sequences
+	public static function encode(s:String):String {
 		return untyped __global__.__hxcpp_char_bytes_to_utf8_string(s);
 		return untyped __global__.__hxcpp_char_bytes_to_utf8_string(s);
 	}
 	}
 
 
-   // Incoming string is array of bytes representing valid utf8 chars
-   // Result is a string containing the compressed bytes
-	public static function decode( s : String ) : String {
+	// Incoming string is array of bytes representing valid utf8 chars
+	// Result is a string containing the compressed bytes
+	public static function decode(s:String):String {
 		return untyped __global__.__hxcpp_utf8_string_to_char_bytes(s);
 		return untyped __global__.__hxcpp_utf8_string_to_char_bytes(s);
 	}
 	}
 
 
-	public #if !cppia inline #end static function iter( s : String, chars : Int -> Void ) : Void {
-      var src = s.c_str();
-      var end = src.add( s.length );
+	public #if !cppia inline #end static function iter(s:String, chars:Int->Void):Void {
+		var src = s.c_str();
+		var end = src.add(s.length);
 
 
-      while(src.lt(end))
-         chars(src.ptr.utf8DecodeAdvance());
+		while (src.lt(end))
+			chars(src.ptr.utf8DecodeAdvance());
 	}
 	}
 
 
-	public static function charCodeAt( s : String, index : Int ) : Int {
-      return s.utf8CharCodeAt(index);
+	public static function charCodeAt(s:String, index:Int):Int {
+		return s.utf8CharCodeAt(index);
 	}
 	}
 
 
-	public static function validate( s : String ) : Bool {
-      return s.utf8IsValid();
+	public static function validate(s:String):Bool {
+		return s.utf8IsValid();
 	}
 	}
 
 
-	public static function length( s : String ) : Int {
-      return s.utf8Length();
+	public static function length(s:String):Int {
+		return s.utf8Length();
 	}
 	}
 
 
-	public static function compare( a : String, b : String ) : Int {
-      return a.compare(b);
+	public static function compare(a:String, b:String):Int {
+		return a.compare(b);
 	}
 	}
 
 
-	public static function sub( s : String, pos : Int, len : Int ) : String {
-      return s.utf8Sub(pos,len);
+	public static function sub(s:String, pos:Int, len:Int):String {
+		return s.utf8Sub(pos, len);
 	}
 	}
-
 }
 }
-
-

+ 51 - 28
std/cpp/_std/haxe/ds/IntMap.hx

@@ -19,6 +19,7 @@
  * 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;
 package haxe.ds;
 
 
 @:headerClassCode("
 @:headerClassCode("
@@ -50,62 +51,84 @@ package haxe.ds;
   inline Float get_float(int key) { return __int_hash_get_float(h,key); }
   inline Float get_float(int key) { return __int_hash_get_float(h,key); }
   inline String get_string(int key) { return __int_hash_get_string(h,key); }
   inline String get_string(int key) { return __int_hash_get_string(h,key); }
 ")
 ")
-@:coreApi class IntMap<T> implements haxe.Constraints.IMap<Int,T> {
-
+@:coreApi class IntMap<T> implements haxe.Constraints.IMap<Int, T> {
 	@:ifFeature("haxe.ds.IntMap.*")
 	@:ifFeature("haxe.ds.IntMap.*")
-	private var h : Dynamic;
+	private var h:Dynamic;
 
 
-	public function new() : Void { }
+	public function new():Void {}
 
 
-	public function set( key : Int, value : T ) : Void {
-		untyped __global__.__int_hash_set(__cpp__("HX_MAP_THIS"),key,value);
+	public function set(key:Int, value:T):Void {
+		untyped __global__.__int_hash_set(__cpp__("HX_MAP_THIS"), key, value);
 	}
 	}
 
 
-	public function get( key : Int ) : Null<T> {
-		return untyped __global__.__int_hash_get(h,key);
+	public function get(key:Int):Null<T> {
+		return untyped __global__.__int_hash_get(h, key);
 	}
 	}
 
 
-	public function exists( key : Int ) : Bool {
-		return untyped __global__.__int_hash_exists(h,key);
+	public function exists(key:Int):Bool {
+		return untyped __global__.__int_hash_exists(h, key);
 	}
 	}
 
 
-	public function remove( key : Int ) : Bool {
-		return untyped __global__.__int_hash_remove(h,key);
+	public function remove(key:Int):Bool {
+		return untyped __global__.__int_hash_remove(h, key);
 	}
 	}
 
 
-	public function keys() : Iterator<Int> {
+	public function keys():Iterator<Int> {
 		var a:Array<Int> = untyped __global__.__int_hash_keys(h);
 		var a:Array<Int> = untyped __global__.__int_hash_keys(h);
 		return a.iterator();
 		return a.iterator();
 	}
 	}
 
 
-	public function iterator() : Iterator<T> {
+	public function iterator():Iterator<T> {
 		var a:Array<Dynamic> = untyped __global__.__int_hash_values(h);
 		var a:Array<Dynamic> = untyped __global__.__int_hash_values(h);
 		return a.iterator();
 		return a.iterator();
 	}
 	}
 
 
-	@:runtime public inline function keyValueIterator() : KeyValueIterator<Int, T> {
+	@:runtime public inline function keyValueIterator():KeyValueIterator<Int, T> {
 		return new haxe.iterators.MapKeyValueIterator(this);
 		return new haxe.iterators.MapKeyValueIterator(this);
 	}
 	}
 
 
-	public function copy() : IntMap<T> {
+	public function copy():IntMap<T> {
 		var copied = new IntMap();
 		var copied = new IntMap();
-		for(key in keys()) copied.set(key, get(key));
+		for (key in keys())
+			copied.set(key, get(key));
 		return copied;
 		return copied;
 	}
 	}
 
 
-	public function toString() : String {
+	public function toString():String {
 		return untyped __global__.__int_hash_to_string(h);
 		return untyped __global__.__int_hash_to_string(h);
 	}
 	}
 
 
-   #if (scriptable)
-   private function setString(key:Int,val:String) : Void { untyped __int_hash_set_string(__cpp__("HX_MAP_THIS"),key,val); }
-   private function setInt(key:Int,val:Int) : Void { untyped __int_hash_set_int(__cpp__("HX_MAP_THIS"),key,val); }
-   private function setBool(key:Int,val:Bool) : Void { untyped __int_hash_set_int(__cpp__("HX_MAP_THIS"),key,val); }
-   private function setFloat(key:Int,val:Float) : Void { untyped __int_hash_set_float(__cpp__("HX_MAP_THIS"),key,val); }
+	#if (scriptable)
+	private function setString(key:Int, val:String):Void {
+		untyped __int_hash_set_string(__cpp__("HX_MAP_THIS"), key, val);
+	}
+
+	private function setInt(key:Int, val:Int):Void {
+		untyped __int_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
+	}
+
+	private function setBool(key:Int, val:Bool):Void {
+		untyped __int_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
+	}
+
+	private function setFloat(key:Int, val:Float):Void {
+		untyped __int_hash_set_float(__cpp__("HX_MAP_THIS"), key, val);
+	}
+
+	private function getString(key:Int):String {
+		return untyped __int_hash_get_string(h, key);
+	}
+
+	private function getInt(key:Int):Int {
+		return untyped __int_hash_get_int(h, key);
+	}
+
+	private function getBool(key:Int):Bool {
+		return untyped __int_hash_get_bool(h, key);
+	}
 
 
-   private function getString(key:Int) : String { return untyped __int_hash_get_string(h,key); }
-   private function getInt(key:Int) : Int { return untyped __int_hash_get_int(h,key); }
-   private function getBool(key:Int) : Bool { return untyped __int_hash_get_bool(h,key); }
-   private function getFloat(key:Int) : Float { return untyped __int_hash_get_float(h,key); }
-   #end
+	private function getFloat(key:Int):Float {
+		return untyped __int_hash_get_float(h, key);
+	}
+	#end
 }
 }

+ 51 - 27
std/cpp/_std/haxe/ds/ObjectMap.hx

@@ -19,6 +19,7 @@
  * 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;
 package haxe.ds;
 
 
 @:headerClassCode("
 @:headerClassCode("
@@ -50,61 +51,84 @@ package haxe.ds;
 
 
 ")
 ")
 @:coreApi
 @:coreApi
-class ObjectMap<K:{},V> implements haxe.Constraints.IMap<K,V> {
+class ObjectMap<K:{}, V> implements haxe.Constraints.IMap<K, V> {
 	@:ifFeature("haxe.ds.ObjectMap.*")
 	@:ifFeature("haxe.ds.ObjectMap.*")
-	private var h : Dynamic;
+	private var h:Dynamic;
 
 
-	public function new() : Void { }
+	public function new():Void {}
 
 
-	public function set( key : K, value : V ) : Void {
-		untyped __global__.__object_hash_set(__cpp__("HX_MAP_THIS"),key,value);
+	public function set(key:K, value:V):Void {
+		untyped __global__.__object_hash_set(__cpp__("HX_MAP_THIS"), key, value);
 	}
 	}
 
 
-	public function get( key : K ) : Null<V> {
-		return untyped __global__.__object_hash_get(h,key);
+	public function get(key:K):Null<V> {
+		return untyped __global__.__object_hash_get(h, key);
 	}
 	}
 
 
-	public function exists( key : K ) : Bool {
-		return untyped __global__.__object_hash_exists(h,key);
+	public function exists(key:K):Bool {
+		return untyped __global__.__object_hash_exists(h, key);
 	}
 	}
 
 
-	public function remove( key : K ) : Bool {
-		return untyped __global__.__object_hash_remove(h,key);
+	public function remove(key:K):Bool {
+		return untyped __global__.__object_hash_remove(h, key);
 	}
 	}
 
 
-	public function keys() : Iterator<K> {
+	public function keys():Iterator<K> {
 		var a:Array<K> = untyped __global__.__object_hash_keys(h);
 		var a:Array<K> = untyped __global__.__object_hash_keys(h);
 		return a.iterator();
 		return a.iterator();
 	}
 	}
 
 
-	public function iterator() : Iterator<V> {
+	public function iterator():Iterator<V> {
 		var a:Array<Dynamic> = untyped __global__.__object_hash_values(h);
 		var a:Array<Dynamic> = untyped __global__.__object_hash_values(h);
 		return a.iterator();
 		return a.iterator();
 	}
 	}
 
 
-	@:runtime public inline function keyValueIterator() : KeyValueIterator<K, V> {
+	@:runtime public inline function keyValueIterator():KeyValueIterator<K, V> {
 		return new haxe.iterators.MapKeyValueIterator(this);
 		return new haxe.iterators.MapKeyValueIterator(this);
 	}
 	}
 
 
-	public function copy() : ObjectMap<K,V> {
+	public function copy():ObjectMap<K, V> {
 		var copied = new ObjectMap();
 		var copied = new ObjectMap();
-		for(key in keys()) copied.set(key, get(key));
+		for (key in keys())
+			copied.set(key, get(key));
 		return copied;
 		return copied;
 	}
 	}
 
 
-	public function toString() : String {
+	public function toString():String {
 		return untyped __global__.__object_hash_to_string(h);
 		return untyped __global__.__object_hash_to_string(h);
 	}
 	}
 
 
-   #if (scriptable)
-   private function setString(key:Dynamic,val:String) : Void { untyped __object_hash_set_string(__cpp__("HX_MAP_THIS"),key,val); }
-   private function setInt(key:Dynamic,val:Int) : Void { untyped __object_hash_set_int(__cpp__("HX_MAP_THIS"),key,val); }
-   private function setBool(key:Dynamic,val:Bool) : Void { untyped __object_hash_set_int(__cpp__("HX_MAP_THIS"),key,val); }
-   private function setFloat(key:Dynamic,val:Float) : Void { untyped __object_hash_set_float(__cpp__("HX_MAP_THIS"),key,val); }
+	#if (scriptable)
+	private function setString(key:Dynamic, val:String):Void {
+		untyped __object_hash_set_string(__cpp__("HX_MAP_THIS"), key, val);
+	}
+
+	private function setInt(key:Dynamic, val:Int):Void {
+		untyped __object_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
+	}
+
+	private function setBool(key:Dynamic, val:Bool):Void {
+		untyped __object_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
+	}
+
+	private function setFloat(key:Dynamic, val:Float):Void {
+		untyped __object_hash_set_float(__cpp__("HX_MAP_THIS"), key, val);
+	}
 
 
-   private function getString(key:Dynamic) : String { return untyped __object_hash_get_string(h,key); }
-   private function getInt(key:Dynamic) : Int { return untyped __object_hash_get_int(h,key); }
-   private function getBool(key:Dynamic) : Bool { return untyped __object_hash_get_bool(h,key); }
-   private function getFloat(key:Dynamic) : Float { return untyped __object_hash_get_float(h,key); }
-   #end
+	private function getString(key:Dynamic):String {
+		return untyped __object_hash_get_string(h, key);
+	}
+
+	private function getInt(key:Dynamic):Int {
+		return untyped __object_hash_get_int(h, key);
+	}
+
+	private function getBool(key:Dynamic):Bool {
+		return untyped __object_hash_get_bool(h, key);
+	}
+
+	private function getFloat(key:Dynamic):Float {
+		return untyped __object_hash_get_float(h, key);
+	}
+	#end
 }
 }

+ 51 - 27
std/cpp/_std/haxe/ds/StringMap.hx

@@ -19,6 +19,7 @@
  * 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;
 package haxe.ds;
 
 
 @:headerClassCode("
 @:headerClassCode("
@@ -50,61 +51,84 @@ package haxe.ds;
   inline Float get_float(String key) { return __string_hash_get_float(h,key); }
   inline Float get_float(String key) { return __string_hash_get_float(h,key); }
   inline String get_string(String key) { return __string_hash_get_string(h,key); }
   inline String get_string(String key) { return __string_hash_get_string(h,key); }
 ")
 ")
-@:coreApi class StringMap<T> implements haxe.Constraints.IMap<String,T> {
+@:coreApi class StringMap<T> implements haxe.Constraints.IMap<String, T> {
 	@:ifFeature("haxe.ds.StringMap.*")
 	@:ifFeature("haxe.ds.StringMap.*")
-	private var h : Dynamic;
+	private var h:Dynamic;
 
 
-	public function new() : Void { }
+	public function new():Void {}
 
 
-	public function set( key : String, value : T ) : Void {
-		untyped __global__.__string_hash_set(__cpp__("HX_MAP_THIS"),key,value);
+	public function set(key:String, value:T):Void {
+		untyped __global__.__string_hash_set(__cpp__("HX_MAP_THIS"), key, value);
 	}
 	}
 
 
-	public function get( key : String ) : Null<T> {
-		return untyped __global__.__string_hash_get(h,key);
+	public function get(key:String):Null<T> {
+		return untyped __global__.__string_hash_get(h, key);
 	}
 	}
 
 
-	public function exists( key : String ) : Bool {
-		return untyped __global__.__string_hash_exists(h,key);
+	public function exists(key:String):Bool {
+		return untyped __global__.__string_hash_exists(h, key);
 	}
 	}
 
 
-	public function remove( key : String ) : Bool {
-		return untyped __global__.__string_hash_remove(h,key);
+	public function remove(key:String):Bool {
+		return untyped __global__.__string_hash_remove(h, key);
 	}
 	}
 
 
-	public function keys() : Iterator<String> {
+	public function keys():Iterator<String> {
 		var a:Array<String> = untyped __global__.__string_hash_keys(h);
 		var a:Array<String> = untyped __global__.__string_hash_keys(h);
 		return a.iterator();
 		return a.iterator();
 	}
 	}
 
 
-	public function iterator() : Iterator<T> {
+	public function iterator():Iterator<T> {
 		var a:Array<Dynamic> = untyped __global__.__string_hash_values(h);
 		var a:Array<Dynamic> = untyped __global__.__string_hash_values(h);
 		return a.iterator();
 		return a.iterator();
 	}
 	}
 
 
-	@:runtime public inline function keyValueIterator() : KeyValueIterator<String, T> {
+	@:runtime public inline function keyValueIterator():KeyValueIterator<String, T> {
 		return new haxe.iterators.MapKeyValueIterator(this);
 		return new haxe.iterators.MapKeyValueIterator(this);
 	}
 	}
 
 
-	public function copy() : StringMap<T> {
+	public function copy():StringMap<T> {
 		var copied = new StringMap();
 		var copied = new StringMap();
-		for(key in keys()) copied.set(key, get(key));
+		for (key in keys())
+			copied.set(key, get(key));
 		return copied;
 		return copied;
 	}
 	}
 
 
-	public function toString() : String {
+	public function toString():String {
 		return untyped __global__.__string_hash_to_string(h);
 		return untyped __global__.__string_hash_to_string(h);
 	}
 	}
 
 
-   #if (scriptable)
-   private function setString(key:String,val:String) : Void { untyped __string_hash_set_string(__cpp__("HX_MAP_THIS"),key,val); }
-   private function setInt(key:String,val:Int) : Void { untyped __string_hash_set_int(__cpp__("HX_MAP_THIS"),key,val); }
-   private function setBool(key:String,val:Bool) : Void { untyped __string_hash_set_int(__cpp__("HX_MAP_THIS"),key,val); }
-   private function setFloat(key:String,val:Float) : Void { untyped __string_hash_set_float(__cpp__("HX_MAP_THIS"),key,val); }
+	#if (scriptable)
+	private function setString(key:String, val:String):Void {
+		untyped __string_hash_set_string(__cpp__("HX_MAP_THIS"), key, val);
+	}
+
+	private function setInt(key:String, val:Int):Void {
+		untyped __string_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
+	}
+
+	private function setBool(key:String, val:Bool):Void {
+		untyped __string_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
+	}
+
+	private function setFloat(key:String, val:Float):Void {
+		untyped __string_hash_set_float(__cpp__("HX_MAP_THIS"), key, val);
+	}
 
 
-   private function getString(key:String) : String { return untyped __string_hash_get_string(h,key); }
-   private function getInt(key:String) : Int { return untyped __string_hash_get_int(h,key); }
-   private function getBool(key:String) : Bool { return untyped __string_hash_get_bool(h,key); }
-   private function getFloat(key:String) : Float { return untyped __string_hash_get_float(h,key); }
-   #end
+	private function getString(key:String):String {
+		return untyped __string_hash_get_string(h, key);
+	}
+
+	private function getInt(key:String):Int {
+		return untyped __string_hash_get_int(h, key);
+	}
+
+	private function getBool(key:String):Bool {
+		return untyped __string_hash_get_bool(h, key);
+	}
+
+	private function getFloat(key:String):Float {
+		return untyped __string_hash_get_float(h, key);
+	}
+	#end
 }
 }

+ 19 - 18
std/cpp/_std/haxe/ds/WeakMap.hx

@@ -19,6 +19,7 @@
  * 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;
 package haxe.ds;
 
 
 @:headerClassCode("
 @:headerClassCode("
@@ -43,50 +44,50 @@ package haxe.ds;
   inline void set(Dynamic key, const ::cpp::Function<V> &value) {__object_hash_set(HX_MAP_THIS,key,(Dynamic)value,true ); }
   inline void set(Dynamic key, const ::cpp::Function<V> &value) {__object_hash_set(HX_MAP_THIS,key,(Dynamic)value,true ); }
 ")
 ")
 @:coreApi
 @:coreApi
-class WeakMap<K:{},V> implements haxe.Constraints.IMap<K,V> {
+class WeakMap<K:{}, V> implements haxe.Constraints.IMap<K, V> {
 	@:ifFeature("haxe.ds.WeakMap.*")
 	@:ifFeature("haxe.ds.WeakMap.*")
-	private var h : Dynamic;
+	private var h:Dynamic;
 
 
-	public function new() : Void { }
+	public function new():Void {}
 
 
-	public function set( key : K, value : V ) : Void {
-		untyped __global__.__object_hash_set(__cpp__("HX_MAP_THIS"),key,value,true);
+	public function set(key:K, value:V):Void {
+		untyped __global__.__object_hash_set(__cpp__("HX_MAP_THIS"), key, value, true);
 	}
 	}
 
 
-	public function get( key : K ) : Null<V> {
-		return untyped __global__.__object_hash_get(h,key);
+	public function get(key:K):Null<V> {
+		return untyped __global__.__object_hash_get(h, key);
 	}
 	}
 
 
-	public function exists( key : K ) : Bool {
-		return untyped __global__.__object_hash_exists(h,key);
+	public function exists(key:K):Bool {
+		return untyped __global__.__object_hash_exists(h, key);
 	}
 	}
 
 
-	public function remove( key : K ) : Bool {
-		return untyped __global__.__object_hash_remove(h,key);
+	public function remove(key:K):Bool {
+		return untyped __global__.__object_hash_remove(h, key);
 	}
 	}
 
 
-	public function keys() : Iterator<K> {
+	public function keys():Iterator<K> {
 		var a:Array<K> = untyped __global__.__object_hash_keys(h);
 		var a:Array<K> = untyped __global__.__object_hash_keys(h);
 		return a.iterator();
 		return a.iterator();
 	}
 	}
 
 
-	public function iterator() : Iterator<V> {
+	public function iterator():Iterator<V> {
 		var a:Array<Dynamic> = untyped __global__.__object_hash_values(h);
 		var a:Array<Dynamic> = untyped __global__.__object_hash_values(h);
 		return a.iterator();
 		return a.iterator();
 	}
 	}
 
 
-	public inline function keyValueIterator() : KeyValueIterator<K, V> {
+	public inline function keyValueIterator():KeyValueIterator<K, V> {
 		return new haxe.iterators.MapKeyValueIterator(this);
 		return new haxe.iterators.MapKeyValueIterator(this);
 	}
 	}
 
 
-	public function copy() : WeakMap<K,V> {
+	public function copy():WeakMap<K, V> {
 		var copied = new WeakMap();
 		var copied = new WeakMap();
-		for(key in keys()) copied.set(key, get(key));
+		for (key in keys())
+			copied.set(key, get(key));
 		return copied;
 		return copied;
 	}
 	}
 
 
-
-	public function toString() : String {
+	public function toString():String {
 		return untyped __global__.__object_hash_to_string(h);
 		return untyped __global__.__object_hash_to_string(h);
 	}
 	}
 }
 }

+ 23 - 23
std/cpp/_std/haxe/zip/Compress.hx

@@ -19,53 +19,53 @@
  * 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.zip;
 package haxe.zip;
 
 
 @:coreApi @:buildXml('<include name="${HXCPP}/src/hx/libs/zlib/Build.xml" />')
 @:coreApi @:buildXml('<include name="${HXCPP}/src/hx/libs/zlib/Build.xml" />')
 class Compress {
 class Compress {
+	var s:Dynamic;
 
 
-	var s : Dynamic;
-
-	public function new( level : Int ) : Void {
+	public function new(level:Int):Void {
 		s = _deflate_init(level);
 		s = _deflate_init(level);
 	}
 	}
 
 
-	public function execute( src : haxe.io.Bytes, srcPos : Int, dst : haxe.io.Bytes, dstPos : Int ) : { done : Bool, read : Int, write : Int } {
-		return _deflate_buffer(s,src.getData(),srcPos,dst.getData(),dstPos);
+	public function execute(src:haxe.io.Bytes, srcPos:Int, dst:haxe.io.Bytes, dstPos:Int):{done:Bool, read:Int, write:Int} {
+		return _deflate_buffer(s, src.getData(), srcPos, dst.getData(), dstPos);
 	}
 	}
 
 
-	public function setFlushMode( f : FlushMode ) : Void {
-		_set_flush_mode(s,Std.string(f));
+	public function setFlushMode(f:FlushMode):Void {
+		_set_flush_mode(s, Std.string(f));
 	}
 	}
 
 
-	public function close() : Void {
+	public function close():Void {
 		_deflate_end(s);
 		_deflate_end(s);
 	}
 	}
 
 
-	public static function run( s : haxe.io.Bytes, level : Int ) : haxe.io.Bytes {
+	public static function run(s:haxe.io.Bytes, level:Int):haxe.io.Bytes {
 		var c = new Compress(level);
 		var c = new Compress(level);
 		c.setFlushMode(FlushMode.FINISH);
 		c.setFlushMode(FlushMode.FINISH);
-		var out = haxe.io.Bytes.alloc(_deflate_bound(c.s,s.length));
-		var r = c.execute(s,0,out,0);
+		var out = haxe.io.Bytes.alloc(_deflate_bound(c.s, s.length));
+		var r = c.execute(s, 0, out, 0);
 		c.close();
 		c.close();
-		if( !r.done || r.read != s.length )
+		if (!r.done || r.read != s.length)
 			throw "Compression failed";
 			throw "Compression failed";
-		return out.sub(0,r.write);
+		return out.sub(0, r.write);
 	}
 	}
 
 
-    @:native("_hx_deflate_init")
-	extern static function _deflate_init(level:Int) : Dynamic;
+	@:native("_hx_deflate_init")
+	extern static function _deflate_init(level:Int):Dynamic;
 
 
-    @:native("_hx_deflate_bound")
-	extern static function _deflate_bound(handle:Dynamic,length:Int):Int;
+	@:native("_hx_deflate_bound")
+	extern static function _deflate_bound(handle:Dynamic, length:Int):Int;
 
 
-    @:native("_hx_deflate_buffer")
-	extern static function _deflate_buffer(handle:Dynamic, src:haxe.io.BytesData, srcPos:Int,  dest:haxe.io.BytesData, destPos:Int) : { done : Bool, read : Int, write : Int };
+	@:native("_hx_deflate_buffer")
+	extern static function _deflate_buffer(handle:Dynamic, src:haxe.io.BytesData, srcPos:Int, dest:haxe.io.BytesData,
+		destPos:Int):{done:Bool, read:Int, write:Int};
 
 
-    @:native("_hx_deflate_end")
-	extern static function _deflate_end(handle:Dynamic) : Void;
+	@:native("_hx_deflate_end")
+	extern static function _deflate_end(handle:Dynamic):Void;
 
 
-    @:native("_hx_zip_set_flush_mode")
+	@:native("_hx_zip_set_flush_mode")
 	extern static function _set_flush_mode(handle:Dynamic, flushMode:String):Void;
 	extern static function _set_flush_mode(handle:Dynamic, flushMode:String):Void;
-
 }
 }

+ 22 - 20
std/cpp/_std/haxe/zip/Uncompress.hx

@@ -19,56 +19,58 @@
  * 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.zip;
 package haxe.zip;
 
 
 @:coreApi @:buildXml('<include name="${HXCPP}/src/hx/libs/zlib/Build.xml"/>')
 @:coreApi @:buildXml('<include name="${HXCPP}/src/hx/libs/zlib/Build.xml"/>')
 class Uncompress {
 class Uncompress {
-	var s : Dynamic;
+	var s:Dynamic;
 
 
-	public function new( ?windowBits : Int ) : Void {
+	public function new(?windowBits:Int):Void {
 		s = _inflate_init(windowBits);
 		s = _inflate_init(windowBits);
 	}
 	}
 
 
-	public function execute( src : haxe.io.Bytes, srcPos : Int, dst : haxe.io.Bytes, dstPos : Int ) : { done : Bool, read : Int, write : Int } {
-		return _inflate_buffer(s,src.getData(),srcPos,dst.getData(),dstPos);
+	public function execute(src:haxe.io.Bytes, srcPos:Int, dst:haxe.io.Bytes, dstPos:Int):{done:Bool, read:Int, write:Int} {
+		return _inflate_buffer(s, src.getData(), srcPos, dst.getData(), dstPos);
 	}
 	}
 
 
-	public function setFlushMode( f : FlushMode ) : Void {
-		_set_flush_mode(s,untyped f.__Tag());
+	public function setFlushMode(f:FlushMode):Void {
+		_set_flush_mode(s, untyped f.__Tag());
 	}
 	}
 
 
-	public function close() : Void {
+	public function close():Void {
 		_inflate_end(s);
 		_inflate_end(s);
 	}
 	}
 
 
-	public static function run( src : haxe.io.Bytes, ?bufsize : Int ) : haxe.io.Bytes {
+	public static function run(src:haxe.io.Bytes, ?bufsize:Int):haxe.io.Bytes {
 		var u = new Uncompress(null);
 		var u = new Uncompress(null);
-		if( bufsize == null ) bufsize = 1 << 16; // 64K
+		if (bufsize == null)
+			bufsize = 1 << 16; // 64K
 		var tmp = haxe.io.Bytes.alloc(bufsize);
 		var tmp = haxe.io.Bytes.alloc(bufsize);
 		var b = new haxe.io.BytesBuffer();
 		var b = new haxe.io.BytesBuffer();
 		var pos = 0;
 		var pos = 0;
 		u.setFlushMode(FlushMode.SYNC);
 		u.setFlushMode(FlushMode.SYNC);
-		while( true ) {
-			var r = u.execute(src,pos,tmp,0);
-			b.addBytes(tmp,0,r.write);
+		while (true) {
+			var r = u.execute(src, pos, tmp, 0);
+			b.addBytes(tmp, 0, r.write);
 			pos += r.read;
 			pos += r.read;
-			if( r.done )
+			if (r.done)
 				break;
 				break;
 		}
 		}
 		u.close();
 		u.close();
 		return b.getBytes();
 		return b.getBytes();
 	}
 	}
 
 
-   @:native("_hx_inflate_init")
-	extern static function _inflate_init(windowBits:Dynamic) : Dynamic;
+	@:native("_hx_inflate_init")
+	extern static function _inflate_init(windowBits:Dynamic):Dynamic;
 
 
-   @:native("_hx_inflate_buffer")
-	extern static function _inflate_buffer(handle:Dynamic, src:haxe.io.BytesData, srcPos:Int,  dest:haxe.io.BytesData, destPos:Int) : { done : Bool, read : Int, write : Int };
+	@:native("_hx_inflate_buffer")
+	extern static function _inflate_buffer(handle:Dynamic, src:haxe.io.BytesData, srcPos:Int, dest:haxe.io.BytesData,
+		destPos:Int):{done:Bool, read:Int, write:Int};
 
 
-   @:native("_hx_inflate_end")
+	@:native("_hx_inflate_end")
 	extern static function _inflate_end(handle:Dynamic):Void;
 	extern static function _inflate_end(handle:Dynamic):Void;
 
 
-   @:native("_hx_zip_set_flush_mode")
+	@:native("_hx_zip_set_flush_mode")
 	extern static function _set_flush_mode(handle:Dynamic, flushMode:String):Void;
 	extern static function _set_flush_mode(handle:Dynamic, flushMode:String):Void;
-
 }
 }

+ 35 - 22
std/cpp/_std/sys/FileSystem.hx

@@ -19,6 +19,7 @@
  * 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 sys;
 package sys;
 
 
 import cpp.NativeSys;
 import cpp.NativeSys;
@@ -26,43 +27,55 @@ import cpp.NativeSys;
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
 @:coreApi
 @:coreApi
 class FileSystem {
 class FileSystem {
-
-	public static function exists( path : String ) : Bool {
+	public static function exists(path:String):Bool {
 		return NativeSys.sys_exists(makeCompatiblePath(path));
 		return NativeSys.sys_exists(makeCompatiblePath(path));
 	}
 	}
 
 
-	public static function rename( path : String, newPath : String ) : Void {
-		NativeSys.sys_rename(path,newPath);
+	public static function rename(path:String, newPath:String):Void {
+		NativeSys.sys_rename(path, newPath);
 	}
 	}
 
 
-	public static function stat( path : String ) : FileStat {
-		var s : FileStat = NativeSys.sys_stat(makeCompatiblePath(path));
-		if (s==null)
-			return { gid:0, uid:0, atime:Date.fromTime(0), mtime:Date.fromTime(0), ctime:Date.fromTime(0), dev:0, ino:0, nlink:0, rdev:0, size:0, mode:0 };
-		s.atime = Date.fromTime(1000.0*(untyped s.atime));
-		s.mtime = Date.fromTime(1000.0*(untyped s.mtime));
-		s.ctime = Date.fromTime(1000.0*(untyped s.ctime));
+	public static function stat(path:String):FileStat {
+		var s:FileStat = NativeSys.sys_stat(makeCompatiblePath(path));
+		if (s == null)
+			return {
+				gid: 0,
+				uid: 0,
+				atime: Date.fromTime(0),
+				mtime: Date.fromTime(0),
+				ctime: Date.fromTime(0),
+				dev: 0,
+				ino: 0,
+				nlink: 0,
+				rdev: 0,
+				size: 0,
+				mode: 0
+			};
+		s.atime = Date.fromTime(1000.0 * (untyped s.atime));
+		s.mtime = Date.fromTime(1000.0 * (untyped s.mtime));
+		s.ctime = Date.fromTime(1000.0 * (untyped s.ctime));
 		return s;
 		return s;
 	}
 	}
 
 
-	public static function fullPath( relPath : String ) : String {
+	public static function fullPath(relPath:String):String {
 		return NativeSys.file_full_path(relPath);
 		return NativeSys.file_full_path(relPath);
 	}
 	}
 
 
-	public static function absolutePath ( relPath : String ) : String {
-		if (haxe.io.Path.isAbsolute(relPath)) return relPath;
+	public static function absolutePath(relPath:String):String {
+		if (haxe.io.Path.isAbsolute(relPath))
+			return relPath;
 		return haxe.io.Path.join([Sys.getCwd(), relPath]);
 		return haxe.io.Path.join([Sys.getCwd(), relPath]);
 	}
 	}
 
 
-	inline static function kind( path : String ) : String {
-		return  NativeSys.sys_file_type(makeCompatiblePath(path));
+	inline static function kind(path:String):String {
+		return NativeSys.sys_file_type(makeCompatiblePath(path));
 	}
 	}
 
 
-	public static function isDirectory( path : String ) : Bool {
+	public static function isDirectory(path:String):Bool {
 		return kind(path) == "dir";
 		return kind(path) == "dir";
 	}
 	}
 
 
-	public static function createDirectory( path : String ) : Void {
+	public static function createDirectory(path:String):Void {
 		var path = haxe.io.Path.addTrailingSlash(path);
 		var path = haxe.io.Path.addTrailingSlash(path);
 		var _p = null;
 		var _p = null;
 		var parts = [];
 		var parts = [];
@@ -71,20 +84,20 @@ class FileSystem {
 			path = _p;
 			path = _p;
 		}
 		}
 		for (part in parts) {
 		for (part in parts) {
-			if (part.charCodeAt(part.length - 1) != ":".code && !exists(part) && !NativeSys.sys_create_dir( part, 493 ))
+			if (part.charCodeAt(part.length - 1) != ":".code && !exists(part) && !NativeSys.sys_create_dir(part, 493))
 				throw "Could not create directory:" + part;
 				throw "Could not create directory:" + part;
 		}
 		}
 	}
 	}
 
 
-	public static function deleteFile( path : String ) : Void {
+	public static function deleteFile(path:String):Void {
 		NativeSys.file_delete(path);
 		NativeSys.file_delete(path);
 	}
 	}
 
 
-	public static function deleteDirectory( path : String ) : Void {
+	public static function deleteDirectory(path:String):Void {
 		NativeSys.sys_remove_dir(path);
 		NativeSys.sys_remove_dir(path);
 	}
 	}
 
 
-	public static function readDirectory( path : String ) : Array<String> {
+	public static function readDirectory(path:String):Array<String> {
 		return NativeSys.sys_read_dir(path);
 		return NativeSys.sys_read_dir(path);
 	}
 	}
 
 

+ 82 - 81
std/cpp/_std/sys/db/Mysql.hx

@@ -19,55 +19,63 @@
  * 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 sys.db;
 package sys.db;
 
 
 @:keep
 @:keep
 private class D {
 private class D {
-
-   @:native("_hx_mysql_connect")
+	@:native("_hx_mysql_connect")
 	extern public static function connect(params:Dynamic):Dynamic;
 	extern public static function connect(params:Dynamic):Dynamic;
-   @:native("_hx_mysql_select_db")
+
+	@:native("_hx_mysql_select_db")
 	extern public static function select_db(handle:Dynamic, db:String):Void;
 	extern public static function select_db(handle:Dynamic, db:String):Void;
-   @:native("_hx_mysql_request")
-	extern public static function request(handle:Dynamic,req:String):Dynamic;
-   @:native("_hx_mysql_close")
+
+	@:native("_hx_mysql_request")
+	extern public static function request(handle:Dynamic, req:String):Dynamic;
+
+	@:native("_hx_mysql_close")
 	extern public static function close(handle:Dynamic):Dynamic;
 	extern public static function close(handle:Dynamic):Dynamic;
-   @:native("_hx_mysql_escape")
-	extern public static function escape(handle:Dynamic,str:String):String;
-   @:native("_hx_mysql_result_get_length")
+
+	@:native("_hx_mysql_escape")
+	extern public static function escape(handle:Dynamic, str:String):String;
+
+	@:native("_hx_mysql_result_get_length")
 	extern public static function result_get_length(handle:Dynamic):Int;
 	extern public static function result_get_length(handle:Dynamic):Int;
-   @:native("_hx_mysql_result_get_nfields")
+
+	@:native("_hx_mysql_result_get_nfields")
 	extern public static function result_get_nfields(handle:Dynamic):Int;
 	extern public static function result_get_nfields(handle:Dynamic):Int;
-   @:native("_hx_mysql_result_next")
+
+	@:native("_hx_mysql_result_next")
 	extern public static function result_next(handle:Dynamic):Dynamic;
 	extern public static function result_next(handle:Dynamic):Dynamic;
-   @:native("_hx_mysql_result_get")
-	extern public static function result_get(handle:Dynamic,i:Int) : String;
-   @:native("_hx_mysql_result_get_int")
-	extern public static function result_get_int(handle:Dynamic,i:Int) : Int;
-   @:native("_hx_mysql_result_get_float")
-	extern public static function result_get_float(handle:Dynamic,i:Int):Float;
-   @:native("_hx_mysql_result_get_fields_names")
-	extern public static function result_fields_names(handle:Dynamic):Array<String>;
 
 
-   @:native("_hx_mysql_set_conversion")
-	extern public static function set_conv_funs(
-      charsToBytes: cpp.Callable< Dynamic -> Dynamic >,
-      intToDate: cpp.Callable< Float -> Dynamic > ) : Void;
+	@:native("_hx_mysql_result_get")
+	extern public static function result_get(handle:Dynamic, i:Int):String;
 
 
-   public static function charsToBytes(data:Dynamic) : Dynamic
-      return haxe.io.Bytes.ofData(data);
+	@:native("_hx_mysql_result_get_int")
+	extern public static function result_get_int(handle:Dynamic, i:Int):Int;
 
 
-   public static function secondsToDate(seconds:Float) : Dynamic
-      return Date.fromTime(seconds * 1000);
+	@:native("_hx_mysql_result_get_float")
+	extern public static function result_get_float(handle:Dynamic, i:Int):Float;
 
 
+	@:native("_hx_mysql_result_get_fields_names")
+	extern public static function result_fields_names(handle:Dynamic):Array<String>;
+
+	@:native("_hx_mysql_set_conversion")
+	extern public static function set_conv_funs(charsToBytes:cpp.Callable<Dynamic->Dynamic>, intToDate:cpp.Callable<Float->Dynamic>):Void;
+
+	public static function charsToBytes(data:Dynamic):Dynamic
+		return haxe.io.Bytes.ofData(data);
+
+	public static function secondsToDate(seconds:Float):Dynamic
+		return Date.fromTime(seconds * 1000);
 }
 }
 
 
 private class MysqlResultSet implements sys.db.ResultSet {
 private class MysqlResultSet implements sys.db.ResultSet {
+	public var length(get, null):Int;
+	public var nfields(get, null):Int;
 
 
-	public var length(get,null) : Int;
-	public var nfields(get,null) : Int;
-	private var __r : Dynamic;
-	private var cache : Dynamic;
+	private var __r:Dynamic;
+	private var cache:Dynamic;
 
 
 	public function new(r:Dynamic) {
 	public function new(r:Dynamic) {
 		__r = r;
 		__r = r;
@@ -82,14 +90,14 @@ private class MysqlResultSet implements sys.db.ResultSet {
 	}
 	}
 
 
 	public function hasNext() {
 	public function hasNext() {
-		if( cache == null )
+		if (cache == null)
 			cache = next();
 			cache = next();
 		return (cache != null);
 		return (cache != null);
 	}
 	}
 
 
-	public function next() : Dynamic {
+	public function next():Dynamic {
 		var c = cache;
 		var c = cache;
-		if( c != null ) {
+		if (c != null) {
 			cache = null;
 			cache = null;
 			return c;
 			return c;
 		}
 		}
@@ -97,72 +105,67 @@ private class MysqlResultSet implements sys.db.ResultSet {
 		return c;
 		return c;
 	}
 	}
 
 
-	public function results() : List<Dynamic> {
+	public function results():List<Dynamic> {
 		var l = new List();
 		var l = new List();
-		while( hasNext() )
+		while (hasNext())
 			l.add(next());
 			l.add(next());
 		return l;
 		return l;
 	}
 	}
 
 
-	public function getResult( n : Int ) {
-		return D.result_get(__r,n);
+	public function getResult(n:Int) {
+		return D.result_get(__r, n);
 	}
 	}
 
 
-	public function getIntResult( n : Int ) : Int {
-		return D.result_get_int(__r,n);
+	public function getIntResult(n:Int):Int {
+		return D.result_get_int(__r, n);
 	}
 	}
 
 
-	public function getFloatResult( n : Int ) : Float {
-		return D.result_get_float(__r,n);
+	public function getFloatResult(n:Int):Float {
+		return D.result_get_float(__r, n);
 	}
 	}
 
 
-	public function getFieldsNames() : Array<String> {
+	public function getFieldsNames():Array<String> {
 		var a = D.result_fields_names(__r);
 		var a = D.result_fields_names(__r);
 		return a;
 		return a;
 	}
 	}
-
 }
 }
 
 
 private class MysqlConnection implements sys.db.Connection {
 private class MysqlConnection implements sys.db.Connection {
-
-	private var __c : Dynamic;
+	private var __c:Dynamic;
 
 
 	public function new(c:Dynamic) {
 	public function new(c:Dynamic) {
 		__c = c;
 		__c = c;
-	 D.set_conv_funs( cpp.Function.fromStaticFunction(D.charsToBytes),
-                     cpp.Function.fromStaticFunction(D.secondsToDate) );
-
+		D.set_conv_funs(cpp.Function.fromStaticFunction(D.charsToBytes), cpp.Function.fromStaticFunction(D.secondsToDate));
 	}
 	}
 
 
-	public function request( s : String ) : sys.db.ResultSet {
-			var r = D.request(this.__c, s);
-			return new MysqlResultSet(r);
+	public function request(s:String):sys.db.ResultSet {
+		var r = D.request(this.__c, s);
+		return new MysqlResultSet(r);
 	}
 	}
 
 
 	public function close() {
 	public function close() {
 		D.close(__c);
 		D.close(__c);
 	}
 	}
 
 
-	public function escape( s : String ) {
-		return D.escape(__c,s);
+	public function escape(s:String) {
+		return D.escape(__c, s);
 	}
 	}
 
 
-	public function quote( s : String ) {
-		return "'"+escape(s)+"'";
+	public function quote(s:String) {
+		return "'" + escape(s) + "'";
 	}
 	}
 
 
-	public function addValue( s : StringBuf, v : Dynamic ) {
+	public function addValue(s:StringBuf, v:Dynamic) {
 		if (v == null) {
 		if (v == null) {
 			s.add(v);
 			s.add(v);
-      }
-      else if (Std.is(v,Bool)) {
-				s.add( v ? 1 : 0 );
-			} else {
+		} else if (Std.is(v, Bool)) {
+			s.add(v ? 1 : 0);
+		} else {
 			var t:Int = untyped v.__GetType();
 			var t:Int = untyped v.__GetType();
-			if( t == 0xff )
+			if (t == 0xff)
 				s.add(v);
 				s.add(v);
-			else if( t == 2 )
-				s.add( untyped v.__GetInt() ? "1".code : "0".code );
+			else if (t == 2)
+				s.add(untyped v.__GetInt() ? "1".code : "0".code);
 			else {
 			else {
 				s.addChar("'".code);
 				s.addChar("'".code);
 				s.add(escape(Std.string(v)));
 				s.add(escape(Std.string(v)));
@@ -196,32 +199,30 @@ private class MysqlConnection implements sys.db.Connection {
 
 
 @:buildXml('<include name="${HXCPP}/src/hx/libs/mysql/Build.xml"/>')
 @:buildXml('<include name="${HXCPP}/src/hx/libs/mysql/Build.xml"/>')
 @:coreApi class Mysql {
 @:coreApi class Mysql {
-
-	public static function connect( params : {
-		host : String,
-		?port : Int,
-		user : String,
-		pass : String,
-		?socket : String,
-		?database : String
-	} ) : sys.db.Connection {
+	public static function connect(params:{
+		host:String,
+		?port:Int,
+		user:String,
+		pass:String,
+		?socket:String,
+		?database:String
+	}):sys.db.Connection {
 		var o = {
 		var o = {
-			host : params.host,
-			port : if( params.port == null ) 3306 else params.port,
-			user : params.user,
-			pass : params.pass,
-			socket : if( params.socket == null ) null else params.socket
+			host: params.host,
+			port: if (params.port == null) 3306 else params.port,
+			user: params.user,
+			pass: params.pass,
+			socket: if (params.socket == null) null else params.socket
 		};
 		};
 		var c = D.connect(o);
 		var c = D.connect(o);
 		if (params.database != null) {
 		if (params.database != null) {
 			try {
 			try {
-				D.select_db(c,params.database);
-			} catch( e : Dynamic ) {
+				D.select_db(c, params.database);
+			} catch (e:Dynamic) {
 				D.close(c);
 				D.close(c);
 				cpp.Lib.rethrow(e);
 				cpp.Lib.rethrow(e);
 			}
 			}
 		}
 		}
 		return new MysqlConnection(c);
 		return new MysqlConnection(c);
 	}
 	}
-
 }
 }

Vissa filer visades inte eftersom för många filer har ändrats