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/26 23:25:56 UTC

svn commit: r958284 - in /commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140: ./ src/xslt/backends/js/ test/in_predicate/scripts/

Author: jbeard
Date: Sat Jun 26 21:25:56 2010
New Revision: 958284

URL: http://svn.apache.org/viewvc?rev=958284&view=rev
Log:
Intermediate check-in. New test still broken. Added in In predicate internal function which I believe should work. Need to now add additional information to the runtime.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.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
    commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js

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=958284&r1=958283&r2=958284&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 Sat Jun 26 21:25:56 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
 			}
 
@@ -112,7 +112,7 @@ require.def("build",
 					"test/kitchen_sink/scripts/unitTest_executableContent",
 					"test/conditional_transition/scripts/unitTest",
 */
-					"test/in_predicate/scripts/unitTest.js"
+					"test/in_predicate/scripts/unitTest"
 			]
 
 			//gets populated at run-time

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=958284&r1=958283&r2=958284&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 Sat Jun 26 21:25:56 2010
@@ -215,6 +215,18 @@
 	<template name="genStateHooks"/>
 	<template name="genEnumeratedHooks"/>
 	<template name="genTriggerIntEnum"/>
+
+	<variable name="genInPredicateFunction">
+		function In(state){
+			state = typeof state == "string" ? self._states[state] : state;
+				
+			return state.isBasic ? 
+				currentConfiguration.indexOf(state.id) != -1 : 
+					currentConfiguration.some(function(s){
+						return s.ancestors.indexOf(state.id) != -1;
+					});
+		}
+	</variable>
 </stylesheet>
 
 

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=958284&r1=958283&r2=958284&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 Sat Jun 26 21:25:56 2010
@@ -119,6 +119,7 @@
 				//start static boilerplate code
 				<call-template name="genBoilerplateDispatchCode"/>
 
+				<value-of select="$genInPredicateFunction"/>
 			}
 
 	</template>
@@ -438,6 +439,11 @@
 			return <value-of select="$currentConfigurationExpression"/>;
 		}
 
+		//public API for In predicate
+		this.$in = function(state){
+			return In(state);
+		}
+
 		//end static boilerplate code
 	</template>
 
@@ -725,5 +731,7 @@
 	<template name="genInitialization"/>
 	<template name="genTriggerDispatcherContext"/>
 
+	<variable name="genInPredicateFunction"/>
+
 </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=958284&r1=958283&r2=958284&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 Sat Jun 26 21:25:56 2010
@@ -162,4 +162,16 @@
 		</choose>
 	</template>
 
+	<variable name="genInPredicateFunction">
+		function In(state){
+			state = typeof state == "string" ? self._states[state] : state;
+				
+			return state.isBasic ? 
+				currentConfiguration.indexOf(state) != -1 : 
+					currentConfiguration.some(function(s){
+						return s.ancestors.indexOf(state) != -1;
+					});
+		}
+	</variable>
+
 </stylesheet>

Modified: commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js?rev=958284&r1=958283&r2=958284&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js Sat Jun 26 21:25:56 2010
@@ -16,7 +16,7 @@
  */
 
 
-require.def( "test/conditional_transition/scripts/unitTest",
+require.def( "test/in_predicate/scripts/unitTest",
 {
 
 	scxmlTest : "test/in_predicate/TestInPredicate.xml",