From fd9db14a98ac8be4f1d8d1734972af3658bc28d2 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Fri, 7 Oct 2005 13:17:41 +0000 Subject: [PATCH] fixes for the except/callback attributes to follow new flag feature convention git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7604 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Modules/emit.cxx | 2 +- SWIG/Source/Modules/lang.cxx | 10 +++++----- SWIG/Source/Modules/python.cxx | 20 ++++++++------------ 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/SWIG/Source/Modules/emit.cxx b/SWIG/Source/Modules/emit.cxx index 8de4f42d3..aa03a6308 100644 --- a/SWIG/Source/Modules/emit.cxx +++ b/SWIG/Source/Modules/emit.cxx @@ -453,7 +453,7 @@ void emit_action(Node *n, Wrapper *f) { /* Look for except feature */ if (!tm) { - tm = Getattr(n,"feature:except"); + tm = GetFlagAttr(n,"feature:except"); if (tm) tm = Copy(tm); } if ((tm) && Len(tm) && (Strcmp(tm,"1") != 0)) { diff --git a/SWIG/Source/Modules/lang.cxx b/SWIG/Source/Modules/lang.cxx index 847596054..92ba9b579 100644 --- a/SWIG/Source/Modules/lang.cxx +++ b/SWIG/Source/Modules/lang.cxx @@ -937,7 +937,7 @@ Language::globalfunctionHandler(Node *n) { return SWIG_NOWRAP; /* Can't wrap static functions */ } else { /* Check for callback mode */ - String *cb = Getattr(n,"feature:callback"); + String *cb = GetFlagAttr(n,"feature:callback"); if (cb) { String *cbname = Getattr(n,"feature:callback:name"); if (!cbname) { @@ -972,7 +972,7 @@ Language::callbackfunctionHandler(Node *n) { String *type = Getattr(n,"type"); String *name = Getattr(n,"name"); String *parms = Getattr(n,"parms"); - String *cb = Getattr(n,"feature:callback"); + String *cb = GetFlagAttr(n,"feature:callback"); String *cbname = Getattr(n,"feature:callback:name"); String *calltype= NewStringf("(%s (*)(%s))(%s)", SwigType_str(type,0), ParmList_str(parms), SwigType_namestr(name)); SwigType *cbty = Copy(type); @@ -1013,7 +1013,7 @@ Language::memberfunctionHandler(Node *n) { SwigType *type = Getattr(n,"type"); String *value = Getattr(n,"value"); ParmList *parms = Getattr(n,"parms"); - String *cb = Getattr(n,"feature:callback"); + String *cb = GetFlagAttr(n,"feature:callback"); if (Cmp(storage,"virtual") == 0) { if (Cmp(value,"0") == 0) { @@ -1084,7 +1084,7 @@ Language::staticmemberfunctionHandler(Node *n) { String *symname = Getattr(n,"sym:name"); SwigType *type = Getattr(n,"type"); ParmList *parms = Getattr(n,"parms"); - String *cb = Getattr(n,"feature:callback"); + String *cb = GetFlagAttr(n,"feature:callback"); String *cname, *mrename; if (!Extend) { @@ -1201,7 +1201,7 @@ Language::membervariableHandler(Node *n) { */ if (!(Extend | SmartPointer) && (!GetFlag(n,"feature:allowexcept"))) { - Delattr(n,"feature:except"); + UnsetFlag(n,"feature:except"); } if (!AttributeFunctionGet) { diff --git a/SWIG/Source/Modules/python.cxx b/SWIG/Source/Modules/python.cxx index b211f5899..48e80ddf8 100644 --- a/SWIG/Source/Modules/python.cxx +++ b/SWIG/Source/Modules/python.cxx @@ -1057,7 +1057,7 @@ public: else Printf(methods,"\t { (char *)\"%s\", (PyCFunction) %s, METH_VARARGS | METH_KEYWORDS, ", name, function); - if (n && Getattr(n,"feature:callback")) { + if (n && GetFlag(n,"feature:callback")) { if (have_docstring(n)) { String* ds = docstring(n, AUTODOC_FUNC, "", false); Replaceall(ds, "\n", "\\n"); @@ -1954,10 +1954,6 @@ public: have_constructor = 0; have_repr = 0; - if (GetFlag(n,"feature:exceptionclass")) { - classic = 1; - modern = 0; - } if (GetFlag(n,"feature:classic")) { classic = 1; modern = 0; @@ -1966,6 +1962,10 @@ public: classic = 0; modern = 1; } + if (GetFlag(n,"feature:exceptionclass")) { + classic = 1; + modern = 0; + } shadow_indent = (String *) tab4; @@ -2147,16 +2147,12 @@ public: * ------------------------------------------------------------ */ virtual int functionHandler(Node *n) { - String *pcb = Getattr(n,"feature:python:callback"); - if (pcb && (Strcmp(pcb,"0") == 0)) { - Setattr(n,"feature:python:callback",""); - pcb = 0; - } + String *pcb = GetFlagAttr(n,"feature:python:callback"); if (pcb) { if (Strcmp(pcb,"1") == 0) { - Setattr(n,"feature:callback","%s_cb_ptr"); + SetFlagAttr(n,"feature:callback","%s_cb_ptr"); } else { - Setattr(n,"feature:callback",pcb); + SetFlagAttr(n,"feature:callback",pcb); } autodoc_l dlevel = autodoc_level(Getattr(n, "feature:autodoc")); if (dlevel != NO_AUTODOC && dlevel > TYPES_AUTODOC) {