Jelajahi Sumber

[python] move select externs to the right place

Dan Korostelev 10 tahun lalu
induk
melakukan
2ebe447eb0
2 mengubah file dengan 32 tambahan dan 12 penghapusan
  1. 32 0
      std/python/lib/Select.hx
  2. 0 12
      std/python/lib/net/Socket.hx

+ 32 - 0
std/python/lib/Select.hx

@@ -0,0 +1,32 @@
+/*
+ * Copyright (C)2005-2015 Haxe Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+package python.lib;
+
+import haxe.io.BytesData;
+import python.Tuple;
+
+private typedef Selectable = haxe.extern.EitherType<Int,{function fileno():Int;}>
+
+@:pythonImport("select")
+extern class Select {
+    static function select(rlist:Array<Selectable>, wlist:Array<Selectable>, xlist:Array<Selectable>, ?timeout:Float):Tuple3<Array<Selectable>,Array<Selectable>,Array<Selectable>>;
+}

+ 0 - 12
std/python/lib/net/Socket.hx

@@ -28,18 +28,6 @@ import python.Tuple;
     A TCP socket class : allow you to both connect to a given server and exchange messages or start your own server and wait for connections.
 **/
 
-typedef Selectable = {
-    function fileno():Int;
-}
-
-@:native("select")
-@:pythonImport("select")
-extern class Select {
-
-    static function select<T>(reads:Array<T>,writes:Array<T>,xs:Array<T>,timeout:Float):Tuple3<Array<T>,Array<T>,Array<T>>;
-
-}
-
 @:pythonImport("socket", "socket")
 extern class Socket {