- compact default arguments feature (original default argument wrapping mode)
- fix for templated functions in a namespace git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6448 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b1481bfddc
commit
a889c59f3b
1 changed files with 32 additions and 9 deletions
|
|
@ -52,6 +52,7 @@ static int inherit_list = 0;
|
||||||
static Parm *template_parameters = 0;
|
static Parm *template_parameters = 0;
|
||||||
static int extendmode = 0;
|
static int extendmode = 0;
|
||||||
static int dirprot_mode = 0;
|
static int dirprot_mode = 0;
|
||||||
|
static int compact_default_args = 0;
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* Assist Functions
|
* Assist Functions
|
||||||
|
|
@ -150,7 +151,7 @@ static Node *copy_node(Node *n) {
|
||||||
* Variables
|
* Variables
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
char *typemap_lang = 0; /* Current language setting */
|
static char *typemap_lang = 0; /* Current language setting */
|
||||||
|
|
||||||
static int cplus_mode = 0;
|
static int cplus_mode = 0;
|
||||||
static String *class_rename = 0;
|
static String *class_rename = 0;
|
||||||
|
|
@ -165,6 +166,10 @@ void SWIG_typemap_lang(const char *tm_lang) {
|
||||||
typemap_lang = Swig_copy_string(tm_lang);
|
typemap_lang = Swig_copy_string(tm_lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SWIG_cparse_set_compact_default_args(int defargs) {
|
||||||
|
compact_default_args = defargs;
|
||||||
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* Assist functions
|
* Assist functions
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
@ -895,6 +900,18 @@ static void new_feature(const char *featurename, String *val, Hash *featureattri
|
||||||
* 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;
|
||||||
|
|
||||||
|
/* 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) */
|
||||||
|
if (function) {
|
||||||
|
if (compact_default_args || !cparse_cplusplus || Getattr(function,"feature:compactdefaultargs") || Getattr(function,"feature:kwargs")) {
|
||||||
|
ParmList *p = Getattr(function,"parms");
|
||||||
|
if (p)
|
||||||
|
Setattr(p,"compactdefargs", "1"); /* mark parameters for special handling */
|
||||||
|
function = 0; /* don't add in extra methods */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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");
|
||||||
|
|
@ -2267,17 +2284,23 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (templnode && nspace) {
|
|
||||||
appendChild(nspace_inner,templnode);
|
|
||||||
templnode = nspace;
|
|
||||||
}
|
|
||||||
/* all the overloaded templated functions are added into a linked list */
|
/* all the overloaded templated functions are added into a linked list */
|
||||||
if (!linklistend) {
|
if (nspace) {
|
||||||
$$ = templnode;
|
/* non-global namespace */
|
||||||
|
if (templnode) {
|
||||||
|
appendChild(nspace_inner,templnode);
|
||||||
|
$$ = nspace;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
set_nextSibling(linklistend,templnode);
|
/* global namespace */
|
||||||
|
if (!linklistend) {
|
||||||
|
$$ = templnode;
|
||||||
|
} else {
|
||||||
|
set_nextSibling(linklistend,templnode);
|
||||||
|
}
|
||||||
|
linklistend = templnode;
|
||||||
}
|
}
|
||||||
linklistend = templnode;
|
|
||||||
}
|
}
|
||||||
nn = Getattr(nn,"sym:nextSibling"); /* repeat for overloaded templated functions. If a templated class there will never be a sibling. */
|
nn = Getattr(nn,"sym:nextSibling"); /* repeat for overloaded templated functions. If a templated class there will never be a sibling. */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue