Rename max() to maximum() as max() is a built-in function in PHP.

Testcases overload_template and overload_template_fast now pass for PHP.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11557 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2009-08-14 01:33:23 +00:00
parent 45359dc12c
commit 84215444eb
7 changed files with 16 additions and 22 deletions

View File

@ -7,8 +7,8 @@ public class runme
{ {
int f = overload_template.foo(); int f = overload_template.foo();
f += overload_template.max(3,4); f += overload_template.maximum(3,4);
double b = overload_template.max(3.4,5.2); double b = overload_template.maximum(3.4,5.2);
b++; // warning suppression b++; // warning suppression
// mix 1 // mix 1

View File

@ -16,8 +16,8 @@ public class overload_template_runme {
public static void main(String argv[]) { public static void main(String argv[]) {
int f = overload_template.foo(); int f = overload_template.foo();
int a = overload_template.max(3,4); int a = overload_template.maximum(3,4);
double b = overload_template.max(3.4,5.2); double b = overload_template.maximum(3.4,5.2);
// mix 1 // mix 1
if (overload_template.mix1("hi") != 101) if (overload_template.mix1("hi") != 101)

View File

@ -2,12 +2,12 @@ require("import") -- the import fn
import("overload_template") -- import code import("overload_template") -- import code
for k,v in pairs(overload_template) do _G[k]=v end -- move to global for k,v in pairs(overload_template) do _G[k]=v end -- move to global
-- lua has only one numeric type, so max(int,int) and max(double,double) are the same -- lua has only one numeric type, so maximum(int,int) and maximum(double,double) are the same
-- whichever one was wrapper first will be used (which is int) -- whichever one was wrapper first will be used (which is int)
f = foo() f = foo()
a = max(3,4) a = maximum(3,4)
-- mix 1 -- mix 1
assert(mix1("hi") == 101) assert(mix1("hi") == 101)

View File

@ -1,8 +1,8 @@
overload_template overload_template
f = foo(); f = foo();
a = max(3,4); a = maximum(3,4);
b = max(3.4,5.2); b = maximum(3.4,5.2);
# mix 1 # mix 1
if (mix1("hi") != 101) if (mix1("hi") != 101)

View File

@ -3,7 +3,7 @@
#ifdef SWIGLUA #ifdef SWIGLUA
// lua only has one numeric type, so most of the overloads shadow each other creating warnings // lua only has one numeric type, so most of the overloads shadow each other creating warnings
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) foo; %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) foo;
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) max; %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) maximum;
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) specialization; %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) specialization;
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) overload; %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) overload;
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) space::nsoverload; %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) space::nsoverload;
@ -11,12 +11,6 @@
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) barT; %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) barT;
#endif #endif
%{
#ifdef max
#undef max
#endif
%}
%inline %{ %inline %{
int foo() { int foo() {
@ -29,15 +23,15 @@ template <class T>
} }
template<class T> template<class T>
T max(T a, T b) { return (a > b) ? a : b; } T maximum(T a, T b) { return (a > b) ? a : b; }
%} %}
%template(foo) foo<int>; %template(foo) foo<int>;
%template(foo) foo<double>; %template(foo) foo<double>;
%template(max) max<int>; %template(maximum) maximum<int>;
%template(max) max<double>; %template(maximum) maximum<double>;
// Mix template overloading with plain function overload // Mix template overloading with plain function overload
// Mix 1 // Mix 1

View File

@ -1,8 +1,8 @@
from overload_template import * from overload_template import *
f = foo() f = foo()
a = max(3,4) a = maximum(3,4)
b = max(3.4,5.2) b = maximum(3.4,5.2)
# mix 1 # mix 1
if (mix1("hi") != 101): if (mix1("hi") != 101):

View File

@ -13,5 +13,5 @@ require 'overload_template'
f = Overload_template.foo() f = Overload_template.foo()
a = Overload_template.max(3,4) a = Overload_template.maximum(3,4)
b = Overload_template.max(3.4,5.2) b = Overload_template.maximum(3.4,5.2)