fixes for templates and template default args, cosmetics, and other fixes for OSS
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6893 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
41e5cbc33c
commit
0ac8253c3f
20 changed files with 615 additions and 271 deletions
|
|
@ -32,10 +32,10 @@ namespace EnumDirector {
|
||||||
virtual Hello say_hello(Hello){ return hello;}
|
virtual Hello say_hello(Hello){ return hello;}
|
||||||
virtual Hello say_hi(A *a){ return hi;}
|
virtual Hello say_hi(A *a){ return hi;}
|
||||||
virtual Bye say_bye(Bye b){ return b;}
|
virtual Bye say_bye(Bye b){ return b;}
|
||||||
virtual const Hello & say_hi_ref(const Hello & h){ return h;}
|
virtual Hello say_hi_ref(const Hello & h){ return h;}
|
||||||
|
|
||||||
Hello ping(Hello h){ return say_hi(h);}
|
Hello ping(Hello h){ return say_hi(h);}
|
||||||
const Hello & ping_ref(const Hello &h){ return say_hi_ref(h);}
|
Hello ping_ref(const Hello &h){ return say_hi_ref(h);}
|
||||||
Bye ping_member_enum(Bye b){ return say_bye(b);}
|
Bye ping_member_enum(Bye b){ return say_bye(b);}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Massive primitive datatype test.
|
// Massive primitive datatype test.
|
||||||
%module(directors="1") primitive_types
|
%module(directors="1") primitive_types
|
||||||
|
|
||||||
|
// Using thread unsafe wrapping
|
||||||
|
#pragma SWIG nowarn=470
|
||||||
/*
|
/*
|
||||||
|
|
||||||
if your language has problems with MyInt* and/or Hello*,
|
if your language has problems with MyInt* and/or Hello*,
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%extend std::basic_ostream<char, std::char_traits<char> >{
|
%extend std::basic_ostream<char>{
|
||||||
std::basic_ostream<char, std::char_traits<char> >&
|
std::basic_ostream<char>&
|
||||||
operator<<(const A& a)
|
operator<<(const A& a)
|
||||||
{
|
{
|
||||||
*self << "A class";
|
*self << "A class";
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int get_y(Bar *b)
|
int get_y(Bar *b)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,164 @@
|
||||||
%module template_default
|
%module template_default
|
||||||
%inline %{
|
|
||||||
template <class T1, class T2 = T1>
|
|
||||||
class A
|
|
||||||
{
|
|
||||||
};
|
|
||||||
%}
|
|
||||||
|
|
||||||
%template(A_ii) A<int, int>;
|
|
||||||
%template(A_d) A<double>;
|
|
||||||
|
%warnfilter(801) ns1::Traits::c; /* Ruby, wrong constant name */
|
||||||
|
namespace ns1 {
|
||||||
|
namespace ns2 {
|
||||||
|
|
||||||
|
%feature("hello") A<int>;
|
||||||
|
%feature("hello") A<double,double>;
|
||||||
|
%feature("hi") A<int,int>;
|
||||||
|
%feature("hi") A<double>;
|
||||||
|
|
||||||
|
%extend A<int>
|
||||||
|
{
|
||||||
|
int foo() { return 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
%extend A<double,double>
|
||||||
|
{
|
||||||
|
int foo() { return 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
%extend A<int,int>
|
||||||
|
{
|
||||||
|
int bar() { return 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
%extend A<double>
|
||||||
|
{
|
||||||
|
int bar() { return 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
%extend N<double>
|
||||||
|
{
|
||||||
|
int bar() { return 1; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
namespace ns1 {
|
||||||
|
namespace ns2 {
|
||||||
|
|
||||||
|
struct Parm
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T1, class T2 = T1>
|
||||||
|
class A
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef SWIG
|
||||||
|
%typemap(in) A * { /* in A */ }
|
||||||
|
%typemap(out) A * { /* out A */ }
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef unsigned int category;
|
||||||
|
|
||||||
|
const category one = 1;
|
||||||
|
const category two = 1;
|
||||||
|
|
||||||
|
|
||||||
|
template <class T1, category C = one, class T2 = Parm>
|
||||||
|
class N
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef SWIG
|
||||||
|
%typemap(in) N * { /* in N */ }
|
||||||
|
%typemap(out) N * { /* out N */ }
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%template(A_p) ns1::ns2::A<double,ns1::ns2::Parm>;
|
||||||
|
%template(N_1p) ns1::ns2::N<int>;
|
||||||
|
|
||||||
|
|
||||||
|
namespace ns1 {
|
||||||
|
namespace ns2 {
|
||||||
|
%template(A_ii) A<int, int>;
|
||||||
|
%template(A_d) A<double>;
|
||||||
|
%template(N_d) N<double>;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
namespace ns1 {
|
||||||
|
namespace ns2 {
|
||||||
|
namespace ns3 {
|
||||||
|
|
||||||
|
struct B : A<int>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
struct C : N<double,ns1::ns2::one>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
A<int> *get_a1(A<int> *a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
A<int,int> *get_a2(A<int,int> *a) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
namespace ns1 {
|
||||||
|
struct Traits
|
||||||
|
{
|
||||||
|
static const ns2::category c = ns2::one;
|
||||||
|
};
|
||||||
|
namespace ns4 {
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct D : ns2::N<double,T::c>
|
||||||
|
{
|
||||||
|
D()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T1, class T2 = D<T1> >
|
||||||
|
struct Base : T2
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
%template(Do) ns1::ns4::D<ns1::Traits>;
|
||||||
|
%template(Bo) ns1::ns4::Base<ns1::Traits, ns1::ns4::D<ns1::Traits> >;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
namespace ns1 {
|
||||||
|
namespace ns5 {
|
||||||
|
|
||||||
|
struct Der : ns4::Base<Traits>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,6 @@ extern int need_redefined_warn(Node* a, Node* b, int InClass);
|
||||||
|
|
||||||
|
|
||||||
/* templ.c */
|
/* templ.c */
|
||||||
extern void Swig_cparse_template_defargs(Parm *parms, Parm *targs, Symtab *tscope);
|
|
||||||
extern String* Swig_cparse_template_deftype(SwigType *type, Symtab *tscope);
|
|
||||||
extern int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *tscope);
|
extern int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *tscope);
|
||||||
extern Node *Swig_cparse_template_locate(String *name, ParmList *tparms, Symtab *tscope);
|
extern Node *Swig_cparse_template_locate(String *name, ParmList *tparms, Symtab *tscope);
|
||||||
extern void Swig_cparse_debug_templates(int);
|
extern void Swig_cparse_debug_templates(int);
|
||||||
|
|
|
||||||
|
|
@ -3322,8 +3322,10 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN { template_para
|
||||||
} else {
|
} else {
|
||||||
/* Need to resolve exact specialization name */
|
/* Need to resolve exact specialization name */
|
||||||
/* add default args from generic template */
|
/* add default args from generic template */
|
||||||
String *fname = Swig_cparse_template_deftype(tname,0);
|
String *ty = Swig_symbol_template_deftype(tname,0);
|
||||||
|
String *fname = Swig_symbol_type_qualify(ty,0);
|
||||||
Swig_symbol_cadd(fname,$$);
|
Swig_symbol_cadd(fname,$$);
|
||||||
|
Delete(ty);
|
||||||
}
|
}
|
||||||
} else if ($$) {
|
} else if ($$) {
|
||||||
Setattr($$,"templatetype",nodeType($6));
|
Setattr($$,"templatetype",nodeType($6));
|
||||||
|
|
|
||||||
|
|
@ -288,9 +288,11 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
|
||||||
/* Printf(stdout,"%s\n", ParmList_str_defaultargs(tp)); */
|
/* Printf(stdout,"%s\n", ParmList_str_defaultargs(tp)); */
|
||||||
|
|
||||||
if (tp) {
|
if (tp) {
|
||||||
|
Symtab *tsdecl = Getattr(n,"sym:symtab");
|
||||||
while (p && tp) {
|
while (p && tp) {
|
||||||
String *name, *value, *valuestr, *tydef, *tmp, *tmpr;
|
String *name, *value, *valuestr, *tydef, *tmp, *tmpr;
|
||||||
int sz, i;
|
int sz, i;
|
||||||
|
String *dvalue = 0;
|
||||||
|
|
||||||
name = Getattr(tp,"name");
|
name = Getattr(tp,"name");
|
||||||
value = Getattr(p,"value");
|
value = Getattr(p,"value");
|
||||||
|
|
@ -298,19 +300,22 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
if (!value) value = Getattr(p,"type");
|
if (!value) value = Getattr(p,"type");
|
||||||
if (SwigType_istemplate(value)) {
|
dvalue = Swig_symbol_type_qualify(value,tsdecl);
|
||||||
value = Swig_cparse_template_deftype(value, 0);
|
if (SwigType_istemplate(dvalue)) {
|
||||||
|
String *ty = Swig_symbol_template_deftype(dvalue, tscope);
|
||||||
|
Delete(dvalue);
|
||||||
|
dvalue = ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
valuestr = SwigType_str(value,0);
|
assert(dvalue);
|
||||||
assert(value);
|
valuestr = SwigType_str(dvalue,0);
|
||||||
/* Need to patch default arguments */
|
/* Need to patch default arguments */
|
||||||
{
|
{
|
||||||
Parm *rp = nextSibling(p);
|
Parm *rp = nextSibling(p);
|
||||||
while (rp) {
|
while (rp) {
|
||||||
String *rvalue = Getattr(rp,"value");
|
String *rvalue = Getattr(rp,"value");
|
||||||
if (rvalue) {
|
if (rvalue) {
|
||||||
Replace(rvalue,name,value, DOH_REPLACE_ID);
|
Replace(rvalue,name,dvalue, DOH_REPLACE_ID);
|
||||||
}
|
}
|
||||||
rp = nextSibling(rp);
|
rp = nextSibling(rp);
|
||||||
}
|
}
|
||||||
|
|
@ -318,20 +323,20 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
|
||||||
sz = Len(patchlist);
|
sz = Len(patchlist);
|
||||||
for (i = 0; i < sz; i++) {
|
for (i = 0; i < sz; i++) {
|
||||||
String *s = Getitem(patchlist,i);
|
String *s = Getitem(patchlist,i);
|
||||||
Replace(s,name,value, DOH_REPLACE_ID);
|
Replace(s,name,dvalue, DOH_REPLACE_ID);
|
||||||
}
|
}
|
||||||
sz = Len(typelist);
|
sz = Len(typelist);
|
||||||
for (i = 0; i < sz; i++) {
|
for (i = 0; i < sz; i++) {
|
||||||
String *s = Getitem(typelist,i);
|
String *s = Getitem(typelist,i);
|
||||||
/* Replace(s,name,value, DOH_REPLACE_ID); */
|
/* Replace(s,name,value, DOH_REPLACE_ID); */
|
||||||
/* Printf(stdout,"name = '%s', value = '%s', tbase = '%s', iname='%s' s = '%s' --> ", name, value, tbase, iname, s); */
|
/* Printf(stdout,"name = '%s', value = '%s', tbase = '%s', iname='%s' s = '%s' --> ", name, dvalue, tbase, iname, s); */
|
||||||
SwigType_typename_replace(s,name,value);
|
SwigType_typename_replace(s,name,dvalue);
|
||||||
SwigType_typename_replace(s,tbase,iname);
|
SwigType_typename_replace(s,tbase,iname);
|
||||||
/* Printf(stdout,"'%s'\n", s);*/
|
/* Printf(stdout,"'%s'\n", s);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tydef) {
|
if (!tydef) {
|
||||||
tydef = value;
|
tydef = dvalue;
|
||||||
}
|
}
|
||||||
tmp = NewStringf("#%s",name);
|
tmp = NewStringf("#%s",name);
|
||||||
tmpr = NewStringf("\"%s\"", valuestr);
|
tmpr = NewStringf("\"%s\"", valuestr);
|
||||||
|
|
@ -346,6 +351,7 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
|
||||||
Delete(tmp);
|
Delete(tmp);
|
||||||
Delete(tmpr);
|
Delete(tmpr);
|
||||||
Delete(valuestr);
|
Delete(valuestr);
|
||||||
|
Delete(dvalue);
|
||||||
}
|
}
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
tp = nextSibling(tp);
|
tp = nextSibling(tp);
|
||||||
|
|
@ -383,105 +389,6 @@ Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *ts
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* Swig_cparse_template_defargs()
|
|
||||||
*
|
|
||||||
* Apply default arg from generic template default args
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Swig_cparse_template_defargs(Parm *parms, Parm *targs, Symtab *tscope) {
|
|
||||||
if (Len(parms) < Len(targs)) {
|
|
||||||
Parm *lp = parms;
|
|
||||||
Parm *p = lp;
|
|
||||||
Parm *tp = targs;
|
|
||||||
while(p && tp) {
|
|
||||||
p = nextSibling(p);
|
|
||||||
tp = nextSibling(tp);
|
|
||||||
if (p) lp = p;
|
|
||||||
}
|
|
||||||
while (tp) {
|
|
||||||
String *value = Getattr(tp,"value");
|
|
||||||
if (value) {
|
|
||||||
Parm *cp;
|
|
||||||
Parm *ta = targs;
|
|
||||||
Parm *p = parms;
|
|
||||||
SwigType *nt = Swig_symbol_typedef_reduce(value,tscope);
|
|
||||||
while(p && ta) {
|
|
||||||
String *name = Getattr(ta,"name");
|
|
||||||
String *value = Getattr(p,"value");
|
|
||||||
if (!value) value = Getattr(p,"type");
|
|
||||||
Replace(nt, name, value, DOH_REPLACE_ID);
|
|
||||||
p = nextSibling(p);
|
|
||||||
ta = nextSibling(ta);
|
|
||||||
}
|
|
||||||
cp = NewParm(Swig_symbol_type_qualify(nt,tscope),0);
|
|
||||||
set_nextSibling(lp,cp);
|
|
||||||
lp = cp;
|
|
||||||
tp = nextSibling(tp);
|
|
||||||
Delete(nt);
|
|
||||||
} else {
|
|
||||||
tp = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* Swig_cparse_template_deftype()
|
|
||||||
*
|
|
||||||
* Apply default args to generic template type
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
String*
|
|
||||||
Swig_cparse_template_deftype(SwigType *type, Symtab *tscope) {
|
|
||||||
String *prefix = SwigType_prefix(type);
|
|
||||||
String *base = SwigType_base(type);
|
|
||||||
String *tprefix = SwigType_templateprefix(base);
|
|
||||||
String *targs = SwigType_templateargs(base);
|
|
||||||
String *tsuffix = SwigType_templatesuffix(base);
|
|
||||||
ParmList *tparms = SwigType_function_parms(targs);
|
|
||||||
Node *tempn = Swig_symbol_clookup_local(tprefix,tscope);
|
|
||||||
if (tempn) {
|
|
||||||
ParmList *tnargs = Getattr(tempn,"templateparms");
|
|
||||||
Parm *p;
|
|
||||||
/* Printf(stderr,"deftype type %s %s %s\n", tprefix, targs, tsuffix);*/
|
|
||||||
Append(tprefix,"<(");
|
|
||||||
Swig_cparse_template_defargs(tparms, tnargs,tscope);
|
|
||||||
p = tparms;
|
|
||||||
while (p) {
|
|
||||||
SwigType *ptype = Getattr(p,"type");
|
|
||||||
SwigType *ttr = Swig_symbol_typedef_reduce(ptype ? ptype : Getattr(p,"value") ,tscope);
|
|
||||||
SwigType *ttq = Swig_symbol_type_qualify(ttr,tscope);
|
|
||||||
if (SwigType_istemplate(ttq)) {
|
|
||||||
SwigType *t = Swig_cparse_template_deftype(ttq, tscope);
|
|
||||||
Delete(ttq);
|
|
||||||
ttq = t;
|
|
||||||
}
|
|
||||||
Append(tprefix,ttq);
|
|
||||||
p = nextSibling(p);
|
|
||||||
if (p) Putc(',',tprefix);
|
|
||||||
Delete(ttr);
|
|
||||||
Delete(ttq);
|
|
||||||
}
|
|
||||||
Append(tprefix,")>");
|
|
||||||
Append(tprefix,tsuffix);
|
|
||||||
Append(prefix,tprefix);
|
|
||||||
/* Printf(stderr,"deftype default %s \n", tprefix); */
|
|
||||||
type = Copy(prefix);
|
|
||||||
} else {
|
|
||||||
type = Copy(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
Delete(prefix);
|
|
||||||
Delete(base);
|
|
||||||
Delete(tprefix);
|
|
||||||
Delete(tsuffix);
|
|
||||||
Delete(targs);
|
|
||||||
Delete(tparms);
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* template_locate()
|
* template_locate()
|
||||||
*
|
*
|
||||||
|
|
@ -506,8 +413,10 @@ template_locate(String *name, Parm *tparms, Symtab *tscope) {
|
||||||
|
|
||||||
/* Add default values from generic template */
|
/* Add default values from generic template */
|
||||||
if (templ) {
|
if (templ) {
|
||||||
|
Symtab *tsdecl = Getattr(templ,"sym:symtab");
|
||||||
|
|
||||||
targs = Getattr(templ,"templateparms");
|
targs = Getattr(templ,"templateparms");
|
||||||
Swig_cparse_template_defargs(parms, targs, tscope);
|
Swig_symbol_template_defargs(parms, targs, tscope, tsdecl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -516,10 +425,8 @@ template_locate(String *name, Parm *tparms, Symtab *tscope) {
|
||||||
while (p) {
|
while (p) {
|
||||||
SwigType *ty = Getattr(p,"type");
|
SwigType *ty = Getattr(p,"type");
|
||||||
if (ty) {
|
if (ty) {
|
||||||
SwigType *rt = Swig_symbol_typedef_reduce(ty,tscope);
|
SwigType *nt = Swig_symbol_type_qualify(ty,tscope);
|
||||||
SwigType *nt = Swig_symbol_type_qualify(rt,tscope);
|
|
||||||
Setattr(p,"type",nt);
|
Setattr(p,"type",nt);
|
||||||
Delete(rt);
|
|
||||||
}
|
}
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
}
|
}
|
||||||
|
|
@ -537,6 +444,16 @@ template_locate(String *name, Parm *tparms, Symtab *tscope) {
|
||||||
Printf(stdout," searching: '%s' (exact specialization)\n", tname);
|
Printf(stdout," searching: '%s' (exact specialization)\n", tname);
|
||||||
}
|
}
|
||||||
n = Swig_symbol_clookup_local(tname,0);
|
n = Swig_symbol_clookup_local(tname,0);
|
||||||
|
if (!n) {
|
||||||
|
SwigType *rname = Swig_symbol_typedef_reduce(tname,tscope);
|
||||||
|
if (Strcmp(rname,tname)) {
|
||||||
|
if (template_debug) {
|
||||||
|
Printf(stdout," searching: '%s' (exact specialization)\n", rname);
|
||||||
|
}
|
||||||
|
n = Swig_symbol_clookup_local(rname,0);
|
||||||
|
}
|
||||||
|
Delete(rname);
|
||||||
|
}
|
||||||
if (n) {
|
if (n) {
|
||||||
Node *tn;
|
Node *tn;
|
||||||
if (Strcmp(nodeType(n),"template") == 0) goto success;
|
if (Strcmp(nodeType(n),"template") == 0) goto success;
|
||||||
|
|
@ -562,16 +479,17 @@ template_locate(String *name, Parm *tparms, Symtab *tscope) {
|
||||||
while (p) {
|
while (p) {
|
||||||
String *t;
|
String *t;
|
||||||
t = Getattr(p,"type");
|
t = Getattr(p,"type");
|
||||||
|
if (!t) t = Getattr(p,"value");
|
||||||
if (t) {
|
if (t) {
|
||||||
String *tbase = SwigType_base(t);
|
String *ty = Swig_symbol_typedef_reduce(t,tscope);
|
||||||
t = SwigType_default(t);
|
String *tb = SwigType_base(ty);
|
||||||
Replaceid(t,"enum SWIGTYPE",tbase);
|
String *td = SwigType_default(ty);
|
||||||
Replaceid(t,"SWIGTYPE",tbase);
|
Replaceid(td,"enum SWIGTYPE",tb);
|
||||||
Printf(rname,"%s",t);
|
Replaceid(td,"SWIGTYPE",tb);
|
||||||
Delete(t);
|
Printf(rname,"%s",td);
|
||||||
} else {
|
Delete(tb);
|
||||||
String *v = Getattr(p,"value");
|
Delete(ty);
|
||||||
Printf(rname,"%s",v);
|
Delete(td);
|
||||||
}
|
}
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
if (p) {
|
if (p) {
|
||||||
|
|
@ -600,13 +518,13 @@ template_locate(String *name, Parm *tparms, Symtab *tscope) {
|
||||||
String *t,*tn;
|
String *t,*tn;
|
||||||
sprintf(tmp,"$%d",i);
|
sprintf(tmp,"$%d",i);
|
||||||
t = Getattr(p,"type");
|
t = Getattr(p,"type");
|
||||||
|
if (!t) t = Getattr(p,"value");
|
||||||
if (t) {
|
if (t) {
|
||||||
tn = SwigType_base(t);
|
String *ty = Swig_symbol_typedef_reduce(t,tscope);
|
||||||
|
tn = SwigType_base(ty);
|
||||||
Replaceid(ss,tmp,tn);
|
Replaceid(ss,tmp,tn);
|
||||||
Delete(tn);
|
Delete(tn);
|
||||||
} else {
|
Delete(ty);
|
||||||
String *v = Getattr(p,"value");
|
|
||||||
Replaceid(ss,tmp,v);
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@
|
||||||
#define WARN_TYPEMAP_TYPECHECK 467
|
#define WARN_TYPEMAP_TYPECHECK 467
|
||||||
#define WARN_TYPEMAP_THROW 468
|
#define WARN_TYPEMAP_THROW 468
|
||||||
#define WARN_TYPEMAP_DIRECTORIN_UNDEF 469
|
#define WARN_TYPEMAP_DIRECTORIN_UNDEF 469
|
||||||
#define WARN_TYPEMAP_THREAD_UNSAFE 470
|
#define WARN_TYPEMAP_DIRECTOROUT_CREF 470
|
||||||
|
|
||||||
/* -- General code generation -- */
|
/* -- General code generation -- */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,7 @@ class Allocate : public Dispatcher {
|
||||||
for (int i = 0; i < Len(abstract); i++) {
|
for (int i = 0; i < Len(abstract); i++) {
|
||||||
Node *nn = Getitem(abstract,i);
|
Node *nn = Getitem(abstract,i);
|
||||||
String *name = Getattr(nn,"name");
|
String *name = Getattr(nn,"name");
|
||||||
|
if (!name) continue;
|
||||||
String *base_decl = Getattr(nn,"decl");
|
String *base_decl = Getattr(nn,"decl");
|
||||||
if (base_decl) base_decl = SwigType_typedef_resolve_all(base_decl);
|
if (base_decl) base_decl = SwigType_typedef_resolve_all(base_decl);
|
||||||
if (Strstr(name,"~")) continue; /* Don't care about destructors */
|
if (Strstr(name,"~")) continue; /* Don't care about destructors */
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,9 @@ int Dispatcher::emit_one(Node *n) {
|
||||||
|
|
||||||
char *tag = Char(nodeType(n));
|
char *tag = Char(nodeType(n));
|
||||||
if (!tag) {
|
if (!tag) {
|
||||||
Printf(stderr,"SWIG: Fatal internal error. Malformed parse tree node!\n");
|
/* Printf(stderr,"SWIG: Fatal internal error. Malformed parse tree
|
||||||
return SWIG_ERROR;
|
node!\n"); */
|
||||||
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not proceed if marked with an error */
|
/* Do not proceed if marked with an error */
|
||||||
|
|
|
||||||
|
|
@ -668,7 +668,7 @@ public:
|
||||||
* ------------------------------------------------------------ */
|
* ------------------------------------------------------------ */
|
||||||
|
|
||||||
virtual int classHandler(Node *n) {
|
virtual int classHandler(Node *n) {
|
||||||
|
static Hash* emitted = NewHash();
|
||||||
String *mangled_classname = 0;
|
String *mangled_classname = 0;
|
||||||
String *real_classname = 0;
|
String *real_classname = 0;
|
||||||
|
|
||||||
|
|
@ -698,6 +698,9 @@ public:
|
||||||
real_classname = Getattr(n,"name");
|
real_classname = Getattr(n,"name");
|
||||||
mangled_classname = Swig_name_mangle(real_classname);
|
mangled_classname = Swig_name_mangle(real_classname);
|
||||||
|
|
||||||
|
if (Getattr(emitted,mangled_classname)) return SWIG_NOWRAP;
|
||||||
|
Setattr(emitted,mangled_classname,"1");
|
||||||
|
|
||||||
attr_tab = NewString("");
|
attr_tab = NewString("");
|
||||||
Printf(attr_tab, "static swig_attribute swig_");
|
Printf(attr_tab, "static swig_attribute swig_");
|
||||||
Printv(attr_tab, mangled_classname, "_attributes[] = {\n", NIL);
|
Printv(attr_tab, mangled_classname, "_attributes[] = {\n", NIL);
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,11 @@ String *Swig_string_mangle(const String *s) {
|
||||||
char *pc, *cb;
|
char *pc, *cb;
|
||||||
String *b = Copy(s);
|
String *b = Copy(s);
|
||||||
if (SwigType_istemplate(b)) {
|
if (SwigType_istemplate(b)) {
|
||||||
String *t = SwigType_namestr(b);
|
String *st = Swig_symbol_template_deftype(b, 0);
|
||||||
|
String *sq = Swig_symbol_type_qualify(st,0);
|
||||||
|
String *t = SwigType_namestr(sq);
|
||||||
|
Delete(st);
|
||||||
|
Delete(sq);
|
||||||
Delete(b);
|
Delete(b);
|
||||||
b = t ;
|
b = t ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -639,6 +639,14 @@ Swig_features_get(Hash *features, String *prefix, String *name, SwigType *decl,
|
||||||
Delete(tname);
|
Delete(tname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (name && SwigType_istemplate(name)) {
|
||||||
|
String *dname = Swig_symbol_template_deftype(name,0);
|
||||||
|
if (Strcmp(dname,name)) {
|
||||||
|
Swig_features_get(features, prefix, dname, decl, node);
|
||||||
|
}
|
||||||
|
Delete(dname);
|
||||||
|
}
|
||||||
|
|
||||||
Delete(rname);
|
Delete(rname);
|
||||||
Delete(rdecl);
|
Delete(rdecl);
|
||||||
}
|
}
|
||||||
|
|
@ -700,6 +708,14 @@ Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl, con
|
||||||
attribs = nextSibling(attribs);
|
attribs = nextSibling(attribs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name && SwigType_istemplate(name)) {
|
||||||
|
String *dname = Swig_symbol_template_deftype(name,0);
|
||||||
|
if (Strcmp(dname,name)) {
|
||||||
|
Swig_feature_set(features, dname, decl, featurename, value, featureattribs);
|
||||||
|
}
|
||||||
|
Delete(dname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -898,20 +898,25 @@ String *SwigType_lcaststr(SwigType *s, const String_or_char *name) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* keep old mangling since Java codes need it */
|
/* keep old mangling since Java codes need it */
|
||||||
String *SwigType_manglestr_default(SwigType *s) {
|
String *SwigType_manglestr_default(SwigType *s) {
|
||||||
char *c;
|
char *c;
|
||||||
String *result,*base;
|
String *result,*base;
|
||||||
SwigType *lt;
|
SwigType *lt;
|
||||||
SwigType *ss = SwigType_typedef_resolve_all(s);
|
SwigType *sr = SwigType_typedef_qualified(s);
|
||||||
|
SwigType *ss = SwigType_typedef_resolve_all(sr);
|
||||||
|
|
||||||
s = ss;
|
s = ss;
|
||||||
|
|
||||||
if (SwigType_istemplate(s)) {
|
if (SwigType_istemplate(ss)) {
|
||||||
String *st = ss;
|
SwigType *ty = Swig_symbol_template_deftype(ss,0);
|
||||||
ss = Swig_cparse_template_deftype(st, 0);
|
Delete(ss);
|
||||||
|
ss = ty;
|
||||||
s = ss;
|
s = ss;
|
||||||
Delete(st);
|
|
||||||
}
|
}
|
||||||
|
Delete(sr);
|
||||||
|
|
||||||
lt = SwigType_ltype(s);
|
lt = SwigType_ltype(s);
|
||||||
result = SwigType_prefix(lt);
|
result = SwigType_prefix(lt);
|
||||||
base = SwigType_base(lt);
|
base = SwigType_base(lt);
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ extern void SwigType_add_function(SwigType *t, ParmList *parms);
|
||||||
extern void SwigType_add_template(SwigType *t, ParmList *parms);
|
extern void SwigType_add_template(SwigType *t, ParmList *parms);
|
||||||
extern SwigType *SwigType_pop_function(SwigType *t);
|
extern SwigType *SwigType_pop_function(SwigType *t);
|
||||||
extern ParmList *SwigType_function_parms(SwigType *t);
|
extern ParmList *SwigType_function_parms(SwigType *t);
|
||||||
extern List *SwigType_split(SwigType *t);
|
extern List *SwigType_split(const SwigType *t);
|
||||||
extern String *SwigType_pop(SwigType *t);
|
extern String *SwigType_pop(SwigType *t);
|
||||||
extern void SwigType_push(SwigType *t, SwigType *s);
|
extern void SwigType_push(SwigType *t, SwigType *s);
|
||||||
extern List *SwigType_parmlist(const SwigType *p);
|
extern List *SwigType_parmlist(const SwigType *p);
|
||||||
|
|
@ -253,12 +253,12 @@ extern int SwigType_istemplate(const SwigType *t);
|
||||||
extern int SwigType_isenum(SwigType *t);
|
extern int SwigType_isenum(SwigType *t);
|
||||||
extern int SwigType_check_decl(SwigType *t, const String_or_char *decl);
|
extern int SwigType_check_decl(SwigType *t, const String_or_char *decl);
|
||||||
extern SwigType *SwigType_strip_qualifiers(SwigType *t);
|
extern SwigType *SwigType_strip_qualifiers(SwigType *t);
|
||||||
extern String *SwigType_base(SwigType *t);
|
extern String *SwigType_base(const SwigType *t);
|
||||||
extern String *SwigType_namestr(const SwigType *t);
|
extern String *SwigType_namestr(const SwigType *t);
|
||||||
extern String *SwigType_templateprefix(SwigType *t);
|
extern String *SwigType_templateprefix(const SwigType *t);
|
||||||
extern String *SwigType_templatesuffix(const SwigType *t);
|
extern String *SwigType_templatesuffix(const SwigType *t);
|
||||||
extern String *SwigType_templateargs(SwigType *t);
|
extern String *SwigType_templateargs(const SwigType *t);
|
||||||
extern String *SwigType_prefix(SwigType *t);
|
extern String *SwigType_prefix(const SwigType *t);
|
||||||
extern int SwigType_array_ndim(SwigType *t);
|
extern int SwigType_array_ndim(SwigType *t);
|
||||||
extern String *SwigType_array_getdim(SwigType *t, int n);
|
extern String *SwigType_array_getdim(SwigType *t, int n);
|
||||||
extern void SwigType_array_setdim(SwigType *t, int n, const String_or_char *rep);
|
extern void SwigType_array_setdim(SwigType *t, int n, const String_or_char *rep);
|
||||||
|
|
@ -267,6 +267,9 @@ extern String *SwigType_default(SwigType *t);
|
||||||
extern void SwigType_typename_replace(SwigType *t, String *pat, String *rep);
|
extern void SwigType_typename_replace(SwigType *t, String *pat, String *rep);
|
||||||
extern SwigType *SwigType_alttype(SwigType *t, int ltmap);
|
extern SwigType *SwigType_alttype(SwigType *t, int ltmap);
|
||||||
|
|
||||||
|
extern void SwigType_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *tsdecl);
|
||||||
|
extern SwigType* SwigType_template_deftype(const SwigType *type, Symtab *tscope);
|
||||||
|
|
||||||
/* --- Type-system managment --- */
|
/* --- Type-system managment --- */
|
||||||
extern void SwigType_typesystem_init();
|
extern void SwigType_typesystem_init();
|
||||||
extern int SwigType_typedef(SwigType *type, String_or_char *name);
|
extern int SwigType_typedef(SwigType *type, String_or_char *name);
|
||||||
|
|
@ -316,10 +319,14 @@ extern Node *Swig_symbol_isoverloaded(Node *node);
|
||||||
extern void Swig_symbol_remove(Node *node);
|
extern void Swig_symbol_remove(Node *node);
|
||||||
extern void Swig_symbol_alias(String_or_char *aliasname, Symtab *tab);
|
extern void Swig_symbol_alias(String_or_char *aliasname, Symtab *tab);
|
||||||
extern void Swig_symbol_inherit(Symtab *tab);
|
extern void Swig_symbol_inherit(Symtab *tab);
|
||||||
extern SwigType *Swig_symbol_type_qualify(SwigType *ty, Symtab *tab);
|
extern SwigType *Swig_symbol_type_qualify(const SwigType *ty, Symtab *tab);
|
||||||
extern String *Swig_symbol_string_qualify(String *s, Symtab *tab);
|
extern String *Swig_symbol_string_qualify(String *s, Symtab *tab);
|
||||||
extern SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab);
|
extern SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab);
|
||||||
|
|
||||||
|
extern void Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *tsdecl);
|
||||||
|
extern SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope);
|
||||||
|
extern SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab);
|
||||||
|
|
||||||
/* --- Parameters and Parameter Lists --- */
|
/* --- Parameters and Parameter Lists --- */
|
||||||
|
|
||||||
/* Parameters are really just hidden behind a DOH object. The following
|
/* Parameters are really just hidden behind a DOH object. The following
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ char cvsroot_symbol_c[] = "$Header$";
|
||||||
#include "swigwarn.h"
|
#include "swigwarn.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
/*#define SWIG_DEBUG*/
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* Synopsis
|
* Synopsis
|
||||||
*
|
*
|
||||||
|
|
@ -433,6 +434,17 @@ Swig_symbol_cadd(String_or_char *name, Node *n) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!name) return;
|
if (!name) return;
|
||||||
|
if (SwigType_istemplate(name)) {
|
||||||
|
String *dname = Swig_symbol_template_deftype(name,0);
|
||||||
|
if (Strcmp(dname,name)) {
|
||||||
|
Swig_symbol_cadd(dname, n);
|
||||||
|
}
|
||||||
|
Delete(dname);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_cadd %s %x\n", name, n);
|
||||||
|
#endif
|
||||||
cn = Getattr(ccurrent,name);
|
cn = Getattr(ccurrent,name);
|
||||||
|
|
||||||
if (cn && (Getattr(cn,"sym:typename"))) {
|
if (cn && (Getattr(cn,"sym:typename"))) {
|
||||||
|
|
@ -558,7 +570,7 @@ Swig_symbol_add(String_or_char *symname, Node *n) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
name = Getattr(n,"name");
|
name = Getattr(n,"name");
|
||||||
if (name) {
|
if (name && Len(name)) {
|
||||||
Swig_symbol_cadd(name,n);
|
Swig_symbol_cadd(name,n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -746,11 +758,16 @@ symbol_lookup(String_or_char *name, Symtab *symtab, int (*check)(Node *n)) {
|
||||||
Node *n;
|
Node *n;
|
||||||
List *inherit;
|
List *inherit;
|
||||||
Hash *sym = Getattr(symtab,"csymtab");
|
Hash *sym = Getattr(symtab,"csymtab");
|
||||||
|
|
||||||
if (Getmark(symtab)) return 0;
|
if (Getmark(symtab)) return 0;
|
||||||
Setmark(symtab,1);
|
Setmark(symtab,1);
|
||||||
|
|
||||||
|
|
||||||
n = Getattr(sym,name);
|
n = Getattr(sym,name);
|
||||||
|
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_look %s %x %x %s\n", name, n, symtab, Getattr(symtab,"name"));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
/* if a check-function is defined. Call it to determine a match */
|
/* if a check-function is defined. Call it to determine a match */
|
||||||
if (check) {
|
if (check) {
|
||||||
|
|
@ -770,6 +787,17 @@ symbol_lookup(String_or_char *name, Symtab *symtab, int (*check)(Node *n)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!n && SwigType_istemplate(name)) {
|
||||||
|
String *dname = 0;
|
||||||
|
Setmark(symtab,0);
|
||||||
|
dname = Swig_symbol_template_deftype(name,symtab);
|
||||||
|
if (Strcmp(name,dname)) {
|
||||||
|
n = symbol_lookup(dname, symtab, check);
|
||||||
|
}
|
||||||
|
Delete(dname);
|
||||||
|
if (n) return n;
|
||||||
|
}
|
||||||
|
|
||||||
inherit = Getattr(symtab,"inherit");
|
inherit = Getattr(symtab,"inherit");
|
||||||
if (inherit) {
|
if (inherit) {
|
||||||
int i,len;
|
int i,len;
|
||||||
|
|
@ -782,6 +810,7 @@ symbol_lookup(String_or_char *name, Symtab *symtab, int (*check)(Node *n)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Setmark(symtab,0);
|
Setmark(symtab,0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -825,6 +854,7 @@ symbol_lookup_qualified(String_or_char *name, Symtab *symtab, String *prefix, in
|
||||||
if (!name) return st;
|
if (!name) return st;
|
||||||
n = symbol_lookup(name, st,checkfunc);
|
n = symbol_lookup(name, st,checkfunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
Delete(qname);
|
Delete(qname);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
if (!local) {
|
if (!local) {
|
||||||
|
|
@ -936,6 +966,7 @@ Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc)(Node
|
||||||
if (Swig_scopename_check(nname)) {
|
if (Swig_scopename_check(nname)) {
|
||||||
s = symbol_lookup_qualified(nname,global_scope,0,0,checkfunc);
|
s = symbol_lookup_qualified(nname,global_scope,0,0,checkfunc);
|
||||||
}
|
}
|
||||||
|
Delete(nname);
|
||||||
} else {
|
} else {
|
||||||
String *prefix = Swig_scopename_prefix(name);
|
String *prefix = Swig_scopename_prefix(name);
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
|
|
@ -993,7 +1024,11 @@ Swig_symbol_clookup_local(String_or_char *name, Symtab *n) {
|
||||||
|
|
||||||
if (Swig_scopename_check(name)) {
|
if (Swig_scopename_check(name)) {
|
||||||
if (Strncmp(name,"::",2) == 0) {
|
if (Strncmp(name,"::",2) == 0) {
|
||||||
s = symbol_lookup_qualified(Char(name)+2,global_scope,0,0,0);
|
String *nname = NewString(Char(name)+2);
|
||||||
|
if (Swig_scopename_check(nname)) {
|
||||||
|
s = symbol_lookup_qualified(nname,global_scope,0,0,0);
|
||||||
|
}
|
||||||
|
Delete(nname);
|
||||||
} else {
|
} else {
|
||||||
s = symbol_lookup_qualified(name,hsym,0,0,0);
|
s = symbol_lookup_qualified(name,hsym,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
@ -1036,7 +1071,11 @@ Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*checkfunc
|
||||||
|
|
||||||
if (Swig_scopename_check(name)) {
|
if (Swig_scopename_check(name)) {
|
||||||
if (Strncmp(name,"::",2) == 0) {
|
if (Strncmp(name,"::",2) == 0) {
|
||||||
s = symbol_lookup_qualified(Char(name)+2,global_scope,0,0,checkfunc);
|
String *nname = NewString(Char(name)+2);
|
||||||
|
if (Swig_scopename_check(nname)) {
|
||||||
|
s = symbol_lookup_qualified(nname,global_scope,0,0,checkfunc);
|
||||||
|
}
|
||||||
|
Delete(nname);
|
||||||
} else {
|
} else {
|
||||||
s = symbol_lookup_qualified(name,hsym,0,0,checkfunc);
|
s = symbol_lookup_qualified(name,hsym,0,0,checkfunc);
|
||||||
}
|
}
|
||||||
|
|
@ -1161,6 +1200,9 @@ Swig_symbol_qualified(Node *n) {
|
||||||
symtab = Getattr(n,"sym:symtab");
|
symtab = Getattr(n,"sym:symtab");
|
||||||
}
|
}
|
||||||
if (!symtab) return NewString("");
|
if (!symtab) return NewString("");
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_qscope %s %x %s\n", Getattr(n,"name"), symtab,Getattr(symtab,"name"));
|
||||||
|
#endif
|
||||||
return Swig_symbol_qualifiedscopename(symtab);
|
return Swig_symbol_qualifiedscopename(symtab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1181,8 +1223,48 @@ Swig_symbol_isoverloaded(Node *n) {
|
||||||
* Create a fully qualified type name
|
* Create a fully qualified type name
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static int no_constructor(Node *n) {
|
||||||
|
SwigType *type = nodeType(n);
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"node type %s\n", Getattr(n,"name"), type);
|
||||||
|
#endif
|
||||||
|
return type ? (Strcmp(type,"constructor") != 0): 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static SwigType *
|
||||||
|
Swig_symbol_template_qualify(const SwigType *e, Symtab *st) {
|
||||||
|
String *tprefix, *tsuffix;
|
||||||
|
SwigType *qprefix;
|
||||||
|
List *targs;
|
||||||
|
Iterator ti;
|
||||||
|
tprefix = SwigType_templateprefix(e);
|
||||||
|
tsuffix = SwigType_templatesuffix(e);
|
||||||
|
qprefix = Swig_symbol_type_qualify(tprefix,st);
|
||||||
|
targs = SwigType_parmlist(e);
|
||||||
|
Printf(qprefix,"<(");
|
||||||
|
for (ti = First(targs); ti.item;) {
|
||||||
|
String *qparm = Swig_symbol_type_qualify(ti.item,st);
|
||||||
|
String *vparm = Swig_symbol_template_param_eval(qparm, st);
|
||||||
|
Append(qprefix,vparm);
|
||||||
|
ti = Next(ti);
|
||||||
|
if (ti.item) {
|
||||||
|
Putc(',',qprefix);
|
||||||
|
}
|
||||||
|
Delete(qparm);
|
||||||
|
Delete(vparm);
|
||||||
|
}
|
||||||
|
Append(qprefix,")>");
|
||||||
|
Append(qprefix,tsuffix);
|
||||||
|
Delete(tprefix);
|
||||||
|
Delete(tsuffix);
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_temp_qual %s %s\n", e, qprefix);
|
||||||
|
#endif
|
||||||
|
return qprefix;
|
||||||
|
}
|
||||||
|
|
||||||
SwigType *
|
SwigType *
|
||||||
Swig_symbol_type_qualify(SwigType *t, Symtab *st) {
|
Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
|
||||||
List *elements;
|
List *elements;
|
||||||
String *result;
|
String *result;
|
||||||
int i,len;
|
int i,len;
|
||||||
|
|
@ -1194,75 +1276,29 @@ Swig_symbol_type_qualify(SwigType *t, Symtab *st) {
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
String *e = Getitem(elements,i);
|
String *e = Getitem(elements,i);
|
||||||
if (SwigType_issimple(e)) {
|
if (SwigType_issimple(e)) {
|
||||||
Node *n = Swig_symbol_clookup(e,st);
|
Node *n = Swig_symbol_clookup_check(e,st,no_constructor);
|
||||||
if (n) {
|
if (n) {
|
||||||
String *name = Getattr(n,"name");
|
String *name = Getattr(n,"name");
|
||||||
Clear(e);
|
Clear(e);
|
||||||
Append(e,name);
|
Append(e,name);
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_qual_ei %d %s %s %x\n", i, name, e, st);
|
||||||
|
#endif
|
||||||
if (!Swig_scopename_check(name)) {
|
if (!Swig_scopename_check(name)) {
|
||||||
String *qname = Swig_symbol_qualified(n);
|
String *qname = Swig_symbol_qualified(n);
|
||||||
if (Len(qname)) {
|
if (Len(qname)) {
|
||||||
Insert(e,0,"::");
|
Insert(e,0,"::");
|
||||||
Insert(e,0,qname);
|
Insert(e,0,qname);
|
||||||
}
|
}
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_qual_sc %d %s %s %x\n", i, qname, e, st);
|
||||||
|
#endif
|
||||||
Delete(qname);
|
Delete(qname);
|
||||||
}
|
}
|
||||||
} else if (SwigType_istemplate(e)) {
|
} else if (SwigType_istemplate(e)) {
|
||||||
String *tprefix, *tsuffix;
|
SwigType *ty = Swig_symbol_template_qualify(e,st);
|
||||||
SwigType *qprefix;
|
|
||||||
List *targs;
|
|
||||||
Iterator ti;
|
|
||||||
tprefix = SwigType_templateprefix(e);
|
|
||||||
tsuffix = SwigType_templatesuffix(e);
|
|
||||||
qprefix = Swig_symbol_type_qualify(tprefix,st);
|
|
||||||
targs = SwigType_parmlist(e);
|
|
||||||
Printf(qprefix,"<(");
|
|
||||||
for (ti = First(targs); ti.item;) {
|
|
||||||
String *qparm = Swig_symbol_type_qualify(ti.item,st);
|
|
||||||
while (1) {
|
|
||||||
/* It is possible for an integer to show up here. If so, we need to evaluate it */
|
|
||||||
Node *nn = Swig_symbol_clookup(qparm,st);
|
|
||||||
if (nn) {
|
|
||||||
SwigType *nt = nodeType(nn);
|
|
||||||
if (Strcmp(nt,"cdecl") == 0) {
|
|
||||||
String *nv = Getattr(nn,"value");
|
|
||||||
if (nv) {
|
|
||||||
Clear(qparm);
|
|
||||||
Append(qparm,nv);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (Strcmp(nt,"enumitem") == 0) {
|
|
||||||
String *qn = Swig_symbol_qualified(nn);
|
|
||||||
if (Len(qn)) {
|
|
||||||
Append(qn,"::");
|
|
||||||
Append(qn,Getattr(nn,"name"));
|
|
||||||
Clear(qparm);
|
|
||||||
Append(qparm,qn);
|
|
||||||
}
|
|
||||||
Delete(qn);
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Append(qprefix,qparm);
|
|
||||||
ti = Next(ti);
|
|
||||||
if (ti.item) {
|
|
||||||
Putc(',',qprefix);
|
|
||||||
}
|
|
||||||
Delete(qparm);
|
|
||||||
}
|
|
||||||
Append(qprefix,")>");
|
|
||||||
Append(qprefix,tsuffix);
|
|
||||||
Clear(e);
|
Clear(e);
|
||||||
Append(e,qprefix);
|
Append(e,ty);
|
||||||
Delete(tprefix);
|
|
||||||
Delete(tsuffix);
|
|
||||||
Delete(qprefix);
|
|
||||||
}
|
}
|
||||||
if (Strncmp(e,"::",2) == 0) {
|
if (Strncmp(e,"::",2) == 0) {
|
||||||
Delitem(e,0);
|
Delitem(e,0);
|
||||||
|
|
@ -1289,6 +1325,9 @@ Swig_symbol_type_qualify(SwigType *t, Symtab *st) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Delete(elements);
|
Delete(elements);
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_qualify %s %s %x %s\n", t, result, st, st ?Getattr(st,"name"): 0);
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1298,6 +1337,48 @@ Swig_symbol_type_qualify(SwigType *t, Symtab *st) {
|
||||||
* Chase a typedef through symbol tables looking for a match.
|
* Chase a typedef through symbol tables looking for a match.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static
|
||||||
|
SwigType *Swig_symbol_template_reduce(SwigType *qt, Symtab *ntab)
|
||||||
|
{
|
||||||
|
Iterator pi;
|
||||||
|
Parm *p;
|
||||||
|
List *parms = SwigType_parmlist(qt);
|
||||||
|
String *tprefix = SwigType_templateprefix(qt);
|
||||||
|
String *tsuffix = SwigType_templatesuffix(qt);
|
||||||
|
String *qprefix = SwigType_typedef_qualified(tprefix);
|
||||||
|
Printv(qprefix,"<(",NIL);
|
||||||
|
pi = First(parms);
|
||||||
|
while ((p = pi.item)) {
|
||||||
|
String *np;
|
||||||
|
String *tp = Swig_symbol_typedef_reduce(p, ntab);
|
||||||
|
String *qp = Swig_symbol_type_qualify(tp, ntab);
|
||||||
|
Node *n = Swig_symbol_clookup(qp,ntab);
|
||||||
|
if (n) {
|
||||||
|
String *qual = Swig_symbol_qualified(n);
|
||||||
|
np = Copy(Getattr(n,"name"));
|
||||||
|
tp = np;
|
||||||
|
if (qual) {
|
||||||
|
Insert(np,0,"::");
|
||||||
|
Insert(np,0,qual);
|
||||||
|
Delete(qual);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
np = qp;
|
||||||
|
}
|
||||||
|
Append(qprefix,np);
|
||||||
|
pi= Next(pi);
|
||||||
|
if (pi.item) {
|
||||||
|
Append(qprefix,",");
|
||||||
|
}
|
||||||
|
Delete(qp);
|
||||||
|
Delete(tp);
|
||||||
|
}
|
||||||
|
Append(qprefix,")>");
|
||||||
|
Insert(tsuffix, 0, qprefix);
|
||||||
|
return tsuffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
|
SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
|
||||||
SwigType *prefix, *base;
|
SwigType *prefix, *base;
|
||||||
Node *n;
|
Node *n;
|
||||||
|
|
@ -1309,8 +1390,20 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
|
||||||
n = Swig_symbol_clookup(base,tab);
|
n = Swig_symbol_clookup(base,tab);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
Delete(base);
|
Delete(base);
|
||||||
Delete(prefix);
|
if (SwigType_istemplate(ty)) {
|
||||||
return Copy(ty);
|
SwigType *qt = Swig_symbol_template_reduce(ty,tab);
|
||||||
|
Append(prefix,qt);
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_reduce %s %s\n", ty, prefix);
|
||||||
|
#endif
|
||||||
|
return prefix;
|
||||||
|
} else {
|
||||||
|
Delete(prefix);
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_reduce %s %s\n", ty, ty);
|
||||||
|
#endif
|
||||||
|
return Copy(ty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Strcmp(nodeType(n),"using") == 0) {
|
if (Strcmp(nodeType(n),"using") == 0) {
|
||||||
String *uname = Getattr(n,"uname");
|
String *uname = Getattr(n,"uname");
|
||||||
|
|
@ -1319,6 +1412,9 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
|
||||||
if (!n) {
|
if (!n) {
|
||||||
Delete(base);
|
Delete(base);
|
||||||
Delete(prefix);
|
Delete(prefix);
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_reduce %s %s\n", ty, ty);
|
||||||
|
#endif
|
||||||
return Copy(ty);
|
return Copy(ty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1354,52 +1450,23 @@ SwigType *Swig_symbol_typedef_reduce(SwigType *ty, Symtab *tab) {
|
||||||
rt = Swig_symbol_typedef_reduce(nt, ntab);
|
rt = Swig_symbol_typedef_reduce(nt, ntab);
|
||||||
qt = Swig_symbol_type_qualify(rt, ntab);
|
qt = Swig_symbol_type_qualify(rt, ntab);
|
||||||
if (SwigType_istemplate(qt)) {
|
if (SwigType_istemplate(qt)) {
|
||||||
Iterator pi;
|
SwigType *qtr = Swig_symbol_template_reduce(qt,ntab);
|
||||||
Parm *p;
|
|
||||||
List *parms = SwigType_parmlist(qt);
|
|
||||||
String *tprefix = SwigType_templateprefix(qt);
|
|
||||||
String *tsuffix = SwigType_templatesuffix(qt);
|
|
||||||
String *qprefix = SwigType_typedef_qualified(tprefix);
|
|
||||||
Printv(qprefix,"<(",NIL);
|
|
||||||
pi = First(parms);
|
|
||||||
while ((p = pi.item)) {
|
|
||||||
String *np;
|
|
||||||
String *tp = 0;
|
|
||||||
String *qp = Swig_symbol_type_qualify(p, ntab);
|
|
||||||
Node *n = Swig_symbol_clookup(qp,ntab);
|
|
||||||
if (n) {
|
|
||||||
String *qual = Swig_symbol_qualified(n);
|
|
||||||
np = Copy(Getattr(n,"name"));
|
|
||||||
tp = np;
|
|
||||||
if (qual) {
|
|
||||||
Insert(np,0,"::");
|
|
||||||
Insert(np,0,qual);
|
|
||||||
Delete(qual);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
np = qp;
|
|
||||||
}
|
|
||||||
Append(qprefix,np);
|
|
||||||
pi= Next(pi);
|
|
||||||
if (pi.item) {
|
|
||||||
Append(qprefix,",");
|
|
||||||
}
|
|
||||||
Delete(qp);
|
|
||||||
Delete(tp);
|
|
||||||
}
|
|
||||||
Append(qprefix,")>");
|
|
||||||
Insert(tsuffix, 0, qprefix);
|
|
||||||
Delete(qt);
|
Delete(qt);
|
||||||
qt = tsuffix;
|
qt = qtr;
|
||||||
}
|
}
|
||||||
Delete(nt);
|
Delete(nt);
|
||||||
Delete(rt);
|
Delete(rt);
|
||||||
/* Printf(stderr,"reduce %s %s\n", ty, qt); */
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_reduce %s %s\n", qt, ty);
|
||||||
|
#endif
|
||||||
return qt;
|
return qt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Delete(base);
|
Delete(base);
|
||||||
Delete(prefix);
|
Delete(prefix);
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"symbol_reduce %s %s\n", ty, ty);
|
||||||
|
#endif
|
||||||
return Copy(ty);
|
return Copy(ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1446,3 +1513,154 @@ Swig_symbol_string_qualify(String *s, Symtab *st) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* Swig_symbol_template_defargs()
|
||||||
|
*
|
||||||
|
* Apply default arg from generic template default args
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *tsdecl) {
|
||||||
|
if (Len(parms) < Len(targs)) {
|
||||||
|
Parm *lp = parms;
|
||||||
|
Parm *p = lp;
|
||||||
|
Parm *tp = targs;
|
||||||
|
while(p && tp) {
|
||||||
|
p = nextSibling(p);
|
||||||
|
tp = nextSibling(tp);
|
||||||
|
if (p) lp = p;
|
||||||
|
}
|
||||||
|
while (tp) {
|
||||||
|
String *value = Getattr(tp,"value");
|
||||||
|
if (value) {
|
||||||
|
Parm *cp;
|
||||||
|
Parm *ta = targs;
|
||||||
|
Parm *p = parms;
|
||||||
|
SwigType *nt = Swig_symbol_string_qualify(value,tsdecl);
|
||||||
|
SwigType *ntq = 0;
|
||||||
|
#ifdef SWIG_DEBUG
|
||||||
|
Printf(stderr,"value %s %s %s\n",value, nt,tsdecl?Getattr(tsdecl,"name") : tsdecl);
|
||||||
|
#endif
|
||||||
|
while(p && ta) {
|
||||||
|
String *name = Getattr(ta,"name");
|
||||||
|
String *value = Getattr(p,"value") ? Getattr(p,"value") : Getattr(p,"type");
|
||||||
|
String *ttq = Swig_symbol_type_qualify(value,tscope);
|
||||||
|
/* value = SwigType_typedef_resolve_all(value);*/
|
||||||
|
Replaceid(nt, name, ttq);
|
||||||
|
p = nextSibling(p);
|
||||||
|
ta = nextSibling(ta);
|
||||||
|
Delete(ttq);
|
||||||
|
}
|
||||||
|
ntq = Swig_symbol_type_qualify(nt,tsdecl);
|
||||||
|
if (SwigType_istemplate(ntq)) {
|
||||||
|
String *ty = Swig_symbol_template_deftype(ntq, tscope);
|
||||||
|
Delete(ntq);
|
||||||
|
ntq = ty;
|
||||||
|
}
|
||||||
|
/* Printf(stderr,"value %s %s %s\n",value,ntr,ntq);*/
|
||||||
|
cp = NewParm(ntq,0);
|
||||||
|
set_nextSibling(lp,cp);
|
||||||
|
lp = cp;
|
||||||
|
tp = nextSibling(tp);
|
||||||
|
Delete(nt);
|
||||||
|
Delete(ntq);
|
||||||
|
} else {
|
||||||
|
tp = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* Swig_symbol_template_deftype()
|
||||||
|
*
|
||||||
|
* Apply default args to generic template type
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
SwigType*
|
||||||
|
Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
|
||||||
|
String *result = 0;
|
||||||
|
String *prefix = SwigType_prefix(type);
|
||||||
|
String *base = SwigType_base(type);
|
||||||
|
String *tprefix = SwigType_templateprefix(base);
|
||||||
|
String *targs = SwigType_templateargs(base);
|
||||||
|
String *tsuffix = SwigType_templatesuffix(base);
|
||||||
|
ParmList *tparms = SwigType_function_parms(targs);
|
||||||
|
Node *tempn = Swig_symbol_clookup_local(tprefix,tscope);
|
||||||
|
/* Printf(stderr,"deftype type %s \n", type);*/
|
||||||
|
if (tempn) {
|
||||||
|
ParmList *tnargs = Getattr(tempn,"templateparms");
|
||||||
|
Parm *p;
|
||||||
|
Symtab *tsdecl = Getattr(tempn,"sym:symtab");
|
||||||
|
|
||||||
|
/* Printf(stderr,"deftype type %s %s %s %s\n", tprefix, targs, tsuffix);*/
|
||||||
|
Append(tprefix,"<(");
|
||||||
|
Swig_symbol_template_defargs(tparms, tnargs,tscope,tsdecl);
|
||||||
|
p = tparms;
|
||||||
|
while (p) {
|
||||||
|
SwigType *ptype = Getattr(p,"type");
|
||||||
|
SwigType *ttr = ptype ? ptype : Getattr(p,"value");
|
||||||
|
SwigType *ttf = Swig_symbol_type_qualify(ttr,tscope);
|
||||||
|
SwigType *ttq = Swig_symbol_template_param_eval(ttf,tscope);
|
||||||
|
SwigType *ttd = 0;
|
||||||
|
if (SwigType_istemplate(ttq)) {
|
||||||
|
ttd = Swig_symbol_template_deftype(ttq, tscope);
|
||||||
|
ttq = ttd;
|
||||||
|
}
|
||||||
|
Append(tprefix,ttq);
|
||||||
|
p = nextSibling(p);
|
||||||
|
if (p) Putc(',',tprefix);
|
||||||
|
Delete(ttr);
|
||||||
|
Delete(ttf);
|
||||||
|
Delete(ttd);
|
||||||
|
}
|
||||||
|
Append(tprefix,")>");
|
||||||
|
Append(tprefix,tsuffix);
|
||||||
|
Append(prefix,tprefix);
|
||||||
|
/* Printf(stderr,"deftype %s %s \n", type, tprefix); */
|
||||||
|
result = Copy(prefix);
|
||||||
|
} else {
|
||||||
|
result = Copy(type);
|
||||||
|
}
|
||||||
|
Delete(prefix);
|
||||||
|
Delete(base);
|
||||||
|
Delete(tprefix);
|
||||||
|
Delete(tsuffix);
|
||||||
|
Delete(targs);
|
||||||
|
Delete(tparms);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symtab)
|
||||||
|
{
|
||||||
|
String *value = Copy(p);
|
||||||
|
Node *lastnode = 0;
|
||||||
|
while (1) {
|
||||||
|
Node *n = Swig_symbol_clookup(value,symtab);
|
||||||
|
if (n == lastnode) break;
|
||||||
|
lastnode = n;
|
||||||
|
if (n) {
|
||||||
|
if (Strcmp(nodeType(n),"enumitem") == 0) {
|
||||||
|
/* An enum item. Generate a fully qualified name */
|
||||||
|
String *qn = Swig_symbol_qualified(n);
|
||||||
|
if (Len(qn)) {
|
||||||
|
Append(qn,"::");
|
||||||
|
Append(qn,Getattr(n,"name"));
|
||||||
|
Delete(value);
|
||||||
|
value = qn;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
Delete(qn);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if ((Strcmp(nodeType(n),"cdecl") == 0) && (Getattr(n,"value"))) {
|
||||||
|
Delete(value);
|
||||||
|
value = Copy(Getattr(n,"value"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,12 +51,14 @@ static Hash* get_typemap(int tm_scope, SwigType* type)
|
||||||
Hash *tm = 0;
|
Hash *tm = 0;
|
||||||
SwigType* dtype = 0;
|
SwigType* dtype = 0;
|
||||||
if (SwigType_istemplate(type)) {
|
if (SwigType_istemplate(type)) {
|
||||||
dtype = Swig_cparse_template_deftype(type,0);
|
String *ty = Swig_symbol_template_deftype(type,0);
|
||||||
|
dtype = Swig_symbol_type_qualify(ty,0);
|
||||||
/* Printf(stderr,"gettm %s %s\n", type, dtype);*/
|
/* Printf(stderr,"gettm %s %s\n", type, dtype);*/
|
||||||
type = dtype;
|
type = dtype;
|
||||||
|
Delete(ty);
|
||||||
}
|
}
|
||||||
tm = Getattr(typemaps[tm_scope],type);
|
tm = Getattr(typemaps[tm_scope],type);
|
||||||
if (dtype) Delete(dtype);
|
Delete(dtype);
|
||||||
return tm;
|
return tm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,12 +66,14 @@ static void set_typemap(int tm_scope, SwigType* type, Hash* tm)
|
||||||
{
|
{
|
||||||
SwigType* dtype = 0;
|
SwigType* dtype = 0;
|
||||||
if (SwigType_istemplate(type)) {
|
if (SwigType_istemplate(type)) {
|
||||||
dtype = Swig_cparse_template_deftype(type,0);
|
String *ty = Swig_symbol_template_deftype(type,0);
|
||||||
|
dtype = Swig_symbol_type_qualify(ty,0);
|
||||||
/* Printf(stderr,"settm %s %s\n", type, dtype);*/
|
/* Printf(stderr,"settm %s %s\n", type, dtype);*/
|
||||||
type = dtype;
|
type = dtype;
|
||||||
|
Delete(ty);
|
||||||
}
|
}
|
||||||
Setattr(typemaps[tm_scope],Copy(type),tm);
|
Setattr(typemaps[tm_scope],Copy(type),tm);
|
||||||
if (dtype) Delete(dtype);
|
Delete(dtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ SwigType_parm(SwigType *t) {
|
||||||
* Splits a type into it's component parts and returns a list of string.
|
* Splits a type into it's component parts and returns a list of string.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
List *SwigType_split(SwigType *t) {
|
List *SwigType_split(const SwigType *t) {
|
||||||
DOH *item;
|
DOH *item;
|
||||||
List *list;
|
List *list;
|
||||||
char *c;
|
char *c;
|
||||||
|
|
@ -769,8 +769,9 @@ SwigType_add_template(SwigType *t, ParmList *parms) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
String *
|
String *
|
||||||
SwigType_templateprefix(SwigType *t) {
|
SwigType_templateprefix(const SwigType *t) {
|
||||||
char *c,*s;
|
const char *c;
|
||||||
|
const char *s;
|
||||||
|
|
||||||
s = Char(t);
|
s = Char(t);
|
||||||
c = s;
|
c = s;
|
||||||
|
|
@ -796,7 +797,7 @@ SwigType_templateprefix(SwigType *t) {
|
||||||
|
|
||||||
String *
|
String *
|
||||||
SwigType_templatesuffix(const SwigType *t) {
|
SwigType_templatesuffix(const SwigType *t) {
|
||||||
char *c;
|
const char *c;
|
||||||
c = Char(t);
|
c = Char(t);
|
||||||
while (*c) {
|
while (*c) {
|
||||||
if ((*c == '<') && (*(c+1) == '(')) {
|
if ((*c == '<') && (*(c+1) == '(')) {
|
||||||
|
|
@ -821,9 +822,9 @@ SwigType_templatesuffix(const SwigType *t) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
String *
|
String *
|
||||||
SwigType_templateargs(SwigType *t) {
|
SwigType_templateargs(const SwigType *t) {
|
||||||
char *c;
|
const char *c;
|
||||||
char *start;
|
const char *start;
|
||||||
c = Char(t);
|
c = Char(t);
|
||||||
while (*c) {
|
while (*c) {
|
||||||
if ((*c == '<') && (*(c+1) == '(')) {
|
if ((*c == '<') && (*(c+1) == '(')) {
|
||||||
|
|
@ -862,7 +863,7 @@ SwigType_istemplate(const SwigType *t) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
SwigType *
|
SwigType *
|
||||||
SwigType_base(SwigType *t) {
|
SwigType_base(const SwigType *t) {
|
||||||
char *c;
|
char *c;
|
||||||
char *lastop = 0;
|
char *lastop = 0;
|
||||||
c = Char(t);
|
c = Char(t);
|
||||||
|
|
@ -915,7 +916,7 @@ SwigType_base(SwigType *t) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
String *
|
String *
|
||||||
SwigType_prefix(SwigType *t) {
|
SwigType_prefix(const SwigType *t) {
|
||||||
char *c, *d;
|
char *c, *d;
|
||||||
String *r = 0;
|
String *r = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -862,6 +862,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t)
|
||||||
elements = SwigType_split(t);
|
elements = SwigType_split(t);
|
||||||
len = Len(elements);
|
len = Len(elements);
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
|
String *ty = 0;
|
||||||
String *e = Getitem(elements,i);
|
String *e = Getitem(elements,i);
|
||||||
if (SwigType_issimple(e)) {
|
if (SwigType_issimple(e)) {
|
||||||
if (!SwigType_istemplate(e)) {
|
if (!SwigType_istemplate(e)) {
|
||||||
|
|
@ -927,7 +928,10 @@ SwigType *SwigType_typedef_qualified(SwigType *t)
|
||||||
String *tsuffix;
|
String *tsuffix;
|
||||||
Iterator pi;
|
Iterator pi;
|
||||||
Parm *p;
|
Parm *p;
|
||||||
List *parms = SwigType_parmlist(e);
|
List *parms;
|
||||||
|
ty = Swig_symbol_template_deftype(e,current_symtab);
|
||||||
|
e = ty;
|
||||||
|
parms = SwigType_parmlist(e);
|
||||||
tprefix = SwigType_templateprefix(e);
|
tprefix = SwigType_templateprefix(e);
|
||||||
tsuffix = SwigType_templatesuffix(e);
|
tsuffix = SwigType_templatesuffix(e);
|
||||||
qprefix = SwigType_typedef_qualified(tprefix);
|
qprefix = SwigType_typedef_qualified(tprefix);
|
||||||
|
|
@ -996,6 +1000,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t)
|
||||||
Delitem(e,0);
|
Delitem(e,0);
|
||||||
}
|
}
|
||||||
Append(result,e);
|
Append(result,e);
|
||||||
|
Delete(ty);
|
||||||
} else if (SwigType_isfunction(e)) {
|
} else if (SwigType_isfunction(e)) {
|
||||||
List *parms = SwigType_parmlist(e);
|
List *parms = SwigType_parmlist(e);
|
||||||
String *s = NewString("f(");
|
String *s = NewString("f(");
|
||||||
|
|
@ -1588,10 +1593,14 @@ SwigType_inherit(String *derived, String *base, String *cast) {
|
||||||
/* Printf(stdout,"'%s' --> '%s' '%s'\n", derived, base, cast); */
|
/* Printf(stdout,"'%s' --> '%s' '%s'\n", derived, base, cast); */
|
||||||
|
|
||||||
if (SwigType_istemplate(derived)) {
|
if (SwigType_istemplate(derived)) {
|
||||||
derived = SwigType_typedef_qualified(SwigType_typedef_resolve_all(derived));
|
String *ty = SwigType_typedef_resolve_all(derived);
|
||||||
|
derived = SwigType_typedef_qualified(ty);
|
||||||
|
Delete(ty);
|
||||||
}
|
}
|
||||||
if (SwigType_istemplate(base)) {
|
if (SwigType_istemplate(base)) {
|
||||||
base = SwigType_typedef_qualified(SwigType_typedef_resolve_all(base));
|
String *ty = SwigType_typedef_resolve_all(base);
|
||||||
|
base = SwigType_typedef_qualified(ty);
|
||||||
|
Delete(ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Printf(stdout,"'%s' --> '%s' '%s'\n", derived, base, cast);*/
|
/* Printf(stdout,"'%s' --> '%s' '%s'\n", derived, base, cast);*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue