diff --git a/CHANGES.current b/CHANGES.current index 60f5fdf20..816c0a4e4 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,10 @@ Version 1.3.39 (in progress) ============================ +2008-02-08: wsfulton + Fix %feature not working for conversion operators, reported by Matt Sprague, for example: + %feature("cs:methodmodifiers") operator bool "protected"; + 2008-02-07: wsfulton [MzScheme] Apply #2081967 configure changes for examples to build with recent PLT versions. Also fixes Makefile errors building SWIG executable when mzscheme package is installed diff --git a/Examples/test-suite/features.i b/Examples/test-suite/features.i index 2db51ae6b..2ccbe725a 100644 --- a/Examples/test-suite/features.i +++ b/Examples/test-suite/features.i @@ -162,3 +162,20 @@ namespace Space { } %} +// Test 8 conversion operators +%rename(opbool) operator bool; +%rename(opuint) operator unsigned int; + +%exception ConversionOperators::ConversionOperators() "$action /* ConversionOperators::ConversionOperators() */"; +%exception ConversionOperators::~ConversionOperators() "$action /* ConversionOperators::~ConversionOperators() */"; +%exception ConversionOperators::operator bool "$action /* ConversionOperators::operator bool */"; +%exception ConversionOperators::operator unsigned int "$action /* ConversionOperators::unsigned int*/"; + +%inline %{ + class ConversionOperators { + public: + operator bool() { return false; } + operator unsigned int() { return 0; } + }; +%} + diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index 76ea73f57..8734c7d0e 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -711,6 +711,10 @@ int yylex(void) { termtoken = SWIG_TOKEN_SEMI; termvalue = ";"; break; + } else if (nexttok == SWIG_TOKEN_STRING) { + termtoken = SWIG_TOKEN_STRING; + termvalue = Swig_copy_string(Char(Scanner_text(scan))); + break; } else if (nexttok == SWIG_TOKEN_ID) { if (needspace) { Append(s," "); diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c index 3e1f46bb1..013ce5929 100644 --- a/Source/Swig/naming.c +++ b/Source/Swig/naming.c @@ -655,7 +655,7 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d } #ifdef SWIG_DEBUG - Printf(stdout, "Swig_features_get: %s %s %s\n", prefix, name, decl); + Printf(stdout, "Swig_features_get: '%s' '%s' '%s'\n", prefix, name, decl); #endif /* Global features */ @@ -732,7 +732,7 @@ void Swig_feature_set(Hash *features, const_String_or_char_ptr name, SwigType *d Hash *fhash; #ifdef SWIG_DEBUG - Printf(stdout, "Swig_feature_set: %s %s %s %s\n", name, decl, featurename, value); + Printf(stdout, "Swig_feature_set: '%s' '%s' '%s' '%s'\n", name, decl, featurename, value); #endif n = Getattr(features, name);