Browse Source

added flash.Lib vector methods
implemented __vector__
renamed flash.VMem to flash.Memory

Nicolas Cannasse 17 years ago
parent
commit
a5ba90273d
5 changed files with 36 additions and 17 deletions
  1. 7 4
      doc/CHANGES.txt
  2. 16 11
      genswf9.ml
  3. 11 0
      std/flash9/Lib.hx
  4. 1 1
      std/flash9/Memory.hx
  5. 1 1
      std/haxe/ImportAll.hx

+ 7 - 4
doc/CHANGES.txt

@@ -1,4 +1,4 @@
-2008-??-??: 2.02 CVS
+2008-11-23: 2.02 CVS
 	Std.is(MyInterface, Class) now returns true (haXe/PHP)
 	php arrays are wrapped into _hx_array instances, fixes issues with references (array cast, access out of bounds ...)
 	removed untested php classes (php.DBase, php.IniHash)
@@ -13,19 +13,22 @@
 	fixed Type.typeof and Std.is in case of too much large integers for Flash6-8/JS
 	haxe.xml.Check : treat comments the same as PCDATA spaces
 	haxe.io.BytesData now uses strings instead of arrays for PHP
-	optimized line calculus from ast position
-	allow identifiers starting with _[0-9]
+	compiler : optimized line calculus from ast position
+	lexer : allow identifiers starting with _[0-9]
 	fixed access to flash.Vector methods : use AS3 namespace (faster)
 	bugfix in inline functions : modifying a parameter can't modify a real local var anymore
 	bugfix in inline functions : handle class type parameters and method type parameters
 	fixed issue with Int default value for Float parameter
 	flash9 : bugfix when using the retval after setting a closure variable
-	added flash.VMem API for flash10 alchemy opcodes access
+	added flash.Memory API for flash10 alchemy opcodes access
 	changed #if as3gen to #if as3 when generating as3 code
 	fixed as3 flash.Vector generation
 	fixed haxe.io.BytesOutput for flash9 : set default to little-endian
 	some flash9 fixes related to extern enums
 	updated flash.text.engine package with haxe enums
+	flash9 : use target file path for Boot unique ID instead of random number
+	as3 : fixed bug when anonymous field was a reserved identifier
+	flash9 : added flash.Lib.vectorOfArray and vectorConvert for flash10
 
 2008-10-04: 2.01
 	fixed php.Sys

+ 16 - 11
genswf9.ml

@@ -809,6 +809,15 @@ let gen_access_rw ctx e : (read access * write access) =
 		let r = gen_access ctx e Read in
 		r, w
 
+let rec gen_type ctx t =
+	match t with
+	| HMParams (t,tl) ->
+		write ctx (HGetLex t);
+		List.iter (gen_type ctx) tl;
+		write ctx (HApplyType (List.length tl));
+	| _ ->
+		write ctx (HGetLex t)
+
 let rec gen_expr_content ctx retval e =
 	match e.eexpr with
 	| TConst c ->
@@ -887,17 +896,8 @@ let rec gen_expr_content ctx retval e =
 	| TNew (c,tl,pl) ->
 		let id = type_id ctx (TInst (c,tl)) in
 		(match id with 
-		| HMParams (t,tl) ->
-			let rec get_type t =
-				match t with
-				| HMParams (t,tl) ->
-					write ctx (HGetLex t);
-					List.iter get_type tl;
-					write ctx (HApplyType (List.length tl));
-				| _ ->
-					write ctx (HGetLex t)
-			in
-			get_type id;
+		| HMParams _ ->
+			gen_type ctx id;
 			List.iter (gen_expr ctx true) pl;
 			write ctx (HConstruct (List.length pl))
 		| _ ->
@@ -1281,6 +1281,11 @@ and gen_call ctx retval e el r =
 			| 2l -> A3OSign16
 			| _ -> assert false
 		))
+	| TLocal "__vector__", [ep] ->
+		gen_type ctx (type_id ctx r);
+		write ctx HGetGlobalScope;
+		gen_expr ctx true ep;
+		write ctx (HCallStack 1)
 	| TArray ({ eexpr = TLocal "__global__" },{ eexpr = TConst (TString s) }), _ ->
 		(match gen_access ctx e Read with
 		| VGlobal id ->

+ 11 - 0
std/flash9/Lib.hx

@@ -77,6 +77,17 @@ class Lib {
 		return untyped __as__(v,c);
 	}
 
+	#if flash10
+
+	public inline static function vectorOfArray<T>( v : Array<T> ) : Vector<T> {
+		return untyped __vector__(v);
+	}
+
+	public inline static function vectorConvert<T,U>( v : Vector<T> ) : Vector<U> {
+		return untyped __vector__(v);
+	}
+
+	#end
 
 }
 

+ 1 - 1
std/flash9/VMem.hx → std/flash9/Memory.hx

@@ -1,6 +1,6 @@
 package flash;
 
-class VMem {
+class Memory {
 
 	public static inline function select( b : flash.utils.ByteArray ) {
 		flash.system.ApplicationDomain.currentDomain.domainMemory = b;

+ 1 - 1
std/haxe/ImportAll.hx

@@ -456,7 +456,7 @@ import tools.hxinst.Main;
 #if flash10
 
 import flash.Vector;
-import flash.VMem;
+import flash.Memory;
 
 import flash.events.SampleDataEvent;
 import flash.events.ShaderEvent;