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:40:26 UTC

svn commit: r954103 - in /commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt: AbstractEnumeratedStatechartGenerator.xsl StateTableStatechartGenerator.xsl

Author: jbeard
Date: Sat Jun 12 19:40:26 2010
New Revision: 954103

URL: http://svn.apache.org/viewvc?rev=954103&view=rev
Log:
Intermediate commit. Almost done hooking up the State Table backend.

Added:
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StateTableStatechartGenerator.xsl   (with props)
Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractEnumeratedStatechartGenerator.xsl

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractEnumeratedStatechartGenerator.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractEnumeratedStatechartGenerator.xsl?rev=954103&r1=954102&r2=954103&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractEnumeratedStatechartGenerator.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/AbstractEnumeratedStatechartGenerator.xsl Sat Jun 12 19:40:26 2010
@@ -4,6 +4,8 @@
 	xmlns:c="http://msdl.cs.mcgill.ca/"
 	version="1.0">
 
+	<import href="AbstractStatechartGenerator.xsl"/>
+
 	<param name="defaultEventLiteral" select="'$default'"/>
 	<param name="currentConfigurationExpression" 
 		select="'currentConfiguration.map(function(s){return STATE_INT_ID_TO_OBJECT_MAP[s]})'"/>
@@ -25,7 +27,7 @@
 
 		//map from states int id's to objects
 		var STATE_INT_ID_TO_OBJECT_MAP = 
-		<for-each select="$basicStates>
+		<for-each select="$basicStates">
 			<value-of select="@id"/> <if test="not(position() = last())"> , </if>
 		</for-each>;
 
@@ -85,57 +87,6 @@
 		];
 	</template>
 
-	<!-- foreach basicState in set of basic states sorted by stateNum
-		find default (eventless) transitions for that state 
-		foreach event in set of events sorted by event id
-			find transition that originates at that state and has that event -->
-	<template name="genStateTransitionTable">
-		var STATE_TRANSITION_TABLE = [ 
-
-			<for-each select="$basicStates">
-				<sort select="@c:stateNum"/>
-
-				<variable name="currentState" select="."/>
-			
-				<!-- get the default transitions for this state -->
-				<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>
-
-					<for-each select="$eventsEnum">
-						<sort select="c:id"/>	
-
-						<variable name="currentEvent" select="."/>
-					
-						<!--get the corresponding transition-->
-						<variable name="correspondingTransitions" 
-							select="$currentState/s:transition[@event = $currentEvent]"/>
-
-						<for-each select="$correspondingTransitions">
-							<!-- generate code here -->
-							<apply-templates select="s:*"/>
-						</for-each>
-											
-						<if test="not(position() = last())">
-						,
-						</if>
-					</for-each>
-				]
-				<if test="not(position() = last())">
-				,
-				</if>
-			</for-each>
-			
-	</template>
-
 	<template name="genTriggerDispatcherContext">
 		<param name="s"/>
 		<param name="t"/>

Added: 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=954103&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StateTableStatechartGenerator.xsl (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StateTableStatechartGenerator.xsl Sat Jun 12 19:40:26 2010
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" 
+	xmlns:s="http://www.w3.org/2005/07/scxml"
+	xmlns:c="http://msdl.cs.mcgill.ca/"
+	version="1.0">
+
+	<import href="AbstractEnumeratedStatechartGenerator.xsl"/>
+
+	<param name="dispatchInvocation" select="'STATE_TRANSITION_TABLE[state][e]();'"/>
+
+	<template name="genEnumeratedHooks">
+		var $nt = function(){};	//null transition
+
+		//state transition table
+		<call-template name="genStateTransitionTable"/>
+	</template>
+
+	<!-- foreach basicState in set of basic states sorted by stateNum
+		find default (eventless) transitions for that state 
+		foreach event in set of events sorted by event id
+			find transition that originates at that state and has that event -->
+
+	<template name="genStateTransitionTable">
+		var STATE_TRANSITION_TABLE = [ 
+
+			<for-each select="$basicStates">
+				<sort select="@c:stateNum"/>
+
+				<variable name="currentState" select="."/>
+			
+				<!-- get the default transitions for this state -->
+				<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>
+
+					<for-each select="$eventsEnum">
+						<sort select="c:id"/>	
+
+						<variable name="currentEvent" select="."/>
+					
+						<!--get the corresponding transition-->
+						<variable name="correspondingTransitions" 
+							select="$currentState/s:transition[@event = $currentEvent]"/>
+
+						<for-each select="$correspondingTransitions">
+							<!-- generate code here -->
+							<apply-templates select="s:*"/>
+						</for-each>
+											
+						<if test="not(position() = last())">
+						,
+						</if>
+					</for-each>
+				]
+				<if test="not(position() = last())">
+				,
+				</if>
+			</for-each>
+			
+	</template>
+
+</stylesheet>
+
+
+

Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/StateTableStatechartGenerator.xsl
------------------------------------------------------------------------------
    svn:eol-style = native