[Rinside-commits] r146 - in pkg: inst src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 5 21:36:09 CEST 2010


Author: edd
Date: 2010-04-05 21:36:08 +0200 (Mon, 05 Apr 2010)
New Revision: 146

Modified:
   pkg/inst/ChangeLog
   pkg/src/RInside.cpp
Log:
restore Windows build by #ifdef WIN32 in set_callbacks


Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-04-01 14:04:54 UTC (rev 145)
+++ pkg/inst/ChangeLog	2010-04-05 19:36:08 UTC (rev 146)
@@ -1,11 +1,16 @@
+2010-04-05  Dirk Eddelbuettel  <edd at debian.org>
+
+	* src/RInside.cpp: Add #ifdef to Callback code to break on Windows
+
 2010-03-26  Romain Francois <romain at r-enthusiasts.com>
 
-	* src/RInside.h: the Proxy class is moved inside RInside and parseEval now
-	returns a Proxy so that the proxy class does its job implicitely
-	
-	* inst/examples/standard/rinside_sample8.cpp: simplify the example to 
-	implicit use of the Proxy class
+	* src/RInside.h: the Proxy class is moved inside RInside and
+  	  parseEval now returns a Proxy so that the proxy class does its job
+	  implicitely
 
+	* inst/examples/standard/rinside_sample8.cpp: simplify the example to
+	  implicit use of the Proxy class
+
 2010-03-25  Dirk Eddelbuettel  <edd at debian.org>
 
 	* src/RInside.h: New Proxy class with operator T() to borrow
@@ -60,21 +65,21 @@
 	* src/MemBuf.h: MemBuf simplified using std::string
 
 	* src/RInside.h: RInside gains an operator[](string) to allow
-	treating the RInside instance as a proxy to the global environment
-	so that we can do: RInside R; R["x"] = 10 ; All the actual work
-	is done by the Rcpp::Environment class
+	  treating the RInside instance as a proxy to the global environment
+	  so that we can do: RInside R; R["x"] = 10 ; All the actual work
+	  is done by the Rcpp::Environment class
 
 2010-02-04  Romain Francois <francoisromain at free.fr>
 
 	* RInside::autoloads revisited with the new Rcpp api
 
 	* RInside gains a default constructor to be used when there
-	is no command line arguments
+	  is no command line arguments
 
 2010-01-28  Romain Francois <francoisromain at free.fr>
 
 	* src/RInside.{h,cpp}: Retire assign(vector<vector<double>> )
-	because now this can be taken care of by template specialization
+	  because now this can be taken care of by template specialization
 
 	* DESCRIPTION: require Rcpp 0.7.3.6
 
@@ -90,14 +95,14 @@
 2010-01-27  Romain Francois <francoisromain at free.fr>
 
 	* src/RInside.{h,cpp}: include Rcpp.h and use the Rf_ prefixed R API
-	functions. stop using macros from Rdefines because they don't
-	work with R_NOREMAP
+	  functions. stop using macros from Rdefines because they don't
+	  work with R_NOREMAP
 
 	* src/RInside.{h,cpp}: using the new Rcpp API assign becomes
-	a template and let Rcpp::Environment.assign deal with the type
-	of the object and how to wrap it. specializations of wrap
-	for vector<vector<int>> and vector<vector<double>> are created
-	to maintain original interface.
+	  a template and let Rcpp::Environment.assign deal with the type
+	  of the object and how to wrap it. specializations of wrap
+	  for vector<vector<int>> and vector<vector<double>> are created
+	  to maintain original interface.
 
 2010-01-06  Dirk Eddelbuettel  <edd at debian.org>
 

Modified: pkg/src/RInside.cpp
===================================================================
--- pkg/src/RInside.cpp	2010-04-01 14:04:54 UTC (rev 145)
+++ pkg/src/RInside.cpp	2010-04-05 19:36:08 UTC (rev 146)
@@ -323,79 +323,83 @@
 /* callbacks */
 
 void Callbacks::Busy_( int which ){
-	R_is_busy = static_cast<bool>( which ) ;
-	Busy( R_is_busy ) ;	
+    R_is_busy = static_cast<bool>( which ) ;
+    Busy( R_is_busy ) ;	
 }
 
 int Callbacks::ReadConsole_( const char* prompt, unsigned char* buf, int len, int addtohistory ){
-	try {
-		std::string res( ReadConsole( prompt, static_cast<bool>(addtohistory) ) ) ;
+    try {
+	std::string res( ReadConsole( prompt, static_cast<bool>(addtohistory) ) ) ;
 		
-		/* At some point we need to figure out what to do if the result is
-		 * longer than "len"... For now, just truncate. */
+	/* At some point we need to figure out what to do if the result is
+	 * longer than "len"... For now, just truncate. */
 		 
-		int l = res.size() ;
-		int last = (l>len-1)?len-1:l ;
-		strncpy( (char*)buf, res.c_str(), last ) ;
-		buf[last] = 0 ;
-		return 1 ;
-	} catch( const std::exception& ex){
-		return -1 ;	
-	}
+	int l = res.size() ;
+	int last = (l>len-1)?len-1:l ;
+	strncpy( (char*)buf, res.c_str(), last ) ;
+	buf[last] = 0 ;
+	return 1 ;
+    } catch( const std::exception& ex){
+	return -1 ;	
+    }
 }
 
 
 void Callbacks::WriteConsole_( const char* buf, int len, int oType ){
-	if( len ){
-		buffer.assign( buf, buf + len - 1 ) ;
-		WriteConsole( buffer, oType) ;
-	}
+    if( len ){
+	buffer.assign( buf, buf + len - 1 ) ;
+	WriteConsole( buffer, oType) ;
+    }
 }
 
 void RInside_ShowMessage( const char* message ){
-	RInside::instance().callbacks->ShowMessage( message ) ;	
+    RInside::instance().callbacks->ShowMessage( message ) ;	
 }
 
 void RInside_WriteConsoleEx( const char* message, int len, int oType ){
-	RInside::instance().callbacks->WriteConsole_( message, len, oType ) ;		
+    RInside::instance().callbacks->WriteConsole_( message, len, oType ) ;		
 }
 
 int RInside_ReadConsole(const char *prompt, unsigned char *buf, int len, int addtohistory){
-	return RInside::instance().callbacks->ReadConsole_( prompt, buf, len, addtohistory ) ;
+    return RInside::instance().callbacks->ReadConsole_( prompt, buf, len, addtohistory ) ;
 }
 
 void RInside_ResetConsole(){
-	RInside::instance().callbacks->ResetConsole() ;
+    RInside::instance().callbacks->ResetConsole() ;
 }
 
 void RInside_FlushConsole(){                                       
-	RInside::instance().callbacks->FlushConsole() ;
+    RInside::instance().callbacks->FlushConsole() ;
 }
 
 void RInside_ClearerrConsole(){
-	RInside::instance().callbacks->CleanerrConsole() ;
+    RInside::instance().callbacks->CleanerrConsole() ;
 }
 
 void RInside_Busy( int which ){
-	RInside::instance().callbacks->Busy_(which) ;
+    RInside::instance().callbacks->Busy_(which) ;
 }
 
 void RInside::set_callbacks(Callbacks* callbacks_){
-	callbacks = callbacks_ ;
+    callbacks = callbacks_ ;
 	
-	/* short circuit the callback function pointers */
-	if( callbacks->has_ShowMessage() ){
-		ptr_R_ShowMessage = RInside_ShowMessage ;
-	}
-	if( callbacks->has_ReadConsole() ){
-		ptr_R_ReadConsole = RInside_ReadConsole;
-	}
+#ifdef WIN32
+    // do something to tell user that he doesn't get this
+#else
+
+    /* short circuit the callback function pointers */
+    if( callbacks->has_ShowMessage() ){
+	ptr_R_ShowMessage = RInside_ShowMessage ;
+    }
+    if( callbacks->has_ReadConsole() ){
+	ptr_R_ReadConsole = RInside_ReadConsole;
+    }
     if( callbacks->has_WriteConsole() ){
     	ptr_R_WriteConsoleEx = RInside_WriteConsoleEx ;
     	ptr_R_WriteConsole = NULL;
 	}
-	if( callbacks->has_ResetConsole() ){
-		ptr_R_ResetConsole = RInside_ResetConsole;
+    if( callbacks->has_ResetConsole() ){
+	ptr_R_ResetConsole = RInside_ResetConsole;
     }
     if( callbacks->has_FlushConsole() ){
     	ptr_R_FlushConsole = RInside_FlushConsole;
@@ -409,12 +413,12 @@
     
     R_Outputfile = NULL;
     R_Consolefile = NULL;    
-    
+#endif    
 }
 
 void RInside::repl(){
-	R_ReplDLLinit();
-	while( R_ReplDLLdo1() > 0 ){}
+    R_ReplDLLinit();
+    while( R_ReplDLLdo1() > 0 ) {}
 }
 
 



More information about the Rinside-commits mailing list