On Sat, 2008-04-26 at 15:43 -0400, Joseph Wang wrote:
> On Saturday 26 April 2008 04:57:26 am Soeren Sonnenburg wrote:
[...]
> > Also what about the dispatcher? Any ideas on how to better check if two
> > types are compatible (extends seems not be the right thing for numeric
> > types)...
>
> No ideas, but I'm interested in anything anyone else can think of.....
OK, I came up with a patch that solves this problem (for me):
I save the args in a argv list and if use is.numeric(argv[[1]]) for
numeric types ...
Another issue I've noticed is with 'garbage collection': There seems to
be a problem when I use
%feature("ref") and %feature("unref"), could it be a problem that the
C++ functions I've bound to this are named ref() and unref()?
Soeren
[r_cxx.diff]
Index: Source/Modules/r.cxx
===================================================================
--- Source/Modules/r.cxx (revision 10394)
+++ Source/Modules/r.cxx (working copy)
@@ -1604,6 +1604,7 @@
int nfunc = Len(dispatch);
Printv(f->code,
"argtypes <- mapply(class, list(...))\n",
+ "argv <- list(...)\n",
"argc <- length(argtypes)\n", NIL );
Printf(f->code, "# dispatch functions %d\n", nfunc);
@@ -1637,10 +1638,17 @@
if(tm) {
replaceRClass(tm, Getattr(p, "type"));
}
+ if (DohStrcmp(tm,"numeric")==0) {
+ Printf(f->code, "%sis.numeric(argv[[%d]])",
+ j == 0 ? "" : " && ",
+ j+1);
+ }
+ else {
Printf(f->code, "%sextends(argtypes[%d], '%s')",
j == 0 ? "" : " && ",
j+1,
tm);
+ }
p = Getattr(p, "tmap:in:next");
}
Printf(f->code, ") { f <- %s%s }\n", sfname, overname);
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user