mirror of https://github.com/swig/swig
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:
parent
45359dc12c
commit
84215444eb
|
@ -7,8 +7,8 @@ public class runme
|
|||
{
|
||||
int f = overload_template.foo();
|
||||
|
||||
f += overload_template.max(3,4);
|
||||
double b = overload_template.max(3.4,5.2);
|
||||
f += overload_template.maximum(3,4);
|
||||
double b = overload_template.maximum(3.4,5.2);
|
||||
b++; // warning suppression
|
||||
|
||||
// mix 1
|
||||
|
|
|
@ -16,8 +16,8 @@ public class overload_template_runme {
|
|||
public static void main(String argv[]) {
|
||||
int f = overload_template.foo();
|
||||
|
||||
int a = overload_template.max(3,4);
|
||||
double b = overload_template.max(3.4,5.2);
|
||||
int a = overload_template.maximum(3,4);
|
||||
double b = overload_template.maximum(3.4,5.2);
|
||||
|
||||
// mix 1
|
||||
if (overload_template.mix1("hi") != 101)
|
||||
|
|
|
@ -2,12 +2,12 @@ require("import") -- the import fn
|
|||
import("overload_template") -- import code
|
||||
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)
|
||||
|
||||
f = foo()
|
||||
|
||||
a = max(3,4)
|
||||
a = maximum(3,4)
|
||||
|
||||
-- mix 1
|
||||
assert(mix1("hi") == 101)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
overload_template
|
||||
f = foo();
|
||||
|
||||
a = max(3,4);
|
||||
b = max(3.4,5.2);
|
||||
a = maximum(3,4);
|
||||
b = maximum(3.4,5.2);
|
||||
|
||||
# mix 1
|
||||
if (mix1("hi") != 101)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#ifdef SWIGLUA
|
||||
// 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) max;
|
||||
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) maximum;
|
||||
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) specialization;
|
||||
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) overload;
|
||||
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) space::nsoverload;
|
||||
|
@ -11,12 +11,6 @@
|
|||
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) barT;
|
||||
#endif
|
||||
|
||||
%{
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
|
||||
int foo() {
|
||||
|
@ -29,15 +23,15 @@ 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<double>;
|
||||
|
||||
%template(max) max<int>;
|
||||
%template(max) max<double>;
|
||||
%template(maximum) maximum<int>;
|
||||
%template(maximum) maximum<double>;
|
||||
|
||||
// Mix template overloading with plain function overload
|
||||
// Mix 1
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from overload_template import *
|
||||
f = foo()
|
||||
|
||||
a = max(3,4)
|
||||
b = max(3.4,5.2)
|
||||
a = maximum(3,4)
|
||||
b = maximum(3.4,5.2)
|
||||
|
||||
# mix 1
|
||||
if (mix1("hi") != 101):
|
||||
|
|
|
@ -13,5 +13,5 @@ require 'overload_template'
|
|||
|
||||
f = Overload_template.foo()
|
||||
|
||||
a = Overload_template.max(3,4)
|
||||
b = Overload_template.max(3.4,5.2)
|
||||
a = Overload_template.maximum(3,4)
|
||||
b = Overload_template.maximum(3.4,5.2)
|
||||
|
|
Loading…
Reference in New Issue