fixes for the except/callback attributes to follow new flag feature convention

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7604 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-10-07 13:17:41 +00:00
commit bab11e11f4
3 changed files with 14 additions and 18 deletions

View file

@ -453,7 +453,7 @@ void emit_action(Node *n, Wrapper *f) {
/* Look for except feature */ /* Look for except feature */
if (!tm) { if (!tm) {
tm = Getattr(n,"feature:except"); tm = GetFlagAttr(n,"feature:except");
if (tm) tm = Copy(tm); if (tm) tm = Copy(tm);
} }
if ((tm) && Len(tm) && (Strcmp(tm,"1") != 0)) { if ((tm) && Len(tm) && (Strcmp(tm,"1") != 0)) {

View file

@ -937,7 +937,7 @@ Language::globalfunctionHandler(Node *n) {
return SWIG_NOWRAP; /* Can't wrap static functions */ return SWIG_NOWRAP; /* Can't wrap static functions */
} else { } else {
/* Check for callback mode */ /* Check for callback mode */
String *cb = Getattr(n,"feature:callback"); String *cb = GetFlagAttr(n,"feature:callback");
if (cb) { if (cb) {
String *cbname = Getattr(n,"feature:callback:name"); String *cbname = Getattr(n,"feature:callback:name");
if (!cbname) { if (!cbname) {
@ -972,7 +972,7 @@ Language::callbackfunctionHandler(Node *n) {
String *type = Getattr(n,"type"); String *type = Getattr(n,"type");
String *name = Getattr(n,"name"); String *name = Getattr(n,"name");
String *parms = Getattr(n,"parms"); 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 *cbname = Getattr(n,"feature:callback:name");
String *calltype= NewStringf("(%s (*)(%s))(%s)", SwigType_str(type,0), ParmList_str(parms), SwigType_namestr(name)); String *calltype= NewStringf("(%s (*)(%s))(%s)", SwigType_str(type,0), ParmList_str(parms), SwigType_namestr(name));
SwigType *cbty = Copy(type); SwigType *cbty = Copy(type);
@ -1013,7 +1013,7 @@ Language::memberfunctionHandler(Node *n) {
SwigType *type = Getattr(n,"type"); SwigType *type = Getattr(n,"type");
String *value = Getattr(n,"value"); String *value = Getattr(n,"value");
ParmList *parms = Getattr(n,"parms"); ParmList *parms = Getattr(n,"parms");
String *cb = Getattr(n,"feature:callback"); String *cb = GetFlagAttr(n,"feature:callback");
if (Cmp(storage,"virtual") == 0) { if (Cmp(storage,"virtual") == 0) {
if (Cmp(value,"0") == 0) { if (Cmp(value,"0") == 0) {
@ -1084,7 +1084,7 @@ Language::staticmemberfunctionHandler(Node *n) {
String *symname = Getattr(n,"sym:name"); String *symname = Getattr(n,"sym:name");
SwigType *type = Getattr(n,"type"); SwigType *type = Getattr(n,"type");
ParmList *parms = Getattr(n,"parms"); ParmList *parms = Getattr(n,"parms");
String *cb = Getattr(n,"feature:callback"); String *cb = GetFlagAttr(n,"feature:callback");
String *cname, *mrename; String *cname, *mrename;
if (!Extend) { if (!Extend) {
@ -1201,7 +1201,7 @@ Language::membervariableHandler(Node *n) {
*/ */
if (!(Extend | SmartPointer) && (!GetFlag(n,"feature:allowexcept"))) { if (!(Extend | SmartPointer) && (!GetFlag(n,"feature:allowexcept"))) {
Delattr(n,"feature:except"); UnsetFlag(n,"feature:except");
} }
if (!AttributeFunctionGet) { if (!AttributeFunctionGet) {

View file

@ -1057,7 +1057,7 @@ public:
else else
Printf(methods,"\t { (char *)\"%s\", (PyCFunction) %s, METH_VARARGS | METH_KEYWORDS, ", name, function); 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)) { if (have_docstring(n)) {
String* ds = docstring(n, AUTODOC_FUNC, "", false); String* ds = docstring(n, AUTODOC_FUNC, "", false);
Replaceall(ds, "\n", "\\n"); Replaceall(ds, "\n", "\\n");
@ -1954,10 +1954,6 @@ public:
have_constructor = 0; have_constructor = 0;
have_repr = 0; have_repr = 0;
if (GetFlag(n,"feature:exceptionclass")) {
classic = 1;
modern = 0;
}
if (GetFlag(n,"feature:classic")) { if (GetFlag(n,"feature:classic")) {
classic = 1; classic = 1;
modern = 0; modern = 0;
@ -1966,6 +1962,10 @@ public:
classic = 0; classic = 0;
modern = 1; modern = 1;
} }
if (GetFlag(n,"feature:exceptionclass")) {
classic = 1;
modern = 0;
}
shadow_indent = (String *) tab4; shadow_indent = (String *) tab4;
@ -2147,16 +2147,12 @@ public:
* ------------------------------------------------------------ */ * ------------------------------------------------------------ */
virtual int functionHandler(Node *n) { virtual int functionHandler(Node *n) {
String *pcb = Getattr(n,"feature:python:callback"); String *pcb = GetFlagAttr(n,"feature:python:callback");
if (pcb && (Strcmp(pcb,"0") == 0)) {
Setattr(n,"feature:python:callback","");
pcb = 0;
}
if (pcb) { if (pcb) {
if (Strcmp(pcb,"1") == 0) { if (Strcmp(pcb,"1") == 0) {
Setattr(n,"feature:callback","%s_cb_ptr"); SetFlagAttr(n,"feature:callback","%s_cb_ptr");
} else { } else {
Setattr(n,"feature:callback",pcb); SetFlagAttr(n,"feature:callback",pcb);
} }
autodoc_l dlevel = autodoc_level(Getattr(n, "feature:autodoc")); autodoc_l dlevel = autodoc_level(Getattr(n, "feature:autodoc"));
if (dlevel != NO_AUTODOC && dlevel > TYPES_AUTODOC) { if (dlevel != NO_AUTODOC && dlevel > TYPES_AUTODOC) {