commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r954062 - in /commons/sandbox/gsoc/2010/scxml-js/trunk: build.js src/scxml/cgf/SCXMLCompiler.js src/scxml/cgf/main.js test/testHelpers.js test/xslt/AbstractStatechartGenerator.xsl
Date Sat, 12 Jun 2010 19:35:27 GMT
Author: jbeard
Date: Sat Jun 12 19:35:27 2010
New Revision: 954062

URL: http://svn.apache.org/viewvc?rev=954062&view=rev
Log:
Intermediate check-in. Need to fix some stuff involving computing LCA.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/build.js
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/main.js
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/testHelpers.js
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/build.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/build.js?rev=954062&r1=954061&r2=954062&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/build.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/build.js Sat Jun 12 19:35:27 2010
@@ -54,8 +54,8 @@ require.def("build",
 			//enums
 			//we keep backward links of these
 			var backends = {
-				"switch" : true,
-				"table" : true,
+				//"switch" : true,
+				//"table" : true,
 				"state" : true
 			}
 
@@ -64,15 +64,15 @@ require.def("build",
 				"Safari" : { host:"localhost", port:4444, browser:"*safari" , ie: false},
 				//FIXME: selenium is unhappy with opera
 				//"Opera" : { host:"localhost", port:4444, browser:"*opera" , ie: false},
-				"IE" : { host:"localhost", port:4444, browser:"*iexplore", ie:true },
+				//"IE" : { host:"localhost", port:4444, browser:"*iexplore", ie:true },
 				"Chrome" : { host:"localhost", port:4444, browser:"*googlechrome", ie:false }
 			}
 
 			//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"
+				//KitchenSink_performance :"test/kitchen_sink/KitchenSink_performance.xml",
+				//KitchenSink_executableContent :"test/kitchen_sink/KitchenSink_executableContent.xml"
 			}
 
 
@@ -89,10 +89,12 @@ require.def("build",
 					path : "test/kitchen_sink/scripts/unitTest.js",
 					scxmlTest : scxmlTests.KitchenSink		//back-link
 				},
+				/*
 				{ 
 					path : "test/kitchen_sink/scripts/unitTest_executableContent.js",
 					scxmlTest : scxmlTests.KitchenSink_executableContent		//back-link
 				}
+				*/
 				
 			]
 

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js?rev=954062&r1=954061&r2=954062&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js Sat Jun 12 19:35:27
2010
@@ -148,8 +148,7 @@ require.def("src/scxml/cgf/SCXMLCompiler
 			var toReturn = options.inFiles.map(function(xmlFile){
 
 				if(options.ie){
-					options.noForEach = options.noIndexOf = true;
-					options.noMap = true;
+					options.noMap = options.noForEach = options.noIndexOf = true;
 				}
 
 				var scxmlRoot = parseSCXML(readFile(xmlFile));
@@ -312,9 +311,13 @@ require.def("src/scxml/cgf/SCXMLCompiler
 				});
 
 
-				util.foreach(scxmlRoot..state,function(state){
-					state.@msdl::isParallelSubstate = conf.parallelRegions..*.contains(state);
-					state.@msdl::isBasic = conf.basicStates.contains(state);
+				util.foreach(conf.allStates,function(state){
+					if(conf.parallelRegions..*.contains(state)){
+						state.@msdl::isParallelSubstate = true;
+					};
+					if(conf.basicStates.contains(state)){
+						state.@msdl::isBasic = true;
+					};
 				});
 
 				util.foreach(scxmlRoot..transition,function(transition){
@@ -326,14 +329,20 @@ require.def("src/scxml/cgf/SCXMLCompiler
 
 					//we use these funky-looking variables to avoid namespace collisions in the below query
 					var $s = sourceState, $t = transitionTarget;
-					transition.@doesNotExitParallelRegion = conf.parallelRegions.( 
-								descendants($s.localName()).contains($s) &&
-									descendants($t.localName()).contains($t)).length();
+					if(conf.parallelRegions.( 
+						descendants($s.localName()).contains($s) &&
+							descendants($t.localName()).contains($t)).length()){ 
+
+						transition.@msdl::doesNotExitParallelRegion = true;
+					}
+					
 
 					//set whether he is preempted
-					transition.@isPreempted = 
-						conf.parallelsAndDescendantStates.contains(sourceState) && 
-							!conf.parallelsAndDescendantStates.contains(transitionTarget);
+					if(conf.parallelsAndDescendantStates.contains(sourceState) && 
+						!conf.parallelsAndDescendantStates.contains(transitionTarget)){
+
+						transition.@msdl::isPreempted = true;
+					}
 
 				});
 				
@@ -355,6 +364,14 @@ require.def("src/scxml/cgf/SCXMLCompiler
 
 				var tFactory = TransformerFactory.newInstance();
 				var transformer = tFactory.newTransformer(new StreamSource("./test/xslt/StatePatternStatechartGenerator.xsl"));
+			
+				//set parameters
+				/*
+				for(var paramName in conf){
+					transformer.setParameter(paramName,conf[paramName]);
+				}
+				*/
+
 				transformer.transform(new StreamSource("build/tmp.xml"), new StreamResult(outWriter));
 				var transformedJs = outWriter.toString();
 

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/main.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/main.js?rev=954062&r1=954061&r2=954062&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/main.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/main.js Sat Jun 12 19:35:27 2010
@@ -46,6 +46,7 @@ require.def("src/scxml/cgf/main",
 				noForEach : true,
 				noIndexOf : true,
 				noMap : true,
+				noForEach :true,
 				beautify : true,
 				log : true,
 				verbose :  true

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testHelpers.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/testHelpers.js?rev=954062&r1=954061&r2=954062&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/testHelpers.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/testHelpers.js Sat Jun 12 19:35:27 2010
@@ -23,5 +23,9 @@ setwiseEqual = function(A,B){
 		return dojo.some(B,function(b){
 			return a==b;
 		});
+	}) && dojo.every(B,function(b){
+		return dojo.some(A,function(a){
+			return a==b;
+		});
 	});
 }

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl?rev=954062&r1=954061&r2=954062&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl Sat
Jun 12 19:35:27 2010
@@ -6,8 +6,9 @@
 	<output method="text"/>
 
 	<param name="log" select="true()"/>
-	<param name="noIndexOf" select="true()"/>
-	<param name="noMap" select="true()"/>
+	<param name="noIndexOf" select="false()"/>
+	<param name="noMap" select="false()"/>
+	<param name="noForEach" select="false()"/>
 	<param name="name"/>
 
 	<!-- these params get overridden by subclasses -->
@@ -47,6 +48,10 @@
 			<call-template name="genNoMapArrayPrototypeExtension"/>
 		</if>
 
+		<if test="$noForEach">
+			<call-template name="genNoForEachArrayPrototypeExtension"/>
+		</if>
+
 		function <value-of select="$name"/>StatechartExecutionContext(){
 
 				var self = this;	//used in the rare occasions we call public functions from inside this
class
@@ -163,7 +168,7 @@
 
 				this.enterAction = function(){
 					<if test="$log">
-						console.log("entering ' + <value-of select="$stateName"/> + '");
+						console.log("entering <value-of select="$stateName"/>");
 					</if>
 
 					<for-each select="$state/onentry/*">
@@ -173,7 +178,7 @@
 
 				this.exitAction = function(){
 					<if test="$log">
-						console.log("exiting ' + <value-of select="$stateName"/> + '");
+						console.log("exiting <value-of select="$stateName"/>" );
 					</if>
 
 					<if test="historyState">
@@ -201,12 +206,11 @@
 	<template name="genStatesEnum">
 		<param name="states"/>
 
-		this._states = {
-			<for-each select="$states">
-				<value-of select="@id"/> : <value-of select="@id"/>
-				<if test="not(position() = last())">,</if>
-			</for-each>
-		}
+		this._states = {};
+		
+		<for-each select="$states">
+			this._states.<value-of select="@id"/><text> = </text><value-of select="@id"/>;
+		</for-each>
 	</template>
 
 	<!-- executable content section-->
@@ -307,31 +311,6 @@
 	<!--TODO-->
 	</template>
 
-	<template name="genNoIndexOfArrayPrototypeExtension">
-		if(!Array.indexOf){
-			Array.prototype.indexOf = function(obj){
-				for(var i=0; i &lt; this.length; i++){
-					if(this[i]==obj){
-						return i;
-					}
-				}
-				return -1;
-			}
-		}
-	</template>
-
-	<template name="genNoMapArrayPrototypeExtension">
-		if(!Array.map){
-			Array.prototype.map = function(fn){
-				var toReturn = [];
-				for(var i=0; i &lt; this.length; i++){
-					toReturn[i]=fn(this[i]);
-				}
-				return toReturn;
-			}
-		}
-	</template>
-
 
 	<!-- abstract templates that we expect to be refined in subclasses -->
 
@@ -379,7 +358,7 @@
 
 			do{
 				//take any available default transitions
-				microstep(<value-of select="$defaultEventLiteral"/>);
+				microstep("<value-of select="$defaultEventLiteral"/>");
 
 				if(!hasTakenDefaultTransition){
 					
@@ -457,13 +436,11 @@
 
 	<variable name="genNonBasicTriggerDispatcherExitBlockInnerForEach">
 		<text>
-			{
-				do{
-					statesExited.push(state);
-				}while((state = state.parent) &amp;&amp;
-					state != lca &amp;&amp; 
-					statesExited.indexOf(state) == -1)
-			}
+			do{
+				statesExited.push(state);
+			}while((state = state.parent) &amp;&amp;
+				state != lca &amp;&amp; 
+				statesExited.indexOf(state) == -1)
 		</text>
 	</variable>
 
@@ -583,9 +560,9 @@
 
 		<choose>
 			<when test="local-name($s) = 'initial' or local-name($s) = 'history' or 
-						( $s/@isBasic and 
-							( not($s/@isParallelSubstate) or 
-								($s/@isParallelSubstate and $t/doesNotExitParallelRegion)))">
+						( $s/@c:isBasic and 
+							( not($s/@c:isParallelSubstate) or 
+								($s/@c:isParallelSubstate and $t/c:doesNotExitParallelRegion)))">
 				<for-each select="$t/c:exitpath/c:state">
 					<value-of select="."/>.exitAction();
 				</for-each>
@@ -606,8 +583,11 @@
 		</for-each>
 
 		//update configuration
+		<message>
+			<copy-of select="$s"/>
+		</message>
 		<choose>
-			<when test="$s/@isParallelSubstate and $t/doesNotExitParallelRegion">
+			<when test="$s/@c:isParallelSubstate and $t/@c:doesNotExitParallelRegion">
 				<call-template name="genParallelSubstateConfigurationSetString">
 					<with-param name="s" select="$s"/>
 					<with-param name="t" select="$t"/>
@@ -628,6 +608,42 @@
 		</if>
 	</template>
 
+	<template name="genNoForEachArrayPrototypeExtension">
+		if(!Array.forEach){
+			Array.prototype.forEach = function(fn){
+				for(var i=0; i &lt; this.length; i++){
+					fn(this[i]);
+				}
+				return undefined;
+			}
+		}
+	</template>
+
+	<template name="genNoIndexOfArrayPrototypeExtension">
+		if(!Array.indexOf){
+			Array.prototype.indexOf = function(obj){
+				for(var i=0; i &lt; this.length; i++){
+					if(this[i]==obj){
+						return i;
+					}
+				}
+				return -1;
+			}
+		}
+	</template>
+
+	<template name="genNoMapArrayPrototypeExtension">
+		if(!Array.map){
+			Array.prototype.map = function(fn){
+				var toReturn = [];
+				for(var i=0; i &lt; this.length; i++){
+					toReturn[i]=fn(this[i]);
+				}
+				return toReturn;
+			}
+		}
+	</template>
+
 
 	<template name="genContextHooks"/>
 	<template name="genStateHooks"/>



Mime
View raw message