commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r954080 - in /commons/sandbox/gsoc/2010/scxml-js/trunk: src/scxml/cgf/SCXMLCompiler.js test/testScript.sh test/xslt/computeLCA.xsl
Date Sat, 12 Jun 2010 19:37:38 GMT
Author: jbeard
Date: Sat Jun 12 19:37:37 2010
New Revision: 954080

URL: http://svn.apache.org/viewvc?rev=954080&view=rev
Log:
Intermediate commit.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/computeLCA.xsl

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=954080&r1=954079&r2=954080&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:37:37
2010
@@ -231,6 +231,7 @@ require.def("src/scxml/cgf/SCXMLCompiler
 				doc.documentElement.setAttributeNS(null,"id","Root");
 
 				//normalize initial states
+				/*
 				$("//s:*[@initial]").forEach(function(n){
 					var newInitial = doc.createElementNS(scxmlNs,"initial");
 					var newTransition = doc.createElementNS(scxmlNs,"transition");
@@ -243,6 +244,7 @@ require.def("src/scxml/cgf/SCXMLCompiler
 
 					//TODO: delete attribute somehow
 				});
+				*/
 
 				/*
 				//we use both a dictionary and an array so that we can use both forEach and "in", which
makes the code pretty
@@ -284,8 +286,8 @@ require.def("src/scxml/cgf/SCXMLCompiler
 				conf.parallelRegions = conf.parallels.state;
 
 				conf.parallelsAndDescendantStates = conf.parallels + conf.parallels..*.(localName() in
stateTagsHash);
-
-
+				*/
+				/*
 				//make sure all states have id's
 				var idNum = 0;
 				util.foreach(conf.allStates.(@id.length() == 0),function(s){

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=954080&r1=954079&r2=954080&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:37:37 2010
@@ -1 +1 @@
-xsltproc xslt/normalizeInitialStates.xsl kitchen_sink/KitchenSink.xml | xsltproc xslt/generateUniqueStateIds.xsl
- | xsltproc xslt/splitTransitionTargets.xsl - | xsltproc xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl
- | xmlindent
+xsltproc xslt/normalizeInitialStates.xsl kitchen_sink/KitchenSink.xml | xsltproc xslt/generateUniqueStateIds.xsl
- | xsltproc xslt/splitTransitionTargets.xsl - | xsltproc xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl
- | xsltproc xslt/computeLCA.xsl - | xmlindent

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/computeLCA.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/computeLCA.xsl?rev=954080&r1=954079&r2=954080&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/computeLCA.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/computeLCA.xsl Sat Jun 12 19:37:37
2010
@@ -52,13 +52,27 @@
 		<xsl:param name="current"/>
 		<xsl:param name="end"/>
 
-		<xsl:variable name="parent" select="parent::$current"/>
+		<!--
+		<xsl:message>
+			<xsl:text>&#10;</xsl:text>
+			<xsl:text>Current: </xsl:text>
+			<xsl:text>&#10;</xsl:text>
+			<xsl:value-of select="$current/@id"/>
+			<xsl:text>&#10;</xsl:text>
+			<xsl:text>End: </xsl:text>
+			<xsl:text>&#10;</xsl:text>
+			<xsl:value-of select="$end/@id"/>
+			<xsl:text>&#10;</xsl:text>
+		</xsl:message>
+		-->
+
+		<xsl:variable name="parent" select="$current/parent::*"/>
 
 		<c:state>
 			<xsl:value-of select="$parent/@id"/>
 		</c:state>
 
-		<xsl:if test="not(current=end)">
+		<xsl:if test="not($current=$end)">
 			<xsl:call-template name="genStateTree">
 				<xsl:with-param name="current" select="$parent"/>
 				<xsl:with-param name="end" select="$end"/>
@@ -68,38 +82,49 @@
 
 	<xsl:template match="s:transition">
 
-		<xsl:variable name="srcState" select="parent::."/>
+		<xsl:variable name="srcState" select="parent::*"/>
+
+		<xsl:copy>
 
-		<xsl:for-each select="./c:targets/c:target">
-			<!-- get the target state -->
-			<xsl:variable name="targetId" select="text()"/>
-			<xsl:variable name="targetState" select="//*[(self::s:state or self::s:parallel or
self::s:final or self::s:initial or self::s:scxml or self::s:history) and @id = $targetId]"/>
-
-			<!-- compute the least common ancestor using the Kaysian method for intersection-->
-			<!-- http://stackoverflow.com/questions/538293/find-common-parent-using-xpath -->
-			<xsl:variable name="lca" select="$srcState/ancestor::* [count(. | $targetState/ancestor::*)
= count($targetState/ancestor::*) ] [1]" />
+			<xsl:apply-templates select="@*"/>
 
-			<!-- call recursive function to populate exit and entry paths -->
-			<xsl:copy>
+			<xsl:for-each select="./c:targets/c:target">
+				<!-- get the target state -->
+				<xsl:variable name="targetId" select="."/>
+				<xsl:variable name="targetState" select="//*[(self::s:state or self::s:parallel or
self::s:final or self::s:initial or self::s:scxml or self::s:history) and @id = $targetId]"/>
+
+				<!-- compute the least common ancestor using the Kaysian method for intersection-->
+				<!-- http://stackoverflow.com/questions/538293/find-common-parent-using-xpath -->
+				<xsl:variable name="lca" select="$srcState/ancestor::* [count(. | $targetState/ancestor::*)
= count($targetState/ancestor::*) ] [1]" />
+
+				<!--
+				<xsl:message>
+					<xsl:text>START&#10;</xsl:text>
+					<xsl:value-of select="$lca/@id"/><xsl:text>&#10;</xsl:text>
+					<xsl:text>END&#10;</xsl:text>
+				</xsl:message>
+				-->
+				<!-- call recursive function to populate exit and entry paths -->
 				<c:enterpath>
 					<xsl:call-template name="genStateTree">
 						<xsl:with-param name="current" select="$srcState"/>
 						<xsl:with-param name="end" select="$lca"/>
-					</xsl:apply-template>
+					</xsl:call-template>
 				</c:enterpath>
 				<c:exitpath>
 					<xsl:call-template name="genStateTree">
 						<xsl:with-param name="current" select="$targetState"/>
 						<xsl:with-param name="end" select="$lca"/>
-					</xsl:apply-template>
+					</xsl:call-template>
 				</c:exitpath>
 				<c:lca>
 					<xsl:value-of select="$lca/@id"/>
 				</c:lca>
-			</xsl:copy>
 
-		</xsl:for-each>
+			</xsl:for-each>
 
+			<xsl:apply-templates select="node()"/>
+		</xsl:copy>
 
 	</xsl:template>
 



Mime
View raw message