File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ 2011-10-25 Dirk Eddelbuettel <edd@debian.org>
2+
3+ * src/Rostream.cpp: Patch by Jelmer Ypma which adds a new device
4+ 'Rcout' not unlike std::cout but uses Rprintf internally
5+ * src/Rstreambuf.cpp: Idem
6+ * include/include/Rcpp/iostream/Rostream.h: Idem
7+ * include/include/Rcpp/iostream/Rstreambuf.h: Idem
8+ * include/include/Rcpp.h: Include new headers
9+
1102011-09-29 Dirk Eddelbuettel <edd@debian.org>
211
312 * DESCRIPTION: Release 0.9.7
Original file line number Diff line number Diff line change 11Package: Rcpp
22Title: Seamless R and C++ Integration
3- Version: 0.9.7
3+ Version: 0.9.7.1
44Date: $Date$
55Author: Dirk Eddelbuettel and Romain Francois,
66 with contributions by Douglas Bates and John Chambers
Original file line number Diff line number Diff line change 1+ 0.9.8 201x-yy-zz
2+
3+ o Applied patch by Jelmer Ypma which adds an output stream class
4+ 'Rcout' not unlike std::cout, but implemented via Rprintf to
5+ cooperate with R and its output buffering.
6+
170.9.7 2011-09-29
28
39 o Applied two patches kindly provided by Martyn Plummer which provide
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Rainer Hurling for help debugging builds issues on FreeBSD
1010Uwe Ligges for help with Windows (32 and 64 bit) build issues
1111Tama Ma for a patch that extends Module constructors
1212Karl Millar for a patch helping with a non-g++ compiler
13- Martyn Plummer for help with Solaris build issues
13+ Martyn Plummer for help and patches regarding Solaris build issues
1414David Reiss for the first-ever contributed patch (Rcpp*View)
1515Brian Ripley for help with Win64 + Solaris build issues
1616Dominick Samperi for starting what is now in the RcppClassic package
@@ -19,3 +19,4 @@ Alexey Stukalov for a support enabling Intel Compiler 12.0 support
1919Luke Tierney for helpful discussions on R internals
2020Simon Urbanek for help on OS X build issues and with R internals
2121Ken Williams for additional OS X testing
22+ Jelmer Ypma for contributing the Rcout iostreams class patch
Original file line number Diff line number Diff line change 6868#include < Rcpp/sugar/sugar.h>
6969#include < Rcpp/stats/stats.h>
7070
71+ // "Rcout" iostream class contributed by Jelmer Ypma
72+ #include < Rcpp/iostream/Rstreambuf.h>
73+ #include < Rcpp/iostream/Rostream.h>
74+
7175#endif
Original file line number Diff line number Diff line change 1+ // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2+ //
3+ // Rostream.h: Rcpp R/C++ interface class library -- output stream
4+ //
5+ // Copyright (C) 2011 Dirk Eddelbuettel, Romain Francois and Jelmer Ypma
6+ //
7+ // This file is part of Rcpp.
8+ //
9+ // Rcpp is free software: you can redistribute it and/or modify it
10+ // under the terms of the GNU General Public License as published by
11+ // the Free Software Foundation, either version 2 of the License, or
12+ // (at your option) any later version.
13+ //
14+ // Rcpp is distributed in the hope that it will be useful, but
15+ // WITHOUT ANY WARRANTY; without even the implied warranty of
16+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ // GNU General Public License for more details.
18+ //
19+ // You should have received a copy of the GNU General Public License
20+ // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21+
22+ #ifndef __ROSTREAM_H__
23+ #define __ROSTREAM_H__
24+
25+ #include < RcppCommon.h>
26+ #include < Rcpp/iostream/Rstreambuf.h>
27+
28+ // modified from
29+ // http://stackoverflow.com/questions/243696/correctly-over-loading-a-stringbuf-to-replace-cout-in-a-matlab-mex-file
30+
31+ namespace Rcpp {
32+
33+ class Rostream : public std ::ostream {
34+
35+ protected:
36+ Rstreambuf buf;
37+
38+ public:
39+ Rostream ();
40+ };
41+
42+ // declare global variable
43+ extern Rostream Rcout;
44+
45+ }
46+
47+ #endif
Original file line number Diff line number Diff line change 1+ // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2+ //
3+ // Rostream.h: Rcpp R/C++ interface class library -- stream buffer
4+ //
5+ // Copyright (C) 2011 Dirk Eddelbuettel, Romain Francois and Jelmer Ypma
6+ //
7+ // This file is part of Rcpp.
8+ //
9+ // Rcpp is free software: you can redistribute it and/or modify it
10+ // under the terms of the GNU General Public License as published by
11+ // the Free Software Foundation, either version 2 of the License, or
12+ // (at your option) any later version.
13+ //
14+ // Rcpp is distributed in the hope that it will be useful, but
15+ // WITHOUT ANY WARRANTY; without even the implied warranty of
16+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ // GNU General Public License for more details.
18+ //
19+ // You should have received a copy of the GNU General Public License
20+ // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21+
22+ #ifndef __RSTREAMBUF_H__
23+ #define __RSTREAMBUF_H__
24+
25+ #include < streambuf>
26+ #include < RcppCommon.h>
27+
28+ // modified from
29+ // http://stackoverflow.com/questions/243696/correctly-over-loading-a-stringbuf-to-replace-cout-in-a-matlab-mex-file
30+
31+ namespace Rcpp {
32+
33+ class Rstreambuf : public std ::streambuf {
34+ public:
35+
36+ protected:
37+ virtual std::streamsize xsputn (const char *s, std::streamsize n );
38+
39+ virtual int overflow (int c = EOF );
40+ };
41+
42+ }
43+
44+ #endif
Original file line number Diff line number Diff line change 1+ // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2+ //
3+ // Rostream.cpp: Rcpp R/C++ interface class library -- output stream
4+ //
5+ // Copyright (C) 2011 Dirk Eddelbuettel, Romain Francois and Jelmer Ypma
6+ //
7+ // This file is part of Rcpp.
8+ //
9+ // Rcpp is free software: you can redistribute it and/or modify it
10+ // under the terms of the GNU General Public License as published by
11+ // the Free Software Foundation, either version 2 of the License, or
12+ // (at your option) any later version.
13+ //
14+ // Rcpp is distributed in the hope that it will be useful, but
15+ // WITHOUT ANY WARRANTY; without even the implied warranty of
16+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ // GNU General Public License for more details.
18+ //
19+ // You should have received a copy of the GNU General Public License
20+ // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21+
22+ #include < RcppCommon.h>
23+ #include < Rcpp/iostream/Rostream.h>
24+
25+ Rcpp::Rostream::Rostream () : std::ostream( &buf ) {}
26+
27+ // define global variable Rcout
28+ Rcpp::Rostream Rcpp::Rcout;
Original file line number Diff line number Diff line change 1+ // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2+ //
3+ // Rostream.h: Rcpp R/C++ interface class library -- stream buffer
4+ //
5+ // Copyright (C) 2011 Dirk Eddelbuettel, Romain Francois and Jelmer Ypma
6+ //
7+ // This file is part of Rcpp.
8+ //
9+ // Rcpp is free software: you can redistribute it and/or modify it
10+ // under the terms of the GNU General Public License as published by
11+ // the Free Software Foundation, either version 2 of the License, or
12+ // (at your option) any later version.
13+ //
14+ // Rcpp is distributed in the hope that it will be useful, but
15+ // WITHOUT ANY WARRANTY; without even the implied warranty of
16+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ // GNU General Public License for more details.
18+ //
19+ // You should have received a copy of the GNU General Public License
20+ // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21+
22+ #include < RcppCommon.h>
23+ #include < Rcpp/iostream/Rstreambuf.h>
24+
25+ std::streamsize Rcpp::Rstreambuf::xsputn (const char *s, std::streamsize num ) {
26+ Rprintf ( " %.*s" , num, s );
27+ return num;
28+ }
29+
30+ int Rcpp::Rstreambuf::overflow (int c ) {
31+ if (c != EOF ) {
32+ Rprintf ( " %.1s" , &c );
33+ }
34+ return c;
35+ }
You can’t perform that action at this time.
0 commit comments