Browse Source

[netlib] getting unit tests to compile again

Caue Waneck 11 years ago
parent
commit
03fbe2bd20
6 changed files with 32 additions and 22 deletions
  1. 8 2
      gencs.ml
  2. 4 4
      std/cs/StdTypes.hx
  3. 3 2
      std/cs/_std/Date.hx
  4. 5 2
      std/cs/_std/EReg.hx
  5. 11 11
      std/cs/io/NativeOutput.hx
  6. 1 1
      std/haxe/io/BytesBuffer.hx

+ 8 - 2
gencs.ml

@@ -3168,8 +3168,12 @@ let add_net_lib com file std =
 			let clr_header = PeReader.read_clr_header ctx in
 			let meta = IlMetaReader.read_meta_tables ctx clr_header in
 			close_in (r.PeReader.ch);
+			if PMap.mem "net_loader_debug" com.defines then
+				print_endline ("for lib " ^ file);
 			Hashtbl.iter (fun _ td ->
 				let path = IlMetaTools.get_path (TypeDef td) in
+				if PMap.mem "net_loader_debug" com.defines then
+					Printf.printf "found %s\n" (path_s (netpath_to_hx path));
 				Hashtbl.add com.net_path_map (netpath_to_hx path) path;
 				Hashtbl.replace meta.il_typedefs path td
 			) meta.il_typedefs;
@@ -3205,6 +3209,8 @@ let add_net_lib com file std =
 		let pack = match fst path with | ["haxe";"root"] -> [] | p -> p in
 		let cp = ref [] in
 		let rec build path = try
+			if PMap.mem "net_loader_debug" com.defines then
+				Printf.printf "looking up %s\n" (path_s path);
 			match lookup path with
 			| Some cls ->
 				let ctx = get_ctx() in
@@ -3234,8 +3240,8 @@ let before_generate com =
 	let net_ver = try
 			int_of_string (PMap.find "net_ver" com.defines)
 		with | Not_found ->
-			Common.define_value com Define.NetVer "20";
-			20
+			Common.define_value com Define.NetVer "40";
+			40
 	in
 	if net_ver < 20 then
 		failwith (

+ 4 - 4
std/cs/StdTypes.hx

@@ -21,9 +21,9 @@
  */
 package cs;
 
-@:notNull @:runtimeValue @:coreType abstract Int8 from Int {}
-@:notNull @:runtimeValue @:coreType abstract Int16 from Int {}
+@:notNull @:runtimeValue @:coreType abstract Int8 to Int {}
+@:notNull @:runtimeValue @:coreType abstract Int16 to Int {}
 @:notNull @:runtimeValue @:coreType abstract Char16 from Int {}
-@:notNull @:runtimeValue @:coreType abstract UInt8 from Int {}
-@:notNull @:runtimeValue @:coreType abstract UInt16 from Int {}
+@:notNull @:runtimeValue @:coreType abstract UInt8 to Int from Int {}
+@:notNull @:runtimeValue @:coreType abstract UInt16 to Int {}
 @:notNull abstract UInt64(haxe.Int64) from haxe.Int64 {}

+ 3 - 2
std/cs/_std/Date.hx

@@ -21,6 +21,7 @@
  */
 package;
 import cs.system.DateTime;
+import cs.system.TimeSpan;
 import haxe.Int64;
 
 @:coreApi class Date
@@ -36,7 +37,7 @@ import haxe.Int64;
 
 	public inline function getTime() : Float
 	{
-		return (cast(date.Ticks, Float) / TimeSpan.TicksPerMillisecond);
+		return (cast(date.Ticks, Float) / cast(TimeSpan.TicksPerMillisecond, Float));
 	}
 
 	public inline function getHours() : Int
@@ -99,7 +100,7 @@ import haxe.Int64;
 	static public function fromTime( t : Float ) : Date
 	{
 		var d = new Date(0, 0, 0, 0, 0, 0);
-		d.date = new DateTime(cast(t * TimeSpan.TicksPerMillisecond, Int64));
+		d.date = new DateTime(cast(t * cast(TimeSpan.TicksPerMillisecond, Float), Int64));
 		return d;
 	}
 

+ 5 - 2
std/cs/_std/EReg.hx

@@ -19,9 +19,12 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
-import cs.system.text.regularExpressions.Regex;
+import cs.system.text.regularexpressions.Regex;
+import cs.system.text.regularexpressions.Match;
+import cs.system.text.regularexpressions.RegexOptions;
+import cs.system.text.regularexpressions.*;
 
-@:coreApi class EReg {
+class EReg {
 
 	private var regex : Regex;
 	private var m : Match;

+ 11 - 11
std/cs/io/NativeOutput.hx

@@ -33,33 +33,33 @@ class NativeOutput extends Output
 		this.stream = stream;
 		if (!stream.CanWrite) throw "Read-only stream";
 	}
-	
-	override public function writeByte(c:Int):Void 
+
+	override public function writeByte(c:Int):Void
 	{
-		stream.WriteByte(c);
+		stream.WriteByte(cast c);
 	}
-	
+
 	override public function close():Void
 	{
 		stream.Close();
 	}
-	
+
 	override public function flush():Void
 	{
 		stream.Flush();
 	}
-	
+
 	override public function prepare(nbytes:Int):Void
 	{
 		//TODO see if implementation is correct
 		stream.SetLength(haxe.Int64.add(stream.Length, cast(nbytes, Int64)));
 	}
-	
+
 	private function get_canSeek():Bool
 	{
 		return stream.CanSeek;
 	}
-	
+
 	public function seek( p : Int, pos : sys.io.FileSeek ) : Void
 	{
 		var p = switch(pos)
@@ -68,12 +68,12 @@ class NativeOutput extends Output
 			case SeekCur: cs.system.io.SeekOrigin.Current;
 			case SeekEnd: cs.system.io.SeekOrigin.End;
 		};
-		
+
 		stream.Seek(cast(p, Int64), p);
 	}
-	
+
 	public function tell() : Int
 	{
 		return cast(stream.Position, Int);
 	}
-}
+}

+ 1 - 1
std/haxe/io/BytesBuffer.hx

@@ -82,7 +82,7 @@ class BytesBuffer {
 		#elseif cpp
 		b.push(untyped byte);
 		#elseif cs
-		b.WriteByte(byte);
+		b.WriteByte(cast byte);
 		#elseif java
 		b.write(byte);
 		#else