From f5adbd3f6ff4ae4645de69130ffadd4dfefd88f2 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Tue, 26 Oct 2004 00:30:05 +0000 Subject: [PATCH] %apply also looks for a typedef match if it doesn't find a match at first git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6509 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Swig/typemap.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/SWIG/Source/Swig/typemap.c b/SWIG/Source/Swig/typemap.c index f3183b5c8..667e23936 100644 --- a/SWIG/Source/Swig/typemap.c +++ b/SWIG/Source/Swig/typemap.c @@ -396,6 +396,21 @@ Swig_typemap_apply(ParmList *src, ParmList *dest) { /* See if there is a matching typemap in this scope */ sm = Swig_typemap_get(type,name,ts); + /* if there is not matching, look for a typemap in the + original typedef, if any, like in: + + typedef unsigned long size_t; + ... + %apply(size_t) {my_size}; ==> %apply(unsigned long) {my_size}; + */ + if (!sm) { + SwigType *ntype = SwigType_typedef_resolve(type); + if (Cmp(ntype,type) != 0) { + sm = Swig_typemap_get(ntype,name,ts); + } + Delete(ntype); + } + if (sm) { /* Got a typemap. Need to only merge attributes for methods that match our signature */ Iterator ki;