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/19 07:56:45 UTC

svn commit: r956187 - in /commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie: lib/js/requirejs/require/xml.js src/javascript/scxml/cgf/SCXMLCompiler.js src/javascript/scxml/cgf/main.js

Author: jbeard
Date: Sat Jun 19 05:56:45 2010
New Revision: 956187

URL: http://svn.apache.org/viewvc?rev=956187&view=rev
Log:
Intermediate commit. Rhino still not yet working.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/lib/js/requirejs/require/xml.js
    commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/src/javascript/scxml/cgf/SCXMLCompiler.js
    commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/src/javascript/scxml/cgf/main.js

Modified: commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/lib/js/requirejs/require/xml.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/lib/js/requirejs/require/xml.js?rev=956187&r1=956186&r2=956187&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/lib/js/requirejs/require/xml.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/lib/js/requirejs/require/xml.js Sat Jun 19 05:56:45 2010
@@ -64,9 +64,9 @@
         };
     }
 
-    if (!require.fetchText) {
+    if (!require.fetchXML) {
 	if(require.isBrowser){
-		require.fetchText = function (url, callback) {
+		require.fetchXML = function (url, callback) {
 		    var xhr = require.getXhr();
 		    xhr.open('GET', url, true);
 		    xhr.onreadystatechange = function (evt) {
@@ -83,7 +83,7 @@
 		var File = java.io.File;
 		var DocumentBuilderFactory = javax.xml.parsers.DocumentBuilderFactory;
 
-		require.fetchText = function (url, callback) {
+		require.fetchXML = function (url, callback) {
 
 			var file = new File(url);
 			var dbf = DocumentBuilderFactory.newInstance();
@@ -175,7 +175,7 @@
                 //Load the text.
                 url = require.nameToUrl(modName, "." + ext, contextName);
                 context.loaded[name] = false;
-                require.fetchText(url, function (text) {
+                require.fetchXML(url, function (text) {
                     context.text[key] = text;
                     context.loaded[name] = true;
                     require.checkLoaded(contextName);                    

Modified: commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/src/javascript/scxml/cgf/SCXMLCompiler.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/src/javascript/scxml/cgf/SCXMLCompiler.js?rev=956187&r1=956186&r2=956187&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/src/javascript/scxml/cgf/SCXMLCompiler.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/src/javascript/scxml/cgf/SCXMLCompiler.js Sat Jun 19 05:56:45 2010
@@ -32,7 +32,7 @@ require.def("src/javascript/scxml/cgf/SC
 		"src/javascript/scxml/cgf/backends/js/StatePatternStatechartGenerator",
 		"src/javascript/scxml/cgf/Transformer",
 		"src/javascript/scxml/cgf/util/base",
-		"/lib/js/beautify.js"],
+		"lib/js/beautify.js"],
 	
 	function(
 		StatePatternStatechartGenerator,
@@ -61,6 +61,7 @@ require.def("src/javascript/scxml/cgf/SC
 				}
 
 				var ir = Transformer(xmlFile,StatePatternStatechartGenerator.transformations,null,"xml");
+debugger;
 				var transformedJs = Transformer(ir,StatePatternStatechartGenerator.code,options,"text");
 
 				//optionally beautify it

Modified: commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/src/javascript/scxml/cgf/main.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/src/javascript/scxml/cgf/main.js?rev=956187&r1=956186&r2=956187&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/src/javascript/scxml/cgf/main.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/browser-tests.1.ie/src/javascript/scxml/cgf/main.js Sat Jun 19 05:56:45 2010
@@ -38,6 +38,14 @@ require.def("src/javascript/scxml/cgf/ma
 		"src/javascript/scxml/cgf/util/commandLine"],
 	function(SCXMLCompiler,cmdLineUtil){
 
+		function parseXMLFromPath(path){
+			var file = new java.io.File(path);
+			var dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
+			var db = dbf.newDocumentBuilder();
+			var doc = db.parse(file);
+			return doc;
+		}
+
 		return function(args){
 
 			var optionsMap = {
@@ -53,9 +61,10 @@ require.def("src/javascript/scxml/cgf/ma
 			}
 
 			var parsedOptionsMap = cmdLineUtil.parseCommandLine(optionsMap,args);
-			parsedOptionsMap.inFiles = parsedOptionsMap.args;
+			parsedOptionsMap.inFiles = parsedOptionsMap.args.map(parseXMLFromPath);
 			delete parsedOptionsMap.args;
 
+			//TODO: parse paths in inFiles into documents
 			var scArr = SCXMLCompiler.compile(parsedOptionsMap);
 
 			if(parsedOptionsMap.inFiles.length > 1){