mirror of https://github.com/swig/swig
Cosmetic change in template terminology
Prefer terminology from C++ standard: function templates and class templates
This commit is contained in:
parent
e2ff557120
commit
a92871d9d1
|
@ -1436,7 +1436,7 @@ static void default_arguments(Node *n) {
|
|||
Delete(pl);
|
||||
}
|
||||
|
||||
/* copy specific attributes for global (or in a namespace) template functions - these are not templated class methods */
|
||||
/* copy specific attributes for global (or in a namespace) template functions - these are not class template methods */
|
||||
if (strcmp(cntype,"template") == 0) {
|
||||
Node *templatetype = Getattr(function,"templatetype");
|
||||
Node *symtypename = Getattr(function,"sym:typename");
|
||||
|
@ -2876,7 +2876,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
if (GetFlag(nn, "instantiate")) {
|
||||
Delattr(nn, "instantiate");
|
||||
{
|
||||
int nnisclass = (Strcmp(Getattr(nn, "templatetype"), "class") == 0); /* if not a templated class it is a templated function */
|
||||
int nnisclass = (Strcmp(Getattr(nn, "templatetype"), "class") == 0); /* if not a class template it is a function template */
|
||||
Parm *tparms = Getattr(nn, "templateparms");
|
||||
int specialized = !tparms; /* fully specialized (an explicit specialization) */
|
||||
String *tname = Copy($5);
|
||||
|
@ -3006,7 +3006,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
}
|
||||
}
|
||||
|
||||
/* all the overloaded templated functions are added into a linked list */
|
||||
/* all the overloaded function templates are added into a linked list */
|
||||
if (!linkliststart)
|
||||
linkliststart = templnode;
|
||||
if (nscope_inner) {
|
||||
|
@ -3027,7 +3027,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
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 function templates. If a class template there will never be a sibling. */
|
||||
}
|
||||
update_defaultargs(linkliststart);
|
||||
update_abstracts(linkliststart);
|
||||
|
|
|
@ -1143,14 +1143,14 @@ success:
|
|||
* Swig_cparse_template_locate()
|
||||
*
|
||||
* Search for a template that matches name with given parameters and mark it for instantiation.
|
||||
* For templated classes marks the specialized template should there be one.
|
||||
* For templated functions marks all the unspecialized templates even if specialized
|
||||
* For class templates marks the specialized template should there be one.
|
||||
* For function templates marks all the unspecialized templates even if specialized
|
||||
* templates exists.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
Node *Swig_cparse_template_locate(String *name, Parm *instantiated_parms, String *symname, Symtab *tscope) {
|
||||
Node *match = 0;
|
||||
Node *n = template_locate(name, instantiated_parms, symname, tscope); /* this function does what we want for templated classes */
|
||||
Node *n = template_locate(name, instantiated_parms, symname, tscope); /* this function does what we want for class templates */
|
||||
|
||||
if (n) {
|
||||
String *nodeType = nodeType(n);
|
||||
|
@ -1178,15 +1178,15 @@ Node *Swig_cparse_template_locate(String *name, Parm *instantiated_parms, String
|
|||
SetFlag(n, "instantiate");
|
||||
} else {
|
||||
Node *firstn = 0;
|
||||
/* If not a templated class we must have a templated function.
|
||||
/* If not a class template we must have a function template.
|
||||
The template found is not necessarily the one we want when dealing with templated
|
||||
functions. We don't want any specialized templated functions as they won't have
|
||||
functions. We don't want any specialized function templates as they won't have
|
||||
the default parameters. Let's look for the unspecialized template. Also make sure
|
||||
the number of template parameters is correct as it is possible to overload a
|
||||
templated function with different numbers of template parameters. */
|
||||
function template with different numbers of template parameters. */
|
||||
|
||||
if (template_debug) {
|
||||
Printf(stdout, " Not a templated class, seeking all appropriate primary templated functions\n");
|
||||
Printf(stdout, " Not a class template, seeking all appropriate primary function templates\n");
|
||||
}
|
||||
|
||||
firstn = Swig_symbol_clookup_local(name, 0);
|
||||
|
@ -1237,7 +1237,7 @@ Node *Swig_cparse_template_locate(String *name, Parm *instantiated_parms, String
|
|||
}
|
||||
|
||||
if (!match) {
|
||||
Swig_error(cparse_file, cparse_line, "Template '%s' undefined.\n", name);
|
||||
Swig_error(cparse_file, cparse_line, "No matching function template '%s' found.\n", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1345,7 +1345,7 @@ ParmList *Swig_cparse_template_parms_expand(ParmList *instantiated_parms, Node *
|
|||
ParmList *expanded_templateparms = CopyParmList(instantiated_parms);
|
||||
|
||||
if (Equal(Getattr(primary, "templatetype"), "class")) {
|
||||
/* Templated class */
|
||||
/* Class template */
|
||||
ParmList *templateparms = Getattr(primary, "templateparms");
|
||||
int variadic = merge_parameters(expanded_templateparms, templateparms);
|
||||
/* Add default arguments from primary template */
|
||||
|
@ -1359,7 +1359,7 @@ ParmList *Swig_cparse_template_parms_expand(ParmList *instantiated_parms, Node *
|
|||
}
|
||||
}
|
||||
} else {
|
||||
/* Templated function */
|
||||
/* Function template */
|
||||
/* TODO: Default template parameters support was only added in C++11 */
|
||||
ParmList *templateparms = Getattr(templ, "templateparms");
|
||||
merge_parameters(expanded_templateparms, templateparms);
|
||||
|
@ -1383,7 +1383,7 @@ ParmList *Swig_cparse_template_partialargs_expand(ParmList *partially_specialize
|
|||
ParmList *expanded_templateparms = CopyParmList(partially_specialized_parms);
|
||||
|
||||
if (Equal(Getattr(primary, "templatetype"), "class")) {
|
||||
/* Templated class */
|
||||
/* Class template */
|
||||
int variadic = ParmList_variadic_parm(templateparms) ? 1 : 0;
|
||||
/* Add default arguments from primary template */
|
||||
if (!variadic) {
|
||||
|
@ -1396,7 +1396,7 @@ ParmList *Swig_cparse_template_partialargs_expand(ParmList *partially_specialize
|
|||
}
|
||||
}
|
||||
} else {
|
||||
/* Templated function */
|
||||
/* Function template */
|
||||
/* TODO: Default template parameters support was only added in C++11 */
|
||||
}
|
||||
|
||||
|
|
|
@ -550,7 +550,7 @@ String *SwigType_str(const SwigType *s, const_String_or_char_ptr id) {
|
|||
int nelements, i;
|
||||
|
||||
if (id) {
|
||||
/* stringify the id expanding templates, for example when the id is a fully qualified templated class name */
|
||||
/* Stringify the id expanding templates, for example when the id is a fully qualified class template name */
|
||||
String *id_str = NewString(id); /* unfortunate copy due to current const limitations */
|
||||
result = SwigType_str(id_str, 0);
|
||||
Delete(id_str);
|
||||
|
|
Loading…
Reference in New Issue