[Rcpp-commits] r4266 - in pkg/RcppCNPy: . src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 21 03:08:03 CET 2013


Author: edd
Date: 2013-02-21 03:08:02 +0100 (Thu, 21 Feb 2013)
New Revision: 4266

Modified:
   pkg/RcppCNPy/ChangeLog
   pkg/RcppCNPy/src/cnpy.cpp
   pkg/RcppCNPy/src/cnpyMod.cpp
Log:
New function npyHasIntegerSupport to test if integer support was compiled in
Minor tweak on unused var to suppress warning


Modified: pkg/RcppCNPy/ChangeLog
===================================================================
--- pkg/RcppCNPy/ChangeLog	2013-02-20 12:17:57 UTC (rev 4265)
+++ pkg/RcppCNPy/ChangeLog	2013-02-21 02:08:02 UTC (rev 4266)
@@ -1,3 +1,8 @@
+2013-02-20  Dirk Eddelbuettel  <edd at debian.org>
+
+	* src/cnpyMod.cpp (npyHasIntegerSupport): New function to test if
+	integer support was compiled in, also exported via Rcpp Modules to R
+
 2013-02-19  Dirk Eddelbuettel  <edd at debian.org>
 
 	* src/cnpy.h: Define R_NO_REMAP before including Rinternals to not
@@ -4,7 +9,7 @@
 	define length(), error(), ... but rather Rf_length(), Rf_error()
 
 	* src/cnpy.cpp: Add a bogus unused variable at the never-reached end
-	of code (after an error exit) to silence the pedantic mode of g++ 
+	of code (after an error exit) to silence the pedantic mode of g++
 
 2012-07-30  Dirk Eddelbuettel  <edd at debian.org>
 

Modified: pkg/RcppCNPy/src/cnpy.cpp
===================================================================
--- pkg/RcppCNPy/src/cnpy.cpp	2013-02-20 12:17:57 UTC (rev 4265)
+++ pkg/RcppCNPy/src/cnpy.cpp	2013-02-21 02:08:02 UTC (rev 4266)
@@ -231,7 +231,9 @@
     fclose(fp);
     Rf_error("npz_load: Error! Variable name %s not found in %s!\n",varname.c_str(),fname.c_str());
     // never reached -- not satisfying -Wall -pedantic 
-    NpyArray unused;
+    cnpy::NpyArray unused;
+    unused.word_size = 0;
+    unused.data = NULL;
     return unused;
 }
 

Modified: pkg/RcppCNPy/src/cnpyMod.cpp
===================================================================
--- pkg/RcppCNPy/src/cnpyMod.cpp	2013-02-20 12:17:57 UTC (rev 4265)
+++ pkg/RcppCNPy/src/cnpyMod.cpp	2013-02-21 02:08:02 UTC (rev 4266)
@@ -154,6 +154,14 @@
     }
 }
 
+bool npyHasIntegerSupport() {
+#ifdef RCPP_HAS_LONG_LONG_TYPES
+    return true;
+#else
+    return false;
+#endif
+}
+
 RCPP_MODULE(cnpy){
 
     using namespace Rcpp;
@@ -172,4 +180,6 @@
                            Named("mode") = "w"),
              "save an R object (vector or matrix of type integer or numeric) to an npy file");
 
+    function("npyHasIntegerSupport", &npyHasIntegerSupport, 
+             "return logical value indicating whether package has integer support (which need C++11)");
 }



More information about the Rcpp-commits mailing list