remove many memory leaks and cleanup
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7898 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
628dc6b32b
commit
f714a2615d
21 changed files with 224 additions and 112 deletions
|
|
@ -93,6 +93,7 @@ static Node *copy_node(Node *n) {
|
|||
Setfile(nn,Getfile(n));
|
||||
Setline(nn,Getline(n));
|
||||
for (k = First(n); k.key; k = Next(k)) {
|
||||
String *ci;
|
||||
String *key = k.key;
|
||||
char *ckey = Char(key);
|
||||
if ((strcmp(ckey,"nextSibling") == 0) ||
|
||||
|
|
@ -106,7 +107,9 @@ static Node *copy_node(Node *n) {
|
|||
if ((strcmp(ckey,"sym:name") == 0) ||
|
||||
(strcmp(ckey,"sym:weak") == 0) ||
|
||||
(strcmp(ckey,"sym:typename") == 0)) {
|
||||
Setattr(nn,key, Copy(k.item));
|
||||
String *ci = Copy(k.item);
|
||||
Setattr(nn,key, ci);
|
||||
Delete(ci);
|
||||
continue;
|
||||
}
|
||||
if (strcmp(ckey,"sym:symtab") == 0) {
|
||||
|
|
@ -146,7 +149,9 @@ static Node *copy_node(Node *n) {
|
|||
continue;
|
||||
}
|
||||
/* Looks okay. Just copy the data using Copy */
|
||||
Setattr(nn, key, Copy(k.item));
|
||||
ci = Copy(k.item);
|
||||
Setattr(nn, key, ci);
|
||||
Delete(ci);
|
||||
}
|
||||
return nn;
|
||||
}
|
||||
|
|
@ -227,15 +232,17 @@ static String *feature_identifier_fix(String *s) {
|
|||
}
|
||||
}
|
||||
|
||||
static void single_rename_add(const char *name, SwigType *decl, const char *newname) {
|
||||
static void single_rename_add(const char *name, SwigType *decl, const char *cnewname) {
|
||||
String *nname;
|
||||
String *newname = NewString(cnewname);
|
||||
if (!rename_hash) rename_hash = NewHash();
|
||||
if (Namespaceprefix) {
|
||||
nname = NewStringf("%s::%s",Namespaceprefix, name);
|
||||
} else {
|
||||
nname = NewString(name);
|
||||
}
|
||||
Swig_name_object_set(rename_hash,nname,decl,NewString(newname));
|
||||
Swig_name_object_set(rename_hash,nname,decl,newname);
|
||||
Delete(newname);
|
||||
Delete(nname);
|
||||
}
|
||||
|
||||
|
|
@ -394,6 +401,7 @@ static void add_symbols(Node *n) {
|
|||
if (name && Namespaceprefix) {
|
||||
String *nname = NewStringf("%s::%s", Namespaceprefix, name);
|
||||
Setattr(n,"name",nname);
|
||||
Delete(nname);
|
||||
}
|
||||
} else {
|
||||
Symtab *st = Swig_symbol_getscope(prefix);
|
||||
|
|
@ -401,6 +409,7 @@ static void add_symbols(Node *n) {
|
|||
String *base = Swig_scopename_last(name);
|
||||
String *nname = NewStringf("%s::%s", ns, base);
|
||||
Setattr(n,"name",nname);
|
||||
Delete(nname);
|
||||
Delete(base);
|
||||
Delete(prefix);
|
||||
}
|
||||
|
|
@ -418,6 +427,7 @@ static void add_symbols(Node *n) {
|
|||
if (Classprefix && (Strcmp(prefix,Classprefix) == 0)) {
|
||||
String *base = Swig_scopename_last(name);
|
||||
Setattr(n,"name",base);
|
||||
Delete(base);
|
||||
}
|
||||
Delete(prefix);
|
||||
}
|
||||
|
|
@ -539,6 +549,7 @@ static void add_symbols(Node *n) {
|
|||
Printf(e,"%s:%d:%s\n%s:%d:%s\n",Getfile(n),Getline(n),en,
|
||||
Getfile(c),Getline(c),ec);
|
||||
Setattr(n,"error",e);
|
||||
Delete(e);
|
||||
Delete(en);
|
||||
Delete(ec);
|
||||
}
|
||||
|
|
@ -690,6 +701,7 @@ static void merge_extensions(Node *cls, Node *am) {
|
|||
Printf(e,"%s:%d:%s\n%s:%d:%s\n",Getfile(csym),Getline(csym),ec,
|
||||
Getfile(n),Getline(n),en);
|
||||
Setattr(csym,"error",e);
|
||||
Delete(e);
|
||||
Delete(en);
|
||||
Delete(ec);
|
||||
Swig_symbol_remove(csym); /* Remove class definition */
|
||||
|
|
@ -991,6 +1003,7 @@ static Node *dump_nested(const char *parent) {
|
|||
while (n) {
|
||||
char temp[256];
|
||||
Node *retx;
|
||||
SwigType *nt;
|
||||
/* Token replace the name of the parent class */
|
||||
Replace(n->code, "$classname", parent, DOH_REPLACE_ANY);
|
||||
/* Fix up the name of the datatype (for building typedefs and other stuff) */
|
||||
|
|
@ -1003,7 +1016,9 @@ static Node *dump_nested(const char *parent) {
|
|||
/* Add the appropriate declaration to the C++ processor */
|
||||
retx = new_node("cdecl");
|
||||
Setattr(retx,"name",n->name);
|
||||
Setattr(retx,"type",Copy(n->type));
|
||||
nt = Copy(n->type);
|
||||
Setattr(retx,"type",nt);
|
||||
Delete(nt);
|
||||
Setattr(retx,"nested",parent);
|
||||
add_symbols(retx);
|
||||
if (ret) {
|
||||
|
|
@ -1065,9 +1080,10 @@ static Node *dump_nested(const char *parent) {
|
|||
}
|
||||
}
|
||||
{
|
||||
Node *head;
|
||||
head = new_node("insert");
|
||||
Setattr(head,"code",NewStringf("\n%s\n",n->code));
|
||||
Node *head = new_node("insert");
|
||||
String *code = NewStringf("\n%s\n",n->code);
|
||||
Setattr(head,"code", code);
|
||||
Delete(code);
|
||||
set_nextSibling(head,ret);
|
||||
ret = head;
|
||||
}
|
||||
|
|
@ -1200,7 +1216,9 @@ static void default_arguments(Node *n) {
|
|||
if (pp) {
|
||||
set_nextSibling(pp,Copy(varargs));
|
||||
} else {
|
||||
Setattr(function,"parms", Copy(varargs));
|
||||
ParmList *cv = Copy(varargs);
|
||||
Setattr(function,"parms", cv);
|
||||
Delete(cv);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -1235,19 +1253,28 @@ static void default_arguments(Node *n) {
|
|||
Node *new_function = new_node(Copy(nodeType(function)));
|
||||
SwigType *decl = Copy(Getattr(function,"decl"));
|
||||
int constqualifier = SwigType_isconst(decl);
|
||||
String *ccode = Copy(Getattr(function,"code"));
|
||||
String *cstorage = Copy(Getattr(function,"storage"));
|
||||
SwigType *ctype = Copy(Getattr(function,"type"));
|
||||
String *cthrow = Copy(Getattr(function,"throw"));
|
||||
|
||||
Delete(SwigType_pop_function(decl)); /* remove the old parameter list from decl */
|
||||
SwigType_add_function(decl,newparms);
|
||||
if (constqualifier)
|
||||
SwigType_add_qualifier(decl,"const");
|
||||
|
||||
Setattr(new_function,"name",Getattr(function,"name"));
|
||||
Setattr(new_function,"code",Copy(Getattr(function,"code")));
|
||||
Setattr(new_function,"name", Getattr(function,"name"));
|
||||
Setattr(new_function,"code", ccode);
|
||||
Setattr(new_function,"decl", decl);
|
||||
Setattr(new_function,"parms",newparms);
|
||||
Setattr(new_function,"storage",Copy(Getattr(function,"storage")));
|
||||
Setattr(new_function,"type",Copy(Getattr(function,"type")));
|
||||
Setattr(new_function,"throw",Copy(Getattr(function,"throw")));
|
||||
Setattr(new_function,"parms", newparms);
|
||||
Setattr(new_function,"storage", cstorage);
|
||||
Setattr(new_function,"type", ctype);
|
||||
Setattr(new_function,"throw", cthrow);
|
||||
Delete(ccode);
|
||||
Delete(cstorage);
|
||||
Delete(ctype);
|
||||
Delete(cthrow);
|
||||
Delete(decl);
|
||||
|
||||
{
|
||||
Node *throws = Getattr(function,"throws");
|
||||
|
|
|
|||
|
|
@ -204,19 +204,25 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear
|
|||
}
|
||||
Delete(stripped_name);
|
||||
}
|
||||
if (Strstr(name,"<")) {
|
||||
if (strstr(Char(name),"<")) {
|
||||
Append(patchlist,Getattr(n,k_name));
|
||||
} else {
|
||||
Append(name,templateargs);
|
||||
}
|
||||
name = Getattr(n,k_symname);
|
||||
if (name && (Strstr(name,"<"))) {
|
||||
Clear(name);
|
||||
Append(name,rname);
|
||||
} else {
|
||||
Replace(name,tname,rname, DOH_REPLACE_ANY);
|
||||
if (name) {
|
||||
if (strstr(Char(name),"<")) {
|
||||
Clear(name);
|
||||
Append(name,rname);
|
||||
} else {
|
||||
String *tmp = Copy(name);
|
||||
Replace(tmp,tname,rname, DOH_REPLACE_ANY);
|
||||
Clear(name);
|
||||
Append(name,tmp);
|
||||
Delete(tmp);
|
||||
}
|
||||
}
|
||||
Setattr(n,k_symname,name);
|
||||
/* Setattr(n,k_symname,name); */
|
||||
}
|
||||
Append(cpatchlist,Getattr(n,k_code));
|
||||
Append(typelist, Getattr(n,k_decl));
|
||||
|
|
@ -224,27 +230,25 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear
|
|||
add_parms(Getattr(n,k_throws), cpatchlist, typelist);
|
||||
} else if (StringEqual(nodeType,k_destructor)) {
|
||||
String *name = Getattr(n,k_name);
|
||||
if (Strstr(name,"<")) {
|
||||
if (name && strstr(Char(name),"<")) {
|
||||
Append(patchlist,Getattr(n,k_name));
|
||||
} else {
|
||||
Append(name,templateargs);
|
||||
}
|
||||
name = Getattr(n,k_symname);
|
||||
if (name && Strstr(name,"<")) {
|
||||
if (name && strstr(Char(name),"<")) {
|
||||
String *sn = Copy(tname);
|
||||
Setattr(n,k_symname, sn);
|
||||
Delete(sn);
|
||||
} else {
|
||||
Replace(name,tname,rname, DOH_REPLACE_ANY);
|
||||
}
|
||||
Setattr(n,k_symname,name);
|
||||
/* Setattr(n,k_symname,name); */
|
||||
Append(cpatchlist,Getattr(n,k_code));
|
||||
} else if (StringEqual(nodeType,k_using)) {
|
||||
String *uname = Getattr(n,k_uname);
|
||||
if (uname) {
|
||||
if (Strstr(uname,"<")) {
|
||||
Append(patchlist, uname);
|
||||
}
|
||||
if (uname && strstr(Char(uname),"<")) {
|
||||
Append(patchlist, uname);
|
||||
}
|
||||
if (Getattr(n,k_namespace)) {
|
||||
/* Namespace link. This is nasty. Is other namespace defined? */
|
||||
|
|
@ -272,17 +276,18 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear
|
|||
static
|
||||
String *partial_arg(String *s, String *p) {
|
||||
char *c;
|
||||
char *cp = Char(p);
|
||||
String *prefix;
|
||||
String *newarg;
|
||||
|
||||
/* Find the prefix on the partial argument */
|
||||
|
||||
c = Strstr(p,"$");
|
||||
c = strstr(cp,"$");
|
||||
if (!c) {
|
||||
return NewString(s);
|
||||
return Copy(s);
|
||||
}
|
||||
prefix = NewStringWithSize(Char(p),c-Char(p));
|
||||
newarg = NewString(s);
|
||||
prefix = NewStringWithSize(cp,c-cp);
|
||||
newarg = Copy(s);
|
||||
Replace(newarg,prefix,"",DOH_REPLACE_ANY | DOH_REPLACE_FIRST);
|
||||
Delete(prefix);
|
||||
return newarg;
|
||||
|
|
@ -462,6 +467,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
|
|||
Delete(cpatchlist);
|
||||
Delete(typelist);
|
||||
Delete(tbase);
|
||||
Delete(tname);
|
||||
Delete(templateargs);
|
||||
|
||||
/* set_nodeType(n,k_template);*/
|
||||
|
|
|
|||
|
|
@ -233,12 +233,19 @@ DohEqual(const DOH *obj1, const DOH *obj2) {
|
|||
if (DohCheck(b2)) {
|
||||
b2info = b2->type;
|
||||
} else {
|
||||
return strncmp((b1info->doh_data)(b1), (void*) obj2, (b1info->doh_len)(b1)) == 0;
|
||||
int len = (b1info->doh_len)(b1);
|
||||
char *cobj = (char *) obj2;
|
||||
return len == strlen(cobj) ? (memcmp(RawData(b1), cobj, len) == 0) : 0;
|
||||
}
|
||||
} else if (DohCheck(b2)) {
|
||||
b2info = b2->type;
|
||||
return strncmp((b2info->doh_data)(b2), (void*) obj1, (b2info->doh_len)(b2)) == 0;
|
||||
int len = (b2info->doh_len)(b2);
|
||||
char *cobj = (char *) obj1;
|
||||
return len == strlen(cobj) ? (memcmp(RawData(b2), cobj, len) == 0) : 0;
|
||||
} else {
|
||||
return strcmp((char*) obj1, (char*) obj2) == 0;
|
||||
}
|
||||
|
||||
if (!b1info) {
|
||||
return obj1 == obj2;
|
||||
} else if ((b1info == b2info)) {
|
||||
|
|
|
|||
|
|
@ -263,10 +263,10 @@ extern int DohString_equal(DOH *s1, DOH *s2);
|
|||
#define DohStringPutc(ch,so) DohString_putc(so, ch)
|
||||
#define DohStringGetc(so) DohString_getc(so)
|
||||
#define DohStringUngetc(ch,so) DohString_ungetc(so, ch)
|
||||
#define DohStringAppend(so,str) DohString_append(so, str)
|
||||
#define DohStringLen(so) DohString_len(so)
|
||||
#define DohStringAppend(so,str) DohString_append(so, (DOH*)str)
|
||||
#define DohStringLen(so) DohString_len((DOH*)so)
|
||||
#define DohStringChar(so) DohString_char(so)
|
||||
#define DohStringEqual(s1,s2) DohString_equal(s1,s2)
|
||||
#define DohStringEqual(s1,s2) DohString_equal((DOH *)s1, (DOH *)s2)
|
||||
|
||||
/* Meta-variables */
|
||||
extern DOH *DohGetmeta(DOH *, const DOH *);
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ DohString_equal(DOH *so1, DOH *so2)
|
|||
} else {
|
||||
register char *c1 = s1->str;
|
||||
register char *c2 = s2->str;
|
||||
#if 0
|
||||
register int mlen = len >> 2;
|
||||
register int i = mlen;
|
||||
for (; i; --i) {
|
||||
|
|
@ -162,6 +163,9 @@ DohString_equal(DOH *so1, DOH *so2)
|
|||
if (*(c1++) != *(c2++)) return 0;
|
||||
}
|
||||
return 1;
|
||||
#else
|
||||
return memcmp(c1, c2, len) == 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +212,7 @@ DohString_append(DOH *so, DOH *str) {
|
|||
|
||||
if (DohCheck(str)) {
|
||||
String *ss = (String *) ObjData(str);
|
||||
newstr = String_data(str);
|
||||
newstr = String_data((DOH*)str);
|
||||
l = ss->len;
|
||||
} else {
|
||||
newstr = (char *) (str);
|
||||
|
|
@ -667,8 +671,6 @@ replace_simple(String *str, char *token, char *rep, int flags, int count, char *
|
|||
register char *base;
|
||||
int i;
|
||||
|
||||
str->hashkey = -1;
|
||||
|
||||
/* Figure out if anything gets replaced */
|
||||
if (!strlen(token)) return 0;
|
||||
|
||||
|
|
@ -678,6 +680,8 @@ replace_simple(String *str, char *token, char *rep, int flags, int count, char *
|
|||
|
||||
if (!s) return 0; /* No matches. Who cares */
|
||||
|
||||
str->hashkey = -1;
|
||||
|
||||
if (flags & DOH_REPLACE_NOQUOTE) noquote = 1;
|
||||
|
||||
/* If we are not replacing inside quotes, we need to do a little extra work */
|
||||
|
|
|
|||
|
|
@ -269,6 +269,8 @@ Language::~Language() {
|
|||
Delete(symbols);
|
||||
Delete(classtypes);
|
||||
Delete(enumtypes);
|
||||
Delete(director_ctor_code);
|
||||
Delete(none_comparison);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ static void install_opts(int argc, char *argv[]) {
|
|||
}
|
||||
if (!noopt) {
|
||||
/* Printf(stdout,"%s\n", opt); */
|
||||
Preprocessor_define(opt, 0);
|
||||
Delete(Preprocessor_define(opt, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -359,7 +359,7 @@ void SWIG_getoptions(int argc, char *argv[])
|
|||
} else if (strncmp(argv[i],"-D",2) == 0) {
|
||||
DOH *d = NewString(argv[i]+2);
|
||||
Replace(d,(char*)"=",(char*)" ", DOH_REPLACE_ANY | DOH_REPLACE_FIRST);
|
||||
Preprocessor_define((DOH *) d,0);
|
||||
Delete(Preprocessor_define((DOH *) d,0));
|
||||
// Create a symbol
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-E") == 0) {
|
||||
|
|
@ -374,7 +374,7 @@ void SWIG_getoptions(int argc, char *argv[])
|
|||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-c++") == 0) {
|
||||
CPlusPlus=1;
|
||||
Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0);
|
||||
Delete(Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0));
|
||||
Swig_cparse_cplusplus(1);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-fcompact") == 0) {
|
||||
|
|
@ -651,13 +651,13 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
// Set up some default symbols (available in both SWIG interface files
|
||||
// and C files)
|
||||
|
||||
Preprocessor_define((DOH *) "SWIG 1", 0);
|
||||
Preprocessor_define((DOH *) "__STDC__", 0);
|
||||
Delete(Preprocessor_define((DOH *) "SWIG 1", 0));
|
||||
Delete(Preprocessor_define((DOH *) "__STDC__", 0));
|
||||
#ifdef MACSWIG
|
||||
Preprocessor_define((DOH *) "SWIGMAC 1", 0);
|
||||
Delete(Preprocessor_define((DOH *) "SWIGMAC 1", 0));
|
||||
#endif
|
||||
#ifdef SWIGWIN32
|
||||
Preprocessor_define((DOH *) "SWIGWIN32 1", 0);
|
||||
Delete(Preprocessor_define((DOH *) "SWIGWIN32 1", 0));
|
||||
#endif
|
||||
|
||||
// Set the SWIG version value in format 0xAABBCC from package version expected to be in format A.B.C
|
||||
|
|
@ -678,7 +678,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
/* Turn on contracts */
|
||||
|
||||
Swig_contract_mode_set(1);
|
||||
Preprocessor_define(vers,0);
|
||||
Delete(Preprocessor_define(vers,0));
|
||||
|
||||
/* Turn off directors mode */
|
||||
Wrapper_director_mode_set(0);
|
||||
|
|
@ -715,7 +715,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
|
||||
// Define the __cplusplus symbol
|
||||
if (CPlusPlus)
|
||||
Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0);
|
||||
Delete(Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0));
|
||||
|
||||
// Parse language dependent options
|
||||
lang->main(argc,argv);
|
||||
|
|
@ -892,6 +892,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
}
|
||||
|
||||
Node *top = Swig_cparse(cpps);
|
||||
Delete(cpps);
|
||||
|
||||
|
||||
if (Verbose) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ struct Module {
|
|||
strcpy(name, n);
|
||||
next = 0;
|
||||
}
|
||||
|
||||
~Module()
|
||||
{
|
||||
delete[] name;
|
||||
}
|
||||
};
|
||||
|
||||
static Module *modules = 0;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ public:
|
|||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-nortti") == 0) {
|
||||
/* Turn on no RTTI mode */
|
||||
Preprocessor_define((DOH *) "SWIG_NORTTI", 0);
|
||||
Delete(Preprocessor_define((DOH *) "SWIG_NORTTI", 0));
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-modern") == 0) {
|
||||
apply = 0;
|
||||
|
|
@ -189,11 +189,11 @@ public:
|
|||
}
|
||||
|
||||
if (cppcast) {
|
||||
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
|
||||
Delete(Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0));
|
||||
}
|
||||
|
||||
if (!global_name) global_name = NewString("cvar");
|
||||
Preprocessor_define("SWIGPYTHON 1", 0);
|
||||
Delete(Preprocessor_define("SWIGPYTHON 1", 0));
|
||||
SWIG_typemap_lang("python");
|
||||
SWIG_config_file("python.swg");
|
||||
allow_overloading();
|
||||
|
|
@ -489,6 +489,7 @@ public:
|
|||
Delete(f_directors_h);
|
||||
|
||||
Close(f_runtime);
|
||||
Delete(f_runtime);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
@ -1209,8 +1210,10 @@ public:
|
|||
num_arguments = emit_num_arguments(l);
|
||||
num_required = emit_num_required(l);
|
||||
varargs = emit_isvarargs(l);
|
||||
|
||||
strcpy(wname,Char(Swig_name_wrapper(iname)));
|
||||
|
||||
String *nw = Swig_name_wrapper(iname);
|
||||
strcpy(wname,Char(nw));
|
||||
Delete(nw);
|
||||
if (overname) {
|
||||
strcat(wname,Char(overname));
|
||||
}
|
||||
|
|
@ -1526,6 +1529,7 @@ public:
|
|||
#else
|
||||
Printf(f->code,"%s\n", tm);
|
||||
#endif
|
||||
Delete(tm);
|
||||
} else {
|
||||
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number,
|
||||
"Unable to use return type %s in function %s.\n", SwigType_str(d,0), name);
|
||||
|
|
@ -1559,6 +1563,7 @@ public:
|
|||
Replaceall(tm,"$input","result");
|
||||
Replaceall(tm,"$result","resultobj");
|
||||
Printf(f->code,"%s\n",tm);
|
||||
Delete(tm);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1717,6 +1722,7 @@ public:
|
|||
Replaceall(tm,"$target","pyobj");
|
||||
Replaceall(tm,"$result","pyobj");
|
||||
Printf(getf->code,"%s\n", tm);
|
||||
Delete(tm);
|
||||
} else {
|
||||
Swig_warning(WARN_TYPEMAP_VAROUT_UNDEF, input_file, line_number,
|
||||
"Unable to read variable of type %s\n", SwigType_str(t,0));
|
||||
|
|
@ -1763,6 +1769,7 @@ public:
|
|||
Replaceall(tm,"$target",name);
|
||||
Replaceall(tm,"$value", value);
|
||||
Printf(const_code,"%s,\n", tm);
|
||||
Delete(tm);
|
||||
have_tm = 1;
|
||||
}
|
||||
if ((tm = Swig_typemap_lookup_new("constcode", n, name, 0))) {
|
||||
|
|
@ -1770,6 +1777,7 @@ public:
|
|||
Replaceall(tm,"$target",name);
|
||||
Replaceall(tm,"$value",value);
|
||||
Printf(f_init, "%s\n", tm);
|
||||
Delete(tm);
|
||||
have_tm = 1;
|
||||
}
|
||||
if (!have_tm) {
|
||||
|
|
@ -2237,6 +2245,7 @@ public:
|
|||
modern = oldmodern;
|
||||
|
||||
/* Restore shadow file back to original version */
|
||||
Delete(f_shadow);
|
||||
f_shadow = f_shadow_file;
|
||||
|
||||
return SWIG_OK;
|
||||
|
|
@ -2957,6 +2966,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
tm = Swig_typemap_lookup_new("director:except", n, "result", 0);
|
||||
if (!tm) {
|
||||
tm = Getattr(n, "feature:director:except");
|
||||
if (tm) tm = Copy(tm);
|
||||
}
|
||||
Printf(w->code, "if (result == NULL) {\n");
|
||||
Printf(w->code, " PyObject *error = PyErr_Occurred();\n");
|
||||
|
|
@ -2970,6 +2980,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
Printf(w->code, " }\n");
|
||||
}
|
||||
Printf(w->code, "}\n");
|
||||
Delete(tm);
|
||||
|
||||
/*
|
||||
* Python method may return a simple object, or a tuple.
|
||||
|
|
@ -3029,6 +3040,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
}
|
||||
Replaceall(tm, "$result", "c_result");
|
||||
Printv(w->code, tm, "\n", NIL);
|
||||
Delete(tm);
|
||||
} else {
|
||||
Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number,
|
||||
"Unable to use return type %s in director method %s::%s (skipping method).\n", SwigType_str(return_type, 0), classname, name);
|
||||
|
|
|
|||
|
|
@ -240,7 +240,9 @@ class TypePass : private Dispatcher {
|
|||
Swig_symbol_setscope(s);
|
||||
|
||||
/* Recursively hit base classes */
|
||||
String *newcast = NewStringf("(%s *)%s", SwigType_namestr(Getattr(bclass,"name")), cast);
|
||||
String *namestr = SwigType_namestr(Getattr(bclass,"name"));
|
||||
String *newcast = NewStringf("(%s *)%s", namestr, cast);
|
||||
Delete(namestr);
|
||||
cplus_inherit_types_impl(first,bclass,clsname,bases,baselist,ispublic,newcast);
|
||||
Delete(newcast);
|
||||
}
|
||||
|
|
@ -434,6 +436,7 @@ class TypePass : private Dispatcher {
|
|||
/* If in a namespace, patch the class name */
|
||||
if (nname) {
|
||||
Setattr(n,"name",nname);
|
||||
Delete(nname);
|
||||
}
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,11 +90,14 @@ static String *cpp_include(String_or_char *fn, int sysfile) {
|
|||
Swig_error(Getfile(fn),Getline(fn),"Unable to find '%s'\n", fn);
|
||||
}
|
||||
} else {
|
||||
String *lf;
|
||||
Seek(s,0,SEEK_SET);
|
||||
if (!dependencies) {
|
||||
dependencies = NewList();
|
||||
}
|
||||
Append(dependencies, Copy(Swig_last_file()));
|
||||
lf = Copy(Swig_last_file());
|
||||
Append(dependencies, lf);
|
||||
Delete(lf);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
@ -213,30 +216,34 @@ String_or_char *Macro_vararg_name(String_or_char *str,
|
|||
argname = Copy(str);
|
||||
s = Char(argname);
|
||||
dots = strchr(s, '.');
|
||||
if (!dots) return NULL;
|
||||
if (!dots) {
|
||||
Delete(argname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strcmp(dots, "...") != 0) {
|
||||
Swig_error(Getfile(line), Getline(line),
|
||||
"Illegal macro argument name '%s'\n", str);
|
||||
Delete(argname);
|
||||
return NULL;
|
||||
}
|
||||
if (dots == s) {
|
||||
varargname = NewString("__VA_ARGS__");
|
||||
} else {
|
||||
*dots = '\0';
|
||||
varargname = NewStringf(argname);
|
||||
varargname = NewString(s);
|
||||
}
|
||||
Delete(argname);
|
||||
return varargname;
|
||||
}
|
||||
|
||||
Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
||||
Hash *Preprocessor_define(const String *str, int swigmacro)
|
||||
{
|
||||
String *macroname = 0, *argstr = 0, *macrovalue = 0, *file = 0, *s = 0;
|
||||
Hash *macro = 0, *symbols = 0, *m1;
|
||||
List *arglist = 0;
|
||||
int c, line;
|
||||
int varargs = 0;
|
||||
String_or_char *str = (String_or_char *) _str;
|
||||
|
||||
assert(cpp);
|
||||
assert(str);
|
||||
|
|
@ -307,6 +314,7 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
|||
if (c == ',') {
|
||||
varargname = Macro_vararg_name(argname, str);
|
||||
if (varargname) {
|
||||
Delete(varargname);
|
||||
Swig_error(Getfile(str),Getline(str),"Variable-length macro argument must be last parameter\n");
|
||||
} else {
|
||||
Append(arglist,argname);
|
||||
|
|
@ -316,10 +324,11 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
|||
} else if (isidchar(c) || (c == '.')) {
|
||||
StringPutc(c,argname);
|
||||
} else if (!(isspace(c) || (c == '\\'))) {
|
||||
Delete(argname);
|
||||
Swig_error(Getfile(str),Getline(str),"Illegal character in macro argument name\n");
|
||||
goto macro_error;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Len(argname)) {
|
||||
/* Check for varargs */
|
||||
varargname = Macro_vararg_name(argname, str);
|
||||
|
|
@ -330,8 +339,8 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
|||
} else {
|
||||
Append(arglist,argname);
|
||||
}
|
||||
Delete(argname);
|
||||
}
|
||||
Delete(argname);
|
||||
}
|
||||
|
||||
if (!swigmacro) {
|
||||
|
|
@ -409,6 +418,7 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
|||
/* Go create the macro */
|
||||
macro = NewHash();
|
||||
Setattr(macro,k_name, macroname);
|
||||
|
||||
if (arglist) {
|
||||
Setattr(macro,k_args,arglist);
|
||||
Delete(arglist);
|
||||
|
|
@ -432,15 +442,16 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
|||
}
|
||||
}
|
||||
Setattr(symbols,macroname,macro);
|
||||
Delete(macroname);
|
||||
|
||||
Delete(str);
|
||||
Delete(argstr);
|
||||
Delete(macroname);
|
||||
return macro;
|
||||
|
||||
macro_error:
|
||||
Delete(str);
|
||||
Delete(argstr);
|
||||
Delete(arglist);
|
||||
Delete(macroname);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1029,9 +1040,7 @@ Preprocessor_replace(DOH *s)
|
|||
StringAppend(ns,id);
|
||||
}
|
||||
}
|
||||
#ifndef SWIG_PUT_BUFF
|
||||
Delete(id);
|
||||
#endif
|
||||
return ns;
|
||||
}
|
||||
|
||||
|
|
@ -1103,7 +1112,8 @@ static void add_chunk(DOH *ns, DOH *chunk, int allow) {
|
|||
static void
|
||||
push_imported() {
|
||||
if (imported_depth == 0) {
|
||||
Preprocessor_define("SWIGIMPORTED 1", 0);
|
||||
DOH *m = Preprocessor_define("SWIGIMPORTED 1", 0);
|
||||
Delete(m);
|
||||
}
|
||||
++imported_depth;
|
||||
}
|
||||
|
|
@ -1678,7 +1688,8 @@ Preprocessor_parse(String *s)
|
|||
}
|
||||
if (allow) {
|
||||
Seek(value,0,SEEK_SET);
|
||||
Preprocessor_define(value,1);
|
||||
DOH *m = Preprocessor_define(value,1);
|
||||
Delete(m);
|
||||
}
|
||||
StringPutc('\n',ns);
|
||||
addline(ns,value,0);
|
||||
|
|
|
|||
|
|
@ -80,9 +80,11 @@ Swig_clocal(SwigType *t, const String_or_char *name, const String_or_char *value
|
|||
if (value) {
|
||||
String *lcaststr = SwigType_lcaststr(t,value);
|
||||
String *lstr = SwigType_lstr(t,0);
|
||||
Printf(decl,"%s = (%s) %s", SwigType_lstr(t,name), lstr, lcaststr);
|
||||
String *lstrn = SwigType_lstr(t,name);
|
||||
Printf(decl,"%s = (%s) %s", lstrn, lstr, lcaststr);
|
||||
Delete(lcaststr);
|
||||
Delete(lstr);
|
||||
Delete(lstrn);
|
||||
} else {
|
||||
String *lstrname = SwigType_lstr(t,name);
|
||||
Printf(decl,"%s", lstrname);
|
||||
|
|
@ -194,7 +196,9 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
|
|||
tycode = SwigType_type(tvalue);
|
||||
if (tycode != T_USER) {
|
||||
/* plain primitive type, we copy the the def value */
|
||||
defvalue = NewStringf("%s = %s", SwigType_lstr(tvalue,defname),qvalue);
|
||||
String *lstr = SwigType_lstr(tvalue,defname);
|
||||
defvalue = NewStringf("%s = %s", lstr,qvalue);
|
||||
Delete(lstr);
|
||||
} else {
|
||||
/* user type, we copy the reference value */
|
||||
String *str = SwigType_str(type,defname);
|
||||
|
|
@ -239,9 +243,13 @@ String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_ch
|
|||
switch(SwigType_type(t)) {
|
||||
case T_VOID:
|
||||
break;
|
||||
case T_REFERENCE:
|
||||
Printf(fcall,"{\n");
|
||||
Printf(fcall,"%s = ", SwigType_str(t,"_result_ref"));
|
||||
case T_REFERENCE:
|
||||
{
|
||||
String *str = SwigType_str(t,"_result_ref");
|
||||
Printf(fcall,"{\n");
|
||||
Printf(fcall,"%s = ", str);
|
||||
Delete(str);
|
||||
}
|
||||
break;
|
||||
case T_USER:
|
||||
Printf(fcall,"%s = ", name);
|
||||
|
|
@ -249,7 +257,11 @@ String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_ch
|
|||
|
||||
default:
|
||||
/* Normal return value */
|
||||
Printf(fcall,"%s = (%s)", name, SwigType_lstr(t,0));
|
||||
{
|
||||
String *lstr = SwigType_lstr(t,0);
|
||||
Printf(fcall,"%s = (%s)", name, lstr);
|
||||
Delete(lstr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -311,7 +323,7 @@ Swig_cfunction_call(String_or_char *name, ParmList *parms) {
|
|||
} else {
|
||||
Printf(func,"%s(", nname);
|
||||
}
|
||||
|
||||
Delete(nname);
|
||||
|
||||
while (p) {
|
||||
SwigType *pt = Getattr(p,"type");
|
||||
|
|
@ -770,7 +782,11 @@ Swig_MethodToFunction(Node *n, String *classname, int flags) {
|
|||
|
||||
/* Generate action code for the access */
|
||||
if (!(flags & CWRAP_EXTEND)) {
|
||||
Setattr(n,"wrap:action", Swig_cresult(Getattr(n,"type"),"result", Swig_cmethod_call(name,p,self)));
|
||||
String *call = Swig_cmethod_call(name,p,self);
|
||||
String *result = Swig_cresult(Getattr(n,"type"),"result", call);
|
||||
Setattr(n,"wrap:action", result);
|
||||
Delete(call);
|
||||
Delete(result);
|
||||
} else {
|
||||
/* Methods with default arguments are wrapped with additional methods for each default argument,
|
||||
* however, only one extra %extend method is generated. */
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ Swig_fragment_register(Node* fragment) {
|
|||
Append(name,mangle);
|
||||
Delete(mangle);
|
||||
Delete(rtype);
|
||||
if (debug) Printf(stdout,"register fragment %s %s\n",name,type);
|
||||
}
|
||||
if (debug) Printf(stdout,"register fragment %s %s\n",name,type);
|
||||
if (!fragments) {
|
||||
fragments = NewHash();
|
||||
}
|
||||
|
|
@ -54,15 +54,14 @@ Swig_fragment_register(Node* fragment) {
|
|||
Hash *kwargs = Getattr(fragment,"kwargs");
|
||||
Setmeta(ccode,"section",section);
|
||||
if (kwargs) {
|
||||
kwargs = Copy(kwargs);
|
||||
Setmeta(ccode,"kwargs",kwargs);
|
||||
Delete(kwargs);
|
||||
}
|
||||
Setattr(fragments,name,ccode);
|
||||
if (debug) Printf(stdout,"registering fragment %s %s\n",name,section);
|
||||
Delete(section);
|
||||
Delete(ccode);
|
||||
}
|
||||
Delete(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -140,6 +139,7 @@ Swig_fragment_emit(Node *n) {
|
|||
pc = char_index(tok,',');
|
||||
if (pc) *pc = 0;
|
||||
}
|
||||
Delete(name);
|
||||
}
|
||||
Delete(t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ Swig_search_path_any(int syspath) {
|
|||
} else {
|
||||
Append(slist,filename);
|
||||
}
|
||||
Delete(filename);
|
||||
}
|
||||
if (syspath) {
|
||||
for (i = 0; i < Len(llist); i++) {
|
||||
|
|
|
|||
|
|
@ -401,12 +401,15 @@ Swig_name_object_set(Hash *namehash, String *name, SwigType *decl, DOH *object)
|
|||
if (!n) {
|
||||
n = NewHash();
|
||||
Setattr(namehash,name,n);
|
||||
Delete(n);
|
||||
}
|
||||
/* Add an object based on the declarator value */
|
||||
if (!decl) {
|
||||
Setattr(n,"*",object);
|
||||
} else {
|
||||
Setattr(n,Copy(decl),object);
|
||||
SwigType *cd = Copy(decl);
|
||||
Setattr(n,cd,object);
|
||||
Delete(cd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -555,7 +558,9 @@ static void merge_features(Hash *features, Node *n) {
|
|||
|
||||
if (!features) return;
|
||||
for (ki = First(features); ki.key; ki = Next(ki)) {
|
||||
Setattr(n,ki.key,Copy(ki.item));
|
||||
String *ci = Copy(ki.item);
|
||||
Setattr(n,ki.key,ci);
|
||||
Delete(ci);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -683,18 +688,21 @@ Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl, con
|
|||
if (!n) {
|
||||
n = NewHash();
|
||||
Setattr(features,name,n);
|
||||
Delete(n);
|
||||
}
|
||||
if (!decl) {
|
||||
fhash = Getattr(n,"*");
|
||||
if (!fhash) {
|
||||
fhash = NewHash();
|
||||
Setattr(n,"*",fhash);
|
||||
Delete(fhash);
|
||||
}
|
||||
} else {
|
||||
fhash = Getattr(n,decl);
|
||||
if (!fhash) {
|
||||
fhash = NewHash();
|
||||
Setattr(n,Copy(decl),fhash);
|
||||
Delete(fhash);
|
||||
}
|
||||
}
|
||||
if (value) {
|
||||
|
|
|
|||
|
|
@ -195,10 +195,10 @@ String *ParmList_str(ParmList *p) {
|
|||
String *out = NewStringEmpty();
|
||||
while(p) {
|
||||
String *pstr = SwigType_str(Getattr(p,"type"), Getattr(p,"name"));
|
||||
Append(out,pstr);
|
||||
StringAppend(out,pstr);
|
||||
p = nextSibling(p);
|
||||
if (p) {
|
||||
Append(out,",");
|
||||
StringAppend(out,",");
|
||||
}
|
||||
Delete(pstr);
|
||||
}
|
||||
|
|
@ -216,13 +216,13 @@ String *ParmList_str_defaultargs(ParmList *p) {
|
|||
while(p) {
|
||||
String *value = Getattr(p,"value");
|
||||
String *pstr = SwigType_str(Getattr(p,"type"), Getattr(p,"name"));
|
||||
Append(out,pstr);
|
||||
StringAppend(out,pstr);
|
||||
if (value) {
|
||||
Printf(out,"=%s", value);
|
||||
}
|
||||
p = nextSibling(p);
|
||||
if (p) {
|
||||
Append(out,",");
|
||||
StringAppend(out,",");
|
||||
}
|
||||
Delete(pstr);
|
||||
}
|
||||
|
|
@ -242,10 +242,10 @@ String *ParmList_protostr(ParmList *p) {
|
|||
p = nextSibling(p);
|
||||
} else {
|
||||
String *pstr = SwigType_str(Getattr(p,"type"), 0);
|
||||
Append(out,pstr);
|
||||
StringAppend(out,pstr);
|
||||
p = nextSibling(p);
|
||||
if (p) {
|
||||
Append(out,",");
|
||||
StringAppend(out,",");
|
||||
}
|
||||
Delete(pstr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -889,18 +889,22 @@ String *SwigType_lcaststr(SwigType *s, const String_or_char *name) {
|
|||
result = NewStringEmpty();
|
||||
|
||||
if (SwigType_isarray(s)) {
|
||||
Printf(result,"(%s)%s", SwigType_lstr(s,0),name);
|
||||
String *lstr = SwigType_lstr(s,0);
|
||||
Printf(result,"(%s)%s", lstr,name);
|
||||
Delete(lstr);
|
||||
} else if (SwigType_isreference(s)) {
|
||||
String *str = SwigType_str(s,0);
|
||||
Printf(result,"(%s)", str);
|
||||
Delete(str);
|
||||
if (name)
|
||||
Append(result,name);
|
||||
StringAppend(result,name);
|
||||
} else if (SwigType_isqualifier(s)) {
|
||||
Printf(result,"(%s)%s", SwigType_lstr(s,0),name);
|
||||
String *lstr = SwigType_lstr(s,0);
|
||||
Printf(result,"(%s)%s", lstr,name);
|
||||
Delete(lstr);
|
||||
} else {
|
||||
if (name)
|
||||
Append(result,name);
|
||||
StringAppend(result,name);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1007,17 +1011,17 @@ SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
|
|||
List *tparms = SwigType_parmlist(e);
|
||||
int j;
|
||||
String *nt = SwigType_templateprefix(e);
|
||||
Append(nt,"<(");
|
||||
StringAppend(nt,"<(");
|
||||
for (j = 0; j < Len(tparms); j++) {
|
||||
SwigType_typename_replace(Getitem(tparms,j), pat, rep);
|
||||
Append(nt,Getitem(tparms,j));
|
||||
StringAppend(nt,Getitem(tparms,j));
|
||||
if (j < (Len(tparms)-1)) Putc(',',nt);
|
||||
}
|
||||
tsuffix = SwigType_templatesuffix(e);
|
||||
Printf(nt,")>%s", tsuffix);
|
||||
Delete(tsuffix);
|
||||
Clear(e);
|
||||
Append(e,nt);
|
||||
StringAppend(e,nt);
|
||||
Delete(nt);
|
||||
Delete(tparms);
|
||||
}
|
||||
|
|
@ -1036,18 +1040,18 @@ SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
|
|||
int j;
|
||||
List *fparms = SwigType_parmlist(e);
|
||||
Clear(e);
|
||||
Append(e,"f(");
|
||||
StringAppend(e,"f(");
|
||||
for (j = 0; j < Len(fparms); j++) {
|
||||
SwigType_typename_replace(Getitem(fparms,j), pat, rep);
|
||||
Append(e,Getitem(fparms,j));
|
||||
StringAppend(e,Getitem(fparms,j));
|
||||
if (j < (Len(fparms)-1)) Putc(',',e);
|
||||
}
|
||||
Append(e,").");
|
||||
StringAppend(e,").");
|
||||
Delete(fparms);
|
||||
} else if (SwigType_isarray(e)) {
|
||||
Replace(e,pat,rep, DOH_REPLACE_ID);
|
||||
}
|
||||
Append(nt,e);
|
||||
StringAppend(nt,e);
|
||||
}
|
||||
Clear(t);
|
||||
Append(t,nt);
|
||||
|
|
@ -1067,10 +1071,9 @@ SwigType_check_decl(SwigType *ty, const SwigType *decl) {
|
|||
t = SwigType_typedef_resolve_all(ty);
|
||||
t1 = SwigType_strip_qualifiers(t);
|
||||
t2 = SwigType_prefix(t1);
|
||||
r = Cmp(t2,decl);
|
||||
r = Equal(t2,decl);
|
||||
Delete(t);
|
||||
Delete(t1);
|
||||
Delete(t2);
|
||||
if (r == 0) return 1;
|
||||
return 0;
|
||||
return r == 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ Swig_symbol_dump_symtable() {
|
|||
|
||||
void
|
||||
Swig_symbol_init() {
|
||||
empty_string = NewStringEmpty();
|
||||
empty_string = NewString("");
|
||||
k_allowstypedef = NewString("allows_typedef");
|
||||
k_cdecl = NewString("cdecl");
|
||||
k_coloncolon = NewString("::");
|
||||
|
|
|
|||
|
|
@ -560,11 +560,12 @@ Swig_typemap_clear_apply(Parm *parms) {
|
|||
if (tm) {
|
||||
/* Clear typemaps that match our signature */
|
||||
Iterator ki, ki2;
|
||||
|
||||
char *ctsig = Char(tsig);
|
||||
for (ki = First(tm); ki.key; ki = Next(ki)) {
|
||||
if (Strncmp(ki.key,"tmap:",5) == 0) {
|
||||
char *ckey = Char(ki.key);
|
||||
if (strncmp(ckey,"tmap:",5) == 0) {
|
||||
int na = count_args(ki.key);
|
||||
if ((na == narg) && Strstr(ki.key,tsig)) {
|
||||
if ((na == narg) && strstr(ckey,ctsig)) {
|
||||
Hash *h = ki.item;
|
||||
for (ki2 = First(h); ki2.key; ki2 = Next(ki2)) {
|
||||
Delattr(h,ki2.key);
|
||||
|
|
@ -1255,7 +1256,7 @@ Printf(stdout, "Swig_typemap_lookup %s [%s %s]\n", op, type, pname ? pname : "NO
|
|||
*/
|
||||
st = Getattr(node,"sym:symtab");
|
||||
qsn = st ? Swig_symbol_qualifiedscopename(st) : 0;
|
||||
if (qsn && Len(qsn)) {
|
||||
if (qsn && StringLen(qsn)) {
|
||||
/* look qualified names first, such as
|
||||
|
||||
int *Foo::foo(int bar) -> Foo::foo
|
||||
|
|
@ -1540,6 +1541,7 @@ Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f)
|
|||
|
||||
/* increase argnum to consider numinputs */
|
||||
argnum += nmatch - 1;
|
||||
Delete(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1566,7 +1568,7 @@ static List *split_embedded(String *s) {
|
|||
int leading = 1;
|
||||
args = NewList();
|
||||
|
||||
c = Strstr(s,"(");
|
||||
c = strstr(Char(s),"(");
|
||||
c++;
|
||||
|
||||
start = c;
|
||||
|
|
@ -1605,7 +1607,7 @@ static void split_var(String *s, String **name, String **value) {
|
|||
char *eq;
|
||||
char *c;
|
||||
|
||||
eq = Strstr(s,"=");
|
||||
eq = strstr(Char(s),"=");
|
||||
if (!eq) {
|
||||
*name = 0;
|
||||
*value = 0;
|
||||
|
|
@ -1630,10 +1632,10 @@ static void split_var(String *s, String **name, String **value) {
|
|||
|
||||
static void replace_embedded_typemap(String *s) {
|
||||
char *start = 0;
|
||||
while (start = strstr(Char(s),"$TYPEMAP(")) {
|
||||
while ((start = strstr(Char(s),"$TYPEMAP("))) {
|
||||
|
||||
/* Gather the argument */
|
||||
char *start, *end=0,*c;
|
||||
char *end=0,*c;
|
||||
int level = 0;
|
||||
String *tmp;
|
||||
c = start;
|
||||
|
|
|
|||
|
|
@ -719,6 +719,7 @@ SwigType_function_parms(SwigType *t) {
|
|||
if (!firstp) firstp = p;
|
||||
if (pp) {
|
||||
set_nextSibling(pp,p);
|
||||
Delete(p);
|
||||
}
|
||||
pp = p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -858,7 +858,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t)
|
|||
String *result;
|
||||
int i,len;
|
||||
if (!typedef_qualified_cache) typedef_qualified_cache = NewHash();
|
||||
result = Getattr(typedef_qualified_cache,t);
|
||||
result = HashGetAttr(typedef_qualified_cache,t);
|
||||
if (result) {
|
||||
String *rc = Copy(result);
|
||||
return rc;
|
||||
|
|
@ -1403,6 +1403,7 @@ void SwigType_remember_clientdata(SwigType *t, const String_or_char *clientdata)
|
|||
SwigType *fr;
|
||||
SwigType *qr;
|
||||
String *tkey;
|
||||
String *cd;
|
||||
|
||||
if (!r_mangled) {
|
||||
r_mangled = NewHash();
|
||||
|
|
@ -1419,8 +1420,10 @@ void SwigType_remember_clientdata(SwigType *t, const String_or_char *clientdata)
|
|||
}
|
||||
|
||||
tkey = Copy(t);
|
||||
Setattr(r_remembered, tkey, clientdata ? NewString(clientdata) : (void *) "");
|
||||
cd = clientdata ? NewString(clientdata) : NewStringEmpty();
|
||||
Setattr(r_remembered, tkey, cd);
|
||||
Delete(tkey);
|
||||
Delete(cd);
|
||||
|
||||
mt = SwigType_manglestr(t); /* Create mangled string */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue