fix many/many memory leaks
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7904 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
1b0603d684
commit
b66f1e672b
23 changed files with 627 additions and 251 deletions
|
|
@ -116,7 +116,7 @@ static Node *copy_node(Node *n) {
|
|||
Setattr(nn,"sym:needs_symtab", "1");
|
||||
}
|
||||
/* We don't copy any other symbol table attributes */
|
||||
if (Strncmp(key,"sym:",4) == 0) {
|
||||
if (strncmp(ckey,"sym:",4) == 0) {
|
||||
continue;
|
||||
}
|
||||
/* If children. We copy them recursively using this function */
|
||||
|
|
@ -124,7 +124,9 @@ static Node *copy_node(Node *n) {
|
|||
/* Copy children */
|
||||
Node *cn = k.item;
|
||||
while (cn) {
|
||||
appendChild(nn,copy_node(cn));
|
||||
Node *copy = copy_node(cn);
|
||||
appendChild(nn,copy);
|
||||
Delete(copy);
|
||||
cn = nextSibling(cn);
|
||||
}
|
||||
continue;
|
||||
|
|
@ -313,7 +315,7 @@ static String *make_name(String *name,SwigType *decl) {
|
|||
destructor = 1;
|
||||
}
|
||||
if (yyrename) {
|
||||
String *s = yyrename;
|
||||
String *s = (yyrename);
|
||||
yyrename = 0;
|
||||
if (destructor) {
|
||||
Insert(s,0,"~");
|
||||
|
|
@ -325,12 +327,12 @@ static String *make_name(String *name,SwigType *decl) {
|
|||
/* Check to see if the name is in the hash */
|
||||
if (!rename_hash) {
|
||||
if (add_oldname) return Copy(add_oldname);
|
||||
return origname;
|
||||
return Copy(origname);
|
||||
}
|
||||
rn = Swig_name_object_get(rename_hash, Namespaceprefix, name, decl);
|
||||
if (!rn) {
|
||||
if (add_oldname) return Copy(add_oldname);
|
||||
return name;
|
||||
return Copy(name);
|
||||
}
|
||||
if (destructor) {
|
||||
if (Strcmp(rn,"$ignore") != 0) {
|
||||
|
|
@ -384,7 +386,7 @@ static void add_symbols(Node *n) {
|
|||
cparse_normalize_void(n);
|
||||
}
|
||||
while (n) {
|
||||
String *symname;
|
||||
String *symname = 0;
|
||||
/* for friends, we need to pop the scope once */
|
||||
String *old_prefix = 0;
|
||||
Symtab *old_scope = 0;
|
||||
|
|
@ -424,7 +426,7 @@ static void add_symbols(Node *n) {
|
|||
*/
|
||||
String *prefix = name ? Swig_scopename_prefix(name) : 0;
|
||||
if (prefix) {
|
||||
if (Classprefix && (Strcmp(prefix,Classprefix) == 0)) {
|
||||
if (Classprefix && (StringEqual(prefix,Classprefix))) {
|
||||
String *base = Swig_scopename_last(name);
|
||||
Setattr(n,"name",base);
|
||||
Delete(base);
|
||||
|
|
@ -462,14 +464,15 @@ static void add_symbols(Node *n) {
|
|||
if (!SwigType_isfunction(decl)) {
|
||||
String *makename = Getattr(n,"parser:makename");
|
||||
if (makename) {
|
||||
symname = make_name(makename,0);
|
||||
Delattr(n,"parser:makename"); /* temporary information, don't leave it hanging around */
|
||||
} else {
|
||||
makename = Getattr(n,"name");
|
||||
symname = make_name(makename,0);
|
||||
}
|
||||
|
||||
symname = make_name(makename,0);
|
||||
if (!symname) {
|
||||
symname = Getattr(n,"unnamed");
|
||||
symname = Copy(Getattr(n,"unnamed"));
|
||||
}
|
||||
if (symname) {
|
||||
wrn = name_warning(n,symname,0);
|
||||
|
|
@ -558,8 +561,13 @@ static void add_symbols(Node *n) {
|
|||
/* restore the class scope if needed */
|
||||
if (isfriend) {
|
||||
Swig_symbol_setscope(old_scope);
|
||||
Namespaceprefix = old_prefix;
|
||||
if (old_prefix) {
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = old_prefix;
|
||||
}
|
||||
}
|
||||
Delete(symname);
|
||||
|
||||
if (add_only_one) return;
|
||||
n = nextSibling(n);
|
||||
}
|
||||
|
|
@ -571,10 +579,10 @@ static void add_symbols(Node *n) {
|
|||
static void add_symbols_copy(Node *n) {
|
||||
String *name;
|
||||
int emode = 0;
|
||||
|
||||
while (n) {
|
||||
char *cnodeType = Char(nodeType(n));
|
||||
|
||||
if (Strcmp(nodeType(n),"access") == 0) {
|
||||
if (strcmp(cnodeType,"access") == 0) {
|
||||
String *kind = Getattr(n,"kind");
|
||||
if (Strcmp(kind,"public") == 0) {
|
||||
cplus_mode = CPLUS_PUBLIC;
|
||||
|
|
@ -593,7 +601,8 @@ static void add_symbols_copy(Node *n) {
|
|||
DohIncref(add_oldname);
|
||||
/* If already renamed, we used that name */
|
||||
if (Strcmp(add_oldname, Getattr(n,"name")) != 0) {
|
||||
yyrename = add_oldname;
|
||||
Delete(yyrename);
|
||||
yyrename = Copy(add_oldname);
|
||||
}
|
||||
}
|
||||
Delattr(n,"sym:needs_symtab");
|
||||
|
|
@ -610,9 +619,10 @@ static void add_symbols_copy(Node *n) {
|
|||
if (Getattr(n,"requires_symtab")) {
|
||||
Swig_symbol_newscope();
|
||||
Swig_symbol_setscopename(name);
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
}
|
||||
if (Strcmp(nodeType(n),"class") == 0) {
|
||||
if (strcmp(cnodeType,"class") == 0) {
|
||||
inclass = 1;
|
||||
if (Strcmp(Getattr(n,"kind"),"class") == 0) {
|
||||
cplus_mode = CPLUS_PRIVATE;
|
||||
|
|
@ -620,33 +630,34 @@ static void add_symbols_copy(Node *n) {
|
|||
cplus_mode = CPLUS_PUBLIC;
|
||||
}
|
||||
}
|
||||
if (Strcmp(nodeType(n),"extend") == 0) {
|
||||
if (strcmp(cnodeType,"extend") == 0) {
|
||||
emode = cplus_mode;
|
||||
cplus_mode = CPLUS_PUBLIC;
|
||||
}
|
||||
add_symbols_copy(firstChild(n));
|
||||
if (Strcmp(nodeType(n),"extend") == 0) {
|
||||
if (strcmp(cnodeType,"extend") == 0) {
|
||||
cplus_mode = emode;
|
||||
}
|
||||
if (Getattr(n,"requires_symtab")) {
|
||||
Setattr(n,"symtab", Swig_symbol_popscope());
|
||||
Delattr(n,"requires_symtab");
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
}
|
||||
if (add_oldname) {
|
||||
Delete(add_oldname);
|
||||
}
|
||||
if (Strcmp(nodeType(n),"class") == 0) {
|
||||
if (strcmp(cnodeType,"class") == 0) {
|
||||
inclass = 0;
|
||||
}
|
||||
add_oldname = 0;
|
||||
} else {
|
||||
if (Strcmp(nodeType(n),"extend") == 0) {
|
||||
if (strcmp(cnodeType,"extend") == 0) {
|
||||
emode = cplus_mode;
|
||||
cplus_mode = CPLUS_PUBLIC;
|
||||
}
|
||||
add_symbols_copy(firstChild(n));
|
||||
if (Strcmp(nodeType(n),"extend") == 0) {
|
||||
if (strcmp(cnodeType,"extend") == 0) {
|
||||
cplus_mode = emode;
|
||||
}
|
||||
}
|
||||
|
|
@ -775,6 +786,7 @@ static void merge_extensions(Node *cls, Node *am) {
|
|||
qargs = Swig_symbol_type_qualify(args,0);
|
||||
Append(prefix,qargs);
|
||||
Delete(nname);
|
||||
Delete(qargs);
|
||||
nname = prefix;
|
||||
}
|
||||
return nname;
|
||||
|
|
@ -810,6 +822,7 @@ static void merge_extensions(Node *cls, Node *am) {
|
|||
Append(bases,s);
|
||||
if (q) {
|
||||
base = NewStringf("%s::%s", q, Getattr(s,"name"));
|
||||
Delete(q);
|
||||
} else {
|
||||
base = NewString(Getattr(s,"name"));
|
||||
}
|
||||
|
|
@ -903,6 +916,7 @@ static String *resolve_node_scope(String *cname) {
|
|||
String *base = Swig_scopename_last(name);
|
||||
String *tprefix = Swig_scopename_prefix(name);
|
||||
Insert(scopes,0,base);
|
||||
Delete(base);
|
||||
Delete(name);
|
||||
name = tprefix;
|
||||
}
|
||||
|
|
@ -930,6 +944,7 @@ static String *resolve_node_scope(String *cname) {
|
|||
/* set the scope to the inner class */
|
||||
Swig_symbol_setscope(Getattr(nscope_inner,"symtab"));
|
||||
/* save the last namespace prefix */
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
/* and return the node name, including the inner class prefix */
|
||||
break;
|
||||
|
|
@ -940,6 +955,7 @@ static String *resolve_node_scope(String *cname) {
|
|||
Setattr(ns2,"symtab", Getattr(ns1,"symtab"));
|
||||
add_symbols(ns2);
|
||||
Swig_symbol_setscope(Getattr(ns1,"symtab"));
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
if (nscope_inner) {
|
||||
if (Getattr(nscope_inner,"symtab") != Getattr(ns2,"symtab")) {
|
||||
|
|
@ -1250,7 +1266,9 @@ static void default_arguments(Node *n) {
|
|||
|
||||
/* Create new function and add to symbol table */
|
||||
{
|
||||
Node *new_function = new_node(Copy(nodeType(function)));
|
||||
SwigType *ntype = Copy(nodeType(function));
|
||||
char *cntype = Char(ntype);
|
||||
Node *new_function = new_node(ntype);
|
||||
SwigType *decl = Copy(Getattr(function,"decl"));
|
||||
int constqualifier = SwigType_isconst(decl);
|
||||
String *ccode = Copy(Getattr(function,"code"));
|
||||
|
|
@ -1270,6 +1288,7 @@ static void default_arguments(Node *n) {
|
|||
Setattr(new_function,"storage", cstorage);
|
||||
Setattr(new_function,"type", ctype);
|
||||
Setattr(new_function,"throw", cthrow);
|
||||
|
||||
Delete(ccode);
|
||||
Delete(cstorage);
|
||||
Delete(ctype);
|
||||
|
|
@ -1284,14 +1303,26 @@ static void default_arguments(Node *n) {
|
|||
}
|
||||
|
||||
/* copy specific attributes for global (or in a namespace) template functions - these are not templated class methods */
|
||||
if (Strcmp(nodeType(function),"template") == 0) {
|
||||
if (strcmp(cntype,"template") == 0) {
|
||||
Node *templatetype = Getattr(function,"templatetype");
|
||||
Node *symtypename = Getattr(function,"sym:typename");
|
||||
Parm *templateparms = Getattr(function,"templateparms");
|
||||
if (templatetype) Setattr(new_function,"templatetype",Copy(templatetype));
|
||||
if (symtypename) Setattr(new_function,"sym:typename",Copy(symtypename));
|
||||
if (templateparms) Setattr(new_function,"templateparms",CopyParmList(templateparms));
|
||||
} else if (Strcmp(nodeType(function),"constructor") == 0) {
|
||||
if (templatetype) {
|
||||
Node *tmp = Copy(templatetype);
|
||||
Setattr(new_function,"templatetype",tmp);
|
||||
Delete(tmp);
|
||||
}
|
||||
if (symtypename) {
|
||||
Node *tmp = Copy(symtypename);
|
||||
Setattr(new_function,"sym:typename",tmp);
|
||||
Delete(tmp);
|
||||
}
|
||||
if (templateparms) {
|
||||
Parm *tmp = CopyParmList(templateparms);
|
||||
Setattr(new_function,"templateparms",tmp);
|
||||
Delete(tmp);
|
||||
}
|
||||
} else if (strcmp(cntype,"constructor") == 0) {
|
||||
/* only copied for constructors as this is not a user defined feature - it is hard coded in the parser */
|
||||
if (GetFlag(function,"feature:new")) SetFlag(new_function,"feature:new");
|
||||
}
|
||||
|
|
@ -1304,6 +1335,8 @@ static void default_arguments(Node *n) {
|
|||
set_nextSibling(function, new_function);
|
||||
|
||||
function = new_function;
|
||||
|
||||
Delete(ntype);
|
||||
}
|
||||
} else {
|
||||
function = 0;
|
||||
|
|
@ -1659,14 +1692,16 @@ clear_directive : CLEAR tm_list SEMI {
|
|||
|
||||
constant_directive : CONSTANT ID EQUAL definetype SEMI {
|
||||
if (($4.type != T_ERROR) && ($4.type != T_SYMBOL)) {
|
||||
SwigType *type = NewSwigType($4.type);
|
||||
$$ = new_node("constant");
|
||||
Setattr($$,"name",$2);
|
||||
Setattr($$,"type",NewSwigType($4.type));
|
||||
Setattr($$,"type",type);
|
||||
Setattr($$,"value",$4.val);
|
||||
if ($4.rawval) Setattr($$,"rawval", $4.rawval);
|
||||
Setattr($$,"storage","%constant");
|
||||
SetFlag($$,"feature:immutable");
|
||||
add_symbols($$);
|
||||
Delete(type);
|
||||
} else {
|
||||
if ($4.type == T_ERROR) {
|
||||
Swig_warning(WARN_PARSE_UNSUPPORTED_VALUE,cparse_file,cparse_line,"Unsupported constant value (ignored)\n");
|
||||
|
|
@ -1792,6 +1827,7 @@ fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
|
|||
}
|
||||
| FRAGMENT LPAREN fname COMMA kwargs RPAREN LBRACE {
|
||||
Hash *p = $5;
|
||||
String *code;
|
||||
skip_balanced('{','}');
|
||||
$$ = new_node("fragment");
|
||||
Setattr($$,"value",Getattr($3,"value"));
|
||||
|
|
@ -1800,7 +1836,9 @@ fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
|
|||
Setattr($$,"kwargs",nextSibling(p));
|
||||
Delitem(scanner_ccode,0);
|
||||
Delitem(scanner_ccode,DOH_END);
|
||||
Setattr($$,"code",Copy(scanner_ccode));
|
||||
code = Copy(scanner_ccode);
|
||||
Setattr($$,"code",code);
|
||||
Delete(code);
|
||||
}
|
||||
| FRAGMENT LPAREN fname RPAREN SEMI {
|
||||
$$ = new_node("fragment");
|
||||
|
|
@ -1902,10 +1940,13 @@ inline_directive : INLINE HBLOCK {
|
|||
|
||||
$$ = 0;
|
||||
} else {
|
||||
String *code;
|
||||
$$ = new_node("insert");
|
||||
Delitem(scanner_ccode,0);
|
||||
Delitem(scanner_ccode,DOH_END);
|
||||
Setattr($$,"code", Copy(scanner_ccode));
|
||||
code = Copy(scanner_ccode);
|
||||
Setattr($$,"code", code);
|
||||
Delete(code);
|
||||
cpps=Copy(scanner_ccode);
|
||||
start_inline(Char(cpps), cparse_start_line);
|
||||
Delete(cpps);
|
||||
|
|
@ -1941,12 +1982,15 @@ insert_directive : HBLOCK {
|
|||
Setattr($$,"code",$5);
|
||||
}
|
||||
| INSERT LPAREN idstring RPAREN LBRACE {
|
||||
String *code;
|
||||
skip_balanced('{','}');
|
||||
$$ = new_node("insert");
|
||||
Setattr($$,"section",$3);
|
||||
Delitem(scanner_ccode,0);
|
||||
Delitem(scanner_ccode,DOH_END);
|
||||
Setattr($$,"code", Copy(scanner_ccode));
|
||||
code = Copy(scanner_ccode);
|
||||
Setattr($$,"code", code);
|
||||
Delete(code);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -1975,7 +2019,9 @@ module_directive: MODULE options idstring {
|
|||
if (!import_mode) {
|
||||
/* first module included, we apply global
|
||||
ModuleName, which can be modify by -module */
|
||||
Setattr($$,"name",Copy(ModuleName));
|
||||
String *mname = Copy(ModuleName);
|
||||
Setattr($$,"name",mname);
|
||||
Delete(mname);
|
||||
} else {
|
||||
/* import mode, we just pass the idstring */
|
||||
Setattr($$,"name",$3);
|
||||
|
|
@ -1991,6 +2037,7 @@ module_directive: MODULE options idstring {
|
|||
|
||||
name_directive : NAME LPAREN idstring RPAREN {
|
||||
Swig_warning(WARN_DEPRECATED_NAME,cparse_file,cparse_line, "%%name is deprecated. Use %%rename instead.\n");
|
||||
Delete(yyrename);
|
||||
yyrename = NewString($3);
|
||||
$$ = 0;
|
||||
}
|
||||
|
|
@ -2314,13 +2361,16 @@ typemap_directive : TYPEMAP LPAREN typemap_type RPAREN tm_list stringbrace {
|
|||
while (len && isspace(cstr[0])) { --len; ++cstr; }
|
||||
while (len && isspace(cstr[len - 1])) { --len; }
|
||||
code = NewStringWithSize(cstr, len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
kw = nextSibling(kw);
|
||||
}
|
||||
Setattr($$,"kwargs", $3.kwargs);
|
||||
}
|
||||
Setattr($$,"code", code ? code : NewString($6));
|
||||
code = code ? code : NewString($6);
|
||||
Setattr($$,"code", code);
|
||||
Delete(code);
|
||||
appendChild($$,$5);
|
||||
}
|
||||
}
|
||||
|
|
@ -2381,10 +2431,13 @@ tm_tail : COMMA typemap_parm tm_tail {
|
|||
;
|
||||
|
||||
typemap_parm : type typemap_parameter_declarator {
|
||||
Parm *parm;
|
||||
SwigType_push($1,$2.type);
|
||||
$$ = new_node("typemapitem");
|
||||
Setattr($$,"pattern",NewParm($1,$2.id));
|
||||
parm = NewParm($1,$2.id);
|
||||
Setattr($$,"pattern",parm);
|
||||
Setattr($$,"parms", $2.parms);
|
||||
Delete(parm);
|
||||
/* $$ = NewParm($1,$2.id);
|
||||
Setattr($$,"parms",$2.parms); */
|
||||
}
|
||||
|
|
@ -2449,15 +2502,18 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
SwigType *rty = Swig_symbol_typedef_reduce(ty,tscope);
|
||||
ty = Swig_symbol_type_qualify(rty,tscope);
|
||||
Setattr(p,"type",ty);
|
||||
Delete(ty);
|
||||
Delete(rty);
|
||||
} else {
|
||||
ty = Swig_symbol_type_qualify(ty,tscope);
|
||||
Setattr(p,"type",ty);
|
||||
Delete(ty);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
value = Swig_symbol_type_qualify(value,tscope);
|
||||
Setattr(p,"value",value);
|
||||
Delete(value);
|
||||
}
|
||||
|
||||
p = nextSibling(p);
|
||||
|
|
@ -2484,6 +2540,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
nn = Getattr(nn,"sym:nextSibling"); /* repeat for overloaded templated functions */
|
||||
continue;
|
||||
} else {
|
||||
String *tname = Copy($5);
|
||||
int def_supplied = 0;
|
||||
/* Expand the template */
|
||||
Node *templ = Swig_symbol_clookup($5,0);
|
||||
|
|
@ -2535,7 +2592,8 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
|
||||
templnode = copy_node(nn);
|
||||
/* We need to set the node name based on name used to instantiate */
|
||||
Setattr(templnode,"name",Copy($5));
|
||||
Setattr(templnode,"name",tname);
|
||||
Delete(tname);
|
||||
if (!specialized) {
|
||||
Delattr(templnode,"sym:typename");
|
||||
} else {
|
||||
|
|
@ -2549,6 +2607,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
String *nname = NewStringf("__dummy_%d__", cnt++);
|
||||
Swig_cparse_template_expand(templnode,nname,temparms,tscope);
|
||||
Setattr(templnode,"sym:name",nname);
|
||||
Delete(nname);
|
||||
Setattr(templnode,"feature:onlychildren",
|
||||
"typemap,typemapitem,typemapcopy,typedef,types,fragment");
|
||||
}
|
||||
|
|
@ -2582,6 +2641,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
Swig_symbol_inherit(st);
|
||||
}
|
||||
}
|
||||
Delete(bases);
|
||||
}
|
||||
}
|
||||
Swig_symbol_setscope(csyms);
|
||||
|
|
@ -2593,10 +2653,11 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
the class */
|
||||
|
||||
if (extendhash) {
|
||||
String *stmp = 0;
|
||||
String *clsname;
|
||||
Node *am;
|
||||
if (Namespaceprefix) {
|
||||
clsname = NewStringf("%s::%s", Namespaceprefix, Getattr(templnode,"name"));
|
||||
clsname = stmp = NewStringf("%s::%s", Namespaceprefix, Getattr(templnode,"name"));
|
||||
} else {
|
||||
clsname = Getattr(templnode,"name");
|
||||
}
|
||||
|
|
@ -2610,6 +2671,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
appendChild(templnode,am);
|
||||
Delattr(extendhash,clsname);
|
||||
}
|
||||
if (stmp) Delete(stmp);
|
||||
}
|
||||
/* Add to classes hash */
|
||||
if (!classes) classes = NewHash();
|
||||
|
|
@ -2618,8 +2680,11 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
if (Namespaceprefix) {
|
||||
String *temp = NewStringf("%s::%s", Namespaceprefix, Getattr(templnode,"name"));
|
||||
Setattr(classes,temp,templnode);
|
||||
Delete(temp);
|
||||
} else {
|
||||
Setattr(classes,Swig_symbol_qualifiedscopename(templnode),templnode);
|
||||
String *qs = Swig_symbol_qualifiedscopename(templnode);
|
||||
Setattr(classes, qs,templnode);
|
||||
Delete(qs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2646,6 +2711,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
}
|
||||
}
|
||||
Swig_symbol_setscope(tscope);
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
}
|
||||
;
|
||||
|
|
@ -2721,15 +2787,19 @@ c_decl : storage_class type declarator initializer c_decl_tail {
|
|||
Setattr($$,"throw",$4.throw);
|
||||
if (!$5) {
|
||||
if (Len(scanner_ccode)) {
|
||||
Setattr($$,"code",Copy(scanner_ccode));
|
||||
String *code = Copy(scanner_ccode);
|
||||
Setattr($$,"code",code);
|
||||
Delete(code);
|
||||
}
|
||||
} else {
|
||||
Node *n = $5;
|
||||
/* Inherit attributes */
|
||||
while (n) {
|
||||
Setattr(n,"type",Copy($2));
|
||||
String *type = Copy($2);
|
||||
Setattr(n,"type",type);
|
||||
Setattr(n,"storage",$1);
|
||||
n = nextSibling(n);
|
||||
Delete(type);
|
||||
}
|
||||
}
|
||||
if ($4.bitfield) {
|
||||
|
|
@ -2781,7 +2851,9 @@ c_decl_tail : SEMI {
|
|||
}
|
||||
if (!$4) {
|
||||
if (Len(scanner_ccode)) {
|
||||
Setattr($$,"code",Copy(scanner_ccode));
|
||||
String *code = Copy(scanner_ccode);
|
||||
Setattr($$,"code",code);
|
||||
Delete(code);
|
||||
}
|
||||
} else {
|
||||
set_nextSibling($$,$4);
|
||||
|
|
@ -2886,29 +2958,37 @@ c_enum_decl : storage_class ENUM ename LBRACE enumlist RBRACE SEMI {
|
|||
Setattr(n,"unnamed",unnamed);
|
||||
|
||||
if (unnamedinstance) {
|
||||
Setattr($$,"type",NewString("enum "));
|
||||
SwigType *cty = NewString("enum ");
|
||||
Setattr($$,"type",cty);
|
||||
Setattr($$,"unnamedinstance","1");
|
||||
Setattr(n,"unnamedinstance","1");
|
||||
Delete(cty);
|
||||
}
|
||||
if ($8) {
|
||||
Node *p = $8;
|
||||
set_nextSibling(n,p);
|
||||
while (p) {
|
||||
Setattr(p,"type",Copy(ty));
|
||||
SwigType *cty = Copy(ty);
|
||||
Setattr(p,"type",cty);
|
||||
Setattr(p,"unnamed",unnamed);
|
||||
Setattr(p,"storage",$1);
|
||||
Delete(cty);
|
||||
p = nextSibling(p);
|
||||
}
|
||||
} else {
|
||||
if (Len(scanner_ccode)) {
|
||||
Setattr(n,"code",Copy(scanner_ccode));
|
||||
String *code = Copy(scanner_ccode);
|
||||
Setattr(n,"code",code);
|
||||
Delete(code);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure that typedef enum ABC {foo} XYZ; uses XYZ for sym:name, like structs.
|
||||
* Note that class_rename/yyrename are bit of a mess so used this simple approach to change the name. */
|
||||
if ($7.id && $3 && Cmp($1,"typedef") == 0) {
|
||||
Setattr($$, "parser:makename", NewString($7.id));
|
||||
String *name = NewString($7.id);
|
||||
Setattr($$, "parser:makename", name);
|
||||
Delete(name);
|
||||
}
|
||||
|
||||
add_symbols($$); /* Add enum to tag space */
|
||||
|
|
@ -2916,6 +2996,7 @@ c_enum_decl : storage_class ENUM ename LBRACE enumlist RBRACE SEMI {
|
|||
|
||||
add_symbols($5); /* Add enum values to id space */
|
||||
add_symbols(n);
|
||||
Delete(unnamed);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -2946,7 +3027,9 @@ c_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end {
|
|||
Setattr($$,"decl",decl);
|
||||
Setattr($$,"parms",$6.parms);
|
||||
if (Len(scanner_ccode)) {
|
||||
Setattr($$,"code",Copy(scanner_ccode));
|
||||
String *code = Copy(scanner_ccode);
|
||||
Setattr($$,"code",code);
|
||||
Delete(code);
|
||||
}
|
||||
}
|
||||
if ($6.defarg) {
|
||||
|
|
@ -3006,6 +3089,7 @@ cpp_class_decl :
|
|||
}
|
||||
}
|
||||
|
||||
Delete(class_rename);
|
||||
class_rename = make_name($3,0);
|
||||
Classprefix = NewString($3);
|
||||
/* Deal with inheritance */
|
||||
|
|
@ -3042,7 +3126,9 @@ cpp_class_decl :
|
|||
Swig_symbol_inherit(st);
|
||||
}
|
||||
}
|
||||
Delete(bases);
|
||||
}
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
cparse_start_line = cparse_line;
|
||||
|
||||
|
|
@ -3052,10 +3138,12 @@ cpp_class_decl :
|
|||
if (template_parameters) {
|
||||
Parm *tp = template_parameters;
|
||||
while(tp) {
|
||||
String *tpname = Copy(Getattr(tp,"name"));
|
||||
Node *tn = new_node("templateparm");
|
||||
Setattr(tn,"name",Getattr(tp,"name"));
|
||||
Swig_symbol_cadd(Copy(Getattr(tp,"name")),tn);
|
||||
Setattr(tn,"name",tpname);
|
||||
Swig_symbol_cadd(tpname,tn);
|
||||
tp = nextSibling(tp);
|
||||
Delete(tpname);
|
||||
}
|
||||
}
|
||||
inclass = 1;
|
||||
|
|
@ -3064,6 +3152,7 @@ cpp_class_decl :
|
|||
SwigType *ty;
|
||||
Symtab *cscope = prev_symtab;
|
||||
Node *am = 0;
|
||||
String *scpname = 0;
|
||||
inclass = 0;
|
||||
$$ = new_node("class");
|
||||
Setline($$,cparse_start_line);
|
||||
|
|
@ -3090,7 +3179,9 @@ cpp_class_decl :
|
|||
Delete(clsname);
|
||||
}
|
||||
if (!classes) classes = NewHash();
|
||||
Setattr(classes,Swig_symbol_qualifiedscopename(0),$$);
|
||||
scpname = Swig_symbol_qualifiedscopename(0);
|
||||
Setattr(classes,scpname,$$);
|
||||
Delete(scpname);
|
||||
|
||||
appendChild($$,$7);
|
||||
if (am) appendChild($$,am);
|
||||
|
|
@ -3117,11 +3208,15 @@ cpp_class_decl :
|
|||
SwigType *decltype = Getattr($9,"decl");
|
||||
if (Cmp($1,"typedef") == 0) {
|
||||
if (!decltype || !Len(decltype)) {
|
||||
String *cname;
|
||||
name = Getattr($9,"name");
|
||||
Setattr($$,"tdname",Copy(name));
|
||||
cname = Copy(name);
|
||||
Setattr($$,"tdname",cname);
|
||||
Delete(cname);
|
||||
|
||||
/* Use typedef name as class name */
|
||||
if (class_rename && (Strcmp(class_rename,$3) == 0)) {
|
||||
Delete(class_rename);
|
||||
class_rename = NewString(name);
|
||||
}
|
||||
if (!Getattr(classes,name)) {
|
||||
|
|
@ -3151,27 +3246,33 @@ cpp_class_decl :
|
|||
/* we add the declaration in the original namespace */
|
||||
appendChild(nscope_inner,$$);
|
||||
Swig_symbol_setscope(Getattr(nscope_inner,"symtab"));
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
add_symbols($$);
|
||||
if (nscope) $$ = nscope;
|
||||
/* but the variable definition in the current scope */
|
||||
Swig_symbol_setscope(cscope);
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
add_symbols($9);
|
||||
} else {
|
||||
yyrename = NewString(class_rename);
|
||||
Delete(yyrename);
|
||||
yyrename = Copy(class_rename);
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
|
||||
add_symbols($$);
|
||||
add_symbols($9);
|
||||
}
|
||||
Swig_symbol_setscope(cscope);
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
}
|
||||
|
||||
/* An unnamed struct, possibly with a typedef */
|
||||
|
||||
| storage_class cpptype LBRACE {
|
||||
Delete(class_rename);
|
||||
class_rename = make_name(0,0);
|
||||
if (strcmp($2,"class") == 0) {
|
||||
cplus_mode = CPLUS_PRIVATE;
|
||||
|
|
@ -3182,6 +3283,7 @@ cpp_class_decl :
|
|||
cparse_start_line = cparse_line;
|
||||
inclass = 1;
|
||||
Classprefix = NewStringEmpty();
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
} cpp_members RBRACE declarator c_decl_tail {
|
||||
String *unnamed;
|
||||
|
|
@ -3210,8 +3312,10 @@ cpp_class_decl :
|
|||
Node *p = $8;
|
||||
set_nextSibling(n,p);
|
||||
while (p) {
|
||||
String *type = Copy(unnamed);
|
||||
Setattr(p,"unnamed",unnamed);
|
||||
Setattr(p,"type",Copy(unnamed));
|
||||
Setattr(p,"type",type);
|
||||
Delete(type);
|
||||
Setattr(p,"storage",$1);
|
||||
p = nextSibling(p);
|
||||
}
|
||||
|
|
@ -3222,6 +3326,7 @@ cpp_class_decl :
|
|||
String *name = 0;
|
||||
if ($1 && (strcmp($1,"typedef") == 0)) {
|
||||
if (!Len($7.type)) {
|
||||
String *scpname = 0;
|
||||
name = $7.id;
|
||||
Setattr($$,"tdname",name);
|
||||
Setattr($$,"name",name);
|
||||
|
|
@ -3247,7 +3352,9 @@ cpp_class_decl :
|
|||
Delete(clsname);
|
||||
}
|
||||
if (!classes) classes = NewHash();
|
||||
Setattr(classes,Swig_symbol_qualifiedscopename(0),$$);
|
||||
scpname = Swig_symbol_qualifiedscopename(0);
|
||||
Setattr(classes,scpname,$$);
|
||||
Delete(scpname);
|
||||
} else {
|
||||
Swig_symbol_setscopename((char*)"<unnamed>");
|
||||
}
|
||||
|
|
@ -3258,11 +3365,14 @@ cpp_class_decl :
|
|||
/* Pop the scope */
|
||||
Setattr($$,"symtab",Swig_symbol_popscope());
|
||||
if (class_rename) {
|
||||
Delete(yyrename);
|
||||
yyrename = NewString(class_rename);
|
||||
}
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
add_symbols($$);
|
||||
add_symbols(n);
|
||||
Delete(unnamed);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -3316,6 +3426,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para
|
|||
}
|
||||
if (sti) {
|
||||
Swig_symbol_setscope(sti);
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
$6 = ni;
|
||||
}
|
||||
|
|
@ -3526,6 +3637,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para
|
|||
}
|
||||
$$ = ntop;
|
||||
Swig_symbol_setscope(cscope);
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
if (error) $$ = 0;
|
||||
}
|
||||
|
|
@ -3589,9 +3701,12 @@ template_parms : rawparms {
|
|||
|
||||
cpp_using_decl : USING idcolon SEMI {
|
||||
String *uname = Swig_symbol_type_qualify($2,0);
|
||||
String *name = Swig_scopename_last($2);
|
||||
$$ = new_node("using");
|
||||
Setattr($$,"uname",uname);
|
||||
Setattr($$,"name", Swig_scopename_last($2));
|
||||
Setattr($$,"name", name);
|
||||
Delete(uname);
|
||||
Delete(name);
|
||||
add_symbols($$);
|
||||
}
|
||||
| USING NAMESPACE idcolon SEMI {
|
||||
|
|
@ -3637,6 +3752,7 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE {
|
|||
Swig_symbol_newscope();
|
||||
Swig_symbol_setscopename($2);
|
||||
}
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
} interface RBRACE {
|
||||
Node *n = $5;
|
||||
|
|
@ -3645,6 +3761,7 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE {
|
|||
Setattr(n,"symtab", Swig_symbol_popscope());
|
||||
Swig_symbol_setscope($1);
|
||||
$$ = n;
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
add_symbols($$);
|
||||
}
|
||||
|
|
@ -3666,6 +3783,7 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE {
|
|||
Setattr($$,"unnamed","1");
|
||||
Setattr($$,"symtab", Swig_symbol_popscope());
|
||||
Swig_symbol_setscope($1);
|
||||
Delete(Namespaceprefix);
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
add_symbols($$);
|
||||
}
|
||||
|
|
@ -3750,8 +3868,10 @@ cpp_member : c_declaration { $$ = $1; }
|
|||
symname= make_name(Getattr($$,"name"), Getattr($$,"decl"));
|
||||
if (Strcmp(symname,Getattr($$,"name")) == 0) {
|
||||
/* No renaming operation. Set name to class name */
|
||||
Delete(yyrename);
|
||||
yyrename = NewString(Getattr(current_class,"sym:name"));
|
||||
} else {
|
||||
Delete(yyrename);
|
||||
yyrename = symname;
|
||||
}
|
||||
}
|
||||
|
|
@ -3793,7 +3913,9 @@ cpp_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end {
|
|||
Setattr($$,"throws",$6.throws);
|
||||
Setattr($$,"throw",$6.throw);
|
||||
if (Len(scanner_ccode)) {
|
||||
Setattr($$,"code",Copy(scanner_ccode));
|
||||
String *code = Copy(scanner_ccode);
|
||||
Setattr($$,"code",code);
|
||||
Delete(code);
|
||||
}
|
||||
SetFlag($$,"feature:new");
|
||||
} else {
|
||||
|
|
@ -3805,15 +3927,20 @@ cpp_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end {
|
|||
/* A destructor (hopefully) */
|
||||
|
||||
cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end {
|
||||
String *name = NewStringf("~%s",$2);
|
||||
$$ = new_node("destructor");
|
||||
Setattr($$,"name",NewStringf("~%s",$2));
|
||||
Setattr($$,"name",name);
|
||||
Delete(name);
|
||||
if (Len(scanner_ccode)) {
|
||||
Setattr($$,"code",Copy(scanner_ccode));
|
||||
String *code = Copy(scanner_ccode);
|
||||
Setattr($$,"code",code);
|
||||
Delete(code);
|
||||
}
|
||||
{
|
||||
String *decl = NewStringEmpty();
|
||||
SwigType_add_function(decl,$4);
|
||||
Setattr($$,"decl",decl);
|
||||
Delete(decl);
|
||||
}
|
||||
Setattr($$,"throws",$6.throws);
|
||||
Setattr($$,"throw",$6.throw);
|
||||
|
|
@ -3823,32 +3950,36 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end {
|
|||
/* A virtual destructor */
|
||||
|
||||
| VIRTUAL NOT idtemplate LPAREN parms RPAREN cpp_vend {
|
||||
String *name;
|
||||
char *c;
|
||||
$$ = new_node("destructor");
|
||||
/* Check for template names. If the class is a template
|
||||
and the constructor is missing the template part, we
|
||||
add it */
|
||||
{
|
||||
char *c = Strstr(Classprefix,"<");
|
||||
if (c) {
|
||||
if (!Strstr($3,"<")) {
|
||||
$3 = NewStringf("%s%s",$3,c);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((c = strstr(Char(Classprefix),"<"))) {
|
||||
if (!Strstr($3,"<")) {
|
||||
$3 = NewStringf("%s%s",$3,c);
|
||||
}
|
||||
}
|
||||
Setattr($$,"storage","virtual");
|
||||
Setattr($$,"name",NewStringf("~%s",$3));
|
||||
name = NewStringf("~%s",$3);
|
||||
Setattr($$,"name",name);
|
||||
Delete(name);
|
||||
Setattr($$,"throws",$7.throws);
|
||||
Setattr($$,"throw",$7.throw);
|
||||
if ($7.val) {
|
||||
Setattr($$,"value","0");
|
||||
}
|
||||
if (Len(scanner_ccode)) {
|
||||
Setattr($$,"code",Copy(scanner_ccode));
|
||||
String *code = Copy(scanner_ccode);
|
||||
Setattr($$,"code",code);
|
||||
Delete(code);
|
||||
}
|
||||
{
|
||||
String *decl = NewStringEmpty();
|
||||
SwigType_add_function(decl,$5);
|
||||
Setattr($$,"decl",decl);
|
||||
Delete(decl);
|
||||
}
|
||||
|
||||
add_symbols($$);
|
||||
|
|
@ -4219,7 +4350,9 @@ valparm : parm {
|
|||
if (!SwigType_isfunction(decl)) {
|
||||
String *value = Getattr(n,"value");
|
||||
if (value) {
|
||||
Setattr($1,"type",Copy(value));
|
||||
String *v = Copy(value);
|
||||
Setattr($1,"type",v);
|
||||
Delete(v);
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -4237,10 +4370,12 @@ valparm : parm {
|
|||
Setattr($$,"value",$1.val);
|
||||
}
|
||||
| STRING {
|
||||
String *v = NewString($1);
|
||||
$$ = NewParm(0,0);
|
||||
Setfile($$,cparse_file);
|
||||
Setline($$,cparse_line);
|
||||
Setattr($$,"value",NewString($1));
|
||||
Setattr($$,"value",v);
|
||||
Delete(v);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -5041,21 +5176,27 @@ enumlist : enumlist COMMA edecl {
|
|||
;
|
||||
|
||||
edecl : ID {
|
||||
SwigType *type = NewSwigType(T_INT);
|
||||
$$ = new_node("enumitem");
|
||||
Setattr($$,"name",$1);
|
||||
Setattr($$,"type",NewSwigType(T_INT));
|
||||
Setattr($$,"type",type);
|
||||
SetFlag($$,"feature:immutable");
|
||||
Delete(type);
|
||||
}
|
||||
| ID EQUAL etype {
|
||||
$$ = new_node("enumitem");
|
||||
Setattr($$,"name",$1);
|
||||
Setattr($$,"enumvalue", $3.val);
|
||||
if ($3.type == T_CHAR) {
|
||||
SwigType *type = NewSwigType(T_CHAR);
|
||||
Setattr($$,"value",$3.val);
|
||||
Setattr($$,"type",NewSwigType(T_CHAR));
|
||||
Setattr($$,"type",type);
|
||||
Delete(type);
|
||||
} else {
|
||||
SwigType *type = NewSwigType(T_INT);
|
||||
Setattr($$,"value",$1);
|
||||
Setattr($$,"type",NewSwigType(T_INT));
|
||||
Setattr($$,"type",type);
|
||||
Delete(type);
|
||||
}
|
||||
SetFlag($$,"feature:immutable");
|
||||
}
|
||||
|
|
@ -5219,14 +5360,18 @@ exprcompound : expr PLUS expr {
|
|||
$$.type = T_INT;
|
||||
}
|
||||
| type LPAREN {
|
||||
String *qty;
|
||||
skip_balanced('(',')');
|
||||
$1 = Swig_symbol_type_qualify($1,0);
|
||||
if (SwigType_istemplate($1)) {
|
||||
$1 = SwigType_namestr($1);
|
||||
qty = Swig_symbol_type_qualify($1,0);
|
||||
if (SwigType_istemplate(qty)) {
|
||||
String *nstr = SwigType_namestr(qty);
|
||||
Delete(qty);
|
||||
qty = nstr;
|
||||
}
|
||||
$$.val = NewStringf("%s%s",$1,scanner_ccode);
|
||||
$$.val = NewStringf("%s%s",qty,scanner_ccode);
|
||||
Clear(scanner_ccode);
|
||||
$$.type = T_INT;
|
||||
Delete(qty);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear
|
|||
/* Change the node type back to normal */
|
||||
if (!expanded) {
|
||||
expanded = 1;
|
||||
set_nodeType(n,Getattr(n,k_templatetype));
|
||||
Setattr(n,k_nodetype,Getattr(n,k_templatetype));
|
||||
ret = cparse_template_expand(n,tname, rname, templateargs, patchlist,typelist, cpatchlist);
|
||||
expanded = 0;
|
||||
return ret;
|
||||
|
|
@ -133,9 +133,9 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear
|
|||
/* Called when template appears inside another template */
|
||||
/* Member templates */
|
||||
|
||||
set_nodeType(n,Getattr(n,k_templatetype));
|
||||
Setattr(n,k_nodetype,Getattr(n,k_templatetype));
|
||||
ret = cparse_template_expand(n,tname, rname, templateargs, patchlist,typelist, cpatchlist);
|
||||
set_nodeType(n,k_template);
|
||||
Setattr(n,k_nodetype,k_template);
|
||||
return ret;
|
||||
}
|
||||
} else if (StringEqual(nodeType,k_cdecl)) {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,17 @@ char cvsroot_base_c[] = "$Header$";
|
|||
* DohDelete()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* #define SWIG_DEBUG_DELETE */
|
||||
#ifndef SWIG_DEBUG_DELETE
|
||||
#define SWIG_DEBUG_DELETE 0
|
||||
#endif
|
||||
|
||||
void
|
||||
DohDelete(DOH *obj) {
|
||||
DohBase *b = (DohBase *) obj;
|
||||
DohObjInfo *objinfo;
|
||||
|
||||
if (!obj) return;
|
||||
#ifdef SWIG_DEBUG_DELETE
|
||||
#if SWIG_DEBUG_DELETE
|
||||
if (!DohCheck(b)) {
|
||||
fputs("DOH: Fatal error. Attempt to delete a non-doh object.\n",stderr);
|
||||
abort();
|
||||
|
|
|
|||
|
|
@ -332,6 +332,7 @@ class Allocate : public Dispatcher {
|
|||
if (!nabstract) {
|
||||
nabstract = NewList();
|
||||
Setattr(n,"abstract",nabstract);
|
||||
Delete(nabstract);
|
||||
}
|
||||
Append(nabstract,nn);
|
||||
if (!Getattr(n,"abstract:firstnode")) {
|
||||
|
|
@ -557,6 +558,7 @@ public:
|
|||
List *abstract = NewList();
|
||||
Append(abstract,na);
|
||||
Setattr(n,"abstract",abstract);
|
||||
Delete(abstract);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -482,4 +482,5 @@ void emit_action(Node *n, Wrapper *f) {
|
|||
Printv(f->code,tm,"\n",NIL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -956,7 +956,11 @@ Language::globalfunctionHandler(Node *n) {
|
|||
Delete(cbname);
|
||||
}
|
||||
Setattr(n,"parms",nonvoid_parms(parms));
|
||||
Setattr(n,"wrap:action", Swig_cresult(type,"result", Swig_cfunction_call(name,parms)));
|
||||
String *call = Swig_cfunction_call(name,parms);
|
||||
String *cres = Swig_cresult(type,"result", call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(cres);
|
||||
Delete(call);
|
||||
functionWrapper(n);
|
||||
}
|
||||
Swig_restore(n);
|
||||
|
|
@ -1207,11 +1211,10 @@ Language::membervariableHandler(Node *n) {
|
|||
}
|
||||
|
||||
if (!AttributeFunctionGet) {
|
||||
|
||||
String *mrename_get, *mrename_set;
|
||||
|
||||
mrename_get = Swig_name_get(Swig_name_member(ClassPrefix, symname));
|
||||
mrename_set = Swig_name_set(Swig_name_member(ClassPrefix, symname));
|
||||
String *mname = Swig_name_member(ClassPrefix, symname);
|
||||
String *mrename_get = Swig_name_get(mname);
|
||||
String *mrename_set = Swig_name_set(mname);
|
||||
Delete(mname);
|
||||
|
||||
/* Create a function to set the value of the variable */
|
||||
|
||||
|
|
@ -1234,10 +1237,14 @@ Language::membervariableHandler(Node *n) {
|
|||
String *base = Getattr(sn,"name");
|
||||
target = NewStringf("%s::%s", base,name);
|
||||
} else {
|
||||
target = NewStringf("(*%s)->%s",Swig_cparm_name(0,0),name);
|
||||
String *pname = Swig_cparm_name(0,0);
|
||||
target = NewStringf("(*%s)->%s",pname,name);
|
||||
Delete(pname);
|
||||
}
|
||||
} else {
|
||||
target = NewStringf("%s->%s", Swig_cparm_name(0,0),name);
|
||||
String *pname = Swig_cparm_name(0,0);
|
||||
target = NewStringf("%s->%s", pname,name);
|
||||
Delete(pname);
|
||||
}
|
||||
tm = Swig_typemap_lookup_new("memberin",n,target,0);
|
||||
}
|
||||
|
|
@ -1254,12 +1261,16 @@ Language::membervariableHandler(Node *n) {
|
|||
make_set_wrapper = 0;
|
||||
}
|
||||
} else {
|
||||
Replace(tm,"$source", Swig_cparm_name(0,1), DOH_REPLACE_ANY);
|
||||
String *pname0 = Swig_cparm_name(0,0);
|
||||
String *pname1 = Swig_cparm_name(0,1);
|
||||
Replace(tm,"$source", pname1, DOH_REPLACE_ANY);
|
||||
Replace(tm,"$target", target, DOH_REPLACE_ANY);
|
||||
Replace(tm,"$input",Swig_cparm_name(0,1),DOH_REPLACE_ANY);
|
||||
Replace(tm,"$self",Swig_cparm_name(0,0),DOH_REPLACE_ANY);
|
||||
Replace(tm,"$input",pname1,DOH_REPLACE_ANY);
|
||||
Replace(tm,"$self",pname0,DOH_REPLACE_ANY);
|
||||
Setattr(n,"wrap:action", tm);
|
||||
Delete(tm);
|
||||
Delete(pname0);
|
||||
Delete(pname1);
|
||||
}
|
||||
Delete(target);
|
||||
}
|
||||
|
|
@ -1307,7 +1318,7 @@ Language::membervariableHandler(Node *n) {
|
|||
cpp_member_func(Char(gname),Char(gname),type,0);
|
||||
Delete(ActionFunc);
|
||||
} else {
|
||||
String *cname = Copy(Swig_name_get(name));
|
||||
String *cname = Swig_name_get(name);
|
||||
cpp_member_func(Char(cname),Char(gname),type,0);
|
||||
Delete(cname);
|
||||
}
|
||||
|
|
@ -1320,7 +1331,7 @@ Language::membervariableHandler(Node *n) {
|
|||
cpp_member_func(Char(gname),Char(gname),vty,p);
|
||||
Delete(ActionFunc);
|
||||
} else {
|
||||
String *cname = Copy(Swig_name_set(name));
|
||||
String *cname = Swig_name_set(name);
|
||||
cpp_member_func(Char(cname),Char(gname),vty,p);
|
||||
Delete(cname);
|
||||
}
|
||||
|
|
@ -2459,8 +2470,9 @@ int Language::variableWrapper(Node *n) {
|
|||
String *tm = Swig_typemap_lookup_new("globalin", n, name, 0);
|
||||
|
||||
Swig_VarsetToFunction(n);
|
||||
|
||||
Setattr(n,"sym:name", Swig_name_set(symname));
|
||||
String *sname = Swig_name_set(symname);
|
||||
Setattr(n,"sym:name", sname);
|
||||
Delete(sname);
|
||||
|
||||
/* String *tm = Swig_typemap_lookup((char *) "globalin",type,name,name,Swig_cparm_name(0,0),name,0);*/
|
||||
|
||||
|
|
@ -2471,11 +2483,13 @@ int Language::variableWrapper(Node *n) {
|
|||
make_set_wrapper = 0;
|
||||
}
|
||||
} else {
|
||||
Replace(tm,"$source", Swig_cparm_name(0,0), DOH_REPLACE_ANY);
|
||||
String *pname0 = Swig_cparm_name(0,0);
|
||||
Replace(tm,"$source", pname0, DOH_REPLACE_ANY);
|
||||
Replace(tm,"$target", name, DOH_REPLACE_ANY);
|
||||
Replace(tm,"$input",Swig_cparm_name(0,0),DOH_REPLACE_ANY);
|
||||
Replace(tm,"$input",pname0,DOH_REPLACE_ANY);
|
||||
Setattr(n,"wrap:action", tm);
|
||||
Delete(tm);
|
||||
Delete(pname0);
|
||||
}
|
||||
if (make_set_wrapper) {
|
||||
functionWrapper(n);
|
||||
|
|
@ -2493,7 +2507,9 @@ int Language::variableWrapper(Node *n) {
|
|||
}
|
||||
}
|
||||
Swig_VargetToFunction(n);
|
||||
Setattr(n,"sym:name", Swig_name_get(symname));
|
||||
String *gname = Swig_name_get(symname);
|
||||
Setattr(n,"sym:name", gname);
|
||||
Delete(gname);
|
||||
functionWrapper(n);
|
||||
Swig_restore(n);
|
||||
return SWIG_OK;
|
||||
|
|
|
|||
|
|
@ -185,8 +185,9 @@ static void install_opts(int argc, char *argv[]) {
|
|||
}
|
||||
if (!noopt) {
|
||||
/* Printf(stdout,"%s\n", opt); */
|
||||
Delete(Preprocessor_define(opt, 0));
|
||||
Preprocessor_define(opt, 0);
|
||||
}
|
||||
Delete(opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -337,6 +338,7 @@ static void SWIG_dump_runtime() {
|
|||
Delete(s);
|
||||
|
||||
Close(runtime);
|
||||
Delete(runtime);
|
||||
SWIG_exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -357,9 +359,10 @@ void SWIG_getoptions(int argc, char *argv[])
|
|||
includefiles[includecount++] = Swig_copy_string(argv[i]+2);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strncmp(argv[i],"-D",2) == 0) {
|
||||
DOH *d = NewString(argv[i]+2);
|
||||
String *d = NewString(argv[i]+2);
|
||||
Replace(d,(char*)"=",(char*)" ", DOH_REPLACE_ANY | DOH_REPLACE_FIRST);
|
||||
Delete(Preprocessor_define((DOH *) d,0));
|
||||
Preprocessor_define((DOH *) d,0);
|
||||
Delete(d);
|
||||
// Create a symbol
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-E") == 0) {
|
||||
|
|
@ -374,7 +377,7 @@ void SWIG_getoptions(int argc, char *argv[])
|
|||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-c++") == 0) {
|
||||
CPlusPlus=1;
|
||||
Delete(Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0));
|
||||
Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0);
|
||||
Swig_cparse_cplusplus(1);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-fcompact") == 0) {
|
||||
|
|
@ -461,8 +464,8 @@ void SWIG_getoptions(int argc, char *argv[])
|
|||
if (!outfile_name_h) {
|
||||
Printf(basename, ".%s", hpp_extension);
|
||||
outfile_name_h = Swig_copy_string(Char(basename));
|
||||
Delete(basename);
|
||||
}
|
||||
Delete(basename);
|
||||
}
|
||||
Swig_mark_arg(i+1);
|
||||
i++;
|
||||
|
|
@ -651,13 +654,13 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
// Set up some default symbols (available in both SWIG interface files
|
||||
// and C files)
|
||||
|
||||
Delete(Preprocessor_define((DOH *) "SWIG 1", 0));
|
||||
Delete(Preprocessor_define((DOH *) "__STDC__", 0));
|
||||
Preprocessor_define((DOH *) "SWIG 1", 0);
|
||||
Preprocessor_define((DOH *) "__STDC__", 0);
|
||||
#ifdef MACSWIG
|
||||
Delete(Preprocessor_define((DOH *) "SWIGMAC 1", 0));
|
||||
Preprocessor_define((DOH *) "SWIGMAC 1", 0);
|
||||
#endif
|
||||
#ifdef SWIGWIN32
|
||||
Delete(Preprocessor_define((DOH *) "SWIGWIN32 1", 0));
|
||||
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 +681,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
/* Turn on contracts */
|
||||
|
||||
Swig_contract_mode_set(1);
|
||||
Delete(Preprocessor_define(vers,0));
|
||||
Preprocessor_define(vers,0);
|
||||
|
||||
/* Turn off directors mode */
|
||||
Wrapper_director_mode_set(0);
|
||||
|
|
@ -715,7 +718,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
|
||||
// Define the __cplusplus symbol
|
||||
if (CPlusPlus)
|
||||
Delete(Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0));
|
||||
Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0);
|
||||
|
||||
// Parse language dependent options
|
||||
lang->main(argc,argv);
|
||||
|
|
@ -827,6 +830,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
}
|
||||
Seek(fs,0,SEEK_SET);
|
||||
cpps = Preprocessor_parse(fs);
|
||||
Delete(fs);
|
||||
} else {
|
||||
df = Swig_open(input_file);
|
||||
cpps = NewFileFromFile(df);
|
||||
|
|
@ -965,9 +969,15 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
|||
if (dump_xml) {
|
||||
Swig_print_xml(top, xmlout);
|
||||
}
|
||||
Delete(top);
|
||||
}
|
||||
if (tm_debug) Swig_typemap_debug();
|
||||
if (memory_debug) DohMemoryDebug();
|
||||
|
||||
// Deletes
|
||||
Delete(libfiles);
|
||||
Preprocessor_delete();
|
||||
|
||||
while (freeze);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -423,6 +423,7 @@ Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *maxargs) {
|
|||
for (/* empty */; num_braces > 0; num_braces--)
|
||||
Printf(f, "}\n");
|
||||
Printf(f,"}\n"); /* braces closes "if" for this method */
|
||||
Delattr(ni,"wrap:parms");
|
||||
}
|
||||
Delete(dispatch);
|
||||
return f;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ public:
|
|||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-nortti") == 0) {
|
||||
/* Turn on no RTTI mode */
|
||||
Delete(Preprocessor_define((DOH *) "SWIG_NORTTI", 0));
|
||||
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) {
|
||||
Delete(Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0));
|
||||
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
|
||||
}
|
||||
|
||||
if (!global_name) global_name = NewString("cvar");
|
||||
Delete(Preprocessor_define("SWIGPYTHON 1", 0));
|
||||
Preprocessor_define("SWIGPYTHON 1", 0);
|
||||
SWIG_typemap_lang("python");
|
||||
SWIG_config_file("python.swg");
|
||||
allow_overloading();
|
||||
|
|
@ -2304,6 +2304,7 @@ public:
|
|||
if (!shadow_list) {
|
||||
shadow_list = NewList();
|
||||
Setattr(getCurrentClass(),"shadow_methods", shadow_list);
|
||||
Delete(shadow_list);
|
||||
}
|
||||
Append(shadow_list, symname);
|
||||
} else {
|
||||
|
|
@ -2560,27 +2561,29 @@ public:
|
|||
Language::membervariableHandler(n);
|
||||
shadow = oldshadow;
|
||||
|
||||
String *mname = Swig_name_member(class_name,symname);
|
||||
String *sname = Swig_name_set(mname);
|
||||
String *gname = Swig_name_get(mname);
|
||||
if (shadow) {
|
||||
int assignable = is_assignable(n);
|
||||
if (!modern) {
|
||||
if (assignable) {
|
||||
Printv(f_shadow, tab4, "__swig_setmethods__[\"", symname, "\"] = ", module, ".", Swig_name_set(Swig_name_member(class_name,symname)), "\n", NIL);
|
||||
Printv(f_shadow, tab4, "__swig_setmethods__[\"", symname, "\"] = ", module, ".", sname, "\n", NIL);
|
||||
}
|
||||
Printv(f_shadow, tab4, "__swig_getmethods__[\"", symname, "\"] = ", module, ".", Swig_name_get(Swig_name_member(class_name,symname)),"\n", NIL);
|
||||
Printv(f_shadow, tab4, "__swig_getmethods__[\"", symname, "\"] = ", module, ".", gname,"\n", NIL);
|
||||
}
|
||||
if (!classic) {
|
||||
if (!assignable) {
|
||||
Printv(f_shadow,tab4, modern ? "" : "if _newclass:",
|
||||
symname," = property(", module, ".",
|
||||
Swig_name_get(Swig_name_member(class_name,symname)),")\n", NIL);
|
||||
Printv(f_shadow, tab4, modern ? "" : "if _newclass:", symname," = property(", module, ".", gname,")\n", NIL);
|
||||
} else {
|
||||
Printv(f_shadow,tab4, modern ? "" : "if _newclass:",
|
||||
symname," = property(",
|
||||
module, ".", Swig_name_get(Swig_name_member(class_name,symname)),", ",
|
||||
module, ".", Swig_name_set(Swig_name_member(class_name,symname)),")\n", NIL);
|
||||
Printv(f_shadow, tab4, modern ? "" : "if _newclass:", symname," = property(", module, ".", gname,", ", module, ".", sname,")\n", NIL);
|
||||
}
|
||||
}
|
||||
}
|
||||
Delete(mname);
|
||||
Delete(sname);
|
||||
Delete(gname);
|
||||
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
@ -2597,7 +2600,9 @@ public:
|
|||
t = Getattr(n,"type");
|
||||
symname = Getattr(n,"sym:name");
|
||||
if (SwigType_isconst(t) && !Getattr(n, "value")) {
|
||||
Printf(f_shadow_stubs,"%s.%s = %s.%s.%s\n", class_name, symname, module, global_name, Swig_name_member(class_name,symname));
|
||||
String *mname = Swig_name_member(class_name,symname);
|
||||
Printf(f_shadow_stubs,"%s.%s = %s.%s.%s\n", class_name, symname, module, global_name, mname);
|
||||
Delete(mname);
|
||||
}
|
||||
}
|
||||
return SWIG_OK;
|
||||
|
|
|
|||
|
|
@ -2041,10 +2041,11 @@ public:
|
|||
|
||||
String *freefunc = NewString("");
|
||||
String *freebody = NewString("");
|
||||
String *pname0 = Swig_cparm_name(0,0);
|
||||
|
||||
Printv(freefunc, "free_", klass->mname, NIL);
|
||||
Printv(freebody, "SWIGINTERN void\n",
|
||||
freefunc, "(", klass->type, " *", Swig_cparm_name(0,0), ") {\n",
|
||||
freefunc, "(", klass->type, " *", pname0, ") {\n",
|
||||
tab4, NIL);
|
||||
|
||||
if (Extend) {
|
||||
|
|
@ -2052,7 +2053,7 @@ public:
|
|||
if (wrap) {
|
||||
Printv(f_wrappers, wrap, NIL);
|
||||
}
|
||||
/* Printv(freebody, Swig_name_destroy(name), "(", Swig_cparm_name(0,0), ")", NIL); */
|
||||
/* Printv(freebody, Swig_name_destroy(name), "(", pname0, ")", NIL); */
|
||||
Printv(freebody,Getattr(n,"wrap:action"), NIL);
|
||||
} else {
|
||||
String *action = Getattr(n,"wrap:action");
|
||||
|
|
@ -2061,14 +2062,14 @@ public:
|
|||
} else {
|
||||
/* In the case swig emits no destroy function. */
|
||||
if (CPlusPlus)
|
||||
Printf(freebody, "delete %s;\n", Swig_cparm_name(0,0));
|
||||
Printf(freebody, "delete %s;\n", pname0);
|
||||
else
|
||||
Printf(freebody, "free((char*) %s);\n", Swig_cparm_name(0,0));
|
||||
Printf(freebody, "free((char*) %s);\n", pname0);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetFlag(n,"feature:trackobjects")) {
|
||||
Printf(freebody, " SWIG_RubyRemoveTracking(%s);\n", Swig_cparm_name(0,0));
|
||||
Printf(freebody, " SWIG_RubyRemoveTracking(%s);\n", pname0);
|
||||
}
|
||||
Printv(freebody, "}\n\n", NIL);
|
||||
|
||||
|
|
@ -2078,6 +2079,7 @@ public:
|
|||
current = NO_CPP;
|
||||
Delete(freefunc);
|
||||
Delete(freebody);
|
||||
Delete(pname0);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,6 +198,8 @@ int main(int margc, char **margv) {
|
|||
dl = (fac)();
|
||||
}
|
||||
}
|
||||
return SWIG_main(argc,argv,dl);
|
||||
int res = SWIG_main(argc,argv,dl);
|
||||
delete dl;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class TypePass : private Dispatcher {
|
|||
|
||||
if (first == cls) return; /* The Marcelo check */
|
||||
if (!cls) cls = first;
|
||||
|
||||
List *alist = 0;
|
||||
List *ilist = Getattr(cls,bases);
|
||||
if (!ilist) {
|
||||
List *nlist = Getattr(cls,baselist);
|
||||
|
|
@ -184,7 +184,7 @@ class TypePass : private Dispatcher {
|
|||
bcls = 0;
|
||||
} else {
|
||||
if (Getattr(bcls,"typepass:visit")) {
|
||||
if (!ilist) ilist = NewList();
|
||||
if (!ilist) ilist = alist = NewList();
|
||||
Append(ilist,bcls);
|
||||
} else {
|
||||
Swig_warning(WARN_TYPE_UNDEFINED_CLASS,Getfile(cls),Getline(cls),"Base class '%s' undefined.\n", bname);
|
||||
|
|
@ -214,6 +214,8 @@ class TypePass : private Dispatcher {
|
|||
Setattr(cls,bases,ilist);
|
||||
}
|
||||
}
|
||||
if (alist) Delete(alist);
|
||||
|
||||
if (!ilist) return;
|
||||
int len = Len(ilist);
|
||||
int i;
|
||||
|
|
@ -269,9 +271,8 @@ class TypePass : private Dispatcher {
|
|||
append_list(allbases,Getattr(cls,"privatebases"));
|
||||
if (Len(allbases)) {
|
||||
Setattr(cls,"allbases",allbases);
|
||||
} else {
|
||||
Delete(allbases);
|
||||
}
|
||||
Delete(allbases);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ static int imported_depth = 0; /* Depth of %imported files */
|
|||
static int single_include = 1; /* Only include each file once */
|
||||
static Hash *included_files = 0;
|
||||
static List *dependencies = 0;
|
||||
static SwigScanner *id_scan = 0;
|
||||
|
||||
/* Test a character to see if it starts an identifier */
|
||||
#define isidentifier(c) ((isalpha(c)) || (c == '_') || (c == '$'))
|
||||
|
|
@ -72,8 +73,7 @@ copy_location(const DOH *s1, DOH *s2) {
|
|||
}
|
||||
|
||||
static String *cpp_include(String_or_char *fn, int sysfile) {
|
||||
String *s;
|
||||
s = sysfile ? Swig_include_sys(fn) : Swig_include(fn);
|
||||
String *s = sysfile ? Swig_include_sys(fn) : Swig_include(fn);
|
||||
if (s && single_include) {
|
||||
String *file = Getfile(s);
|
||||
if (Getattr(included_files,file)) {
|
||||
|
|
@ -180,9 +180,58 @@ void Preprocessor_init(void) {
|
|||
cpp = NewHash();
|
||||
s = NewHash();
|
||||
Setattr(cpp,k_symbols,s);
|
||||
Delete(s);
|
||||
Preprocessor_expr_init(); /* Initialize the expression evaluator */
|
||||
included_files = NewHash();
|
||||
|
||||
id_scan = NewSwigScanner();;
|
||||
|
||||
}
|
||||
|
||||
void Preprocessor_delete(void) {
|
||||
Delete(k_args);
|
||||
Delete(k_define);
|
||||
Delete(k_defined);
|
||||
Delete(k_else);
|
||||
Delete(k_elif);
|
||||
Delete(k_endif);
|
||||
Delete(k_expanded);
|
||||
Delete(k_if);
|
||||
Delete(k_ifdef);
|
||||
Delete(k_ifndef);
|
||||
Delete(k_name);
|
||||
Delete(k_swigmacro);
|
||||
Delete(k_symbols);
|
||||
Delete(k_undef);
|
||||
Delete(k_value);
|
||||
Delete(k_error);
|
||||
Delete(k_warning);
|
||||
Delete(k_pragma);
|
||||
Delete(k_level);
|
||||
Delete(k_line);
|
||||
Delete(k_include);
|
||||
Delete(k_varargs);
|
||||
|
||||
Delete(k_dinclude);
|
||||
Delete(k_dimport);
|
||||
Delete(k_dextern);
|
||||
Delete(k_ddefine);
|
||||
Delete(k_dline);
|
||||
|
||||
|
||||
Delete(k_LINE);
|
||||
Delete(k_FILE);
|
||||
Delete(cpp);
|
||||
Delete(included_files);
|
||||
Preprocessor_expr_delete();
|
||||
DelSwigScanner(id_scan);
|
||||
|
||||
Delete(dependencies);
|
||||
|
||||
Delete(Swig_last_file());
|
||||
Delete(Swig_add_directory(0));
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void Preprocessor_include_all() - Instruct preprocessor to include all files
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
@ -418,7 +467,7 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
|||
|
||||
/* Go create the macro */
|
||||
macro = NewHash();
|
||||
Setattr(macro,k_name, macroname);
|
||||
Setattr(macro,k_name,macroname);
|
||||
|
||||
if (arglist) {
|
||||
Setattr(macro,k_args,arglist);
|
||||
|
|
@ -428,7 +477,6 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
|||
}
|
||||
}
|
||||
Setattr(macro,k_value,macrovalue);
|
||||
Delete(macrovalue);
|
||||
Setline(macro,line);
|
||||
Setfile(macro,file);
|
||||
if (swigmacro) {
|
||||
|
|
@ -441,9 +489,13 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
|||
Swig_error(Getfile(m1),Getline(m1),"previous definition of '%s'.\n",macroname);
|
||||
goto macro_error;
|
||||
}
|
||||
} else {
|
||||
Setattr(symbols,macroname,macro);
|
||||
Delete(macro);
|
||||
}
|
||||
Setattr(symbols,macroname,macro);
|
||||
|
||||
Delete(macroname);
|
||||
Delete(macrovalue);
|
||||
|
||||
Delete(str);
|
||||
Delete(argstr);
|
||||
|
|
@ -454,6 +506,7 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
|||
Delete(argstr);
|
||||
Delete(arglist);
|
||||
Delete(macroname);
|
||||
Delete(macrovalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1056,16 +1109,12 @@ Preprocessor_replace(DOH *s)
|
|||
static int
|
||||
check_id(DOH *s)
|
||||
{
|
||||
static SwigScanner *scan = 0;
|
||||
int c;
|
||||
int hastok = 0;
|
||||
SwigScanner *scan = id_scan;
|
||||
|
||||
Seek(s,0,SEEK_SET);
|
||||
|
||||
if (!scan) {
|
||||
scan = NewSwigScanner();
|
||||
}
|
||||
|
||||
SwigScanner_clear(scan);
|
||||
s = Copy(s);
|
||||
Seek(s,SEEK_SET,0);
|
||||
|
|
@ -1113,8 +1162,7 @@ static void add_chunk(DOH *ns, DOH *chunk, int allow) {
|
|||
static void
|
||||
push_imported() {
|
||||
if (imported_depth == 0) {
|
||||
DOH *m = Preprocessor_define("SWIGIMPORTED 1", 0);
|
||||
Delete(m);
|
||||
Preprocessor_define("SWIGIMPORTED 1", 0);
|
||||
}
|
||||
++imported_depth;
|
||||
}
|
||||
|
|
@ -1145,10 +1193,10 @@ String *
|
|||
Preprocessor_parse(String *s)
|
||||
{
|
||||
String *ns; /* New string containing the preprocessed text */
|
||||
String *chunk, *sval, *decl;
|
||||
String *chunk, *decl;
|
||||
Hash *symbols;
|
||||
String *id = 0, *value = 0, *comment = 0;
|
||||
int i, state, val, e, c;
|
||||
int i, state, e, c;
|
||||
int start_line = 0;
|
||||
int allow = 1;
|
||||
int level = 0;
|
||||
|
|
@ -1371,7 +1419,6 @@ Preprocessor_parse(String *s)
|
|||
}
|
||||
Delete(v);
|
||||
}
|
||||
Delete(m);
|
||||
}
|
||||
} else if (StringEqual(id,k_undef)) {
|
||||
if (allow) Preprocessor_undef(value);
|
||||
|
|
@ -1420,8 +1467,9 @@ Preprocessor_parse(String *s)
|
|||
cond_lines[level] = Getline(id);
|
||||
level++;
|
||||
if (allow) {
|
||||
int val;
|
||||
String *sval = Preprocessor_replace(value);
|
||||
start_level = level;
|
||||
sval = Preprocessor_replace(value);
|
||||
Seek(sval,0,SEEK_SET);
|
||||
/* Printf(stdout,"Evaluating '%s'\n", sval); */
|
||||
val = Preprocessor_expr(sval,&e);
|
||||
|
|
@ -1447,7 +1495,8 @@ Preprocessor_parse(String *s)
|
|||
allow = 0;
|
||||
mask = 0;
|
||||
} else if (level == start_level) {
|
||||
sval = Preprocessor_replace(value);
|
||||
int val;
|
||||
String *sval = Preprocessor_replace(value);
|
||||
Seek(sval,0,SEEK_SET);
|
||||
val = Preprocessor_expr(sval,&e);
|
||||
if (e) {
|
||||
|
|
@ -1689,7 +1738,7 @@ Preprocessor_parse(String *s)
|
|||
}
|
||||
if (allow) {
|
||||
Seek(value,0,SEEK_SET);
|
||||
Delete(Preprocessor_define(value,1));
|
||||
Preprocessor_define(value,1);
|
||||
}
|
||||
StringPutc('\n',ns);
|
||||
addline(ns,value,0);
|
||||
|
|
|
|||
|
|
@ -226,6 +226,13 @@ Preprocessor_expr_init (void) {
|
|||
if (!scan) scan = NewSwigScanner();
|
||||
}
|
||||
|
||||
void
|
||||
Preprocessor_expr_delete (void) {
|
||||
SwigScanner_clear(scan);
|
||||
DelSwigScanner(scan);
|
||||
}
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Tokenizer
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@ extern char *Preprocessor_expr_error(void);
|
|||
extern Hash *Preprocessor_define(const String_or_char *str, int swigmacro);
|
||||
extern void Preprocessor_undef(const String_or_char *name);
|
||||
extern void Preprocessor_init(void);
|
||||
extern void Preprocessor_delete(void);
|
||||
extern String *Preprocessor_parse(String *s);
|
||||
extern void Preprocessor_include_all(int);
|
||||
extern void Preprocessor_import_all(int);
|
||||
extern void Preprocessor_ignore_missing(int);
|
||||
extern List *Preprocessor_depend(void);
|
||||
extern void Preprocessor_expr_init(void);
|
||||
extern void Preprocessor_expr_delete(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ Swig_clocal(SwigType *t, const String_or_char *name, const String_or_char *value
|
|||
Delete(lstrn);
|
||||
} else {
|
||||
String *lstrname = SwigType_lstr(t,name);
|
||||
Printf(decl,"%s", lstrname);
|
||||
Append(decl,lstrname);
|
||||
Delete(lstrname);
|
||||
}
|
||||
}
|
||||
|
|
@ -156,34 +156,19 @@ Swig_wrapped_var_assign(SwigType *t, const String_or_char *name) {
|
|||
* argument behaviour is required.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
int Swig_cargs(Wrapper *w, ParmList *p) {
|
||||
int i;
|
||||
SwigType *pt;
|
||||
String *pvalue;
|
||||
String *pname;
|
||||
String *local;
|
||||
String *lname;
|
||||
SwigType *altty;
|
||||
String *type;
|
||||
int tycode;
|
||||
int compactdefargs = ParmList_is_compactdefargs(p);
|
||||
|
||||
i = 0;
|
||||
int i = 0;
|
||||
int compactdefargs = ParmList_is_compactdefargs(p);
|
||||
|
||||
while (p != 0) {
|
||||
lname = Swig_cparm_name(p,i);
|
||||
pt = Getattr(p,"type");
|
||||
String *lname = Swig_cparm_name(p,i);
|
||||
SwigType *pt = Getattr(p,"type");
|
||||
if ((SwigType_type(pt) != T_VOID)) {
|
||||
pname = Getattr(p,"name");
|
||||
|
||||
String *local = 0;
|
||||
String *type = Getattr(p,"type");
|
||||
/* default values only emitted if in compact default args mode */
|
||||
if (compactdefargs)
|
||||
pvalue = Getattr(p,"value");
|
||||
else
|
||||
pvalue = 0;
|
||||
|
||||
type = Getattr(p,"type");
|
||||
altty = SwigType_alttype(type,0);
|
||||
tycode = SwigType_type(type);
|
||||
String *pvalue = (compactdefargs) ? Getattr(p,"value") : 0;
|
||||
SwigType *altty = SwigType_alttype(type,0);
|
||||
int tycode = SwigType_type(type);
|
||||
if (tycode == T_REFERENCE) {
|
||||
if (pvalue) {
|
||||
SwigType *tvalue;
|
||||
|
|
@ -222,8 +207,10 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
|
|||
Delete(altty);
|
||||
}
|
||||
Wrapper_add_localv(w,lname,local,NIL);
|
||||
Delete(local);
|
||||
i++;
|
||||
}
|
||||
Delete(lname);
|
||||
p = nextSibling(p);
|
||||
}
|
||||
return(i);
|
||||
|
|
@ -272,13 +259,15 @@ String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_ch
|
|||
{
|
||||
char *c = Char(decl) + Len(decl) - 1;
|
||||
if (!((*c == ';') || (*c == '}')))
|
||||
Printf(fcall, ";");
|
||||
Append(fcall, ";");
|
||||
}
|
||||
Printf(fcall,"\n");
|
||||
Append(fcall,"\n");
|
||||
|
||||
if (SwigType_type(t) == T_REFERENCE) {
|
||||
Printf(fcall,"%s = (%s) &_result_ref;\n", name, SwigType_lstr(t,0));
|
||||
Printf(fcall,"}\n");
|
||||
String *lstr = SwigType_lstr(t,0);
|
||||
Printf(fcall,"%s = (%s) &_result_ref;\n", name, lstr);
|
||||
Append(fcall,"}\n");
|
||||
Delete(lstr);
|
||||
}
|
||||
return fcall;
|
||||
}
|
||||
|
|
@ -333,9 +322,9 @@ Swig_cfunction_call(String_or_char *name, ParmList *parms) {
|
|||
String *rcaststr = SwigType_rcaststr(rpt, pname);
|
||||
|
||||
if (comma) {
|
||||
Printf(func, ",%s", rcaststr);
|
||||
Printv(func, ",", rcaststr, NIL);
|
||||
} else {
|
||||
Printf(func, "%s", rcaststr);
|
||||
Append(func,rcaststr);
|
||||
}
|
||||
Delete(rpt);
|
||||
Delete(pname);
|
||||
|
|
@ -369,23 +358,28 @@ Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self) {
|
|||
SwigType *pt;
|
||||
int comma = 0;
|
||||
|
||||
if (!self) self = (char *) "(this)->";
|
||||
|
||||
func = NewStringEmpty();
|
||||
nname = SwigType_namestr(name);
|
||||
if (!p) return func;
|
||||
|
||||
if (!self) self = (char *) "(this)->";
|
||||
Append(func,self);
|
||||
|
||||
nname = SwigType_namestr(name);
|
||||
pt = Getattr(p,"type");
|
||||
|
||||
/* If the method is invoked through a dereferenced pointer, we don't add any casts
|
||||
(needed for smart pointers). Otherwise, we cast to the appropriate type */
|
||||
|
||||
if (Strstr(func,"*this")) {
|
||||
Replaceall(func,"this", Swig_cparm_name(p,0));
|
||||
String *pname = Swig_cparm_name(p,0);
|
||||
Replaceall(func,"this", pname);
|
||||
Delete(pname);
|
||||
} else {
|
||||
String *rcaststr = SwigType_rcaststr(pt, Swig_cparm_name(p,0));
|
||||
String *pname = Swig_cparm_name(p,0);
|
||||
String *rcaststr = SwigType_rcaststr(pt, pname);
|
||||
Replaceall(func,"this", rcaststr);
|
||||
Delete(rcaststr);
|
||||
Delete(pname);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -407,9 +401,10 @@ Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self) {
|
|||
if ((SwigType_type(pt) != T_VOID)) {
|
||||
String *pname = Swig_cparm_name(p,i);
|
||||
String *rcaststr = SwigType_rcaststr(pt, pname);
|
||||
if (comma) Printf(func,",");
|
||||
Printf(func,"%s", rcaststr);
|
||||
if (comma) Append(func,",");
|
||||
Append(func,rcaststr);
|
||||
Delete(rcaststr);
|
||||
Delete(pname);
|
||||
comma = 1;
|
||||
i++;
|
||||
}
|
||||
|
|
@ -464,10 +459,11 @@ Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int skip_se
|
|||
func = NewStringEmpty();
|
||||
Printf(func,"new %s(", nname);
|
||||
while (p) {
|
||||
String *pname;
|
||||
pt = Getattr(p,"type");
|
||||
if ((SwigType_type(pt) != T_VOID)) {
|
||||
if (comma) Printf(func,",");
|
||||
String *rcaststr = 0;
|
||||
String *pname = 0;
|
||||
if (comma) Append(func,",");
|
||||
if (!Getattr(p, "arg:byname")) {
|
||||
pname = Swig_cparm_name(p,i);
|
||||
i++;
|
||||
|
|
@ -477,12 +473,15 @@ Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int skip_se
|
|||
else
|
||||
pname = Copy(Getattr(p, "name"));
|
||||
}
|
||||
Printf(func,"%s", SwigType_rcaststr(pt, pname));
|
||||
comma = 1;
|
||||
rcaststr = SwigType_rcaststr(pt, pname);
|
||||
Append(func,rcaststr);
|
||||
Delete(rcaststr);
|
||||
comma = 1;
|
||||
Delete(pname);
|
||||
}
|
||||
p = nextSibling(p);
|
||||
}
|
||||
Printf(func,")");
|
||||
Append(func,")");
|
||||
Delete(nname);
|
||||
return func;
|
||||
}
|
||||
|
|
@ -567,9 +566,11 @@ Swig_unref_call(Node *n) {
|
|||
Node *cn = Swig_methodclass(n);
|
||||
String* unref = Swig_rflag_search(cn,"feature:unref","feature:nounref");
|
||||
if (unref) {
|
||||
String *pname = Swig_cparm_name(0,0);
|
||||
unref = NewString(unref);
|
||||
Replaceall(unref,"$this",Swig_cparm_name(0,0));
|
||||
Replaceall(unref,"$self",Swig_cparm_name(0,0));
|
||||
Replaceall(unref,"$this",pname);
|
||||
Replaceall(unref,"$self",pname);
|
||||
Delete(pname);
|
||||
}
|
||||
return unref;
|
||||
}
|
||||
|
|
@ -603,9 +604,15 @@ Swig_ref_call(Node *n, const String* lname) {
|
|||
String *
|
||||
Swig_cdestructor_call(Node *n) {
|
||||
String* unref = Swig_unref_call(n);
|
||||
if (unref) return unref;
|
||||
|
||||
return NewStringf("free((char *) %s);",Swig_cparm_name(0,0));
|
||||
if (unref) {
|
||||
return unref;
|
||||
} else {
|
||||
String *pname = Swig_cparm_name(0,0);
|
||||
String *call = NewStringf("free((char *) %s);",pname);
|
||||
Delete(pname);
|
||||
return call;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -620,9 +627,14 @@ Swig_cdestructor_call(Node *n) {
|
|||
String *
|
||||
Swig_cppdestructor_call(Node *n) {
|
||||
String* unref = Swig_unref_call(n);
|
||||
if (unref) return unref;
|
||||
|
||||
return NewStringf("delete %s;",Swig_cparm_name(0,0));
|
||||
if (unref) {
|
||||
return unref;
|
||||
} else {
|
||||
String *pname = Swig_cparm_name(0,0);
|
||||
String *call = NewStringf("delete %s;",pname);
|
||||
Delete(pname);
|
||||
return call;
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -637,20 +649,25 @@ Swig_cppdestructor_call(Node *n) {
|
|||
String *
|
||||
Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_char *self) {
|
||||
String *func;
|
||||
String *pname0 = Swig_cparm_name(0,0);
|
||||
String *pname1 = Swig_cparm_name(0,1);
|
||||
func = NewStringEmpty();
|
||||
if (!self) self = NewString("(this)->");
|
||||
else self = NewString(self);
|
||||
Replaceall(self,"this",Swig_cparm_name(0,0));
|
||||
Replaceall(self,"this",pname0);
|
||||
if (SwigType_type(type) != T_ARRAY) {
|
||||
if (!Strstr(type,"enum $unnamed")) {
|
||||
Printf(func,"if (%s) %s%s = %s",Swig_cparm_name(0,0), self,name,
|
||||
Swig_wrapped_var_deref(type, Swig_cparm_name(0,1)));
|
||||
String *dref = Swig_wrapped_var_deref(type, pname1);
|
||||
Printf(func,"if (%s) %s%s = %s",pname0, self,name,dref);
|
||||
Delete(dref);
|
||||
} else {
|
||||
Printf(func,"if (%s && sizeof(int) == sizeof(%s%s)) *(int*)(void*)&(%s%s) = %s",
|
||||
Swig_cparm_name(0,0), self, name, self, name, Swig_cparm_name(0,1));
|
||||
pname0, self, name, self, name, pname1);
|
||||
}
|
||||
}
|
||||
Delete(self);
|
||||
Delete(pname0);
|
||||
Delete(pname1);
|
||||
return(func);
|
||||
}
|
||||
|
||||
|
|
@ -668,12 +685,17 @@ String *
|
|||
Swig_cmemberget_call(const String_or_char *name, SwigType *t,
|
||||
String_or_char *self) {
|
||||
String *func;
|
||||
String *call;
|
||||
String *pname0 = Swig_cparm_name(0,0);
|
||||
if (!self) self = NewString("(this)->");
|
||||
else self = NewString(self);
|
||||
Replaceall(self,"this",Swig_cparm_name(0,0));
|
||||
Replaceall(self,"this",pname0);
|
||||
func = NewStringEmpty();
|
||||
Printf(func,"%s (%s%s)", Swig_wrapped_var_assign(t,""),self, name);
|
||||
call = Swig_wrapped_var_assign(t,"");
|
||||
Printf(func,"%s (%s%s)", call,self, name);
|
||||
Delete(self);
|
||||
Delete(call);
|
||||
Delete(pname0);
|
||||
return func;
|
||||
}
|
||||
|
||||
|
|
@ -783,10 +805,10 @@ Swig_MethodToFunction(Node *n, String *classname, int flags) {
|
|||
/* Generate action code for the access */
|
||||
if (!(flags & CWRAP_EXTEND)) {
|
||||
String *call = Swig_cmethod_call(name,p,self);
|
||||
String *result = Swig_cresult(Getattr(n,"type"),"result", call);
|
||||
Setattr(n,"wrap:action", result);
|
||||
String *cres = Swig_cresult(Getattr(n,"type"),"result", call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(result);
|
||||
Delete(cres);
|
||||
} else {
|
||||
/* Methods with default arguments are wrapped with additional methods for each default argument,
|
||||
* however, only one extra %extend method is generated. */
|
||||
|
|
@ -816,10 +838,14 @@ Swig_MethodToFunction(Node *n, String *classname, int flags) {
|
|||
int i = 0;
|
||||
Parm *pp = p;
|
||||
String *func = NewStringf("%s(", mangled);
|
||||
String *cres;
|
||||
|
||||
if (Cmp(Getattr(n,"storage"),"static") != 0) {
|
||||
String *fadd = NewStringf("(%s*)(%s)->operator ->()", cname, Swig_cparm_name(pp,i));
|
||||
String *pname = Swig_cparm_name(pp,i);
|
||||
String *fadd = NewStringf("(%s*)(%s)->operator ->()", cname, pname);
|
||||
Append(func,fadd);
|
||||
Delete(fadd);
|
||||
Delete(pname);
|
||||
pp = nextSibling(pp);
|
||||
if (pp) Append(func,",");
|
||||
} else{
|
||||
|
|
@ -839,9 +865,15 @@ Swig_MethodToFunction(Node *n, String *classname, int flags) {
|
|||
}
|
||||
}
|
||||
Append(func,")");
|
||||
Setattr(n,"wrap:action", Swig_cresult(Getattr(n,"type"),"result", func));
|
||||
cres = Swig_cresult(Getattr(n,"type"),"result", func);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(cres);
|
||||
} else {
|
||||
Setattr(n,"wrap:action", Swig_cresult(Getattr(n,"type"),"result", Swig_cfunction_call(mangled,p)));
|
||||
String *call = Swig_cfunction_call(mangled,p);
|
||||
String *cres = Swig_cresult(Getattr(n,"type"),"result", call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
}
|
||||
|
||||
Delete(membername);
|
||||
|
|
@ -962,7 +994,8 @@ Swig_ConstructorToFunction(Node *n, String *classname,
|
|||
if (flags & CWRAP_EXTEND) {
|
||||
/* Constructors with default arguments are wrapped with additional constructor methods for each default argument,
|
||||
* however, only one extra %extend method is generated. */
|
||||
|
||||
String *call;
|
||||
String *cres;
|
||||
String *defaultargs = Getattr(n,"defaultargs");
|
||||
String *code = Getattr(n,"code");
|
||||
String *membername = Swig_name_construct(classname);
|
||||
|
|
@ -979,9 +1012,12 @@ Swig_ConstructorToFunction(Node *n, String *classname,
|
|||
if (!defaultargs && code) {
|
||||
Swig_add_extension_code(n, mangled, parms, type, code, cparse_cplusplus);
|
||||
}
|
||||
|
||||
Setattr(n,"wrap:action", Swig_cresult(type,"result", Swig_cfunction_call(mangled,parms)));
|
||||
|
||||
|
||||
call = Swig_cfunction_call(mangled,parms);
|
||||
cres = Swig_cresult(type,"result", call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(cres);
|
||||
Delete(call);
|
||||
Delete(membername);
|
||||
Delete(mangled);
|
||||
} else {
|
||||
|
|
@ -1009,7 +1045,9 @@ Swig_ConstructorToFunction(Node *n, String *classname,
|
|||
* implemented in the target language, calls to those methods will
|
||||
* generate Swig::DirectorPureVirtualException exceptions.
|
||||
*/
|
||||
Append(action, Swig_cresult(type, "result", director_call));
|
||||
String *cres = Swig_cresult(type, "result", director_call);
|
||||
Append(action, cres);
|
||||
Delete(cres);
|
||||
} else {
|
||||
/* (scottm): The code for creating a new director is now a string
|
||||
template that gets passed in via the director_ctor argument.
|
||||
|
|
@ -1018,22 +1056,35 @@ Swig_ConstructorToFunction(Node *n, String *classname,
|
|||
$director_new: Call new for director class
|
||||
$nondirector_new: Call new for non-director class
|
||||
*/
|
||||
String *cres;
|
||||
Append(action, director_ctor);
|
||||
Replaceall( action, "$comparison", tmp_none_comparison);
|
||||
Replaceall( action, "$director_new",
|
||||
Swig_cresult(type, "result", director_call) );
|
||||
Replaceall( action, "$nondirector_new",
|
||||
Swig_cresult(type, "result", nodirector_call) );
|
||||
|
||||
cres = Swig_cresult(type, "result", director_call);
|
||||
Replaceall( action, "$director_new",cres);
|
||||
Delete(cres);
|
||||
|
||||
cres = Swig_cresult(type, "result", nodirector_call);
|
||||
Replaceall( action, "$nondirector_new", cres);
|
||||
Delete(cres);
|
||||
}
|
||||
Setattr(n, "wrap:action", action);
|
||||
Delete(tmp_none_comparison);
|
||||
Delete(action);
|
||||
Delete(directorname);
|
||||
} else {
|
||||
Setattr(n,"wrap:action", Swig_cresult(type,"result", Swig_cppconstructor_call(classname,parms)));
|
||||
String *call = Swig_cppconstructor_call(classname,parms);
|
||||
String *cres = Swig_cresult(type,"result", call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(cres);
|
||||
Delete(call);
|
||||
}
|
||||
} else {
|
||||
Setattr(n,"wrap:action", Swig_cresult(type,"result", Swig_cconstructor_call(classname)));
|
||||
String *call = Swig_cconstructor_call(classname);
|
||||
String *cres = Swig_cresult(type,"result", call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(cres);
|
||||
Delete(call);
|
||||
}
|
||||
}
|
||||
Setattr(n,"type",type);
|
||||
|
|
@ -1065,6 +1116,8 @@ Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
|
|||
type = NewString("void");
|
||||
|
||||
if (flags & CWRAP_EXTEND) {
|
||||
String *cres;
|
||||
String *call;
|
||||
String *membername, *mangled, *code;
|
||||
membername = Swig_name_destroy(classname);
|
||||
mangled = Swig_name_mangle(membername);
|
||||
|
|
@ -1072,14 +1125,26 @@ Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
|
|||
if (code) {
|
||||
Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus);
|
||||
}
|
||||
Setattr(n,"wrap:action", NewStringf("%s;\n", Swig_cfunction_call(mangled,p)));
|
||||
call = Swig_cfunction_call(mangled,p);
|
||||
cres = NewStringf("%s;\n", call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(membername);
|
||||
Delete(mangled);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
} else {
|
||||
if (cplus) {
|
||||
Setattr(n,"wrap:action", NewStringf("%s\n",Swig_cppdestructor_call(n)));
|
||||
String *call = Swig_cppdestructor_call(n);
|
||||
String *cres = NewStringf("%s\n",call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
} else {
|
||||
Setattr(n,"wrap:action", NewStringf("%s\n", Swig_cdestructor_call(n)));
|
||||
String *call = Swig_cdestructor_call(n);
|
||||
String *cres = NewStringf("%s\n", call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
}
|
||||
}
|
||||
Setattr(n,"type",type);
|
||||
|
|
@ -1107,6 +1172,8 @@ Swig_MembersetToFunction(Node *n, String *classname, int flags) {
|
|||
String *membername;
|
||||
String *mangled;
|
||||
String *self= 0;
|
||||
String *sname;
|
||||
|
||||
varref = flags & CWRAP_VAR_REFERENCE;
|
||||
|
||||
if (flags & CWRAP_SMART_POINTER) {
|
||||
|
|
@ -1116,7 +1183,8 @@ Swig_MembersetToFunction(Node *n, String *classname, int flags) {
|
|||
name = Getattr(n,"name");
|
||||
type = Getattr(n,"type");
|
||||
|
||||
membername = Swig_name_member(classname, Swig_name_set(name));
|
||||
sname = Swig_name_set(name);
|
||||
membername = Swig_name_member(classname, sname);
|
||||
mangled = Swig_name_mangle(membername);
|
||||
|
||||
t = NewString(classname);
|
||||
|
|
@ -1135,13 +1203,23 @@ Swig_MembersetToFunction(Node *n, String *classname, int flags) {
|
|||
Delete(p);
|
||||
|
||||
if (flags & CWRAP_EXTEND) {
|
||||
String *call;
|
||||
String *cres;
|
||||
String *code = Getattr(n,"code");
|
||||
if (code) {
|
||||
Swig_add_extension_code(n, mangled, parms, void_type, code, cparse_cplusplus);
|
||||
}
|
||||
Setattr(n,"wrap:action", NewStringf("%s;\n", Swig_cfunction_call(mangled,parms)));
|
||||
call = Swig_cfunction_call(mangled,parms);
|
||||
cres = NewStringf("%s;\n", call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
} else {
|
||||
Setattr(n,"wrap:action", NewStringf("%s;\n", Swig_cmemberset_call(name,type,self)));
|
||||
String *call = Swig_cmemberset_call(name,type,self);
|
||||
String *cres = NewStringf("%s;\n", call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
}
|
||||
Setattr(n,"type",void_type);
|
||||
Setattr(n,"parms", parms);
|
||||
|
|
@ -1149,6 +1227,7 @@ Swig_MembersetToFunction(Node *n, String *classname, int flags) {
|
|||
Delete(ty);
|
||||
Delete(void_type);
|
||||
Delete(membername);
|
||||
Delete(sname);
|
||||
Delete(mangled);
|
||||
Delete(self);
|
||||
varref = 0;
|
||||
|
|
@ -1171,6 +1250,7 @@ Swig_MembergetToFunction(Node *n, String *classname, int flags) {
|
|||
String *membername;
|
||||
String *mangled;
|
||||
String *self = 0;
|
||||
String *gname;
|
||||
varref = flags & CWRAP_VAR_REFERENCE;
|
||||
|
||||
if (flags & CWRAP_SMART_POINTER) {
|
||||
|
|
@ -1185,8 +1265,9 @@ Swig_MembergetToFunction(Node *n, String *classname, int flags) {
|
|||
|
||||
name = Getattr(n,"name");
|
||||
type = Getattr(n,"type");
|
||||
|
||||
membername = Swig_name_member(classname, Swig_name_get(name));
|
||||
|
||||
gname = Swig_name_get(name);
|
||||
membername = Swig_name_member(classname, gname);
|
||||
mangled = Swig_name_mangle(membername);
|
||||
|
||||
t = NewString(classname);
|
||||
|
|
@ -1196,19 +1277,31 @@ Swig_MembergetToFunction(Node *n, String *classname, int flags) {
|
|||
|
||||
ty = Swig_wrapped_var_type(type);
|
||||
if (flags & CWRAP_EXTEND) {
|
||||
String *call;
|
||||
String *cres;
|
||||
|
||||
String *code = Getattr(n,"code");
|
||||
if (code) {
|
||||
Swig_add_extension_code(n, mangled, parms, ty, code, cparse_cplusplus);
|
||||
}
|
||||
Setattr(n,"wrap:action", Swig_cresult(ty,"result",Swig_cfunction_call(mangled,parms)));
|
||||
call = Swig_cfunction_call(mangled,parms);
|
||||
cres = Swig_cresult(ty,"result",call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(cres);
|
||||
Delete(call);
|
||||
} else {
|
||||
Setattr(n,"wrap:action", Swig_cresult(ty,"result",Swig_cmemberget_call(name,type,self)));
|
||||
String *call = Swig_cmemberget_call(name,type,self);
|
||||
String *cres = Swig_cresult(ty,"result",call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
}
|
||||
Setattr(n,"type",ty);
|
||||
Setattr(n,"parms", parms);
|
||||
Delete(parms);
|
||||
Delete(ty);
|
||||
Delete(membername);
|
||||
Delete(gname);
|
||||
Delete(mangled);
|
||||
varref = 0;
|
||||
return SWIG_OK;
|
||||
|
|
@ -1236,9 +1329,18 @@ Swig_VarsetToFunction(Node *n) {
|
|||
Delete(ty);
|
||||
|
||||
if (!Strstr(type,"enum $unnamed")) {
|
||||
Setattr(n,"wrap:action", NewStringf("%s = %s;\n", nname, Swig_wrapped_var_deref(type,Swig_cparm_name(0,0))));
|
||||
String *pname = Swig_cparm_name(0,0);
|
||||
String *dref = Swig_wrapped_var_deref(type,pname);
|
||||
String *call = NewStringf("%s = %s;\n", nname, dref);
|
||||
Setattr(n,"wrap:action", call);
|
||||
Delete(call);
|
||||
Delete(dref);
|
||||
Delete(pname);
|
||||
} else {
|
||||
Setattr(n,"wrap:action", NewStringf("if (sizeof(int) == sizeof(%s)) *(int*)(void*)&(%s) = %s;\n", nname, nname, Swig_cparm_name(0,0)));
|
||||
String *pname = Swig_cparm_name(0,0);
|
||||
String *call = NewStringf("if (sizeof(int) == sizeof(%s)) *(int*)(void*)&(%s) = %s;\n", nname, nname, pname);
|
||||
Setattr(n,"wrap:action", call);
|
||||
Delete(call);
|
||||
}
|
||||
Setattr(n,"type","void");
|
||||
Setattr(n,"parms",parms);
|
||||
|
|
@ -1255,6 +1357,7 @@ Swig_VarsetToFunction(Node *n) {
|
|||
|
||||
int
|
||||
Swig_VargetToFunction(Node *n) {
|
||||
String *cres, *call;
|
||||
String *name, *nname;
|
||||
SwigType *type, *ty;
|
||||
|
||||
|
|
@ -1263,8 +1366,11 @@ Swig_VargetToFunction(Node *n) {
|
|||
|
||||
nname = SwigType_namestr(name);
|
||||
ty = Swig_wrapped_var_type(type);
|
||||
|
||||
Setattr(n,"wrap:action", Swig_cresult(ty,"result",Swig_wrapped_var_assign(type,nname)));
|
||||
call = Swig_wrapped_var_assign(type,nname);
|
||||
cres = Swig_cresult(ty,"result",call);
|
||||
Setattr(n,"wrap:action", cres);
|
||||
Delete(cres);
|
||||
Delete(call);
|
||||
Setattr(n,"type",ty);
|
||||
Delattr(n,"parms");
|
||||
Delete(nname);
|
||||
|
|
|
|||
|
|
@ -68,15 +68,19 @@ Swig_swiglib_get() {
|
|||
* Adds a directory to the SWIG search path.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
List *
|
||||
Swig_add_directory(const String_or_char *dirname) {
|
||||
String *dir = 0;
|
||||
if (!directories) directories = NewList();
|
||||
assert(directories);
|
||||
dir = NewString((char *) dirname);
|
||||
assert(dir);
|
||||
Setattr(dir,"sysdir","1");
|
||||
Append(directories, dir);
|
||||
if (dirname) {
|
||||
dir = NewString((char *) dirname);
|
||||
assert(dir);
|
||||
Setattr(dir,"sysdir","1");
|
||||
Append(directories, dir);
|
||||
Delete(dir);
|
||||
}
|
||||
return directories;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -537,10 +537,13 @@ Swig_name_object_inherit(Hash *namehash, String *base, String *derived) {
|
|||
if (!newh) {
|
||||
newh = NewHash();
|
||||
Setattr(namehash,nkey,newh);
|
||||
Delete(newh);
|
||||
}
|
||||
for (oi = First(n); oi.key; oi = Next(oi)) {
|
||||
if (!Getattr(newh,oi.key)) {
|
||||
Setattr(newh,oi.key,Copy(oi.item));
|
||||
String *ci = Copy(oi.item);
|
||||
Setattr(newh,oi.key,ci);
|
||||
Delete(ci);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -700,8 +703,10 @@ Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl, con
|
|||
} else {
|
||||
fhash = Getattr(n,decl);
|
||||
if (!fhash) {
|
||||
String *cdecl = Copy(decl);
|
||||
fhash = NewHash();
|
||||
Setattr(n,Copy(decl),fhash);
|
||||
Setattr(n,cdecl,fhash);
|
||||
Delete(cdecl);
|
||||
Delete(fhash);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ void SwigType_add_default(String *def, SwigType *nr)
|
|||
|
||||
|
||||
SwigType *SwigType_default(SwigType *t) {
|
||||
String *r1, *def;
|
||||
String *r1, *def, *cdef;
|
||||
String *r = 0;
|
||||
char *cr;
|
||||
|
||||
|
|
@ -440,10 +440,10 @@ SwigType *SwigType_default(SwigType *t) {
|
|||
#ifdef SWIG_NEW_TYPE_DEFAULT
|
||||
SwigType_del_array(nr);
|
||||
SwigType_add_default(def, nr);
|
||||
Delete(nr);
|
||||
#else
|
||||
Append(def,"SWIGTYPE");
|
||||
#endif
|
||||
Delete(nr);
|
||||
}
|
||||
} else if (SwigType_ismemberpointer(r)) {
|
||||
if (strcmp(cr,"m(CLASS).SWIGTYPE") == 0) {
|
||||
|
|
@ -469,7 +469,9 @@ SwigType *SwigType_default(SwigType *t) {
|
|||
if (r != t) Delete(r);
|
||||
#ifdef SWIG_DEFAULT_CACHE
|
||||
/* The cache produces strange results, see enum_template.i case */
|
||||
Setattr(default_cache,t,Copy(def));
|
||||
cdef = Copy(def);
|
||||
Setattr(default_cache,t, cdef);
|
||||
Delete(cdef);
|
||||
#endif
|
||||
if (StringEqual(def,t)) {
|
||||
Delete(def);
|
||||
|
|
@ -1055,6 +1057,7 @@ SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
|
|||
}
|
||||
Clear(t);
|
||||
Append(t,nt);
|
||||
Delete(nt);
|
||||
Delete(elem);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ typedef DOH SwigType;
|
|||
|
||||
/* --- File interface --- */
|
||||
|
||||
extern void Swig_add_directory(const String_or_char *dirname);
|
||||
extern List *Swig_add_directory(const String_or_char *dirname);
|
||||
extern void Swig_push_directory(const String_or_char *dirname);
|
||||
extern void Swig_pop_directory();
|
||||
extern String *Swig_last_file();
|
||||
|
|
|
|||
|
|
@ -277,11 +277,14 @@ Swig_symbol_init() {
|
|||
ccurrent = NewHash();
|
||||
set_nodeType(current_symtab,k_symboltable);
|
||||
Setattr(current_symtab,k_symtab,current);
|
||||
Delete(current);
|
||||
Setattr(current_symtab,k_csymtab, ccurrent);
|
||||
Delete(ccurrent);
|
||||
|
||||
/* Set the global scope */
|
||||
symtabs = NewHash();
|
||||
Setattr(symtabs,empty_string,current_symtab);
|
||||
Delete(current_symtab);
|
||||
global_scope = current_symtab;
|
||||
}
|
||||
|
||||
|
|
@ -378,6 +381,7 @@ Swig_symbol_newscope()
|
|||
|
||||
set_nodeType(h,k_symboltable);
|
||||
Setattr(h,k_symtab,hsyms);
|
||||
Delete(hsyms);
|
||||
set_parentNode(h,current_symtab);
|
||||
|
||||
n = lastChild(current_symtab);
|
||||
|
|
@ -390,8 +394,9 @@ Swig_symbol_newscope()
|
|||
current = hsyms;
|
||||
ccurrent = NewHash();
|
||||
Setattr(h,k_csymtab,ccurrent);
|
||||
Delete(ccurrent);
|
||||
current_symtab = h;
|
||||
return current_symtab;
|
||||
return h;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -473,6 +478,7 @@ void Swig_symbol_inherit(Symtab *s) {
|
|||
if (!inherit) {
|
||||
inherit = NewList();
|
||||
Setattr(current_symtab,k_inherit, inherit);
|
||||
Delete(inherit);
|
||||
}
|
||||
assert(s != current_symtab);
|
||||
for (i = 0; i < Len(inherit); i++) {
|
||||
|
|
|
|||
|
|
@ -1101,7 +1101,7 @@ static void typemap_locals(DOHString *s, ParmList *l, Wrapper *f, int argnum) {
|
|||
|
||||
str = NewStringEmpty();
|
||||
|
||||
if (Strncmp(pn,"_global_",8) == 0) {
|
||||
if (strncmp(Char(pn),"_global_",8) == 0) {
|
||||
isglobal = 1;
|
||||
}
|
||||
|
||||
|
|
@ -1159,7 +1159,10 @@ String *Swig_typemap_lookup(const String_or_char *op, SwigType *type, String_or_
|
|||
if (!s) return 0;
|
||||
|
||||
/* Blocked */
|
||||
if (Cmp(s,"pass") == 0) return 0;
|
||||
if (Cmp(s,"pass") == 0) {
|
||||
Delete(mtype);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s = Copy(s); /* Make a local copy of the typemap code */
|
||||
|
||||
|
|
@ -1345,6 +1348,7 @@ Printf(stdout, "Swig_typemap_lookup %s [%s %s]\n", op, type, pname ? pname : "NO
|
|||
}
|
||||
sprintf(temp,"%s:%s",Char(op),Char(Getattr(kw,k_name)));
|
||||
Setattr(node,tmop_name(temp), value);
|
||||
Delete(value);
|
||||
kw = nextSibling(kw);
|
||||
}
|
||||
|
||||
|
|
@ -1400,13 +1404,15 @@ Swig_typemap_attach_kwargs(Hash *tm, const String_or_char *op, Parm *p) {
|
|||
String *type = Getattr(kw,k_type);
|
||||
if (type) {
|
||||
Hash *v = NewHash();
|
||||
Setattr(v,k_value,value);
|
||||
Setattr(v,k_type,type);
|
||||
Setattr(v,k_value,value);
|
||||
Delete(value);
|
||||
value = v;
|
||||
}
|
||||
Clear(temp);
|
||||
Printf(temp,"%s:%s",op,Getattr(kw,k_name));
|
||||
Setattr(p,tmop_name(temp),value);
|
||||
Delete(value);
|
||||
kw = nextSibling(kw);
|
||||
}
|
||||
Delete(temp);
|
||||
|
|
|
|||
|
|
@ -794,7 +794,7 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
|
|||
String *key = NewString(t);
|
||||
if (r) {
|
||||
SwigType *r1;
|
||||
Setattr(typedef_resolve_cache,key,r);
|
||||
Setattr(typedef_resolve_cache,key,r);
|
||||
Setmeta(r,k_scope,resolved_scope);
|
||||
r1 = Copy(r);
|
||||
Delete(r);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue