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
This commit is contained in:
William S Fulton 2005-09-30 22:10:17 +00:00
commit 656cb7ab06
15 changed files with 36 additions and 36 deletions

View file

@ -551,7 +551,7 @@ CHICKEN::functionWrapper(Node *n)
Replaceall(tm,"$source", "result"); Replaceall(tm,"$source", "result");
Replaceall(tm,"$target", "resultobj"); Replaceall(tm,"$target", "resultobj");
Replaceall(tm,"$result", "resultobj"); Replaceall(tm,"$result", "resultobj");
if (Getattr(n,"feature:new")) { if (GetFlag(n,"feature:new")) {
Replaceall(tm,"$owner","1"); Replaceall(tm,"$owner","1");
} else { } else {
Replaceall(tm,"$owner","0"); Replaceall(tm,"$owner","0");
@ -586,7 +586,7 @@ CHICKEN::functionWrapper(Node *n)
Printv(f->code,cleanup,NIL); Printv(f->code,cleanup,NIL);
/* Look to see if there is any newfree cleanup code */ /* 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
Printf(f->code,"%s\n",tm); Printf(f->code,"%s\n",tm);

View file

@ -704,7 +704,7 @@ class CSHARP : public Language {
Printv(f->code,cleanup,NIL); Printv(f->code,cleanup,NIL);
/* Look to see if there is any newfree cleanup code */ /* 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
canThrow(n, "newfree", n); canThrow(n, "newfree", n);
Replaceall(tm,"$source","result"); /* deprecated */ 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) // 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 ((tm = Swig_typemap_lookup_new("csout",n,"",0))) {
if (Getattr(n,"feature:new")) if (GetFlag(n,"feature:new"))
Replaceall(tm,"$owner","true"); Replaceall(tm,"$owner","true");
else else
Replaceall(tm,"$owner","false"); Replaceall(tm,"$owner","false");
@ -1719,7 +1719,7 @@ class CSHARP : public Language {
} else { } else {
// Getter method // Getter method
if ((tm = Swig_typemap_lookup_new("csvarout",n,"",0))) { if ((tm = Swig_typemap_lookup_new("csvarout",n,"",0))) {
if (Getattr(n,"feature:new")) if (GetFlag(n,"feature:new"))
Replaceall(tm,"$owner","true"); Replaceall(tm,"$owner","true");
else else
Replaceall(tm,"$owner","false"); 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) // 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 ((tm = Swig_typemap_lookup_new("csout",n,"",0))) {
if (Getattr(n,"feature:new")) if (GetFlag(n,"feature:new"))
Replaceall(tm,"$owner","true"); Replaceall(tm,"$owner","true");
else else
Replaceall(tm,"$owner","false"); Replaceall(tm,"$owner","false");
@ -2125,7 +2125,7 @@ class CSHARP : public Language {
} else { } else {
// Getter method // Getter method
if ((tm = Swig_typemap_lookup_new("csvarout",n,"",0))) { if ((tm = Swig_typemap_lookup_new("csvarout",n,"",0))) {
if (Getattr(n,"feature:new")) if (GetFlag(n,"feature:new"))
Replaceall(tm,"$owner","true"); Replaceall(tm,"$owner","true");
else else
Replaceall(tm,"$owner","false"); Replaceall(tm,"$owner","false");

View file

@ -947,7 +947,7 @@ public:
Replaceall(tm,"$result","gswig_result"); Replaceall(tm,"$result","gswig_result");
Replaceall(tm,"$target","gswig_result"); Replaceall(tm,"$target","gswig_result");
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
if (Getattr(n, "feature:new")) if (GetFlag(n, "feature:new"))
Replaceall(tm, "$owner", "1"); Replaceall(tm, "$owner", "1");
else else
Replaceall(tm, "$owner", "0"); Replaceall(tm, "$owner", "0");
@ -965,7 +965,7 @@ public:
// Look for any remaining cleanup // 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
Printv(f->code,tm,"\n",NIL); Printv(f->code,tm,"\n",NIL);

View file

@ -938,7 +938,7 @@ class JAVA : public Language {
Printv(f->code,cleanup,NIL); Printv(f->code,cleanup,NIL);
/* Look to see if there is any newfree cleanup code */ /* 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
addThrows(n, "tmap:newfree", n); addThrows(n, "tmap:newfree", n);
Replaceall(tm,"$source","result"); /* deprecated */ 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) // 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))) { if ((tm = Swig_typemap_lookup_new("javaout",n,"",0))) {
addThrows(n, "tmap:javaout", n); addThrows(n, "tmap:javaout", n);
if (Getattr(n,"feature:new")) if (GetFlag(n,"feature:new"))
Replaceall(tm,"$owner","true"); Replaceall(tm,"$owner","true");
else else
Replaceall(tm,"$owner","false"); 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) // 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))) { if ((tm = Swig_typemap_lookup_new("javaout",n,"",0))) {
addThrows(n, "tmap:javaout", n); addThrows(n, "tmap:javaout", n);
if (Getattr(n,"feature:new")) if (GetFlag(n,"feature:new"))
Replaceall(tm,"$owner","true"); Replaceall(tm,"$owner","true");
else else
Replaceall(tm,"$owner","false"); Replaceall(tm,"$owner","false");

View file

@ -2008,7 +2008,7 @@ static Node *makeConstructor(Node *n)
} }
String *lname = Swig_scopename_last(name); String *lname = Swig_scopename_last(name);
Append(dname,lname); Append(dname,lname);
Setattr(cn,"feature:new","1"); SetFlag(cn,"feature:new");
Setattr(cn,"decl","f()."); Setattr(cn,"decl","f().");
Swig_features_get(Swig_cparse_features(), 0, dname, Getattr(cn,"decl"), cn); Swig_features_get(Swig_cparse_features(), 0, dname, Getattr(cn,"decl"), cn);
Delete(rname); Delete(rname);

View file

@ -507,7 +507,7 @@ NEW LANGUAGE NOTE:END ************************************************/
// } // }
// else returnval++; // else returnval++;
Replaceall(tm,"$source", "result"); Replaceall(tm,"$source", "result");
if (Getattr(n,"feature:new")) { if (GetFlag(n,"feature:new")) {
Replaceall(tm,"$owner","1"); Replaceall(tm,"$owner","1");
} else { } else {
Replaceall(tm,"$owner","0"); Replaceall(tm,"$owner","0");
@ -526,7 +526,7 @@ NEW LANGUAGE NOTE:END ************************************************/
Printv(f->code,cleanup,NIL); Printv(f->code,cleanup,NIL);
/* Look to see if there is any newfree cleanup code */ /* 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
Printf(f->code,"%s\n",tm); Printf(f->code,"%s\n",tm);

View file

@ -1537,7 +1537,7 @@ MODULA3 ():
Printv (f->code, cleanup, NIL); Printv (f->code, cleanup, NIL);
/* Look to see if there is any newfree cleanup code */ /* 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); String *tm = Swig_typemap_lookup_new ("newfree", n, "result", 0);
if (tm != NIL) { if (tm != NIL) {
addThrows (throws_hash, "newfree", n); 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) // 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", ""))) { if ((tm = getMappedTypeNew (n, "m3out", ""))) {
addThrows (throws_hash, "m3out", n); addThrows (throws_hash, "m3out", n);
if (Getattr (n, "feature:new")) if (GetFlag (n, "feature:new"))
Replaceall (tm, "$owner", "true"); Replaceall (tm, "$owner", "true");
else else
Replaceall (tm, "$owner", "false"); Replaceall (tm, "$owner", "false");
@ -3004,7 +3004,7 @@ MODULA3 ():
if (setter_flag) { if (setter_flag) {
// Setter method // Setter method
if ((tm = getMappedTypeNew (n, "m3varin", ""))) { if ((tm = getMappedTypeNew (n, "m3varin", ""))) {
if (Getattr (n, "feature:new")) if (GetFlag (n, "feature:new"))
Replaceall (tm, "$owner", "true"); Replaceall (tm, "$owner", "true");
else else
Replaceall (tm, "$owner", "false"); Replaceall (tm, "$owner", "false");
@ -3015,7 +3015,7 @@ MODULA3 ():
} else { } else {
// Getter method // Getter method
if ((tm = getMappedTypeNew (n, "m3varout", ""))) { if ((tm = getMappedTypeNew (n, "m3varout", ""))) {
if (Getattr (n, "feature:new")) if (GetFlag (n, "feature:new"))
Replaceall (tm, "$owner", "true"); Replaceall (tm, "$owner", "true");
else else
Replaceall (tm, "$owner", "false"); Replaceall (tm, "$owner", "false");
@ -3768,7 +3768,7 @@ MODULA3 ():
// Setter method // Setter method
String *tm = getMappedTypeNew (n, "m3varin", ""); String *tm = getMappedTypeNew (n, "m3varin", "");
if (tm != NIL) { if (tm != NIL) {
if (Getattr (n, "feature:new")) { if (GetFlag (n, "feature:new")) {
Replaceall (tm, "$owner", "true"); Replaceall (tm, "$owner", "true");
} else { } else {
Replaceall (tm, "$owner", "false"); Replaceall (tm, "$owner", "false");
@ -3783,7 +3783,7 @@ MODULA3 ():
// Getter method // Getter method
String *tm = getMappedTypeNew (n, "m3varout", ""); String *tm = getMappedTypeNew (n, "m3varout", "");
if (tm != NIL) { if (tm != NIL) {
if (Getattr (n, "feature:new")) if (GetFlag (n, "feature:new"))
Replaceall (tm, "$owner", "true"); Replaceall (tm, "$owner", "true");
else else
Replaceall (tm, "$owner", "false"); Replaceall (tm, "$owner", "false");

View file

@ -366,7 +366,7 @@ public:
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
Replaceall(tm,"$target","values[0]"); Replaceall(tm,"$target","values[0]");
Replaceall(tm,"$result","values[0]"); Replaceall(tm,"$result","values[0]");
if (Getattr(n, "feature:new")) if (GetFlag(n, "feature:new"))
Replaceall(tm, "$owner", "1"); Replaceall(tm, "$owner", "1");
else else
Replaceall(tm, "$owner", "0"); Replaceall(tm, "$owner", "0");
@ -383,7 +383,7 @@ public:
// Look for any remaining cleanup // 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
Printv(f->code, tm, "\n",NIL); Printv(f->code, tm, "\n",NIL);

View file

@ -472,7 +472,7 @@ public:
int i = 0; int i = 0;
int numargs; int numargs;
int numreq; int numreq;
int newobj = Getattr(n,"feature:new") ? 1 : 0; int newobj = GetFlag(n,"feature:new");
String *nodeType = Getattr(n, "nodeType"); String *nodeType = Getattr(n, "nodeType");
int constructor = !Cmp(nodeType, "constructor"); int constructor = !Cmp(nodeType, "constructor");
int destructor = (!Cmp(nodeType, "destructor")); int destructor = (!Cmp(nodeType, "destructor"));
@ -734,7 +734,7 @@ public:
// Look for any remaining cleanup // 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
Replaceall(tm,"$source","swig_result"); Replaceall(tm,"$source","swig_result");
Printv(f->code, tm, "\n",NIL); Printv(f->code, tm, "\n",NIL);

View file

@ -654,7 +654,7 @@ public:
} else { } else {
Replaceall(tm, "$shadow", "0"); Replaceall(tm, "$shadow", "0");
} }
if (Getattr(n,"feature:new")) { if (GetFlag(n,"feature:new")) {
Replaceall(tm,"$owner","SWIG_OWNER"); Replaceall(tm,"$owner","SWIG_OWNER");
} else { } else {
Replaceall(tm,"$owner","0"); Replaceall(tm,"$owner","0");
@ -673,7 +673,7 @@ public:
Printv(f->code,cleanup,NIL); 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
Printf(f->code,"%s\n",tm); Printf(f->code,"%s\n",tm);

View file

@ -886,7 +886,7 @@ public:
SwigType *d = Getattr(n,"type"); SwigType *d = Getattr(n,"type");
ParmList *l = Getattr(n,"parms"); ParmList *l = Getattr(n,"parms");
String *nodeType = Getattr(n, "nodeType"); String *nodeType = Getattr(n, "nodeType");
int newobject = (Getattr(n,"feature:new"))?1:0; int newobject = GetFlag(n,"feature:new");
Parm *p; Parm *p;
char source[256]; char source[256];

View file

@ -408,7 +408,7 @@ public:
Replaceall(tm,"$source", "result"); Replaceall(tm,"$source", "result");
Replaceall(tm,"$target", "resultobj"); Replaceall(tm,"$target", "resultobj");
Replaceall(tm,"$result", "resultobj"); Replaceall(tm,"$result", "resultobj");
if (Getattr(n,"feature:new")) { if (GetFlag(n,"feature:new")) {
Replaceall(tm,"$owner","1"); Replaceall(tm,"$owner","1");
} else { } else {
Replaceall(tm,"$owner","0"); Replaceall(tm,"$owner","0");
@ -431,7 +431,7 @@ public:
Printv(f->code,cleanup,NIL); Printv(f->code,cleanup,NIL);
/* Look to see if there is any newfree cleanup code */ /* 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
Printf(f->code,"%s\n",tm); Printf(f->code,"%s\n",tm);

View file

@ -1445,7 +1445,7 @@ public:
Replaceall(tm,"$source", "result"); Replaceall(tm,"$source", "result");
Replaceall(tm,"$target", "resultobj"); Replaceall(tm,"$target", "resultobj");
Replaceall(tm,"$result", "resultobj"); Replaceall(tm,"$result", "resultobj");
if (Getattr(n,"feature:new")) { if (GetFlag(n,"feature:new")) {
Replaceall(tm,"$owner","1"); Replaceall(tm,"$owner","1");
} else { } else {
Replaceall(tm,"$owner","0"); Replaceall(tm,"$owner","0");
@ -1493,7 +1493,7 @@ public:
Printv(f->code,cleanup,NIL); Printv(f->code,cleanup,NIL);
/* Look to see if there is any newfree cleanup code */ /* 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
Printf(f->code,"%s\n",tm); Printf(f->code,"%s\n",tm);

View file

@ -1233,7 +1233,7 @@ public:
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
Replaceall(tm,"$target","vresult"); Replaceall(tm,"$target","vresult");
if (Getattr(n, "feature:new")) if (GetFlag(n, "feature:new"))
Replaceall(tm,"$owner", "1"); Replaceall(tm,"$owner", "1");
else else
Replaceall(tm,"$owner", "0"); Replaceall(tm,"$owner", "0");
@ -1296,7 +1296,7 @@ public:
Printv(f->code,cleanup,NIL); Printv(f->code,cleanup,NIL);
/* Look for any remaining cleanup. This processes the %new directive */ /* 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); tm = Swig_typemap_lookup_new("newfree",n,"result",0);
if (tm) { if (tm) {
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");

View file

@ -438,7 +438,7 @@ public:
Replaceall(tm,"$source", "result"); Replaceall(tm,"$source", "result");
Replaceall(tm,"$target", "Tcl_GetObjResult(interp)"); Replaceall(tm,"$target", "Tcl_GetObjResult(interp)");
Replaceall(tm,"$result", "Tcl_GetObjResult(interp)"); Replaceall(tm,"$result", "Tcl_GetObjResult(interp)");
if(Getattr(n,"feature:new")) { if(GetFlag(n,"feature:new")) {
Replaceall(tm,"$owner","1"); Replaceall(tm,"$owner","1");
} else { } else {
Replaceall(tm,"$owner","0"); Replaceall(tm,"$owner","0");
@ -456,7 +456,7 @@ public:
Printv(f->code,cleanup,NIL); Printv(f->code,cleanup,NIL);
/* Look for any remaining cleanup */ /* 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))) { if ((tm = Swig_typemap_lookup_new("newfree",n,"result",0))) {
Replaceall(tm,"$source","result"); Replaceall(tm,"$source","result");
Printf(f->code,"%s\n", tm); Printf(f->code,"%s\n", tm);