add direct HashCheckAttr

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7889 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-11-27 09:58:26 +00:00
commit 72469f2d26
7 changed files with 136 additions and 77 deletions

View file

@ -42,7 +42,7 @@
#define DohCmp DOH_NAMESPACE(Cmp)
#define DohEqual DOH_NAMESPACE(Equal)
#define DohIncref DOH_NAMESPACE(Incref)
#define DohGetattr DOH_NAMESPACE(Getattr)
#define DohCheckattr DOH_NAMESPACE(Checkattr)
#define DohSetattr DOH_NAMESPACE(Setattr)
#define DohDelattr DOH_NAMESPACE(Delattr)
#define DohKeys DOH_NAMESPACE(Keys)
@ -108,6 +108,7 @@
#define DohCopyto DOH_NAMESPACE(Copyto)
#define DohNewList DOH_NAMESPACE(NewList)
#define DohNewHash DOH_NAMESPACE(NewHash)
#define DohHashCheckAttr DOH_NAMESPACE(HashCheckAttr)
#define DohNewVoid DOH_NAMESPACE(NewVoid)
#define DohSplit DOH_NAMESPACE(Split)
#define DohSplitLines DOH_NAMESPACE(SplitLines)
@ -331,6 +332,7 @@ extern void DohSortList(DOH *lo, int (*cmp)(const DOH *, const DOH *));
* ----------------------------------------------------------------------------- */
extern DOHHash *DohNewHash();
extern int DohHashCheckAttr(DOH *hash, DOH *key, DOH *value);
/* -----------------------------------------------------------------------------
* Void
@ -414,6 +416,7 @@ extern void DohMemoryDebug(void);
#define NewStringWithSize DohNewStringWithSize
#define NewStringf DohNewStringf
#define NewHash DohNewHash
#define HashCheckAttr DohHashCheckAttr
#define NewList DohNewList
#define NewFile DohNewFile
#define NewFileFromFile DohNewFileFromFile

View file

@ -244,26 +244,58 @@ Hash_setattr(DOH *ho, DOH *k, DOH *obj) {
*
* Get an attribute from the hash table. Returns 0 if it doesn't exist.
* ----------------------------------------------------------------------------- */
typedef int (*binop)(DOH *obj1, DOH *obj2);
#define _Hash_getattr(h, k, o) \
int hv = Hashval(k) % h->hashsize; \
DohObjInfo *k_type = ((DohBase*)k)->type; \
HashNode *n = h->hashtable[hv]; \
if (k_type->doh_equal) { \
binop equal = k_type->doh_equal; \
while (n) { \
DohBase *nk = (DohBase *)n->key; \
if ((k_type == nk->type) && equal(k, nk)) o = n->object; \
n = n->next; \
} \
} else { \
binop cmp = k_type->doh_cmp; \
while (n) { \
DohBase *nk = (DohBase *)n->key; \
if ((k_type == nk->type) && (cmp(k, nk) == 0)) o = n->object; \
n = n->next; \
} \
}
static DOH *
Hash_getattr(DOH *ho, DOH *k) {
int hv;
HashNode *n;
DohObjInfo *k_type;
DohBase *nk;
Hash_getattr(DOH *h, DOH *k) {
DOH *obj = 0;
Hash *ho = (Hash *) ObjData(h);
DOH *ko = DohCheck(k) ? k : find_key(k);
_Hash_getattr(ho, ko, obj);
return obj;
}
Hash *h = (Hash *) ObjData(ho);
if (!DohCheck(k)) k = find_key(k);
hv = Hashval(k) % h->hashsize;
n = h->hashtable[hv];
k_type = ((DohBase*)k)->type;
while (n) {
nk = (DohBase *)n->key;
if ((k_type == nk->type) && ((k_type->doh_equal)(k, nk))) return n->object;
n = n->next;
/* -----------------------------------------------------------------------------
* Hash_checkattr()
*
* Get an attribute from the hash table. Returns 0 if it doesn't exist.
* ----------------------------------------------------------------------------- */
int
DohHashCheckAttr(DOH *h, DOH *k, DOH *v) {
DOH *obj = 0;
Hash *ho = (Hash *) ObjData(h);
_Hash_getattr(ho, k, obj);
if (obj) {
DohObjInfo *o_type = ((DohBase*)obj)->type;
if (o_type == ((DohBase*)v)->type) {
binop equal = o_type->doh_equal;
return equal ? equal(obj, v) : (o_type->doh_cmp(obj, v) == 0);
}
return 0;
}
return 0;
}
/* -----------------------------------------------------------------------------

View file

@ -988,7 +988,7 @@ DohNewString(const DOH *so)
char *s;
if (DohCheck(so)) {
str = (String *) ObjData(so);
s = String_data(so);
s = String_data((String *)so);
l = s ? str->len : 0;
} else {
s = (char *) so;
@ -1029,7 +1029,7 @@ DohNewStringWithSize(const DOH *so, int len)
String *str;
char *s;
if (DohCheck(so)) {
s = String_data(so);
s = String_data((String *)so);
}
else {
s = (char *) so;

View file

@ -432,7 +432,7 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
}
symbols = Getattr(cpp,k_symbols);
if ((m1 = Getattr(symbols,macroname))) {
if (!StringEqual(Getattr(m1,k_value),macrovalue)) {
if (!HashCheckAttr(m1,k_value,macrovalue)) {
Swig_error(Getfile(str),Getline(str),"Macro '%s' redefined,\n",macroname);
Swig_error(Getfile(m1),Getline(m1),"previous definition of '%s'.\n",macroname);
goto macro_error;
@ -858,7 +858,7 @@ List *evaluate_args(List *x) {
* which are then expanded.
* ----------------------------------------------------------------------------- */
/* #define SWIG_PUT_BUFF */
/* #define SWIG_PUT_BUFF */
DOH *
Preprocessor_replace(DOH *s)
@ -920,7 +920,7 @@ Preprocessor_replace(DOH *s)
StringUngetc(c,s);
/* See if this is the special "defined" macro */
#ifndef SWIG_PUT_BUFF
if (StringEqual(id,k_defined)) {
if (StringEqual(k_defined,id)) {
#else
if (strcmp(id,"defined") == 0) {
#endif
@ -966,7 +966,7 @@ Preprocessor_replace(DOH *s)
break;
}
#ifndef SWIG_PUT_BUFF
if (StringEqual(id,k_LINE)) {
if (StringEqual(k_LINE,id)) {
#else
if (strcmp(id,"__LINE__") == 0) {
#endif
@ -975,7 +975,7 @@ Preprocessor_replace(DOH *s)
break;
}
#ifndef SWIG_PUT_BUFF
if (StringEqual(id,k_FILE)) {
if (StringEqual(k_FILE,id)) {
#else
if (strcmp(id,"__FILE__") == 0) {
#endif
@ -1046,7 +1046,7 @@ Preprocessor_replace(DOH *s)
if (state == 1) {
/* See if this is the special "defined" macro */
#ifndef SWIG_PUT_BUFF
if (StringEqual(id,k_defined)) {
if (StringEqual(k_defined,id)) {
#else
if (strcmp(id,"defined") == 0) {
#endif

View file

@ -537,6 +537,11 @@ extern void Swig_fragment_emit(String *name);
extern int Swig_need_protected();
extern int Swig_director_mode();
/* -- template init -- */
extern void SwigType_template_init();
#ifdef __cplusplus
}
#endif

View file

@ -175,6 +175,8 @@ static Hash *symtabs = 0; /* Hash of all symbol tables by fully-qualifie
static Hash *global_scope = 0; /* Global scope */
/* common attribute keys, to avoid calling find_key all the times */
static String *k_allowstypedef = 0;
static String *k_cdecl = 0;
static String *k_coloncolon = 0;
static String *k_constructor = 0;
@ -182,9 +184,11 @@ static String *k_csymnextSibling = 0;
static String *k_csympreviousSibling = 0;
static String *k_csymtab = 0;
static String *k_decl = 0;
static String *k_empty = 0;
static String *k_enumitem = 0;
static String *k_inherit = 0;
static String *k_name = 0;
static String *k_namespace = 0;
static String *k_nodetype = 0;
static String *k_parentnode = 0;
static String *k_storage = 0;
@ -196,7 +200,12 @@ static String *k_symovername = 0;
static String *k_sympreviousSibling = 0;
static String *k_symsymtab = 0;
static String *k_symtab = 0;
static String *k_symtypename = 0;
static String *k_symweak = 0;
static String *k_template = 0;
static String *k_templateparm = 0;
static String *k_templateparms = 0;
static String *k_templatetype = 0;
static String *k_type = 0;
static String *k_typedef = 0;
static String *k_uname = 0;
@ -209,7 +218,7 @@ void
Swig_symbol_dump_symtable() {
Printf(stdout, "DUMPING SYMTABLE start =======================================\n");
{
Hash* cst = Getattr(current_symtab, "csymtab");
Hash* cst = Getattr(current_symtab, k_csymtab);
Swig_print_tree(cst);
/*
Swig_print_tree(Getattr(cst, "NumSpace"));
@ -227,6 +236,7 @@ Swig_symbol_dump_symtable() {
void
Swig_symbol_init() {
k_allowstypedef = NewString("allows_typedef");
k_cdecl = NewString("cdecl");
k_coloncolon = NewString("::");
k_constructor = NewString("constructor");
@ -234,9 +244,11 @@ Swig_symbol_init() {
k_csympreviousSibling = NewString("csym:previousSibling");
k_csymtab = NewString("csymtab");
k_decl = NewString("decl");
k_empty = NewString("empty");
k_enumitem = NewString("enumitem");
k_inherit = NewString("inherit");
k_name = NewString("name");
k_namespace = NewString("namespace");
k_nodetype = NewString("nodeType");
k_parentnode = NewString("parentNode");
k_storage = NewString("storage");
@ -248,7 +260,12 @@ Swig_symbol_init() {
k_sympreviousSibling = NewString("sym:previousSibling");
k_symsymtab = NewString("sym:symtab");
k_symtab = NewString("symtab");
k_symtypename = NewString("sym:typename");
k_symweak = NewString("sym:weak");
k_template = NewString("template");
k_templateparm = NewString("templateparm");
k_templateparms = NewString("templateparms");
k_templatetype = NewString("templatetype");
k_type = NewString("type");
k_typedef = NewString("typedef");
k_uname = NewString("uname");
@ -264,7 +281,7 @@ Swig_symbol_init() {
/* Set the global scope */
symtabs = NewHash();
Setattr(symtabs,"",current_symtab);
Setattr(symtabs,k_empty,current_symtab);
global_scope = current_symtab;
}
@ -277,7 +294,7 @@ Swig_symbol_init() {
void
Swig_symbol_setscopename(const String_or_char *name) {
String *qname;
assert(!Getattr(current_symtab,k_name));
/* assert(!Getattr(current_symtab,k_name)); */
Setattr(current_symtab,k_name,name);
/* Set nested scope in parent */
@ -309,7 +326,7 @@ Swig_symbol_getscopename() {
Symtab *
Swig_symbol_getscope(const String_or_char *name) {
if (!symtabs) return 0;
if (Strcmp(name,k_coloncolon) == 0) name = "";
if (StringEqual(k_coloncolon,(String_or_char *)name)) name = k_empty;
return Getattr(symtabs,name);
}
@ -496,7 +513,7 @@ Swig_symbol_cadd(String_or_char *name, Node *n) {
if (SwigType_istemplate(name)) {
String *cname = NewString(name);
String *dname = Swig_symbol_template_deftype(cname,0);
if (Strcmp(dname,name)) {
if (!StringEqual(dname,name)) {
Swig_symbol_cadd(dname, n);
}
Delete(dname);
@ -508,20 +525,20 @@ Swig_symbol_cadd(String_or_char *name, Node *n) {
#endif
cn = Getattr(ccurrent,name);
if (cn && (Getattr(cn,"sym:typename"))) {
if (cn && (Getattr(cn,k_symtypename))) {
/* The node in the C symbol table is a typename. Do nothing */
/* We might append the symbol at the end */
append = n;
} else if (cn && (Getattr(cn,"sym:weak"))) {
} else if (cn && (Getattr(cn,k_symweak))) {
/* The node in the symbol table is weak. Replace it */
Setattr(ccurrent,name, n);
} else if (cn && (Getattr(n,"sym:weak"))) {
} else if (cn && (Getattr(n,k_symweak))) {
/* The node being added is weak. Don't worry about it */
} else if (cn && (Getattr(n,"sym:typename"))) {
} else if (cn && (Getattr(n,k_symtypename))) {
/* The node being added is a typename. We definitely add it */
Setattr(ccurrent,name,n);
append = cn;
} else if (cn && (Strcmp(nodeType(cn),"templateparm") == 0)) {
} else if (cn && (HashCheckAttr(cn, k_nodetype, k_templateparm))) {
Swig_error(Getfile(n),Getline(n),
"Declaration of '%s' shadows template parameter,\n",
name);
@ -567,7 +584,7 @@ Swig_symbol_cadd(String_or_char *name, Node *n) {
{
Node *td = n;
while (td && (Strcmp(nodeType(td),k_cdecl) == 0) && (checkAttribute(td,k_storage,k_typedef))) {
while (td && HashCheckAttr(td,k_nodetype,k_cdecl) && HashCheckAttr(td,k_storage,k_typedef)) {
SwigType *type;
Node *td1;
type = Copy(Getattr(td,k_type));
@ -591,10 +608,10 @@ Swig_symbol_cadd(String_or_char *name, Node *n) {
ie, when Foo -> FooBar -> Foo, jump one scope up when possible.
*/
if (td1 && checkAttribute(td1,k_storage,k_typedef)) {
if (td1 && HashCheckAttr(td1,k_storage,k_typedef)) {
String *st = Getattr(td1,k_type);
String *sn = Getattr(td,k_name);
if (st && sn && (Strcmp(st, sn) == 0)) {
if (st && sn && StringEqual(st, sn)) {
Symtab *sc = Getattr(current_symtab,k_parentnode);
if (sc) td1 = Swig_symbol_clookup(type,sc);
}
@ -683,7 +700,7 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
In this case, "Foo" sits in the symbol table. However, the
definition of Foo would replace the entry if it appeared later. */
if (c && Getattr(c,"sym:weak")) {
if (c && Getattr(c,k_symweak)) {
c = 0;
}
if (c) {
@ -698,7 +715,8 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
*/
/* Check for namespaces */
if ((Strcmp(nodeType(n),nodeType(c)) == 0) && ((Strcmp(nodeType(n),"namespace") == 0))) {
String *ntype = Getattr(n, k_nodetype);
if ((StringEqual(ntype,Getattr(c,k_nodetype))) && ((StringEqual(ntype,k_namespace)))) {
Node *cl, *pcl = 0;
cl = c;
while (cl) {
@ -711,8 +729,8 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
Setattr(n,k_sympreviousSibling, pcl);
return n;
}
if (Getattr(n,"allows_typedef")) nt = 1;
if (Getattr(c,"allows_typedef")) ct = 1;
if (Getattr(n,k_allowstypedef)) nt = 1;
if (Getattr(c,k_allowstypedef)) ct = 1;
if (nt || ct) {
Node *td, *other;
String *s;
@ -731,7 +749,7 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
}
/* Make sure the other node is a typedef */
s = Getattr(other,k_storage);
if (!s || (Strcmp(s,k_typedef))) return c; /* No. This is a conflict */
if (!s || (!StringEqual(s,k_typedef))) return c; /* No. This is a conflict */
/* Hmmm. This appears to be okay. Make sure the symbol table refers to the allow_type node */
@ -748,14 +766,14 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
{
String *nt1, *nt2;
nt1 = nodeType(n);
if (Strcmp(nt1,"template") == 0) nt1 = Getattr(n,"templatetype");
nt2 = nodeType(c);
if (Strcmp(nt2,"template") == 0) nt2 = Getattr(c,"templatetype");
if (Strcmp(nt1,"using") == 0) u1 = 1;
if (Strcmp(nt2,"using") == 0) u2 = 1;
nt1 = Getattr(n,k_nodetype);
if (StringEqual(nt1,k_template)) nt1 = Getattr(n,k_templatetype);
nt2 = Getattr(c,k_nodetype);
if (StringEqual(nt2,k_template)) nt2 = Getattr(c,k_templatetype);
if (StringEqual(nt1,k_using)) u1 = 1;
if (StringEqual(nt2,k_using)) u2 = 1;
if ((Strcmp(nt1,nt2) != 0) && !(u1 || u2)) return c;
if ((!StringEqual(nt1,nt2)) && !(u1 || u2)) return c;
}
if (!(u1 || u2)) {
if ((!SwigType_isfunction(decl)) || (!SwigType_isfunction(ndecl))) {
@ -779,8 +797,9 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
/* Okay. Walk down the list of symbols and see if we get a declarator match */
{
int n_template = (Strcmp(nodeType(n),"template") == 0) && (Strcmp(Getattr(n,"templatetype"),k_cdecl) == 0);
int n_plain_cdecl = (Strcmp(nodeType(n),k_cdecl) == 0);
String *nt = Getattr(n,k_nodetype);
int n_template = StringEqual(nt,k_template) && HashCheckAttr(n,k_templatetype,k_cdecl);
int n_plain_cdecl = StringEqual(nt,k_cdecl);
cn = c;
pn = 0;
while (cn) {
@ -790,8 +809,9 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
/* Declarator conflict */
/* Now check we don't have a non-templated function overloaded by a templated function with same params,
* eg void foo(); template<typename> void foo(); */
int cn_template = (Strcmp(nodeType(cn),"template") == 0) && (Strcmp(Getattr(cn,"templatetype"),k_cdecl) == 0);
int cn_plain_cdecl = (Strcmp(nodeType(cn),k_cdecl) == 0);
String *cnt = Getattr(cn,k_nodetype);
int cn_template = StringEqual(cnt,k_template) && HashCheckAttr(cn,k_templatetype,k_cdecl);
int cn_plain_cdecl = StringEqual(cnt,k_cdecl);
if (!((n_template && cn_plain_cdecl) || (cn_template && n_plain_cdecl))) {
/* found a conflict */
return cn;
@ -883,7 +903,7 @@ symbol_lookup(String_or_char *name, Symtab *symtab, int (*check)(Node *n)) {
String *dname = 0;
Setmark(symtab,0);
dname = Swig_symbol_template_deftype(name,symtab);
if (Strcmp(name,dname)) {
if (!StringEqual(dname,name)) {
n = symbol_lookup(dname, symtab, check);
}
Delete(dname);
@ -977,7 +997,7 @@ Swig_symbol_clookup(String_or_char *name, Symtab *n) {
if (!n) {
hsym = current_symtab;
} else {
if (!checkAttribute(n,k_nodetype,k_symboltable)) {
if (!HashCheckAttr(n,k_nodetype,k_symboltable)) {
n = Getattr(n,k_symsymtab);
}
assert(n);
@ -1016,10 +1036,10 @@ Swig_symbol_clookup(String_or_char *name, Symtab *n) {
return 0;
}
/* Check if s is a 'using' node */
while (s && checkAttribute(s,k_nodetype,k_using)) {
while (s && HashCheckAttr(s,k_nodetype,k_using)) {
String *uname = Getattr(s,k_uname);
Symtab *un = Getattr(s,k_symsymtab);
Node *ss = (Strcmp(name,uname) || (un != n)) ?
Node *ss = (!StringEqual(name,uname) || (un != n)) ?
Swig_symbol_clookup(uname, un) : 0; /* avoid infinity loop */
if (!ss) {
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,k_uname));
@ -1047,7 +1067,7 @@ Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc)(Node
if (!n) {
hsym = current_symtab;
} else {
if (!checkAttribute(n,k_nodetype,k_symboltable)) {
if (!HashCheckAttr(n,k_nodetype,k_symboltable)) {
n = Getattr(n,k_symsymtab);
}
assert(n);
@ -1086,7 +1106,7 @@ Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc)(Node
return 0;
}
/* Check if s is a 'using' node */
while (s && checkAttribute(s,k_nodetype,k_using)) {
while (s && HashCheckAttr(s,k_nodetype,k_using)) {
Node *ss;
ss = Swig_symbol_clookup(Getattr(s,k_uname), Getattr(s,k_symsymtab));
if (!ss && !checkfunc) {
@ -1110,7 +1130,7 @@ Swig_symbol_clookup_local(String_or_char *name, Symtab *n) {
hsym = current_symtab;
h = ccurrent;
} else {
if (!checkAttribute(n,k_nodetype,k_symboltable)) {
if (!HashCheckAttr(n,k_nodetype,k_symboltable)) {
n = Getattr(n,k_symsymtab);
}
assert(n);
@ -1134,7 +1154,7 @@ Swig_symbol_clookup_local(String_or_char *name, Symtab *n) {
}
if (!s) return 0;
/* Check if s is a 'using' node */
while (s && checkAttribute(s,k_nodetype,k_using)) {
while (s && HashCheckAttr(s,k_nodetype,k_using)) {
Node *ss = Swig_symbol_clookup_local(Getattr(s,k_uname), Getattr(s,k_symsymtab));
if (!ss) {
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,k_uname));
@ -1157,7 +1177,7 @@ Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*checkfunc
hsym = current_symtab;
h = ccurrent;
} else {
if (!checkAttribute(n,k_nodetype,k_symboltable)) {
if (!HashCheckAttr(n,k_nodetype,k_symboltable)) {
n = Getattr(n,k_symsymtab);
}
assert(n);
@ -1181,7 +1201,7 @@ Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*checkfunc
}
if (!s) return 0;
/* Check if s is a 'using' node */
while (s && checkAttribute(s,k_nodetype,k_using)) {
while (s && HashCheckAttr(s,k_nodetype,k_using)) {
Node *ss = Swig_symbol_clookup_local_check(Getattr(s,k_uname), Getattr(s,k_symsymtab),checkfunc);
if (!ss && !checkfunc) {
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,k_uname));
@ -1293,7 +1313,7 @@ Swig_symbol_remove(Node *n) {
String *
Swig_symbol_qualified(Node *n) {
Hash *symtab;
if (checkAttribute(n,k_nodetype,k_symboltable)) {
if (HashCheckAttr(n,k_nodetype,k_symboltable)) {
symtab = n;
} else {
symtab = Getattr(n,k_symsymtab);
@ -1326,7 +1346,7 @@ static int no_constructor(Node *n) {
#ifdef SWIG_DEBUG
Printf(stderr,"node type %s\n", Getattr(n,k_name), type);
#endif
return !checkAttribute(n, k_nodetype, k_constructor);
return !HashCheckAttr(n, k_nodetype, k_constructor);
}
static SwigType *
@ -1342,7 +1362,7 @@ Swig_symbol_template_qualify(const SwigType *e, Symtab *st) {
qprefix = Swig_symbol_type_qualify(tprefix,st);
targs = SwigType_parmlist(e);
tempn = Swig_symbol_clookup_local(tprefix,st);
tscope = tempn ? Getattr(tempn,"sym:symtab") : 0;
tscope = tempn ? Getattr(tempn,k_symsymtab) : 0;
Printf(qprefix,"<(");
for (ti = First(targs); ti.item;) {
String *vparm;
@ -1523,7 +1543,7 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
}
}
nt = Getattr(n,k_nodetype);
if (Strcmp(nt,k_using) == 0) {
if (StringEqual(nt,k_using)) {
String *uname = Getattr(n,k_uname);
if (uname) {
n = Swig_symbol_clookup(base,Getattr(n,k_symsymtab));
@ -1537,9 +1557,9 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
}
}
}
if (Strcmp(nt,k_cdecl) == 0) {
if (StringEqual(nt,k_cdecl)) {
String *storage = Getattr(n,k_storage);
if (storage && (Strcmp(storage,k_typedef) == 0)) {
if (storage && (StringEqual(storage,k_typedef))) {
SwigType *decl;
SwigType *rt;
SwigType *qt;
@ -1746,13 +1766,12 @@ Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
Symtab *tsdecl = Getattr(tempn,k_symsymtab);
#ifdef SWIG_DEBUG
Printf(stderr,"deftype type %s %s %s\n", tprefix, targs,
tsuffix);
Printf(stderr,"deftype type %s %s %s\n", tprefix, targs,tsuffix);
#endif
Append(tprefix,"<(");
Swig_symbol_template_defargs(tparms, tnargs,tscope,tsdecl);
p = tparms;
tscope = Getattr(tempn,"sym:symtab");
tscope = tsdecl;
while (p) {
SwigType *ptype = Getattr(p,k_type);
SwigType *ttr = ptype ? ptype : Getattr(p,k_value);
@ -1809,7 +1828,7 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab)
lastnode = n;
if (n) {
String *nt = Getattr(n,k_nodetype);
if (Strcmp(nt,k_enumitem) == 0) {
if (StringEqual(nt,k_enumitem)) {
/* An enum item. Generate a fully qualified name */
String *qn = Swig_symbol_qualified(n);
if (Len(qn)) {
@ -1822,7 +1841,7 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab)
Delete(qn);
break;
}
} else if ((Strcmp(nt,k_cdecl) == 0)) {
} else if ((StringEqual(nt,k_cdecl))) {
String *nv = Getattr(n,k_value);
if (nv) {
Delete(value);

View file

@ -661,7 +661,7 @@ Swig_typemap_search(const String_or_char *op, SwigType *type, const String_or_ch
if (!unstripped) {
unstripped = ctype;
ctype = SwigType_strip_qualifiers(ctype);
if (Strcmp(ctype,unstripped) != 0) continue; /* Types are different */
if (!StringEqual(ctype,unstripped)) continue; /* Types are different */
Delete(ctype);
ctype = unstripped;
unstripped = 0;
@ -1325,7 +1325,7 @@ Printf(stdout, "Swig_typemap_lookup %s [%s %s]\n", op, type, pname ? pname : "NO
Delete(locals);
}
if (checkAttribute(tm,k_type,k_SWIGTYPE)) {
if (HashCheckAttr(tm,k_type,k_SWIGTYPE)) {
sprintf(temp,"%s:SWIGTYPE", Char(op));
Setattr(node,tmop_name(temp),k_one);
}
@ -1499,7 +1499,7 @@ Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f)
typemap_replace_vars(s,locals,type,type,pname,lname,i+1);
}
if (checkAttribute(tm,k_type,k_SWIGTYPE)) {
if (HashCheckAttr(tm,k_type,k_SWIGTYPE)) {
sprintf(temp,"%s:SWIGTYPE", Char(op));
Setattr(p,tmop_name(temp),k_one);
}