Re: [Rcpp-devel] exporting void test(void) function

2013-12-31 Thread Romain Francois
Hello, 

This is fixed in Rcpp implementations I maintain: Rcpp11 and Rcpp98 and tested 
for in Rcpp-test. 
https://github.com/romainfrancois/Rcpp11/blob/master/src/attributes.cpp#L1195
https://github.com/romainfrancois/Rcpp98/blob/master/src/attributes.cpp#L1228

Trivial to port the fix to Rcpp. 

Romain

Le 31 déc. 2013 à 05:15, Tim Keitt tke...@gmail.com a écrit :

 Apologies if this is the wrong list for user questions -- happy to be 
 redirected -- I did not see it immediately.
 
 Am I correct in noting that
 
 // [[Rcpp::export]]
 void test(void)
 {
 // do something
 }
 
 does not generate any code in RcppExports.R?
 
 Thanks.
 
 -- 
 Timothy H. Keitt
 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

___
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] exporting void test(void) function

2013-12-31 Thread Tim Keitt
On Mon, Dec 30, 2013 at 10:36 PM, Dirk Eddelbuettel e...@debian.org wrote:


 Hi Tim,

 Nice to see you here!


Nice to be here. Happy new year!



 On 30 December 2013 at 22:15, Tim Keitt wrote:
 | Apologies if this is the wrong list for user questions -- happy to be
 | redirected -- I did not see it immediately.

 And it is absolutely the right list: rcpp-devel as in our understanding
 'using' of Rcpp means developing with it.

 | Am I correct in noting that
 |
 | // [[Rcpp::export]]
 | void test(void)
 | {
 | // do something
 | }
 |
 | does not generate any code in RcppExports.R?

 Yes, 'void foo(void) { ... }' is a corner case that is not well covered by
 Rcpp Attributes. At the end of the day, we always convert into 'SEXP
 .Call(foo, SEXP a, SEXP b, ...)' so the args in, result out structure is
 pretty tight.

 I have done 'bool foo(int ignoreme) { ... }'  to work around it, or just
 returned NULLs. If you write explicit converters (maybe by manually
 postprocessing what RcppExports.cpp has) you could approximate it (by
 adding
 the require input / output args later) but the main issue is that
 Attributes
 does not do it.  Maybe JJ will chime in with some comments.


I have

SEXP theFun(const char* ignored = dummy)
{
  // do something
  return R_NilValue;
}

Wasn't sure if I'd missed something; thanks for the clarification.

THK


 Cheers, Dirk

 --
 Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com




-- 
Timothy H. Keitt
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] exporting void test(void) function

2013-12-31 Thread JJ Allaire

 Am I correct in noting that

 // [[Rcpp::export]]
 void test(void)
 {
 // do something
 }

 does not generate any code in RcppExports.R?


The problem occurs because the attributes parser doesn't know what to do
with the void argument specification. If you declare the function with no
argument specification at all then the function will be handled correctly
in RcppExports.R, e.g.

// [[Rcpp::export]]
void foo() {

}
___
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] exporting void test(void) function

2013-12-31 Thread Tim Keitt
On Tue, Dec 31, 2013 at 1:45 PM, JJ Allaire jj.alla...@gmail.com wrote:

 Am I correct in noting that

 // [[Rcpp::export]]
 void test(void)
 {
 // do something
 }

 does not generate any code in RcppExports.R?


 The problem occurs because the attributes parser doesn't know what to do
 with the void argument specification. If you declare the function with no
 argument specification at all then the function will be handled correctly
 in RcppExports.R, e.g.

 // [[Rcpp::export]]
 void foo() {

 }


Thanks. Thought I had tried it both ways, but I'll take your word for it.

THK


-- 
Timothy H. Keitt
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

[Rcpp-devel] exporting void test(void) function

2013-12-30 Thread Tim Keitt
Apologies if this is the wrong list for user questions -- happy to be
redirected -- I did not see it immediately.

Am I correct in noting that

// [[Rcpp::export]]
void test(void)
{
// do something
}

does not generate any code in RcppExports.R?

Thanks.

-- 
Timothy H. Keitt
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] exporting void test(void) function

2013-12-30 Thread Dirk Eddelbuettel

Hi Tim,

Nice to see you here!  

On 30 December 2013 at 22:15, Tim Keitt wrote:
| Apologies if this is the wrong list for user questions -- happy to be
| redirected -- I did not see it immediately.

And it is absolutely the right list: rcpp-devel as in our understanding
'using' of Rcpp means developing with it.
 
| Am I correct in noting that
| 
| // [[Rcpp::export]]
| void test(void)
| {
|     // do something
| }
| 
| does not generate any code in RcppExports.R?

Yes, 'void foo(void) { ... }' is a corner case that is not well covered by
Rcpp Attributes. At the end of the day, we always convert into 'SEXP
.Call(foo, SEXP a, SEXP b, ...)' so the args in, result out structure is
pretty tight.

I have done 'bool foo(int ignoreme) { ... }'  to work around it, or just
returned NULLs. If you write explicit converters (maybe by manually
postprocessing what RcppExports.cpp has) you could approximate it (by adding
the require input / output args later) but the main issue is that Attributes
does not do it.  Maybe JJ will chime in with some comments.

Cheers, 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