Re: [Rcpp-devel] Bug: compileAttributes incorrectly handles Rcpp::export-ed functions with multiple arguments

2014-01-18 Thread Dirk Eddelbuettel

On 18 January 2014 at 16:19, Davor Cubranic wrote:
| Thanks!
| 
| I forgot about the github repository — hurray for no more R-Forge’s
| subversion browser…
| 
| Should bug reports and requests now be filed as Github issues?

Whatever works, and I leave that up to you. I still think that the list here
gets more eyeballs.  But if you have something more narrow, or already have a
Pull Request ready and tested (hint, hint) then by all means post on Github.

Dirk
 
-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] Bug: compileAttributes incorrectly handles Rcpp::export-ed functions with multiple arguments

2014-01-18 Thread Davor Cubranic
Thanks!

I forgot about the github repository — hurray for no more R-Forge’s subversion 
browser…

Should bug reports and requests now be filed as Github issues?

Davor

On Jan 18, 2014, at 4:07 AM, JJ Allaire  wrote:

> Thanks for the report and sorry it took so long to get the the bottom
> of it (I had also tried reproing to no avail). This is now fixed with
> https://github.com/RcppCore/Rcpp/commit/d366984e6aabc426bae7f827b9fabc69df8d707b.
> 
> J.J.
> 
> On Sat, Jan 18, 2014 at 6:41 AM, Romain Francois
>  wrote:
>> 
>> Le 18 janv. 2014 à 06:10, Davor Cubranic  a écrit :
>> 
>> Running compileAttributes with “verbose = TRUE” was very informative:
>> 
>> $ Rscript -e 'Rcpp::compileAttributes(".", TRUE)'
>> Exports from /Users/davor/projects/Davor/myPackage/src/rcpp_hello_world.cpp:
>>   List rcpp_hello_world(NumericVector foo)
>> 
>> Exports from
>> /Users/davor/projects/Davor/myPackage/src/rcpp_hello_world.cpp~:
>>   List rcpp_hello_world()
>> 
>> 
>> Answer: compileAttributes interprets Emacs backup files with extension
>> “.cpp~” as source files. (My fault for not zipping up the actual source
>> directory but the product of "R CMD build".)
>> 
>> Probable source of the error is in compileAttributes (Attributes.R:355):
>> 
>>cppFiles <- list.files(srcDir, pattern = glob2rx("*.c*”))
>> 
>> 
>> Hi,
>> 
>> This has bitten me too in various training I gave about Rcp. I guess
>> [.]c(c|pp)$ would make a better pattern.
>> WRE says (if you read between the lines) that c++ files are .cpp or .cc
>> 
>> So this is a bug.
>> 
>> Romain
>> 
>> You need a better way to identify C++ sources. R-exts manual says R’s make
>> rules use .cc and .cpp for C++. (This is supposed to be recorded in
>> R_HOME/etcR_ARCH/Makeconf, so it could potentially be processed dynamically,
>> although I doubt that’s really necessary.)
>> 
>> Davor
>> 
>> 
>> On Jan 17, 2014, at 4:18 PM, Dirk Eddelbuettel  wrote:
>> 
>> 
>> On 17 January 2014 at 15:32, Davor Cubranic wrote:
>> | On 2014-01-17, at 2:55 PM, Dirk Eddelbuettel wrote:
>> |
>> | > You had two mistakes here:
>> | >
>> | >  i)   after you alter an interface to be used by Rcpp Attributes, you
>> must
>> | >   re-run the compileAttributes() function to update the files.  See
>> the
>> | >   vignette for details.
>> |
>> | What do you mean by this? Like I said, I changed the .cpp file and re-run
>> |  compileAttributes. What I uploaded is the result afterwards.
>> 
>> The equivalent of
>> 
>>   $ cd myPackage; R -e 'Rcpp::compileAttributes(".")'
>> 
>> For once, I launched R and typed it by hand.
>> 
>> | >   (And if you use RStudio, this is done automagically)
>> |
>> | So it is by devtools, on one of the functions I regularly use in my
>> workflow, perhaps "test". If it wasn't, it would be such a pain.
>> |
>> | >  ii)  Your C++ function did not work as the 'List z = ...' parameter
>> | >   shadowed an already declared parameter from the function
>> interface.
>> | >   Renaming to zz or z2 works, of course.
>> |
>> | I fixed it and rerun compileAttributes. Still the same problem. New
>> version of the package is attached.
>> 
>> See here, based on your previous file.
>> 
>> edd@max:/tmp/davor/myPackage$ cat src/rcpp_hello_world.cpp
>> 
>> #include 
>> using namespace Rcpp;
>> 
>> // [[Rcpp::export]]
>> List rcpp_hello_world(NumericVector z) {
>> 
>>   CharacterVector x = CharacterVector::create( "foo", "bar" )  ;
>>   NumericVector y   = NumericVector::create( 0.0, 1.0 ) ;
>>   List z2   = List::create( x, y ) ;
>> 
>>   return z2 ;
>> }
>> edd@max:/tmp/davor/myPackage$ R CMD check .
>> * using log directory ‘/tmp/davor/myPackage/..Rcheck’
>> * using R version 3.0.2 (2013-09-25)
>> * using platform: x86_64-pc-linux-gnu (64-bit)
>> * using session charset: UTF-8
>> * checking for file ‘./DESCRIPTION’ ... OK
>> * checking extension type ... Package
>> * this is package ‘myPackage’ version ‘1.0’
>> * checking package namespace information ... OK
>> * checking package dependencies ... OK
>> * checking if this is a source package ... OK
>> * checking if there is a namespace ... OK
>> * checking for executable files ... OK
>> * checking for hidden files and directories ... NOTE
>> Found the following hidden files and directories:
>> ..Rcheck
>> These were most likely included in error. See section ‘Package structure’ in
>> the ‘Writing R Extensions’ manual.
>> * checking for portable file names ... OK
>> * checking for sufficient/correct file permissions ... OK
>> * checking whether package ‘myPackage’ can be installed ... WARNING
>> Found the following significant warnings:
>> Warning: /tmp/davor/myPackage/man/myPackage-package.Rd:31: All text must be
>> in a section
>> Warning: /tmp/davor/myPackage/man/myPackage-package.Rd:32: All text must be
>> in a section
>> See ‘/tmp/davor/myPackage/..Rcheck/00install.out’ for details.
>> * checking installed package size ... OK
>> * checking package directory ... OK
>> * checking DESCRIPTION meta-information ... WA

