PHP: fix for the wrapmacro testcase

'max' is a built-in function in PHP, so let's rename it to 'maximum'
instead.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11495 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Miklos Vajna 2009-08-04 09:32:12 +00:00
commit 88a934d7f0
4 changed files with 10 additions and 9 deletions

View file

@ -2,7 +2,7 @@ wrapmacro
a = 2;
b = -1;
wrapmacro.max(a,b);
wrapmacro.max(a/7.0, -b*256);
wrapmacro.maximum(a,b);
wrapmacro.maximum(a/7.0, -b*256);
wrapmacro.GUINT16_SWAP_LE_BE_CONSTANT(1);

View file

@ -9,6 +9,6 @@ require_ok('wrapmacro');
my $a = 2;
my $b = -1;
is(wrapmacro::max($a,$b), 2);
is(wrapmacro::max($a/7.0, -$b*256), 256);
is(wrapmacro::maximum($a,$b), 2);
is(wrapmacro::maximum($a/7.0, -$b*256), 256);
is(wrapmacro::GUINT16_SWAP_LE_BE_CONSTANT(1), 256);

View file

@ -2,6 +2,6 @@ import wrapmacro
a = 2
b = -1
wrapmacro.max(a,b)
wrapmacro.max(a/7.0, -b*256)
wrapmacro.maximum(a,b)
wrapmacro.maximum(a/7.0, -b*256)
wrapmacro.GUINT16_SWAP_LE_BE_CONSTANT(1)

View file

@ -21,7 +21,8 @@ typedef unsigned short guint16;
(guint16) ((guint16) (val) >> 8) | \
(guint16) ((guint16) (val) << 8)))
#define max(a,b) ((a) > (b) ? (a) : (b))
/* Don't use max(), it's a builtin function for PHP. */
#define maximum(a,b) ((a) > (b) ? (a) : (b))
%}
@ -41,8 +42,8 @@ type SWIGMACRO_##name(lparams) {
/* Here, wrapping the macros */
%wrapmacro(guint16, GUINT16_SWAP_LE_BE_CONSTANT, guint16 val, val);
%wrapmacro(size_t, max, PLIST(size_t a, const size_t& b), PLIST(a, b));
%wrapmacro(double, max, PLIST(double a, double b), PLIST(a, b));
%wrapmacro(size_t, maximum, PLIST(size_t a, const size_t& b), PLIST(a, b));
%wrapmacro(double, maximum, PLIST(double a, double b), PLIST(a, b));
/* Maybe in the future, a swig directive will make this easier: