change r to allow logical enums. add change to CHANGES.current

This commit is contained in:
Joseph C Wang 2017-10-10 17:50:58 +08:00
commit be05daa39a
2 changed files with 17 additions and 2 deletions

View file

@ -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) 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 2017-10-09: olly
[PHP] Fix incorrect wrapper code generated when there's a [PHP] Fix incorrect wrapper code generated when there's a
combination of overloading, parameters with a default value combination of overloading, parameters with a default value

View file

@ -1,3 +1,4 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* This file is part of SWIG, which is licensed as a whole under version 3 * 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 * (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) // 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 // 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. // quietly using the wrong enum value like we used to.
Printf(scode, "%s%s%s'%s' = %s%s\n", tab8, tab8, tab8, name, val, if (!Strcmp(val, "true")) {
nextSibling(c) ? ", " : ""); 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 { } else {
Printf(scode, "%s%s%s'%s' = %d%s\n", tab8, tab8, tab8, name, value, Printf(scode, "%s%s%s'%s' = %d%s\n", tab8, tab8, tab8, name, value,
nextSibling(c) ? ", " : ""); nextSibling(c) ? ", " : "");