Fix named output typemaps not being used when the symbol uses a qualifier and contains a number

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12831 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-11-01 23:06:53 +00:00
commit 0463a49df5
3 changed files with 26 additions and 1 deletions

View file

@ -5,6 +5,12 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.5 (in progress)
===========================
2011-11-01: wsfulton
Fix named output typemaps not being used when the symbol uses a qualifier and contains
a number, eg:
%typemap(out) double ABC::m1 "..."
2011-10-24: talby
[perl5] SF bug #3423119 - overload dispatch stack corruption fix. Better, but more research
is needed on a stable path for tail calls in XS.

View file

@ -55,3 +55,20 @@ void foo2(Foo<short> f, const Foo<short>& ff) {}
};
}
// Test obscure bug where named typemaps where not being applied when symbol name contained a number
%typemap(out) double "_typemap_for_double_no_compile_"
%typemap(out) double ABC::meth "$1 = 0.0;"
%typemap(out) double ABC::m1 "$1 = 0.0;"
%typemap(out) double ABC::_x2 "$1 = 0.0;"
%typemap(out) double ABC::y_ "$1 = 0.0;"
%typemap(out) double ABC::_3 "$1 = 0.0;"
%inline %{
struct ABC {
double meth() {}
double m1() {}
double _x2() {}
double y_() {}
double _3() {}
};
%}

View file

@ -1749,8 +1749,9 @@ String *Swig_symbol_string_qualify(String *s, Symtab *st) {
String *id = NewStringEmpty();
String *r = NewStringEmpty();
char *c = Char(s);
int first_char = 1;
while (*c) {
if (isalpha((int) *c) || (*c == '_') || (*c == ':')) {
if (isalpha((int) *c) || (*c == '_') || (*c == ':') || (isdigit((int) *c) && !first_char)) {
Putc(*c, id);
have_id = 1;
} else {
@ -1763,6 +1764,7 @@ String *Swig_symbol_string_qualify(String *s, Symtab *st) {
}
Putc(*c, r);
}
first_char = (*c == ':');
c++;
}
if (have_id) {