commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r954125 - /commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/
Date Sat, 12 Jun 2010 19:43:45 GMT
Author: jbeard
Date: Sat Jun 12 19:43:45 2010
New Revision: 954125

URL: http://svn.apache.org/viewvc?rev=954125&view=rev
Log:
Added comments to all xsl transformations in src/xslt/ir-compiler

Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendBasicStateInformation.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendStateInformation.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendTransitionInformation.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/computeLCA.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/enumerateEvents.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/flattenTransitions.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/generateUniqueInitialStateIds.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/generateUniqueStateIds.xsl
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/nameTransitions.xsl

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendBasicStateInformation.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendBasicStateInformation.xsl?rev=954125&r1=954124&r2=954125&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendBasicStateInformation.xsl
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendBasicStateInformation.xsl
Sat Jun 12 19:43:45 2010
@@ -15,7 +15,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
-
+<!--
+This stylesheet adds attributes isBasic="true" to basic states, and
+isHistory="true" to history states.
+-->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:s="http://www.w3.org/2005/07/scxml"
 	xmlns="http://www.w3.org/2005/07/scxml"

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendStateInformation.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendStateInformation.xsl?rev=954125&r1=954124&r2=954125&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendStateInformation.xsl
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendStateInformation.xsl
Sat Jun 12 19:43:45 2010
@@ -15,6 +15,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
+<!--
+This stylesheet adds the attribute isParallelSubstate to states are direct
+descendants of children of <parallel> states.
+-->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:s="http://www.w3.org/2005/07/scxml"
 	xmlns="http://www.w3.org/2005/07/scxml"

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendTransitionInformation.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendTransitionInformation.xsl?rev=954125&r1=954124&r2=954125&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendTransitionInformation.xsl
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/appendTransitionInformation.xsl
Sat Jun 12 19:43:45 2010
@@ -15,6 +15,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
+<!--
+This stylesheet appends extra information to transitions. Specifically, it
+conditionally adds the following attributes:
+
+@exitsParallelRegion: if the souce state of a transition is inside a parallel
+region (a child of <parallel>), and the target state is outside of that region
+
+@isPreempted: if the source is a parallel state or one of his descendants, and
+the target is outside of the parallel state that most closely wraps the source
+state
+-->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:s="http://www.w3.org/2005/07/scxml"
 	xmlns="http://www.w3.org/2005/07/scxml"
@@ -29,35 +40,6 @@
 	   </xsl:copy>
 	</xsl:template>
 
-	<!--
-
-		util.foreach(scxmlRoot..transition,function(transition){
-
-			var sourceState = transition.parent();
-
-			var targetId = transition.msdl::targets.msdl::target.msdl::targetState[0].toString();
-			var transitionTarget = conf.allStates.(@id == targetId);
-
-			//we use these funky-looking variables to avoid namespace collisions in the below query
-			var $s = sourceState, $t = transitionTarget;
-			if(!conf.parallelRegions.( 
-				descendants($s.localName()).contains($s) &&
-					descendants($t.localName()).contains($t)).length()){ 
-
-				transition.@msdl::exitsParallelRegion = true;
-			}
-			
-
-			//set whether he is preempted
-			if(conf.parallelsAndDescendantStates.contains(sourceState) && 
-				!conf.parallelsAndDescendantStates.contains(transitionTarget)){
-
-				transition.@msdl::isPreempted = true;
-			}
-
-		});
-	-->
-
 	<xsl:variable name="parallels" select="//s:parallel"/>
 
 	<xsl:variable name="parallelRegions" select="$parallels/s:state"/>
@@ -73,10 +55,6 @@
 			<xsl:apply-templates select="@*"/>
 
 			<!-- get his parallel region -->
-			<!--
-			<xsl:variable name="sourceParallelRegion" select="$parallelRegions[.//*[. = $sourceState]]"/>
-			<xsl:variable name="targetParallelRegion" select="$parallelRegions[.//*[. = $targetState]]"/>
-			-->
 			<xsl:variable name="sourceParallelRegion" select="$sourceState/ancestor::s:state[parent::s:parallel][1]"/>
 			<xsl:variable name="targetParallelRegion" select="$targetState/ancestor::s:state[parent::s:parallel][1]"/>
 
@@ -92,10 +70,6 @@
 			<!-- if the source is a parallel state or one of his descendants, 
 				and the target is outside of the parallel state that most closely wraps the source state,

 				then we we say he is preempted -->
-			<!--
-			<xsl:variable name="sourceParallel" select="$parallels[descendant-or-self::*[. = $sourceState]]"/>
-			<xsl:variable name="targetParallel" select="$parallels[descendant-or-self::*[. = $targetState]]"/>
-			-->
 			<xsl:variable name="sourceParallel" select="$sourceState/ancestor-or-self::s:parallel[1]"/>
 			<xsl:variable name="targetParallel" select="$targetState/ancestor-or-self::s:parallel[1]"/>
 

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl?rev=954125&r1=954124&r2=954125&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl
Sat Jun 12 19:43:45 2010
@@ -15,6 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
+<!--
+This stylesheet changes transitions that point to non-basic states to point
+instead to the initial states.  
+
+Note that it only changes the transitions stored in our custom-namespaced
+elements, so this should still generate valid SCXML.
+-->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:s="http://www.w3.org/2005/07/scxml"
 	xmlns="http://www.w3.org/2005/07/scxml"
@@ -30,9 +37,7 @@
 	</xsl:template>
 
 	<!--
-	//change transitions that point to non-basic states to point instead to the initial states
-	//note that we only change the transitions stored in our custom-namespaced elements, so
this
-	//is still legal SCXML
+	//
 	util.foreach(conf.transitions,function(t){
 			util.foreach(t.msdl::targets.msdl::target,function(targetNode){
 				var target = conf.allStates.(@id == targetNode.msdl::targetState.text());

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/computeLCA.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/computeLCA.xsl?rev=954125&r1=954124&r2=954125&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/computeLCA.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/computeLCA.xsl Sat Jun 12
19:43:45 2010
@@ -15,6 +15,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
+
+
+<!--
+This stylesheet augments the SCXML document to add extra information to
+transitions. Specifically, this will precompute the Least Common Ancestor
+(lca), the exit path, and the entry of the transition, and add this information
+to the input document as children in the scxml-js namespace.
+-->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:s="http://www.w3.org/2005/07/scxml"
 	xmlns="http://www.w3.org/2005/07/scxml"
@@ -29,41 +37,6 @@
 	   </xsl:copy>
 	</xsl:template>
 
-	<!--
-	//augment our AST to allow easy retrieval of enter and exit states from transitions
-	util.foreach(conf.transitions,function(t){
-
-		var startnode = t.parent();
-		var exitpath, lca;
-
-		util.foreach(t.msdl::targets.msdl::target,function(targetNode){
-
-			var endnode = conf.allStates.(@id == targetNode.msdl::targetState.text());
-
-			var enterpath;
-			[enterpath, exitpath, lca] = getTransitionPath(conf.allStates,startnode,endnode);
-
-			if(enterpath){
-				enterpath.forEach(function(state){
-					targetNode.msdl::enterpath.msdl::state += state.@id;
-				});
-			}
-			
-		});
-
-		if(exitpath){
-			exitpath.forEach(function(state){
-				t.msdl::exitpath.msdl::state += state.@id;
-			});
-		}
-
-		if(lca){
-			t.msdl::lca = lca.@id;
-		}
-
-	});
-	-->
-
 	<xsl:template name="genStateTree">
 		<xsl:param name="current"/>
 		<xsl:param name="end"/>

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/enumerateEvents.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/enumerateEvents.xsl?rev=954125&r1=954124&r2=954125&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/enumerateEvents.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/enumerateEvents.xsl Sat
Jun 12 19:43:45 2010
@@ -15,6 +15,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
+<!--
+This stylesheet creates a list of unique transition events, and adds it to the
+source document under the namespaced <eventsEnum> element.
+-->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:s="http://www.w3.org/2005/07/scxml"
 	xmlns="http://www.w3.org/2005/07/scxml"
@@ -41,7 +45,7 @@
 	
 			<c:eventsEnum>
 				<!-- start with default event -->
-				<!-- FIXME: this may be a bit implementation-specfic, hence a bit evil. might be better
to separate this out -->
+				<!-- FIXME: this may be a bit specfic to the JavaScript backend, hence a bit evil.
might be better to separate this out -->
 				<c:event>
 					<c:name>
 						<xsl:value-of select="'$default'"/>

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/flattenTransitions.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/flattenTransitions.xsl?rev=954125&r1=954124&r2=954125&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/flattenTransitions.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/flattenTransitions.xsl Sat
Jun 12 19:43:45 2010
@@ -15,6 +15,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
+<!--
+This stylesheet copies transitions recursively from a composite states to their
+descendant basic states. As the scxml-js compiler respects inner-first
+transition semantics, the descendant state has priority in the case of an event
+collision. 
+-->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:s="http://www.w3.org/2005/07/scxml"
 	xmlns="http://www.w3.org/2005/07/scxml"
@@ -30,20 +36,6 @@
 	</xsl:template>
 
 	<!--
-	var origin = t.parent();
-	if(!conf.basicStates.contains(origin)){
-		//for each basic state, if the state does not have a transition with the same event, copy
the transition into him
-		util.foreach(origin..state,function(d){
-			if(conf.basicStates.contains(d) && !d.transition.@event.contains(t.@event)){
-				d.transition += t.copy();
-			}
-		});
-
-		//delete the transition off of the composite state
-		delete origin.children()[t.childIndex()];
-	}
-	-->
-	<!--
 		if the origin is non-basic
 			for each of the origin's substates
 				if the substate is nonbasic and the substate is not the origin for any transitions that
have the same event as the origin transition

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/generateUniqueInitialStateIds.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/generateUniqueInitialStateIds.xsl?rev=954125&r1=954124&r2=954125&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/generateUniqueInitialStateIds.xsl
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/generateUniqueInitialStateIds.xsl
Sat Jun 12 19:43:45 2010
@@ -15,6 +15,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
+<!--
+This generates unique ids for initial states based on the id of the parent
+state.
+-->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:s="http://www.w3.org/2005/07/scxml"
 	xmlns="http://www.w3.org/2005/07/scxml"

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/generateUniqueStateIds.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/generateUniqueStateIds.xsl?rev=954125&r1=954124&r2=954125&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/generateUniqueStateIds.xsl
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/generateUniqueStateIds.xsl
Sat Jun 12 19:43:45 2010
@@ -15,6 +15,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
+<!--
+This generates unique ids for all states without id attributes, based on their
+local-name and the XSLT generate-id function. 
+-->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:s="http://www.w3.org/2005/07/scxml"
 	xmlns="http://www.w3.org/2005/07/scxml"

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/nameTransitions.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/nameTransitions.xsl?rev=954125&r1=954124&r2=954125&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/nameTransitions.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/ir-compiler/nameTransitions.xsl Sat
Jun 12 19:43:45 2010
@@ -15,6 +15,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
+<!--
+This transform attaches an @tName attribute to each transition.  This attribute
+is based on the id of the source state and the name of the event ("$default" if
+there is no event), and so should be unique as long as there are no duplicate
+transitions with events. In practice, it is legal to have transitions
+originating from the same state, with the same event (in SCXML, priority is
+assigned based on document order), and so this is something that will need to
+be fixed in the future.  
+
+This attribute is used to generate the names of state transition functions in
+enuemrated statechart backends.
+-->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:s="http://www.w3.org/2005/07/scxml"
 	xmlns="http://www.w3.org/2005/07/scxml"



Mime
View raw message