Skip to content

Commit

Permalink
fixes for the except/callback attributes to follow new flag feature c…
Browse files Browse the repository at this point in the history
…onvention

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7604 626c5289-ae23-0410-ae9c-e8d60b6d4f22
  • Loading branch information
Marcelo Matus committed Oct 7, 2005
1 parent deba68d commit bab11e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Source/Modules/emit.cxx
Expand Up @@ -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)) {
Expand Down
10 changes: 5 additions & 5 deletions Source/Modules/lang.cxx
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
20 changes: 8 additions & 12 deletions Source/Modules/python.cxx
Expand Up @@ -1057,7 +1057,7 @@ class PYTHON : public Language {
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");
Expand Down Expand Up @@ -1954,10 +1954,6 @@ class PYTHON : public Language {
have_constructor = 0;
have_repr = 0;

if (GetFlag(n,"feature:exceptionclass")) {
classic = 1;
modern = 0;
}
if (GetFlag(n,"feature:classic")) {
classic = 1;
modern = 0;
Expand All @@ -1966,6 +1962,10 @@ class PYTHON : public Language {
classic = 0;
modern = 1;
}
if (GetFlag(n,"feature:exceptionclass")) {
classic = 1;
modern = 0;
}

shadow_indent = (String *) tab4;

Expand Down Expand Up @@ -2147,16 +2147,12 @@ class PYTHON : public Language {
* ------------------------------------------------------------ */

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) {
Expand Down

0 comments on commit bab11e1

Please sign in to comment.