diff --git a/CHANGES.current b/CHANGES.current index dc328dd6b..ac08d2bcb 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -6,6 +6,12 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.0.0 (in progress) =========================== +2017-10-10: joequant + [R] pass enum expressions to R. This will generate + incorrect files when there is an arithmetic expression + in the enum, but this is better than silently generating + incorrect code + 2017-10-09: olly [PHP] Fix incorrect wrapper code generated when there's a combination of overloading, parameters with a default value diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index fc9a5916b..bd3395a73 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -1,3 +1,4 @@ + /* ----------------------------------------------------------------------------- * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional @@ -1245,8 +1246,16 @@ int R::enumDeclaration(Node *n) { // This won't work in general, but will at least handle cases like (3) // and 3+7, and when it doesn't work, it'll fail noisly rather than // quietly using the wrong enum value like we used to. - Printf(scode, "%s%s%s'%s' = %s%s\n", tab8, tab8, tab8, name, val, - nextSibling(c) ? ", " : ""); + if (!Strcmp(val, "true")) { + Printf(scode, "%s%s%s'%s' = %s%s\n", tab8, tab8, tab8, name, "TRUE", + nextSibling(c) ? ", " : ""); + } else if (!Strcmp(val, "false")) { + Printf(scode, "%s%s%s'%s' = %s%s\n", tab8, tab8, tab8, name, "FALSE", + nextSibling(c) ? ", " : ""); + } else { + Printf(scode, "%s%s%s'%s' = %s%s\n", tab8, tab8, tab8, name, val, + nextSibling(c) ? ", " : ""); + } } else { Printf(scode, "%s%s%s'%s' = %d%s\n", tab8, tab8, tab8, name, value, nextSibling(c) ? ", " : "");