Re: [Rcpp-devel] GSOC ideas

2014-01-18 Thread Dirk Eddelbuettel

On 18 January 2014 at 12:24, Tim Keitt wrote:
| Is there a list of GSOC ideas for Rcpp? I assume you all participate.

I have in the past (and even admin'ed for R) but not for the last two
years for lack of time. 

Rcpp clearly fits under the R mantle so if you want to mentor, go for it.
GSoC is a lovely program.

Dirk
 
| As far as I can tell (correct me if I am wrong), Rcpp does not support as
| arguments or return types:
| void*
| enums
| int/double* buffers
| char** buffers (vector of null-terminated strings)
| 
| If these types of arguments could be handled natively, I would not have to
| write wrappers by hand, which is easy but time consuming for large libraries.
| 
| The first thing might be to add an "enum_" template to Rcpp a la
| Boost::Python.
| 
| It would be nice to extend the attributed mechanism to allow wrapping given a
| prototype, for example:
| 
| // [[Rcpp::wrap]]
| const char* theFunc(double n);
| 
| This would not emit a prototype for theFunc, the assumption being it is 
defined
| in a header.
| 
| THK
| 
| --
| http://www.keittlab.org/
| 
| --
| ___
| Rcpp-devel mailing list
| Rcpp-devel@lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


[Rcpp-devel] GSOC ideas

2014-01-18 Thread Tim Keitt
Is there a list of GSOC ideas for Rcpp? I assume you all participate.

As far as I can tell (correct me if I am wrong), Rcpp does not support as
arguments or return types:
void*
enums
int/double* buffers
char** buffers (vector of null-terminated strings)

If these types of arguments could be handled natively, I would not have to
write wrappers by hand, which is easy but time consuming for large
libraries.

The first thing might be to add an "enum_" template to Rcpp a la
Boost::Python.

It would be nice to extend the attributed mechanism to allow wrapping given
a prototype, for example:

// [[Rcpp::wrap]]
const char* theFunc(double n);

This would not emit a prototype for theFunc, the assumption being it is
defined in a header.

THK

-- 
http://www.keittlab.org/
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] Bug: compileAttributes incorrectly handles Rcpp::export-ed functions with multiple arguments

