[Sciviews-commits] r417 - komodo/SciViews-K komodo/SciViews-K/content komodo/SciViews-K/content/js komodo/SciViews-K/defaults komodo/SciViews-K Unit pkg/SciViews pkg/SciViews/R pkg/svKomodo pkg/svKomodo/R pkg/svKomodo/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 29 20:46:40 CET 2011


Author: phgrosjean
Date: 2011-12-29 20:46:37 +0100 (Thu, 29 Dec 2011)
New Revision: 417

Added:
   komodo/SciViews-K/defaults/R reference (0.9.25).kpz
   komodo/SciViews-K/defaults/SciViews-K (0.9.25).kpz
   komodo/SciViews-K/defaults/SciViews_0.9-5.tar.gz
   komodo/SciViews-K/defaults/SciViews_0.9-5.zip
   komodo/SciViews-K/defaults/print.help_files_with_topic214.R
   komodo/SciViews-K/defaults/svKomodo_0.9-53.tar.gz
   komodo/SciViews-K/defaults/svKomodo_0.9-53.zip
   komodo/SciViews-K/defaults/svMisc_0.9-63.tar.gz
   komodo/SciViews-K/defaults/svMisc_0.9-63.zip
Removed:
   komodo/SciViews-K/defaults/R reference (0.9.20).kpz
   komodo/SciViews-K/defaults/R reference (0.9.23).kpz
   komodo/SciViews-K/defaults/SciViews-K (0.9.20).kpz
   komodo/SciViews-K/defaults/SciViews-K (0.9.23).kpz
   komodo/SciViews-K/defaults/svKomodo_0.9-52.tar.gz
   komodo/SciViews-K/defaults/svKomodo_0.9-52.zip
   komodo/SciViews-K/defaults/svMisc_0.9-62.tar.gz
   komodo/SciViews-K/defaults/svMisc_0.9-62.zip
Modified:
   komodo/SciViews-K Unit/sciviewskunit-0.7.3-ko.xpi
   komodo/SciViews-K/content/js/commands.js
   komodo/SciViews-K/content/js/pref-R.js
   komodo/SciViews-K/content/js/prefs.js
   komodo/SciViews-K/content/js/sciviews.js
   komodo/SciViews-K/content/js/socket.js
   komodo/SciViews-K/content/pref-R.xul
   komodo/SciViews-K/defaults/codetools_0.2-8.zip
   komodo/SciViews-K/defaults/ellipse_0.3-5.zip
   komodo/SciViews-K/defaults/print.help_files_with_topic210.R
   komodo/SciViews-K/defaults/print.help_files_with_topic211.R
   komodo/SciViews-K/defaults/svHttp_0.9-52.tar.gz
   komodo/SciViews-K/defaults/svHttp_0.9-52.zip
   komodo/SciViews-K/defaults/svSocket_0.9-52.tar.gz
   komodo/SciViews-K/defaults/svSocket_0.9-52.zip
   komodo/SciViews-K/defaults/svStart.R
   komodo/SciViews-K/defaults/svTools_0.9-1.tar.gz
   komodo/SciViews-K/defaults/svTools_0.9-1.zip
   komodo/SciViews-K/install.rdf
   pkg/SciViews/DESCRIPTION
   pkg/SciViews/R/character.R
   pkg/SciViews/R/file.R
   pkg/svKomodo/DESCRIPTION
   pkg/svKomodo/NEWS
   pkg/svKomodo/R/koCmd.R
   pkg/svKomodo/man/koCmd.Rd
Log:
Alternate Komodo server usinng files, plus latests updates of SciViews R packages

Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js	2011-12-15 23:41:49 UTC (rev 416)
+++ komodo/SciViews-K/content/js/commands.js	2011-12-29 19:46:37 UTC (rev 417)
@@ -141,6 +141,7 @@
 		"koType=" + clientType,
 		"koServe=" + sv.prefs.getString("sciviews.client.socket", "8888"),
 		"koPort=" + sv.prefs.getString("sciviews.server.socket", "7052"),
+		"koKotype=" + sv.prefs.getString("sciviews.server.type", "file"),
 		"koDebug=" + String(sv.socket.debug).toUpperCase(),
 		"koAppFile=" + sv.tools.file.path("binDir", "komodo" + (isWin? ".exe" : "")),
 		"OutDec=" + sv.prefs.getString("r.csv.dec", "."),

Modified: komodo/SciViews-K/content/js/pref-R.js
===================================================================
--- komodo/SciViews-K/content/js/pref-R.js	2011-12-15 23:41:49 UTC (rev 416)
+++ komodo/SciViews-K/content/js/pref-R.js	2011-12-29 19:46:37 UTC (rev 417)
@@ -123,8 +123,6 @@
 	// Get the sv object:
 	var p = parent;
 	while (p.opener && (p = p.opener) && !sv) if (p.sv) sv = p.sv;
-    //p = parent;
-	//while (p.opener && (p = p.opener) && !ko) if (p.ko) ko = p.ko;
 
 	var os = Components.classes['@activestate.com/koOs;1']
 		.getService(Components.interfaces.koIOs);
@@ -157,9 +155,9 @@
     apps = tmp;
 
     for (var i in apps)
-    menu.appendItem(apps[i].label, i, null);
+		menu.appendItem(apps[i].label, i, null);
 
-    // update cran mirror list (first local, then tries remote at CRAN)
+    // Update cran mirror list (first local, then tries remote at CRAN)
 	if (!PrefR_UpdateCranMirrors(true))
     PrefR_UpdateCranMirrors(false);
 
@@ -272,12 +270,21 @@
 
 	menuListGetValues();
 
-	// Restart socket server if running and port changed
+	// Restart socket server if running and port or channel changed
+	var serverType = document.getElementById('sciviews.server.type').value;
 	var serverPort = document.getElementById('sciviews.server.socket').value;
 	if (sv.socket.serverIsStarted &&
-		serverPort != prefset.getStringPref("sciviews.server.socket")){
+		(serverPort != prefset.getStringPref("sciviews.server.socket") ||
+		serverType != sv.serverType)) {
 		prefset.setStringPref("sciviews.server.socket", serverPort);
+		prefset.setStringPref("sciviews.server.type", serverType);
+		sv.serverType = serverType;
 		sv.socket.serverStart();
+		// TODO: change config in R (better), or warn that R must be restarted!
+	} else {
+		// Just change config
+		prefset.setStringPref("sciviews.server.socket", serverPort);
+		prefset.setStringPref("sciviews.server.type", serverType);
 	}
 	return(true);
 }
@@ -341,7 +348,7 @@
     var cmdArgs = document.getElementById("svRArgs").value;
 	var args1 = "";
 
-	if(document.getElementById("sciviews.pkgs.sciviews").checked)
+	if (document.getElementById("sciviews.pkgs.sciviews").checked)
 			args1 += " --svStartPkgs=SciViews";
 
    	var cwd = sv.tools.file.path("ProfD", "extensions",

Modified: komodo/SciViews-K/content/js/prefs.js
===================================================================
--- komodo/SciViews-K/content/js/prefs.js	2011-12-15 23:41:49 UTC (rev 416)
+++ komodo/SciViews-K/content/js/prefs.js	2011-12-29 19:46:37 UTC (rev 417)
@@ -19,6 +19,7 @@
 // sv.prefs.defaults[preferenceName] = preferenceValue
 sv.prefs.defaults = {
 	"sciviews.server.socket": "7052",
+	"sciviews.server.type": "file",
 	"sciviews.client.type": "socket",
 	"sciviews.client.socket": "8888",
 	"sciviews.client.id": "SciViewsK",

Modified: komodo/SciViews-K/content/js/sciviews.js
===================================================================
--- komodo/SciViews-K/content/js/sciviews.js	2011-12-15 23:41:49 UTC (rev 416)
+++ komodo/SciViews-K/content/js/sciviews.js	2011-12-29 19:46:37 UTC (rev 417)
@@ -53,7 +53,7 @@
 FIXME: A loose list: PhG: YES, we definitely need to rethink SciViews-K
 shortcuts, but:
 1) The FX shortcuts you propose for main R interaction function (send to R,
-   source, etc.) are not easy to remeber, and are not easy to use on a Mac. FX
+   source, etc.) are not easy to remember, and are not easy to use on a Mac. FX
    keys are NOT commonly used on a Mac, and you have to press Fn+FX in original
    keyboard config (this can be changed in the system preferences),
 2) The key combinations should work on all three platforms Windows, Linux & Mac

Modified: komodo/SciViews-K/content/js/socket.js
===================================================================
--- komodo/SciViews-K/content/js/socket.js	2011-12-15 23:41:49 UTC (rev 416)
+++ komodo/SciViews-K/content/js/socket.js	2011-12-29 19:46:37 UTC (rev 417)
@@ -22,6 +22,7 @@
 // sv.socket.rUpdate();								  	// Update R options
 //
 /////// Socket server //////
+// sv.serverType				// A global variable with 'file' or 'socket'
 // sv.socket.debug              // Debugging mode (in Command Output)
 // sv.socket.serverIsLocal      // Is the socket servicing only localhost?
 //
@@ -44,8 +45,9 @@
 //   does not help at all. (PhG: stange! It works like a charm for me on Mac)
 ////////////////////////////////////////////////////////////////////////////////
 
-// Make sure sv.clientType is defined according to current prefs
+// Make sure sv.clientType and sv.serverType are defined using current prefs
 sv.clientType = sv.prefs.getString("sciviews.client.type", "socket");
+sv.serverType = sv.prefs.getString("sciviews.server.type", "socket");
 
 // Define the 'sv.socket' namespace
 if (typeof(sv.socket) == 'undefined') sv.socket = {};
@@ -57,7 +59,7 @@
 /////// Socket client //////////////////////////////////////////////////////
 // svSocketMinVersion, partial and _converter are global variables
 // defined in svRinterpreter.js
-this.svSocketMinVersion = "0.9-50";// Min version of svSocket package required
+this.svSocketMinVersion = "0.9-52";// Min version of svSocket package required
 this.svHttpMinVersion = "0.9-52";  // Minimum version of svHttp package required
 this.partial = false;			   // Is the last command send to R partial?
 this.lastCmd = "";				   // Last command issued
@@ -497,6 +499,7 @@
 
 /////// Socket server //////////////////////////////////////////////////////
 this.debug = sv.log.isAll();	// Set to true for debugging mode
+
 this.serverIsLocal = true;		// Is the socket servicing only localhost?
 const nsITransport = Components.interfaces.nsITransport;
 
@@ -505,7 +508,11 @@
 var _outputString;				// The string with the result to send to R
 var _output = [];				// An array with outputs
 var _timeout = 250;				// Maximal ms to wait for input
+var _gDocFile = "";             // The math to the file we are looking for
+var _gDoc;                      // The file we are looking for, if in file mode
+var _gDocIntervalID = 0;        // The ID if the interval timer
 
+
 // Debug only
 this.serverSocket = _serverSocket;
 
@@ -595,94 +602,197 @@
 };
 // End of 'nsIServerSocketListener' methods
 
-// Core function for the SciViews-K socket server
+// The following function implements the file server reaction in Komodo
+this.checkFile = function ()
+{
+	try {
+		if (_gDoc.differentOnDisk()) {
+			_output = [];
+			if (_this.debug)
+				sv.log.debug("File server: " + _gDocFile + "\n");
+			_gDoc.load();
+			// Reset res file
+			sv.tools.file.write(_gDocFile + ".out", "", "UTF-8", false);
+			var cmd = _gDoc.buffer;
+			if (cmd == "") {
+				_output.push("Error: no command send!");
+			} else {
+				// Process the command
+				if (_this.debug)
+						sv.log.debug("Command send by the client:\n" + cmd);
+				// Note that cmd starts with <<<xxxxxxxx>>> where x = 0-9
+				try {
+					if (cmd.match(/^<<<[0-9]{8}>>><<<js>>>/)) {
+						eval(cmd.substring(22));
+					} else if (cmd.match(/^<<<[0-9]{8}>>><<<rjsonp>>>/)) {
+						sv.rjson.eval(cmd.substring(26));
+					} else {
+						// TODO: this is some output data... wait that R finishes
+						// Sending the output and echo it into the R Output panel
+						sv.r.print(cmd.substring(14), false, false, false);
+					}
+				} catch(e) {
+					_output.push(e.toString());
+				}		
+			}
+			if (_this.debug) sv.log.debug(_output.length ?
+				("Result:\n" + _output.join("\n")) :
+				("Nothing to return to the socket client"));
+			// And finally, return the result to the file client
+			// (append \n at the end)
+			sv.tools.file.write(_gDocFile + ".out",
+				_output.join("\n") + "\n", "UTF-8", true);
+	    }
+	} catch (e) {
+		sv.log.exception(e, "File server: checkFile()," +
+			" unmanaged error");
+	}
+}
+
+// Core function for the SciViews-K socket/file server
 // Create the _serverSocket object
 // TODO: it does not handle correctly conversion
 //       (now an UTF-8 string is returned)
 this.serverStart = function (port) {
-	if (_this.debug) sv.log.debug("Socket server: serverStart");
+	if (_this.debug) sv.log.debug("Socket/file server: serverStart");
 
-	if (_this.serverIsStarted) try {
+	try {
 		_serverSocket.close();
 	} catch(e) {
 		sv.log.exception(e, "sv.socket.serverStart() failed to close the" +
-			" socket before reopening it");
+			" socket/file before reopening it");
 	}
-	try {
-		_serverSocket = Components
-			.classes["@mozilla.org/network/server-socket;1"]
-			.createInstance(Components.interfaces.nsIServerSocket);
-		if (port) {
-			sv.prefs.setString("sciviews.server.socket", port);
-		} else {
-			port = sv.prefs.getString("sciviews.server.socket", "7052");
+	// Make sure port is OK
+	if (port) {
+		sv.prefs.setString("sciviews.server.socket", port);
+	} else {
+		port = sv.prefs.getString("sciviews.server.socket", "7052");
+	}
+	// The way the server is started depends on its type (file or socket)
+	if (sv.serverType == "file") {
+		// File name is: <tempdir>.sv<port>
+		// <tempdir> is /tmp/ everywhere, except on Windows, where it is the
+		// the default system temp dir
+		var tempdir = "/tmp/"
+		if (navigator.platform.indexOf("Win") == 0) {
+			var nsIFile = Components.interfaces.nsIFile;
+			var dirSvc = Components
+				.classes["@mozilla.org/file/directory_service;1"]
+				.getService(Components.interfaces.nsIProperties);
+			tempdir = dirSvc.get("TmpD", nsIFile).path + "\\";
 		}
+		var file = ".sv" + port
+		_gDocFile = tempdir + file; 
+		// (re)create this file
+		sv.tools.file.write(_gDocFile, "\n", "UTF-8", false);
+		var documentService = Components
+			.classes["@activestate.com/koDocumentService;1"].getService();
+		_gDoc = documentService
+			.createDocumentFromURI(ko.uriparse.localPathToURI(_gDocFile));
+		_gDoc.addReference();
+		if (!_gDoc) alert("Problem creating or accessing '" + _gDocFile + "'");
+		_gDoc.load();
+		_gDocIntervalID = window.setInterval('sv.socket.checkFile()', 500);
+		ko.statusBar.AddMessage("Listening to " + _gDocFile, "SciViews-K",
+			3000, true);
+	} else { // Must be a socket server
+		try {
+			_serverSocket = Components
+				.classes["@mozilla.org/network/server-socket;1"]
+				.createInstance(Components.interfaces.nsIServerSocket);
+			_serverSocket.init(port, _this.serverIsLocal, -1);
+			_serverSocket.asyncListen(_this);
+			this.serverSocket = _serverSocket;
+		} catch(e) {
+			//TODO: add exception type checking here (see below)
+			port = parseInt(port);
+			// PhG: do this silently!
+			//if (ko.dialogs.okCancel(
+			//	sv.translate("Cannot open a server socket to allow communication "
+			//		+ " from R to Komodo on port %S.\n" +
+			//		"Click OK to change port to %S and try again.", port, port + 1),
+			//		"OK", null, "SciViews-K") == "OK") {
+			// Avoid increasing constantly the port number!
+			if (port >= 8000) port = 7051;
+			sv.prefs.setString("sciviews.server.socket", port + 1);
+			_this.serverStart();
+			//}
+			return;
 
-		_serverSocket.init(port, _this.serverIsLocal, -1);
-		_serverSocket.asyncListen(_this);
-		this.serverSocket = _serverSocket;
-	} catch(e) {
-		//TODO: add exception type checking here (see below)
-		port = parseInt(port);
-		// PhG: do this silently!
-		//if (ko.dialogs.okCancel(
-		//	sv.translate("Cannot open a server socket to allow communication "
-		//		+ " from R to Komodo on port %S.\n" +
-		//		"Click OK to change port to %S and try again.", port, port + 1),
-		//		"OK", null, "SciViews-K") == "OK") {
-		// Avoid increasing constantly the port number!
-		if (port >= 8000) port = 7051;
-		sv.prefs.setString("sciviews.server.socket", port + 1);
-		_this.serverStart();
-		//}
-		return;
-
-		// sv.log.exception(e, "SciViews-K cannot open a server socket on port "
-		//	+ port + ".\nMake sure the port is not already used by another" +
-		//	" Komodo instance" + "\nor choose another port in the" +
-		//	" preferences and restart Komodo", false);
-		// If the port is already used, I got:
-		// "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
-		// chrome://sciviewsk/content/js/socket.js :: anonymous :: line 285
+			// sv.log.exception(e, "SciViews-K cannot open a server socket on port "
+			//	+ port + ".\nMake sure the port is not already used by another" +
+			//	" Komodo instance" + "\nor choose another port in the" +
+			//	" preferences and restart Komodo", false);
+			// If the port is already used, I got:
+			// "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
+			// chrome://sciviewsk/content/js/socket.js :: anonymous :: line 285
+		}
 	}
 	if (_this.debug)
-		sv.log.debug("serverStart: Socket server started");
+		sv.log.debug("serverStart: Socket/file server started");
 	ko.statusBar.AddMessage(
-		"SciViews-K socket server started", "SciViews-K server", 2000, true);
+		"SciViews-K socket/file server started", "SciViews-K server",
+		2000, true);
 }
 
-// Stop the SciViews-K socket server
+// Stop the SciViews-K socket/file server
 this.serverStop = function () {
-	if (_this.serverIsStarted) {
+	var isStopped = false;
+	// Try stopping the file server
+	if (_gDocIntervalID != 0) {
 		try {
-			_serverSocket.close();
+			isStopped = true;
+			window.clearInterval(_gDocIntervalID);
+			_gDocIntervalID = 0;
+			_gDoc.releaseReference();
+			ko.statusBar.AddMessage("Stop listening to " + _gDocFile,
+				"SciViews-K", 3000, true);
+		} catch (e) {
+			sv.log.exception(e, "Socket server: serverStop() cannot" +
+				" close the file", true);				
+		}	
+	}
+	// Try stopping the socket server
+	if (typeof(sv.socket.serverSocket) != "undefined") {
+		try {
+			_this.serverSocket.asyncListen(_this);
 		} catch(e) {
-			sv.log.exception(e, "Socket server: serverStop() cannot" +
-				" close the socket", true);
+			if (e.name == "NS_ERROR_IN_PROGRESS") {
+				isStopped = true;
+				try {
+					_serverSocket.close();
+				} catch(e) {
+				sv.log.exception(e, "Socket server: serverStop() cannot" +
+					" close the socket", true);
+				}
+			}
 		}
-		if (_this.debug) sv.log.debug("Socket server stopped");
+	}
+	if (!isStopped) {
 		ko.statusBar.AddMessage(
-			"SciViews-K socket server stopped", "SciViews-K server",
+			"SciViews-K socket/file server is not started", "SciViews-K server",
 			2000, true);
-	} else {
-		ko.statusBar.AddMessage(
-			"SciViews-K socket server is not started", "SciViews-K server",
-			2000, true);
 	}
 }
 
 // Is the SciViews-K socket server started?
 this.__defineGetter__ ('serverIsStarted', function () {
-	// Use brute force to find whether socketServer is initiated and listening
-	if (typeof(sv.socket.serverSocket) == "undefined") return(false);
-	try {
-		_this.serverSocket.asyncListen(_this);
-	} catch(e) {
-		if (e.name == "NS_ERROR_IN_PROGRESS") return(true);
-		else if (e.name == "NS_ERROR_NOT_INITIALIZED") return(false);
-		else sv.log.exception(e);
+	// Depends on the server type
+	if (sv.serverType == "file") {
+		// Look at _gDocIntervalID
+		return(_gDocIntervalID != 0);
+	} else { // Must be a socket server	
+		// Use brute force to find whether socketServer is initiated and listening
+		if (typeof(sv.socket.serverSocket) == "undefined") return(false);
+		try {
+			_this.serverSocket.asyncListen(_this);
+		} catch(e) {
+			if (e.name == "NS_ERROR_IN_PROGRESS") return(true);
+			else if (e.name == "NS_ERROR_NOT_INITIALIZED") return(false);
+			else sv.log.exception(e);
+		}
+		return(true);
 	}
-	return(true);
 });
 
 // What is the current SciViews-K socket server config?
@@ -691,16 +801,22 @@
 	if (_this.serverIsStarted) serverStatus = " (started)"
 	var port = sv.prefs.getString("sciviews.server.socket", "7052");
 	if (_this.serverIsLocal) {
-		return("Local socket server on port " + port + serverStatus);
+		return("Local " + sv.serverType + " server on port " +
+			port + serverStatus);
 	} else {
-		return("Global socket server on port " + port + serverStatus);
+		return("Global " + sv.serverType + " server on port " +
+			port + serverStatus);
 	}
 }
 
 // Write to the socket server, use this to return something to the client
 this.serverWrite = function (data) {
 	if (_this.serverIsStarted) {
-		_output.push(_fromUnicode(data));
+		if (sv.serverType == "file") {
+			_output.push(data);
+		} else { // This must be a socket server, and I have to translate
+			_output.push(_fromUnicode(data));
+		}
 	} else {
 		sv.alert("The socket server in unavailable",
 			"Trying to write data though the SciViews-K socket server" +

Modified: komodo/SciViews-K/content/pref-R.xul
===================================================================
--- komodo/SciViews-K/content/pref-R.xul	2011-12-15 23:41:49 UTC (rev 416)
+++ komodo/SciViews-K/content/pref-R.xul	2011-12-29 19:46:37 UTC (rev 417)
@@ -16,6 +16,7 @@
 
 	Contributor(s):
 	Philippe Grosjean
+	Kamil Barton
 	ActiveState Software Inc (code inspired from)
 
 	Alternatively, the contents of this file may be used under the terms of
@@ -134,6 +135,21 @@
 						<textbox id="sciviews.server.host" pref="true" width="150"
 						disabled="true"/>
 				</row>
+			</rows>
+		</grid>
+		<hbox align="center">
+		  <label value="Client type:" control="sciviews.server.type"/>
+		  <menulist pref="true" id="sciviews.server.type"
+		   values="file socket" persist="values">
+		   <menupopup />
+		  </menulist>
+		</hbox>		
+		<grid>
+		  <columns>
+				<column flex="1"/> <column flex="2"/> <column flex="1"/> <column
+					flex="2"/>
+			</columns>
+		  <rows>		
 				<row align="center">
 					<label value="Client port #:" control="sciviews.server.socket" />
 					<textbox id="sciviews.server.socket" pref="true" width="50" />

Deleted: komodo/SciViews-K/defaults/R reference (0.9.20).kpz
===================================================================
(Binary files differ)

Deleted: komodo/SciViews-K/defaults/R reference (0.9.23).kpz
===================================================================
(Binary files differ)

Added: komodo/SciViews-K/defaults/R reference (0.9.25).kpz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/R reference (0.9.25).kpz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Deleted: komodo/SciViews-K/defaults/SciViews-K (0.9.20).kpz
===================================================================
(Binary files differ)

Deleted: komodo/SciViews-K/defaults/SciViews-K (0.9.23).kpz
===================================================================
(Binary files differ)

Added: komodo/SciViews-K/defaults/SciViews-K (0.9.25).kpz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/SciViews-K (0.9.25).kpz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: komodo/SciViews-K/defaults/SciViews_0.9-5.tar.gz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/SciViews_0.9-5.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: komodo/SciViews-K/defaults/SciViews_0.9-5.zip
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/SciViews_0.9-5.zip
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: komodo/SciViews-K/defaults/codetools_0.2-8.zip
===================================================================
(Binary files differ)

Modified: komodo/SciViews-K/defaults/ellipse_0.3-5.zip
===================================================================
(Binary files differ)

Modified: komodo/SciViews-K/defaults/print.help_files_with_topic210.R
===================================================================
--- komodo/SciViews-K/defaults/print.help_files_with_topic210.R	2011-12-15 23:41:49 UTC (rev 416)
+++ komodo/SciViews-K/defaults/print.help_files_with_topic210.R	2011-12-29 19:46:37 UTC (rev 417)
@@ -181,4 +181,4 @@
     }
     invisible(x)
 }, envir = baseenv())
-lockBinding("print.help_files_with_topic", env = baseenv())
\ No newline at end of file
+lockBinding("print.help_files_with_topic", env = baseenv())

Modified: komodo/SciViews-K/defaults/print.help_files_with_topic211.R
===================================================================
--- komodo/SciViews-K/defaults/print.help_files_with_topic211.R	2011-12-15 23:41:49 UTC (rev 416)
+++ komodo/SciViews-K/defaults/print.help_files_with_topic211.R	2011-12-29 19:46:37 UTC (rev 417)
@@ -136,4 +136,4 @@
     }
     invisible(x)
 }, envir = baseenv())
-lockBinding("print.help_files_with_topic", env = baseenv())
\ No newline at end of file
+lockBinding("print.help_files_with_topic", env = baseenv())

Added: komodo/SciViews-K/defaults/print.help_files_with_topic214.R
===================================================================
--- komodo/SciViews-K/defaults/print.help_files_with_topic214.R	                        (rev 0)
+++ komodo/SciViews-K/defaults/print.help_files_with_topic214.R	2011-12-29 19:46:37 UTC (rev 417)
@@ -0,0 +1,143 @@
+# print method of object returned by help() is very unflexible for R.app and
+# does not allow in any way to use anything else than the R.app internal
+# browser for help!!!
+# That makes me very unhappy! Hey guys, I would like to use SciViews help
+# browser here! So, no other solution than to be even harsher, and to force
+# rewriting of the print function in base environment!!!
+# (problem emailed to Simon Urbanek on 03/11/2009... I hope he will propose
+# a work-around for this in R 2.12!!!)
+#
+unlockBinding("print.help_files_with_topic", env = baseenv())
+assign("print.help_files_with_topic",
+function (x, ...)
+{
+    browser <- getOption("browser")
+    topic <- attr(x, "topic")
+    type <- attr(x, "type")
+	# This is the problematic code!
+    #if (.Platform$GUI == "AQUA" && type == "html") {
+    #    browser <- function(x, ...) {
+    #        .Internal(aqua.custom.print("help-files", x))
+    #        return(invisible(x))
+    #    }
+    #}
+    paths <- as.character(x)
+    if (!length(paths)) {
+        writeLines(c(gettextf("No documentation for '%s' in specified packages and libraries:", 
+            sQuote(topic)), gettextf("you could try %s", sQuote(paste("??", topic, sep = "")))))
+        return(invisible(x))
+    }
+    if (type == "html") 
+        if (tools:::httpdPort == 0L) 
+            tools::startDynamicHelp()
+    if (attr(x, "tried_all_packages")) {
+        paths <- unique(dirname(dirname(paths)))
+        msg <- gettextf("Help for topic '%s' is not in any loaded package but can be found in the following packages:", 
+            sQuote(topic))
+        if (type == "html" && tools:::httpdPort > 0L) {
+            path <- file.path(tempdir(), ".R/doc/html")
+            dir.create(path, recursive = TRUE, showWarnings = FALSE)
+            out <- paste("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n", 
+                "<html><head><title>R: help</title>\n", "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=\"UTF-8\">\n", 
+                "<link rel=\"stylesheet\" type=\"text/css\" href=\"/doc/html/R.css\">\n", 
+                "</head><body>\n\n<hr>\n", sep = "")
+            out <- c(out, "<p>", msg, "</p><br>")
+            out <- c(out, "<table width=\"100%\" summary=\"R Package list\">\n", 
+                "<tr align=\"left\" valign=\"top\">\n", "<td width=\"25%\">Package</td><td>Library</td></tr>\n")
+            pkgs <- basename(paths)
+            links <- paste("<a href=\"http://127.0.0.1:", tools:::httpdPort, 
+                "/library/", pkgs, "/help/", topic, "\">", pkgs, 
+                "</a>", sep = "")
+            out <- c(out, paste("<tr align=\"left\" valign=\"top\">\n", 
+                "<td>", links, "</td><td>", dirname(paths), "</td></tr>\n", 
+                sep = ""))
+            out <- c(out, "</table>\n</p>\n<hr>\n</body></html>")
+            writeLines(out, file.path(path, "all.available.html"))
+            browseURL(paste("http://127.0.0.1:", tools:::httpdPort, 
+                "/doc/html/all.available.html", sep = ""), browser)
+        }
+        else {
+            writeLines(c(strwrap(msg), "", paste(" ", formatDL(c(gettext("Package"), 
+                basename(paths)), c(gettext("Library"), dirname(paths)), 
+                indent = 22))))
+        }
+    }
+    else {
+        if (length(paths) > 1L) {
+            if (type == "html" && tools:::httpdPort > 0L) {
+                browseURL(paste("http://127.0.0.1:", tools:::httpdPort, 
+                  "/library/NULL/help/", topic, sep = ""), browser)
+                return(invisible(x))
+            }
+            file <- paths[1L]
+            p <- paths
+            msg <- gettextf("Help on topic '%s' was found in the following packages:", 
+                sQuote(topic))
+            paths <- dirname(dirname(paths))
+            txt <- formatDL(c("Package", basename(paths)), c("Library", 
+                dirname(paths)), indent = 22L)
+            writeLines(c(strwrap(msg), "", paste(" ", txt), ""))
+            if (interactive()) {
+                fp <- file.path(paths, "Meta", "Rd.rds")
+                tp <- basename(p)
+                titles <- tp
+                if (type == "html" || type == "latex") 
+                  tp <- tools::file_path_sans_ext(tp)
+                for (i in seq_along(fp)) {
+                  tmp <- try(.readRDS(fp[i]))
+                  titles[i] <- if (inherits(tmp, "try-error")) 
+                    "unknown title"
+                  else tmp[tools::file_path_sans_ext(tmp$File) == 
+                    tp[i], "Title"]
+                }
+                txt <- paste(titles, " {", basename(paths), "}", 
+                  sep = "")
+                res <- menu(txt, title = gettext("Choose one"), 
+                  graphics = getOption("menu.graphics"))
+                if (res > 0) 
+                  file <- p[res]
+            }
+            else {
+                writeLines(gettext("\nUsing the first match ..."))
+            }
+        }
+        else file <- paths
+        if (type == "html") {
+            if (tools:::httpdPort > 0L) {
+                path <- dirname(file)
+                dirpath <- dirname(path)
+                pkgname <- basename(dirpath)
+                browseURL(paste("http://127.0.0.1:", tools:::httpdPort, 
+                  "/library/", pkgname, "/html/", basename(file), 
+                  ".html", sep = ""), browser)
+            }
+            else {
+                warning("HTML help is unavailable", call. = FALSE)
+                att <- attributes(x)
+                xx <- sub("/html/([^/]*)\\.html$", "/help/\\1", 
+                  x)
+                attributes(xx) <- att
+                attr(xx, "type") <- "text"
+                print(xx)
+            }
+        }
+        else if (type == "text") {
+            pkgname <- basename(dirname(dirname(file)))
+            temp <- tools::Rd2txt(.getHelpFile(file), out = tempfile("Rtxt"), 
+                package = pkgname)
+            file.show(temp, title = gettextf("R Help on '%s'", 
+                topic), delete.file = TRUE)
+        }
+        else if (type %in% c("ps", "postscript", "pdf")) {
+            path <- dirname(file)
+			dirpath <- dirname(path)
+			texinputs <- file.path(dirpath, "help", "figures")
+			tf2 <- tempfile("Rlatex")
+            tools::Rd2latex(.getHelpFile(file), tf2)
+            .show_help_on_topic_offline(tf2, topic, type, texinputs)
+            unlink(tf2)
+        }
+    }
+    invisible(x)
+}, envir = baseenv())
+lockBinding("print.help_files_with_topic", env = baseenv())

Modified: komodo/SciViews-K/defaults/svHttp_0.9-52.tar.gz
===================================================================
(Binary files differ)

Modified: komodo/SciViews-K/defaults/svHttp_0.9-52.zip
===================================================================
(Binary files differ)

Deleted: komodo/SciViews-K/defaults/svKomodo_0.9-52.tar.gz
===================================================================
(Binary files differ)

Deleted: komodo/SciViews-K/defaults/svKomodo_0.9-52.zip
===================================================================
(Binary files differ)

Added: komodo/SciViews-K/defaults/svKomodo_0.9-53.tar.gz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/svKomodo_0.9-53.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: komodo/SciViews-K/defaults/svKomodo_0.9-53.zip
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/svKomodo_0.9-53.zip
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Deleted: komodo/SciViews-K/defaults/svMisc_0.9-62.tar.gz
===================================================================
(Binary files differ)

Deleted: komodo/SciViews-K/defaults/svMisc_0.9-62.zip
===================================================================
(Binary files differ)

Added: komodo/SciViews-K/defaults/svMisc_0.9-63.tar.gz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/svMisc_0.9-63.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: komodo/SciViews-K/defaults/svMisc_0.9-63.zip
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/svMisc_0.9-63.zip
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: komodo/SciViews-K/defaults/svSocket_0.9-52.tar.gz
===================================================================
(Binary files differ)

Modified: komodo/SciViews-K/defaults/svSocket_0.9-52.zip
===================================================================
(Binary files differ)

Modified: komodo/SciViews-K/defaults/svStart.R
===================================================================
--- komodo/SciViews-K/defaults/svStart.R	2011-12-15 23:41:49 UTC (rev 416)
+++ komodo/SciViews-K/defaults/svStart.R	2011-12-29 19:46:37 UTC (rev 417)
@@ -5,6 +5,7 @@
 ## Version 0.9.19, 2010-10-03 mod by Ph. Grosjean
 ## Version 0.9.20, 2010-11-10 mod by K. Barton
 ## Version 0.9.23, 2011-08-05 mod by Ph. Grosjean
+## Version 0.9.25, 2011-12-28 mod by Ph. Grosjean
 
 ## TODO: also use value in koDebug to debug server from within R!
 ## TODO: use the mechanism of startHttpServer() to retrieve default config
@@ -14,6 +15,9 @@
 ## that way, one should be able to reconfigure R for SciViews communication
 ## just by loading the svKomodo package... but without rechecking if
 ## required packages are installed, versions, etc...
+## TODO: I have now a work-around with print.help_files_with_topic but still
+## help(package = ....) gets to the R.app help => I also need a workaround
+## there!
 
 "svStart" <-
 function (minRVersion = "2.11.1", minVersion = NA,
@@ -164,6 +168,8 @@
 		svOption("ko.port", default = 7052, args = args, as.type = as.integer)
 		## The id used by Komodo
 		svOption("ko.id", default = "SciViewsK", args = args)
+		## Which type of Komodo server do we use?
+		svOption("ko.kotype", default = "file", args = args)
 		## Do we reactivate Komodo?
 		svOption("ko.activate", default = FALSE, args = args, as.type = as.logical)
 		## The id used for this R kernel in Komodo
@@ -561,8 +567,10 @@
 ## a work-around for this in R 2.12!!!)
 if (compareVersion(rVersion, "2.11.0") < 0) {
 	source("print.help_files_with_topic210.R")
+} else if (compareVersion(rVersion, "2.14.0") < 0) {
+	source("print.help_files_with_topic211.R")
 } else {
-	source("print.help_files_with_topic211.R")
+	source("print.help_files_with_topic214.R")
 }
 
 		## Change the working directory to the provided directory

Modified: komodo/SciViews-K/defaults/svTools_0.9-1.tar.gz
===================================================================
(Binary files differ)

Modified: komodo/SciViews-K/defaults/svTools_0.9-1.zip
===================================================================
(Binary files differ)

Modified: komodo/SciViews-K/install.rdf
===================================================================
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/sciviews -r 417


More information about the Sciviews-commits mailing list