swig/Examples/test-suite/overload_extend.i
Mark Gossage 0c2bbb25a3 [lua] fixed bug in template classes which cases template_default2 and template_specialization_defarg to fail.
Added several warning filters into the overload's test cases.
Added runtime tests for several codes.
You can now make check-lua-test-suite with no errors and only a few warnings.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10076 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-10-30 06:10:04 +00:00

65 lines
982 B
OpenEdge ABL

%module overload_extend
#ifndef __cplusplus
%{
#include <stdlib.h>
%}
%typemap(default) double y "$1=1000;";
#endif
#ifdef SWIGLUA // lua only has one numeric type, so some overloads shadow each other creating warnings
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) test;
#endif
%warnfilter(SWIGWARN_PARSE_REDEFINED) Foo::test;
%extend Foo {
int test() { return 0; }
int test(int x) { x = 0; return 1; }
int test(char *s) { s = 0; return 2; }
#ifdef __cplusplus
double test(double x, double y = 1000) { return x + y; }
#else
double test(double x, double y) { return x + y; }
#endif
};
%inline %{
struct Foo {
int variable;
#ifdef __cplusplus
int test() { return -1; }
#endif
};
%}
%extend Bar {
#ifdef __cplusplus
Bar() {
return new Bar();
}
~Bar() {
delete $self;
}
#else
Bar() {
return (Bar *) malloc(sizeof(Bar));
}
~Bar() {
free($self);
}
#endif
}
%inline %{
typedef struct {
int variable;
} Bar;
%}