fix several memory leaks and add static keys like 'k_name'
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7034 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9c094a08ee
commit
32783162e0
1 changed files with 230 additions and 162 deletions
|
|
@ -174,6 +174,33 @@ static Hash *current_symtab = 0; /* Current symbol table node */
|
||||||
static Hash *symtabs = 0; /* Hash of all symbol tables by fully-qualified name */
|
static Hash *symtabs = 0; /* Hash of all symbol tables by fully-qualified name */
|
||||||
static Hash *global_scope = 0; /* Global scope */
|
static Hash *global_scope = 0; /* Global scope */
|
||||||
|
|
||||||
|
/* common attribute keys, to avoid calling find_key all the times */
|
||||||
|
static String *k_name = 0;
|
||||||
|
static String *k_coloncolon = 0;
|
||||||
|
static String *k_decl = 0;
|
||||||
|
static String *k_cdecl = 0;
|
||||||
|
static String *k_uname = 0;
|
||||||
|
static String *k_type = 0;
|
||||||
|
static String *k_templateparms = 0;
|
||||||
|
static String *k_symtab = 0;
|
||||||
|
static String *k_csymtab = 0;
|
||||||
|
static String *k_using = 0;
|
||||||
|
static String *k_inherit = 0;
|
||||||
|
static String *k_value = 0;
|
||||||
|
static String *k_symboltable = 0;
|
||||||
|
static String *k_storage = 0;
|
||||||
|
static String *k_typedef = 0;
|
||||||
|
static String *k_symname = 0;
|
||||||
|
static String *k_symsymtab = 0;
|
||||||
|
static String *k_sympreviousSibling = 0;
|
||||||
|
static String *k_symnextSibling = 0;
|
||||||
|
static String *k_symovername = 0;
|
||||||
|
static String *k_symoverloaded = 0;
|
||||||
|
static String *k_csympreviousSibling = 0;
|
||||||
|
static String *k_csymnextSibling = 0;
|
||||||
|
static String *k_enumitem = 0;
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void
|
void
|
||||||
Swig_symbol_dump_symtable() {
|
Swig_symbol_dump_symtable() {
|
||||||
|
|
@ -197,12 +224,37 @@ Swig_symbol_dump_symtable() {
|
||||||
|
|
||||||
void
|
void
|
||||||
Swig_symbol_init() {
|
Swig_symbol_init() {
|
||||||
|
k_name = NewString("name");
|
||||||
|
k_coloncolon = NewString("::");
|
||||||
|
k_decl = NewString("decl");
|
||||||
|
k_cdecl = NewString("cdecl");
|
||||||
|
k_uname = NewString("uname");
|
||||||
|
k_type = NewString("type");
|
||||||
|
k_templateparms = NewString("templateparms");
|
||||||
|
k_symtab = NewString("symtab");
|
||||||
|
k_symsymtab = NewString("sym:symtab");
|
||||||
|
k_csymtab = NewString("csymtab");
|
||||||
|
k_using = NewString("using");
|
||||||
|
k_inherit = NewString("inherit");
|
||||||
|
k_value = NewString("value");
|
||||||
|
k_symboltable = NewString("symboltable");
|
||||||
|
k_storage = NewString("storage");
|
||||||
|
k_typedef = NewString("typedef");
|
||||||
|
k_symname = NewString("sym:name");
|
||||||
|
k_sympreviousSibling = NewString("sym:previousSibling");
|
||||||
|
k_symnextSibling = NewString("sym:nextSibling");
|
||||||
|
k_symovername = NewString("sym:overname");
|
||||||
|
k_symoverloaded = NewString("sym:overloaded");
|
||||||
|
k_csympreviousSibling = NewString("csym:previousSibling");
|
||||||
|
k_csymnextSibling = NewString("csym:nextSibling");
|
||||||
|
k_enumitem = NewString("enumitem");
|
||||||
|
|
||||||
current = NewHash();
|
current = NewHash();
|
||||||
current_symtab = NewHash();
|
current_symtab = NewHash();
|
||||||
ccurrent = NewHash();
|
ccurrent = NewHash();
|
||||||
set_nodeType(current_symtab,"symboltable");
|
set_nodeType(current_symtab,k_symboltable);
|
||||||
Setattr(current_symtab,"symtab",current);
|
Setattr(current_symtab,k_symtab,current);
|
||||||
Setattr(current_symtab,"csymtab", ccurrent);
|
Setattr(current_symtab,k_csymtab, ccurrent);
|
||||||
|
|
||||||
/* Set the global scope */
|
/* Set the global scope */
|
||||||
symtabs = NewHash();
|
symtabs = NewHash();
|
||||||
|
|
@ -219,8 +271,8 @@ Swig_symbol_init() {
|
||||||
void
|
void
|
||||||
Swig_symbol_setscopename(const String_or_char *name) {
|
Swig_symbol_setscopename(const String_or_char *name) {
|
||||||
String *qname;
|
String *qname;
|
||||||
assert(!Getattr(current_symtab,"name"));
|
assert(!Getattr(current_symtab,k_name));
|
||||||
Setattr(current_symtab,"name",name);
|
Setattr(current_symtab,k_name,name);
|
||||||
|
|
||||||
/* Set nested scope in parent */
|
/* Set nested scope in parent */
|
||||||
|
|
||||||
|
|
@ -228,6 +280,7 @@ Swig_symbol_setscopename(const String_or_char *name) {
|
||||||
|
|
||||||
/* Save a reference to this scope */
|
/* Save a reference to this scope */
|
||||||
Setattr(symtabs,qname,current_symtab);
|
Setattr(symtabs,qname,current_symtab);
|
||||||
|
Delete(qname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -238,7 +291,7 @@ Swig_symbol_setscopename(const String_or_char *name) {
|
||||||
|
|
||||||
String *
|
String *
|
||||||
Swig_symbol_getscopename() {
|
Swig_symbol_getscopename() {
|
||||||
return Getattr(current_symtab,"name");
|
return Getattr(current_symtab,k_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -250,7 +303,7 @@ Swig_symbol_getscopename() {
|
||||||
Symtab *
|
Symtab *
|
||||||
Swig_symbol_getscope(const String_or_char *name) {
|
Swig_symbol_getscope(const String_or_char *name) {
|
||||||
if (!symtabs) return 0;
|
if (!symtabs) return 0;
|
||||||
if (Strcmp(name,"::") == 0) name = "";
|
if (Strcmp(name,k_coloncolon) == 0) name = "";
|
||||||
return Getattr(symtabs,name);
|
return Getattr(symtabs,name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -271,7 +324,7 @@ Swig_symbol_qualifiedscopename(Symtab *symtab) {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
result = Swig_symbol_qualifiedscopename(parent);
|
result = Swig_symbol_qualifiedscopename(parent);
|
||||||
}
|
}
|
||||||
name = Getattr(symtab,"name");
|
name = Getattr(symtab,k_name);
|
||||||
if (name) {
|
if (name) {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
result = NewString("");
|
result = NewString("");
|
||||||
|
|
@ -300,8 +353,8 @@ Swig_symbol_newscope()
|
||||||
hsyms = NewHash();
|
hsyms = NewHash();
|
||||||
h = NewHash();
|
h = NewHash();
|
||||||
|
|
||||||
set_nodeType(h,"symboltable");
|
set_nodeType(h,k_symboltable);
|
||||||
Setattr(h,"symtab",hsyms);
|
Setattr(h,k_symtab,hsyms);
|
||||||
set_parentNode(h,current_symtab);
|
set_parentNode(h,current_symtab);
|
||||||
|
|
||||||
n = lastChild(current_symtab);
|
n = lastChild(current_symtab);
|
||||||
|
|
@ -313,7 +366,7 @@ Swig_symbol_newscope()
|
||||||
set_lastChild(current_symtab,h);
|
set_lastChild(current_symtab,h);
|
||||||
current = hsyms;
|
current = hsyms;
|
||||||
ccurrent = NewHash();
|
ccurrent = NewHash();
|
||||||
Setattr(h,"csymtab",ccurrent);
|
Setattr(h,k_csymtab,ccurrent);
|
||||||
current_symtab = h;
|
current_symtab = h;
|
||||||
return current_symtab;
|
return current_symtab;
|
||||||
}
|
}
|
||||||
|
|
@ -328,9 +381,9 @@ Symtab *
|
||||||
Swig_symbol_setscope(Symtab *sym) {
|
Swig_symbol_setscope(Symtab *sym) {
|
||||||
Symtab *ret = current_symtab;
|
Symtab *ret = current_symtab;
|
||||||
current_symtab = sym;
|
current_symtab = sym;
|
||||||
current = Getattr(sym,"symtab");
|
current = Getattr(sym,k_symtab);
|
||||||
assert(current);
|
assert(current);
|
||||||
ccurrent = Getattr(sym,"csymtab");
|
ccurrent = Getattr(sym,k_csymtab);
|
||||||
assert(ccurrent);
|
assert(ccurrent);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -347,9 +400,9 @@ Swig_symbol_popscope() {
|
||||||
Hash *h = current_symtab;
|
Hash *h = current_symtab;
|
||||||
current_symtab = parentNode(current_symtab);
|
current_symtab = parentNode(current_symtab);
|
||||||
assert(current_symtab);
|
assert(current_symtab);
|
||||||
current = Getattr(current_symtab,"symtab");
|
current = Getattr(current_symtab,k_symtab);
|
||||||
assert(current);
|
assert(current);
|
||||||
ccurrent = Getattr(current_symtab,"csymtab");
|
ccurrent = Getattr(current_symtab,k_csymtab);
|
||||||
assert(ccurrent);
|
assert(ccurrent);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
@ -373,8 +426,7 @@ Swig_symbol_current() {
|
||||||
|
|
||||||
void
|
void
|
||||||
Swig_symbol_alias(String_or_char *aliasname, Symtab *s) {
|
Swig_symbol_alias(String_or_char *aliasname, Symtab *s) {
|
||||||
String *qname;
|
String *qname = Swig_symbol_qualifiedscopename(current_symtab);
|
||||||
qname = Swig_symbol_qualifiedscopename(current_symtab);
|
|
||||||
if (qname) {
|
if (qname) {
|
||||||
Printf(qname,"::%s", aliasname);
|
Printf(qname,"::%s", aliasname);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -383,6 +435,7 @@ Swig_symbol_alias(String_or_char *aliasname, Symtab *s) {
|
||||||
if (!Getattr(symtabs,qname)) {
|
if (!Getattr(symtabs,qname)) {
|
||||||
Setattr(symtabs,qname,s);
|
Setattr(symtabs,qname,s);
|
||||||
}
|
}
|
||||||
|
Delete(qname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -393,10 +446,10 @@ Swig_symbol_alias(String_or_char *aliasname, Symtab *s) {
|
||||||
|
|
||||||
void Swig_symbol_inherit(Symtab *s) {
|
void Swig_symbol_inherit(Symtab *s) {
|
||||||
int i;
|
int i;
|
||||||
List *inherit = Getattr(current_symtab,"inherit");
|
List *inherit = Getattr(current_symtab,k_inherit);
|
||||||
if (!inherit) {
|
if (!inherit) {
|
||||||
inherit = NewList();
|
inherit = NewList();
|
||||||
Setattr(current_symtab,"inherit", inherit);
|
Setattr(current_symtab,k_inherit, inherit);
|
||||||
}
|
}
|
||||||
assert(s != current_symtab);
|
assert(s != current_symtab);
|
||||||
for (i = 0; i < Len(inherit); i++) {
|
for (i = 0; i < Len(inherit); i++) {
|
||||||
|
|
@ -486,10 +539,10 @@ Swig_symbol_cadd(String_or_char *name, Node *n) {
|
||||||
/* already added. Bail */
|
/* already added. Bail */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fn = Getattr(fn,"csym:nextSibling");
|
fn = Getattr(fn,k_csymnextSibling);
|
||||||
}
|
}
|
||||||
if (pn) {
|
if (pn) {
|
||||||
Setattr(pn,"csym:nextSibling",append);
|
Setattr(pn,k_csymnextSibling,append);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -506,19 +559,19 @@ Swig_symbol_cadd(String_or_char *name, Node *n) {
|
||||||
|
|
||||||
{
|
{
|
||||||
Node *td = n;
|
Node *td = n;
|
||||||
while (td && (Strcmp(nodeType(td),"cdecl") == 0) && (checkAttribute(td,"storage","typedef"))) {
|
while (td && (Strcmp(nodeType(td),k_cdecl) == 0) && (checkAttribute(td,k_storage,k_typedef))) {
|
||||||
SwigType *type;
|
SwigType *type;
|
||||||
Node *td1;
|
Node *td1;
|
||||||
type = Copy(Getattr(td,"type"));
|
type = Copy(Getattr(td,k_type));
|
||||||
SwigType_push(type,Getattr(td,"decl"));
|
SwigType_push(type,Getattr(td,k_decl));
|
||||||
td1 = Swig_symbol_clookup(type,0);
|
td1 = Swig_symbol_clookup(type,0);
|
||||||
Delete(type);
|
Delete(type);
|
||||||
if (td1 == td) break;
|
if (td1 == td) break;
|
||||||
td = td1;
|
td = td1;
|
||||||
if (td) {
|
if (td) {
|
||||||
Symtab *st = Getattr(td,"symtab");
|
Symtab *st = Getattr(td,k_symtab);
|
||||||
if (st) {
|
if (st) {
|
||||||
Swig_symbol_alias(Getattr(n,"name"),st);
|
Swig_symbol_alias(Getattr(n,k_name),st);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -544,7 +597,7 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
|
||||||
int nt = 0, ct = 0;
|
int nt = 0, ct = 0;
|
||||||
int pn = 0;
|
int pn = 0;
|
||||||
int u1 = 0, u2 = 0;
|
int u1 = 0, u2 = 0;
|
||||||
String *name;
|
String *name, *overname;
|
||||||
|
|
||||||
/* See if the node has a name. If so, we place in the C symbol table for this
|
/* See if the node has a name. If so, we place in the C symbol table for this
|
||||||
scope. We don't worry about overloading here---the primary purpose of this
|
scope. We don't worry about overloading here---the primary purpose of this
|
||||||
|
|
@ -569,14 +622,14 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
|
||||||
stays in the C symbol table (so that it can be expanded using %template).
|
stays in the C symbol table (so that it can be expanded using %template).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
name = Getattr(n,"name");
|
name = Getattr(n,k_name);
|
||||||
if (name && Len(name)) {
|
if (name && Len(name)) {
|
||||||
Swig_symbol_cadd(name,n);
|
Swig_symbol_cadd(name,n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No symbol name defined. We return. */
|
/* No symbol name defined. We return. */
|
||||||
if (!symname) {
|
if (!symname) {
|
||||||
Setattr(n,"sym:symtab",current_symtab);
|
Setattr(n,k_symsymtab,current_symtab);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -615,12 +668,12 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
|
||||||
cl = c;
|
cl = c;
|
||||||
while (cl) {
|
while (cl) {
|
||||||
pcl = cl;
|
pcl = cl;
|
||||||
cl = Getattr(cl,"sym:nextSibling");
|
cl = Getattr(cl,k_symnextSibling);
|
||||||
}
|
}
|
||||||
Setattr(pcl,"sym:nextSibling",n);
|
Setattr(pcl,k_symnextSibling,n);
|
||||||
Setattr(n,"sym:symtab", current_symtab);
|
Setattr(n,k_symsymtab, current_symtab);
|
||||||
Setattr(n,"sym:name", symname);
|
Setattr(n,k_symname, symname);
|
||||||
Setattr(n,"sym:previousSibling", pcl);
|
Setattr(n,k_sympreviousSibling, pcl);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
if (Getattr(n,"allows_typedef")) nt = 1;
|
if (Getattr(n,"allows_typedef")) nt = 1;
|
||||||
|
|
@ -642,21 +695,21 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
|
||||||
other = n;
|
other = n;
|
||||||
}
|
}
|
||||||
/* Make sure the other node is a typedef */
|
/* Make sure the other node is a typedef */
|
||||||
s = Getattr(other,"storage");
|
s = Getattr(other,k_storage);
|
||||||
if (!s || (Strcmp(s,"typedef"))) return c; /* No. This is a conflict */
|
if (!s || (Strcmp(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 */
|
/* Hmmm. This appears to be okay. Make sure the symbol table refers to the allow_type node */
|
||||||
|
|
||||||
if (td != c) {
|
if (td != c) {
|
||||||
Setattr(current,symname, td);
|
Setattr(current,symname, td);
|
||||||
Setattr(td,"sym:symtab", current_symtab);
|
Setattr(td,k_symsymtab, current_symtab);
|
||||||
Setattr(td,"sym:name", symname);
|
Setattr(td,k_symname, symname);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
decl = Getattr(c,"decl");
|
decl = Getattr(c,k_decl);
|
||||||
ndecl = Getattr(n,"decl");
|
ndecl = Getattr(n,k_decl);
|
||||||
|
|
||||||
{
|
{
|
||||||
String *nt1, *nt2;
|
String *nt1, *nt2;
|
||||||
|
|
@ -678,32 +731,32 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
|
||||||
|
|
||||||
/* Hmmm. Declarator seems to indicate that this is a function */
|
/* Hmmm. Declarator seems to indicate that this is a function */
|
||||||
/* Look at storage class to see if compatible */
|
/* Look at storage class to see if compatible */
|
||||||
cstorage = Getattr(c,"storage");
|
cstorage = Getattr(c,k_storage);
|
||||||
nstorage = Getattr(n,"storage");
|
nstorage = Getattr(n,k_storage);
|
||||||
|
|
||||||
/* If either one is declared as typedef, forget it. We're hosed */
|
/* If either one is declared as typedef, forget it. We're hosed */
|
||||||
if (Cmp(cstorage,"typedef") == 0) {
|
if (Cmp(cstorage,k_typedef) == 0) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
if (Cmp(nstorage,"typedef") == 0) {
|
if (Cmp(nstorage,k_typedef) == 0) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Okay. Walk down the list of symbols and see if we get a declarator match */
|
/* 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"),"cdecl") == 0);
|
int n_template = (Strcmp(nodeType(n),"template") == 0) && (Strcmp(Getattr(n,"templatetype"),k_cdecl) == 0);
|
||||||
int n_plain_cdecl = (Strcmp(nodeType(n),"cdecl") == 0);
|
int n_plain_cdecl = (Strcmp(nodeType(n),k_cdecl) == 0);
|
||||||
cn = c;
|
cn = c;
|
||||||
pn = 0;
|
pn = 0;
|
||||||
while (cn) {
|
while (cn) {
|
||||||
decl = Getattr(cn,"decl");
|
decl = Getattr(cn,k_decl);
|
||||||
if (!(u1 || u2)) {
|
if (!(u1 || u2)) {
|
||||||
if (Cmp(ndecl,decl) == 0) {
|
if (Cmp(ndecl,decl) == 0) {
|
||||||
/* Declarator conflict */
|
/* Declarator conflict */
|
||||||
/* Now check we don't have a non-templated function overloaded by a templated function with same params,
|
/* 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(); */
|
* eg void foo(); template<typename> void foo(); */
|
||||||
int cn_template = (Strcmp(nodeType(cn),"template") == 0) && (Strcmp(Getattr(cn,"templatetype"),"cdecl") == 0);
|
int cn_template = (Strcmp(nodeType(cn),"template") == 0) && (Strcmp(Getattr(cn,"templatetype"),k_cdecl) == 0);
|
||||||
int cn_plain_cdecl = (Strcmp(nodeType(cn),"cdecl") == 0);
|
int cn_plain_cdecl = (Strcmp(nodeType(cn),k_cdecl) == 0);
|
||||||
if (!((n_template && cn_plain_cdecl) || (cn_template && n_plain_cdecl))) {
|
if (!((n_template && cn_plain_cdecl) || (cn_template && n_plain_cdecl))) {
|
||||||
/* found a conflict */
|
/* found a conflict */
|
||||||
return cn;
|
return cn;
|
||||||
|
|
@ -711,30 +764,34 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cl = cn;
|
cl = cn;
|
||||||
cn = Getattr(cn,"sym:nextSibling");
|
cn = Getattr(cn,k_symnextSibling);
|
||||||
pn++;
|
pn++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Well, we made it this far. Guess we can drop the symbol in place */
|
/* Well, we made it this far. Guess we can drop the symbol in place */
|
||||||
Setattr(n,"sym:symtab",current_symtab);
|
Setattr(n,k_symsymtab,current_symtab);
|
||||||
Setattr(n,"sym:name",symname);
|
Setattr(n,k_symname,symname);
|
||||||
/* Printf(stdout,"%s %x\n", Getattr(n,"sym:overname"), current_symtab); */
|
/* Printf(stdout,"%s %x\n", Getattr(n,k_symovername), current_symtab); */
|
||||||
assert(!Getattr(n,"sym:overname"));
|
assert(!Getattr(n,k_symovername));
|
||||||
Setattr(n,"sym:overname", NewStringf("__SWIG_%d", pn));
|
overname = NewStringf("__SWIG_%d", pn);
|
||||||
/*Printf(stdout,"%s %s %s\n", symname, Getattr(n,"decl"), Getattr(n,"sym:overname")); */
|
Setattr(n,k_symovername, overname);
|
||||||
Setattr(cl,"sym:nextSibling",n);
|
/*Printf(stdout,"%s %s %s\n", symname, Getattr(n,k_decl), Getattr(n,k_symovername)); */
|
||||||
Setattr(n,"sym:previousSibling",cl);
|
Setattr(cl,k_symnextSibling,n);
|
||||||
Setattr(cl,"sym:overloaded",c);
|
Setattr(n,k_sympreviousSibling,cl);
|
||||||
Setattr(n,"sym:overloaded",c);
|
Setattr(cl,k_symoverloaded,c);
|
||||||
|
Setattr(n,k_symoverloaded,c);
|
||||||
|
Delete(overname);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No conflict. Just add it */
|
/* No conflict. Just add it */
|
||||||
Setattr(n,"sym:symtab",current_symtab);
|
Setattr(n,k_symsymtab,current_symtab);
|
||||||
Setattr(n,"sym:name",symname);
|
Setattr(n,k_symname,symname);
|
||||||
/* Printf(stdout,"%s\n", Getattr(n,"sym:overname")); */
|
/* Printf(stdout,"%s\n", Getattr(n,k_symovername)); */
|
||||||
Setattr(n,"sym:overname", NewStringf("__SWIG_%d", pn));
|
overname = NewStringf("__SWIG_%d", pn);
|
||||||
/* Printf(stdout,"%s %s %s\n", symname, Getattr(n,"decl"), Getattr(n,"sym:overname")); */
|
Setattr(n,k_symovername, overname);
|
||||||
|
Delete(overname);
|
||||||
|
/* Printf(stdout,"%s %s %s\n", symname, Getattr(n,k_decl), Getattr(n,k_symovername)); */
|
||||||
Setattr(current,symname,n);
|
Setattr(current,symname,n);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
@ -757,7 +814,7 @@ static Node *
|
||||||
symbol_lookup(String_or_char *name, Symtab *symtab, int (*check)(Node *n)) {
|
symbol_lookup(String_or_char *name, Symtab *symtab, int (*check)(Node *n)) {
|
||||||
Node *n;
|
Node *n;
|
||||||
List *inherit;
|
List *inherit;
|
||||||
Hash *sym = Getattr(symtab,"csymtab");
|
Hash *sym = Getattr(symtab,k_csymtab);
|
||||||
if (Getmark(symtab)) return 0;
|
if (Getmark(symtab)) return 0;
|
||||||
Setmark(symtab,1);
|
Setmark(symtab,1);
|
||||||
|
|
||||||
|
|
@ -765,7 +822,7 @@ symbol_lookup(String_or_char *name, Symtab *symtab, int (*check)(Node *n)) {
|
||||||
n = Getattr(sym,name);
|
n = Getattr(sym,name);
|
||||||
|
|
||||||
#ifdef SWIG_DEBUG
|
#ifdef SWIG_DEBUG
|
||||||
Printf(stderr,"symbol_look %s %x %x %s\n", name, n, symtab, Getattr(symtab,"name"));
|
Printf(stderr,"symbol_look %s %x %x %s\n", name, n, symtab, Getattr(symtab,k_name));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
|
|
@ -798,7 +855,7 @@ symbol_lookup(String_or_char *name, Symtab *symtab, int (*check)(Node *n)) {
|
||||||
if (n) return n;
|
if (n) return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
inherit = Getattr(symtab,"inherit");
|
inherit = Getattr(symtab,k_inherit);
|
||||||
if (inherit) {
|
if (inherit) {
|
||||||
int i,len;
|
int i,len;
|
||||||
len = Len(inherit);
|
len = Len(inherit);
|
||||||
|
|
@ -840,12 +897,13 @@ symbol_lookup_qualified(String_or_char *name, Symtab *symtab, String *prefix, in
|
||||||
Node *n = 0;
|
Node *n = 0;
|
||||||
/* Make qualified name of current scope */
|
/* Make qualified name of current scope */
|
||||||
qname = Swig_symbol_qualifiedscopename(symtab);
|
qname = Swig_symbol_qualifiedscopename(symtab);
|
||||||
if (qname && Len(qname)) {
|
if (Len(qname)) {
|
||||||
if (Len(prefix)) {
|
if (Len(prefix)) {
|
||||||
Append(qname,"::");
|
Append(qname,k_coloncolon);
|
||||||
Append(qname,prefix);
|
Append(qname,prefix);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Delete(qname);
|
||||||
qname = NewString(prefix);
|
qname = NewString(prefix);
|
||||||
}
|
}
|
||||||
st = Getattr(symtabs,qname);
|
st = Getattr(symtabs,qname);
|
||||||
|
|
@ -884,8 +942,8 @@ Swig_symbol_clookup(String_or_char *name, Symtab *n) {
|
||||||
if (!n) {
|
if (!n) {
|
||||||
hsym = current_symtab;
|
hsym = current_symtab;
|
||||||
} else {
|
} else {
|
||||||
if (Strcmp(nodeType(n),"symboltable")) {
|
if (Strcmp(nodeType(n),k_symboltable)) {
|
||||||
n = Getattr(n,"sym:symtab");
|
n = Getattr(n,k_symsymtab);
|
||||||
}
|
}
|
||||||
assert(n);
|
assert(n);
|
||||||
if (n) {
|
if (n) {
|
||||||
|
|
@ -894,7 +952,7 @@ Swig_symbol_clookup(String_or_char *name, Symtab *n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Swig_scopename_check(name)) {
|
if (Swig_scopename_check(name)) {
|
||||||
if (Strncmp(name,"::",2) == 0) {
|
if (Strncmp(name,k_coloncolon,2) == 0) {
|
||||||
String *nname = NewString(Char(name)+2);
|
String *nname = NewString(Char(name)+2);
|
||||||
if (Swig_scopename_check(nname)) {
|
if (Swig_scopename_check(nname)) {
|
||||||
s = symbol_lookup_qualified(nname,global_scope,0,0,0);
|
s = symbol_lookup_qualified(nname,global_scope,0,0,0);
|
||||||
|
|
@ -922,11 +980,11 @@ Swig_symbol_clookup(String_or_char *name, Symtab *n) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Check if s is a 'using' node */
|
/* Check if s is a 'using' node */
|
||||||
while (s && Strcmp(nodeType(s),"using") == 0) {
|
while (s && Strcmp(nodeType(s),k_using) == 0) {
|
||||||
Node *ss;
|
Node *ss;
|
||||||
ss = Swig_symbol_clookup(Getattr(s,"uname"), Getattr(s,"sym:symtab"));
|
ss = Swig_symbol_clookup(Getattr(s,k_uname), Getattr(s,k_symsymtab));
|
||||||
if (!ss) {
|
if (!ss) {
|
||||||
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,"uname"));
|
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,k_uname));
|
||||||
}
|
}
|
||||||
s = ss;
|
s = ss;
|
||||||
}
|
}
|
||||||
|
|
@ -951,8 +1009,8 @@ Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc)(Node
|
||||||
if (!n) {
|
if (!n) {
|
||||||
hsym = current_symtab;
|
hsym = current_symtab;
|
||||||
} else {
|
} else {
|
||||||
if (Strcmp(nodeType(n),"symboltable")) {
|
if (Strcmp(nodeType(n),k_symboltable)) {
|
||||||
n = Getattr(n,"sym:symtab");
|
n = Getattr(n,k_symsymtab);
|
||||||
}
|
}
|
||||||
assert(n);
|
assert(n);
|
||||||
if (n) {
|
if (n) {
|
||||||
|
|
@ -961,7 +1019,7 @@ Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc)(Node
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Swig_scopename_check(name)) {
|
if (Swig_scopename_check(name)) {
|
||||||
if (Strncmp(name,"::",2) == 0) {
|
if (Strncmp(name,k_coloncolon,2) == 0) {
|
||||||
String *nname = NewString(Char(name)+2);
|
String *nname = NewString(Char(name)+2);
|
||||||
if (Swig_scopename_check(nname)) {
|
if (Swig_scopename_check(nname)) {
|
||||||
s = symbol_lookup_qualified(nname,global_scope,0,0,checkfunc);
|
s = symbol_lookup_qualified(nname,global_scope,0,0,checkfunc);
|
||||||
|
|
@ -990,11 +1048,11 @@ Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc)(Node
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Check if s is a 'using' node */
|
/* Check if s is a 'using' node */
|
||||||
while (s && Strcmp(nodeType(s),"using") == 0) {
|
while (s && Strcmp(nodeType(s),k_using) == 0) {
|
||||||
Node *ss;
|
Node *ss;
|
||||||
ss = Swig_symbol_clookup(Getattr(s,"uname"), Getattr(s,"sym:symtab"));
|
ss = Swig_symbol_clookup(Getattr(s,k_uname), Getattr(s,k_symsymtab));
|
||||||
if (!ss && !checkfunc) {
|
if (!ss && !checkfunc) {
|
||||||
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,"uname"));
|
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,k_uname));
|
||||||
}
|
}
|
||||||
s = ss;
|
s = ss;
|
||||||
}
|
}
|
||||||
|
|
@ -1014,16 +1072,16 @@ Swig_symbol_clookup_local(String_or_char *name, Symtab *n) {
|
||||||
hsym = current_symtab;
|
hsym = current_symtab;
|
||||||
h = ccurrent;
|
h = ccurrent;
|
||||||
} else {
|
} else {
|
||||||
if (Strcmp(nodeType(n),"symboltable")) {
|
if (Strcmp(nodeType(n),k_symboltable)) {
|
||||||
n = Getattr(n,"sym:symtab");
|
n = Getattr(n,k_symsymtab);
|
||||||
}
|
}
|
||||||
assert(n);
|
assert(n);
|
||||||
hsym = n;
|
hsym = n;
|
||||||
h = Getattr(n,"csymtab");
|
h = Getattr(n,k_csymtab);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Swig_scopename_check(name)) {
|
if (Swig_scopename_check(name)) {
|
||||||
if (Strncmp(name,"::",2) == 0) {
|
if (Strncmp(name,k_coloncolon,2) == 0) {
|
||||||
String *nname = NewString(Char(name)+2);
|
String *nname = NewString(Char(name)+2);
|
||||||
if (Swig_scopename_check(nname)) {
|
if (Swig_scopename_check(nname)) {
|
||||||
s = symbol_lookup_qualified(nname,global_scope,0,0,0);
|
s = symbol_lookup_qualified(nname,global_scope,0,0,0);
|
||||||
|
|
@ -1038,10 +1096,10 @@ Swig_symbol_clookup_local(String_or_char *name, Symtab *n) {
|
||||||
}
|
}
|
||||||
if (!s) return 0;
|
if (!s) return 0;
|
||||||
/* Check if s is a 'using' node */
|
/* Check if s is a 'using' node */
|
||||||
while (s && Strcmp(nodeType(s),"using") == 0) {
|
while (s && Strcmp(nodeType(s),k_using) == 0) {
|
||||||
Node *ss = Swig_symbol_clookup_local(Getattr(s,"uname"), Getattr(s,"sym:symtab"));
|
Node *ss = Swig_symbol_clookup_local(Getattr(s,k_uname), Getattr(s,k_symsymtab));
|
||||||
if (!ss) {
|
if (!ss) {
|
||||||
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,"uname"));
|
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,k_uname));
|
||||||
}
|
}
|
||||||
s = ss;
|
s = ss;
|
||||||
}
|
}
|
||||||
|
|
@ -1061,16 +1119,16 @@ Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*checkfunc
|
||||||
hsym = current_symtab;
|
hsym = current_symtab;
|
||||||
h = ccurrent;
|
h = ccurrent;
|
||||||
} else {
|
} else {
|
||||||
if (Strcmp(nodeType(n),"symboltable")) {
|
if (Strcmp(nodeType(n),k_symboltable)) {
|
||||||
n = Getattr(n,"sym:symtab");
|
n = Getattr(n,k_symsymtab);
|
||||||
}
|
}
|
||||||
assert(n);
|
assert(n);
|
||||||
hsym = n;
|
hsym = n;
|
||||||
h = Getattr(n,"csymtab");
|
h = Getattr(n,k_csymtab);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Swig_scopename_check(name)) {
|
if (Swig_scopename_check(name)) {
|
||||||
if (Strncmp(name,"::",2) == 0) {
|
if (Strncmp(name,k_coloncolon,2) == 0) {
|
||||||
String *nname = NewString(Char(name)+2);
|
String *nname = NewString(Char(name)+2);
|
||||||
if (Swig_scopename_check(nname)) {
|
if (Swig_scopename_check(nname)) {
|
||||||
s = symbol_lookup_qualified(nname,global_scope,0,0,checkfunc);
|
s = symbol_lookup_qualified(nname,global_scope,0,0,checkfunc);
|
||||||
|
|
@ -1085,10 +1143,10 @@ Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*checkfunc
|
||||||
}
|
}
|
||||||
if (!s) return 0;
|
if (!s) return 0;
|
||||||
/* Check if s is a 'using' node */
|
/* Check if s is a 'using' node */
|
||||||
while (s && Strcmp(nodeType(s),"using") == 0) {
|
while (s && Strcmp(nodeType(s),k_using) == 0) {
|
||||||
Node *ss = Swig_symbol_clookup_local_check(Getattr(s,"uname"), Getattr(s,"sym:symtab"),checkfunc);
|
Node *ss = Swig_symbol_clookup_local_check(Getattr(s,k_uname), Getattr(s,k_symsymtab),checkfunc);
|
||||||
if (!ss && !checkfunc) {
|
if (!ss && !checkfunc) {
|
||||||
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,"uname"));
|
Swig_warning(WARN_PARSE_USING_UNDEF, Getfile(s), Getline(s), "Nothing known about '%s'.\n", Getattr(s,k_uname));
|
||||||
}
|
}
|
||||||
s = ss;
|
s = ss;
|
||||||
}
|
}
|
||||||
|
|
@ -1104,7 +1162,7 @@ Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*checkfunc
|
||||||
|
|
||||||
Symtab *
|
Symtab *
|
||||||
Swig_symbol_cscope(String_or_char *name, Symtab *symtab) {
|
Swig_symbol_cscope(String_or_char *name, Symtab *symtab) {
|
||||||
if (Strncmp(name,"::",2) == 0) return symbol_lookup_qualified(0, global_scope, name, 0,0);
|
if (Strncmp(name,k_coloncolon,2) == 0) return symbol_lookup_qualified(0, global_scope, name, 0,0);
|
||||||
return symbol_lookup_qualified(0,symtab,name,0,0);
|
return symbol_lookup_qualified(0,symtab,name,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1120,22 +1178,23 @@ void
|
||||||
Swig_symbol_remove(Node *n) {
|
Swig_symbol_remove(Node *n) {
|
||||||
Symtab *symtab;
|
Symtab *symtab;
|
||||||
String *symname;
|
String *symname;
|
||||||
|
String *overname;
|
||||||
Node *symprev;
|
Node *symprev;
|
||||||
Node *symnext;
|
Node *symnext;
|
||||||
Node *fixovername = 0;
|
Node *fixovername = 0;
|
||||||
symtab = Getattr(n,"sym:symtab"); /* Get symbol table object */
|
symtab = Getattr(n,k_symsymtab); /* Get symbol table object */
|
||||||
symtab = Getattr(symtab,"symtab"); /* Get actual hash table of symbols */
|
symtab = Getattr(symtab,k_symtab); /* Get actual hash table of symbols */
|
||||||
symname = Getattr(n,"sym:name");
|
symname = Getattr(n,k_symname);
|
||||||
symprev = Getattr(n,"sym:previousSibling");
|
symprev = Getattr(n,k_sympreviousSibling);
|
||||||
symnext = Getattr(n,"sym:nextSibling");
|
symnext = Getattr(n,k_symnextSibling);
|
||||||
|
|
||||||
/* If previous symbol, just fix the links */
|
/* If previous symbol, just fix the links */
|
||||||
if (symprev) {
|
if (symprev) {
|
||||||
if (symnext) {
|
if (symnext) {
|
||||||
Setattr(symprev,"sym:nextSibling",symnext);
|
Setattr(symprev,k_symnextSibling,symnext);
|
||||||
fixovername = symprev; /* fix as symbol to remove is somewhere in the middle of the linked list */
|
fixovername = symprev; /* fix as symbol to remove is somewhere in the middle of the linked list */
|
||||||
} else {
|
} else {
|
||||||
Delattr(symprev,"sym:nextSibling");
|
Delattr(symprev,k_symnextSibling);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* If no previous symbol, see if there is a next symbol */
|
/* If no previous symbol, see if there is a next symbol */
|
||||||
|
|
@ -1148,18 +1207,18 @@ Swig_symbol_remove(Node *n) {
|
||||||
}
|
}
|
||||||
if (symnext) {
|
if (symnext) {
|
||||||
if (symprev) {
|
if (symprev) {
|
||||||
Setattr(symnext,"sym:previousSibling",symprev);
|
Setattr(symnext,k_sympreviousSibling,symprev);
|
||||||
} else {
|
} else {
|
||||||
Delattr(symnext,"sym:previousSibling");
|
Delattr(symnext,k_sympreviousSibling);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Delattr(n,"sym:symtab");
|
Delattr(n,k_symsymtab);
|
||||||
Delattr(n,"sym:previousSibling");
|
Delattr(n,k_sympreviousSibling);
|
||||||
Delattr(n,"sym:nextSibling");
|
Delattr(n,k_symnextSibling);
|
||||||
Delattr(n,"csym:nextSibling");
|
Delattr(n,k_csymnextSibling);
|
||||||
Delattr(n,"sym:overname");
|
Delattr(n,k_symovername);
|
||||||
Delattr(n,"csym:previousSibling");
|
Delattr(n,k_csympreviousSibling);
|
||||||
Delattr(n,"sym:overloaded");
|
Delattr(n,k_symoverloaded);
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
if (fixovername) {
|
if (fixovername) {
|
||||||
|
|
@ -1170,17 +1229,19 @@ Swig_symbol_remove(Node *n) {
|
||||||
/* find head of linked list */
|
/* find head of linked list */
|
||||||
while (nn) {
|
while (nn) {
|
||||||
head = nn;
|
head = nn;
|
||||||
nn = Getattr(nn, "sym:previousSibling");
|
nn = Getattr(nn, k_sympreviousSibling);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* adjust all the sym:overname strings to start from 0 and increment by one */
|
/* adjust all the sym:overname strings to start from 0 and increment by one */
|
||||||
nn = head;
|
nn = head;
|
||||||
while (nn) {
|
while (nn) {
|
||||||
assert(Getattr(nn,"sym:overname"));
|
assert(Getattr(nn,k_symovername));
|
||||||
Delattr(nn,"sym:overname");
|
Delattr(nn,k_symovername);
|
||||||
Setattr(nn,"sym:overname", NewStringf("__SWIG_%d", pn));
|
overname = NewStringf("__SWIG_%d", pn);
|
||||||
|
Setattr(nn,k_symovername, overname);
|
||||||
|
Delete(overname);
|
||||||
pn++;
|
pn++;
|
||||||
nn = Getattr(nn,"sym:nextSibling");
|
nn = Getattr(nn,k_symnextSibling);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1194,14 +1255,14 @@ Swig_symbol_remove(Node *n) {
|
||||||
String *
|
String *
|
||||||
Swig_symbol_qualified(Node *n) {
|
Swig_symbol_qualified(Node *n) {
|
||||||
Hash *symtab;
|
Hash *symtab;
|
||||||
if (Strcmp(nodeType(n),"symboltable") == 0) {
|
if (Strcmp(nodeType(n),k_symboltable) == 0) {
|
||||||
symtab = n;
|
symtab = n;
|
||||||
} else {
|
} else {
|
||||||
symtab = Getattr(n,"sym:symtab");
|
symtab = Getattr(n,k_symsymtab);
|
||||||
}
|
}
|
||||||
if (!symtab) return NewString("");
|
if (!symtab) return NewString("");
|
||||||
#ifdef SWIG_DEBUG
|
#ifdef SWIG_DEBUG
|
||||||
Printf(stderr,"symbol_qscope %s %x %s\n", Getattr(n,"name"), symtab,Getattr(symtab,"name"));
|
Printf(stderr,"symbol_qscope %s %x %s\n", Getattr(n,k_name), symtab,Getattr(symtab,k_name));
|
||||||
#endif
|
#endif
|
||||||
return Swig_symbol_qualifiedscopename(symtab);
|
return Swig_symbol_qualifiedscopename(symtab);
|
||||||
}
|
}
|
||||||
|
|
@ -1214,7 +1275,7 @@ Swig_symbol_qualified(Node *n) {
|
||||||
|
|
||||||
Node *
|
Node *
|
||||||
Swig_symbol_isoverloaded(Node *n) {
|
Swig_symbol_isoverloaded(Node *n) {
|
||||||
return Getattr(n,"sym:overloaded");
|
return Getattr(n,k_symoverloaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -1226,7 +1287,7 @@ Swig_symbol_isoverloaded(Node *n) {
|
||||||
static int no_constructor(Node *n) {
|
static int no_constructor(Node *n) {
|
||||||
SwigType *type = nodeType(n);
|
SwigType *type = nodeType(n);
|
||||||
#ifdef SWIG_DEBUG
|
#ifdef SWIG_DEBUG
|
||||||
Printf(stderr,"node type %s\n", Getattr(n,"name"), type);
|
Printf(stderr,"node type %s\n", Getattr(n,k_name), type);
|
||||||
#endif
|
#endif
|
||||||
return type ? (Strcmp(type,"constructor") != 0): 1;
|
return type ? (Strcmp(type,"constructor") != 0): 1;
|
||||||
}
|
}
|
||||||
|
|
@ -1257,6 +1318,7 @@ Swig_symbol_template_qualify(const SwigType *e, Symtab *st) {
|
||||||
Append(qprefix,tsuffix);
|
Append(qprefix,tsuffix);
|
||||||
Delete(tprefix);
|
Delete(tprefix);
|
||||||
Delete(tsuffix);
|
Delete(tsuffix);
|
||||||
|
Delete(targs);
|
||||||
#ifdef SWIG_DEBUG
|
#ifdef SWIG_DEBUG
|
||||||
Printf(stderr,"symbol_temp_qual %s %s\n", e, qprefix);
|
Printf(stderr,"symbol_temp_qual %s %s\n", e, qprefix);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1278,7 +1340,7 @@ Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
|
||||||
if (SwigType_issimple(e)) {
|
if (SwigType_issimple(e)) {
|
||||||
Node *n = Swig_symbol_clookup_check(e,st,no_constructor);
|
Node *n = Swig_symbol_clookup_check(e,st,no_constructor);
|
||||||
if (n) {
|
if (n) {
|
||||||
String *name = Getattr(n,"name");
|
String *name = Getattr(n,k_name);
|
||||||
Clear(e);
|
Clear(e);
|
||||||
Append(e,name);
|
Append(e,name);
|
||||||
#ifdef SWIG_DEBUG
|
#ifdef SWIG_DEBUG
|
||||||
|
|
@ -1287,7 +1349,7 @@ Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
|
||||||
if (!Swig_scopename_check(name)) {
|
if (!Swig_scopename_check(name)) {
|
||||||
String *qname = Swig_symbol_qualified(n);
|
String *qname = Swig_symbol_qualified(n);
|
||||||
if (Len(qname)) {
|
if (Len(qname)) {
|
||||||
Insert(e,0,"::");
|
Insert(e,0,k_coloncolon);
|
||||||
Insert(e,0,qname);
|
Insert(e,0,qname);
|
||||||
}
|
}
|
||||||
#ifdef SWIG_DEBUG
|
#ifdef SWIG_DEBUG
|
||||||
|
|
@ -1299,17 +1361,17 @@ Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
|
||||||
SwigType *ty = Swig_symbol_template_qualify(e,st);
|
SwigType *ty = Swig_symbol_template_qualify(e,st);
|
||||||
Clear(e);
|
Clear(e);
|
||||||
Append(e,ty);
|
Append(e,ty);
|
||||||
|
Delete(ty);
|
||||||
}
|
}
|
||||||
if (Strncmp(e,"::",2) == 0) {
|
if (Strncmp(e,k_coloncolon,2) == 0) {
|
||||||
Delitem(e,0);
|
Delitem(e,0);
|
||||||
Delitem(e,0);
|
Delitem(e,0);
|
||||||
}
|
}
|
||||||
Append(result,e);
|
Append(result,e);
|
||||||
} else if (SwigType_isfunction(e)) {
|
} else if (SwigType_isfunction(e)) {
|
||||||
Iterator pi;
|
|
||||||
List *parms = SwigType_parmlist(e);
|
List *parms = SwigType_parmlist(e);
|
||||||
String *s = NewString("f(");
|
String *s = NewString("f(");
|
||||||
pi = First(parms);
|
Iterator pi = First(parms);
|
||||||
while (pi.item) {
|
while (pi.item) {
|
||||||
String *pf = Swig_symbol_type_qualify(pi.item,st);
|
String *pf = Swig_symbol_type_qualify(pi.item,st);
|
||||||
Append(s,pf);
|
Append(s,pf);
|
||||||
|
|
@ -1321,6 +1383,7 @@ Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
|
||||||
}
|
}
|
||||||
Append(s,").");
|
Append(s,").");
|
||||||
Append(result,s);
|
Append(result,s);
|
||||||
|
Delete(parms);
|
||||||
Delete(s);
|
Delete(s);
|
||||||
} else {
|
} else {
|
||||||
Append(result,e);
|
Append(result,e);
|
||||||
|
|
@ -1328,7 +1391,7 @@ Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
|
||||||
}
|
}
|
||||||
Delete(elements);
|
Delete(elements);
|
||||||
#ifdef SWIG_DEBUG
|
#ifdef SWIG_DEBUG
|
||||||
Printf(stderr,"symbol_qualify %s %s %x %s\n", t, result, st, st ?Getattr(st,"name"): 0);
|
Printf(stderr,"symbol_qualify %s %s %x %s\n", t, result, st, st ?Getattr(st,k_name): 0);
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -1357,13 +1420,13 @@ SwigType *Swig_symbol_template_reduce(SwigType *qt, Symtab *ntab)
|
||||||
Node *n = Swig_symbol_clookup(qp,ntab);
|
Node *n = Swig_symbol_clookup(qp,ntab);
|
||||||
if (n) {
|
if (n) {
|
||||||
String *qual = Swig_symbol_qualified(n);
|
String *qual = Swig_symbol_qualified(n);
|
||||||
np = Copy(Getattr(n,"name"));
|
np = Copy(Getattr(n,k_name));
|
||||||
tp = np;
|
tp = np;
|
||||||
if (qual) {
|
if (Len(qual)) {
|
||||||
Insert(np,0,"::");
|
Insert(np,0,k_coloncolon);
|
||||||
Insert(np,0,qual);
|
Insert(np,0,qual);
|
||||||
Delete(qual);
|
|
||||||
}
|
}
|
||||||
|
Delete(qual);
|
||||||
} else {
|
} else {
|
||||||
np = qp;
|
np = qp;
|
||||||
}
|
}
|
||||||
|
|
@ -1377,6 +1440,9 @@ SwigType *Swig_symbol_template_reduce(SwigType *qt, Symtab *ntab)
|
||||||
}
|
}
|
||||||
Append(qprefix,")>");
|
Append(qprefix,")>");
|
||||||
Insert(tsuffix, 0, qprefix);
|
Insert(tsuffix, 0, qprefix);
|
||||||
|
Delete(parms);
|
||||||
|
Delete(tprefix);
|
||||||
|
Delete(qprefix);
|
||||||
return tsuffix;
|
return tsuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1395,6 +1461,7 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
|
||||||
if (SwigType_istemplate(ty)) {
|
if (SwigType_istemplate(ty)) {
|
||||||
SwigType *qt = Swig_symbol_template_reduce(ty,tab);
|
SwigType *qt = Swig_symbol_template_reduce(ty,tab);
|
||||||
Append(prefix,qt);
|
Append(prefix,qt);
|
||||||
|
Delete(qt);
|
||||||
#ifdef SWIG_DEBUG
|
#ifdef SWIG_DEBUG
|
||||||
Printf(stderr,"symbol_reduce %s %s\n", ty, prefix);
|
Printf(stderr,"symbol_reduce %s %s\n", ty, prefix);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1407,10 +1474,10 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
|
||||||
return Copy(ty);
|
return Copy(ty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Strcmp(nodeType(n),"using") == 0) {
|
if (Strcmp(nodeType(n),k_using) == 0) {
|
||||||
String *uname = Getattr(n,"uname");
|
String *uname = Getattr(n,k_uname);
|
||||||
if (uname) {
|
if (uname) {
|
||||||
n = Swig_symbol_clookup(base,Getattr(n,"sym:symtab"));
|
n = Swig_symbol_clookup(base,Getattr(n,k_symsymtab));
|
||||||
if (!n) {
|
if (!n) {
|
||||||
Delete(base);
|
Delete(base);
|
||||||
Delete(prefix);
|
Delete(prefix);
|
||||||
|
|
@ -1421,14 +1488,14 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Strcmp(nodeType(n),"cdecl") == 0) {
|
if (Strcmp(nodeType(n),k_cdecl) == 0) {
|
||||||
String *storage = Getattr(n,"storage");
|
String *storage = Getattr(n,k_storage);
|
||||||
if (storage && (Strcmp(storage,"typedef") == 0)) {
|
if (storage && (Strcmp(storage,k_typedef) == 0)) {
|
||||||
SwigType *decl;
|
SwigType *decl;
|
||||||
SwigType *rt;
|
SwigType *rt;
|
||||||
SwigType *qt;
|
SwigType *qt;
|
||||||
Symtab *ntab;
|
Symtab *ntab;
|
||||||
SwigType *nt = Copy(Getattr(n,"type"));
|
SwigType *nt = Copy(Getattr(n,k_type));
|
||||||
|
|
||||||
/* Fix for case 'typedef struct Hello hello;' */
|
/* Fix for case 'typedef struct Hello hello;' */
|
||||||
{
|
{
|
||||||
|
|
@ -1441,14 +1508,14 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
decl = Getattr(n,"decl");
|
decl = Getattr(n,k_decl);
|
||||||
if (decl) {
|
if (decl) {
|
||||||
SwigType_push(nt,decl);
|
SwigType_push(nt,decl);
|
||||||
}
|
}
|
||||||
SwigType_push(nt,prefix);
|
SwigType_push(nt,prefix);
|
||||||
Delete(base);
|
Delete(base);
|
||||||
Delete(prefix);
|
Delete(prefix);
|
||||||
ntab = Getattr(n,"sym:symtab");
|
ntab = Getattr(n,k_symsymtab);
|
||||||
rt = Swig_symbol_typedef_reduce(nt, ntab);
|
rt = Swig_symbol_typedef_reduce(nt, ntab);
|
||||||
qt = Swig_symbol_type_qualify(rt, ntab);
|
qt = Swig_symbol_type_qualify(rt, ntab);
|
||||||
if (SwigType_istemplate(qt)) {
|
if (SwigType_istemplate(qt)) {
|
||||||
|
|
@ -1535,7 +1602,7 @@ Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *t
|
||||||
if (p) lp = p;
|
if (p) lp = p;
|
||||||
}
|
}
|
||||||
while (tp) {
|
while (tp) {
|
||||||
String *value = Getattr(tp,"value");
|
String *value = Getattr(tp,k_value);
|
||||||
if (value) {
|
if (value) {
|
||||||
Parm *cp;
|
Parm *cp;
|
||||||
Parm *ta = targs;
|
Parm *ta = targs;
|
||||||
|
|
@ -1543,11 +1610,12 @@ Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *t
|
||||||
SwigType *nt = Swig_symbol_string_qualify(value,tsdecl);
|
SwigType *nt = Swig_symbol_string_qualify(value,tsdecl);
|
||||||
SwigType *ntq = 0;
|
SwigType *ntq = 0;
|
||||||
#ifdef SWIG_DEBUG
|
#ifdef SWIG_DEBUG
|
||||||
Printf(stderr,"value %s %s %s\n",value, nt,tsdecl?Getattr(tsdecl,"name") : tsdecl);
|
Printf(stderr,"value %s %s %s\n",value, nt,tsdecl ? Getattr(tsdecl,k_name) : tsdecl);
|
||||||
#endif
|
#endif
|
||||||
while(p && ta) {
|
while(p && ta) {
|
||||||
String *name = Getattr(ta,"name");
|
String *name = Getattr(ta,k_name);
|
||||||
String *value = Getattr(p,"value") ? Getattr(p,"value") : Getattr(p,"type");
|
String *pvalue = Getattr(p,k_value);
|
||||||
|
String *value = pvalue ? pvalue : Getattr(p,k_type);
|
||||||
String *ttq = Swig_symbol_type_qualify(value,tscope);
|
String *ttq = Swig_symbol_type_qualify(value,tscope);
|
||||||
/* value = SwigType_typedef_resolve_all(value);*/
|
/* value = SwigType_typedef_resolve_all(value);*/
|
||||||
Replaceid(nt, name, ttq);
|
Replaceid(nt, name, ttq);
|
||||||
|
|
@ -1566,6 +1634,7 @@ Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *t
|
||||||
set_nextSibling(lp,cp);
|
set_nextSibling(lp,cp);
|
||||||
lp = cp;
|
lp = cp;
|
||||||
tp = nextSibling(tp);
|
tp = nextSibling(tp);
|
||||||
|
Delete(cp);
|
||||||
Delete(nt);
|
Delete(nt);
|
||||||
Delete(ntq);
|
Delete(ntq);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1589,10 +1658,9 @@ Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
String *e = Getitem(elements,i);
|
String *e = Getitem(elements,i);
|
||||||
if (SwigType_isfunction(e)) {
|
if (SwigType_isfunction(e)) {
|
||||||
Iterator pi;
|
|
||||||
List *parms = SwigType_parmlist(e);
|
|
||||||
String *s = NewString("f(");
|
String *s = NewString("f(");
|
||||||
pi = First(parms);
|
List *parms = SwigType_parmlist(e);
|
||||||
|
Iterator pi = First(parms);
|
||||||
while (pi.item) {
|
while (pi.item) {
|
||||||
String *pf = SwigType_istemplate(e) ?
|
String *pf = SwigType_istemplate(e) ?
|
||||||
Swig_symbol_template_deftype(pi.item,tscope)
|
Swig_symbol_template_deftype(pi.item,tscope)
|
||||||
|
|
@ -1607,6 +1675,7 @@ Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
|
||||||
Append(s,").");
|
Append(s,").");
|
||||||
Append(result,s);
|
Append(result,s);
|
||||||
Delete(s);
|
Delete(s);
|
||||||
|
Delete(parms);
|
||||||
} else if (SwigType_istemplate(e)) {
|
} else if (SwigType_istemplate(e)) {
|
||||||
String *prefix = SwigType_prefix(e);
|
String *prefix = SwigType_prefix(e);
|
||||||
String *base = SwigType_base(e);
|
String *base = SwigType_base(e);
|
||||||
|
|
@ -1617,30 +1686,29 @@ Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
|
||||||
Node *tempn = Swig_symbol_clookup_local(tprefix,tscope);
|
Node *tempn = Swig_symbol_clookup_local(tprefix,tscope);
|
||||||
/* Printf(stderr,"deftype type %s \n", e);*/
|
/* Printf(stderr,"deftype type %s \n", e);*/
|
||||||
if (tempn) {
|
if (tempn) {
|
||||||
ParmList *tnargs = Getattr(tempn,"templateparms");
|
ParmList *tnargs = Getattr(tempn,k_templateparms);
|
||||||
Parm *p;
|
Parm *p;
|
||||||
Symtab *tsdecl = Getattr(tempn,"sym:symtab");
|
Symtab *tsdecl = Getattr(tempn,k_symsymtab);
|
||||||
|
|
||||||
/* Printf(stderr,"deftype type %s %s %s %s\n", tprefix, targs, tsuffix);*/
|
/* Printf(stderr,"deftype type %s %s %s %s\n", tprefix, targs, tsuffix);*/
|
||||||
Append(tprefix,"<(");
|
Append(tprefix,"<(");
|
||||||
Swig_symbol_template_defargs(tparms, tnargs,tscope,tsdecl);
|
Swig_symbol_template_defargs(tparms, tnargs,tscope,tsdecl);
|
||||||
p = tparms;
|
p = tparms;
|
||||||
while (p) {
|
while (p) {
|
||||||
SwigType *ptype = Getattr(p,"type");
|
SwigType *ptype = Getattr(p,k_type);
|
||||||
SwigType *ttr = ptype ? ptype : Getattr(p,"value");
|
SwigType *ttr = ptype ? ptype : Getattr(p,k_value);
|
||||||
SwigType *ttf = Swig_symbol_type_qualify(ttr,tscope);
|
SwigType *ttf = Swig_symbol_type_qualify(ttr,tscope);
|
||||||
SwigType *ttq = Swig_symbol_template_param_eval(ttf,tscope);
|
SwigType *ttq = Swig_symbol_template_param_eval(ttf,tscope);
|
||||||
SwigType *ttd = 0;
|
|
||||||
if (SwigType_istemplate(ttq)) {
|
if (SwigType_istemplate(ttq)) {
|
||||||
ttd = Swig_symbol_template_deftype(ttq, tscope);
|
SwigType *ttd = Swig_symbol_template_deftype(ttq, tscope);
|
||||||
|
Delete(ttq);
|
||||||
ttq = ttd;
|
ttq = ttd;
|
||||||
}
|
}
|
||||||
Append(tprefix,ttq);
|
Append(tprefix,ttq);
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
if (p) Putc(',',tprefix);
|
if (p) Putc(',',tprefix);
|
||||||
Delete(ttr);
|
|
||||||
Delete(ttf);
|
Delete(ttf);
|
||||||
Delete(ttd);
|
Delete(ttq);
|
||||||
}
|
}
|
||||||
Append(tprefix,")>");
|
Append(tprefix,")>");
|
||||||
Append(tprefix,tsuffix);
|
Append(tprefix,tsuffix);
|
||||||
|
|
@ -1673,12 +1741,12 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab)
|
||||||
if (n == lastnode) break;
|
if (n == lastnode) break;
|
||||||
lastnode = n;
|
lastnode = n;
|
||||||
if (n) {
|
if (n) {
|
||||||
if (Strcmp(nodeType(n),"enumitem") == 0) {
|
if (Strcmp(nodeType(n),k_enumitem) == 0) {
|
||||||
/* An enum item. Generate a fully qualified name */
|
/* An enum item. Generate a fully qualified name */
|
||||||
String *qn = Swig_symbol_qualified(n);
|
String *qn = Swig_symbol_qualified(n);
|
||||||
if (Len(qn)) {
|
if (Len(qn)) {
|
||||||
Append(qn,"::");
|
Append(qn,k_coloncolon);
|
||||||
Append(qn,Getattr(n,"name"));
|
Append(qn,Getattr(n,k_name));
|
||||||
Delete(value);
|
Delete(value);
|
||||||
value = qn;
|
value = qn;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1686,9 +1754,9 @@ SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab)
|
||||||
Delete(qn);
|
Delete(qn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if ((Strcmp(nodeType(n),"cdecl") == 0) && (Getattr(n,"value"))) {
|
} else if ((Strcmp(nodeType(n),k_cdecl) == 0) && (Getattr(n,k_value))) {
|
||||||
Delete(value);
|
Delete(value);
|
||||||
value = Copy(Getattr(n,"value"));
|
value = Copy(Getattr(n,k_value));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue