Nicolas Cannasse 19 年之前
父節點
當前提交
bd31ec2b3a
共有 6 個文件被更改,包括 152 次插入18 次删除
  1. 20 11
      std/Array.hx
  2. 13 0
      std/Date.hx
  3. 24 0
      std/Math.hx
  4. 8 2
      std/Std.hx
  5. 16 5
      std/String.hx
  6. 71 0
      std/haxe/ImportAll.hx

+ 20 - 11
std/Array.hx

@@ -1,17 +1,26 @@
-native class Array<T> {
+extern class Array<T> {
 
-	public var length : Int;
+	var length : Int;
 
-	public function new() { }
-	function push(x : T) : Void { }
-	function pop() : T { }
-	function unshift( x : T ) : Void { }
+	function new() : Void;
 
-	function join( sep : String ) : String { }
-	function toString() : String { }
-
-	function sort( f : T -> T -> Int ) : Void { }
-	function insert( pos : Int, x : T ) : Void { }
+	function concat( a : Array<T> ) : Array<T>;
+	function join( sep : String ) : String;
+	function pop() : T;
+	function push(x : T) : Int;
+	function reverse() : Array<T>;
+	function shift() : T;
+	function slice( pos : Int, end : Int ) : Array<T>; // sub
+	function sort( f : T -> T -> Int ) : Void;
+	function splice( pos : Int, len : Int ) : Array<T>; // removed elts
+	// no toSource (js specific)
+	function toString() : String;
+	function unshift( x : T ) : Void;
+	// no valueOf (js specific)
 
+	/** added **/
+	function insert( pos : Int, x : T ) : Void;
+	function remove( x : T ) : Bool;
+	function copy() : Array<T>;
 
 }

+ 13 - 0
std/Date.hx

@@ -0,0 +1,13 @@
+extern class Date
+{
+	function new(year : Int, month : Int, date : Int, hour : Int, min : Int, sec : Int, ms : Int) : Void;
+
+	function getTime() : Int;
+	function setTime(value : Int) : Void;
+	function toString():String;
+
+	// need to think about the API
+
+}
+
+

+ 24 - 0
std/Math.hx

@@ -0,0 +1,24 @@
+extern class Math
+{
+	static var pi : Float;
+
+	static function abs(value:Float):Float;
+	static function min(value1:Float,value2:Float):Float;
+	static function max(value1:Float,value2:Float):Float;
+	static function sin(value:Float):Float;
+	static function cos(value:Float):Float;
+	static function atan2(value1:Float,value2:Float):Float;
+	static function tan(value:Float):Float;
+	static function exp(value:Float):Float;
+	static function log(value:Float):Float;
+	static function sqrt(value:Float):Float;
+	static function round(value:Float):Float;
+	static function floor(value:Float):Float;
+	static function ceil(value:Float):Float;
+	static function atan(value:Float):Float;
+	static function asin(value:Float):Float;
+	static function acos(value:Float):Float;
+	static function pow(value1:Float,value2:Float):Float;
+}
+
+

+ 8 - 2
std/Std.hx

@@ -1,8 +1,10 @@
+// standard haXe types
+
 enum Void { }
 
-native class Float { }
+extern class Float { }
 
-native class Int extends Float { }
+extern class Int extends Float { }
 
 enum Bool {
 	true;
@@ -11,3 +13,7 @@ enum Bool {
 
 enum Dynamic<T> {
 }
+
+class Std {
+
+}

+ 16 - 5
std/String.hx

@@ -1,9 +1,20 @@
-native class String {
+extern class String {
 
-	public var length : Int;
+	var length : Int;
 
-	public function new( s : String ) { }
-	public function sub( p : Int, l : Int) : String { }
-	public function split( s : String ) : Array<String> { }
+	function new(string:String) : Void;
+
+	function toUpperCase() : String;
+	function toLowerCase() : String;
+
+	function charAt( index : Int) : String;
+	function charCodeAt( index : Int) : Int;
+
+	function indexOf( value : String, startIndex : Int ) : Int;
+	function lastIndexOf( value : String, startIndex : Int ) : Int;
+	function split( delimiter : String ) : Array<String>;
+
+	/* added */
+	function sub( pos : Int, len : Int ) : String;
 
 }

+ 71 - 0
std/haxe/ImportAll.hx

@@ -0,0 +1,71 @@
+// std
+import Array;
+import Date;
+import ImportAll;
+import List;
+import Math;
+import Std;
+import String;
+
+// flash
+#flash
+
+import Accessibility;
+import AsBroadCaster;
+import Boot;
+import Camera;
+import Color;
+import Key;
+import LoadVars;
+import LocalConnection;
+import Microphone;
+import Mouse;
+import MovieClip;
+import MovieClipLoader;
+import PrintJob;
+import Selection;
+import SharedObject;
+import Sound;
+import Stage;
+import System;
+import TextField;
+import TextFormat;
+import TextSnapshot;
+import Video;
+
+import flash.text.StyleSheet;
+import flash.system.Capabilities;
+import flash.system.Security;
+
+#end
+
+#flash8
+
+import flash.display.BitmapData;
+import flash.external.ExternalInterface;
+import flash.filters.BevelFilter;
+import flash.filters.BitmapFilter;
+import flash.filters.BlurFilter;
+import flash.filters.ColorMatrixFilter;
+import flash.filters.ConvolutionFilter;
+import flash.filters.DisplacementMapFilter;
+import flash.filters.DropShadowFilter;
+import flash.filters.GlowFilter;
+import flash.filters.GradientBevelFilter;
+import flash.filters.GradientGlowFilter;
+
+import flash.geom.ColorTransform;
+import flash.geom.Matrix;
+import flash.geom.Point;
+import flash.geom.Rectangle;
+import flash.geom.Transform;
+
+import flash.net.FileReference;
+import flash.net.FileReferenceList;
+
+import flash.system.IME;
+import flash.text.TextRenderer;
+
+#end
+
+