moves perl space constructor fixups into wrapper code.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10747 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
2728e5a606
commit
93652cdc70
1 changed files with 23 additions and 15 deletions
|
|
@ -589,7 +589,7 @@ public:
|
||||||
NIL);
|
NIL);
|
||||||
|
|
||||||
num_implicits = 0;
|
num_implicits = 0;
|
||||||
if(outer) {
|
if (outer) {
|
||||||
Parm *tmp = outer;
|
Parm *tmp = outer;
|
||||||
Parm *tail;
|
Parm *tail;
|
||||||
while(tmp) {
|
while(tmp) {
|
||||||
|
|
@ -633,7 +633,8 @@ public:
|
||||||
Printf(f->code, "%s = ST(%d);\n", pname, i++);
|
Printf(f->code, "%s = ST(%d);\n", pname, i++);
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
}
|
}
|
||||||
Printf(f->code, "ax += %d;\n", num_implicits);
|
if (l)
|
||||||
|
Printf(f->code, "ax += %d;\n", num_implicits);
|
||||||
}
|
}
|
||||||
/* Write code to extract parameters. */
|
/* Write code to extract parameters. */
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
@ -747,6 +748,9 @@ public:
|
||||||
Wrapper_add_localv(f, "_saved", "SV *", temp, NIL);
|
Wrapper_add_localv(f, "_saved", "SV *", temp, NIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (num_implicits && l)
|
||||||
|
Printf(f->code, "ax -= %d;\n", num_implicits);
|
||||||
|
|
||||||
/* Now write code to make the function call */
|
/* Now write code to make the function call */
|
||||||
|
|
||||||
Swig_director_emit_dynamic_cast(n, f);
|
Swig_director_emit_dynamic_cast(n, f);
|
||||||
|
|
@ -793,6 +797,11 @@ public:
|
||||||
Printf(f->code, "%s\n", tm);
|
Printf(f->code, "%s\n", tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (blessed && Equal(nodeType(n), "constructor")) {
|
||||||
|
Append(f->code,
|
||||||
|
"if (SvOK(ST(0))) sv_bless(ST(0), gv_stashsv(proto, 0));\n");
|
||||||
|
}
|
||||||
|
|
||||||
Printv(f->code, "XSRETURN(argvi);\n", "fail:\n", cleanup, "SWIG_croak_null();\n" "}\n" "}\n", NIL);
|
Printv(f->code, "XSRETURN(argvi);\n", "fail:\n", cleanup, "SWIG_croak_null();\n" "}\n" "}\n", NIL);
|
||||||
|
|
||||||
/* Add the dXSARGS last */
|
/* Add the dXSARGS last */
|
||||||
|
|
@ -824,7 +833,7 @@ public:
|
||||||
Printv(df->def, "XS(", dname, ") {\n", NIL);
|
Printv(df->def, "XS(", dname, ") {\n", NIL);
|
||||||
|
|
||||||
Wrapper_add_local(df, "dXSARGS", "dXSARGS");
|
Wrapper_add_local(df, "dXSARGS", "dXSARGS");
|
||||||
if(num_implicits) {
|
if (num_implicits) {
|
||||||
Printf(df->code, "ax += %d;\n", num_implicits);
|
Printf(df->code, "ax += %d;\n", num_implicits);
|
||||||
Printf(df->code, "items -= %d;\n", num_implicits);
|
Printf(df->code, "items -= %d;\n", num_implicits);
|
||||||
}
|
}
|
||||||
|
|
@ -1081,7 +1090,7 @@ public:
|
||||||
SwigType *pt = Getattr(p, "type");
|
SwigType *pt = Getattr(p, "type");
|
||||||
String *pn = Getattr(p, "name");
|
String *pn = Getattr(p, "name");
|
||||||
if (!checkAttribute(p,"tmap:in:numinputs","0")) {
|
if (!checkAttribute(p,"tmap:in:numinputs","0")) {
|
||||||
if(i > 0) Append(temp, ",");
|
if (i > 0) Append(temp, ",");
|
||||||
/* If parameter has been named, use that. Otherwise, just print a type */
|
/* If parameter has been named, use that. Otherwise, just print a type */
|
||||||
if (SwigType_type(pt) != T_VOID) {
|
if (SwigType_type(pt) != T_VOID) {
|
||||||
if (Len(pn) > 0) {
|
if (Len(pn) > 0) {
|
||||||
|
|
@ -1536,17 +1545,16 @@ public:
|
||||||
Delete(plaction);
|
Delete(plaction);
|
||||||
Printv(pcode, plcode, NIL);
|
Printv(pcode, plcode, NIL);
|
||||||
} else {
|
} else {
|
||||||
if ((Cmp(symname, class_name) == 0)) {
|
/* Emit a blessed constructor */
|
||||||
/* Emit a blessed constructor */
|
String *cname = Swig_name_construct(symname);
|
||||||
Printf(pcode, "sub new {\n");
|
char *pname;
|
||||||
} else {
|
/* override Class->Class to be Class->new */
|
||||||
/* Constructor doesn't match classname so we'll just use the normal name */
|
if (Cmp(symname, class_name) == 0)
|
||||||
Printv(pcode, "sub ", Swig_name_construct(symname), " () {\n", NIL);
|
pname = "new";
|
||||||
}
|
else
|
||||||
|
pname = Char(cname);
|
||||||
Printv(pcode,
|
Printf(pcode, "*%s = *%s::%s;\n", pname, cmodule, cname);
|
||||||
tab4, "my $pkg = $_[0];\n",
|
Delete(cname);
|
||||||
tab4, "my $self = ", cmodule, "::", Swig_name_construct(symname), "(@_);\n", tab4, "bless $self, $pkg if defined($self);\n", "}\n\n", NIL);
|
|
||||||
|
|
||||||
have_constructor = 1;
|
have_constructor = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue