From ea41d15804eb5e06af2c7e5f7cb60b9ada19780f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 3 Aug 2009 19:13:37 +0200 Subject: [PATCH] PHP: fix for the wrapmacro testcase 'max' is a built-in function in PHP, so let's rename it to 'maximum' instead. --- Examples/test-suite/octave/wrapmacro_runme.m | 4 ++-- Examples/test-suite/perl5/wrapmacro_runme.pl | 4 ++-- Examples/test-suite/python/wrapmacro_runme.py | 4 ++-- Examples/test-suite/wrapmacro.i | 7 ++++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Examples/test-suite/octave/wrapmacro_runme.m b/Examples/test-suite/octave/wrapmacro_runme.m index 4f42883..5069f2c 100644 --- a/Examples/test-suite/octave/wrapmacro_runme.m +++ b/Examples/test-suite/octave/wrapmacro_runme.m @@ -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); diff --git a/Examples/test-suite/perl5/wrapmacro_runme.pl b/Examples/test-suite/perl5/wrapmacro_runme.pl index f0345e4..8e01540 100755 --- a/Examples/test-suite/perl5/wrapmacro_runme.pl +++ b/Examples/test-suite/perl5/wrapmacro_runme.pl @@ -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); diff --git a/Examples/test-suite/python/wrapmacro_runme.py b/Examples/test-suite/python/wrapmacro_runme.py index e7a5a37..0272afd 100644 --- a/Examples/test-suite/python/wrapmacro_runme.py +++ b/Examples/test-suite/python/wrapmacro_runme.py @@ -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) diff --git a/Examples/test-suite/wrapmacro.i b/Examples/test-suite/wrapmacro.i index 5353e77..bd5e48b 100644 --- a/Examples/test-suite/wrapmacro.i +++ b/Examples/test-suite/wrapmacro.i @@ -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: -- 1.6.3.3