[Rcpp-commits] r2760 - in pkg/Rcpp: . inst/include inst/include/Rcpp src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Dec 10 12:43:07 CET 2010
Author: romain
Date: 2010-12-10 12:43:06 +0100 (Fri, 10 Dec 2010)
New Revision: 2760
Added:
pkg/Rcpp/inst/include/Rcpp/barrier.h
pkg/Rcpp/src/barrier.cpp
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/inst/include/RcppCommon.h
Log:
crossing the write barrier
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2010-12-10 04:26:01 UTC (rev 2759)
+++ pkg/Rcpp/ChangeLog 2010-12-10 11:43:06 UTC (rev 2760)
@@ -1,6 +1,13 @@
+2010-12-10 Romain Francois <romain at r-enthusiasts.com>
+
+ * inst/include/Rcpp/barrier.h: faster versions (crossing the write barrier)
+ for string_elt, etc ...(to be used only internally)
+
+ * src/barrier.cpp: implementation of the above
+
2010-12-09 John M Chambers <jmc at r-project.org>
- * Rcpp/src/Module.cpp: Rcpp/src/exceptions.cpp,
+ * src/Module.cpp: Rcpp/src/exceptions.cpp,
Rcpp/src/Rcpp_init.c, etc. add a not_initialized exception and a
dummy_pointer to identify such objects, throw exc. back to R
Added: pkg/Rcpp/inst/include/Rcpp/barrier.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/barrier.h (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/barrier.h 2010-12-10 11:43:06 UTC (rev 2760)
@@ -0,0 +1,33 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// barrier.h: Rcpp R/C++ interface class library -- crossin the write barrier
+//
+// Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef Rcpp__barrier__h
+#define Rcpp__barrier__h
+
+SEXP get_string_elt(SEXP, int) ;
+const char* char_get_string_elt(SEXP, int) ;
+void set_string_elt(SEXP, int, SEXP) ;
+void char_set_string_elt(SEXP, int, const char*) ;
+
+SEXP get_vector_elt(SEXP, int) ;
+void set_vector_elt(SEXP, int, SEXP ) ;
+
+#endif
Modified: pkg/Rcpp/inst/include/RcppCommon.h
===================================================================
--- pkg/Rcpp/inst/include/RcppCommon.h 2010-12-10 04:26:01 UTC (rev 2759)
+++ pkg/Rcpp/inst/include/RcppCommon.h 2010-12-10 11:43:06 UTC (rev 2760)
@@ -132,6 +132,8 @@
#include <Rcpp/complex.h>
+#include <Rcpp/barrier.h>
+
#define RcppExport extern "C"
#include <Rcpp/internal/posixt.h>
Added: pkg/Rcpp/src/barrier.cpp
===================================================================
--- pkg/Rcpp/src/barrier.cpp (rev 0)
+++ pkg/Rcpp/src/barrier.cpp 2010-12-10 11:43:06 UTC (rev 2760)
@@ -0,0 +1,45 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
+//
+// barrier.cpp: Rcpp R/C++ interface class library -- write barrier
+//
+// Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
+
+#define USE_RINTERNALS
+#include <Rinternals.h>
+#include <Rcpp/barrier.h>
+
+SEXP get_string_elt(SEXP x, int i){
+ return STRING_ELT(x, i ) ;
+}
+const char* char_get_string_elt(SEXP x, int i){
+ return CHAR(STRING_ELT(x, i )) ;
+}
+void set_string_elt(SEXP x, int i, SEXP value){
+ SET_STRING_ELT(x, i, value ) ;
+}
+void char_set_string_elt(SEXP x, int i, const char* value){
+ SET_STRING_ELT(x, i, Rf_mkChar(value) ) ;
+}
+
+SEXP get_vector_elt(SEXP x, int i){
+ return VECTOR_ELT(x, i ) ;
+}
+void set_vector_elt(SEXP x, int i, SEXP value){
+ SET_VECTOR_ELT(x, i, value ) ;
+}
+
More information about the Rcpp-commits
mailing list