fix %features/%rename + def args
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6657 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
2b71e5fe23
commit
44009421a8
2 changed files with 40 additions and 5 deletions
|
|
@ -128,3 +128,21 @@ namespace std {
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%template(VectorInt) std::Vector<int>;
|
%template(VectorInt) std::Vector<int>;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%ignore TROOT::TROOT(const char *name, const char *title, void *initfunc = 0);
|
||||||
|
%inline %{
|
||||||
|
class TROOT {
|
||||||
|
|
||||||
|
public:
|
||||||
|
TROOT()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TROOT(const char *name, const char *title, void *initfunc = 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ Hash *Swig_cparse_features() {
|
||||||
if (!features_hash) features_hash = NewHash();
|
if (!features_hash) features_hash = NewHash();
|
||||||
return features_hash;
|
return features_hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String *feature_identifier_fix(String *s) {
|
static String *feature_identifier_fix(String *s) {
|
||||||
if (SwigType_istemplate(s)) {
|
if (SwigType_istemplate(s)) {
|
||||||
String *tp, *ts, *ta, *tq;
|
String *tp, *ts, *ta, *tq;
|
||||||
|
|
@ -1054,6 +1054,10 @@ static int is_cfunction(Node *n) {
|
||||||
* The additional functions form a linked list of nodes with the head being the original Node n. */
|
* The additional functions form a linked list of nodes with the head being the original Node n. */
|
||||||
static void default_arguments(Node *n) {
|
static void default_arguments(Node *n) {
|
||||||
Node *function = n;
|
Node *function = n;
|
||||||
|
String *fname = 0;
|
||||||
|
String *oname = 0;
|
||||||
|
SwigType *fdecl = 0;
|
||||||
|
int ignore = 0;
|
||||||
|
|
||||||
/* Do not add in functions if kwargs is being used or if user wants old default argument wrapping
|
/* Do not add in functions if kwargs is being used or if user wants old default argument wrapping
|
||||||
(one wrapped method per function irrespective of number of default arguments) */
|
(one wrapped method per function irrespective of number of default arguments) */
|
||||||
|
|
@ -1069,6 +1073,16 @@ static void default_arguments(Node *n) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (function) {
|
||||||
|
fdecl = Getattr(function,"decl");
|
||||||
|
/* try to see if we need to ignore this method */
|
||||||
|
fname = Getattr(function,"name");
|
||||||
|
oname = make_name(fname,fdecl);
|
||||||
|
if (strncmp(Char(oname),"$ignore",7) == 0) {
|
||||||
|
ignore = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (function) {
|
while (function) {
|
||||||
/* Look for parameters with default arguments */
|
/* Look for parameters with default arguments */
|
||||||
ParmList *p = Getattr(function,"parms");
|
ParmList *p = Getattr(function,"parms");
|
||||||
|
|
@ -1105,7 +1119,7 @@ static void default_arguments(Node *n) {
|
||||||
/* Create new function and add to symbol table */
|
/* Create new function and add to symbol table */
|
||||||
{
|
{
|
||||||
Node *new_function = new_node(Copy(nodeType(function)));
|
Node *new_function = new_node(Copy(nodeType(function)));
|
||||||
SwigType *decl = Copy(Getattr(function,"decl"));
|
SwigType *decl = Copy(fdecl);
|
||||||
int constqualifier = SwigType_isconst(decl);
|
int constqualifier = SwigType_isconst(decl);
|
||||||
|
|
||||||
Delete(SwigType_pop_function(decl)); /* remove the old parameter list from decl */
|
Delete(SwigType_pop_function(decl)); /* remove the old parameter list from decl */
|
||||||
|
|
@ -1113,7 +1127,7 @@ static void default_arguments(Node *n) {
|
||||||
if (constqualifier)
|
if (constqualifier)
|
||||||
SwigType_add_qualifier(decl,"const");
|
SwigType_add_qualifier(decl,"const");
|
||||||
|
|
||||||
Setattr(new_function,"name",Copy(Getattr(function,"name")));
|
Setattr(new_function,"name",fname);
|
||||||
Setattr(new_function,"code",Copy(Getattr(function,"code")));
|
Setattr(new_function,"code",Copy(Getattr(function,"code")));
|
||||||
Setattr(new_function,"decl", decl);
|
Setattr(new_function,"decl", decl);
|
||||||
Setattr(new_function,"parms",newparms);
|
Setattr(new_function,"parms",newparms);
|
||||||
|
|
@ -1135,9 +1149,12 @@ static void default_arguments(Node *n) {
|
||||||
if (symtypename) Setattr(new_function,"sym:typename",Copy(symtypename));
|
if (symtypename) Setattr(new_function,"sym:typename",Copy(symtypename));
|
||||||
if (templateparms) Setattr(new_function,"templateparms",CopyParmList(templateparms));
|
if (templateparms) Setattr(new_function,"templateparms",CopyParmList(templateparms));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* apply the original function features */
|
||||||
|
Swig_features_get(Swig_cparse_features(),Namespaceprefix,fname,fdecl,new_function);
|
||||||
|
if (ignore) Setattr(new_function,"feature:ignore","1");
|
||||||
|
|
||||||
add_symbols(new_function);
|
add_symbols(new_function);
|
||||||
|
|
||||||
/* mark added functions as ones with overloaded parameters and point to the parsed method */
|
/* mark added functions as ones with overloaded parameters and point to the parsed method */
|
||||||
Setattr(new_function,"defaultargs", n);
|
Setattr(new_function,"defaultargs", n);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue