瀏覽代碼

[java] changed 'jvm' to 'java'. Fixed Issue #762

Caue Waneck 13 年之前
父節點
當前提交
45ad10a24f

+ 1 - 1
common.ml

@@ -194,7 +194,7 @@ let platform_name = function
 	| Php -> "php"
 	| Cpp -> "cpp"
 	| Cs -> "cs"
-	| Java -> "jvm"
+	| Java -> "java"
 
 let flash_versions = List.map (fun v ->
 	let maj = int_of_float v in

+ 50 - 51
genjava.ml

@@ -26,23 +26,23 @@ open Printf
 open Option
 
 let is_boxed_type t = match follow t with
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Boolean") }, [])
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Double") }, [])
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Integer") }, [])
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Byte") }, [])
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Short") }, [])
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Character") }, [])
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Float") }, []) -> true
+  | TInst ({ cl_path = (["java";"lang"], "Boolean") }, [])
+  | TInst ({ cl_path = (["java";"lang"], "Double") }, [])
+  | TInst ({ cl_path = (["java";"lang"], "Integer") }, [])
+  | TInst ({ cl_path = (["java";"lang"], "Byte") }, [])
+  | TInst ({ cl_path = (["java";"lang"], "Short") }, [])
+  | TInst ({ cl_path = (["java";"lang"], "Character") }, [])
+  | TInst ({ cl_path = (["java";"lang"], "Float") }, []) -> true
   | _ -> false
 
 let unboxed_type gen t tbyte tshort tchar tfloat = match follow t with
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Boolean") }, []) -> gen.gcon.basic.tbool
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Double") }, []) -> gen.gcon.basic.tfloat
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Integer") }, []) -> gen.gcon.basic.tint
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Byte") }, []) -> tbyte
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Short") }, []) -> tshort
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Character") }, []) -> tchar
-  | TInst ({ cl_path = (["jvm";"native";"lang"], "Float") }, []) -> tfloat
+  | TInst ({ cl_path = (["java";"lang"], "Boolean") }, []) -> gen.gcon.basic.tbool
+  | TInst ({ cl_path = (["java";"lang"], "Double") }, []) -> gen.gcon.basic.tfloat
+  | TInst ({ cl_path = (["java";"lang"], "Integer") }, []) -> gen.gcon.basic.tint
+  | TInst ({ cl_path = (["java";"lang"], "Byte") }, []) -> tbyte
+  | TInst ({ cl_path = (["java";"lang"], "Short") }, []) -> tshort
+  | TInst ({ cl_path = (["java";"lang"], "Character") }, []) -> tchar
+  | TInst ({ cl_path = (["java";"lang"], "Float") }, []) -> tfloat
   | _ -> assert false
 
 let rec t_has_type_param t = match follow t with
@@ -131,7 +131,7 @@ struct
   
   let traverse gen runtime_cl =
     let basic = gen.gcon.basic in
-    let float_cl = get_cl ( get_type gen (["jvm";"native";"lang"], "Double")) in
+    let float_cl = get_cl ( get_type gen (["java";"lang"], "Double")) in
     
     let is_var = alloc_var "__is__" t_dynamic in
       let block = ref [] in
@@ -148,19 +148,19 @@ struct
           { e with eexpr = TBlock(ret) }
         
         (* Math changes *)
-        | TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["jvm";"native";"lang"], "Math") }) ) }, "NaN" ) ->
+        | TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["java";"lang"], "Math") }) ) }, "NaN" ) ->
           mk_static_field_access_infer float_cl "NaN" e.epos []
-        | TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["jvm";"native";"lang"], "Math") }) ) }, "NEGATIVE_INFINITY" ) ->
+        | TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["java";"lang"], "Math") }) ) }, "NEGATIVE_INFINITY" ) ->
           mk_static_field_access_infer float_cl "NEGATIVE_INFINITY" e.epos []
-        | TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["jvm";"native";"lang"], "Math") }) ) }, "POSITIVE_INFINITY" ) ->
+        | TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["java";"lang"], "Math") }) ) }, "POSITIVE_INFINITY" ) ->
           mk_static_field_access_infer float_cl "POSITIVE_INFINITY" e.epos []
-        | TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["jvm";"native";"lang"], "Math") }) ) }, "isNaN" ) ->
+        | TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["java";"lang"], "Math") }) ) }, "isNaN" ) ->
           mk_static_field_access_infer float_cl "isNaN" e.epos []
-        | TCall( { eexpr = TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["jvm";"native";"lang"], "Math") }) ) }, "floor" ) }, _)
-        | TCall( { eexpr = TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["jvm";"native";"lang"], "Math") }) ) }, "round" ) }, _)
-        | TCall( { eexpr = TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["jvm";"native";"lang"], "Math") }) ) }, "ceil" ) }, _) ->
+        | TCall( { eexpr = TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["java";"lang"], "Math") }) ) }, "floor" ) }, _)
+        | TCall( { eexpr = TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["java";"lang"], "Math") }) ) }, "round" ) }, _)
+        | TCall( { eexpr = TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["java";"lang"], "Math") }) ) }, "ceil" ) }, _) ->
           mk_cast basic.tint (Type.map_expr run e)
-        | TCall( ( { eexpr = TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["jvm";"native";"lang"], "Math") }) ) }, "isFinite" ) } as efield ), [v]) ->
+        | TCall( ( { eexpr = TField( { eexpr = TTypeExpr( TClassDecl( { cl_path = (["java";"lang"], "Math") }) ) }, "isFinite" ) } as efield ), [v]) ->
           { e with eexpr = 
             TUnop(Ast.Not, Ast.Prefix, {
               e with eexpr = TCall( mk_static_field_access_infer float_cl "isInfinite" efield.epos [], [run v] )
@@ -486,11 +486,11 @@ struct
   
   let traverse gen runtime_cl =
     let basic = gen.gcon.basic in
-    let tchar = match ( get_type gen (["jvm"], "Char16") ) with | TTypeDecl t -> TType(t,[]) | _ -> assert false in
-    let tbyte = match ( get_type gen (["jvm"], "Int8") ) with | TTypeDecl t -> TType(t,[]) | _ -> assert false in
-    let tshort = match ( get_type gen (["jvm"], "Int16") ) with | TTypeDecl t -> TType(t,[]) | _ -> assert false in
+    let tchar = match ( get_type gen (["java"], "Char16") ) with | TTypeDecl t -> TType(t,[]) | _ -> assert false in
+    let tbyte = match ( get_type gen (["java"], "Int8") ) with | TTypeDecl t -> TType(t,[]) | _ -> assert false in
+    let tshort = match ( get_type gen (["java"], "Int16") ) with | TTypeDecl t -> TType(t,[]) | _ -> assert false in
     let tsingle = match ( get_type gen ([], "Single") ) with | TTypeDecl t -> TType(t,[]) | _ -> assert false in
-    let bool_cl = get_cl ( get_type gen (["jvm";"native";"lang"], "Boolean")) in
+    let bool_cl = get_cl ( get_type gen (["java";"lang"], "Boolean")) in
     let string_ext = get_cl ( get_type gen (["haxe";"lang"], "StringExt")) in
     
     let is_string t = match follow t with | TInst({ cl_path = ([], "String") }, []) -> true | _ -> false in
@@ -498,7 +498,7 @@ struct
     let rec run e =
       match e.eexpr with 
         (* for new NativeArray<T> issues *)
-        | TNew(({ cl_path = (["jvm"], "NativeArray") } as cl), [t], el) when t_has_type_param t ->
+        | TNew(({ cl_path = (["java"], "NativeArray") } as cl), [t], el) when t_has_type_param t ->
           mk_cast (TInst(cl,[t])) (mk_cast t_dynamic ({ e with eexpr = TNew(cl, [t_empty], List.map run el) }))
         
         (* Std.int() *)
@@ -583,7 +583,7 @@ struct
 end;;
  
 let connecting_string = "?" (* ? see list here http://www.fileformat.info/info/unicode/category/index.htm and here for C# http://msdn.microsoft.com/en-us/library/aa664670.aspx *)
-let default_package = "jvm" (* I'm having this separated as I'm still not happy with having a cs package. Maybe dotnet would be better? *)
+let default_package = "java" (* I'm having this separated as I'm still not happy with having a cs package. Maybe dotnet would be better? *)
 let strict_mode = ref false (* strict mode is so we can check for unexpected information *)
 
 (* reserved c# words *)
@@ -641,7 +641,7 @@ let configure gen =
   *)
   let change_param_type md params =
     match md with
-      | TClassDecl( { cl_path = (["jvm"], "NativeArray") } ) -> params
+      | TClassDecl( { cl_path = (["java"], "NativeArray") } ) -> params
       | _ ->
         match params with
           | [] -> []
@@ -656,9 +656,9 @@ let configure gen =
                   | TInst ({ cl_path = ([],"Int") },[])
                   | TType ({ t_path = [],"Int64" },[])
                   | TType ({ t_path = ["haxe"],"Int64" },[])
-                  | TType ({ t_path = ["jvm"],"Int8" },[])
-                  | TType ({ t_path = ["jvm"],"Int16" },[])
-                  | TType ({ t_path = ["jvm"],"Char16" },[])
+                  | TType ({ t_path = ["java"],"Int8" },[])
+                  | TType ({ t_path = ["java"],"Int16" },[])
+                  | TType ({ t_path = ["java"],"Char16" },[])
                   | TType ({ t_path = [],"Single" },[]) -> basic.tnull f_t
                   (*| TType ({ t_path = [], "Null"*)
                   | _ -> t
@@ -667,7 +667,6 @@ let configure gen =
   
   let rec change_ns ns = match ns with
     | [] -> ["haxe"; "root"]
-    | "jvm" :: "native" :: tl -> "java" :: (change_ns tl)
     | _ -> ns
   in
   
@@ -689,9 +688,9 @@ let configure gen =
       | TInst( { cl_path = (["haxe"], "Int32") }, [] )
       | TInst( { cl_path = (["haxe"], "Int64") }, [] )
       | TType ({ t_path = [],"Int64" },[])
-      | TType ({ t_path = ["jvm"],"Int8" },[])
-      | TType ({ t_path = ["jvm"],"Int16" },[])
-      | TType ({ t_path = ["jvm"],"Char16" },[])
+      | TType ({ t_path = ["java"],"Int8" },[])
+      | TType ({ t_path = ["java"],"Int16" },[])
+      | TType ({ t_path = ["java"],"Char16" },[])
       | TType ({ t_path = [],"Single" },[])
       | TType ({ t_path = [],"Null" },[_]) -> Some t
 			| TInst( { cl_path = ([], "EnumValue") }, _  ) -> Some t_dynamic
@@ -745,17 +744,17 @@ let configure gen =
       | TInst ({ cl_path = ([],"Float") },[]) -> "double"
       | TInst ({ cl_path = ([],"Int") },[]) -> "int"
       | TType ({ t_path = [],"Int64" },[]) -> "long"
-      | TType ({ t_path = ["jvm"],"Int8" },[]) -> "byte"
-      | TType ({ t_path = ["jvm"],"Int16" },[]) -> "short"
-      | TType ({ t_path = ["jvm"],"Char16" },[]) -> "char"
+      | TType ({ t_path = ["java"],"Int8" },[]) -> "byte"
+      | TType ({ t_path = ["java"],"Int16" },[]) -> "short"
+      | TType ({ t_path = ["java"],"Char16" },[]) -> "char"
       | TType ({ t_path = [],"Single" },[]) -> "float"
       | TInst ({ cl_path = ["haxe"],"Int32" },[]) -> "int"
       | TInst ({ cl_path = ["haxe"],"Int64" },[]) -> "long"
       | TInst ({ cl_path = ([], "Dynamic") }, _) -> "java.lang.Object"
-      | TInst({ cl_path = (["jvm"], "NativeArray") }, [param]) ->
+      | TInst({ cl_path = (["java"], "NativeArray") }, [param]) ->
         let rec check_t_s t =
           match real_type t with
-            | TInst({ cl_path = (["jvm"], "NativeArray") }, [param]) ->
+            | TInst({ cl_path = (["java"], "NativeArray") }, [param]) ->
               (check_t_s param) ^ "[]"
             | _ -> t_s (run_follow gen t)
         in
@@ -784,9 +783,9 @@ let configure gen =
       | TType ({ t_path = [],"Int64" },[]) -> "java.lang.Long"
       | TInst ({ cl_path = ["haxe"],"Int64" },[]) -> "java.lang.Long"
       | TInst ({ cl_path = ["haxe"],"Int32" },[]) -> "java.lang.Integer"
-      | TType ({ t_path = ["jvm"],"Int8" },[]) -> "java.lang.Byte"
-      | TType ({ t_path = ["jvm"],"Int16" },[]) -> "java.lang.Short"
-      | TType ({ t_path = ["jvm"],"Char16" },[]) -> "java.lang.Character"
+      | TType ({ t_path = ["java"],"Int8" },[]) -> "java.lang.Byte"
+      | TType ({ t_path = ["java"],"Int16" },[]) -> "java.lang.Short"
+      | TType ({ t_path = ["java"],"Char16" },[]) -> "java.lang.Character"
       | TType ({ t_path = [],"Single" },[]) -> "java.lang.Float"
       | TDynamic _ -> "?"
       | TInst (cl, params) -> t_s (TInst(cl, change_param_type (TClassDecl cl) params))
@@ -920,7 +919,7 @@ let configure gen =
             so we'll just ignore all type parameters, and hope for the best!
           *)
           let rec transform_t t = match gen.gfollow#run_f t with
-            | TInst( ({ cl_path = (["jvm"], "NativeArray") } as narr), [t]) ->
+            | TInst( ({ cl_path = (["java"], "NativeArray") } as narr), [t]) ->
               TInst(narr, [transform_t t])
             | TInst(cl, params) -> TInst(cl, List.map (fun _ -> t_dynamic) params)
             | TEnum(e, params) -> TEnum(e, List.map (fun _ -> t_dynamic) params)
@@ -996,10 +995,10 @@ let configure gen =
             acc + 1
           ) 0 el);
           write w ")"
-        | TNew (({ cl_path = (["jvm"], "NativeArray") } as cl), params, [ size ]) ->
+        | TNew (({ cl_path = (["java"], "NativeArray") } as cl), params, [ size ]) ->
           let rec check_t_s t times =
             match real_type t with
-              | TInst({ cl_path = (["jvm"], "NativeArray") }, [param]) ->
+              | TInst({ cl_path = (["java"], "NativeArray") }, [param]) ->
                 (check_t_s param (times+1))
               | _ -> 
                 print w "new %s[" (t_s (run_follow gen t));
@@ -1508,7 +1507,7 @@ let configure gen =
     match e.eexpr with 
       | TArray(e1, e2) -> 
         ( match follow e1.etype with 
-          | TInst({ cl_path = (["jvm"], "NativeArray") }, _) -> false
+          | TInst({ cl_path = (["java"], "NativeArray") }, _) -> false
           | _ -> true ) 
       | _ -> assert false
   ) "__get" "__set" );
@@ -1611,7 +1610,7 @@ let configure gen =
   
   FilterClosures.configure gen (FilterClosures.traverse gen (fun e1 s -> true) closure_func);
     
-  let base_exception = get_cl (get_type gen (["jvm"; "native"; "lang"], "Throwable")) in
+  let base_exception = get_cl (get_type gen (["java"; "lang"], "Throwable")) in
   let base_exception_t = TInst(base_exception, []) in
   
   let hx_exception = get_cl (get_type gen (["haxe";"lang"], "HaxeException")) in
@@ -1691,7 +1690,7 @@ let configure gen =
       | _ -> assert false
   ) true );
 
-  let native_arr_cl = get_cl ( get_type gen (["jvm"], "NativeArray") ) in
+  let native_arr_cl = get_cl ( get_type gen (["java"], "NativeArray") ) in
   
   ExpressionUnwrap.configure gen (ExpressionUnwrap.traverse gen (fun e -> Some { eexpr = TVars([mk_temp gen "expr" e.etype, Some e]); etype = gen.gcon.basic.tvoid; epos = e.epos }));
   

+ 1 - 1
main.ml

@@ -931,7 +931,7 @@ try
 			add_std "cs"; "cs"
 		| Java -> 
 			Genjava.before_generate com;
-			add_std "jvm"; "jvm"
+			add_std "java"; "java"
 	) in
 	(* if we are at the last compilation step, allow all packages accesses - in case of macros or opening another project file *)
 	if com.display && not ctx.has_next then com.package_rules <- PMap.foldi (fun p r acc -> match r with Forbidden -> acc | _ -> PMap.add p r acc) com.package_rules PMap.empty;

+ 1 - 1
std/StringTools.hx

@@ -112,7 +112,7 @@ class StringTools {
 	**/
 	public static #if jvm inline #end function endsWith( s : String, end : String ) {
 		#if jvm
-		return untyped s.endsWith(start);
+		return untyped s.endsWith(end);
 		#else
 		var elen = end.length;
 		var slen = s.length;

+ 29 - 0
std/java/Boot.hx

@@ -0,0 +1,29 @@
+package java;
+import haxe.lang.Exceptions;
+import haxe.lang.Function;
+import haxe.lang.HxObject;
+import haxe.lang.Runtime;
+import haxe.lang.Iterator;
+import java.Lib;
+//import haxe.lang.StringExt;
+import java.StdTypes;
+import Hash;
+import Reflect;
+import java.lang.Boolean;
+import java.lang.Character;
+import java.lang.Class;
+import java.lang.Number;
+import java.lang.Throwable;
+import haxe.lang.StringExt;
+import haxe.lang.FieldLookup;
+/**
+ * ...
+ * @author waneck
+ */
+
+class Boot 
+{
+
+	
+	
+}

+ 35 - 0
std/java/Lib.hx

@@ -0,0 +1,35 @@
+package java;
+import java.lang.Class;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+class Lib 
+{
+
+	public static function toNativeReadOnlyArray<T>(arr:Array<T>, equalLengthRequired:Bool):NativeArray<T>
+	{
+		var native:NativeArray<T> = untyped arr.__a;
+		if (native.length == arr.length)
+		{
+			return native;
+		} else {
+			return null;
+		}
+	}
+	
+	public static function toNativeType<T>(cl:Class<T>):java.lang.Class<T>
+	{
+		return untyped cl.nativeType();
+	}
+	
+	@:functionBody('
+		return (java.lang.Class<T>) obj.getClass();
+	')
+	public static function getNativeType<T>(obj:T):java.lang.Class<T>
+	{
+		return null;
+	}
+}

+ 14 - 0
std/java/NativeArray.hx

@@ -0,0 +1,14 @@
+package java;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+@:nativegen extern class NativeArray<T> implements ArrayAccess<T>
+{
+	public var length(default, null):Int;
+	
+	public function new(len:Int):Void;
+	
+}

+ 10 - 0
std/java/StdTypes.hx

@@ -0,0 +1,10 @@
+package java;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+typedef Int8 = Int;
+typedef Int16 = Int;
+typedef Char16 = Int;

文件差異過大導致無法顯示
+ 0 - 0
std/java/_std/Array.hx


+ 153 - 0
std/java/_std/Date.hx

@@ -0,0 +1,153 @@
+package;
+import haxe.Int64;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+class Date 
+{
+	private var date:java.util.Date;
+	
+	/**
+		Creates a new date object.
+	**/
+	public function new(year : Int, month : Int, day : Int, hour : Int, min : Int, sec : Int ) : Void
+	{
+		date = new java.util.Date(year, month, day, hour, min, sec);
+	}
+
+	/**
+		Returns the timestamp of the date. It's the number of milliseconds
+		elapsed since 1st January 1970. It might only have a per-second precision
+		depending on the platforms.
+	**/
+	public inline function getTime() : Float
+	{
+		return cast date.getTime();
+	}
+
+	/**
+		Returns the hours value of the date (0-23 range).
+	**/
+	public inline function getHours() : Int
+	{
+		return date.getHours();
+	}
+
+	/**
+		Returns the minutes value of the date (0-59 range).
+	**/
+	public inline function getMinutes() : Int
+	{
+		return date.getMinutes();
+	}
+
+	/**
+		Returns the seconds of the date (0-59 range).
+	**/
+	public inline function getSeconds() : Int
+	{
+		return date.getSeconds();
+	}
+
+	/**
+		Returns the full year of the date.
+	**/
+	public inline function getFullYear() : Int
+	{
+		return date.getYear() + 1900;
+	}
+
+	/**
+		Returns the month of the date (0-11 range).
+	**/
+	public inline function getMonth() : Int
+	{
+		return date.getMonth();
+	}
+
+	/**
+		Returns the day of the date (1-31 range).
+	**/
+	public inline function getDate() : Int
+	{
+		return date.getDate();
+	}
+
+	/**
+		Returns the week day of the date (0-6 range).
+	**/
+	public inline function getDay() : Int
+	{
+		return date.getDay();
+	}
+
+	/**
+		Returns a string representation for the Date, by using the
+		standard format [YYYY-MM-DD HH:MM:SS]. See [DateTools.format] for
+		other formating rules.
+	**/
+	public function toString():String
+	{
+		var m = date.getMonth() + 1;
+		var d = date.getDate();
+		var h = date.getHours();
+		var mi = date.getMinutes();
+		var s = date.getSeconds();
+		return (date.getYear() + 1900)
+			+"-"+(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);
+	}
+
+	/**
+		Returns a Date representing the current local time.
+	**/
+	static public function now() : Date
+	{
+		var d = new Date(0, 0, 0, 0, 0, 0);
+		d.date = new java.util.Date();
+		return d;
+	}
+
+	/**
+		Returns a Date from a timestamp [t] which is the number of
+		milliseconds elapsed since 1st January 1970.
+	**/
+	static public function fromTime( t : Float ) : Date
+	{
+		var d = new Date(0, 0, 0, 0, 0, 0);
+		d.date = new java.util.Date(cast(t, Int64));
+		return d;
+	}
+
+	/**
+		Returns a Date from a formated string of one of the following formats :
+		[YYYY-MM-DD hh:mm:ss] or [YYYY-MM-DD] or [hh:mm:ss]. The first two formats
+		are expressed in local time, the third in UTC Epoch.
+	**/
+	static public function fromString( s : String ) : Date
+	{
+		switch( s.length ) 
+		{
+			case 8: // hh:mm:ss
+				var k = s.split(":");
+				var d : Date = new Date(0, 0, 0, Std.parseInt(k[0]), Std.parseInt(k[1]), Std.parseInt(k[2]));
+				return d;
+			case 10: // YYYY-MM-DD
+				var k = s.split("-");
+				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
+				var k = s.split(" ");
+				var y = k[0].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]));
+			default:
+				throw "Invalid date format : " + s;
+		}
+	}
+}

+ 135 - 0
std/java/_std/EReg.hx

@@ -0,0 +1,135 @@
+import java.util.regex.Regex;
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/**
+	Regular expressions are a way to find regular patterns into
+	Strings. Have a look at the tutorial on haXe website to learn
+	how to use them.
+**/
+class EReg {
+
+	private var pattern:String;
+	private var matcher:Matcher;
+	private var cur:String;
+	
+	/**
+		Creates a new regular expression with pattern [r] and
+		options [opt].
+	**/
+	public function new( r : String, opt : String ) {
+		//FIXME opt is ignored by now
+		matcher = Pattern.compile(r).matcher("");
+		pattern = r;
+	}
+
+	/**
+		Tells if the regular expression matches the String.
+		Updates the internal state accordingly.
+	**/
+	public function match( s : String ) : Bool {
+		cur = s;
+		matcher = matcher.reset(s);
+		return matcher.find();
+	}
+
+	/**
+		Returns a matched group or throw an expection if there
+		is no such group. If [n = 0], the whole matched substring
+		is returned.
+	**/
+	public function matched( n : Int ) : String 
+	{
+		return matcher.group(n);
+	}
+
+	/**
+		Returns the part of the string that was as the left of
+		of the matched substring.
+	**/
+	public function matchedLeft() : String 
+	{
+		return cur.substr(0, matcher.start());
+	}
+
+	/**
+		Returns the part of the string that was at the right of
+		of the matched substring.
+	**/
+	public function matchedRight() : String 
+	{
+		return cur.substr(matcher.end());
+	}
+
+	/**
+		Returns the position of the matched substring within the
+		original matched string.
+	**/
+	public function matchedPos() : { pos : Int, len : Int } {
+		var start = matcher.start();
+		return { pos : start, len : matcher.end() - start };
+	}
+
+	/**
+		Split a string by using the regular expression to match
+		the separators.
+	**/
+	@:functionBody('
+		return new Array<String>(s.split(this.pattern));
+	')
+	public function split( s : String ) : Array<String> 
+	{
+		return null;
+	}
+
+	/**
+		Replaces a pattern by another string. The [by] format can
+		contains [$1] to [$9] that will correspond to groups matched
+		while replacing. [$$] means the [$] character.
+	**/
+	public function replace( s : String, by : String ) : String {
+		matcher.reset(s);
+		return matcher.replaceAll(by);
+	}
+
+	/**
+		For each occurence of the pattern in the string [s], the function [f] is called and
+		can return the string that needs to be replaced. All occurences are matched anyway,
+		and setting the [g] flag might cause some incorrect behavior on some platforms.
+	**/
+	public function customReplace( s : String, f : EReg -> String ) : String {
+		var buf = new StringBuf();
+		while( true ) {
+			if( !match(s) )
+				break;
+			buf.add(matchedLeft());
+			buf.add(f(this));
+			s = matchedRight();
+		}
+		buf.add(s);
+		return buf.toString();
+	}
+
+}

+ 114 - 0
std/java/_std/Hash.hx

@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+@:core_api class Hash<T>  
+{
+	//private var hashes:Array<Int>;
+	private var keysArr:Array<String>;
+	private var valuesArr:Array<T>;
+	
+	public function new() : Void 
+	{
+		//hashes = [];
+		keysArr = [];
+		valuesArr = [];
+	}
+
+	public function set( key : String, value : T ) : Void 
+	{
+		keysArr.push(key);
+		valuesArr.push(value);
+	}
+
+	public function get( key : String ) : Null<T> 
+	{
+		var i = 0;
+		for (k in keysArr)
+		{
+			if (k == key) return valuesArr[i];
+			i++;
+		}
+		return null;
+	}
+
+	public function exists( key : String ) : Bool 
+	{
+		for (k in keysArr)
+		{
+			if (k == key) return true;
+		}
+		return false;
+	}
+
+	public function remove( key : String ) : Bool 
+	{
+		var i = 0;
+		for (k in keysArr)
+		{
+			if (k == key)
+			{
+				keysArr.splice(i, 1);
+				valuesArr.splice(i, 1);
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+		Returns an iterator of all keys in the hashtable.
+	**/
+	public function keys() : Iterator<String> 
+	{
+		return keysArr.iterator();
+	}
+
+	/**
+		Returns an iterator of all values in the hashtable.
+	**/
+	public function iterator() : Iterator<T> 
+	{
+		return valuesArr.iterator();
+	}
+
+	/**
+		Returns an displayable representation of the hashtable content.
+	**/
+
+	public function toString() : String {
+		var s = new StringBuf();
+		s.add("{");
+		var it = keys();
+		for( i in it ) {
+			s.add(i);
+			s.add(" => ");
+			s.add(Std.string(get(i)));
+			if( it.hasNext() )
+				s.add(", ");
+		}
+		s.add("}");
+		return s.toString();
+	}
+}

+ 114 - 0
std/java/_std/IntHash.hx

@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+@:core_api class IntHash<T>  
+{
+	//private var hashes:Array<Int>;
+	private var keysArr:Array<Int>;
+	private var valuesArr:Array<T>;
+	
+	public function new() : Void 
+	{
+		//hashes = [];
+		keysArr = [];
+		valuesArr = [];
+	}
+
+	public function set( key : Int, value : T ) : Void 
+	{
+		keysArr.push(key);
+		valuesArr.push(value);
+	}
+
+	public function get( key : Int ) : Null<T> 
+	{
+		var i = 0;
+		for (k in keysArr)
+		{
+			if (k == key) return valuesArr[i];
+			i++;
+		}
+		return null;
+	}
+
+	public function exists( key : Int ) : Bool 
+	{
+		for (k in keysArr)
+		{
+			if (k == key) return true;
+		}
+		return false;
+	}
+
+	public function remove( key : Int ) : Bool 
+	{
+		var i = 0;
+		for (k in keysArr)
+		{
+			if (k == key)
+			{
+				keysArr.splice(i, 1);
+				valuesArr.splice(i, 1);
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+		Returns an iterator of all keys in the hashtable.
+	**/
+	public function keys() : Iterator<Int> 
+	{
+		return keysArr.iterator();
+	}
+
+	/**
+		Returns an iterator of all values in the hashtable.
+	**/
+	public function iterator() : Iterator<T> 
+	{
+		return valuesArr.iterator();
+	}
+
+	/**
+		Returns an displayable representation of the hashtable content.
+	**/
+
+	public function toString() : String {
+		var s = new StringBuf();
+		s.add("{");
+		var it = keys();
+		for( i in it ) {
+			s.add(i);
+			s.add(" => ");
+			s.add(Std.string(get(i)));
+			if( it.hasNext() )
+				s.add(", ");
+		}
+		s.add("}");
+		return s.toString();
+	}
+}

+ 59 - 0
std/java/_std/Math.hx

@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/**
+	This class defines mathematical functions and constants.
+**/
+@:native("java.lang.Math") extern class Math
+{
+	static var PI(default,null) : Float;
+	static var NaN(default,null) : Float;
+	static var NEGATIVE_INFINITY(default,null) : Float;
+	static var POSITIVE_INFINITY(default,null) : Float;
+
+	static function abs(v:Float):Float;
+	static function min(a:Float,b:Float):Float;
+	static function max(a:Float,b:Float):Float;
+	static function sin(v:Float):Float;
+	static function cos(v:Float):Float;
+	static function atan2(y:Float,x:Float):Float;
+	static function tan(v:Float):Float;
+	static function exp(v:Float):Float;
+	static function log(v:Float):Float;
+	static function sqrt(v:Float):Float;
+	static function round(v:Float):Int;
+	static function floor(v:Float):Int;
+	static function ceil(v:Float):Int;
+	static function atan(v:Float):Float;
+	static function asin(v:Float):Float;
+	static function acos(v:Float):Float;
+	static function pow(v:Float,exp:Float):Float;
+	static function random() : Float;
+
+	static function isFinite( f : Float ) : Bool;
+	static function isNaN( f : Float ) : Bool;
+}
+
+

+ 214 - 0
std/java/_std/Reflect.hx

@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/**
+	The Reflect API is a way to manipulate values dynamicly through an
+	abstract interface in an untyped manner. Use with care.
+**/
+@:core_api class Reflect {
+
+	/**
+		Tells if an object has a field set. This doesn't take into account the object prototype (class methods).
+	**/
+	@:functionBody('
+		//TODO make slow path
+		if (o instanceof haxe.lang.IHxObject)
+			return ((haxe.lang.IHxObject) o).__hx_getField(field, false, false, true) != haxe.lang.Runtime.undefined;
+		
+		return false;
+	
+	')
+	public static function hasField( o : Dynamic, field : String ) : Bool
+	{
+		return false;
+	}
+
+	/**
+		Returns the field of an object, or null if [o] is not an object or doesn't have this field.
+	**/
+	@:functionBody('
+		//TODO make slow path
+		if (o instanceof haxe.lang.IHxObject)
+			return ((haxe.lang.IHxObject) o).__hx_getField(field, false, false, false);
+		
+		return haxe.lang.Runtime.slowGetField(o, field, false);
+	
+	')
+	public static function field( o : Dynamic, field : String ) : Dynamic
+	{
+		return null;
+	}
+
+
+	/**
+		Set an object field value.
+	**/
+	@:functionBody('
+		//TODO make slow path
+		if (o instanceof haxe.lang.IHxObject)
+			((haxe.lang.IHxObject) o).__hx_setField(field, false, value);
+		
+		 haxe.lang.Runtime.slowSetField(o, field, value);
+	')
+	public static function setField( o : Dynamic, field : String, value : Dynamic ) : Void
+	{
+		
+	}
+	
+	/**
+		Similar to field but also supports property (might be slower).
+	**/
+	public static function getProperty( o : Dynamic, field : String ) : Dynamic
+	{
+		return null;
+	}
+
+	/**
+		Similar to setField but also supports property (might be slower).
+	**/
+	public static function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void
+	{
+		
+	}
+
+	/**
+		Call a method with the given object and arguments.
+	**/
+	@:functionBody('
+		return ((haxe.lang.Function) func).__hx_invokeDynamic(args);
+	')
+	public static function callMethod( o : Dynamic, func : Dynamic, args : Array<Dynamic> ) : Dynamic
+	{
+		return null;
+	}
+
+	/**
+		Returns the list of fields of an object, excluding its prototype (class methods).
+	**/
+	@:functionBody('
+		if (o instanceof haxe.lang.IHxObject)
+		{
+			Array<String> ret = new Array<String>();
+			((haxe.lang.IHxObject) o).__hx_getFields(ret, false);
+			return ret;
+		} else {
+			return null;
+		}
+	')
+	public static function fields( o : Dynamic ) : Array<String>
+	{
+		return null;
+	}
+
+	/**
+		Tells if a value is a function or not.
+	**/
+	@:functionBody('
+		return f instanceof haxe.lang.Function;
+	')
+	public static function isFunction( f : Dynamic ) : Bool
+	{
+		return null;
+	}
+
+	/**
+		Generic comparison function, does not work for methods, see [compareMethods]
+	**/
+	@:functionBody('
+		return haxe.lang.Runtime.compare(a, b);
+	')
+	public static function compare<T>( a : T, b : T ) : Int
+	{
+		return null;
+	}
+
+	/**
+		Compare two methods closures. Returns true if it's the same method of the same instance.
+	**/
+	@:functionBody('
+		if (f1 == f2) 
+			return true;
+		
+		if (f1 instanceof haxe.lang.Closure && f2 instanceof haxe.lang.Closure)
+		{
+			haxe.lang.Closure f1c = (haxe.lang.Closure) f1;
+			haxe.lang.Closure f2c = (haxe.lang.Closure) f2;
+			
+			return haxe.lang.Runtime.refEq(f1c.target, f2c.target) && f1c.field.equals(f2c.field);
+		}
+		
+		
+		return false;
+	')
+	public static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool
+	{
+		return false;
+	}
+
+	/**
+		Tells if a value is an object or not.
+
+	**/
+	@:functionBody('
+		return v instanceof haxe.lang.DynamicObject;
+	')
+	public static function isObject( v : Dynamic ) : Bool
+	{
+		return false;
+	}
+
+	/**
+		Delete an object field.
+	**/
+	@:functionBody('
+		return (o instanceof haxe.lang.DynamicObject && ((haxe.lang.DynamicObject) o).__hx_deleteField(f));
+	')
+	public static function deleteField( o : Dynamic, f : String ) : Bool
+	{
+		return false;
+	}
+
+	/**
+		Make a copy of the fields of an object.
+	**/
+	public static function copy<T>( o : T ) : T
+	{
+		var o2 : Dynamic = {};
+		for( f in Reflect.fields(o) )
+			Reflect.setField(o2,f,Reflect.field(o,f));
+		return cast o2;
+	}
+
+	/**
+		Transform a function taking an array of arguments into a function that can
+		be called with any number of arguments.
+	**/
+	public static function makeVarArgs( f : Array<Dynamic> -> Dynamic ) : Dynamic
+	{
+		return null;
+	}
+	
+	
+}

+ 213 - 0
std/java/_std/Std.hx

@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+import java.Boot;
+import java.Lib;
+import haxe.lang.Exceptions;
+ 
+@:core_api @:nativegen class Std {
+	public static function is( v : Dynamic, t : Dynamic ) : Bool 
+	{
+		if (v == null) 
+			return v == t;
+		var clt:Class<Dynamic> = cast t;
+		if (clt == null)
+			return false;
+		
+		if (t == Float)
+		{
+			return untyped __java__('haxe.lang.Runtime.isDouble(v)');
+		} else if (t == Int) {
+			return untyped __java__('haxe.lang.Runtime.isInt(v)');
+		} else if (t == Bool) {
+			return untyped __java__('v instanceof java.lang.Boolean');
+		}
+			
+		var native:java.lang.Class<Dynamic> = untyped clt.nativeType();
+		
+		return native.isAssignableFrom(Lib.getNativeType(v));
+	}
+
+	public static inline function string( s : Dynamic ) : String {
+		return cast s;
+	}
+
+	public static inline function int( x : Float ) : Int {
+		return cast x;
+	}
+	
+	@:functionBody('
+		if (x == null) return null;
+		
+		x = x.trim();
+		int ret = 0;
+		int base = 10;
+		
+		if (x.startsWith("0x"))
+		{
+			x = x.substring(2);
+			base = 16;
+		}
+		
+		int len = x.length();
+		boolean foundAny = false;
+		boolean isNeg = false;
+		boolean hasValue = false;
+		for (int i = 0; i < len; i++)
+		{
+			char c = x.charAt(i);
+			if (!foundAny && c == \'-\') {
+				isNeg = true;
+				continue;
+			}
+			
+			if (c >= \'0\' && c <= \'9\')
+			{
+				if (!foundAny && c == \'0\')
+				{
+					hasValue = true;
+					continue;
+				}
+				ret *= base; foundAny = true;
+				
+				ret += ((int) (c - \'0\'));
+			} else if (base == 16) {
+				if (c >= \'a\' && c <= \'f\') {
+					ret *= base; foundAny = true;
+					ret += ((int) (c - \'a\')) + 10;
+				} else if (c >= \'A\' && c <= \'F\') {
+					ret *= base; foundAny = true;
+					ret += ((int) (c - \'A\')) + 10;
+				} else {
+					break;
+				}
+			} else {
+				break;
+			}
+		}
+		
+		if (foundAny || hasValue)
+			return isNeg ? -ret : ret;
+		else
+			return null;
+	')
+	public static function parseInt( x : String ) : Null<Int> {
+		return null;
+	}
+	
+	@:functionBody('
+		if (x == null) return java.lang.Double.NaN;
+		
+		x = x.trim();
+		double ret = 0.0;
+		double div = 0.0;
+		double e = 0.0;
+		
+		int len = x.length();
+		boolean hasValue = false;
+		boolean foundAny = false;
+		boolean isNeg = false;
+		for (int i = 0; i < len; i++)
+		{
+			char c = x.charAt(i);
+			if (!foundAny && c == \'-\') {
+				isNeg = true;
+				continue;
+			}
+			
+			if (c == \'.\') {
+				if (div != 0.0) 
+					break;
+				div = 1.0;
+				
+				continue;
+			}
+			
+			if (c >= \'0\' && c <= \'9\')
+			{
+				if (!foundAny && c == \'0\')
+				{
+					hasValue = true;
+					continue;
+				}
+				ret *= 10.0; foundAny = true; div *= 10.0;
+				
+				ret += ((int) (c - \'0\'));
+			} else if (foundAny && c == \'E\' || c == \'e\') {
+				boolean eNeg = false;
+				if (i + 1 < len && x.charAt(i + 1) == \'-\')
+				{
+					eNeg = true;
+					i++;
+				}
+				
+				while (++i < len)
+				{
+					c = x.charAt(i);
+					if (c >= \'0\' && c <= \'9\')
+					{
+						if (!foundAny && c == \'0\')
+							continue;
+						e *= 10.0;
+						e += ((int) (c - \'0\'));
+					} else {
+						break;
+					}
+				}
+				
+				if (eNeg) e = -e;
+			} else {
+				break;
+			}
+		}
+		
+		if (div == 0.0) div = 1.0;
+		
+		if (foundAny || hasValue)
+		{
+			ret = isNeg ? -(ret / div) : (ret / div);
+			if (e != 0.0)
+			{
+				return ret * Math.pow(10.0, e);
+			} else {
+				return ret;
+			}
+		} else {
+			return java.lang.Double.NaN;
+		}
+	')
+	public static function parseFloat( x : String ) : Float {
+		return null;
+	}
+
+	public static function random( x : Int ) : Int {
+		return Std.int(Math.random() * x);
+	}
+
+	@:macro public static function format( fmt : haxe.macro.Expr.ExprRequire<String> ) : haxe.macro.Expr.ExprRequire<String> {
+		return haxe.macro.Format.format(fmt);
+	}
+
+}
+	

+ 104 - 0
std/java/_std/String.hx

@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/**
+	The basic String class.
+**/
+extern class String {
+
+	/**
+		The number of characters in the String.
+	**/
+	var length(default,null) : Int;
+
+	/**
+		Creates a copy from a given String.
+	**/
+	function new(string:String) : Void;
+
+	/**
+		Returns an String where all characters have been uppercased.
+	**/
+	function toUpperCase() : String;
+
+	/**
+		Returns an String where all characters have been lowercased.
+	**/
+	function toLowerCase() : String;
+
+	/**
+		Returns the character at the given position.
+		Returns the empty String if outside of String bounds.
+	**/
+	function charAt( index : Int) : String;
+
+	/**
+		Returns the character code at the given position.
+		Returns [null] if outside of String bounds.
+	**/
+	function charCodeAt( index : Int) : Null<Int>;
+
+	/**
+		Returns the index of first occurence of [value]
+		Returns [1-1] if [value] is not found.
+		The optional [startIndex] parameter allows you to specify at which character to start searching.
+		The position returned is still relative to the beginning of the string.
+	**/
+	function indexOf( str : String, ?startIndex : Int ) : Int;
+
+	/**
+		Similar to [indexOf] but returns the latest index.
+	**/
+	function lastIndexOf( str : String, ?startIndex : Int ) : Int;
+
+	/**
+		Split the string using the specified delimiter.
+	**/
+	function split( delimiter : String ) : Array<String>;
+
+	/**
+		Returns a part of the String, taking [len] characters starting from [pos].
+		If [len] is not specified, it takes all the remaining characters.
+	**/
+	function substr( pos : Int, ?len : Int ) : String;
+
+	/**
+		Returns the String itself.
+	**/
+	function toString() : String;
+	
+	private function compareTo( anotherString : String ) : Int;
+	
+	private function codePointAt( idx : Int ) : Int;
+	
+	private function startsWith( str : String ) : Bool;
+	
+	private function endsWith( str : String ) : Bool;
+	
+	private function replace( sub : String, by : String ) : String;
+
+	static function fromCharCode( code : Int ) : String;
+
+}

+ 233 - 0
std/java/_std/Type.hx

@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+enum ValueType {
+	TNull;
+	TInt;
+	TFloat;
+	TBool;
+	TObject;
+	TFunction;
+	TClass( c : Class<Dynamic> );
+	TEnum( e : Enum<Dynamic> );
+	TUnknown;
+}
+
+@:core_api class Type {
+	
+	@:functionBody('
+		if (o instanceof haxe.lang.IHxObject)
+		{
+			return ((haxe.lang.IHxObject) o).__hx_getClass();
+		} else {
+			//TODO implement slow method
+			return null;
+		}
+	')
+	public static function getClass<T>( o : T ) : Class<T> untyped 
+	{
+		return null;
+	}
+	
+	@:functionBody('
+		if (o instanceof haxe.lang.IHxObject)
+		{
+			return ((haxe.lang.IHxObject) o).__hx_getClass();
+		} else {
+			//TODO implement slow method
+			return null;
+		}
+	')
+	public static function getEnum( o : EnumValue ) : Enum<Dynamic> untyped 
+	{
+		return null;
+	}
+
+	public static function getSuperClass( c : Class<Dynamic> ) : Class<Dynamic> untyped 
+	{
+		return null;
+	}
+	
+	public static function getClassName( c : Class<Dynamic> ) : String untyped {
+		var name:String = cast(c.nativeType(), java.lang.Class<Dynamic>).getName();
+		if (name.startsWith("haxe.root."))
+			return name.substr(10);
+			
+		return switch(name)
+		{
+			case "int": "Int";
+			case "double": "Float";
+			case "java.lang.String": "String";
+			case "boolean": "Bool";
+			default: name;
+		}
+	}
+
+	public static function getEnumName( e : Enum<Dynamic> ) : String untyped {
+		return cast(e.nativeType(), java.lang.Class<Dynamic>).getName();
+	}
+
+	public static function resolveClass( name : String ) : Class<Dynamic> untyped 
+	{
+		return null;
+	}
+
+
+	public static function resolveEnum( name : String ) : Enum<Dynamic> untyped 
+	{
+		return null;
+	}
+
+	public static function createInstance<T>( cl : Class<T>, args : Array<Dynamic> ) : T untyped 
+	{
+		return cl.__hx_create(args);
+	}
+
+	public static function createEmptyInstance<T>( cl : Class<T> ) : T untyped 
+	{
+		return cl.__hx_createEmpty();
+	}
+	
+	@:functionBody('
+		if (params == null) {
+			T ret = (T) e.__hx_getField(constr, false, false, false);
+			if (ret instanceof haxe.lang.Function)
+				throw haxe.lang.HaxeException.wrap("Constructor " + constr + " needs parameters");
+			return ret;
+		} else {
+			return (T)e.__hx_invokeField(constr, false, params);
+		}
+	')
+	public static function createEnum<T>( e : Enum<T>, constr : String, ?params : Array<Dynamic> ) : T 
+	{
+		return null;
+	}
+	
+	@:functionBody('
+		if (params == null) {
+			T ret = (T) e.__hx_getField(index + "", false, false, false);
+			if (ret instanceof haxe.lang.Function)
+				throw haxe.lang.HaxeException.wrap("Constructor " + index + " needs parameters");
+			return ret;
+		} else {
+			return (T)e.__hx_invokeField(index + "", false, params);
+		}
+	')
+	public static function createEnumIndex<T>( e : Enum<T>, index : Int, ?params : Array<Dynamic> ) : T {
+		return null;
+	}
+
+	static function describe( t : Dynamic, fact : Bool ) : Array<String> untyped {
+		return null;
+	}
+	
+	@:functionBody('
+		if (c instanceof haxe.lang.IHxObject)
+		{
+			Array<String> ret = new Array<String>();
+			((haxe.lang.IHxObject) c).__hx_getFields(ret, true);
+			return ret;
+		} else {
+			return null;
+		}
+	')
+	public static function getInstanceFields( c : Class<Dynamic> ) : Array<String> {
+		return null;
+	}
+
+	public static function getClassFields( c : Class<Dynamic> ) : Array<String> {
+		return null;
+	}
+
+	public static function getEnumConstructs( e : Enum<Dynamic> ) : Array<String> {
+		return null;
+	}
+	
+	@:functionBody('
+		if (v == null) return ValueType.TNull;
+		
+		if (v instanceof haxe.lang.IHxObject) {
+			haxe.lang.IHxObject vobj = (haxe.lang.IHxObject) v;
+			haxe.lang.Class cl = vobj.__hx_getClass();
+			if (cl == null)
+				return ValueType.TObject;
+			else if (v instanceof haxe.lang.Enum)
+				return ValueType.TEnum(cl);
+			else
+				return ValueType.TClass(cl);
+		} else if (v instanceof java.lang.Number) {
+			java.lang.Number n = (java.lang.Number) v;
+			if (n.intValue() == n.doubleValue())
+				return ValueType.TInt;
+			else
+				return ValueType.TFloat;
+		} else if (v instanceof haxe.lang.Function) {
+			return ValueType.TFunction;
+		} else if (v instanceof java.lang.Enum) {
+			return ValueType.TEnum(new haxe.lang.NativeClassWrapper(v.getClass()));
+		} else if (v instanceof java.lang.Boolean) {
+			return ValueType.TBool;
+		} else {
+			return ValueType.TClass(new haxe.lang.NativeClassWrapper(v.getClass()));
+		}
+	')
+	public static function typeof( v : Dynamic ) : ValueType untyped 
+	{
+		return null;
+	}
+
+	public static function enumEq<T>( a : T, b : T ) : Bool untyped 
+	{
+		return a.equals(b);
+	}
+
+	public static function enumConstructor( e : EnumValue ) : String untyped
+	{
+		return e.tag;
+	}
+
+	public static function enumParameters( e : EnumValue ) : Array<Dynamic> untyped
+	{
+		return if( e.params == null ) [] else e.params;
+	}
+	
+	@:functionBody('
+		if (e instanceof java.lang.Enum)
+			return ((java.lang.Enum) e).ordinal();
+		else
+			return ((haxe.lang.Enum) e).index;
+	')
+	public static function enumIndex( e : EnumValue ) : Int untyped
+	{
+		return e.index;
+	}
+
+	public static function allEnums<T>( e : Enum<T> ) : Array<T> 
+	{
+		return null;
+	}
+
+}
+

+ 453 - 0
std/java/_std/Xml.hx

@@ -0,0 +1,453 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+enum XmlType {
+	Element;
+	PCData;
+	CData;
+	Comment;
+	DocType;
+	Prolog;
+	Document;
+}
+
+@:core_api class Xml {
+
+	public static var Element(default,null) : XmlType;
+	public static var PCData(default,null) : XmlType;
+	public static var CData(default,null) : XmlType;
+	public static var Comment(default,null) : XmlType;
+	public static var DocType(default,null) : XmlType;
+	public static var Prolog(default,null) : XmlType;
+	public static var Document(default,null) : XmlType;
+
+	static var enode = ~/^<([a-zA-Z0-9:_-]+)/;
+	static var ecdata = ~/^<!\[CDATA\[/i;
+	static var edoctype = ~/^<!DOCTYPE /i;
+	static var eend = ~/^<\/([a-zA-Z0-9:_-]+)>/;
+	static var epcdata = ~/^[^<]+/;
+	static var ecomment = ~/^<!--/;
+	static var eprolog = ~/^<\?[^\?]+\?>/;
+
+	static var eattribute = ~/^\s*([a-zA-Z0-9:_-]+)\s*=\s*(["'])([^$2]*?)$2/; //"
+	static var eclose = ~/^[ \r\n\t]*(>|(\/>))/;
+	static var ecdata_end = ~/\]\]>/;
+	static var edoctype_elt = ~/[\[|\]>]/;
+	static var ecomment_end = ~/-->/;
+
+	public var nodeType(default,null) : XmlType;
+	public var nodeName(getNodeName,setNodeName) : String;
+	public var nodeValue(getNodeValue,setNodeValue) : String;
+	public var parent(getParent,null) : Xml;
+
+	var _nodeName : String;
+	var _nodeValue : String;
+	var _attributes : Hash<String>;
+	var _children : Array<Xml>;
+	var _parent : Xml;
+
+	public static function parse( str : String ) : Xml {
+		var rules = [enode,epcdata,eend,ecdata,edoctype,ecomment,eprolog];
+		var nrules = rules.length;
+		var current = Xml.createDocument();
+
+		var stack = new List();
+		while( str.length > 0 ) {
+			var i = 0;
+			while( i < nrules ) {
+				var r = rules[i];
+				if( r.match(str) ) {
+					switch( i ) {
+					case 0: // Node
+						var x = Xml.createElement(r.matched(1));
+						current.addChild(x);
+						str = r.matchedRight();
+						while( eattribute.match(str) ) {
+							x.set(eattribute.matched(1),eattribute.matched(3));
+							str = eattribute.matchedRight();
+						}
+						if( !eclose.match(str) ) {
+							i = nrules;
+							break;
+						}
+						if( eclose.matched(1) == ">" ) {
+							stack.push(current);
+							current = x;
+						}
+						str = eclose.matchedRight();
+					case 1: // PCData
+						var x = Xml.createPCData(r.matched(0));
+						current.addChild(x);
+						str = r.matchedRight();
+					case 2: // End Node
+						untyped if( current._children != null && current._children.length == 0 ) {
+							var e = Xml.createPCData("");
+							current.addChild(e);
+						}
+						untyped if( r.matched(1) != current._nodeName || stack.isEmpty() ) {
+							i = nrules;
+							break;
+						}
+						current = stack.pop();
+						str = r.matchedRight();
+					case 3: // CData
+						str = r.matchedRight();
+						if( !ecdata_end.match(str) )
+							throw "End of CDATA section not found";
+						var x = Xml.createCData(ecdata_end.matchedLeft());
+						current.addChild(x);
+						str = ecdata_end.matchedRight();
+					case 4: // DocType
+						var pos = 0;
+						var count = 0;
+						var old = str;
+						while( true ) {
+							if( !edoctype_elt.match(str) )
+								throw "End of DOCTYPE section not found";
+							var p = edoctype_elt.matchedPos();
+							pos += p.pos + p.len;
+							str = edoctype_elt.matchedRight();
+							switch( edoctype_elt.matched(0) ) {
+							case "[": count++;
+							case "]": count--; if( count < 0 ) throw "Invalid ] found in DOCTYPE declaration";
+							default:
+								if( count == 0 )
+									break;
+							}
+						}
+						var x = Xml.createDocType(old.substr(10,pos-11));
+						current.addChild(x);
+					case 5: // Comment
+						if( !ecomment_end.match(str) )
+							throw "Unclosed Comment";
+						var p = ecomment_end.matchedPos();
+						var x = Xml.createComment(str.substr(4,p.pos+p.len-7));
+						current.addChild(x);
+						str = ecomment_end.matchedRight();
+					case 6: // Prolog
+						var prolog = r.matched(0);
+						var x = Xml.createProlog(prolog.substr(2,prolog.length - 4));
+						current.addChild(x);
+						str = r.matchedRight();
+					}
+					break;
+				}
+				i += 1;
+			}
+			if( i == nrules ) {
+				if( str.length > 10 )
+					throw ("Xml parse error : Unexpected "+str.substr(0,10)+"...");
+				else
+					throw ("Xml parse error : Unexpected "+str);
+			}
+		}
+		if( !stack.isEmpty() )
+			throw "Xml parse error : Unclosed "+stack.last().nodeName;
+		untyped return current;
+	}
+
+	private function new() : Void {
+	}
+
+	public static function createElement( name : String ) : Xml {
+		var r = new Xml();
+		r.nodeType = Xml.Element;
+		r._children = new Array();
+		r._attributes = new Hash();
+		r.setNodeName( name );
+		return r;
+	}
+
+	public static function createPCData( data : String ) : Xml {
+		var r = new Xml();
+		r.nodeType = Xml.PCData;
+		r.setNodeValue( data );
+		return r;
+	}
+
+	public static function createCData( data : String ) : Xml {
+		var r = new Xml();
+		r.nodeType = Xml.CData;
+		r.setNodeValue( data );
+		return r;
+	}
+
+	public static function createComment( data : String ) : Xml {
+		var r = new Xml();
+		r.nodeType = Xml.Comment;
+		r.setNodeValue( data );
+		return r;
+	}
+
+	public static function createDocType( data : String ) : Xml {
+		var r = new Xml();
+		r.nodeType = Xml.DocType;
+		r.setNodeValue( data );
+		return r;
+	}
+
+	public static function createProlog( data : String ) : Xml {
+		var r = new Xml();
+		r.nodeType = Xml.Prolog;
+		r.setNodeValue( data );
+		return r;
+	}
+
+	public static function createDocument() : Xml {
+		var r = new Xml();
+		r.nodeType = Xml.Document;
+		r._children = new Array();
+		return r;
+	}
+
+	private function getNodeName() : String {
+		if( nodeType != Xml.Element )
+			throw "bad nodeType";
+		return _nodeName;
+	}
+
+	private function setNodeName( n : String ) : String {
+		if( nodeType != Xml.Element )
+			throw "bad nodeType";
+		return _nodeName = n;
+	}
+
+	private function getNodeValue() : String {
+		if( nodeType == Xml.Element || nodeType == Xml.Document )
+			throw "bad nodeType";
+		return _nodeValue;
+	}
+
+	private function setNodeValue( v : String ) : String {
+		if( nodeType == Xml.Element || nodeType == Xml.Document )
+			throw "bad nodeType";
+		return _nodeValue = v;
+	}
+
+	private function getParent() : Xml {
+		return _parent;
+	}
+
+	public function get( att : String ) : String {
+		if( nodeType != Xml.Element )
+			throw "bad nodeType";
+		return _attributes.get( att );
+	}
+
+	public function set( att : String, value : String ) : Void {
+		if( nodeType != Xml.Element )
+			throw "bad nodeType";
+		_attributes.set( att, value );
+	}
+
+	public function remove( att : String ) : Void{
+		if( nodeType != Xml.Element )
+			throw "bad nodeType";
+		_attributes.remove( att );
+	}
+
+	public function exists( att : String ) : Bool {
+		if( nodeType != Xml.Element )
+			throw "bad nodeType";
+		return _attributes.exists( att );
+	}
+
+	public function attributes() : Iterator<String> {
+		if( nodeType != Xml.Element )
+			throw "bad nodeType";
+		return _attributes.keys();
+	}
+
+	public function iterator() : Iterator<Xml> {
+		if( _children == null ) throw "bad nodetype";
+		return untyped {
+			cur: 0,
+			x: this._children,
+			hasNext : function(){
+				return __this__.cur < __this__.x.length;
+			},
+			next : function(){
+				return __this__.x[__this__.cur++];
+			}
+		}
+	}
+
+	public function elements() : Iterator<Xml> {
+		if( _children == null ) throw "bad nodetype";
+		return untyped {
+			cur: 0,
+			x: this._children,
+			hasNext : function() {
+				var k = __this__.cur;
+				var l = __this__.x.length;
+				while( k < l ) {
+					if( __this__.x[k].nodeType == Xml.Element )
+						break;
+					k += 1;
+				}
+				__this__.cur = k;
+				return k < l;
+			},
+			next : function() {
+				var k = __this__.cur;
+				var l = __this__.x.length;
+				while( k < l ) {
+					var n = __this__.x[k];
+					k += 1;
+					if( n.nodeType == Xml.Element ) {
+						__this__.cur = k;
+						return n;
+					}
+				}
+				return null;
+			}
+		}
+	}
+
+	public function elementsNamed( name : String ) : Iterator<Xml> {
+		if( _children == null ) throw "bad nodetype";
+		return untyped {
+			cur: 0,
+			x: this._children,
+			hasNext : function() {
+				var k = __this__.cur;
+				var l = __this__.x.length;
+				while( k < l ) {
+					var n = __this__.x[k];
+					if( n.nodeType == Xml.Element && n._nodeName == name )
+						break;
+					k++;
+				}
+				__this__.cur = k;
+				return k < l;
+			},
+			next : function() {
+				var k = __this__.cur;
+				var l = __this__.x.length;
+				while( k < l ) {
+					var n = __this__.x[k];
+					k++;
+					if( n.nodeType == Xml.Element && n._nodeName == name ) {
+						__this__.cur = k;
+						return n;
+					}
+				}
+				return null;
+			}
+		}
+	}
+
+	public function firstChild() : Xml {
+		if( _children == null ) throw "bad nodetype";
+		return _children[0];
+	}
+
+	public function firstElement() : Xml {
+		if( _children == null ) throw "bad nodetype";
+		var cur = 0;
+		var l = _children.length;
+		while( cur < l ) {
+			var n = _children[cur];
+			if( n.nodeType == Xml.Element )
+				return n;
+			cur++;
+		}
+		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 );
+	}
+
+	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 );
+	}
+
+	public function toString() : String {
+		if( nodeType == Xml.PCData )
+			return _nodeValue;
+		if( nodeType == Xml.CData )
+			return "<![CDATA["+_nodeValue+"]]>";
+		if( nodeType == Xml.Comment )
+			return "<!--"+_nodeValue+"-->";
+		if( nodeType == Xml.DocType )
+			return "<!DOCTYPE "+_nodeValue+">";
+		if( nodeType == Xml.Prolog )
+			return "<?"+_nodeValue+"?>";
+		var s = new StringBuf();
+
+		if( nodeType == Xml.Element ) {
+			s.add("<");
+			s.add(_nodeName);
+			for( k in _attributes.keys() ){
+				s.add(" ");
+				s.add(k);
+				s.add("=\"");
+				s.add(_attributes.get(k));
+				s.add("\"");
+			}
+			if( _children.length == 0 ) {
+				s.add("/>");
+				return s.toString();
+			}
+			s.add(">");
+		}
+
+		for( x in iterator() )
+			s.add(x.toString());
+
+		if( nodeType == Xml.Element ) {
+			s.add("</");
+			s.add(_nodeName);
+			s.add(">");
+		}
+		return s.toString();
+	}
+
+	static function __init__() : Void untyped {
+		Xml.Element = XmlType.Element;
+		Xml.PCData = XmlType.PCData;
+		Xml.CData = XmlType.CData;
+		Xml.Comment = XmlType.Comment;
+		Xml.DocType = XmlType.DocType;
+		Xml.Prolog = XmlType.Prolog;
+		Xml.Document = XmlType.Document;
+	}
+
+}

+ 140 - 0
std/java/_std/haxe/Int32.hx

@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT
+ * , STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+package haxe;
+
+@:nativegen
+class Int32 
+{
+	public static inline function make( a : Int, b : Int ) : Int32
+	{
+		return cast ((a << 16) | b);
+	}
+	
+	public static inline function ofInt( x : Int ) : Int32
+	{
+		return cast x;
+	}
+	
+	public static function toInt( x : Int32 ) : Int
+	{
+		if ( (((cast x) >> 30) & 1) != ((cast x) >>> 31) ) throw "Overflow " + x;
+		
+		return cast x;
+	}
+	
+	public static inline function add( a : Int32, b : Int32 ) : Int32
+	{
+		return cast ((cast a) + cast b);
+	}
+	
+	public static inline function sub( a : Int32, b : Int32 ) : Int32
+	{
+		return cast ((cast a) - cast b);
+	}
+	
+	public static inline function mul( a : Int32, b : Int32 ) : Int32
+	{
+		return cast ((cast a) * cast b);
+	}
+	
+	public static inline function div( a : Int32, b : Int32 ) : Int32
+	{
+		return cast ((cast a) / cast b);
+	}
+	
+	public static inline function mod( a : Int32, b : Int32 ) : Int32
+	{
+		return cast ((cast a) % cast b);
+	}
+	
+	public static inline function shl( a : Int32, b : Int ) : Int32
+	{
+		return cast ((cast a) << b);
+	}
+	
+	public static inline function shr( a : Int32, b : Int ) : Int32
+	{
+		return cast ((cast a) >> b);
+	}
+	
+	public static inline function ushr( a : Int32, b : Int ) : Int32
+	{
+		return cast ((cast a) >>> b);
+	}
+	
+	public static inline function and( a : Int32, b : Int32 ) : Int32
+	{
+		return cast ((cast a) & cast b);
+	}
+	
+	public static inline function or( a : Int32, b : Int32 ) : Int32
+	{
+		return cast ((cast a) | cast b);
+	}
+	
+	public static inline function xor( a : Int32, b : Int32 ) : Int32
+	{
+		return cast ((cast a) ^ cast b);
+	}
+	
+	public static inline function neg( a : Int32 ) : Int32
+	{
+		return cast -(cast a);
+	}
+	
+	public static inline function complement( a : Int32 ) : Int32
+	{
+		return cast ~(cast a);
+	}
+	
+	public static inline function compare( a : Int32, b : Int32 ) : Int
+	{
+		return (cast a) - cast b;
+	}
+	
+	public static inline function isNeg( a : Int32 ) : Bool
+	{
+		return (cast a) < 0;
+	}
+	
+	public static inline function isZero( a : Int32 ) : Bool
+	{
+		return (cast a) == 0;
+	}
+	
+	public static function ucompare( a : Int32, b : Int32 ) : Int
+	{
+		if( isNeg(a) )
+			return isNeg(b) ? compare(complement(b),complement(a)) : 1;
+		return isNeg(b) ? -1 : compare(a,b);
+	}
+	
+	public static inline function toNativeInt(a:Int32) : Int
+	{
+		return cast a;
+	}
+}
+

+ 152 - 0
std/java/_std/haxe/Int64.hx

@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+package haxe;
+
+private typedef NativeInt64 = Int64;
+
+@:nativegen class Int64 
+{
+	public static inline function make( high : Int32, low : Int32 ) : Int64 
+	{
+		return (cast(high, NativeInt64) << 32 ) | (cast(low, NativeInt64));
+	}
+
+	public static inline function ofInt( x : Int ) : Int64 {
+		return cast x;
+	}
+
+	public static inline function ofInt32( x : Int32 ) : Int64 {
+		return cast x;
+	}
+
+	public static inline function toInt( x : Int64 ) : Int 
+	{
+		return cast x;
+	}
+
+	public static inline function getLow( x : Int64 ) : Int32 
+	{
+		return cast x;
+	}
+
+	public static inline function getHigh( x : Int64 ) : Int32 
+	{
+		return cast (cast(x,NativeInt64) >>> 32, Int32);
+	}
+
+	public static inline function add( a : Int64, b : Int64 ) : Int64 
+	{
+		return cast(a, NativeInt64) + cast(b, NativeInt64);
+	}
+
+	public static inline function sub( a : Int64, b : Int64 ) : Int64 
+	{
+		return cast(a, NativeInt64) - cast(b, NativeInt64);
+	}
+
+	public static inline function mul( a : Int64, b : Int64 ) : Int64 {
+		return cast(a, NativeInt64) * cast(b, NativeInt64);
+	}
+
+	static function divMod( modulus : Int64, divisor : Int64 ) 
+	{
+		var q:NativeInt64 = cast (cast(modulus, NativeInt64) / cast(divisor, NativeInt64));
+		var m:NativeInt64 = cast(modulus, NativeInt64) % cast(divisor, NativeInt64);
+		return { quotient : q, modulus : m };
+	}
+
+	public static inline function div( a : Int64, b : Int64 ) : Int64 {
+		return cast (cast(a, NativeInt64) / cast(b, NativeInt64));
+	}
+
+	public static inline function mod( a : Int64, b : Int64 ) : Int64 {
+		return cast(a, NativeInt64) % cast(b, NativeInt64);
+	}
+
+	public static inline function shl( a : Int64, b : Int ) : Int64 {
+		return cast(a, NativeInt64) << cast(b, NativeInt64);
+	}
+
+	public static inline function shr( a : Int64, b : Int ) : Int64 {
+		return cast(a, NativeInt64) >> cast(b, NativeInt64);
+	}
+
+	public static inline function ushr( a : Int64, b : Int ) : Int64 {
+		return cast(a, NativeInt64) >>> b;
+	}
+
+	public static inline function and( a : Int64, b : Int64 ) : Int64 
+	{
+		return cast(a, NativeInt64) & cast(b, NativeInt64);
+	}
+
+	public static inline function or( a : Int64, b : Int64 ) : Int64 
+	{
+		return cast(a, NativeInt64) | cast(b, NativeInt64);
+	}
+
+	public static inline function xor( a : Int64, b : Int64 ) : Int64 
+	{
+		return cast(a, NativeInt64) ^ cast(b, NativeInt64);
+	}
+
+	public static inline function neg( a : Int64 ) : Int64 
+	{
+		return -cast(a, NativeInt64);
+	}
+
+	public static inline function isNeg( a : Int64 ) : Bool 
+	{
+		return cast(a, NativeInt64) < cast(0, NativeInt64);
+	}
+
+	public static inline function isZero( a : Int64 ) : Bool 
+	{
+		return cast(a, NativeInt64) == cast(0, NativeInt64);
+	}
+
+	public static inline function compare( a : Int64, b : Int64 ) : Int 
+	{
+		return cast(cast(a, NativeInt64) - cast(b, NativeInt64), Int);
+	}
+
+	/**
+		Compare two Int64 in unsigned mode.
+	**/
+	public static function ucompare( a : Int64, b : Int64 ) : Int 
+	{
+		var a:NativeInt64 = cast a;
+		var b:NativeInt64 = cast b;
+		if (a < cast(0, NativeInt64))
+			return (b < cast(0, NativeInt64)) ? compare(~a, ~b) : 1;
+		return (b < cast(0, NativeInt64)) ? -1 : compare(a, b);
+	}
+
+	public static inline function toStr( a : Int64 ) : String {
+		return a + "";
+	}
+}
+
+

+ 42 - 0
std/java/_std/haxe/lang/Exceptions.hx

@@ -0,0 +1,42 @@
+package haxe.lang;
+import java.lang.Throwable;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+@:nativegen @:keep @:native("haxe.lang.HaxeException") private class HaxeException extends RuntimeException
+{
+	private var obj:Dynamic;
+	
+	public function new(obj:Dynamic)
+	{
+		super(null, null);
+		
+		if (Std.is(obj, HaxeException))
+		{
+			var _obj:HaxeException = cast obj;
+			obj = _obj.getObject();
+		}
+		
+		this.obj = obj;
+	}
+	
+	public function getObject():Dynamic
+	{
+		return obj;
+	}
+	
+	public function toString():String
+	{
+		return "Haxe Exception: " + obj;
+	}
+	
+	public static function wrap(obj:Dynamic):RuntimeException
+	{
+		if (Std.is(obj, RuntimeException)) return obj;
+		
+		return new HaxeException(obj);
+	}
+}

+ 37 - 0
std/java/_std/haxe/lang/FieldLookup.hx

@@ -0,0 +1,37 @@
+package haxe.lang;
+
+@:native('haxe.lang.FieldLookup')
+@:static private class FieldLookup 
+{
+	
+	@:functionBody('
+		return s.hashCode();
+	')
+	public static function hash(s:String):Int
+	{
+		return 0;
+	}
+	
+	public static function findHash(hash:String, hashs:Array<String>):Int
+	{
+		var min = 0;
+		var max = hashs.length;
+		
+		while (min < max)
+		{
+			var mid = Std.int((max + min) / 2); //overflow safe
+			var classify = untyped hash.compareTo(hashs[mid]);
+			if (classify < 0)
+			{
+				max = mid;
+			} else if (classify > 0) {
+				min = mid + 1;
+			} else {
+				return mid;
+			}
+		}
+		//if not found, return a negative value of where it should be inserted
+		return ~min;
+	}
+	
+}

+ 24 - 0
std/java/_std/haxe/lang/Function.hx

@@ -0,0 +1,24 @@
+package haxe.lang;
+
+/**
+ * These classes are automatically generated by the compiler. They are only
+ * here so there is an option for e.g. defining them as externs if you are compiling
+ * in modules (untested)
+ * 
+ * @author waneck
+ */
+@:abstract @:nativegen @:native("haxe.lang.Function") private class Function 
+{
+	
+}
+
+@:nativegen @:native("haxe.lang.Closure") private class Closure extends Function
+{
+	
+}
+
+/*
+@:nativegen @:native("haxe.lang.VarArgsFunction") private class VarArgsFunction extends Function
+{
+	
+}*/

文件差異過大導致無法顯示
+ 0 - 0
std/java/_std/haxe/lang/HxObject.hx


+ 13 - 0
std/java/_std/haxe/lang/IEquatable.hx

@@ -0,0 +1,13 @@
+package haxe.lang;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+interface IEquatable 
+{
+	
+	public function equals(to:Dynamic):Bool;
+	
+}

+ 22 - 0
std/java/_std/haxe/lang/Iterator.hx

@@ -0,0 +1,22 @@
+package haxe.lang;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+interface Iterator<T>
+{
+	
+	public function hasNext():Bool;
+	
+	public function next():T;
+	
+}
+
+interface Iterable<T>
+{
+	
+	public function iterator():Iterator<T>;
+	
+}

+ 478 - 0
std/java/_std/haxe/lang/Runtime.hx

@@ -0,0 +1,478 @@
+package haxe.lang;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+@:nativegen
+//it's private so we don't have access to it in normal haxe code
+@:native('haxe.lang.Runtime')
+@:classContents('
+	public static java.lang.Object getField(haxe.lang.IHxObject obj, java.lang.String field, boolean throwErrors)
+	{
+		if (obj == null && !throwErrors) return null;
+		return obj.__hx_getField(field, false, throwErrors, false);
+	}
+	
+	public static double getField_f(haxe.lang.IHxObject obj, java.lang.String field, boolean throwErrors)
+	{
+		if (obj == null && !throwErrors) return 0.0;
+		return obj.__hx_getField_f(field, false, throwErrors);
+	}
+	
+	public static java.lang.Object setField(haxe.lang.IHxObject obj, java.lang.String field, java.lang.Object value)
+	{
+		return obj.__hx_setField(field, false, value);
+	}
+	
+	public static double setField_f(haxe.lang.IHxObject obj, java.lang.String field, double value)
+	{
+		return obj.__hx_setField_f(field, false, value);
+	}
+	
+	public static java.lang.Object callField(haxe.lang.IHxObject obj, java.lang.String field, Array<?> args)
+	{
+		return obj.__hx_invokeField(field, false, args);
+	}
+')
+@:keep private class Runtime 
+{
+	public static var undefined:Dynamic = {};
+	
+	@:functionBody('
+			if (v1 == v2)
+				return true;
+			if (v1 == null || v2 == null)
+				return false;
+			
+			if (v1 instanceof java.lang.Number)
+			{
+				if (!(v2 instanceof java.lang.Number))
+					return false;
+				
+				java.lang.Number v1c = (java.lang.Number) v1;
+				java.lang.Number v2c = (java.lang.Number) v2;
+				if (v1 instanceof java.lang.Long || v2 instanceof java.lang.Long)
+					return v1c.longValue() == v2c.longValue();
+				return v1c.doubleValue() == v2c.doubleValue();
+			} else if (v1 instanceof java.lang.String || v1 instanceof haxe.lang.IEquatable) { //TODO see what happens with Boolean cases
+				return v1.equals(v2);
+			}
+			
+			return false;
+	')
+	public static function eq(v1:Dynamic, v2:Dynamic):Bool
+	{
+		return false;
+	}
+	
+	@:functionBody('
+		if (v1 == v2)
+			return true;
+		
+		if (v1 instanceof java.lang.String || v1 instanceof haxe.lang.IEquatable) 
+		{
+			return v1 != null && v1.equals(v2);
+		} else {
+			return v1 == v2;
+		}
+	')
+	public static function refEq(v1: { }, v2: { } ):Bool
+	{
+		return false;
+	}
+	
+	@:functionBody('
+		return v1 == v2 || (v1 != null && v1.equals(v2));
+	')
+	public static function valEq(v1: { }, v2: { } ):Bool
+	{
+		return false;
+	}
+	
+	@:functionBody('
+		return (obj == null) ? 0.0 : ((java.lang.Number) obj).doubleValue();
+	')
+	public static function toDouble(obj:Dynamic):Float
+	{
+		return 0.0;
+	}
+	
+	@:functionBody('
+		return (obj == null) ? 0 : ((java.lang.Number) obj).intValue();
+	')
+	public static function toInt(obj:Dynamic):Int
+	{
+		return 0;
+	}
+	
+	@:functionBody('
+		if (obj != null && obj instanceof java.lang.Number)
+		{
+			return true;
+		} else {
+			return false;
+		}
+	')
+	public static function isDouble(obj:Dynamic):Bool
+	{
+		return false;
+	}
+	
+	@:functionBody('
+		if (obj != null && obj instanceof java.lang.Number)
+		{
+			java.lang.Number n = (java.lang.Number) obj;
+			return n.doubleValue() == n.intValue();
+		} else {
+			return false;
+		}
+	')
+	public static function isInt(obj:Dynamic):Bool
+	{
+		return false;
+	}
+	
+	@:functionBody('
+			if (v1 == v2)
+				return 0;
+			
+			if (v1 instanceof java.lang.Number)
+			{
+				java.lang.Number v1c = (java.lang.Number) v1;
+				java.lang.Number v2c = (java.lang.Number) v2;
+				
+				if (v1 instanceof java.lang.Long || v2 instanceof java.lang.Long)
+				{
+					long l1 = (v1 == null) ? 0L : v1c.longValue();
+					long l2 = (v2 == null) ? 0L : v2c.longValue();
+					return (int) (l1 - l2);
+				} else {
+					double d1 = (v1 == null) ? 0.0 : v1c.doubleValue();
+					double d2 = (v2 == null) ? 0.0 : v2c.doubleValue();
+					
+					return (int) (d1 - d2);
+				}
+			}
+			//if it\'s not a number it must be a String
+			return ((java.lang.String) v1).compareTo((java.lang.String) v2);
+	')
+	public static function compare(v1:Dynamic, v2:Dynamic):Int
+	{
+		return 0;
+	}
+	
+	@:functionBody('
+			if (v1 instanceof java.lang.String || v2 instanceof java.lang.String)
+				return (v1 + "") + (v2 + "");
+			
+			if (v1 instanceof java.lang.Number || v2 instanceof java.lang.Number)
+			{
+				java.lang.Number v1c = (java.lang.Number) v1;
+				java.lang.Number v2c = (java.lang.Number) v2;
+				
+				double d1 = (v1 == null) ? 0.0 : v1c.doubleValue();
+				double d2 = (v2 == null) ? 0.0 : v2c.doubleValue();
+				
+				return d1 + d2;
+			}
+			
+			throw new java.lang.IllegalArgumentException("Cannot dynamically add " + v1 + " and " + v2);
+	')
+	public static function plus(v1:Dynamic, v2:Dynamic):Dynamic
+	{
+		return null;
+	}
+	
+	@:functionBody('
+	
+	if (obj == null)
+		if (throwErrors) 
+			throw new java.lang.NullPointerException("Cannot access field \'" + field + "\' of null.");
+		else
+			return null;
+	
+	try
+	{
+		java.lang.Class cl = null;
+		if (obj instanceof java.lang.Class)
+		{
+			cl = (java.lang.Class) obj;
+			obj = null;
+		} else {
+			cl = obj.getClass();
+		}
+		
+		java.lang.reflect.Field f = cl.getField(field);
+		return f.get(obj);
+	} catch (Throwable t)
+	{
+		if (throwErrors)
+			throw HaxeException.wrap(t);
+		
+		return null;
+	}
+	
+	')
+	public static function slowGetField(obj:Dynamic, field:String, throwErrors:Bool):Dynamic
+	{
+		return null;
+	}
+	
+	@:functionBody('
+		java.lang.Class cl = null;
+		if (obj instanceof java.lang.Class)
+		{
+			cl = (java.lang.Class) obj;
+			obj = null;
+		} else {
+			cl = obj.getClass();
+		}
+		
+		try {
+			java.lang.reflect.Field f = cl.getField(field);
+			if (isInt(value))
+			{
+				f.setInt(obj, toInt(value));
+			} else if (isDouble(value)) {
+				f.setDouble(obj, toDouble(value));
+			} else {
+				f.set(obj, value);
+			}
+			return value;
+		}
+		catch (Throwable t)
+		{
+			throw HaxeException.wrap(t);
+		}
+	')
+	public static function slowSetField(obj:Dynamic, field:String, value:Dynamic):Dynamic
+	{
+		//not implemented yet;
+		throw "Not implemented";
+	}
+	
+	@:functionBody('
+		java.lang.Class cl = null;
+		if (obj instanceof java.lang.Class)
+		{
+			cl = (java.lang.Class) obj;
+			obj = null;
+		} else {
+			cl = obj.getClass();
+		}
+		
+		if (args == null) args = new Array();
+		
+		try {
+			int len = args.length;
+			java.lang.Class[] cls = new java.lang.Class[len];
+			java.lang.Object[] objs = new java.lang.Object[len];
+			
+			java.lang.reflect.Method[] ms = cl.getDeclaredMethods();
+			int msl = ms.length;
+			int lstRes = 0;
+			int realMsl = 0;
+			for(int i =0; i < msl; i++)
+			{
+				if (ms[i].getName() != field || (!ms[i].isVarArgs() && ms[i].getParameterTypes().length != len))
+				{
+					ms[i] = null;
+				} else {
+					ms[lstRes] = ms[i];
+					if (lstRes != i)
+						ms[i] = null;
+					lstRes = i + 1;
+					realMsl++;
+				}
+			}
+			
+			boolean hasNumber = false;
+			
+			for (int i = 0; i < len; i++)
+			{
+				Object o = args.__get(i);
+				objs[i]= o;
+				cls[i] = o.getClass();
+				
+				if (!(o instanceof java.lang.Number))
+				{
+					lstRes = 0;
+					msl = realMsl;
+					
+					for (int j = 0; j < msl; j++)
+					{
+						java.lang.Class[] allcls = ms[j].getParameterTypes();
+						if (i < allcls.length)
+						{
+							if (!allcls[i].isAssignableFrom(cls[i]))
+							{
+								ms[j] = null;
+							} else {
+								ms[lstRes] = ms[j];
+								if (lstRes != j)
+									ms[j] = null;
+								lstRes = j + 1;
+								realMsl++;
+							}
+						}
+					}
+					
+					if (realMsl == 0)
+						throw haxe.lang.HaxeException.wrap("No compatible method found for: " + field);
+				} else {
+					hasNumber = true;
+				}
+				
+			}
+			
+			java.lang.reflect.Method found = ms[0];
+			
+			if (hasNumber)
+			{
+				java.lang.Class[] allcls = found.getParameterTypes();
+				
+				for (int i = 0; i < len; i++)
+				{
+					java.lang.Object o = objs[i];
+					if (o instanceof java.lang.Number)
+					{
+						java.lang.Class curCls = null;
+						if (i < allcls.length)
+						{
+							curCls = allcls[i];
+							if (!curCls.isAssignableFrom(o.getClass()))
+							{
+								String name = curCls.getName();
+								if (name.equals("double") || name.equals("java.lang.Double"))
+								{
+									objs[i] = ((java.lang.Number)o).doubleValue();
+								} else if (name.equals("int") || name.equals("java.lang.Integer"))
+								{
+									objs[i] = ((java.lang.Number)o).intValue();
+								} else if (name.equals("float") || name.equals("java.lang.Float"))
+								{
+									objs[i] = ((java.lang.Number)o).floatValue();
+								} else if (name.equals("byte") || name.equals("java.lang.Byte"))
+								{
+									objs[i] = ((java.lang.Number)o).byteValue();
+								} else if (name.equals("short") || name.equals("java.lang.Short"))
+								{
+									objs[i] = ((java.lang.Number)o).shortValue();
+								}
+							}
+						} //else varargs not handled TODO
+					}
+				}
+			}
+			
+			return found.invoke(obj, objs);
+		} catch(Throwable t) {
+			throw HaxeException.wrap(t);
+		}
+	')
+	public static function slowCallField(obj:Dynamic, field:String, args:Array<Dynamic>):Dynamic
+	{
+		throw "not implemented";
+	}
+	
+	@:functionBody('
+		if (obj instanceof haxe.lang.IHxObject)
+		{
+			return ((haxe.lang.IHxObject) obj).__hx_invokeField(field, false, args);
+		}
+		
+		return slowCallField(obj, field, args);
+	')
+	public static function callField(obj:Dynamic, field:String, args:Array<Dynamic>):Dynamic
+	{
+		return null;
+	}
+	
+	@:functionBody('
+	
+		if (obj instanceof haxe.lang.IHxObject)
+			return ((haxe.lang.IHxObject) obj).__hx_getField(field, false, throwErrors, false);
+		
+		return slowGetField(obj, field, throwErrors);
+	
+	')
+	public static function getField(obj:Dynamic, field:String, throwErrors:Bool):Dynamic
+	{
+		return null;
+	}
+	
+	@:functionBody('
+	
+		if (obj instanceof haxe.lang.IHxObject)
+			return ((haxe.lang.IHxObject) obj).__hx_getField_f(field, false, throwErrors);
+		
+		return toDouble(slowGetField(obj, field, throwErrors));
+	
+	')
+	public static function getField_f(obj:Dynamic, field:String, throwErrors:Bool):Float
+	{
+		return 0.0;
+	}
+	
+	@:functionBody('
+	
+		if (obj instanceof haxe.lang.IHxObject)
+			return ((haxe.lang.IHxObject) obj).__hx_setField(field, false, value);
+		
+		return slowSetField(obj, field, value);
+	
+	')
+	public static function setField(obj:Dynamic, field:String, value:Dynamic):Dynamic
+	{
+		return null;
+	}
+	
+	@:functionBody('
+	
+		if (obj instanceof haxe.lang.IHxObject)
+			return ((haxe.lang.IHxObject) obj).__hx_setField_f(field, false, value);
+		
+		return toDouble(slowSetField(obj, field, value));
+	
+	')
+	public static function setField_f(obj:Dynamic, field:String, value:Float):Float
+	{
+		return 0.0;
+	}
+	
+	
+	private static var classes:Hash<Class<Dynamic>> = new Hash();
+	
+	public static function registerClass(name:String, cl:Class<Dynamic>):Void
+	{
+		classes.set(name, cl);
+	}
+	
+	public static function getClass(name:String, t:java.lang.Class<Dynamic>):Class<Dynamic>
+	{
+		var ret:Class<Dynamic> = classes.get(name);
+		if (ret == null)
+			return slowGetClass(name, t);
+		else
+			return ret;
+	}
+	
+	@:functionBody('
+	if (t == null)
+		return null;
+	
+	return null;
+	')
+	public static function slowGetClass(name:String, t:java.lang.Class<Dynamic>):Class<Dynamic>
+	{
+		return null;
+	}
+	
+}
+
+@:native("haxe.lang.EmptyObject") private enum EmptyObject
+{
+	EMPTY;
+}

文件差異過大導致無法顯示
+ 0 - 0
std/java/_std/haxe/lang/StringExt.hx


+ 14 - 0
std/java/lang/Arrays.hx

@@ -0,0 +1,14 @@
+package java.lang;
+import java.NativeArray;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+class Arrays 
+{
+	
+	public static function copyOf<T>(original:NativeArray<T>, newLength:Int):NativeArray<T>;
+	
+}

+ 18 - 0
std/java/lang/Boolean.hx

@@ -0,0 +1,18 @@
+package java.lang;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+extern class Boolean 
+{
+	static var FALSE(default, null):Boolean;
+	static var TRUE(default, null):Boolean;
+	
+	
+	@:overload(function(s:String):Void {})
+	public function new(value:Bool):Void;
+	
+	function booleanValue():Bool;
+}

+ 19 - 0
std/java/lang/Character.hx

@@ -0,0 +1,19 @@
+package java.lang;
+import java.StdTypes;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+@:final extern class Character 
+{
+	function new(value:Char16):Void;
+	
+	function charValue():Char16;
+	
+	static function toLowerCase(ch:Char16):Char16;
+	static function toUpperCase(ch:Char16):Char16;
+	static function toTitleCase(ch:Char16):Char16;
+	static function toString(ch:Char16):String;
+}

+ 12 - 0
std/java/lang/Class.hx

@@ -0,0 +1,12 @@
+package java.lang;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+extern class Class<T>
+{
+	function isAssignableFrom(cls:Class<Dynamic>):Bool;
+	function getName():String;
+}

+ 98 - 0
std/java/lang/Number.hx

@@ -0,0 +1,98 @@
+package java.lang;
+import haxe.Int64;
+import java.StdTypes;
+
+private typedef StdFloat = Float;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+@:abstract extern class Number 
+{
+	
+	public function byteValue():Int8;
+	public function doubleValue():StdFloat;
+	public function floatValue():Single;
+	public function intValue():Int;
+	public function longValue():Int64;
+	public function shortValue():Int16;
+	
+}
+
+@:final extern class Byte extends Number, implements Int
+{
+	static var MAX_VALUE(default, null):Int8;
+	static var MIN_VALUE(default, null):Int8;
+	
+	@:overload(function(s:String):Void {})
+	function new(value:Int8):Void;
+	
+	static function parseByte(s:String, radix:Int):Int8;
+}
+
+@:final extern class Double extends Number, implements StdFloat
+{
+	static var MAX_VALUE(default, null):StdFloat;
+	static var MIN_VALUE(default, null):StdFloat;
+	static var NaN(default, null):StdFloat;
+	static var NEGATIVE_INFINITY(default, null):StdFloat;
+	static var POSITIVE_INFINITY(default, null):StdFloat;
+	
+	@:overload(function(s:String):Void {})
+	function new(value:StdFloat):Void;
+	
+	public static function isInfinite(f:Float):Bool;
+	public static function isNaN(f:Float):Bool;
+}
+
+@:final extern class Float extends Number, implements StdFloat
+{
+	static var MAX_VALUE(default, null):Single;
+	static var MIN_VALUE(default, null):Single;
+	static var NaN(default, null):Single;
+	static var NEGATIVE_INFINITY(default, null):Single;
+	static var POSITIVE_INFINITY(default, null):Single;
+	
+	static function isNaN(f:Float):Bool;
+	
+	@:overload(function(s:String):Void {})
+	function new(value:Single):Void;
+}
+
+@:final extern class Integer extends Number, implements Int
+{
+	static var MAX_VALUE(default, null):Int;
+	static var MIN_VALUE(default, null):Int;
+	
+	@:overload(function(s:String):Void {})
+	function new(value:Int):Void;
+	
+	static function toString(i:Int):String;
+	static function parseInt(s:String, radix:Int):Int;
+}
+
+@:final extern class Long extends Number
+{
+	static var MAX_VALUE(default, null):Int64;
+	static var MIN_VALUE(default, null):Int64;
+	
+	@:overload(function(s:String):Void {})
+	function new(value:Int64):Void;
+	
+	static function toString(i:Int64):String;
+	static function parseLong(s:String, radix:Int):Int64;
+}
+
+@:final extern class Short extends Number, implements Int
+{
+	static var MAX_VALUE(default, null):Int16;
+	static var MIN_VALUE(default, null):Int16;
+	
+	@:overload(function(s:String):Void {})
+	function new(value:Int16):Void;
+	
+	static function parseShort(s:String, radix:Int):Int16;
+}
+

+ 23 - 0
std/java/lang/System.hx

@@ -0,0 +1,23 @@
+package java.lang;
+import haxe.Int64;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+extern class System 
+{
+	static function arraycopy(src:Dynamic, srcPos:Int, dest:Dynamic, destPos:Int, length:Int):Void;
+	static function currentTimeMillis():Int64;
+	static function exit(status:Int):Void;
+	static function getenv(name:String):String;
+	static function getProperty(key:String, def:String):String;
+	static function setProperty(key:String, value:String):String;
+	static function load(filename:String):Void;
+	static function loadLibrary(libname:String):Void;
+	static function mapLibraryName(libname:String):String;
+	static function gc():Void;
+	static function runFinalization():Void;
+	
+}

+ 39 - 0
std/java/lang/Throwable.hx

@@ -0,0 +1,39 @@
+package java.lang;
+import java.NativeArray;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+extern class Throwable 
+{
+	
+	function new(message:String, cause:Throwable):Void;
+	function fillInStackTrace():Throwable;
+	function getCause():Throwable;
+	function getLocalizedMessage():String;
+	function getMessage():String;
+	function getStackTrace():NativeArray<StackTraceElement>;
+	function setStackTrace(stackTrace:NativeArray<StackTraceElement>):Void;
+	function initCause(cause:Throwable):Throwable;
+	function printStackTrace():Void;
+	
+}
+
+extern class Exception extends Throwable { }
+
+extern class RuntimeException extends Exception { }
+
+extern class Error extends Throwable { }
+
+extern class StackTraceElement
+{
+	function new(declaringClass:String, methodName:String, fileName:String, lineNumber:Int):Void;
+	
+	function getClassName():String;
+	function getFileName():String;
+	function getLineNumber():Int;
+	function getMethodName():String;
+	function isNativeMethod():Bool;
+}

+ 92 - 0
std/java/util/Date.hx

@@ -0,0 +1,92 @@
+package java.util;
+import haxe.Int64;
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/**
+	The Date class is used for date manipulation. There is some extra functions
+	available in the [DateTools] class.
+**/
+
+extern class Date
+{
+	/**
+		Creates a new date object.
+	**/
+	@:overload(function() : Void { })
+	@:overload(function(str : String) : Void { })
+	@:overload(function(time : Int64) : Void { })
+	function new(year : Int, month : Int, day : Int, hour : Int, min : Int, sec : Int ) : Void;
+
+	/**
+		Returns the timestamp of the date. It's the number of milliseconds
+		elapsed since 1st January 1970. It might only have a per-second precision
+		depending on the platforms.
+	**/
+	function getTime() : Int64;
+
+	/**
+		Returns the hours value of the date (0-23 range).
+	**/
+	function getHours() : Int;
+
+	/**
+		Returns the minutes value of the date (0-59 range).
+	**/
+	function getMinutes() : Int;
+
+	/**
+		Returns the seconds of the date (0-59 range).
+	**/
+	function getSeconds() : Int;
+
+	/**
+		Returns the full year of the date.
+	**/
+	function getYear() : Int;
+
+	/**
+		Returns the month of the date (0-11 range).
+	**/
+	function getMonth() : Int;
+
+	/**
+		Returns the day of the date (1-31 range).
+	**/
+	function getDate() : Int;
+
+	/**
+		Returns the week day of the date (0-6 range).
+	**/
+	function getDay() : Int;
+
+	/**
+		Returns a string representation for the Date, by using the
+		standard format [YYYY-MM-DD HH:MM:SS]. See [DateTools.format] for
+		other formating rules.
+	**/
+	function toString():String;
+}
+

+ 46 - 0
std/java/util/regex/Regex.hx

@@ -0,0 +1,46 @@
+package java.util.regex;
+
+/**
+ * ...
+ * @author waneck
+ */
+
+extern class Pattern
+{
+	static function compile(regex:String):Pattern;
+	
+	function matcher(input:String):Matcher;
+}
+
+
+extern interface MatchResult
+{
+	@:overload(function(group:Int):Int {})
+	function end():Int;
+	
+	function group(group:Int):String;
+	
+	function groupCount():Int;
+	
+	@:overload(function(group:Int):Int {})
+	function start():Int;
+}
+
+extern class Matcher implements MatchResult
+{
+	function reset(input:String):Matcher;
+	
+	@:overload(function(group:Int):Int {})
+	function end():Int;
+	
+	function group(group:Int):String;
+	
+	function groupCount():Int;
+
+	@:overload(function(group:Int):Int {})
+	function start():Int;
+	
+	function find():Bool;
+	
+	function replaceAll(replacement:String):String;
+}

部分文件因文件數量過多而無法顯示