You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jb...@apache.org on 2010/06/27 03:17:20 UTC

svn commit: r958307 - in /commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140: ./ src/javascript/scxml/cgf/ src/xslt/backends/js/

Author: jbeard
Date: Sun Jun 27 01:17:19 2010
New Revision: 958307

URL: http://svn.apache.org/viewvc?rev=958307&view=rev
Log:
Added another array prototype extension to allow it to work in IE.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.js
    commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/javascript/scxml/cgf/SCXMLCompiler.js
    commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/AbstractEnumeratedStatechartGenerator.xsl
    commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/AbstractStatechartGenerator.xsl
    commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/StatePatternStatechartGenerator.xsl

Modified: commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.js?rev=958307&r1=958306&r2=958307&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.js Sun Jun 27 01:17:19 2010
@@ -56,8 +56,8 @@ require.def("build",
 			//enums
 			//we keep backward links of these
 			var backends = {
-				//"switch" : true,
-				//"table" : true,
+				"switch" : true,
+				"table" : true,
 				"state" : true
 			}
 
@@ -73,13 +73,10 @@ require.def("build",
 
 			//paths to all of the SCXML files we want to compile
 			var scxmlTests = {
-/*
 				KitchenSink :"test/kitchen_sink/KitchenSink.xml",
 				KitchenSink_performance :"test/kitchen_sink/KitchenSink_performance.xml",
 				KitchenSink_executableContent :"test/kitchen_sink/KitchenSink_executableContent.xml",
 				ConditionalTransition :"test/conditional_transition/TestConditionalTransition.xml",
-				ConditionalTransition_executableContent :"test/conditional_transition/TestConditionalTransition_executableContent.xml",
-*/
 				InPredicate :"test/in_predicate/TestInPredicate.xml"
 			}
 
@@ -107,11 +104,9 @@ require.def("build",
 
 
 			var unitTestScripts = [
-/*
 					"test/kitchen_sink/scripts/unitTest",
 					"test/kitchen_sink/scripts/unitTest_executableContent",
 					"test/conditional_transition/scripts/unitTest",
-*/
 					"test/in_predicate/scripts/unitTest"
 			]
 

Modified: commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/javascript/scxml/cgf/SCXMLCompiler.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/javascript/scxml/cgf/SCXMLCompiler.js?rev=958307&r1=958306&r2=958307&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/javascript/scxml/cgf/SCXMLCompiler.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/javascript/scxml/cgf/SCXMLCompiler.js Sun Jun 27 01:17:19 2010
@@ -54,7 +54,7 @@ require.def("src/javascript/scxml/cgf/SC
 			if(!options.inFiles) return false;
 
 			if(options.ie){
-				options.noMap = options.noForEach = options.noIndexOf = true;
+				options.noMap = options.noForEach = options.noIndexOf = options.noSome = true;
 			}
 
 			var backendModuleToImport = 

Modified: commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/AbstractEnumeratedStatechartGenerator.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/AbstractEnumeratedStatechartGenerator.xsl?rev=958307&r1=958306&r2=958307&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/AbstractEnumeratedStatechartGenerator.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/AbstractEnumeratedStatechartGenerator.xsl Sun Jun 27 01:17:19 2010
@@ -212,6 +212,9 @@
 		<value-of select="$s/@id"/>
 	</template>
 
+	<variable name="inPredicateFunctionStateReference" select="'state.id'"/>
+	<variable name="inPredicateFunctionStateIdReference" select="'STATE_INT_ID_TO_OBJECT_MAP[s]'"/>
+
 	<template name="genStateHooks"/>
 	<template name="genEnumeratedHooks"/>
 	<template name="genTriggerIntEnum"/>

Modified: commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/AbstractStatechartGenerator.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/AbstractStatechartGenerator.xsl?rev=958307&r1=958306&r2=958307&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/AbstractStatechartGenerator.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/AbstractStatechartGenerator.xsl Sun Jun 27 01:17:19 2010
@@ -25,6 +25,7 @@
 	<param name="noIndexOf" select="false()"/>
 	<param name="noMap" select="false()"/>
 	<param name="noForEach" select="false()"/>
+	<param name="noSome" select="false()"/>
 	<param name="name"/>
 
 	<!-- these params get overridden by subclasses -->
@@ -75,6 +76,10 @@
 			<call-template name="genNoForEachArrayPrototypeExtension"/>
 		</if>
 
+		<if test="$noSome">
+			<call-template name="genNoSomeArrayPrototypeExtension"/>
+		</if>
+
 		function <value-of select="$name"/>StatechartExecutionContext(){
 
 				var self = this;	//used in the rare occasions we call public functions from inside this class
@@ -747,26 +752,40 @@
 		}
 	</template>
 
-
-	<template name="genContextHooks"/>
-	<template name="genStateHooks"/>
-	<template name="genExternalTriggerDispatcher"/>
-	<template name="genParallelSubstateConfigurationSetString"/>
-	<template name="genNonParallelSubstateConfigurationSetString"/>
-	<template name="genInitialization"/>
-	<template name="genTriggerDispatcherContext"/>
+	<template name="genNoSomeArrayPrototypeExtension">
+		if(!Array.map){
+			Array.prototype.some = function(fn){
+				for(var i=0; i &lt; this.length; i++){
+					if(fn(this[i])) return true;
+				}
+				return false;
+			}
+		}
+	</template>
 
 	<variable name="genInPredicateFunction">
 		function In(state){
 			state = typeof state == "string" ? self._states[state] : state;
 				
 			return state.isBasic ? 
-				currentConfiguration.indexOf(state) != -1 : 
+				currentConfiguration.indexOf(<value-of select="$inPredicateFunctionStateReference"/>) != -1 : 
 					currentConfiguration.some(function(s){
-						return s.ancestors.indexOf(state) != -1;
+						return <value-of select="$inPredicateFunctionStateIdReference"/>.ancestors.indexOf(state) != -1;
 					});
 		}
 	</variable>
 
+	<variable name="inPredicateFunctionStateReference"/>
+	<variable name="inPredicateFunctionStateIdReference"/>
+
+	<template name="genContextHooks"/>
+	<template name="genStateHooks"/>
+	<template name="genExternalTriggerDispatcher"/>
+	<template name="genParallelSubstateConfigurationSetString"/>
+	<template name="genNonParallelSubstateConfigurationSetString"/>
+	<template name="genInitialization"/>
+	<template name="genTriggerDispatcherContext"/>
+
+
 </stylesheet>
 

Modified: commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/StatePatternStatechartGenerator.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/StatePatternStatechartGenerator.xsl?rev=958307&r1=958306&r2=958307&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/StatePatternStatechartGenerator.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/src/xslt/backends/js/StatePatternStatechartGenerator.xsl Sun Jun 27 01:17:19 2010
@@ -162,4 +162,7 @@
 		</choose>
 	</template>
 
+	<variable name="inPredicateFunctionStateReference" select="'state'"/>
+	<variable name="inPredicateFunctionStateIdReference" select="'s'"/>
+
 </stylesheet>