[Rinside-commits] r225 - in pkg: . src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jan 9 02:47:29 CET 2012
Author: edd
Date: 2012-01-09 02:47:28 +0100 (Mon, 09 Jan 2012)
New Revision: 225
Modified:
pkg/ChangeLog
pkg/src/MemBuf.cpp
pkg/src/RInside.cpp
Log:
small cleanup related to not using cout/cerr or stderr to please R CMD check
Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog 2012-01-08 18:09:43 UTC (rev 224)
+++ pkg/ChangeLog 2012-01-09 01:47:28 UTC (rev 225)
@@ -6,6 +6,8 @@
* src/RInside.cpp: Update RNG seeding to same scheme now used by
R which blends both (millisecond) time and process id
+ * src/RInside.cpp: Replace fprintf(stderr,...) with Rf_error(...)
+
* inst/examples/*: Added CMake build support for all example
directories kindly provided by Peter Aberline; this helps when coding
inside of IDEs such as Eclipse, KDevelop or Code::Blocks
Modified: pkg/src/MemBuf.cpp
===================================================================
--- pkg/src/MemBuf.cpp 2012-01-08 18:09:43 UTC (rev 224)
+++ pkg/src/MemBuf.cpp 2012-01-09 01:47:28 UTC (rev 225)
@@ -1,8 +1,9 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
//
// MemBuf.cpp: R/C++ interface class library -- Easier R embedding into C++
//
-// Copyright (C) 2009 - 2010 Dirk Eddelbuettel
+// Copyright (C) 2009 Dirk Eddelbuettel
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
//
// This file is part of RInside.
//
@@ -31,9 +32,7 @@
MemBuf::~MemBuf() {}
MemBuf::MemBuf(int sizebytes) : buffer() {
- if (verbose) std::cout << "MemBuf::ctor BEGIN" << std::endl;
buffer.reserve(sizebytes) ;
- if (verbose) std::cout << "MemBuf::ctor END" << std::endl;
}
void MemBuf::resize() { // Use power of 2 resizing
Modified: pkg/src/RInside.cpp
===================================================================
--- pkg/src/RInside.cpp 2012-01-08 18:09:43 UTC (rev 224)
+++ pkg/src/RInside.cpp 2012-01-09 01:47:28 UTC (rev 225)
@@ -119,8 +119,6 @@
for (int i = 0; R_VARS[i] != NULL; i+= 2) {
if (getenv(R_VARS[i]) == NULL) { // if env variable is not yet set
if (setenv(R_VARS[i],R_VARS[i+1],1) != 0){
- //perror("ERROR: couldn't set/replace an R environment variable");
- //exit(1);
throw std::runtime_error(std::string("Could not set R environment variable ") +
std::string(R_VARS[i]) + std::string(" to ") +
std::string(R_VARS[i+1]));
@@ -199,8 +197,6 @@
}
R_TempDir = (char*) tmp;
if (setenv("R_SESSION_TMPDIR",tmp,1) != 0){
- //perror("Fatal Error: couldn't set/replace R_SESSION_TMPDIR!");
- //exit(1);
throw std::runtime_error(std::string("Could not set / replace R_SESSION_TMPDIR to ") + std::string(tmp));
}
}
@@ -296,8 +292,6 @@
idx += packobjc[i] ;
}
} catch( std::exception& ex){
- // fprintf(stderr,"%s: Error calling delayedAssign:\n %s", programName, ex.what() );
- // exit(1);
throw std::runtime_error(std::string("Error calling delayedAssign: ") + std::string(ex.what()));
}
}
@@ -321,7 +315,7 @@
for(i = 0; i < Rf_length(cmdexpr); i++){
ans = R_tryEval(VECTOR_ELT(cmdexpr, i),NULL,&errorOccurred);
if (errorOccurred) {
- fprintf(stderr, "%s: Error in evaluating R code (%d)\n", programName, status);
+ Rf_error("%s: Error in evaluating R code (%d)\n", programName, status);
UNPROTECT(2);
return 1;
}
@@ -335,20 +329,20 @@
// need to read another line
break;
case PARSE_NULL:
- fprintf(stderr, "%s: ParseStatus is null (%d)\n", programName, status);
+ Rf_error("%s: ParseStatus is null (%d)\n", programName, status);
UNPROTECT(2);
return 1;
break;
case PARSE_ERROR:
- fprintf(stderr,"Parse Error: \"%s\"\n", line.c_str());
+ Rf_error("Parse Error: \"%s\"\n", line.c_str());
UNPROTECT(2);
return 1;
break;
case PARSE_EOF:
- fprintf(stderr, "%s: ParseStatus is eof (%d)\n", programName, status);
+ Rf_error("%s: ParseStatus is eof (%d)\n", programName, status);
break;
default:
- fprintf(stderr, "%s: ParseStatus is not documented %d\n", programName, status);
+ Rf_error("%s: ParseStatus is not documented %d\n", programName, status);
UNPROTECT(2);
return 1;
break;
More information about the Rinside-commits
mailing list