[Sciviews-commits] r526 - in pkg/svSocket: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 30 16:02:51 CET 2013


Author: phgrosjean
Date: 2013-01-30 16:02:47 +0100 (Wed, 30 Jan 2013)
New Revision: 526

Modified:
   pkg/svSocket/DESCRIPTION
   pkg/svSocket/NEWS
   pkg/svSocket/R/evalServer.R
   pkg/svSocket/man/evalServer.Rd
   pkg/svSocket/man/svSocket-package.Rd
Log:
Further rework of evalServer() and associated examples
Pointers are now changed to NULL before thay are passed as sourceable code to the client (failing to do so led to error on client side)

Modified: pkg/svSocket/DESCRIPTION
===================================================================
--- pkg/svSocket/DESCRIPTION	2013-01-27 23:13:01 UTC (rev 525)
+++ pkg/svSocket/DESCRIPTION	2013-01-30 15:02:47 UTC (rev 526)
@@ -1,7 +1,7 @@
 Package: svSocket
 Type: Package
-Version: 0.9-54
-Date: 2013-01-27
+Version: 0.9-55
+Date: 2013-01-28
 Title: SciViews GUI API - R Socket Server
 Authors at R: c(person("Philippe", "Grosjean", role = c("aut", "cre"),
   email = "phgrosjean at sciviews.org"),

Modified: pkg/svSocket/NEWS
===================================================================
--- pkg/svSocket/NEWS	2013-01-27 23:13:01 UTC (rev 525)
+++ pkg/svSocket/NEWS	2013-01-30 15:02:47 UTC (rev 526)
@@ -1,5 +1,18 @@
 = svSocket News
 
+== Changes in svSocket 0.9-55
+
+* evalServer now can pass objects that contain pointers as attributes (e.g.,
+  data.table objects), but the pointers are set to NULL on the client side (they
+  are probably meaningless there). This may result in corrupted or
+  malfunctioning objects, unless they can cope with such a situation, like
+  data.table object do.
+
+* Slightly reworked examples of ?evalServer and added a details section to
+  explain which R objects cannot be transferred between R processes through
+  evalServer().
+
+
 == Changes in svSocket 0.9-54
 
 * An example is added to ?sendSocketClients.

Modified: pkg/svSocket/R/evalServer.R
===================================================================
--- pkg/svSocket/R/evalServer.R	2013-01-27 23:13:01 UTC (rev 525)
+++ pkg/svSocket/R/evalServer.R	2013-01-30 15:02:47 UTC (rev 526)
@@ -15,7 +15,7 @@
 	readLines(con)  # Flush input stream just in case previous call failed to clean up
 	if (missing(send)) {
 		cat('..Last.value <- try(eval(parse(text = "', x,
-			'"))); .f <- file(); dump("..Last.value", file = .f); flush(.f); seek(.f, 0); cat("\\n<<<startflag>>>", readLines(.f), "<<<endflag>>>\\n", sep = "\\n"); close(.f); rm(.f, ..Last.value); flush.console()\n',
+			'"))); .f <- file(); dump("..Last.value", file = .f); flush(.f); seek(.f, 0); cat("\\n<<<startflag>>>", gsub("<pointer: [0-9a-fx]+>", "NULL", readLines(.f)), "<<<endflag>>>\\n", sep = "\\n"); close(.f); rm(.f, ..Last.value); flush.console()\n',
 			file = con, sep = "")
 		## It is important that one line only is written, so that other clients
 		## don't mix in with these lines.

Modified: pkg/svSocket/man/evalServer.Rd
===================================================================
--- pkg/svSocket/man/evalServer.Rd	2013-01-27 23:13:01 UTC (rev 525)
+++ pkg/svSocket/man/evalServer.Rd	2013-01-30 15:02:47 UTC (rev 526)
@@ -3,10 +3,9 @@
 
 \title{ Evaluate R code in a server process }
 \description{
-  This function is designed to connect two R processes together using
-  the socket server. This function allows for piloting the server R process from
-  a client R process, to evaluate R code in the server and return its results
-  to the client.
+  This function is designed to connect two R processes together using the socket
+  server. It allows for piloting the server R process from a client R process,
+  to evaluate R code in the server and return its results to the client.
 }
 
 \usage{
@@ -23,8 +22,21 @@
   The object returned by the last evaluation in the server.
 }
 
-\author{Matthew Dowle (\email{m.dowle at wintoncapital.com})}
+\details{
+  The function serializes R objects using \code{dump()} on the server, and it
+  \code{source()}s the data on the client side. It has, thus, the same
+  limitations as \code{dump}, (see \code{?dump}), and in particular,
+  environments, external pointers, weak references and objects of type \code{S4}
+  are not serializable with \code{dump()} and will raise an error, or will
+  produce unusable objects on the client side. Note also that lists or
+  attributes of accepted objects may contain external pointers or environments,
+  and thus, the whole object becomes unserializable. In that case, try to coerce
+  your object, or extract a part of it on the server side to make sure you send
+  just the part that is transferable between the two R processes.
+}
 
+\author{Matthew Dowle (\email{mdowle at mdowle.plus.com})}
+
 \seealso{ \code{\link{sendSocketClients}} }
 
 \examples{
@@ -43,20 +55,20 @@
 L
 evalServer(con, L)             # L is not an the server, hence the error
 evalServer(con, L, L)          # Send it to the server
-evalServer(con,L)              # Now it is there
+evalServer(con, L)             # Now it is there
 evalServer(con, L, L + 2)
 L
 evalServer(con, L)
 
 ## More examples
-evalServer(con,"x = 42")       # Set x
-evalServer(con,"y = 10")
+evalServer(con, "x <- 42")     # Set x
+evalServer(con, "y <- 10")     # Set y
 evalServer(con, x + y)         # Don't need quotes
 evalServer(con, "x + y")       # but you can put quotes if you like
 evalServer(con, x)             # Same as get x
 evalServer(con, "x + Y")       # Return server side-error to the client
 evalServer(con, x)             # Keep working after an error
-evalServer(con, "x = 'a'")     # Embedded quotes are OK
+evalServer(con, "x <- 'a'")    # Embedded quotes are OK
 
 ## Examples of sending data
 evalServer(con, X, -42)        # Alternative way to assign to X
@@ -82,6 +94,9 @@
 X
 Y
 Z
+
+## Stop the socket server
+stopSocketServer()
 }
 }
 

Modified: pkg/svSocket/man/svSocket-package.Rd
===================================================================
--- pkg/svSocket/man/svSocket-package.Rd	2013-01-27 23:13:01 UTC (rev 525)
+++ pkg/svSocket/man/svSocket-package.Rd	2013-01-30 15:02:47 UTC (rev 526)
@@ -37,8 +37,8 @@
   \tabular{ll}{
     Package: \tab svSocket\cr
     Type: \tab Package\cr
-    Version: \tab 0.9-54\cr
-    Date: \tab 2013-01-27\cr
+    Version: \tab 0.9-55\cr
+    Date: \tab 2013-01-28\cr
     License: \tab GPL 2 or above, at your convenience\cr
   }
   % TODO: add description of main functions here. Also add examples



More information about the Sciviews-commits mailing list