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:34:30 UTC

svn commit: r954054 - /commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js

Author: jbeard
Date: Sat Jun 12 19:34:30 2010
New Revision: 954054

URL: http://svn.apache.org/viewvc?rev=954054&view=rev
Log:
Did some work on SCXMLCompiler to decouple it from associated templates.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js

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=954054&r1=954053&r2=954054&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:34:30 2010
@@ -117,6 +117,17 @@ require.def("src/scxml/cgf/SCXMLCompiler
 			return [enterpath,exitpath,LCA];
 		}
 
+		//private and not changable by subclasses
+		function computeDepth(state){
+			var depthToReturn = 0;
+			var currentNode = state;
+			while(currentNode = currentNode.parent()){
+				depthToReturn++;
+			}
+			return depthToReturn;
+		}
+
+
 		/*
 		    supported options:
 				backend	{switch | table | state}
@@ -279,7 +290,36 @@ require.def("src/scxml/cgf/SCXMLCompiler
 				});
 
 
-				//we do lazy loading here. I mean, why not?
+				util.foreach(scxmlRoot.descendants("if"),function(ifNode){
+					var toReturn = "";
+
+					var ifNodeChildren = ifNode.*;
+					
+					ifNode.msdl::executableContent = "";
+					var currentPartition = ifNode.msdl::executableContent;
+
+					debugger;
+					util.foreach(ifNodeChildren,function(node){
+						if(node.localName() == "elseif" || 
+							node.localName() == "else"){
+							node.msdl::executableContent = "";
+							currentPartition = node.msdl::executableContent;
+						}else{
+							currentPartition.appendChild(node.copy());
+						}
+					});
+				});
+
+				/*
+				util.foreach(conf.allStates,function(s){
+					s.@msdl::depth = computeDepth(s);				
+				});
+				*/
+
+				print(scxmlRoot);
+
+
+				/*
 				var generatorConstructor;
 				switch(options.backend){
 					case "switch":
@@ -309,6 +349,7 @@ require.def("src/scxml/cgf/SCXMLCompiler
 
 				//return generated statechart as a string
 				return sc;
+				*/
 			});
 			
 			if(toReturn.length == 1){