Pārlūkot izejas kodu

remoting package change.

Nicolas Cannasse 19 gadi atpakaļ
vecāks
revīzija
b78a2a590e

+ 16 - 14
std/haxe/ImportAll.hx

@@ -44,26 +44,31 @@ import StringBuf;
 import StringTools;
 import Xml;
 
-import haxe.AsyncConnection;
-import haxe.AsyncDebugConnection;
-import haxe.AsyncRemotingProxy;
-import haxe.Connection;
 import haxe.Http;
 import haxe.ImportAll;
 import haxe.Log;
 import haxe.PosInfos;
-import haxe.RemotingProxy;
 import haxe.Serializer;
-#if js
-#else true
-import haxe.SocketConnection;
-#end
 import haxe.Template;
+import haxe.Timer;
+import haxe.Unserializer;
+
+import haxe.remoting.AsyncConnection;
+import haxe.remoting.AsyncDebugConnection;
+import haxe.remoting.AsyncProxy;
+import haxe.remoting.Connection;
+#if flash
+import haxe.remoting.LocalConnection;
+#end
+import haxe.remoting.Proxy;
 #if neko
+import haxe.remoting.Server;
+import haxe.remoting.SocketBuffer;
+#end
+#if js
 #else true
-import haxe.Timer;
+import haxe.remoting.SocketConnection;
 #end
-import haxe.Unserializer;
 
 // flash
 #if flash
@@ -149,9 +154,6 @@ import neko.db.Object;
 import neko.db.ResultSet;
 import neko.db.Transaction;
 
-import neko.remoting.Server;
-import neko.remoting.SocketBuffer;
-
 import tools.DocView;
 
 #end

+ 4 - 4
std/haxe/remoting/AsyncConnection.hx

@@ -22,7 +22,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  */
-package haxe;
+package haxe.remoting;
 
 class AsyncConnection implements Dynamic<AsyncConnection> {
 
@@ -67,9 +67,9 @@ class AsyncConnection implements Dynamic<AsyncConnection> {
 			return;
 		}
 		#end
-		var h = new Http(__data);
+		var h = new haxe.Http(__data);
 		var me = this;
-		var s = new Serializer();
+		var s = new haxe.Serializer();
 		s.serialize(__path);
 		s.serialize(params);
 		h.setHeader("X-Haxe-Remoting","1");
@@ -80,7 +80,7 @@ class AsyncConnection implements Dynamic<AsyncConnection> {
 			try {
 				if( data.length < 3 || data.substr(0,3) != "hxr" )
 					throw "Invalid response : '"+data+"'";
-				var s = new Unserializer(data.substr(3,data.length-3));
+				var s = new haxe.Unserializer(data.substr(3,data.length-3));
 				v = s.unserialize();
 			} catch( err : Dynamic ) {
 				ok = false;

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

@@ -22,7 +22,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  */
-package haxe;
+package haxe.remoting;
 
 class AsyncDebugConnection extends AsyncConnection, implements Dynamic<AsyncDebugConnection> {
 

+ 3 - 3
std/haxe/remoting/AsyncProxy.hx

@@ -22,16 +22,16 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  */
-package haxe;
+package haxe.remoting;
 
 /**
 	This class is magic. When you extend it with a class C, it will automaticaly
 	create a stub class with all public methods forwarding remoting messages over
 	the connection.
 **/
-class AsyncRemotingProxy<T> {
+class AsyncProxy<T> {
 
-	var __cnx : haxe.AsyncConnection;
+	var __cnx : AsyncConnection;
 
 	function new( c ) {
 		__cnx = c;

+ 11 - 11
std/haxe/remoting/Connection.hx

@@ -22,7 +22,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  */
-package haxe;
+package haxe.remoting;
 
 class Connection implements Dynamic<Connection> {
 
@@ -45,24 +45,24 @@ class Connection implements Dynamic<Connection> {
 		var p = __path.copy();
 		var f = p.pop();
 		var path = p.join(".");
-		var s = new Serializer();
+		var s = new haxe.Serializer();
 		s.serialize(params);
 		var params = s.toString().split("\\").join("\\\\");
-		var s = flash.external.ExternalInterface.call("haxe.Connection.doCall",path,f,params);
+		var s = flash.external.ExternalInterface.call("haxe.remoting.Connection.doCall",path,f,params);
 		if( s == null )
 			throw "Failed to call JS method "+__path.join(".");
-		return new Unserializer(s).unserialize();
+		return new haxe.Unserializer(s).unserialize();
 	#else js
 		var p = __path.copy();
 		var f = p.pop();
 		var path = p.join(".");
-		var s = new Serializer();
+		var s = new haxe.Serializer();
 		s.serialize(params);
 		var params = s.toString();
 		var s = __data.remotingCall(path,f,params);
 		if( s == null )
 			throw "Failed to call Flash method "+__path.join(".");
-		return new Unserializer(s).unserialize();
+		return new haxe.Unserializer(s).unserialize();
 	#else neko
 		var cnx = AsyncConnection.urlConnect(__data);
 		var result = null;
@@ -77,7 +77,7 @@ class Connection implements Dynamic<Connection> {
 
 	static function doCall( path : String, f : String, params : String ) : String {
 		try {
-			var params = new Unserializer(params).unserialize();
+			var params = new haxe.Unserializer(params).unserialize();
 			#if flash
 			var obj = flash.Lib.eval(path);
 			#else js
@@ -89,7 +89,7 @@ class Connection implements Dynamic<Connection> {
 			if( fun == null )
 				throw "Invalid call : "+path+"."+f;
 			var v = Reflect.callMethod(obj,fun,params);
-			var s = new Serializer();
+			var s = new haxe.Serializer();
 			s.serialize(v);
 			#if flash
 			return s.toString().split("\\").join("\\\\");
@@ -99,7 +99,7 @@ class Connection implements Dynamic<Connection> {
 			return null;
 			#end
 		} catch( e : Dynamic ) {
-			var s = new Serializer();
+			var s = new haxe.Serializer();
 			s.serializeException(e);
 			return s.toString();
 		}
@@ -116,8 +116,8 @@ class Connection implements Dynamic<Connection> {
 	public static function jsConnect() : Connection {
 		if( !flash.external.ExternalInterface.available )
 			throw "External Interface not available";
-		if( flash.external.ExternalInterface.call("haxe.Connection.jsRemoting") != "yes" )
-			throw "haxe.Connection is not available in JavaScript";
+		if( flash.external.ExternalInterface.call("haxe.remoting.Connection.jsRemoting") != "yes" )
+			throw "haxe.remoting.Connection is not available in JavaScript";
 		return new Connection(null,[]);
 	}
 

+ 3 - 3
std/haxe/remoting/Proxy.hx

@@ -22,16 +22,16 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  */
-package haxe;
+package haxe.remoting;
 
 /**
 	This class is magic. When you extend it with a class C, it will automaticaly
 	create a stub class with all public methods forwarding remoting messages over
 	the connection.
 **/
-class RemotingProxy<T> {
+class Proxy<T> {
 
-	var __cnx : haxe.Connection;
+	var __cnx : Connection;
 
 	function new( c ) {
 		__cnx = c;

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

@@ -22,7 +22,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  */
-package neko.remoting;
+package haxe.remoting;
 
 class Server {
 

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

@@ -22,7 +22,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  */
-package neko.remoting;
+package haxe.remoting;
 
 enum SocketError {
 	ReadError;

+ 5 - 5
std/haxe/remoting/SocketConnection.hx

@@ -22,13 +22,13 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  */
-package haxe;
+package haxe.remoting;
 
 class SocketConnection extends AsyncConnection {
 
 	var __funs : List<Dynamic -> Void>;
 	#if neko
-	var __r : neko.remoting.Server;
+	var __r : Server;
 	#end
 
 	function __resolve(field) : AsyncConnection {
@@ -135,7 +135,7 @@ class SocketConnection extends AsyncConnection {
 	public static function processMessage( sc : SocketConnection, data : String ) {
 		var f : Dynamic -> Void;
 		var val : Dynamic;
-		var s = new Unserializer(data);
+		var s = new haxe.Unserializer(data);
 		try {
 			var isrequest : Bool = s.unserialize();
 			if( !isrequest ) {
@@ -179,7 +179,7 @@ class SocketConnection extends AsyncConnection {
 			exc = true;
 		}
 		try {
-			var s = new Serializer();
+			var s = new haxe.Serializer();
 			s.serialize(false);
 			if( exc )
 				s.serializeException(val);
@@ -197,7 +197,7 @@ class SocketConnection extends AsyncConnection {
 
 	#if neko
 
-	public static function socketConnect( s : neko.Socket, r : neko.remoting.Server ) {
+	public static function socketConnect( s : neko.Socket, r : Server ) {
 		var sc = new SocketConnection(s,[]);
 		sc.__funs = new List();
 		sc.__r = r;

+ 3 - 3
typer.ml

@@ -405,7 +405,7 @@ let extend_remoting ctx c t p async =
 	in
 	let class_fields = (match ct with
 		| TInst (c,params) ->
-			(FVar ("__cnx",None,[],Some (TPNormal { tpackage = ["haxe"]; tname = if async then "AsyncConnection" else "Connection"; tparams = [] }),None),p) ::
+			(FVar ("__cnx",None,[],Some (TPNormal { tpackage = ["haxe";"remoting"]; tname = if async then "AsyncConnection" else "Connection"; tparams = [] }),None),p) ::
 			(FFun ("new",None,[APublic],[],{ f_args = ["c",None]; f_type = None; f_expr = (EBinop (OpAssign,(EConst (Ident "__cnx"),p),(EConst (Ident "c"),p)),p) }),p) ::
 			PMap.fold (fun f acc ->						
 				if not f.cf_public then
@@ -431,9 +431,9 @@ let set_heritance ctx c herits p =
 	let rec loop = function
 		| HPrivate | HExtern | HInterface ->
 			()
-		| HExtends { tpackage = ["haxe"]; tname = "RemotingProxy"; tparams = [TPNormal t] } ->
+		| HExtends { tpackage = ["haxe";"remoting"]; tname = "Proxy"; tparams = [TPNormal t] } ->
 			extend_remoting ctx c t p false
-		| HExtends { tpackage = ["haxe"]; tname = "AsyncRemotingProxy"; tparams = [TPNormal t] } ->
+		| HExtends { tpackage = ["haxe";"remoting"]; tname = "AsyncProxy"; tparams = [TPNormal t] } ->
 			extend_remoting ctx c t p true
 		| HExtends t ->
 			if c.cl_super <> None then error "Cannot extend several classes" p;