Selaa lähdekoodia

new flash9 apis

Nicolas Cannasse 17 vuotta sitten
vanhempi
commit
289f8cf53e

+ 1 - 0
doc/CHANGES.txt

@@ -13,6 +13,7 @@ TODO inlining : substitute class+function type parameters in order to have fully
 	small patch for jsfl support
 	added __charCodeAt for very fast string operations on Flash9
 	bugfix with inlined local variables
+	upgraded flash9 api to flex3/player 9.0.115
 
 2008-04-05: 1.19
 	fixed flash9 Array.toString

+ 2 - 0
genswf9.ml

@@ -158,6 +158,8 @@ let type_path ctx path =
 		| [] , "Enum" -> [] , "Class"
 		| ["flash";"xml"], "XML" -> [], "XML"
 		| ["flash";"xml"], "XMLList" -> [], "XMLList"
+		| ["flash";"utils"], "QName" -> [] , "QName"
+		| ["flash";"utils"], "Namespace" -> [] , "Namespace"
 		| ["flash"] , "FlashXml__" -> [] , "Xml"
 		| ["flash"] , "Boot" -> [] , ctx.boot
 		| _ -> path

+ 53 - 0
std/flash9/sampler/Api.hx

@@ -0,0 +1,53 @@
+package flash.sampler;
+
+class Api {
+
+	public function clearSamples() {
+		untyped __global__["flash.sampler.clearSamples"]();
+	}
+
+	public function getGetterInvocationCount( obj : Dynamic, qname : flash.utils.QName ) : Float {
+		return untyped __global__["flash.sampler.getGetterInvocationCount"](obj,qname);
+	}
+
+	public function getSetterInvocationCount( obj : Dynamic, qname : flash.utils.QName ) : Float {
+		return untyped __global__["flash.sampler.getSetterInvocationCount"](obj,qname);
+	}
+
+	public function getInvocationCount( obj : Dynamic, qname : flash.utils.QName ) : Float {
+		return untyped __global__["flash.sampler.getInvocationCount"](obj,qname);
+	}
+
+	public function getMemberNames( obj : Dynamic, ?instanceNames : Bool ) : Dynamic<flash.utils.QName> {
+		return untyped __global__["flash.sampler.getMemberNames"](obj,instanceNames);
+	}
+
+	public function getSampleCount() : Float {
+		return untyped __global__["flash.sampler.getSampleCount"]();
+	}
+
+	public function getSamples() : Dynamic<flash.sampler.Sample> {
+		return untyped __global__["flash.sampler.getSamples"]();
+	}
+
+	public function getSize( obj : Dynamic ) : Float {
+		return untyped __global__["flash.sampler.getSize"](obj);
+	}
+
+	public function isGetterSetter( obj : Dynamic, qname : flash.utils.QName ) : Bool {
+		return untyped __global__["flash.sampler.isGetterSetter"](obj,qname);
+	}
+
+	public function pauseSampling() {
+		untyped __global__["flash.sampler.pauseSampling"]();
+	}
+
+	public function startSampling() {
+		untyped __global__["flash.sampler.startSampling"]();
+	}
+
+	public function stopSampling() {
+		untyped __global__["flash.sampler.stopSampling"]();
+	}
+
+}

+ 6 - 0
std/flash9/sampler/DeleteObjectSample.hx

@@ -0,0 +1,6 @@
+package flash.sampler;
+
+extern class DeleteObjectSample extends flash.sampler.Sample {
+	var id : Float;
+	var size : Float;
+}

+ 7 - 0
std/flash9/sampler/NewObjectSample.hx

@@ -0,0 +1,7 @@
+package flash.sampler;
+
+extern class NewObjectSample extends flash.sampler.Sample {
+	var id : Float;
+	var object(default,null) : Dynamic;
+	var type : Class<Dynamic>;
+}

+ 6 - 0
std/flash9/sampler/Sample.hx

@@ -0,0 +1,6 @@
+package flash.sampler;
+
+extern class Sample {
+	var stack : Array<StackFrame>;
+	var time : Float;
+}

+ 8 - 0
std/flash9/sampler/StackFrame.hx

@@ -0,0 +1,8 @@
+package flash.sampler;
+
+extern class StackFrame {
+	var file : String;
+	var line : UInt;
+	var name : String;
+	function toString() : String;
+}

+ 15 - 0
std/flash9/trace/Trace.hx

@@ -0,0 +1,15 @@
+package flash.trace;
+
+extern class Trace {
+	static var FILE : Int;
+	static var LISTENER : Int;
+	static var METHODS : Int;
+	static var METHODS_AND_LINES : Int;
+	static var METHODS_AND_LINES_WITH_ARGS : Int;
+	static var METHODS_WITH_ARGS : Int;
+	static var OFF : Int;
+	static function getLevel(?target : Int) : Int;
+	static function getListener() : Dynamic;
+	static function setLevel(l : Int, ?target : Int) : Dynamic;
+	static function setListener(f : Dynamic) : Dynamic;
+}

+ 7 - 0
std/flash9/utils/Namespace.hx

@@ -0,0 +1,7 @@
+package flash.utils;
+
+extern class Namespace {
+	var prefix : String;
+	var uri : String;
+	public function new( p1 : Dynamic, ?url : Dynamic ) : Void;
+}

+ 8 - 0
std/flash9/utils/QName.hx

@@ -0,0 +1,8 @@
+package flash.utils;
+
+extern class QName {
+	var localName(default,null) : String;
+	var uri(default,null) : String;
+	// p1 can be Namespace or QName (without localName)
+	public function new( p1 : Dynamic, ?localName : QName ) : Void;
+}

+ 17 - 0
std/haxe/ImportAll.hx

@@ -265,6 +265,8 @@ import flash.utils.Proxy;
 import flash.utils.SetIntervalTimer;
 import flash.utils.Timer;
 import flash.utils.TypedDictionary;
+import flash.utils.QName;
+import flash.utils.Namespace;
 import flash.xml.XML;
 import flash.xml.XMLList;
 import flash.xml.XMLDocument;
@@ -272,6 +274,12 @@ import flash.xml.XMLNode;
 import flash.xml.XMLNodeType;
 import flash.xml.XMLParser;
 import flash.xml.XMLTag;
+import flash.trace.Trace;
+import flash.sampler.Api;
+import flash.sampler.DeleteObjectSample;
+import flash.sampler.NewObjectSample;
+import flash.sampler.Sample;
+import flash.sampler.StackFrame;
 
 #else flash
 
@@ -478,6 +486,8 @@ import flash9.utils.Proxy;
 import flash9.utils.SetIntervalTimer;
 import flash9.utils.Timer;
 import flash9.utils.TypedDictionary;
+import flash9.utils.QName;
+import flash9.utils.Namespace;
 import flash9.xml.XML;
 import flash9.xml.XMLList;
 import flash9.xml.XMLDocument;
@@ -485,6 +495,13 @@ import flash9.xml.XMLNode;
 import flash9.xml.XMLNodeType;
 import flash9.xml.XMLParser;
 import flash9.xml.XMLTag;
+import flash9.trace.Trace;
+import flash9.sampler.Api;
+import flash9.sampler.DeleteObjectSample;
+import flash9.sampler.NewObjectSample;
+import flash9.sampler.Sample;
+import flash9.sampler.StackFrame;
+
 
 #end