Modify following features to work as flags, so that they can be truely set and unset:
java:const
java:downcast
compactdefaultargs
ignore
valuewrapper
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7562 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
33486da5a5
commit
beebb0a8e1
13 changed files with 40 additions and 42 deletions
|
|
@ -438,7 +438,7 @@ static void add_symbols(Node *n) {
|
|||
}
|
||||
if (strncmp(Char(symname),"$ignore",7) == 0) {
|
||||
char *c = Char(symname)+7;
|
||||
Setattr(n,"feature:ignore","1");
|
||||
SetFlag(n,"feature:ignore");
|
||||
if (strlen(c)) {
|
||||
SWIG_WARN_NODE_BEGIN(n);
|
||||
Swig_warning(0,Getfile(n), Getline(n), "%s\n",c+1);
|
||||
|
|
@ -1166,7 +1166,7 @@ static void default_arguments(Node *n) {
|
|||
(one wrapped method per function irrespective of number of default arguments) */
|
||||
if (compact_default_args
|
||||
|| is_cfunction(function)
|
||||
|| Getattr(function,"feature:compactdefaultargs")
|
||||
|| GetFlag(function,"feature:compactdefaultargs")
|
||||
|| Getattr(function,"feature:kwargs")) {
|
||||
ParmList *p = Getattr(function,"parms");
|
||||
if (p)
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ class Allocate : public Dispatcher {
|
|||
String *base_decl = Getattr(base, "decl");
|
||||
SwigType *base_type = Getattr(base, "type");
|
||||
if (base_decl && base_type) {
|
||||
if (checkAttribute(base, "name", name) && !Getattr(b, "feature:ignore") /* whole class is ignored */ ) {
|
||||
if (checkAttribute(base, "name", name) && !GetFlag(b, "feature:ignore") /* whole class is ignored */ ) {
|
||||
if (SwigType_isfunction(resolved_decl) && SwigType_isfunction(base_decl)) {
|
||||
// We have found a method that has the same name as one in a base class
|
||||
bool covariant_returntype = false;
|
||||
|
|
@ -208,7 +208,7 @@ class Allocate : public Dispatcher {
|
|||
if (virtual_elimination_mode)
|
||||
if (both_have_public_access)
|
||||
if (!is_non_public_base(inclass, b))
|
||||
Setattr(n,"feature:ignore", "1");
|
||||
SetFlag(n,"feature:ignore");
|
||||
} else {
|
||||
// Some languages need to know about covariant return types
|
||||
Setattr(n, "covariant", most_base_covariant_type);
|
||||
|
|
@ -363,21 +363,21 @@ class Allocate : public Dispatcher {
|
|||
if (kind && (Strcmp(kind,"class") == 0)) mode = PRIVATE;
|
||||
|
||||
while (c) {
|
||||
if (Getattr(c,"error") || Getattr(c,"feature:ignore")) {
|
||||
if (Getattr(c,"error") || GetFlag(c,"feature:ignore")) {
|
||||
c = nextSibling(c);
|
||||
continue;
|
||||
}
|
||||
if (!isconst && (Strcmp(nodeType(c),"extend") == 0)) {
|
||||
methods = smart_pointer_methods(c, methods, isconst, Getattr(cls,"name"));
|
||||
} else if (Strcmp(nodeType(c),"cdecl") == 0) {
|
||||
if (!Getattr(c,"feature:ignore")) {
|
||||
if (!GetFlag(c,"feature:ignore")) {
|
||||
String *storage = Getattr(c,"storage");
|
||||
if (!((Cmp(storage,"typedef") == 0))
|
||||
&& !((Cmp(storage,"friend") == 0))) {
|
||||
String *name = Getattr(c,"name");
|
||||
String *symname = Getattr(c,"sym:name");
|
||||
Node *e = Swig_symbol_clookup_local(name,0);
|
||||
if (e && is_public(e) && !Getattr(e,"feature:ignore") && (Cmp(symname, Getattr(e,"sym:name")) == 0)) {
|
||||
if (e && is_public(e) && !GetFlag(e,"feature:ignore") && (Cmp(symname, Getattr(e,"sym:name")) == 0)) {
|
||||
Swig_warning(WARN_LANG_DEREF_SHADOW,Getfile(e),Getline(e),"Declaration of '%s' shadows declaration accessible via operator->(),\n",
|
||||
name);
|
||||
Swig_warning(WARN_LANG_DEREF_SHADOW,Getfile(c),Getline(c),"previous declaration of '%s'.\n", name);
|
||||
|
|
@ -644,7 +644,7 @@ public:
|
|||
p = parentNode(p);
|
||||
}
|
||||
if (Strcmp(nodeType(p),"class") == 0) {
|
||||
if (Getattr(p,"feature:ignore")) {
|
||||
if (GetFlag(p,"feature:ignore")) {
|
||||
Setattr(n,"allocate:smartpointer",Getattr(p,"allocate:smartpointer"));
|
||||
}
|
||||
}
|
||||
|
|
@ -718,7 +718,7 @@ public:
|
|||
Setattr(inclass,"allocate:has_new","1");
|
||||
}
|
||||
/* Look for smart pointer operator */
|
||||
if ((Strcmp(name,"operator ->") == 0) && (!Getattr(n,"feature:ignore"))) {
|
||||
if ((Strcmp(name,"operator ->") == 0) && (!GetFlag(n,"feature:ignore"))) {
|
||||
/* Look for version with no parameters */
|
||||
Node *sn = n;
|
||||
while (sn) {
|
||||
|
|
|
|||
|
|
@ -1267,8 +1267,7 @@ class JAVA : public Language {
|
|||
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
|
||||
|
||||
// The %javaconst feature determines how the constant value is obtained
|
||||
String *const_feature = Getattr(n,"feature:java:const");
|
||||
bool const_feature_flag = const_feature && Cmp(const_feature, "0") != 0;
|
||||
int const_feature_flag = GetFlag(n,"feature:java:const");
|
||||
|
||||
/* Adjust the enum type for the Swig_typemap_lookup.
|
||||
* We want the same jstype typemap for all the enum items so we use the enum type (parent node). */
|
||||
|
|
@ -1713,7 +1712,7 @@ class JAVA : public Language {
|
|||
good place to put this code, since Abstract Base Classes (ABCs) can and should have
|
||||
downcasts, making the constructorHandler() a bad place (because ABCs don't get to
|
||||
have constructors emitted.) */
|
||||
if (Getattr(n, "feature:javadowncast")) {
|
||||
if (GetFlag(n, "feature:javadowncast")) {
|
||||
String *jni_imclass_name = makeValidJniName(imclass_name);
|
||||
String *jni_class_name = makeValidJniName(proxy_class_name);
|
||||
String *norm_name = SwigType_namestr(Getattr(n, "name"));
|
||||
|
|
@ -2337,8 +2336,7 @@ class JAVA : public Language {
|
|||
|
||||
if (!value) {
|
||||
// The %javaconst feature determines how the constant value is obtained
|
||||
String *const_feature = Getattr(n,"feature:java:const");
|
||||
bool const_feature_flag = const_feature && Cmp(const_feature, "0") != 0;
|
||||
int const_feature_flag = GetFlag(n,"feature:java:const");
|
||||
|
||||
if (const_feature_flag) {
|
||||
// Use the C syntax to make a true Java constant and hope that it compiles as Java code
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ int Language::emit_one(Node *n) {
|
|||
int oldext;
|
||||
if (!n) return SWIG_OK;
|
||||
|
||||
if (Getattr(n,"feature:ignore")
|
||||
if (GetFlag(n,"feature:ignore")
|
||||
&& !Getattr(n,"feature:onlychildren")) return SWIG_OK;
|
||||
|
||||
oldext = Extend;
|
||||
|
|
@ -1915,7 +1915,7 @@ int Language::classDeclaration(Node *n) {
|
|||
Setattr(n,"feature:emitonlychildren",ochildren);
|
||||
emit_children(n);
|
||||
Delattr(n,"feature:emitonlychildren");
|
||||
Setattr(n,"feature:ignore","1");
|
||||
SetFlag(n,"feature:ignore");
|
||||
return SWIG_NOWRAP;
|
||||
}
|
||||
|
||||
|
|
@ -2144,7 +2144,7 @@ int Language::constructorDeclaration(Node *n) {
|
|||
while (nn) {
|
||||
if (!is_public(nn)) {
|
||||
if (!dirclass || !need_nonpublic_ctor(nn)) {
|
||||
Setattr(nn,"feature:ignore","1");
|
||||
SetFlag(nn,"feature:ignore");
|
||||
}
|
||||
}
|
||||
nn = Getattr(nn,"sym:nextSibling");
|
||||
|
|
@ -2590,7 +2590,7 @@ Language::classLookup(SwigType *s) {
|
|||
Delete(base);
|
||||
Delete(prefix);
|
||||
}
|
||||
if (n && (Getattr(n,"feature:ignore") || Getattr(n,"feature:onlychildren"))) {
|
||||
if (n && (GetFlag(n,"feature:ignore") || Getattr(n,"feature:onlychildren"))) {
|
||||
n = 0;
|
||||
}
|
||||
|
||||
|
|
@ -2652,7 +2652,7 @@ Language::enumLookup(SwigType *s) {
|
|||
Delete(base);
|
||||
Delete(prefix);
|
||||
}
|
||||
if (n && (Getattr(n,"feature:ignore"))) {
|
||||
if (n && (GetFlag(n,"feature:ignore"))) {
|
||||
n = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1408,7 +1408,7 @@ public:
|
|||
if(baselist) {
|
||||
int class_count = 0;
|
||||
Iterator base = First(baselist);
|
||||
while(base.item && Getattr(base.item,"feature:ignore")) {
|
||||
while(base.item && GetFlag(base.item,"feature:ignore")) {
|
||||
base = Next(base);
|
||||
}
|
||||
|
||||
|
|
@ -1418,7 +1418,7 @@ public:
|
|||
}
|
||||
|
||||
if (base.item) for(base = Next(base); base.item; base = Next(base)) {
|
||||
if (Getattr(base.item,"feature:ignore")) {
|
||||
if (GetFlag(base.item,"feature:ignore")) {
|
||||
continue;
|
||||
}
|
||||
if(is_shadow(Getattr(base.item, "name"))) {
|
||||
|
|
@ -1496,7 +1496,7 @@ public:
|
|||
base.item = NULL;
|
||||
}
|
||||
|
||||
while(base.item && Getattr(base.item,"feature:ignore")) {
|
||||
while(base.item && GetFlag(base.item,"feature:ignore")) {
|
||||
base = Next(base);
|
||||
}
|
||||
|
||||
|
|
@ -1544,7 +1544,7 @@ public:
|
|||
GetChar(base.item, "sym:name"));
|
||||
|
||||
base=Next(base);
|
||||
while (base.item && Getattr(base.item,"feature:ignore")) {
|
||||
while (base.item && GetFlag(base.item,"feature:ignore")) {
|
||||
base=Next(base);
|
||||
}
|
||||
}
|
||||
|
|
@ -1586,7 +1586,7 @@ public:
|
|||
} else {
|
||||
base.item=NULL;
|
||||
}
|
||||
while(base.item && Getattr(base.item,"feature:ignore")) {
|
||||
while(base.item && GetFlag(base.item,"feature:ignore")) {
|
||||
base = Next(base);
|
||||
}
|
||||
ki = First(shadow_get_vars);
|
||||
|
|
@ -1634,7 +1634,7 @@ public:
|
|||
GetChar(base.item, "sym:name"));
|
||||
|
||||
base=Next(base);
|
||||
while (base.item && Getattr(base.item,"feature:ignore")) {
|
||||
while (base.item && GetFlag(base.item,"feature:ignore")) {
|
||||
base=Next(base);
|
||||
}
|
||||
}
|
||||
|
|
@ -1655,7 +1655,7 @@ public:
|
|||
else {
|
||||
base.item=NULL;
|
||||
}
|
||||
while(base.item && Getattr(base.item,"feature:ignore")) {
|
||||
while(base.item && GetFlag(base.item,"feature:ignore")) {
|
||||
base = Next(base);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1982,7 +1982,7 @@ public:
|
|||
b = First(baselist);
|
||||
while (b.item) {
|
||||
String *bname = Getattr(b.item, "python:proxy");
|
||||
if (!bname || Getattr(b.item,"feature:ignore")) {
|
||||
if (!bname || GetFlag(b.item,"feature:ignore")) {
|
||||
b = Next(b);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -770,7 +770,7 @@ public:
|
|||
b = First(baselist);
|
||||
while (b.item) {
|
||||
String *bname = Getattr(b.item, "name");
|
||||
if ((!bname) || Getattr(b.item,"feature:ignore") || (!Getattr(b.item,"module"))) {
|
||||
if ((!bname) || GetFlag(b.item,"feature:ignore") || (!Getattr(b.item,"module"))) {
|
||||
b = Next(b);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -797,7 +797,7 @@ class TypePass : private Dispatcher {
|
|||
SwigType_typedef_using(uname);
|
||||
} else {
|
||||
/* A normal C declaration. */
|
||||
if ((inclass) && (!Getattr(n,"feature:ignore")) && (Getattr(n,"sym:name"))) {
|
||||
if ((inclass) && (!GetFlag(n,"feature:ignore")) && (Getattr(n,"sym:name"))) {
|
||||
Node *c = ns;
|
||||
Node *unodes = 0, *last_unodes = 0;
|
||||
int ccount = 0;
|
||||
|
|
@ -808,7 +808,7 @@ class TypePass : private Dispatcher {
|
|||
|| checkAttribute(c,"storage","typedef")
|
||||
|| checkAttribute(c,"storage","friend")
|
||||
|| (Getattr(c,"feature:extend") && !Getattr(c,"code"))
|
||||
|| Getattr(c,"feature:ignore"))) {
|
||||
|| GetFlag(c,"feature:ignore"))) {
|
||||
|
||||
String *csymname = Getattr(c,"sym:name");
|
||||
if (!csymname || (Strcmp(csymname,symname) == 0)) {
|
||||
|
|
@ -834,7 +834,7 @@ class TypePass : private Dispatcher {
|
|||
Delattr(nn,"access"); // access might be different from the method in the base class
|
||||
if (!Getattr(nn,"sym:name")) Setattr(nn,"sym:name", symname);
|
||||
|
||||
if (!Getattr(nn,"feature:ignore")) {
|
||||
if (!GetFlag(nn,"feature:ignore")) {
|
||||
Setattr(nn,"parms",CopyParmList(Getattr(c,"parms")));
|
||||
ParmList *throw_parm_list = Getattr(c,"throws");
|
||||
if (throw_parm_list)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void clean_overloaded(Node *n) {
|
|||
int cnt = 0;
|
||||
while (nn) {
|
||||
if ((Strcmp(nodeType(nn),"template") == 0) ||
|
||||
(Getattr(nn,"feature:ignore")) ||
|
||||
(GetFlag(nn,"feature:ignore")) ||
|
||||
(Getattr(nn,"error")) ||
|
||||
// (checkAttribute(nn,"storage","friend")) ||
|
||||
((Strcmp(nodeType(nn),"using") == 0) && !firstChild(nn))) {
|
||||
|
|
|
|||
|
|
@ -772,8 +772,8 @@ Swig_MethodToFunction(Node *n, String *classname, int flags) {
|
|||
This happens in python, but may also happens in other target
|
||||
languages.
|
||||
*/
|
||||
if (Getattr(n,"feature:self:disown")) {
|
||||
Setattr(p,"wrap:disown",Getattr(n,"feature:self:disown"));
|
||||
if (GetFlag(n,"feature:self:disown")) {
|
||||
Setattr(p,"wrap:disown","1");
|
||||
}
|
||||
set_nextSibling(p,parms);
|
||||
Delete(type);
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ Swig_name_get(const String_or_char *vname) {
|
|||
String *f;
|
||||
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stdout,"name get: '%s'\n", vname);
|
||||
Printf(stdout,"Swig_name_get: '%s'\n", vname);
|
||||
#endif
|
||||
|
||||
r = NewString("");
|
||||
|
|
@ -395,7 +395,7 @@ Swig_name_object_set(Hash *namehash, String *name, SwigType *decl, DOH *object)
|
|||
DOH *n;
|
||||
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stdout,"name set: '%s', '%s'\n", name, decl);
|
||||
Printf(stdout,"Swig_name_object_set: '%s', '%s'\n", name, decl);
|
||||
#endif
|
||||
n = Getattr(namehash,name);
|
||||
if (!n) {
|
||||
|
|
@ -571,7 +571,7 @@ void features_get(Hash *features, String *tname, SwigType *decl, SwigType *ncdec
|
|||
{
|
||||
Node *n = Getattr(features,tname);
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stdout," feature_get: %s\n", tname);
|
||||
Printf(stdout," features_get: %s\n", tname);
|
||||
#endif
|
||||
if (n) {
|
||||
merge_features(get_object(n,0),node);
|
||||
|
|
@ -608,7 +608,7 @@ Swig_features_get(Hash *features, String *prefix, String *name, SwigType *decl,
|
|||
}
|
||||
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stdout,"feature_get: %s %s %s\n", prefix, name, decl);
|
||||
Printf(stdout,"SWwig_features_get: %s %s %s\n", prefix, name, decl);
|
||||
#endif
|
||||
|
||||
/* Global features */
|
||||
|
|
@ -676,7 +676,7 @@ Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl, con
|
|||
Hash *fhash;
|
||||
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stdout,"feature_set: %s %s %s %s\n", name, decl, featurename,value);
|
||||
Printf(stdout,"Swig_feature_set: %s %s %s %s\n", name, decl, featurename,value);
|
||||
#endif
|
||||
|
||||
n = Getattr(features,name);
|
||||
|
|
|
|||
|
|
@ -661,7 +661,7 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
|
|||
}
|
||||
|
||||
/* If node is ignored. We don't proceed any further */
|
||||
if (Getattr(n,"feature:ignore")) return n;
|
||||
if (GetFlag(n,"feature:ignore")) return n;
|
||||
|
||||
/* See if the symbol already exists in the table */
|
||||
c = Getattr(current,symname);
|
||||
|
|
|
|||
|
|
@ -1277,7 +1277,7 @@ SwigType *SwigType_alttype(SwigType *t, int local_tmap) {
|
|||
SwigType *td = SwigType_strip_qualifiers(ftd);
|
||||
Delete(ftd);
|
||||
if ((n = Swig_symbol_clookup(td,0))) {
|
||||
if (Getattr(n,"feature:valuewrapper")) {
|
||||
if (GetFlag(n,"feature:valuewrapper")) {
|
||||
use_wrapper = 1;
|
||||
} else {
|
||||
if ((Strcmp(nodeType(n),"class") == 0)
|
||||
|
|
@ -1314,7 +1314,7 @@ SwigType *SwigType_alttype(SwigType *t, int local_tmap) {
|
|||
&& !Getattr(n,"allocate:noassign")
|
||||
&& (Getattr(n,"allocate:default_constructor")))
|
||||
|| (Getattr(n,"feature:novaluewrapper"))) {
|
||||
use_wrapper = Getattr(n,"feature:valuewrapper") ? 1 : 0;
|
||||
use_wrapper = GetFlag(n,"feature:valuewrapper");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue