00001 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 00002 // 00003 // RcppCommon.h: Rcpp R/C++ interface class library -- common include and defines statements 00004 // 00005 // Copyright (C) 2005 - 2006 Dominick Samperi 00006 // Copyright (C) 2008 - 2009 Dirk Eddelbuettel 00007 // Copyright (C) 2009 Romain Francois 00008 // 00009 // This file is part of Rcpp. 00010 // 00011 // Rcpp is free software: you can redistribute it and/or modify it 00012 // under the terms of the GNU General Public License as published by 00013 // the Free Software Foundation, either version 2 of the License, or 00014 // (at your option) any later version. 00015 // 00016 // Rcpp is distributed in the hope that it will be useful, but 00017 // WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License 00022 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>. 00023 00024 #ifndef RcppCommon_h 00025 #define RcppCommon_h 00026 00027 #include <exception> 00028 #include <iostream> 00029 #include <sstream> 00030 #include <string> 00031 #include <list> 00032 #include <map> 00033 #include <stdexcept> 00034 #include <vector> 00035 00036 // include R headers, but set R_NO_REMAP and access everything via Rf_ prefixes 00037 #define R_NO_REMAP 00038 00039 #include <R.h> 00040 #include <Rinternals.h> 00041 #include <R_ext/Callbacks.h> 00042 #include <Rversion.h> 00043 00044 // #ifdef BUILDING_DLL 00045 // #define RcppExport extern "C" __declspec(dllexport) 00046 // #else 00047 #define RcppExport extern "C" 00048 // #endif 00049 00050 char *copyMessageToR(const char* const mesg); 00051 00052 // simple logging help 00053 inline void logTxtFunction(const char* file, const int line, const char* expression); 00054 00055 //#define logTxt(x) logTxtFunction(__FILE__, __LINE__, x); 00056 #define logTxt(x) 00057 00058 /* in exceptions.cpp */ 00059 void forward_uncaught_exceptions_to_r() ; 00060 RcppExport SEXP initUncaughtExceptionHandler() ; 00061 00062 #endif