fixes for mixed_types.i, multidimension arrays, and arrays +references+typedefs
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6728 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
eb4f1acca0
commit
6d930e0ef0
4 changed files with 47 additions and 24 deletions
|
|
@ -264,14 +264,13 @@ Swig_cfunction_call(String_or_char *name, ParmList *parms) {
|
|||
int i = 0;
|
||||
int comma = 0;
|
||||
Parm *p = parms;
|
||||
SwigType *pt;
|
||||
String *nname;
|
||||
|
||||
func = NewString("");
|
||||
nname = SwigType_namestr(name);
|
||||
|
||||
/*
|
||||
SWIG_TEMPLATE_DESIMBUAGATOR is compiler dependent (common.swg),
|
||||
SWIG_TEMPLATE_DISAMBIGUATOR is compiler dependent (common.swg),
|
||||
- SUN Studio 9 requires 'template',
|
||||
- gcc-3.4 forbids the use of 'template'.
|
||||
the rest seems not caring very much,
|
||||
|
|
@ -292,13 +291,13 @@ Swig_cfunction_call(String_or_char *name, ParmList *parms) {
|
|||
|
||||
|
||||
while (p) {
|
||||
String *pname;
|
||||
pt = Getattr(p,"type");
|
||||
|
||||
SwigType *pt = Getattr(p,"type");
|
||||
if ((SwigType_type(pt) != T_VOID)) {
|
||||
String *pname = Swig_cparm_name(p,i);
|
||||
String *rcaststr = SwigType_rcaststr(pt, pname);
|
||||
if (comma) Printf(func,",");
|
||||
pname = Swig_cparm_name(p,i);
|
||||
Printf(func,"%s", SwigType_rcaststr(pt, pname));
|
||||
Printf(func,"%s", rcaststr);
|
||||
Delete(rcaststr);
|
||||
comma = 1;
|
||||
i++;
|
||||
}
|
||||
|
|
@ -342,7 +341,9 @@ Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self) {
|
|||
if (Strstr(func,"*this")) {
|
||||
Replaceall(func,"this", Swig_cparm_name(p,0));
|
||||
} else {
|
||||
Replaceall(func,"this", SwigType_rcaststr(pt, Swig_cparm_name(p,0)));
|
||||
String *rcaststr = SwigType_rcaststr(pt, Swig_cparm_name(p,0));
|
||||
Replaceall(func,"this", rcaststr);
|
||||
Delete(rcaststr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -360,12 +361,13 @@ Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self) {
|
|||
i++;
|
||||
p = nextSibling(p);
|
||||
while (p) {
|
||||
String *pname;
|
||||
pt = Getattr(p,"type");
|
||||
if ((SwigType_type(pt) != T_VOID)) {
|
||||
String *pname = Swig_cparm_name(p,i);
|
||||
String *rcaststr = SwigType_rcaststr(pt, pname);
|
||||
if (comma) Printf(func,",");
|
||||
pname = Swig_cparm_name(p,i);
|
||||
Printf(func,"%s", SwigType_rcaststr(pt, pname));
|
||||
Printf(func,"%s", rcaststr);
|
||||
Delete(rcaststr);
|
||||
comma = 1;
|
||||
i++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -752,17 +752,17 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
|
|||
rs = s;
|
||||
}
|
||||
|
||||
if (SwigType_issimple(rs)) {
|
||||
td = SwigType_typedef_resolve(rs);
|
||||
if ((td) && (SwigType_isconst(td) || SwigType_isarray(td) || SwigType_isreference(td))) {
|
||||
td = SwigType_typedef_resolve(rs);
|
||||
if (td) {
|
||||
if ((SwigType_isconst(td) || SwigType_isarray(td) || SwigType_isreference(td))) {
|
||||
elements = SwigType_split(td);
|
||||
} else if (td && SwigType_isenum(td)) {
|
||||
} else if (SwigType_isenum(td)) {
|
||||
elements = SwigType_split(rs);
|
||||
clear = 0;
|
||||
} else {
|
||||
elements = SwigType_split(rs);
|
||||
}
|
||||
if (td) Delete(td);
|
||||
Delete(td);
|
||||
} else {
|
||||
elements = SwigType_split(rs);
|
||||
}
|
||||
|
|
@ -838,6 +838,7 @@ String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
|
|||
Delete(parms);
|
||||
} else if (SwigType_isenum(element)) {
|
||||
String *bs = SwigType_namestr(element);
|
||||
Insert(result,0," ");
|
||||
Insert(result,0,bs);
|
||||
Delete(bs);
|
||||
clear = 0;
|
||||
|
|
|
|||
|
|
@ -750,7 +750,7 @@ void typemap_replace_vars(String *s, ParmList *locals, SwigType *type, SwigType
|
|||
String *size;
|
||||
int ndim;
|
||||
int i;
|
||||
if (!SwigType_isarray(type)) type = ftype;
|
||||
if (SwigType_array_ndim(type) != SwigType_array_ndim(ftype)) type = ftype;
|
||||
ndim = SwigType_array_ndim(type);
|
||||
size = NewString("");
|
||||
for (i = 0; i < ndim; i++) {
|
||||
|
|
|
|||
|
|
@ -547,6 +547,7 @@ typedef_resolve(Typetab *s, String *base) {
|
|||
* SwigType_typedef_resolve()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* #define SWIG_DEBUG */
|
||||
SwigType *SwigType_typedef_resolve(SwigType *t) {
|
||||
String *base;
|
||||
String *type = 0;
|
||||
|
|
@ -578,7 +579,9 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
|
|||
|
||||
base = SwigType_base(t);
|
||||
|
||||
/* Printf(stdout,"base = '%s' t='%s'\n", base, t); */
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stdout,"base = '%s' t='%s'\n", base, t);
|
||||
#endif
|
||||
|
||||
if (SwigType_issimple(base)) {
|
||||
s = current_scope;
|
||||
|
|
@ -599,7 +602,9 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
|
|||
if (Swig_scopename_check(base)) {
|
||||
/* A qualified name. */
|
||||
nameprefix = Swig_scopename_prefix(base);
|
||||
/* Printf(stdout,"nameprefix = '%s'\n", nameprefix); */
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stdout,"nameprefix = '%s'\n", nameprefix);
|
||||
#endif
|
||||
if (nameprefix) {
|
||||
/* Name had a prefix on it. See if we can locate the proper scope for it */
|
||||
s = SwigType_find_scope(s,nameprefix);
|
||||
|
|
@ -613,10 +618,22 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
|
|||
}
|
||||
/* Try to locate the name starting in the scope */
|
||||
namebase = Swig_scopename_last(base);
|
||||
/* Printf(stdout,"namebase = '%s'\n", namebase); */
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stdout,"namebase = '%s'\n", namebase);
|
||||
#endif
|
||||
type = typedef_resolve(s,namebase);
|
||||
/* Printf(stdout,"%s type = '%s'\n", Getattr(s,"name"), type); */
|
||||
if ((type) && (!Swig_scopename_check(type))) {
|
||||
if (type) {
|
||||
/* we need to look for the resolved type, this will also
|
||||
fix the resolved_scope if 'type' and 'namebase' are
|
||||
declared in different scopes */
|
||||
String *rtype = 0;
|
||||
rtype = typedef_resolve(resolved_scope,type);
|
||||
if (rtype) type = rtype;
|
||||
}
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stdout,"%s type = '%s'\n", Getattr(s,"name"), type);
|
||||
#endif
|
||||
if ((type) && (!Swig_scopename_check(type)) && resolved_scope) {
|
||||
Typetab *rtab = resolved_scope;
|
||||
String *qname = Getattr(resolved_scope,k_qname);
|
||||
/* If qualified *and* the typename is defined from the resolved scope, we qualify */
|
||||
|
|
@ -624,6 +641,9 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
|
|||
type = Copy(type);
|
||||
Insert(type,0,"::");
|
||||
Insert(type,0,qname);
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stdout,"qual %s \n", type);
|
||||
#endif
|
||||
newtype = 1;
|
||||
}
|
||||
resolved_scope = rtab;
|
||||
|
|
@ -1079,12 +1099,12 @@ int SwigType_typedef_using(String_or_char *name) {
|
|||
defined_name = Copy(defined_name);
|
||||
Append(defined_name,"::");
|
||||
Append(defined_name,base);
|
||||
/* Printf(stdout,"defined_name = '%s'\n", defined_name);*/
|
||||
tt = SwigType_find_scope(current_scope,defined_name);
|
||||
}
|
||||
}
|
||||
if (td) Delete(td);
|
||||
|
||||
/* Printf(stdout,"defined_name = '%s'\n", defined_name);*/
|
||||
tt = SwigType_find_scope(current_scope,defined_name);
|
||||
|
||||
/* Figure out the scope the using directive refers to */
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue