[Rcpp-commits] r4313 - in pkg/Rcpp: . inst src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 28 15:23:13 CEST 2013


Author: edd
Date: 2013-04-28 15:23:13 +0200 (Sun, 28 Apr 2013)
New Revision: 4313

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/DESCRIPTION
   pkg/Rcpp/inst/NEWS.Rd
   pkg/Rcpp/src/api.cpp
Log:
In api.cpp, use default snprintf formatting
Added missing curly brace to NEWS.Rd
Increment minor release number


Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2013-04-28 01:58:44 UTC (rev 4312)
+++ pkg/Rcpp/ChangeLog	2013-04-28 13:23:13 UTC (rev 4313)
@@ -1,3 +1,8 @@
+2013-04-28  Dirk Eddelbuettel  <edd at debian.org>
+
+	* src/api.cpp (Rcpp): No longer use Rd_format(Real|Complex) which is
+	a very verboten R internal; formatting to string is now very bare bones
+
 2013-04-27  Dirk Eddelbuettel  <edd at debian.org>
 
 	* src/Makevars: Improved use as well as a new possible overrride of

Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION	2013-04-28 01:58:44 UTC (rev 4312)
+++ pkg/Rcpp/DESCRIPTION	2013-04-28 13:23:13 UTC (rev 4313)
@@ -1,6 +1,6 @@
 Package: Rcpp
 Title: Seamless R and C++ Integration
-Version: 0.10.3.1
+Version: 0.10.3.2
 Date: $Date$
 Author: Dirk Eddelbuettel and Romain Francois, with contributions 
  by Douglas Bates, John Chambers and JJ Allaire

Modified: pkg/Rcpp/inst/NEWS.Rd
===================================================================
--- pkg/Rcpp/inst/NEWS.Rd	2013-04-28 01:58:44 UTC (rev 4312)
+++ pkg/Rcpp/inst/NEWS.Rd	2013-04-28 13:23:13 UTC (rev 4313)
@@ -16,15 +16,16 @@
     }
     \item Changes in Rcpp sugar:
     \itemize{
-        \item New function \code{na_omit} based on the StackOverflow thread
-        http://stackoverflow.com/questions/15953768/templated-rcpp-function-to-erase-na-values
+      \item New function \code{na_omit} based on the StackOverflow thread
+      http://stackoverflow.com/questions/15953768/templated-rcpp-function-to-erase-na-values
     }
     \item Changes in Rcpp build tools:
     \itemize{
-        \item Fix (from Martyn Plummer) for solaris in handling SingleLogicalResult.     
-	\item The \code{src/Makevars} file can now optionally ovveride the
-	path for \code{/usr/bin/install_name_tool} which is used on OS X.
+      \item Fix (from Martyn Plummer) for solaris in handling SingleLogicalResult.     
+      \item The \code{src/Makevars} file can now optionally ovveride the
+      path for \code{/usr/bin/install_name_tool} which is used on OS X.
     }
+  }
 }
 
 \section{Changes in Rcpp version 0.10.3 (2013-03-23)}{

Modified: pkg/Rcpp/src/api.cpp
===================================================================
--- pkg/Rcpp/src/api.cpp	2013-04-28 01:58:44 UTC (rev 4312)
+++ pkg/Rcpp/src/api.cpp	2013-04-28 13:23:13 UTC (rev 4313)
@@ -1753,7 +1753,7 @@
 }
 
 template <> const char* coerce_to_string<REALSXP>(double x){
-    int w,d,e ;
+    //int w,d,e ;
     // cf src/main/format.c in R's sources:
     //   The return values are
     //     w : the required field width
@@ -1762,23 +1762,25 @@
     //
     //   nsmall specifies the minimum number of decimal digits in fixed format:
     //   it is 0 except when called from do_format.
-    Rf_formatReal( &x, 1, &w, &d, &e, 0 ) ;
+    //Rf_formatReal( &x, 1, &w, &d, &e, 0 ) ;
     // we are no longer allowed to use this:
     //     char* tmp = const_cast<char*>( Rf_EncodeReal(x, w, d, e, '.') );
     // so approximate it poorly as
     static char tmp[128];
-    snprintf(tmp, 127, "%*.*f", w, d, x);
+    //snprintf(tmp, 127, "%*.*f", w, d, x);
+    snprintf(tmp, 127, "%f", x); // FIXME: barebones defaults
     return dropTrailing0(tmp, '.');
 }
 
 template <> const char* coerce_to_string<CPLXSXP>(Rcomplex x){
-    int wr, dr, er, wi, di, ei;
-    Rf_formatComplex(&x, 1, &wr, &dr, &er, &wi, &di, &ei, 0);
+    //int wr, dr, er, wi, di, ei;
+    //Rf_formatComplex(&x, 1, &wr, &dr, &er, &wi, &di, &ei, 0);
     // we are no longer allowed to use this:
     //     Rf_EncodeComplex(x, wr, dr, er, wi, di, ei, '.' );
     // so approximate it poorly as
     static char tmp[128];
-    snprintf(tmp, 127, "%*.*f+%*.*fi", wr, dr, x.r, wi, di, x.i);
+    //snprintf(tmp, 127, "%*.*f+%*.*fi", wr, dr, x.r, wi, di, x.i);
+    snprintf(tmp, 127, "%*.*f+%*.*fi", x.r, x.i); // FIXEM: barebones default formatting
     return tmp;
 }
 



More information about the Rcpp-commits mailing list