2014-01-18 Thread JJ Allaire
Thanks for the report and sorry it took so long to get the the bottom
of it (I had also tried reproing to no avail). This is now fixed with
https://github.com/RcppCore/Rcpp/commit/d366984e6aabc426bae7f827b9fabc69df8d707b.

J.J.

On Sat, Jan 18, 2014 at 6:41 AM, Romain Francois
 wrote:
>
> Le 18 janv. 2014 à 06:10, Davor Cubranic  a écrit :
>
> Running compileAttributes with “verbose = TRUE” was very informative:
>
> $ Rscript -e 'Rcpp::compileAttributes(".", TRUE)'
> Exports from /Users/davor/projects/Davor/myPackage/src/rcpp_hello_world.cpp:
>List rcpp_hello_world(NumericVector foo)
>
> Exports from
> /Users/davor/projects/Davor/myPackage/src/rcpp_hello_world.cpp~:
>List rcpp_hello_world()
>
>
> Answer: compileAttributes interprets Emacs backup files with extension
> “.cpp~” as source files. (My fault for not zipping up the actual source
> directory but the product of "R CMD build".)
>
> Probable source of the error is in compileAttributes (Attributes.R:355):
>
> cppFiles <- list.files(srcDir, pattern = glob2rx("*.c*”))
>
>
> Hi,
>
> This has bitten me too in various training I gave about Rcp. I guess
> [.]c(c|pp)$ would make a better pattern.
> WRE says (if you read between the lines) that c++ files are .cpp or .cc
>
> So this is a bug.
>
> Romain
>
> You need a better way to identify C++ sources. R-exts manual says R’s make
> rules use .cc and .cpp for C++. (This is supposed to be recorded in
> R_HOME/etcR_ARCH/Makeconf, so it could potentially be processed dynamically,
> although I doubt that’s really necessary.)
>
> Davor
>
>
> On Jan 17, 2014, at 4:18 PM, Dirk Eddelbuettel  wrote:
>
>
> On 17 January 2014 at 15:32, Davor Cubranic wrote:
> | On 2014-01-17, at 2:55 PM, Dirk Eddelbuettel wrote:
> |
> | > You had two mistakes here:
> | >
> | >  i)   after you alter an interface to be used by Rcpp Attributes, you
> must
> | >   re-run the compileAttributes() function to update the files.  See
> the
> | >   vignette for details.
> |
> | What do you mean by this? Like I said, I changed the .cpp file and re-run
> |  compileAttributes. What I uploaded is the result afterwards.
>
> The equivalent of
>
>$ cd myPackage; R -e 'Rcpp::compileAttributes(".")'
>
> For once, I launched R and typed it by hand.
>
> | >   (And if you use RStudio, this is done automagically)
> |
> | So it is by devtools, on one of the functions I regularly use in my
> workflow, perhaps "test". If it wasn't, it would be such a pain.
> |
> | >  ii)  Your C++ function did not work as the 'List z = ...' parameter
> | >   shadowed an already declared parameter from the function
> interface.
> | >   Renaming to zz or z2 works, of course.
> |
> | I fixed it and rerun compileAttributes. Still the same problem. New
> version of the package is attached.
>
> See here, based on your previous file.
>
> edd@max:/tmp/davor/myPackage$ cat src/rcpp_hello_world.cpp
>
> #include 
> using namespace Rcpp;
>
> // [[Rcpp::export]]
> List rcpp_hello_world(NumericVector z) {
>
>CharacterVector x = CharacterVector::create( "foo", "bar" )  ;
>NumericVector y   = NumericVector::create( 0.0, 1.0 ) ;
>List z2   = List::create( x, y ) ;
>
>return z2 ;
> }
> edd@max:/tmp/davor/myPackage$ R CMD check .
> * using log directory ‘/tmp/davor/myPackage/..Rcheck’
> * using R version 3.0.2 (2013-09-25)
> * using platform: x86_64-pc-linux-gnu (64-bit)
> * using session charset: UTF-8
> * checking for file ‘./DESCRIPTION’ ... OK
> * checking extension type ... Package
> * this is package ‘myPackage’ version ‘1.0’
> * checking package namespace information ... OK
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking if there is a namespace ... OK
> * checking for executable files ... OK
> * checking for hidden files and directories ... NOTE
> Found the following hidden files and directories:
>  ..Rcheck
> These were most likely included in error. See section ‘Package structure’ in
> the ‘Writing R Extensions’ manual.
> * checking for portable file names ... OK
> * checking for sufficient/correct file permissions ... OK
> * checking whether package ‘myPackage’ can be installed ... WARNING
> Found the following significant warnings:
>  Warning: /tmp/davor/myPackage/man/myPackage-package.Rd:31: All text must be
> in a section
>  Warning: /tmp/davor/myPackage/man/myPackage-package.Rd:32: All text must be
> in a section
> See ‘/tmp/davor/myPackage/..Rcheck/00install.out’ for details.
> * checking installed package size ... OK
> * checking package directory ... OK
> * checking DESCRIPTION meta-information ... WARNING
> Non-standard license specification:
>  What Licence is it under ?
> Standardizable: FALSE
> * checking top-level files ... OK
> * checking for left-over files ... OK
> * checking index information ... OK
> * checking package subdirectories ... WARNING
> Found the following directory with the name of a check directory:
>  ./..Rcheck
> Most likely, these were included

Re: [Rcpp-devel] Bug: compileAttributes incorrectly handles Rcpp::export-ed functions with multiple arguments

2014-01-18 Thread Romain Francois

Le 18 janv. 2014 à 06:10, Davor Cubranic  a écrit :

> Running compileAttributes with “verbose = TRUE” was very informative:
> 
> $ Rscript -e 'Rcpp::compileAttributes(".", TRUE)'
> Exports from /Users/davor/projects/Davor/myPackage/src/rcpp_hello_world.cpp:
>List rcpp_hello_world(NumericVector foo)
> 
> Exports from /Users/davor/projects/Davor/myPackage/src/rcpp_hello_world.cpp~:
>List rcpp_hello_world()
> 
> Answer: compileAttributes interprets Emacs backup files with extension 
> “.cpp~” as source files. (My fault for not zipping up the actual source 
> directory but the product of "R CMD build".)
> 
> Probable source of the error is in compileAttributes (Attributes.R:355):
> 
> cppFiles <- list.files(srcDir, pattern = glob2rx("*.c*”))

Hi, 

This has bitten me too in various training I gave about Rcp. I guess 
[.]c(c|pp)$ would make a better pattern. 
WRE says (if you read between the lines) that c++ files are .cpp or .cc

So this is a bug. 

Romain

> You need a better way to identify C++ sources. R-exts manual says R’s make 
> rules use .cc and .cpp for C++. (This is supposed to be recorded in 
> R_HOME/etcR_ARCH/Makeconf, so it could potentially be processed dynamically, 
> although I doubt that’s really necessary.)
> 
> Davor
> 
> 
> On Jan 17, 2014, at 4:18 PM, Dirk Eddelbuettel  wrote:
> 
>> 
>> On 17 January 2014 at 15:32, Davor Cubranic wrote:
>> | On 2014-01-17, at 2:55 PM, Dirk Eddelbuettel wrote:
>> | 
>> | > You had two mistakes here:
>> | > 
>> | >  i)   after you alter an interface to be used by Rcpp Attributes, you 
>> must
>> | >   re-run the compileAttributes() function to update the files.  See 
>> the
>> | >   vignette for details.
>> | 
>> | What do you mean by this? Like I said, I changed the .cpp file and re-run
>> |  compileAttributes. What I uploaded is the result afterwards.
>> 
>> The equivalent of 
>> 
>>$ cd myPackage; R -e 'Rcpp::compileAttributes(".")'
>> 
>> For once, I launched R and typed it by hand.
>> 
>> | >   (And if you use RStudio, this is done automagically)
>> | 
>> | So it is by devtools, on one of the functions I regularly use in my 
>> workflow, perhaps "test". If it wasn't, it would be such a pain.
>> | 
>> | >  ii)  Your C++ function did not work as the 'List z = ...' parameter
>> | >   shadowed an already declared parameter from the function interface.
>> | >   Renaming to zz or z2 works, of course.
>> | 
>> | I fixed it and rerun compileAttributes. Still the same problem. New 
>> version of the package is attached.
>> 
>> See here, based on your previous file.
>> 
>> edd@max:/tmp/davor/myPackage$ cat src/rcpp_hello_world.cpp 
>> 
>> #include 
>> using namespace Rcpp;
>> 
>> // [[Rcpp::export]]
>> List rcpp_hello_world(NumericVector z) {
>> 
>>CharacterVector x = CharacterVector::create( "foo", "bar" )  ;
>>NumericVector y   = NumericVector::create( 0.0, 1.0 ) ;
>>List z2   = List::create( x, y ) ;
>> 
>>return z2 ;
>> }
>> edd@max:/tmp/davor/myPackage$ R CMD check .
>> * using log directory ‘/tmp/davor/myPackage/..Rcheck’
>> * using R version 3.0.2 (2013-09-25)
>> * using platform: x86_64-pc-linux-gnu (64-bit)
>> * using session charset: UTF-8
>> * checking for file ‘./DESCRIPTION’ ... OK
>> * checking extension type ... Package
>> * this is package ‘myPackage’ version ‘1.0’
>> * checking package namespace information ... OK
>> * checking package dependencies ... OK
>> * checking if this is a source package ... OK
>> * checking if there is a namespace ... OK
>> * checking for executable files ... OK
>> * checking for hidden files and directories ... NOTE
>> Found the following hidden files and directories:
>>  ..Rcheck
>> These were most likely included in error. See section ‘Package structure’ in 
>> the ‘Writing R Extensions’ manual.
>> * checking for portable file names ... OK
>> * checking for sufficient/correct file permissions ... OK
>> * checking whether package ‘myPackage’ can be installed ... WARNING
>> Found the following significant warnings:
>>  Warning: /tmp/davor/myPackage/man/myPackage-package.Rd:31: All text must be 
>> in a section
>>  Warning: /tmp/davor/myPackage/man/myPackage-package.Rd:32: All text must be 
>> in a section
>> See ‘/tmp/davor/myPackage/..Rcheck/00install.out’ for details.
>> * checking installed package size ... OK
>> * checking package directory ... OK
>> * checking DESCRIPTION meta-information ... WARNING
>> Non-standard license specification:
>>  What Licence is it under ?
>> Standardizable: FALSE
>> * checking top-level files ... OK
>> * checking for left-over files ... OK
>> * checking index information ... OK
>> * checking package subdirectories ... WARNING
>> Found the following directory with the name of a check directory:
>>  ./..Rcheck
>> Most likely, these were included erroneously.
>> * checking R files for non-ASCII characters ... OK
>> * checking R files for syntax errors ... OK
>> * checking whether the package can be loaded ... OK
>> * checkin