Numerous bug fixes. Improvements to C++
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@967 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ce983e3203
commit
cc46b7bb77
17 changed files with 255 additions and 103 deletions
|
|
@ -171,23 +171,16 @@ Swig_proto_cmp(const String_or_char *pat, DOH *node) {
|
|||
SwigType *ty;
|
||||
SwigType *ct;
|
||||
ParmList *p;
|
||||
List *tl;
|
||||
int r;
|
||||
|
||||
ty = Gettype(node);
|
||||
p = Getparms(node);
|
||||
if (!ty || !p) return -1;
|
||||
ct = Copy(ty);
|
||||
tl = NewList();
|
||||
while (p) {
|
||||
Append(tl,Gettype(p));
|
||||
p = Getnext(p);
|
||||
}
|
||||
SwigType_add_function(ct,tl);
|
||||
SwigType_add_function(ct,p);
|
||||
SwigType_strip_qualifiers(ct);
|
||||
r = Cmp(pat,ct);
|
||||
Delete(ct);
|
||||
Delete(tl);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -199,16 +199,16 @@ SwigType_add_qualifier(SwigType *t, String *qual) {
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
SwigType_add_function(SwigType *t, List *parms) {
|
||||
SwigType_add_function(SwigType *t, ParmList *parms) {
|
||||
String *pstr;
|
||||
int i,l;
|
||||
|
||||
Insert(t,0,").");
|
||||
pstr = NewString("f(");
|
||||
l = Len(parms);
|
||||
for (i = 0; i < l; i++) {
|
||||
Printf(pstr,"%s",Getitem(parms,i));
|
||||
if (i < (l-1))
|
||||
|
||||
while (parms) {
|
||||
Printf(pstr,"%s",Gettype(parms));
|
||||
parms = Getnext(parms);
|
||||
if (parms)
|
||||
Putc(',',pstr);
|
||||
}
|
||||
Insert(t,0,pstr);
|
||||
|
|
@ -1107,7 +1107,7 @@ int SwigType_typedef(SwigType *type, String_or_char *name) {
|
|||
qname = NewString(name);
|
||||
while (i >= 0) {
|
||||
String *sname;
|
||||
Printf(stdout,"Adding typedef [%d] : '%s' -> '%s'\n", i, qname, type);
|
||||
/* Printf(stdout,"Adding typedef [%d] : '%s' -> '%s'\n", i, qname, type); */
|
||||
Setattr(scopes[i],qname,type);
|
||||
if (i > 0) {
|
||||
sname = scopenames[i];
|
||||
|
|
@ -1177,7 +1177,7 @@ void SwigType_set_scope_name(String_or_char *name) {
|
|||
* Merges the contents of one scope into the current scope.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void SwigType_merge_scope(Hash *scope, String_or_char *prefix) {
|
||||
void SwigType_merge_scope(Hash *scope, String *prefix) {
|
||||
String *name;
|
||||
String *key;
|
||||
String *type;
|
||||
|
|
@ -1191,7 +1191,7 @@ void SwigType_merge_scope(Hash *scope, String_or_char *prefix) {
|
|||
} else {
|
||||
name = NewString(key);
|
||||
}
|
||||
Setattr(scopes[scope_level],name,type);
|
||||
SwigType_typedef(type,name);
|
||||
key = Nextkey(scope);
|
||||
}
|
||||
}
|
||||
|
|
@ -1209,9 +1209,9 @@ Hash *SwigType_pop_scope() {
|
|||
if (scope_level == 0) return 0;
|
||||
prefix = scopenames[scope_level];
|
||||
s = scopes[scope_level--];
|
||||
/* SwigType_merge_scope(s,prefix); */
|
||||
/* Printf(stdout,"****\n%s\n", scopes[scope_level]); */
|
||||
return s;
|
||||
if (Len(s)) return s;
|
||||
Delete(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ typedef DOH Hash;
|
|||
typedef DOH List;
|
||||
typedef DOH String_or_char;
|
||||
typedef DOH File;
|
||||
typedef DOH Parm;
|
||||
typedef DOH ParmList;
|
||||
typedef DOH Node;
|
||||
|
||||
/* --- Legacy DataType interface. These type codes are provided solely
|
||||
for backwards compatibility with older modules --- */
|
||||
|
|
@ -167,7 +170,7 @@ extern void SwigType_del_pointer(SwigType *t);
|
|||
extern void SwigType_add_array(SwigType *t, String_or_char *size);
|
||||
extern void SwigType_add_reference(SwigType *t);
|
||||
extern void SwigType_add_qualifier(SwigType *t, String_or_char *qual);
|
||||
extern void SwigType_add_function(SwigType *t, List *parms);
|
||||
extern void SwigType_add_function(SwigType *t, ParmList *parms);
|
||||
extern List *SwigType_split(SwigType *t);
|
||||
extern String *SwigType_pop(SwigType *t);
|
||||
extern void SwigType_push(SwigType *t, SwigType *s);
|
||||
|
|
@ -195,7 +198,7 @@ extern void SwigType_inherit(String *subclass, String *baseclass);
|
|||
extern void SwigType_new_scope();
|
||||
extern void SwigType_reset_scopes();
|
||||
extern void SwigType_set_scope_name(String_or_char *name);
|
||||
extern void SwigType_merge_scope(Hash *scope, String_or_char *prefix);
|
||||
extern void SwigType_merge_scope(Hash *scope, String *prefix);
|
||||
extern Hash *SwigType_pop_scope();
|
||||
extern SwigType *SwigType_typedef_resolve(SwigType *t);
|
||||
extern SwigType *SwigType_typedef_resolve_all(SwigType *t);
|
||||
|
|
@ -215,12 +218,10 @@ extern void SwigType_strip_qualifiers(SwigType *t);
|
|||
/* Parameters are really just hidden behind a DOH object. The following
|
||||
interface will probably be simplified even further. */
|
||||
|
||||
typedef DOH Parm;
|
||||
|
||||
extern Parm *NewParm(SwigType *type, String_or_char *n);
|
||||
extern Parm *CopyParm(Parm *p);
|
||||
|
||||
typedef DOH ParmList;
|
||||
|
||||
|
||||
extern ParmList *CopyParmList(ParmList *);
|
||||
extern int ParmList_len(ParmList *);
|
||||
|
|
@ -391,7 +392,7 @@ extern void Swig_typemap_clear_apply(SwigType *type, String_or_char *pname);
|
|||
extern void Swig_typemap_debug();
|
||||
extern Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, String_or_char *pname);
|
||||
extern char *Swig_typemap_lookup(const String_or_char *op, SwigType *type, String_or_char *pname, String_or_char *source, String_or_char *target, Wrapper *f);
|
||||
extern void Swig_typemap_new_scope();
|
||||
extern void Swig_typemap_new_scope(Hash *);
|
||||
extern Hash *Swig_typemap_pop_scope();
|
||||
|
||||
/* --- Legacy %except directive API --- */
|
||||
|
|
|
|||
|
|
@ -45,9 +45,14 @@ static char *parm_key(String_or_char *pname) {
|
|||
* Create a new typemap scope
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_typemap_new_scope() {
|
||||
void Swig_typemap_new_scope(Hash *oldscope) {
|
||||
tm_scope++;
|
||||
typemaps[tm_scope] = NewHash();
|
||||
if (!oldscope) {
|
||||
typemaps[tm_scope] = NewHash();
|
||||
} else {
|
||||
typemaps[tm_scope] = oldscope;
|
||||
DohIncref(oldscope);
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -59,7 +64,12 @@ void Swig_typemap_new_scope() {
|
|||
Hash *
|
||||
Swig_typemap_pop_scope() {
|
||||
if (tm_scope > 0) {
|
||||
return Swig_temp_result(typemaps[tm_scope--]);
|
||||
if (Len(typemaps[tm_scope])) {
|
||||
return typemaps[tm_scope--];
|
||||
} else {
|
||||
Delete(typemaps[tm_scope--]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue