change R components so that pointers are visible through ref

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13601 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Joseph Wang 2012-08-12 15:21:39 +00:00
commit fad95da7f5
2 changed files with 35 additions and 17 deletions

View file

@ -1891,6 +1891,9 @@ int R::functionWrapper(Node *n) {
if(nargs == -1)
nargs = getFunctionPointerNumArgs(p, tt);
Printv(sfun->code, "if (.hasSlot(", name, ", \"ref\")) {\n",
name, " = slot(", name, ", \"ref\");\n",
"}\n", NIL);
String *snargs = NewStringf("%d", nargs);
Printv(sfun->code, "if(is.function(", name, ")) {", "\n",
"assert('...' %in% names(formals(", name,
@ -2112,7 +2115,8 @@ int R::functionWrapper(Node *n) {
{
String *finalizer = NewString(iname);
Replace(finalizer, "new_", "", DOH_REPLACE_FIRST);
Printf(sfun->code, "reg.finalizer(ans, delete_%s)\n", finalizer);
Printf(sfun->code, "if (.hasSlot(ans, \"ref\")) {\n"
"reg.finalizer(ans@ref, delete_%s); }\n", finalizer);
}
Printf(sfun->code, "ans\n");
}