Wide range of minor bug fixes and improvements.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@966 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e699ee5a9d
commit
5c13fac1d5
10 changed files with 132 additions and 28 deletions
|
|
@ -159,6 +159,39 @@ String *Swig_string_mangle(String *s) {
|
|||
return t;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_proto_cmp()
|
||||
*
|
||||
* Compares a function prototype against an expected type-string.
|
||||
* For example, Swig_proto_cmp("f(p.void,p.Tcl_Interp,int,p.p.char).int", node)
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
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_strip_qualifiers(ct);
|
||||
r = Cmp(pat,ct);
|
||||
Delete(ct);
|
||||
Delete(tl);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_init()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1056,6 +1056,18 @@ String *SwigType_manglestr(SwigType *s) {
|
|||
return SwigType_manglestr_default(s);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SwigType_strip_qualifiers()
|
||||
*
|
||||
* Rips all qualifiers out of a type.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void SwigType_strip_qualifiers(SwigType *ty) {
|
||||
/* Sick hack alert */
|
||||
Replace(ty,"q(const).","", DOH_REPLACE_ANY);
|
||||
Replace(ty,"q(volatile).", "", DOH_REPLACE_ANY);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Scope handling
|
||||
*
|
||||
|
|
@ -1220,7 +1232,7 @@ SwigType *SwigType_typedef_resolve(SwigType *t) {
|
|||
level = scope_level;
|
||||
while (level >= 0) {
|
||||
/* See if we know about this type */
|
||||
type = Getattr(scopes[scope_level],base);
|
||||
type = Getattr(scopes[level],base);
|
||||
if (type) break;
|
||||
level--;
|
||||
}
|
||||
|
|
@ -1264,7 +1276,7 @@ int SwigType_istypedef(SwigType *t) {
|
|||
level = scope_level;
|
||||
while (level >= 0) {
|
||||
/* See if we know about this type */
|
||||
type = Getattr(scopes[scope_level],base);
|
||||
type = Getattr(scopes[level],base);
|
||||
if (type) {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ extern String *SwigType_default(SwigType *t);
|
|||
extern int SwigType_type(SwigType *t);
|
||||
extern void SwigType_remember(SwigType *t);
|
||||
extern void SwigType_emit_type_table(File *f_headers, File *f_table);
|
||||
extern void SwigType_strip_qualifiers(SwigType *t);
|
||||
|
||||
/* --- Parameters and Parameter Lists --- */
|
||||
|
||||
|
|
@ -301,6 +302,8 @@ extern String *Swig_string_escape(String *s);
|
|||
extern String *Swig_string_mangle(String *s);
|
||||
extern void Swig_init();
|
||||
|
||||
extern int Swig_proto_cmp(const String_or_char *pat, DOH *node);
|
||||
|
||||
/* --- C Wrappers --- */
|
||||
extern String *Swig_clocal(SwigType *t, String_or_char *name, String_or_char *value);
|
||||
extern SwigType *Swig_clocal_type(SwigType *t);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue