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:41:10 UTC
svn commit: r954109 - in /commons/sandbox/gsoc/2010/scxml-js/trunk/test:
testScript.sh xslt/StateTableStatechartGenerator.xsl
Author: jbeard
Date: Sat Jun 12 19:41:10 2010
New Revision: 954109
URL: http://svn.apache.org/viewvc?rev=954109&view=rev
Log:
test/xslt/StateTableStatechartGenerator.xsl generates syntactically correct code.
Modified:
commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StateTableStatechartGenerator.xsl
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh?rev=954109&r1=954108&r2=954109&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh Sat Jun 12 19:41:10 2010
@@ -9,8 +9,7 @@ xsltproc xslt/appendStateInformation.xsl
xsltproc xslt/appendBasicStateInformation.xsl - | \
xsltproc xslt/appendTransitionInformation.xsl - | \
xsltproc xslt/nameTransitions.xsl - | \
-#xsltproc xslt/flattenTransitions.xsl - | \
-#xsltproc xslt/numberStatesAndTransitions.xsl - | \
-#todo: this next one can happen earlier, and for state pattern as well.
+xsltproc xslt/flattenTransitions.xsl - | \
+xsltproc xslt/numberStatesAndTransitions.xsl - | \
xmlindent > tmp_IR.xml;
#xsltproc xslt/StatePatternStatechartGenerator.xsl tmp_IR.xml
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StateTableStatechartGenerator.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StateTableStatechartGenerator.xsl?rev=954109&r1=954108&r2=954109&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StateTableStatechartGenerator.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StateTableStatechartGenerator.xsl Sat Jun 12 19:41:10 2010
@@ -8,8 +8,10 @@
<param name="dispatchInvocation" select="'STATE_TRANSITION_TABLE[state][e]();'"/>
+ <variable name="nullTransitionFunctionName" select="'$nt'"/>
+
<template name="genEnumeratedHooks">
- var $nt = function(){}; //null transition
+ var <value-of select="$nullTransitionFunctionName"/> = function(){}; //null transition
//state transition table
<call-template name="genStateTransitionTable"/>
@@ -21,7 +23,7 @@
find transition that originates at that state and has that event -->
<template name="genStateTransitionTable">
- var STATE_TRANSITION_TABLE = [
+ <text>var STATE_TRANSITION_TABLE = [ </text>
<for-each select="$basicStates">
<sort select="@c:stateNum"/>
@@ -29,17 +31,27 @@
<variable name="currentState" select="."/>
<!-- get the default transitions for this state -->
- <variable name="defaultTransitions"
- select="s:transition[not(@event)]"/>
- [
+ <text>[</text>
+
+ <variable name="defaultTransitions" select="s:transition[not(@event)]"/>
<!-- FIXME: figure out proper comma usage -->
<!--generate stuff for default transitions-->
- <for-each select="$defaultTransitions">
- <!-- generate code here -->
- $nt
- </for-each>
+ <choose>
+ <when test="$defaultTransitions">
+ <for-each select="$defaultTransitions">
+ <value-of select="@c:tName"/>
+ </for-each>
+ </when>
+ <otherwise>
+ <value-of select="$nullTransitionFunctionName"/>
+ </otherwise>
+ </choose>
+
+ <if test="$eventsEnum">
+ <text>,</text>
+ </if>
<for-each select="$eventsEnum">
<sort select="c:id"/>
@@ -48,23 +60,35 @@
<!--get the corresponding transition-->
<variable name="correspondingTransitions"
- select="$currentState/s:transition[@event = $currentEvent]"/>
+ select="$currentState/s:transition[@event = $currentEvent/c:name]"/>
+
+ <message>
+ state: <value-of select="$currentState/@id"/>
+ event: <value-of select="$currentEvent/c:name"/>
+ transitions: <copy-of select="$correspondingTransitions"/>
+ </message>
+
+ <choose>
+ <when test="$correspondingTransitions">
+ <for-each select="$correspondingTransitions">
+ <value-of select="@c:tName"/>
+ </for-each>
+ </when>
+ <otherwise>
+ <value-of select="$nullTransitionFunctionName"/>
+ </otherwise>
+ </choose>
- <for-each select="$correspondingTransitions">
- <!-- generate code here -->
- <apply-templates select="s:*"/>
- </for-each>
-
<if test="not(position() = last())">
- ,
+ <text>,</text>
</if>
</for-each>
- ]
+ <text>]</text>
<if test="not(position() = last())">
- ,
+ <text>, </text>
</if>
</for-each>
-
+ <text>]</text>
</template>
</stylesheet>