[Phylobase-commits] r881 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 19 03:59:02 CET 2014


Author: francois
Date: 2014-03-19 03:58:59 +0100 (Wed, 19 Mar 2014)
New Revision: 881

Modified:
   pkg/src/GetNCL.cpp
   pkg/src/Makevars
   pkg/src/Makevars.win
Log:
upgrading code to Rcpp 0.11 standards.

Modified: pkg/src/GetNCL.cpp
===================================================================
--- pkg/src/GetNCL.cpp	2014-03-17 13:29:22 UTC (rev 880)
+++ pkg/src/GetNCL.cpp	2014-03-19 02:58:59 UTC (rev 881)
@@ -1,3 +1,5 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
+
 #include <Rcpp.h>
 #include "ncl/nxsmultiformat.h"
 
@@ -63,10 +65,9 @@
 }
 
 
-extern "C" SEXP GetNCL(SEXP params, SEXP paramsVecR) {
+//[[Rcpp::export]]
+Rcpp::List GetNCL (SEXP params, SEXP paramsVecR) {
 
-    BEGIN_RCPP
-
     Rcpp::List list(params);
     Rcpp::LogicalVector paramsVec(paramsVecR);
 
@@ -115,6 +116,7 @@
     std::string fileFormatString = list["fileFormat"];
     if (!fileFormatString.empty())
         {
+
         fileFormat = MultiFormatReader::formatNameToCode(fileFormatString);
         if (fileFormat == MultiFormatReader::UNSUPPORTED_FORMAT)
             {
@@ -125,39 +127,38 @@
 	        return res;
             }
         }
-/* 
 
-fileFormatString should be one of these: 	"nexus",
-								"dnafasta",
-								"aafasta",
-								"rnafasta",
-								"dnaphylip",
-								"rnaphylip",
-								"aaphylip",
-								"discretephylip",
-								"dnaphylipinterleaved",
-								"rnaphylipinterleaved",
-								"aaphylipinterleaved",
-								"discretephylipinterleaved",
-								"dnarelaxedphylip",
-								"rnarelaxedphylip",
-								"aarelaxedphylip",
-								"discreterelaxedphylip",
-								"dnarelaxedphylipinterleaved",
-								"rnarelaxedphylipinterleaved",
-								"aarelaxedphylipinterleaved",
-								"discreterelaxedphylipinterleaved",
-								"dnaaln",
-								"rnaaln",
-								"aaaln",
-								"phyliptree",
-								"relaxedphyliptree",
-								"nexml",
-								"dnafin",
-								"aafin",
-								"rnafin"
-							};
-							*/
+/*  fileFormatString should be one of these:
+    "nexus",
+    "dnafasta",
+    "aafasta",
+    "rnafasta",
+    "dnaphylip",
+    "rnaphylip",
+    "aaphylip",
+    "discretephylip",
+    "dnaphylipinterleaved",
+    "rnaphylipinterleaved",
+    "aaphylipinterleaved",
+    "discretephylipinterleaved",
+    "dnarelaxedphylip",
+    "rnarelaxedphylip",
+    "aarelaxedphylip",
+    "discreterelaxedphylip",
+    "dnarelaxedphylipinterleaved",
+    "rnarelaxedphylipinterleaved",
+    "aarelaxedphylipinterleaved",
+    "discreterelaxedphylipinterleaved",
+    "dnaaln",
+    "rnaaln",
+    "aaaln",
+    "phyliptree",
+    "relaxedphyliptree",
+    "nexml",
+    "dnafin",
+    "aafin",
+    "rnafin"
+    }; */
     try {
 	nexusReader.ReadFilepath(const_cast < char* > (filename.c_str()), fileFormat);  
     }
@@ -218,7 +219,8 @@
 			NxsSimpleTree simpleTree(ftd, -1, -1.0);
 			std::vector<const NxsSimpleNode *> ndVector =  simpleTree.GetPreorderTraversal();
 			unsigned internalNdIndex = nTax;
-			for (std::vector<const NxsSimpleNode *>::const_iterator ndIt = ndVector.begin(); ndIt != ndVector.end(); ++ndIt)
+			for (std::vector<const NxsSimpleNode *>::const_iterator ndIt = ndVector.begin();
+			     ndIt != ndVector.end(); ++ndIt) 
 			{
 			    NxsSimpleNode * nd = (NxsSimpleNode *) *ndIt;
 			    unsigned nodeIndex;
@@ -330,6 +332,7 @@
 						else {
 						    if (nCharStates == 1) {
 							tmpCharString += charBlock->GetState(taxon, eachChar, 0);
+			
 						    }
 						    else {
 							tmpCharString += "?"; //FIXME
@@ -348,8 +351,8 @@
 			}
 			std::string charString = "c(" + tmpCharString + ");";
 			dataChr.push_back (charString);
-		    }				
-		}  
+		    }
+		}
 	    }
 	}
     }
@@ -368,8 +371,5 @@
 					Rcpp::Named("stateLabels") = stateLabels,
 					Rcpp::Named("dataChr") = dataChr,
 					Rcpp::Named("Test") = test);
-    return res;				
-
-  END_RCPP
-
+    return res;
 }

Modified: pkg/src/Makevars
===================================================================
--- pkg/src/Makevars	2014-03-17 13:29:22 UTC (rev 880)
+++ pkg/src/Makevars	2014-03-19 02:58:59 UTC (rev 881)
@@ -1,2 +1,2 @@
-PKG_CPPFLAGS=-I. -DHAVE_INTTYPES_H -DASSERTS_TO_EXCEPTIONS
-#PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`
+## PKG_CPPFLAGS=-I. -DHAVE_INTTYPES_H -DASSERTS_TO_EXCEPTIONS
+## PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`

Modified: pkg/src/Makevars.win
===================================================================
--- pkg/src/Makevars.win	2014-03-17 13:29:22 UTC (rev 880)
+++ pkg/src/Makevars.win	2014-03-19 02:58:59 UTC (rev 881)
@@ -1,5 +1,5 @@
 ## PKG_LIBS = -s $(shell Rscript -e 'Rcpp:::LdFlags()') -L"$(RHOME)/bin" -lR --no-export-all-symbols --add-stdcall-alias
-PKG_CXXFLAGS =  -I. -DHAVE_INTTYPES_H -DASSERTS_TO_EXCEPTIONS
+## PKG_CXXFLAGS =  -I. -DHAVE_INTTYPES_H -DASSERTS_TO_EXCEPTIONS
 ## PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()")
 
 



More information about the Phylobase-commits mailing list