diff --git a/bindings/r/inc/RExports.h b/bindings/r/inc/RExports.h index 262c736fb3d9e..81f7df91d9701 100644 --- a/bindings/r/inc/RExports.h +++ b/bindings/r/inc/RExports.h @@ -138,11 +138,12 @@ namespace ROOT { extern VARIABLE_IS_NOT_USED SEXP ModuleSymRef; template class class_: public Rcpp::class_ { public: - class_(const char *name_, const char *doc = 0): Rcpp::class_(name_, doc) {} + class_(const Char_t *name_, const Char_t *doc = 0) : Rcpp::class_(name_, doc) {} }; //________________________________________________________________________________________________________ - template void function(const char *name_, T fun, const char *docstring = 0) + template + void function(const Char_t *name_, T fun, const Char_t *docstring = 0) { //template function required to create modules using the macro ROOTR_MODULE Rcpp::function(name_, fun, docstring); diff --git a/bindings/r/inc/TRDataFrame.h b/bindings/r/inc/TRDataFrame.h index 76fd593ae6101..b7bb4ed89d215 100644 --- a/bindings/r/inc/TRDataFrame.h +++ b/bindings/r/inc/TRDataFrame.h @@ -201,9 +201,9 @@ namespace ROOT { */ template Binding operator=(T var) { - int size = fDf.size(), i = 0 ; + Int_t size = fDf.size(), i = 0; Rcpp::CharacterVector names = fDf.attr("names"); - bool found = false; + Bool_t found = false; while (i < size) { if (names[i] == fName.Data()) { found = true; @@ -238,9 +238,9 @@ namespace ROOT { */ Binding operator=(Binding obj) { - int size = fDf.size(), i = 0 ; + Int_t size = fDf.size(), i = 0; Rcpp::CharacterVector names = fDf.attr("names"); - bool found = false; + Bool_t found = false; while (i < size) { if (names[i] == fName.Data()) { found = true; @@ -291,9 +291,9 @@ namespace ROOT { */ template Binding &operator <<(T var) { - int size = fDf.size(), i = 0 ; + Int_t size = fDf.size(), i = 0; Rcpp::CharacterVector names = fDf.attr("names"); - bool found = false; + Bool_t found = false; while (i < size) { if (names[i] == fName.Data()) { found = true; @@ -392,18 +392,12 @@ namespace ROOT { Method to get the number of colunms \return number of cols */ - int GetNcols() - { - return df.size(); - } + Int_t GetNcols() { return df.size(); } /** Method to get the number of rows \return number of rows */ - int GetNrows() - { - return df.nrows(); - } + Int_t GetNrows() { return df.nrows(); } /** Method to get labels of dataframe \return colunms names @@ -412,7 +406,7 @@ namespace ROOT { { Rcpp::CharacterVector names = df.attr("names"); TVectorString rnames(GetNcols()); - for (int i = 0; i < GetNcols(); i++)rnames[i] = names[i]; + for (Int_t i = 0; i < GetNcols(); i++) rnames[i] = names[i]; return rnames; } @@ -431,7 +425,7 @@ namespace ROOT { Method to print the dataframe in stdout or a column given the label \param label nomber of the column to print */ - void Print(const char* label = "") + void Print(const Char_t *label = "") { TRFunctionImport print("print"); if (label && !label[0]) { diff --git a/bindings/r/inc/TRFunctionExport.h b/bindings/r/inc/TRFunctionExport.h index 9c1ccba62554a..8c872d97c11f7 100644 --- a/bindings/r/inc/TRFunctionExport.h +++ b/bindings/r/inc/TRFunctionExport.h @@ -148,14 +148,14 @@ namespace ROOT { Default TRFunctionExport constructor */ TRFunctionExport(); - + /** Default TRFunctionExport destructor */ ~TRFunctionExport() - { - if(f) delete f; - } + { + if (f) delete f; + } /** TRFunctionExport copy constructor \param fun other TRFunctionExport diff --git a/bindings/r/inc/TRInterface.h b/bindings/r/inc/TRInterface.h index cf12a7b11ff0b..bdb559bfb5d6b 100644 --- a/bindings/r/inc/TRInterface.h +++ b/bindings/r/inc/TRInterface.h @@ -211,7 +211,9 @@ namespace ROOT { \param verbose default false \param interactive default true */ - TRInterface(const int argc = 0, const char *argv[] = NULL, const bool loadRcpp = true, const bool verbose = false, const bool interactive = true); + TRInterface(const Int_t argc = 0, const Char_t *argv[] = NULL, const Bool_t loadRcpp = true, + const Bool_t verbose = false, const Bool_t interactive = true); + public: ~TRInterface(); diff --git a/bindings/r/src/RExports.cxx b/bindings/r/src/RExports.cxx index 28af10e7c8d4b..b3d36df7cf614 100644 --- a/bindings/r/src/RExports.cxx +++ b/bindings/r/src/RExports.cxx @@ -69,7 +69,7 @@ namespace Rcpp { template<> TMatrixT as(SEXP m) { NumericMatrix mat =::Rcpp::as(m); - std::vector dat = Rcpp::as >(mat); + std::vector dat = Rcpp::as>(mat); return TMatrixT(mat.rows(), mat.cols(), &dat[0], "F"); } diff --git a/bindings/r/src/TRDataFrame.cxx b/bindings/r/src/TRDataFrame.cxx index e1c4d951af647..a269e5bcffb7a 100644 --- a/bindings/r/src/TRDataFrame.cxx +++ b/bindings/r/src/TRDataFrame.cxx @@ -9,8 +9,6 @@ using namespace ROOT::R; -ClassImp(TRDataFrame) - //______________________________________________________________________________ TRDataFrame::TRDataFrame(): TObject() diff --git a/bindings/r/src/TRInterface.cxx b/bindings/r/src/TRInterface.cxx index 5c7809fb1f68e..96585f5823773 100644 --- a/bindings/r/src/TRInterface.cxx +++ b/bindings/r/src/TRInterface.cxx @@ -22,7 +22,9 @@ ClassImp(TRInterface) static ROOT::R::TRInterface *gR = NULL; static Bool_t statusEventLoop; -TRInterface::TRInterface(const int argc, const char *argv[], const bool loadRcpp, const bool verbose, const bool interactive): TObject() +TRInterface::TRInterface(const Int_t argc, const Char_t *argv[], const Bool_t loadRcpp, const Bool_t verbose, + const Bool_t interactive) + : TObject() { if (RInside::instancePtr()) throw std::runtime_error("Can only have one TRInterface instance"); fR = new RInside(argc, argv, loadRcpp, verbose, interactive); @@ -105,7 +107,7 @@ TRObject TRInterface::Eval(const TString &code) Error("Eval", "Can execute the requested code: %s", code.Data()); } - return TRObject(ans , (rc == 0) ? kTRUE : kFALSE); + return TRObject(ans, (rc == 0) ? kTRUE : kFALSE); } @@ -139,7 +141,7 @@ void TRInterface::Assign(const TRDataFrame &obj, const TString &name) void TRInterface::Interactive() { while (kTRUE) { - char *line = readline("[r]:"); + Char_t *line = readline("[r]:"); if (!line) continue; if (std::string(line) == ".q") break; Execute(line); @@ -153,7 +155,8 @@ void TRInterface::Interactive() TRInterface *TRInterface::InstancePtr() { if (!gR) { - const char *R_argv[] = {"rootr", "--gui=none", "--no-save", "--no-readline", "--silent", "--vanilla", "--slave"}; + const Char_t *R_argv[] = {"rootr", "--gui=none", "--no-save", "--no-readline", + "--silent", "--vanilla", "--slave"}; gR = new TRInterface(7, R_argv, true, false, false); } gR->ProcessEventsLoop(); @@ -198,11 +201,13 @@ void TRInterface::ProcessEventsLoop() if (!statusEventLoop) { th = new TThread([](void *args) { while (kTRUE) { - fd_set *fd; - int usec = 10000; - fd = R_checkActivity(usec, 0); - R_runHandlers(R_InputHandlers, fd); - gSystem->Sleep(100); + if (gR) { // in case global object was freed + fd_set *fd; + Int_t usec = 10000; + fd = R_checkActivity(usec, 0); + R_runHandlers(R_InputHandlers, fd); + if (gSystem) gSystem->Sleep(100); + } } }); th->Run();