From 656cb7ab06a214474567e3a46e2dc0aca4b98f40 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 30 Sep 2005 22:10:17 +0000 Subject: [PATCH] Modify following features to work as flags, so that they can be truely set and unset: new git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7564 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/chicken.cxx | 4 ++-- Source/Modules/csharp.cxx | 10 +++++----- Source/Modules/guile.cxx | 4 ++-- Source/Modules/java.cxx | 6 +++--- Source/Modules/lang.cxx | 2 +- Source/Modules/lua.cxx | 4 ++-- Source/Modules/modula3.cxx | 12 ++++++------ Source/Modules/mzscheme.cxx | 4 ++-- Source/Modules/ocaml.cxx | 4 ++-- Source/Modules/perl5.cxx | 4 ++-- Source/Modules/php4.cxx | 2 +- Source/Modules/pike.cxx | 4 ++-- Source/Modules/python.cxx | 4 ++-- Source/Modules/ruby.cxx | 4 ++-- Source/Modules/tcl8.cxx | 4 ++-- 15 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Source/Modules/chicken.cxx b/Source/Modules/chicken.cxx index 2735e6058..dc62905f1 100644 --- a/Source/Modules/chicken.cxx +++ b/Source/Modules/chicken.cxx @@ -551,7 +551,7 @@ CHICKEN::functionWrapper(Node *n) Replaceall(tm,"$source", "result"); Replaceall(tm,"$target", "resultobj"); Replaceall(tm,"$result", "resultobj"); - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { Replaceall(tm,"$owner","1"); } else { Replaceall(tm,"$owner","0"); @@ -586,7 +586,7 @@ CHICKEN::functionWrapper(Node *n) Printv(f->code,cleanup,NIL); /* Look to see if there is any newfree cleanup code */ - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { Replaceall(tm,"$source","result"); Printf(f->code,"%s\n",tm); diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index 4fdd64988..d73aaea09 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -704,7 +704,7 @@ class CSHARP : public Language { Printv(f->code,cleanup,NIL); /* Look to see if there is any newfree cleanup code */ - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { canThrow(n, "newfree", n); Replaceall(tm,"$source","result"); /* deprecated */ @@ -1663,7 +1663,7 @@ class CSHARP : public Language { // Transform return type used in PInvoke function (in intermediary class) to type used in C# wrapper function (in proxy class) if ((tm = Swig_typemap_lookup_new("csout",n,"",0))) { - if (Getattr(n,"feature:new")) + if (GetFlag(n,"feature:new")) Replaceall(tm,"$owner","true"); else Replaceall(tm,"$owner","false"); @@ -1719,7 +1719,7 @@ class CSHARP : public Language { } else { // Getter method if ((tm = Swig_typemap_lookup_new("csvarout",n,"",0))) { - if (Getattr(n,"feature:new")) + if (GetFlag(n,"feature:new")) Replaceall(tm,"$owner","true"); else Replaceall(tm,"$owner","false"); @@ -2070,7 +2070,7 @@ class CSHARP : public Language { // Transform return type used in PInvoke function (in intermediary class) to type used in C# wrapper function (in module class) if ((tm = Swig_typemap_lookup_new("csout",n,"",0))) { - if (Getattr(n,"feature:new")) + if (GetFlag(n,"feature:new")) Replaceall(tm,"$owner","true"); else Replaceall(tm,"$owner","false"); @@ -2125,7 +2125,7 @@ class CSHARP : public Language { } else { // Getter method if ((tm = Swig_typemap_lookup_new("csvarout",n,"",0))) { - if (Getattr(n,"feature:new")) + if (GetFlag(n,"feature:new")) Replaceall(tm,"$owner","true"); else Replaceall(tm,"$owner","false"); diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx index 8a2f7af82..83f1a9feb 100644 --- a/Source/Modules/guile.cxx +++ b/Source/Modules/guile.cxx @@ -947,7 +947,7 @@ public: Replaceall(tm,"$result","gswig_result"); Replaceall(tm,"$target","gswig_result"); Replaceall(tm,"$source","result"); - if (Getattr(n, "feature:new")) + if (GetFlag(n, "feature:new")) Replaceall(tm, "$owner", "1"); else Replaceall(tm, "$owner", "0"); @@ -965,7 +965,7 @@ public: // Look for any remaining cleanup - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { Replaceall(tm,"$source","result"); Printv(f->code,tm,"\n",NIL); diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index fbec6641d..6d87513b5 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -938,7 +938,7 @@ class JAVA : public Language { Printv(f->code,cleanup,NIL); /* Look to see if there is any newfree cleanup code */ - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { addThrows(n, "tmap:newfree", n); Replaceall(tm,"$source","result"); /* deprecated */ @@ -1929,7 +1929,7 @@ class JAVA : public Language { // Transform return type used in JNI function (in intermediary class) to type used in Java wrapper function (in proxy class) if ((tm = Swig_typemap_lookup_new("javaout",n,"",0))) { addThrows(n, "tmap:javaout", n); - if (Getattr(n,"feature:new")) + if (GetFlag(n,"feature:new")) Replaceall(tm,"$owner","true"); else Replaceall(tm,"$owner","false"); @@ -2273,7 +2273,7 @@ class JAVA : public Language { // Transform return type used in JNI function (in intermediary class) to type used in Java wrapper function (in module class) if ((tm = Swig_typemap_lookup_new("javaout",n,"",0))) { addThrows(n, "tmap:javaout", n); - if (Getattr(n,"feature:new")) + if (GetFlag(n,"feature:new")) Replaceall(tm,"$owner","true"); else Replaceall(tm,"$owner","false"); diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index 767cc508a..10d31548c 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -2008,7 +2008,7 @@ static Node *makeConstructor(Node *n) } String *lname = Swig_scopename_last(name); Append(dname,lname); - Setattr(cn,"feature:new","1"); + SetFlag(cn,"feature:new"); Setattr(cn,"decl","f()."); Swig_features_get(Swig_cparse_features(), 0, dname, Getattr(cn,"decl"), cn); Delete(rname); diff --git a/Source/Modules/lua.cxx b/Source/Modules/lua.cxx index 005a5d72d..3e67f8050 100644 --- a/Source/Modules/lua.cxx +++ b/Source/Modules/lua.cxx @@ -507,7 +507,7 @@ NEW LANGUAGE NOTE:END ************************************************/ // } // else returnval++; Replaceall(tm,"$source", "result"); - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { Replaceall(tm,"$owner","1"); } else { Replaceall(tm,"$owner","0"); @@ -526,7 +526,7 @@ NEW LANGUAGE NOTE:END ************************************************/ Printv(f->code,cleanup,NIL); /* Look to see if there is any newfree cleanup code */ - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { Replaceall(tm,"$source","result"); Printf(f->code,"%s\n",tm); diff --git a/Source/Modules/modula3.cxx b/Source/Modules/modula3.cxx index 4c1b35a2f..1421d9eca 100644 --- a/Source/Modules/modula3.cxx +++ b/Source/Modules/modula3.cxx @@ -1537,7 +1537,7 @@ MODULA3 (): Printv (f->code, cleanup, NIL); /* Look to see if there is any newfree cleanup code */ - if (Getattr (n, "feature:new")) { + if (GetFlag (n, "feature:new")) { String *tm = Swig_typemap_lookup_new ("newfree", n, "result", 0); if (tm != NIL) { addThrows (throws_hash, "newfree", n); @@ -2987,7 +2987,7 @@ MODULA3 (): // Transform return type used in PInvoke function (in intermediary class) to type used in Modula 3 wrapper function (in proxy class) if ((tm = getMappedTypeNew (n, "m3out", ""))) { addThrows (throws_hash, "m3out", n); - if (Getattr (n, "feature:new")) + if (GetFlag (n, "feature:new")) Replaceall (tm, "$owner", "true"); else Replaceall (tm, "$owner", "false"); @@ -3004,7 +3004,7 @@ MODULA3 (): if (setter_flag) { // Setter method if ((tm = getMappedTypeNew (n, "m3varin", ""))) { - if (Getattr (n, "feature:new")) + if (GetFlag (n, "feature:new")) Replaceall (tm, "$owner", "true"); else Replaceall (tm, "$owner", "false"); @@ -3015,7 +3015,7 @@ MODULA3 (): } else { // Getter method if ((tm = getMappedTypeNew (n, "m3varout", ""))) { - if (Getattr (n, "feature:new")) + if (GetFlag (n, "feature:new")) Replaceall (tm, "$owner", "true"); else Replaceall (tm, "$owner", "false"); @@ -3768,7 +3768,7 @@ MODULA3 (): // Setter method String *tm = getMappedTypeNew (n, "m3varin", ""); if (tm != NIL) { - if (Getattr (n, "feature:new")) { + if (GetFlag (n, "feature:new")) { Replaceall (tm, "$owner", "true"); } else { Replaceall (tm, "$owner", "false"); @@ -3783,7 +3783,7 @@ MODULA3 (): // Getter method String *tm = getMappedTypeNew (n, "m3varout", ""); if (tm != NIL) { - if (Getattr (n, "feature:new")) + if (GetFlag (n, "feature:new")) Replaceall (tm, "$owner", "true"); else Replaceall (tm, "$owner", "false"); diff --git a/Source/Modules/mzscheme.cxx b/Source/Modules/mzscheme.cxx index c5e7ebea9..738ea7c36 100644 --- a/Source/Modules/mzscheme.cxx +++ b/Source/Modules/mzscheme.cxx @@ -366,7 +366,7 @@ public: Replaceall(tm,"$source","result"); Replaceall(tm,"$target","values[0]"); Replaceall(tm,"$result","values[0]"); - if (Getattr(n, "feature:new")) + if (GetFlag(n, "feature:new")) Replaceall(tm, "$owner", "1"); else Replaceall(tm, "$owner", "0"); @@ -383,7 +383,7 @@ public: // Look for any remaining cleanup - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { Replaceall(tm,"$source","result"); Printv(f->code, tm, "\n",NIL); diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index 68dd10c0a..a5be7f582 100755 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -472,7 +472,7 @@ public: int i = 0; int numargs; int numreq; - int newobj = Getattr(n,"feature:new") ? 1 : 0; + int newobj = GetFlag(n,"feature:new"); String *nodeType = Getattr(n, "nodeType"); int constructor = !Cmp(nodeType, "constructor"); int destructor = (!Cmp(nodeType, "destructor")); @@ -734,7 +734,7 @@ public: // Look for any remaining cleanup - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { Replaceall(tm,"$source","swig_result"); Printv(f->code, tm, "\n",NIL); diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx index 7ff1cd921..10006ffdd 100644 --- a/Source/Modules/perl5.cxx +++ b/Source/Modules/perl5.cxx @@ -654,7 +654,7 @@ public: } else { Replaceall(tm, "$shadow", "0"); } - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { Replaceall(tm,"$owner","SWIG_OWNER"); } else { Replaceall(tm,"$owner","0"); @@ -673,7 +673,7 @@ public: Printv(f->code,cleanup,NIL); - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { Replaceall(tm,"$source","result"); Printf(f->code,"%s\n",tm); diff --git a/Source/Modules/php4.cxx b/Source/Modules/php4.cxx index 669b513cd..989f046f2 100644 --- a/Source/Modules/php4.cxx +++ b/Source/Modules/php4.cxx @@ -886,7 +886,7 @@ public: SwigType *d = Getattr(n,"type"); ParmList *l = Getattr(n,"parms"); String *nodeType = Getattr(n, "nodeType"); - int newobject = (Getattr(n,"feature:new"))?1:0; + int newobject = GetFlag(n,"feature:new"); Parm *p; char source[256]; diff --git a/Source/Modules/pike.cxx b/Source/Modules/pike.cxx index e666e63d5..9e940af8e 100644 --- a/Source/Modules/pike.cxx +++ b/Source/Modules/pike.cxx @@ -408,7 +408,7 @@ public: Replaceall(tm,"$source", "result"); Replaceall(tm,"$target", "resultobj"); Replaceall(tm,"$result", "resultobj"); - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { Replaceall(tm,"$owner","1"); } else { Replaceall(tm,"$owner","0"); @@ -431,7 +431,7 @@ public: Printv(f->code,cleanup,NIL); /* Look to see if there is any newfree cleanup code */ - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { Replaceall(tm,"$source","result"); Printf(f->code,"%s\n",tm); diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 2a013ee5e..9d8b5abf0 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -1445,7 +1445,7 @@ public: Replaceall(tm,"$source", "result"); Replaceall(tm,"$target", "resultobj"); Replaceall(tm,"$result", "resultobj"); - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { Replaceall(tm,"$owner","1"); } else { Replaceall(tm,"$owner","0"); @@ -1493,7 +1493,7 @@ public: Printv(f->code,cleanup,NIL); /* Look to see if there is any newfree cleanup code */ - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { Replaceall(tm,"$source","result"); Printf(f->code,"%s\n",tm); diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index ca39b2c48..e6e83b4d1 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -1233,7 +1233,7 @@ public: Replaceall(tm,"$source","result"); Replaceall(tm,"$target","vresult"); - if (Getattr(n, "feature:new")) + if (GetFlag(n, "feature:new")) Replaceall(tm,"$owner", "1"); else Replaceall(tm,"$owner", "0"); @@ -1296,7 +1296,7 @@ public: Printv(f->code,cleanup,NIL); /* Look for any remaining cleanup. This processes the %new directive */ - if (current != CONSTRUCTOR_ALLOCATE && Getattr(n, "feature:new")) { + if (current != CONSTRUCTOR_ALLOCATE && GetFlag(n, "feature:new")) { tm = Swig_typemap_lookup_new("newfree",n,"result",0); if (tm) { Replaceall(tm,"$source","result"); diff --git a/Source/Modules/tcl8.cxx b/Source/Modules/tcl8.cxx index d83b163eb..f3c5488ed 100644 --- a/Source/Modules/tcl8.cxx +++ b/Source/Modules/tcl8.cxx @@ -438,7 +438,7 @@ public: Replaceall(tm,"$source", "result"); Replaceall(tm,"$target", "Tcl_GetObjResult(interp)"); Replaceall(tm,"$result", "Tcl_GetObjResult(interp)"); - if(Getattr(n,"feature:new")) { + if(GetFlag(n,"feature:new")) { Replaceall(tm,"$owner","1"); } else { Replaceall(tm,"$owner","0"); @@ -456,7 +456,7 @@ public: Printv(f->code,cleanup,NIL); /* Look for any remaining cleanup */ - if (Getattr(n,"feature:new")) { + if (GetFlag(n,"feature:new")) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) { Replaceall(tm,"$source","result"); Printf(f->code,"%s\n", tm);