flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [1/2] git commit: [flex-asjs] [refs/heads/spark] - clean compile and cross-compile of UIComponent (needs FalconJX fix to be committed shortly). Next step is to get a test app to get through GCC cleanly
Date Mon, 28 Mar 2016 05:44:40 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/spark a23bd593f -> b173bdce0


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b173bdce/frameworks/projects/MX/src/main/flex/mx/utils/UIDUtil.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/utils/UIDUtil.as b/frameworks/projects/MX/src/main/flex/mx/utils/UIDUtil.as
index 34369e1..91af364 100644
--- a/frameworks/projects/MX/src/main/flex/mx/utils/UIDUtil.as
+++ b/frameworks/projects/MX/src/main/flex/mx/utils/UIDUtil.as
@@ -20,8 +20,11 @@
 package mx.utils
 {
 
-import flash.utils.ByteArray;
-import flash.utils.Dictionary;
+COMPILE::AS3
+{
+	import flash.utils.ByteArray;
+	import flash.utils.Dictionary;		
+}
 
 import mx.core.IPropertyChangeNotifier;
 import mx.core.IUIComponent;
@@ -67,6 +70,7 @@ public class UIDUtil
 		55, 56, 57, 65, 66, 67, 68, 69, 70];
 
     private static const DASH:int = 45;       // dash ascii
+	COMPILE::AS3
     private static const UIDBuffer:ByteArray = new ByteArray();       // static ByteArray
used for UID generation to save memory allocation cost
 
     //--------------------------------------------------------------------------
@@ -83,6 +87,7 @@ public class UIDUtil
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
+	COMPILE::AS3
     private static var uidDictionary:Dictionary = new Dictionary(true);
 
     //--------------------------------------------------------------------------
@@ -111,11 +116,13 @@ public class UIDUtil
      */
 	public static function createUID():String
     {
+		var i:int;
+		var j:int;
+		
+		COMPILE::AS3
+		{
         UIDBuffer.position = 0;
 
-        var i:int;
-        var j:int;
-
         for (i = 0; i < 8; i++)
         {
             UIDBuffer.writeByte(ALPHA_CHAR_CODES[int(Math.random() * 16)]);
@@ -145,6 +152,40 @@ public class UIDUtil
         }
 
         return UIDBuffer.toString();
+		}
+		COMPILE::JS
+		{
+			var s:String = "";
+			for (i = 0; i < 8; i++)
+			{
+				s += ALPHA_CHAR_CODES[int(Math.random() * 16)];
+			}
+			
+			for (i = 0; i < 3; i++)
+			{
+				s += DASH;
+				for (j = 0; j < 4; j++)
+				{
+					s += ALPHA_CHAR_CODES[int(Math.random() * 16)];
+				}
+			}
+			
+			s += DASH;
+			
+			var time:uint = new Date().getTime(); // extract last 8 digits
+			var timeString:String = time.toString(16).toUpperCase();
+			// 0xFFFFFFFF milliseconds ~= 3 days, so timeString may have between 1 and 8 digits, hence
we need to pad with 0s to 8 digits
+			for (i = 8; i > timeString.length; i--)
+				s += "0";
+			s += timeString;
+			
+			for (i = 0; i < 4; i++)
+			{
+				s += ALPHA_CHAR_CODES[int(Math.random() * 16)];
+			}
+			
+			return s;
+		}
     }
 
     /**
@@ -162,6 +203,7 @@ public class UIDUtil
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
+	COMPILE::AS3
     public static function fromByteArray(ba:ByteArray):String
     {
         if (ba != null && ba.length >= 16 && ba.bytesAvailable >= 16)
@@ -242,6 +284,7 @@ public class UIDUtil
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
+	COMPILE::AS3
     public static function toByteArray(uid:String):ByteArray
     {
         if (isUID(uid))
@@ -317,6 +360,8 @@ public class UIDUtil
         {
             try
             {
+				COMPILE::AS3
+				{
                 // We don't create uids for XMLLists, but if
                 // there's only a single XML node, we'll extract it.
                 if (item is XMLList && item.length == 1)
@@ -337,17 +382,14 @@ public class UIDUtil
                     if (nodeKind == "text" || nodeKind == "attribute")
                         return xitem.toString();
 
-                    COMPILE::AS3
+                    var notificationFunction:Function = xitem.notification();
+                    if (!(notificationFunction is Function))
                     {
-                        var notificationFunction:Function = xitem.notification();
-                        if (!(notificationFunction is Function))
-                        {
-                            // The xml node hasn't already been initialized
-                            // for notification, so do so now.
-                            notificationFunction =
-                                XMLNotifier.initializeXMLForNotification(); 
-                            xitem.setNotification(notificationFunction);
-                        }
+                        // The xml node hasn't already been initialized
+                        // for notification, so do so now.
+                        notificationFunction =
+                            XMLNotifier.initializeXMLForNotification(); 
+                        xitem.setNotification(notificationFunction);
                     }
                     
                     // Generate a new uid for the node if necessary.
@@ -379,6 +421,17 @@ public class UIDUtil
                         }
                     }
                 }
+				}
+				COMPILE::JS
+				{
+					if ("mx_internal_uid" in item)
+						return item.mx_internal_uid;
+					
+					if ("uid" in item)
+						return item.uid;
+					
+					item["mx_internal_uid"] = result = createUID();
+				}
             }
             catch(e:Error)
             {
@@ -416,7 +469,14 @@ public class UIDUtil
             case "f":
                 return 15;
             default:
+				COMPILE::AS3
+				{
                 return new uint(hex);
+				}
+				COMPILE::JS
+				{
+				return parseInt(hex, 16);
+				}
         }    
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b173bdce/frameworks/projects/MX/src/main/resources/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/resources/compile-config.xml b/frameworks/projects/MX/src/main/resources/compile-config.xml
index 57a36d3..ddd4086 100644
--- a/frameworks/projects/MX/src/main/resources/compile-config.xml
+++ b/frameworks/projects/MX/src/main/resources/compile-config.xml
@@ -22,6 +22,12 @@
         <accessible>false</accessible>
         
         <external-library-path>
+            <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
+            <path-element>../../../../../libs/Binding.swc</path-element>
+            <path-element>../../../../../libs/Core.swc</path-element>
+            <path-element>../../../../../libs/Graphics.swc</path-element>
+            <path-element>../../../../../libs/Collections.swc</path-element>
+            <path-element>../../../../../libs/Reflection.swc</path-element>
         </external-library-path>
         
 		<mxml>
@@ -41,16 +47,6 @@
 	  
         <locale/>
         
-        <library-path>
-            <!-- asjscompc won't 'link' these classes in, but will list their requires
-                 if these swcs are on the external-library-path then their requires
-                 will not be listed -->
-            <path-element>../../../../../externs/Binding.swc</path-element>
-            <path-element>../../../../../externs/Core.swc</path-element>
-            <path-element>../../../../../externs/Graphics.swc</path-element>
-            <path-element>../../../../../externs/Collections.swc</path-element>
-        </library-path>
-        
         <namespaces>
             <namespace>
                 <uri>library://ns.apache.org/flexjs/mx</uri>


Mime
View raw message