fix for the typemap match option
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8108 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c524ada254
commit
88e6edcac3
7 changed files with 71 additions and 16 deletions
|
|
@ -1404,7 +1404,7 @@ public:
|
|||
const char *get_implicitconv_flag(Node *klass)
|
||||
{
|
||||
int conv = 0;
|
||||
if (klass && Getattr(klass,"feature:implicitconv")) {
|
||||
if (klass && GetFlag(klass,"feature:implicitconv")) {
|
||||
conv = 1;
|
||||
}
|
||||
return conv ? "SWIG_POINTER_IMPLICIT_CONV" : "0";
|
||||
|
|
@ -1537,9 +1537,12 @@ public:
|
|||
|
||||
if (constructor && num_arguments == 1 && num_required == 1) {
|
||||
if (Cmp(storage,"explicit") == 0) {
|
||||
String *desc = NewStringf("SWIGTYPE%s", SwigType_manglestr(Getattr(n,"type")));
|
||||
Printf(f->code, "if (SWIG_CheckImplicit(%s)) SWIG_fail;\n", desc);
|
||||
Delete(desc);
|
||||
Node *parent = Swig_methodclass(n);
|
||||
if (GetFlag(parent,"feature:implicitconv")) {
|
||||
String *desc = NewStringf("SWIGTYPE%s", SwigType_manglestr(Getattr(n,"type")));
|
||||
Printf(f->code, "if (SWIG_CheckImplicit(%s)) SWIG_fail;\n", desc);
|
||||
Delete(desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1703,9 +1706,19 @@ public:
|
|||
|
||||
/* Insert cleanup code */
|
||||
for (p = l; p;) {
|
||||
if (!checkAttribute(p,"tmap:in:numinputs","0") &&
|
||||
!Getattr(p,"tmap:in:parse") && (tm = Getattr(p,"tmap:freearg"))) {
|
||||
if (Len(tm) != 0) {
|
||||
if (!checkAttribute(p,"tmap:in:numinputs","0") && !Getattr(p,"tmap:in:parse")) {
|
||||
tm = Getattr(p,"tmap:freearg");
|
||||
if (Getattr(p,"tmap:freearg:implicitconv")) {
|
||||
const char *convflag = "0";
|
||||
if (!Getattr(p,"self")) {
|
||||
SwigType *ptype = Getattr(p,"type");
|
||||
convflag = get_implicitconv_flag(classLookup(ptype));
|
||||
}
|
||||
tm = (strcmp(convflag,"0") != 0) ? Getattr(p,"tmap:freearg") : 0;
|
||||
} else {
|
||||
tm = Getattr(p,"tmap:freearg");
|
||||
}
|
||||
if (tm && (Len(tm) != 0)) {
|
||||
Replaceall(tm,"$source",Getattr(p,"lname"));
|
||||
Printv(cleanup,tm,"\n",NIL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1421,6 +1421,9 @@ Swig_typemap_attach_kwargs(Hash *tm, const String_or_char *op, Parm *p) {
|
|||
Delete(value);
|
||||
kw = nextSibling(kw);
|
||||
}
|
||||
Clear(temp);
|
||||
Printf(temp,"%s:match_type",op);
|
||||
Setattr(p,tmop_name(temp),Getattr(tm,k_type));
|
||||
Delete(temp);
|
||||
}
|
||||
|
||||
|
|
@ -1507,8 +1510,31 @@ Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f)
|
|||
if (kwmatch) {
|
||||
String *tmname = NewStringf("tmap:%s",kwmatch);
|
||||
Hash *tmin = Getattr(p,tmname);
|
||||
if (!tmin || !Equal(Getattr(tmin,k_type),Getattr(tm,k_type))) {
|
||||
if (tmin) {
|
||||
SwigType *typetm = Getattr(tm,k_type);
|
||||
SwigType *typein = Getattr(tmin,k_type);
|
||||
if (!typein) {
|
||||
String *temp = NewStringf("tmap:%s:match_type",kwmatch);
|
||||
typein = Getattr(p,temp);
|
||||
Delete(temp);
|
||||
}
|
||||
if (!typetm) {
|
||||
Printf(stderr,"notm %s\n",tm);
|
||||
}
|
||||
|
||||
if (!typein) {
|
||||
Printf(stderr,"noin %s\n",tmin);
|
||||
}
|
||||
|
||||
if (!Equal(typein,typetm)) {
|
||||
Printf(stderr,"type in %s tm %s\n", typein, typetm);
|
||||
p = nextSibling(p);
|
||||
Delete(tmname);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
p = nextSibling(p);
|
||||
Delete(tmname);
|
||||
continue;
|
||||
}
|
||||
Delete(tmname);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue