fix %template + static class members
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6623 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9cdd5195ab
commit
cb15d93f18
2 changed files with 32 additions and 28 deletions
|
|
@ -155,11 +155,13 @@ namespace jafar {
|
||||||
namespace jmath {
|
namespace jmath {
|
||||||
class EulerT3D {
|
class EulerT3D {
|
||||||
public:
|
public:
|
||||||
|
static void hello(){}
|
||||||
|
|
||||||
template<class VecFrame, class Vec, class VecRes>
|
template<class VecFrame, class Vec, class VecRes>
|
||||||
static inline void toFrame(const VecFrame& frame_, const Vec&v_,VecRes& vRes){}
|
static void toFrame(const VecFrame& frame_, const Vec&v_,VecRes& vRes){}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%template(EulerT3D_toFrame) jafar::jmath::EulerT3D::toFrame<int,int,int>;
|
%template(toFrame) jafar::jmath::EulerT3D::toFrame<int,int,int>;
|
||||||
|
|
|
||||||
|
|
@ -731,12 +731,12 @@ static Symtab *get_global_scope() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Node *nspace = 0;
|
static Node *nscope = 0;
|
||||||
static Node *nspace_inner = 0;
|
static Node *nscope_inner = 0;
|
||||||
static String *resolve_namespace_class(String *cname) {
|
static String *resolve_node_scope(String *cname) {
|
||||||
Symtab *gscope = 0;
|
Symtab *gscope = 0;
|
||||||
nspace = 0;
|
nscope = 0;
|
||||||
nspace_inner = 0;
|
nscope_inner = 0;
|
||||||
if (Swig_scopename_check(cname)) {
|
if (Swig_scopename_check(cname)) {
|
||||||
Node *ns;
|
Node *ns;
|
||||||
String *prefix = Swig_scopename_prefix(cname);
|
String *prefix = Swig_scopename_prefix(cname);
|
||||||
|
|
@ -751,9 +751,9 @@ static String *resolve_namespace_class(String *cname) {
|
||||||
if (!prefix || (Len(prefix) == 0)) {
|
if (!prefix || (Len(prefix) == 0)) {
|
||||||
/* Use the global scope */
|
/* Use the global scope */
|
||||||
if (!gscope) gscope = get_global_scope();
|
if (!gscope) gscope = get_global_scope();
|
||||||
nspace = new_node("namespace");
|
nscope = new_node("namespace");
|
||||||
Setattr(nspace,"symtab", gscope);
|
Setattr(nscope,"symtab", gscope);
|
||||||
nspace_inner = nspace;
|
nscope_inner = nscope;
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
/* Try to locate the scope */
|
/* Try to locate the scope */
|
||||||
|
|
@ -765,9 +765,9 @@ static String *resolve_namespace_class(String *cname) {
|
||||||
Swig_error(cparse_file,cparse_line,"'%s' is not defined as a valid scope.\n", prefix);
|
Swig_error(cparse_file,cparse_line,"'%s' is not defined as a valid scope.\n", prefix);
|
||||||
ns = 0;
|
ns = 0;
|
||||||
} else {
|
} else {
|
||||||
Symtab *nscope = Getattr(ns,"symtab");
|
Symtab *nstab = Getattr(ns,"symtab");
|
||||||
String *tname = Swig_symbol_qualifiedscopename(0);
|
String *tname = Swig_symbol_qualifiedscopename(0);
|
||||||
String *nname = Swig_symbol_qualifiedscopename(nscope);
|
String *nname = Swig_symbol_qualifiedscopename(nstab);
|
||||||
if (tname && (Strcmp(tname,nname) == 0)) {
|
if (tname && (Strcmp(tname,nname) == 0)) {
|
||||||
ns = 0;
|
ns = 0;
|
||||||
cname = base;
|
cname = base;
|
||||||
|
|
@ -800,11 +800,13 @@ static String *resolve_namespace_class(String *cname) {
|
||||||
} else {
|
} else {
|
||||||
/* this is a class, or nested classes */
|
/* this is a class, or nested classes */
|
||||||
si = Next(si);
|
si = Next(si);
|
||||||
|
ns1 = Swig_symbol_clookup(sname,0);
|
||||||
for (; si.item; si = Next(si)) {
|
for (; si.item; si = Next(si)) {
|
||||||
if (si.item) {
|
if (si.item) {
|
||||||
Printf(sname,"::%s",si.item);
|
Printf(sname,"::%s",si.item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
nscope_inner = Swig_symbol_clookup(sname,0);
|
||||||
Printf(sname,"::%s",base);
|
Printf(sname,"::%s",base);
|
||||||
Delete(base);
|
Delete(base);
|
||||||
base = sname;
|
base = sname;
|
||||||
|
|
@ -816,13 +818,13 @@ static String *resolve_namespace_class(String *cname) {
|
||||||
add_symbols(ns2);
|
add_symbols(ns2);
|
||||||
Swig_symbol_setscope(Getattr(ns1,"symtab"));
|
Swig_symbol_setscope(Getattr(ns1,"symtab"));
|
||||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
if (nspace_inner) {
|
if (nscope_inner) {
|
||||||
if (Getattr(nspace_inner,"symtab") != Getattr(ns2,"symtab")) {
|
if (Getattr(nscope_inner,"symtab") != Getattr(ns2,"symtab")) {
|
||||||
appendChild(nspace_inner,ns2);
|
appendChild(nscope_inner,ns2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nspace_inner = ns2;
|
nscope_inner = ns2;
|
||||||
if (!nspace) nspace = ns2;
|
if (!nscope) nscope = ns2;
|
||||||
}
|
}
|
||||||
cname = base;
|
cname = base;
|
||||||
}
|
}
|
||||||
|
|
@ -2194,10 +2196,10 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
||||||
tscope = Swig_symbol_current(); /* Get the current scope */
|
tscope = Swig_symbol_current(); /* Get the current scope */
|
||||||
|
|
||||||
/* If the class name is qualified. We need to create or lookup namespace entries */
|
/* If the class name is qualified. We need to create or lookup namespace entries */
|
||||||
$5 = resolve_namespace_class($5);
|
$5 = resolve_node_scope($5);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
we use the new namespace entry 'nspace' only to
|
we use the new namespace entry 'nscope' only to
|
||||||
emit the template node. The template parameters are
|
emit the template node. The template parameters are
|
||||||
resolved in the current 'tscope'.
|
resolved in the current 'tscope'.
|
||||||
|
|
||||||
|
|
@ -2379,11 +2381,11 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all the overloaded templated functions are added into a linked list */
|
/* all the overloaded templated functions are added into a linked list */
|
||||||
if (nspace) {
|
if (nscope) {
|
||||||
/* non-global namespace */
|
/* non-global namespace */
|
||||||
if (templnode) {
|
if (templnode) {
|
||||||
appendChild(nspace_inner,templnode);
|
appendChild(nscope_inner,templnode);
|
||||||
$$ = nspace;
|
$$ = nscope;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* global namespace */
|
/* global namespace */
|
||||||
|
|
@ -2732,8 +2734,8 @@ cpp_class_decl :
|
||||||
/* preserve the current scope */
|
/* preserve the current scope */
|
||||||
prev_symtab = Swig_symbol_current();
|
prev_symtab = Swig_symbol_current();
|
||||||
|
|
||||||
/* If the class name is qualified. We need to create or lookup namespace entries */
|
/* If the class name is qualified. We need to create or lookup namespace/scope entries */
|
||||||
$3 = resolve_namespace_class($3);
|
$3 = resolve_node_scope($3);
|
||||||
|
|
||||||
class_rename = make_name($3,0);
|
class_rename = make_name($3,0);
|
||||||
Classprefix = NewString($3);
|
Classprefix = NewString($3);
|
||||||
|
|
@ -2861,12 +2863,12 @@ cpp_class_decl :
|
||||||
Setattr($$,"symtab",Swig_symbol_popscope());
|
Setattr($$,"symtab",Swig_symbol_popscope());
|
||||||
|
|
||||||
Classprefix = 0;
|
Classprefix = 0;
|
||||||
if (nspace) {
|
if (nscope) {
|
||||||
appendChild(nspace_inner,$$);
|
appendChild(nscope_inner,$$);
|
||||||
Swig_symbol_setscope(Getattr(nspace_inner,"symtab"));
|
Swig_symbol_setscope(Getattr(nscope_inner,"symtab"));
|
||||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
add_symbols($$);
|
add_symbols($$);
|
||||||
$$ = nspace;
|
$$ = nscope;
|
||||||
Swig_symbol_setscope(cscope);
|
Swig_symbol_setscope(cscope);
|
||||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||||
add_symbols($9);
|
add_symbols($9);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue