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/12 21:36:48 UTC
svn commit: r954073 - in /commons/sandbox/gsoc/2010/scxml-js/trunk:
build.bat build.sh test/xslt/AbstractStatechartGenerator.xsl
test/xslt/StatePatternStatechartGenerator.xsl test/xslt/snippets.txt
test/xslt/triggers.xsl
Author: jbeard
Date: Sat Jun 12 19:36:48 2010
New Revision: 954073
URL: http://svn.apache.org/viewvc?rev=954073&view=rev
Log:
Intermediate commit.
Modified:
commons/sandbox/gsoc/2010/scxml-js/trunk/build.bat
commons/sandbox/gsoc/2010/scxml-js/trunk/build.sh
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractStatechartGenerator.xsl
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StatePatternStatechartGenerator.xsl
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/snippets.txt
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/triggers.xsl
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/build.bat
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/build.bat?rev=954073&r1=954072&r2=954073&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/build.bat (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/build.bat Sat Jun 12 19:36:48 2010
@@ -1,2 +1 @@
-java -cp lib\java\js.jar;lib\test-java\selenium-java-client-driver.jar org.mozilla.javascript.tools.shell.Main -debug runner.js %~dp0 build %*
-
+java -cp lib\java\js.jar;lib\test-java\selenium-java-client-driver.jar;lib\java\serializer.jar;lib\java\xalan.jar;lib\java\xercesImpl.jar;lib\java\xml-apis.jar org.mozilla.javascript.tools.shell.Main -debug runner.js %~dp0 build %*
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/build.sh
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/build.sh?rev=954073&r1=954072&r2=954073&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/build.sh (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/build.sh Sat Jun 12 19:36:48 2010
@@ -1,4 +1,4 @@
#!/bin/sh
dn=`dirname $0`
abspath=`cd $dn; pwd`
-java -cp ./lib/java/js.jar:./lib/test-java/selenium-java-client-driver.jar org.mozilla.javascript.tools.shell.Main -debug runner.js $abspath build $*
+java -cp ./lib/java/js.jar:./lib/test-java/selenium-java-client-driver.jar:./lib/java/serializer.jar:./lib/java/xalan.jar:./lib/java/xercesImpl.jar:./lib/java/xml-apis.jar org.mozilla.javascript.tools.shell.Main -debug runner.js $abspath build $*
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=954073&r1=954072&r2=954073&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:36:48 2010
@@ -37,6 +37,9 @@
select="$allStates[.//*[(self::s:state or self::s:parallel or self::s:final or self::s:initial or self::s:scxml or self::s:history)]]"/>
<variable name="parallelRegions" select="$parallels/s:state"/>
+ <key name="events" match="s:transition" use="@event"/> <!-- used for generating unique list -->
+
+ <variable name="uniqueEvents" select="//s:transition[generate-id(.)=generate-id(key('events',@event)[1])]/@event"/>
<template match="/s:scxml">
@@ -59,7 +62,7 @@
//abstract state
<call-template name="genAbstractState">
- <with-param name="events" select=".//s:transition/@event"/>
+ <with-param name="events" select="$uniqueEvents"/>
</call-template>
//states
@@ -76,9 +79,9 @@
</call-template>
//trigger methods for synchronous interaction
- <for-each select="$nonDefaultTransitions">
+ <for-each select="$uniqueEvents">
<call-template name="genExternalTriggerDispatcher">
- <with-param name="t" select="."/>
+ <with-param name="event" select="."/>
</call-template>
</for-each>
@@ -202,11 +205,13 @@
<template name="genStatesEnum">
<param name="states"/>
- this._states = {};
-
- <for-each select="$states">
- this._states.<value-of select="@id"/><text> = </text><value-of select="@id"/>;
- </for-each>
+ this._states = {
+ <for-each select="$states">
+ <value-of select="@id"/> : <value-of select="@id"/>
+ <if test="not(position() = last())">,</if>
+ </for-each>
+ }
+
</template>
<!-- executable content section-->
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StatePatternStatechartGenerator.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StatePatternStatechartGenerator.xsl?rev=954073&r1=954072&r2=954073&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StatePatternStatechartGenerator.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StatePatternStatechartGenerator.xsl Sat Jun 12 19:36:48 2010
@@ -26,11 +26,11 @@
</template>
<template name="genExternalTriggerDispatcher">
- <param name="t"/>
+ <param name="event"/>
- this.<value-of select="$t/@event"/> = function(){
+ this.<value-of select="$event"/> = function(){
if(isInStableState){
- runToCompletion("<value-of select="$t/@event"/>");
+ runToCompletion("<value-of select="$event"/>");
}else{
return undefined;
}
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/snippets.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/snippets.txt?rev=954073&r1=954072&r2=954073&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/snippets.txt (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/snippets.txt Sat Jun 12 19:36:48 2010
@@ -1,75 +1,9 @@
- <for-each select=".//s:state">
- <call-template name="genState">
- <with-param name="state" select="."/>
- </call-template>
- </for-each>
+ self.stateIdMap = {};
+ //numbers the basic states
+ this maps state ids to ints
+
+ self.eventIdMap = {};
+ self.eventIdList = ["$default"];
- self.genIfNode = function(ifNode){
-
- var toReturn = "";
-
- //break him up into partitions
- var ifBlock = {
- cond : ifNode.@cond,
- statements : []
- };
- var elseIfBlocks = [];
- var elseBlock = null;
-
- var ifNodeChildren = ifNode.children();
-
- var currentPartition = ifBlock;
-
- for(var i = 0; i < ifNodeChildren.length(); i++){
- var node = ifNodeChildren[i];
-
- switch(node.localName()){
- case "elseif":
- currentPartition = {
- cond : node.@cond,
- statements : []
- };
- elseIfBlocks.push(currentPartition);
- break;
- case "else":
- currentPartition = {
- cond : node.@cond,
- statements : []
- };
- elseBlock.push(currentPartition);
- break;
- default:
- currentPartition.statements.push(node);
- }
- }
-
- function genIfBlockCode(type,block){
- return <>
- {type} ({block.cond}) {
- {block.statements.map(self.genExecutableContent).join("\n")}
- }
- </>
-
- }
-
- toReturn += genIfBlockCode("if",ifBlock);
- toReturn += elseIfBlocks.map(function(elseIfBlock){
- return genIfBlockCode("else if",elseIfBlock);
- });
- if(elseBlock){
- toReturn += genIfBlockCode("else",elseBlock);
- }
-
- return toReturn;
- }
-
- //private and not changable by subclasses
- self.computeDepth = function(state){
- var depthToReturn = 0;
- var currentNode = state;
- while(currentNode = currentNode.parent()){
- depthToReturn++;
- }
- return depthToReturn;
- }
+ s.msdl::enumId = stateName + "_id";
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/triggers.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/triggers.xsl?rev=954073&r1=954072&r2=954073&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/triggers.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/triggers.xsl Sat Jun 12 19:36:48 2010
@@ -8,13 +8,13 @@
<!--prepare to examine all names valued by surname-->
<xsl:key name="events" match="s:transition" use="@event"/>
+ <xsl:variable name="uniqueEvents" select="//s:transition[generate-id(.)=generate-id(key('events',@event)[1])]/@event"/>
+
<xsl:template match="/"> <!--root rule-->
<!--select only those name elements whose unique
generated id is equal to the generated id of the
first of the key members with the same surname-->
- <xsl:variable name="uniqueEvents" select="//s:transition[generate-id(.)=generate-id(key('events',@event)[1])]/@event"/>
-
<xsl:for-each select="$uniqueEvents">
<xsl:value-of select="."/> <!--show the grouping-->
<xsl:text> </xsl:text>