From 26655216ab0d3c1cec40049adb2bb3bd32b57757 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Sun, 19 Dec 2004 22:54:40 +0000 Subject: [PATCH] fix typemap search, now you can add a typemap like %typemap(out) int *Foo::foo(int bar); git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6899 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Swig/typemap.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/SWIG/Source/Swig/typemap.c b/SWIG/Source/Swig/typemap.c index eb7c6f756..9de092424 100644 --- a/SWIG/Source/Swig/typemap.c +++ b/SWIG/Source/Swig/typemap.c @@ -1164,16 +1164,16 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri SwigType *type; SwigType *mtype = 0; String *pname; - Hash *tm; + Hash *tm = 0; String *s = 0; String *sdef = 0; ParmList *locals; ParmList *kw; char temp[256]; - String *symname; + String *symname, *qsn; String *cname = 0; String *clname = 0; - + Symtab *st; /* special case, we need to check for 'ref' call and set the defaul code 'sdef' */ if (Cmp(op,"newfree") == 0) { @@ -1184,7 +1184,26 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri if (!type) return sdef; pname = Getattr(node,"name"); - tm = Swig_typemap_search(op,type,pname,&mtype); + st = Getattr(node,"sym:symtab"); + qsn = st ? Swig_symbol_qualifiedscopename(st) : 0; + if (qsn && Len(qsn)) { + /* look qualified names first, such as + + int *Foo::foo(int bar) -> Foo::foo + -> *::foo + -> Foo::* + */ + String *qname = NewStringf("%s::%s",qsn,pname); + tm = Swig_typemap_search(op,type,qname,&mtype); + Delete(qname); + } + Delete(qsn); + + /* look now for simple name, such as + + int *Foo::foo(int bar) -> foo + */ + if (!tm) tm = Swig_typemap_search(op,type,pname,&mtype); if (!tm) return sdef; s = Getattr(tm,"code");