Change class names in test code which clash with PHP reserved words

(Interface, Class, and Function - these are case insensitive reserved
words in PHP).

Fix lists of expected methods in rename_scope_runme.php to match those
which we expect with PHP5.  With this and the change above, this testcase
now passes.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11545 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2009-08-13 03:58:09 +00:00
parent 54018f66a2
commit d3809285a4
7 changed files with 34 additions and 34 deletions

View File

@ -6,10 +6,10 @@ require "rename_scope.php";
check::classes(array("rename_scope","Interface_UP","Interface_BP","Natural_UP","Natural_BP","Bucket"));
check::classmethods("Interface_UP",array("__construct"));
check::classmethods("Interface_BP",array("__construct"));
check::classmethods("Natural_UP",array("__construct","rtest"));
check::classmethods("Natural_BP",array("__construct","rtest"));
check::classmethods("Interface_UP",array("__construct","__set","__isset","__get"));
check::classmethods("Interface_BP",array("__construct","__set","__isset","__get"));
check::classmethods("Natural_UP",array("__construct","__set","__isset","__get","rtest"));
check::classmethods("Natural_BP",array("__construct","__set","__isset","__get","rtest"));
check::classparent("Natural_UP","Interface_UP");
check::classparent("Natural_BP","Interface_BP");

View File

@ -7,7 +7,7 @@
enum Polarization { UnaryPolarization, BinaryPolarization };
template <Polarization P>
struct Interface
struct Interface_
{
};
}
@ -15,9 +15,9 @@
namespace oss
{
// Interface
%template(Interface_UP) Interface<UnaryPolarization>;
%template(Interface_BP) Interface<BinaryPolarization>;
// Interface_
%template(Interface_UP) Interface_<UnaryPolarization>;
%template(Interface_BP) Interface_<BinaryPolarization>;
}
%inline
@ -27,7 +27,7 @@ namespace oss
namespace interfaces
{
template <Polarization P>
struct Natural : Interface<P>
struct Natural : Interface_<P>
{
int test(void) { return 1; }
};

View File

@ -12,14 +12,14 @@
enum Polarization { UnaryPolarization, BinaryPolarization };
template <Polarization P>
struct Interface
struct Interface_
{
};
namespace modules
{
template <class traits, class base = Interface<traits::pmode> >
template <class traits, class base = Interface_<traits::pmode> >
// *** problem here ****
struct Module : base
{
@ -35,7 +35,7 @@
namespace oss
{
%template(Interface_UP) Interface<UnaryPolarization>;
%template(Interface_UP) Interface_<UnaryPolarization>;
namespace modules
{
%template(Module_etraits) Module<etraits>;

View File

@ -6,7 +6,7 @@
enum Polarization { UnaryPolarization, BinaryPolarization };
template <Polarization P>
struct Interface
struct Interface_
{
};
@ -21,8 +21,8 @@
namespace oss
{
%template(Interface_UP) Interface<UnaryPolarization>;
%template(Module_UPIUP) Module<UnaryPolarization,Interface<UnaryPolarization> >;
%template(Interface_UP) Interface_<UnaryPolarization>;
%template(Module_UPIUP) Module<UnaryPolarization,Interface_<UnaryPolarization> >;
}
%inline %{
@ -31,18 +31,18 @@ namespace oss
namespace hello
{
struct HInterface1 :
Interface<oss::UnaryPolarization> // this works (with fullns qualification)
Interface_<oss::UnaryPolarization> // this works (with fullns qualification)
{
};
struct HInterface2 :
Interface<UnaryPolarization> // this doesn't work
Interface_<UnaryPolarization> // this doesn't work
{
};
struct HModule1 : Module<UnaryPolarization, Interface<UnaryPolarization> > {
struct HModule1 : Module<UnaryPolarization, Interface_<UnaryPolarization> > {
};
}
}
%}
%}

View File

@ -9,7 +9,7 @@
enum Polarization { UnaryPolarization, BinaryPolarization };
template <Polarization P>
struct Interface
struct Interface_
{
};
@ -25,7 +25,7 @@
typedef Traits traits;
static const Polarization P = traits::pmode;
void get(Interface<P> arg) { }; // Here P is only replace by traits::pmode
void get(Interface_<P> arg) { }; // Here P is only replace by traits::pmode
};
}
@ -34,6 +34,6 @@
namespace oss
{
%template(Interface_UP) Interface<UnaryPolarization>;
%template(Interface_UP) Interface_<UnaryPolarization>;
%template(Module_UP) Module<etraits>;
}

View File

@ -8,13 +8,13 @@
};
template <class ArgType, class ResType>
struct Function
struct Function_
{
char *test() { return (char *) "test"; }
};
template <class AF, class RF>
struct ArithFunction : Function<AF, RF>
struct ArithFunction : Function_<AF, RF>
{
};
@ -40,7 +40,7 @@
};
template <class AF, class RF>
class Class : public ArithFunction< typename traits<AF, RF>::arg_type,
class Class_ : public ArithFunction< typename traits<AF, RF>::arg_type,
typename traits<AF, RF>::res_type >
{
};
@ -49,7 +49,7 @@
typename traits<AF, RF>::base
make_Class()
{
return Class<AF, RF>();
return Class_<AF, RF>();
}
@ -58,9 +58,9 @@
%{
namespace hello {
template struct Function <Double, Double>;
template struct Function_ <Double, Double>;
template struct ArithFunction <Double, Double>;
template class Class <Double, Double>;
template class Class_ <Double, Double>;
}
%}
@ -69,9 +69,9 @@
// This complains only when using a namespace
//
%template() traits<Double,Double>;
%template(Function_DD) Function <Double, Double>;
%template(Function_DD) Function_ <Double, Double>;
%template(ArithFunction_DD) ArithFunction <Double, Double>;
%template(Class_DD) Class <Double, Double>;
%template(Class_DD) Class_ <Double, Double>;
%template(make_Class_DD) make_Class <Double, Double>;
}

View File

@ -10,9 +10,9 @@
};
template <Polarization P>
struct Interface : Base
struct Interface_ : Base
{
Interface(const Base& b) { };
Interface_(const Base& b) { };
};
template <class Result>
@ -23,6 +23,6 @@
namespace oss
{
// Interface
%template(Interface_BP) Interface<BinaryPolarization>;
%template(make_Interface_BP) make<Interface<BinaryPolarization> >;
%template(Interface_BP) Interface_<BinaryPolarization>;
%template(make_Interface_BP) make<Interface_<BinaryPolarization> >;
}