The great merge

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2002-11-30 22:01:28 +00:00
commit 12a43edc2d
1508 changed files with 125983 additions and 44037 deletions

View file

@ -0,0 +1,4 @@
%module xxx
%name() int foo;

View file

@ -0,0 +1,5 @@
%module xxx
%native(foo) int foo;

View file

@ -0,0 +1,8 @@
%module xxx
int class(int x);

View file

@ -0,0 +1,4 @@
%module xxx
int foo(int x = 42 || 3);

View file

@ -0,0 +1,8 @@
%module xxx
int foo(%val int *x, %out int *y);

View file

@ -0,0 +1,4 @@
%module xxx
int foo(int x = '');

View file

@ -0,0 +1,7 @@
%module xxx
enum stuff {
FOO = 'x',
BAR = 3.14159
};

View file

@ -0,0 +1,8 @@
%module xxx
int foo(int x);
%}

View file

@ -0,0 +1,7 @@
%module xxx
int foo(int);
}

View file

@ -0,0 +1,6 @@
%module xxx
int foo(unsigned unsigned int x);
int bar(signed signed y);
int spam(unsigned signed int x);

View file

@ -0,0 +1,3 @@
%module xxx
%insert("header") "missing_file.i";

View file

@ -0,0 +1,6 @@
%module xxx
int foo(long short x);
int bar(short long y);
int spam(long long long x);
int grok(short short int x);

View file

@ -0,0 +1,10 @@
%module xxx
int foo(int x) {
int y;

View file

@ -0,0 +1,4 @@
%module xxx
int foo(int)
int bar(int,int);

View file

@ -0,0 +1,20 @@
%module xxx
int foo(int x, int y);
int foo;
int bar(int x);
struct bar {
int y;
};
%rename(bar) spam;
int spam(int);

View file

@ -0,0 +1,3 @@
%module xxx
int foo(int x, ...);

View file

@ -0,0 +1,7 @@
%module xxx
%varargs(0,int x = 0) foo;
int foo(int x, ...);

View file

@ -0,0 +1,7 @@
%module xxx
extern "INTERCAL" {
int foo(int);
};
extern "INTERCAL" int blah(int);

View file

@ -0,0 +1,23 @@
%module xxx
%extend foo {
int bar() {
}
};
struct foo {
int bar();
int spam();
};
%extend foo {
int spam();
};

View file

@ -0,0 +1,6 @@
%module xxx
%extend foo {
int bar() {
}
};

View file

@ -0,0 +1,7 @@
%module xxx
namespace foo {
%inline %{
int bar(int x) { }
%}
}

View file

@ -0,0 +1,11 @@
%module xxx
int foo(vector<int);

View file

@ -0,0 +1,14 @@
%module xxx
namespace blah {
}
namespace B = blah;
namespace B {
}

View file

@ -0,0 +1,4 @@
%module xxx
int blah;
namespace B = blah;

View file

@ -0,0 +1,3 @@
%module xxx
namespace B = blah;

View file

@ -0,0 +1,13 @@
%module xxx
class Foo {
public:
class Bar {
};
};
class Spam {
public:
class Grok {
} x;
};

View file

@ -0,0 +1,4 @@
%module xxx
class Bar : foo {
};

View file

@ -0,0 +1,7 @@
%module xxx
class Foo : public Bar {
};
class Spam : public Bar<int> {
};

View file

@ -0,0 +1,15 @@
%module xxx
int foo(int x);
int foo(double x);
class Foo {
public:
int bar(int);
int bar(double);
};
class Spam {
public:
Spam();
Spam(int);
};

View file

@ -0,0 +1,7 @@
%module xxx
class foo {
static const int BAR = 42;
public:
int blah(int x = BAR);
};

View file

@ -0,0 +1,11 @@
%module xxx
class Foo {
};
class Bar : private Foo {
};
class Spam : protected Foo {
};

View file

@ -0,0 +1,8 @@
%module xxx
template<T> T blah(T x);

View file

@ -0,0 +1,10 @@
%module xxx
template<typename T> T blah(T x) { };
%template(blahi) blah<int,double>;
%template(blahf) blah<>;

View file

@ -0,0 +1,9 @@
%module xxx
int blah;
%template(blahi) blah<int>;

View file

@ -0,0 +1,4 @@
%module xxx
template<class T> class vector<T *> {
};

View file

@ -0,0 +1,7 @@
%module xxx
template<class T> T blah(T x) { };
%template(iblah) blah<int>;
%template(iiblah) blah<int>;

View file

@ -0,0 +1,7 @@
%module xxx
%template(blahi) blah<int>;

View file

@ -0,0 +1,9 @@
%module xxx
int blah;
using namespace blah;

View file

@ -0,0 +1,9 @@
%module xxx
using foo::bar;
using namespace foo;

View file

@ -0,0 +1,103 @@
#!/bin/sh
echo "---------------------------------------"
echo "Testing SWIG error and warning messages"
echo "---------------------------------------"
SWIG='../../../swig -I../../../Lib'
# Files run in C mode
CFILES='
c_bad_name
c_bad_native
c_class
c_default_error
c_deprecated
c_empty_char
c_enum_badvalue
c_extra_rblock
c_extra_rbrace
c_extra_unsigned
c_insert_missing
c_long_short
c_missing_rbrace
c_missing_semi
c_redefine
c_varargs
c_varargs_neg
nomodule
pp_badeval
pp_defined
pp_macro_args
pp_macro_badchar
pp_macro_nargs
pp_macro_redef
pp_macro_rparen
pp_macro_unterminated
pp_misplaced_elif
pp_misplaced_else
pp_missing_enddef
pp_missing_endif
pp_missing_file
pp_missing_rblock
pp_unterm_char
pp_unterm_comment
pp_unterm_string
swig_apply_nargs
swig_identifier
swig_insert_bad
swig_typemap_copy
swig_typemap_old
'
# Files run in C++ mode
CPPFILES='
cpp_bad_extern
cpp_extend_redefine
cpp_extend_undefined
cpp_inline_namespace
cpp_missing_rtemplate
cpp_namespace_alias
cpp_namespace_aliasnot
cpp_namespace_aliasundef
cpp_nested
cpp_no_access
cpp_nobase
cpp_overload
cpp_private_defvalue
cpp_private_inherit
cpp_template_argname
cpp_template_nargs
cpp_template_not
cpp_template_partial
cpp_template_repeat
cpp_template_undef
cpp_using_not
cpp_using_undef
'
LOGFILE='test.log'
SWIGOPT=$*
rm -f ${LOGFILE}
echo "SWIG error and warning test. opts=${SWIGOPT}" >> ${LOGFILE}
echo "-----------------------------------------------------------" >> ${LOGFILE}
for i in ${CFILES}; do
echo " Testing : ${i}.i";
echo "" >> ${LOGFILE};
echo ":::::::::::::::::::::::::::::::: ${i}.i :::::::::::::::::::::::::::::::::::" >> ${LOGFILE};
${SWIG} -Wall ${SWIGOPT} ${i}.i >>${LOGFILE} 2>&1
done
for i in ${CPPFILES}; do
echo " Testing : ${i}.i";
echo "" >> ${LOGFILE}
echo ":::::::::::::::::::::::::::::::: ${i}.i :::::::::::::::::::::::::::::::::::" >> ${LOGFILE};
${SWIG} -Wall -c++ ${SWIGOPT} ${i}.i >>${LOGFILE} 2>&1
done
echo ""
echo "Results written to '${LOGFILE}'"

View file

@ -0,0 +1,2 @@
/* No module name */
int foo(int);

View file

@ -0,0 +1,11 @@
%module xxx
#if FOO==4
#elif FOO==4+
#endif

View file

@ -0,0 +1,7 @@
%module xxx
#if defined()
#endif
#if defined
#endif

View file

@ -0,0 +1,7 @@
%module xxx
#define foo(a,x) a x
#if foo
#endif

View file

@ -0,0 +1,5 @@
%module xxx
#define f@oo(a,x) a + x
#define foo(a@,x) a + x

View file

@ -0,0 +1,16 @@
%module xxx
#define foo(a,x) a x
#define bar(x) x
#define spam() /**/
foo(3)
foo(3,4,5)
bar()
bar(2,3)
spam(1)

View file

@ -0,0 +1,8 @@
%module xxx
#define foo(a,x) a+x
#define foo 4
/* Should not generate an error */
#define foo 4

View file

@ -0,0 +1,3 @@
%module xxx
#define foo(a,x 3

View file

@ -0,0 +1,7 @@
%module xxx
#define foo(a,x) a+x
foo(3,

View file

@ -0,0 +1,7 @@
%module xxx
#elif foo == 3
int x;
#endif

View file

@ -0,0 +1,7 @@
%module xxx
#else
int x;
#endif

View file

@ -0,0 +1,7 @@
%module xxx
%define FOO
int x;

View file

@ -0,0 +1,6 @@
%module xxx
#ifdef FOO
int x;

View file

@ -0,0 +1,3 @@
%module test
%include "missing_filename.i"

View file

@ -0,0 +1,7 @@
%module xxx
%{
int x;

View file

@ -0,0 +1,7 @@
%module xxx
const char x = 'H

View file

@ -0,0 +1,6 @@
%module xxx
/* Hello

View file

@ -0,0 +1,6 @@
%module xxx
const char *x = "Hello

View file

@ -0,0 +1,6 @@
%module xxx
%typemap(in) (char *str, int len) {
}
%apply (char *str, int len) { int x };

View file

@ -0,0 +1,6 @@
%module xxx
%rename("foo bar") foobar;
int foobar(int);

View file

@ -0,0 +1,5 @@
%module xxx
%insert("foobar") %{
some code
%}

View file

@ -0,0 +1,3 @@
%module xxx
%typemap(in) int = blah;

View file

@ -0,0 +1,6 @@
%module xxx
%typemap(in) int x {
$source;
$target;
}