Explorar o código

[java/cs] changed haxe.lang package to cs.internal, and sys.io.NativeInput/Output to cs.io / java.io

Caue Waneck %!s(int64=13) %!d(string=hai) anos
pai
achega
531a45c3c1

+ 8 - 13
std/cs/Boot.hx

@@ -1,22 +1,17 @@
 package cs;
-import haxe.lang.Exceptions;
-import haxe.lang.FieldLookup;
-import haxe.lang.Function;
-import haxe.lang.HxObject;
-import haxe.lang.Runtime;
-import haxe.lang.Iterator;
-import haxe.lang.Null;
+import cs.internal.Exceptions;
+import cs.internal.FieldLookup;
+import cs.internal.Function;
+import cs.internal.HxObject;
+import cs.internal.Runtime;
+import cs.internal.Iterator;
+import cs.internal.Null;
 import cs.Lib;
-import haxe.lang.StringExt;
+import cs.internal.StringExt;
 import cs.StdTypes;
 import Hash;
 import Reflect;
 
-/**
- * ...
- * @author waneck
- */
-
 class Boot 
 {
 

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

@@ -1,4 +1,4 @@
-import haxe.lang.Function;
+import cs.internal.Function;
 /*
  * Copyright (c) 2005, The haXe Project Contributors
  * All rights reserved.

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

@@ -24,7 +24,7 @@
  */
 import cs.Boot;
 import cs.Lib;
-import haxe.lang.Exceptions;
+import cs.internal.Exceptions;
  
 @:core_api @:nativegen class Std {
 	public static function is( v : Dynamic, t : Dynamic ) : Bool 

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

@@ -218,7 +218,7 @@ class Sys {
 	public static function stdin() : haxe.io.Input
 	{
 #if !(Xbox || CF || MF)
-		return new sys.io.NativeInput(system.Console.OpenStandardInput());
+		return new cs.io.NativeInput(system.Console.OpenStandardInput());
 #else
 		return null;
 #end
@@ -230,7 +230,7 @@ class Sys {
 	public static function stdout() : haxe.io.Output
 	{
 #if !(Xbox || CF || MF)
-		return new sys.io.NativeOutput(system.Console.OpenStandardOutput());
+		return new cs.io.NativeOutput(system.Console.OpenStandardOutput());
 #else
 		return null;
 #end
@@ -242,7 +242,7 @@ class Sys {
 	public static function stderr() : haxe.io.Output
 	{
 #if !(Xbox || CF || MF)
-		return new sys.io.NativeOutput(system.Console.OpenStandardError());
+		return new cs.io.NativeOutput(system.Console.OpenStandardError());
 #else
 		return null;
 #end

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

@@ -1,6 +1,6 @@
 import cs.Lib;
-import haxe.lang.HxObject;
-import haxe.lang.Runtime;
+import cs.internal.HxObject;
+import cs.internal.Runtime;
 /*
  * Copyright (c) 2005, The haXe Project Contributors
  * All rights reserved.

+ 0 - 1
std/cs/_std/haxe/lang/HxObject.hx

@@ -1 +0,0 @@
-package haxe.lang;
private typedef StdType = Type;
import system.Type;

@:native('haxe.lang.HxObject')
private class HxObject implements IHxObject
{
	
}

@:native('haxe.lang.IHxObject')
private interface IHxObject
{
	
}

@:native('haxe.lang.DynamicObject')
private class DynamicObject extends HxObject, implements Dynamic
{
	public function toString():String
	{
		var ret = new StringBuf();
		ret.add("{");
		var first = true;
		for (f in Reflect.fields(this))
		{
			if( first )
				first = false;
			else
				ret.add(",");
			ret.add(" "); ret.add(f);
			ret.add(" : ");
			ret.add(Reflect.field(this, f));
		}
		if (!first) ret.add(" ");
		ret.add("}");
		
		return ret.toString();
	}
}

interface IGenericObject
{
	
}

@:native('haxe.lang.Enum')
@:skip_ctor
private class Enum
{
	@:readonly private var index:Int;
	@:readonly private var params:Array<{}>;
	
	public function new(index:Int, params:Array<{}>)
	{
		this.index = index;
		this.params = params;
	}
	
	@:final public function getTag():String
	{
		var cl:Dynamic = StdType.getClass(this);
		return cl.constructs[index];
	}
	
	public function toString():String
	{
		if (params == null) return getTag();
		var ret = new StringBuf();
		ret.add(getTag()); ret.add("(");
		
		var first = true;
		
		for (p in params)
		{
			if (first)
				first = false;
			else
				ret.add(",");
			ret.add(p);
		}
		
		ret.add(")");
		return ret.toString();
	}
	
	public function Equals(obj:Dynamic)
	{
		if (obj == this) //we cannot use == as .Equals !
			return true;
		
		var obj:Enum = cast obj;
		var ret = obj != null && Std.is(obj, StdType.getClass(this)) && obj.index == this.index;
		if (!ret) 
			return false;
		if (obj.params == this.params)
			return true;
		var len = 0;
		if (obj.params == null || this.params == null || (len = this.params.length) != obj.params.length)
			return false;
		
		for (i in 0...len)
		{
			if (!StdType.enumEq(obj.params[i], this.params[i]))
				return false;
		}
		return true;
	}
	
	
}

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

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

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
std/cs/_std/haxe/lang/StringExt.hx


+ 1 - 1
std/cs/_std/sys/io/FileInput.hx

@@ -27,7 +27,7 @@ package sys.io;
 /**
 	Use [sys.io.File.read] to create a [FileInput]
 **/
-class FileInput extends NativeInput {
+class FileInput extends cs.io.NativeInput {
 	public function new(stream:system.io.FileStream)
 	{
 		super(stream);

+ 1 - 1
std/cs/_std/sys/io/FileOutput.hx

@@ -27,7 +27,7 @@ package sys.io;
 /**
 	Use [sys.io.File.write] to create a [FileOutput]
 **/
-class FileOutput extends NativeOutput {
+class FileOutput extends cs.io.NativeOutput {
 	public function new(stream:system.io.FileStream)
 	{
 		super(stream);

+ 3 - 3
std/cs/_std/sys/io/Process.hx

@@ -53,9 +53,9 @@ class Process {
 		
 		native.Start();
 		
-		this.stdout = new sys.io.NativeInput(native.StandardOutput.BaseStream);
-		this.stderr = new sys.io.NativeInput(native.StandardError.BaseStream);
-		this.stdin = new sys.io.NativeOutput(native.StandardInput.BaseStream);
+		this.stdout = new cs.io.NativeInput(native.StandardOutput.BaseStream);
+		this.stderr = new cs.io.NativeInput(native.StandardError.BaseStream);
+		this.stdin = new cs.io.NativeOutput(native.StandardInput.BaseStream);
 	}
 	
 	public function getPid() : Int

+ 1 - 1
std/cs/_std/haxe/lang/Exceptions.hx → std/cs/internal/Exceptions.hx

@@ -1,4 +1,4 @@
-package haxe.lang;
+package cs.internal;
 import system.Exception;
 
 //should NOT be usable inside haxe code

+ 1 - 1
std/cs/_std/haxe/lang/FieldLookup.hx → std/cs/internal/FieldLookup.hx

@@ -1,4 +1,4 @@
-package haxe.lang;
+package cs.internal;
 
 @:native('haxe.lang.FieldLookup')
 @:static private class FieldLookup 

+ 3 - 3
std/cs/_std/haxe/lang/Function.hx → std/cs/internal/Function.hx

@@ -1,4 +1,4 @@
-package haxe.lang;
+package cs.internal;
 
 /**
  These classes are automatically generated by the compiler. They are only
@@ -22,7 +22,7 @@ package haxe.lang;
 	}
 }
 
-@:nativegen class VarArgsFunction extends VarArgsBase
+@:nativegen @:native('haxe.lang.VarArgsFunction') class VarArgsFunction extends VarArgsBase
 {
 	private var fun:Array<Dynamic>->Dynamic;
 	
@@ -38,7 +38,7 @@ package haxe.lang;
 	}
 }
 
-@:nativegen class Closure extends VarArgsBase
+@:nativegen @:native('haxe.lang.Closure') class Closure extends VarArgsBase
 {
 	private var obj:Dynamic;
 	private var field:String;

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
std/cs/internal/HxObject.hx


+ 17 - 0
std/cs/internal/Iterator.hx

@@ -0,0 +1,17 @@
+package cs.internal;
+
+@:native('haxe.lang.Iterator') interface Iterator<T>
+{
+	
+	public function hasNext():Bool;
+	
+	public function next():T;
+	
+}
+
+@:native('haxe.lang.Iterable') interface Iterable<T>
+{
+	
+	public function iterator():Iterator<T>;
+	
+}

+ 1 - 1
std/cs/_std/haxe/lang/Null.hx → std/cs/internal/Null.hx

@@ -1,4 +1,4 @@
-package haxe.lang;
+package cs.internal;
 
 @:classContents('
 	//This function is here to be used with Reflection, when the haxe.lang.Null type is known

+ 3 - 2
std/cs/_std/haxe/lang/Runtime.hx → std/cs/internal/Runtime.hx

@@ -1,4 +1,4 @@
-package haxe.lang;
+package cs.internal;
 import cs.Lib;
 import cs.NativeArray;
 import cs.NativeArray;
@@ -14,6 +14,7 @@ import system.Type;
 **/
 
 @:nativegen
+@:native('haxe.lang.Runtime')
 @:classContents('
 	public static object getField(haxe.lang.HxObject obj, string field, int fieldHash, bool throwErrors)
 	{
@@ -414,7 +415,7 @@ import system.Type;
 			}
 			m = m.MakeGenericMethod(tgs);
 			var retg = m.Invoke(obj, oargs);
-			return haxe.lang.Runtime.unbox(retg);
+			return cs.internal.Runtime.unbox(retg);
 		}
 		
 		var m = methods[0];

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
std/cs/internal/StringExt.hx


+ 2 - 2
std/cs/_std/sys/io/NativeInput.hx → std/cs/io/NativeInput.hx

@@ -1,4 +1,4 @@
-package sys.io;
+package cs.io;
 import haxe.Int64;
 import haxe.io.Bytes;
 import haxe.io.Eof;
@@ -43,7 +43,7 @@ class NativeInput extends Input
 		return stream.CanSeek;
 	}
 	
-	public function seek( p : Int, pos : FileSeek ) : Void
+	public function seek( p : Int, pos : sys.io.FileSeek ) : Void
 	{
 		var p = switch(pos)
 		{

+ 2 - 2
std/cs/_std/sys/io/NativeOutput.hx → std/cs/io/NativeOutput.hx

@@ -1,4 +1,4 @@
-package sys.io;
+package cs.io;
 import haxe.Int64;
 import haxe.io.Bytes;
 import haxe.io.Output;
@@ -40,7 +40,7 @@ class NativeOutput extends Output
 		return stream.CanSeek;
 	}
 	
-	public function seek( p : Int, pos : FileSeek ) : Void
+	public function seek( p : Int, pos : sys.io.FileSeek ) : Void
 	{
 		var p = switch(pos)
 		{

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

@@ -211,7 +211,7 @@ import sys.io.Process;
 	public static function stdin() : haxe.io.Input
 	{
 		var _in:java.io.InputStream = Reflect.field(System, "in");
-		return new sys.io.NativeInput(_in);
+		return new java.io.NativeInput(_in);
 	}
 
 	/**
@@ -219,7 +219,7 @@ import sys.io.Process;
 	**/
 	public static function stdout() : haxe.io.Output
 	{
-		return new sys.io.NativeOutput(System.out);
+		return new java.io.NativeOutput(System.out);
 	}
 
 	/**
@@ -227,7 +227,7 @@ import sys.io.Process;
 	**/
 	public static function stderr() : haxe.io.Output
 	{
-		return new sys.io.NativeOutput(System.err);
+		return new java.io.NativeOutput(System.err);
 	}
 
 }

+ 2 - 2
std/java/_std/sys/io/Process.hx

@@ -55,7 +55,7 @@ class Process {
 		var p = proc;
 		stderr = new ProcessInput(p.getErrorStream());
 		stdout = new ProcessInput(p.getInputStream());
-		stdin = new sys.io.NativeOutput(p.getOutputStream());
+		stdin = new java.io.NativeOutput(p.getOutputStream());
 	}
 	
 	public function getPid() : Int
@@ -90,7 +90,7 @@ class Process {
 }
 
 
-private class ProcessInput extends NativeInput
+private class ProcessInput extends java.io.NativeInput
 {
 	private var chained:BytesInput;
 	

+ 2 - 2
std/java/_std/sys/io/NativeInput.hx → std/java/io/NativeInput.hx

@@ -1,11 +1,11 @@
-package sys.io;
+package java.io;
 import haxe.Int64;
 import haxe.io.Bytes;
 import haxe.io.Eof;
 import haxe.io.Input;
 import java.io.Exceptions;
 
-class NativeInput extends Input
+@:native('haxe.java.io.NativeInput') class NativeInput extends Input
 {
 	var stream:java.io.InputStream;
 	public function new(stream)

+ 2 - 2
std/java/_std/sys/io/NativeOutput.hx → std/java/io/NativeOutput.hx

@@ -1,11 +1,11 @@
-package sys.io;
+package java.io;
 import haxe.Int64;
 import haxe.io.Bytes;
 import haxe.io.Eof;
 import haxe.io.Output;
 import java.io.Exceptions;
 
-class NativeOutput extends Output
+@:native('haxe.java.io.NativeOutput') class NativeOutput extends Output
 {
 	var stream:java.io.OutputStream;
 	public function new(stream)

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio