aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite
diff options
context:
space:
mode:
authorDave Beazley <dave-swig@dabeaz.com>2002-11-30 22:01:28 +0000
committerDave Beazley <dave-swig@dabeaz.com>2002-11-30 22:01:28 +0000
commit12a43edc2df8853e8e0315f742e57be88f0c4269 (patch)
treee3237f5f8c0a67c9bfa9bb5d6d095a739a49e4b2 /Examples/test-suite
parent5fcae5eb66d377e1c3f81da7465c44a62295a72b (diff)
downloadswig-12a43edc2df8853e8e0315f742e57be88f0c4269.tar.gz
The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/test-suite')
-rw-r--r--Examples/test-suite/README42
-rw-r--r--Examples/test-suite/abstract_inherit.i20
-rw-r--r--Examples/test-suite/abstract_inherit_ok.i21
-rw-r--r--Examples/test-suite/abstract_signature.i25
-rw-r--r--Examples/test-suite/abstract_typedef.i52
-rw-r--r--Examples/test-suite/add_link.i20
-rw-r--r--Examples/test-suite/anonymous_arg.i12
-rw-r--r--Examples/test-suite/argout.i37
-rw-r--r--Examples/test-suite/arrayptr.i12
-rw-r--r--Examples/test-suite/arrays.i52
-rw-r--r--Examples/test-suite/arrays_global.i37
-rw-r--r--Examples/test-suite/arrays_global_twodim.i42
-rw-r--r--Examples/test-suite/arrays_scope.i19
-rw-r--r--Examples/test-suite/bool_default.i9
-rw-r--r--Examples/test-suite/casts.i21
-rw-r--r--Examples/test-suite/char_constant.i11
-rw-r--r--Examples/test-suite/class_ignore.i20
-rw-r--r--Examples/test-suite/common.mk291
-rw-r--r--Examples/test-suite/const_const.i13
-rw-r--r--Examples/test-suite/const_const_2.i21
-rw-r--r--Examples/test-suite/constant_pointers.i74
-rw-r--r--Examples/test-suite/constover.i38
-rw-r--r--Examples/test-suite/constructor_exception.i27
-rw-r--r--Examples/test-suite/constructor_explicit.i13
-rw-r--r--Examples/test-suite/constructor_value.i15
-rw-r--r--Examples/test-suite/conversion.i11
-rw-r--r--Examples/test-suite/conversion_namespace.i14
-rw-r--r--Examples/test-suite/conversion_ns_template.i49
-rw-r--r--Examples/test-suite/cplusplus_throw.i22
-rw-r--r--Examples/test-suite/cpp_enum.i27
-rw-r--r--Examples/test-suite/cpp_enum_scope.i17
-rw-r--r--Examples/test-suite/cpp_namespace.i104
-rw-r--r--Examples/test-suite/cpp_nodefault.i42
-rw-r--r--Examples/test-suite/cpp_static.i24
-rw-r--r--Examples/test-suite/cpp_typedef.i46
-rw-r--r--Examples/test-suite/default_cast.i6
-rw-r--r--Examples/test-suite/default_constructor.i109
-rw-r--r--Examples/test-suite/default_ns.i23
-rw-r--r--Examples/test-suite/default_ref.i12
-rw-r--r--Examples/test-suite/defineop.i22
-rw-r--r--Examples/test-suite/defines.i18
-rw-r--r--Examples/test-suite/dynamic_cast.i65
-rw-r--r--Examples/test-suite/enum.i26
-rw-r--r--Examples/test-suite/enum_scope.i16
-rw-r--r--Examples/test-suite/enum_scope_template.i20
-rw-r--r--Examples/test-suite/enum_var.i8
-rw-r--r--Examples/test-suite/errors/c_bad_name.i4
-rw-r--r--Examples/test-suite/errors/c_bad_native.i5
-rw-r--r--Examples/test-suite/errors/c_class.i8
-rw-r--r--Examples/test-suite/errors/c_default_error.i4
-rw-r--r--Examples/test-suite/errors/c_deprecated.i8
-rw-r--r--Examples/test-suite/errors/c_empty_char.i4
-rw-r--r--Examples/test-suite/errors/c_enum_badvalue.i7
-rw-r--r--Examples/test-suite/errors/c_extra_rblock.i8
-rw-r--r--Examples/test-suite/errors/c_extra_rbrace.i7
-rw-r--r--Examples/test-suite/errors/c_extra_unsigned.i6
-rw-r--r--Examples/test-suite/errors/c_insert_missing.i3
-rw-r--r--Examples/test-suite/errors/c_long_short.i6
-rw-r--r--Examples/test-suite/errors/c_missing_rbrace.i10
-rw-r--r--Examples/test-suite/errors/c_missing_semi.i4
-rw-r--r--Examples/test-suite/errors/c_redefine.i20
-rw-r--r--Examples/test-suite/errors/c_varargs.i3
-rw-r--r--Examples/test-suite/errors/c_varargs_neg.i7
-rw-r--r--Examples/test-suite/errors/cpp_bad_extern.i7
-rw-r--r--Examples/test-suite/errors/cpp_extend_redefine.i23
-rw-r--r--Examples/test-suite/errors/cpp_extend_undefined.i6
-rw-r--r--Examples/test-suite/errors/cpp_inline_namespace.i7
-rw-r--r--Examples/test-suite/errors/cpp_missing_rtemplate.i11
-rw-r--r--Examples/test-suite/errors/cpp_namespace_alias.i14
-rw-r--r--Examples/test-suite/errors/cpp_namespace_aliasnot.i4
-rw-r--r--Examples/test-suite/errors/cpp_namespace_aliasundef.i3
-rw-r--r--Examples/test-suite/errors/cpp_nested.i13
-rw-r--r--Examples/test-suite/errors/cpp_no_access.i4
-rw-r--r--Examples/test-suite/errors/cpp_nobase.i7
-rw-r--r--Examples/test-suite/errors/cpp_overload.i15
-rw-r--r--Examples/test-suite/errors/cpp_private_defvalue.i7
-rw-r--r--Examples/test-suite/errors/cpp_private_inherit.i11
-rw-r--r--Examples/test-suite/errors/cpp_template_argname.i8
-rw-r--r--Examples/test-suite/errors/cpp_template_nargs.i10
-rw-r--r--Examples/test-suite/errors/cpp_template_not.i9
-rw-r--r--Examples/test-suite/errors/cpp_template_partial.i4
-rw-r--r--Examples/test-suite/errors/cpp_template_repeat.i7
-rw-r--r--Examples/test-suite/errors/cpp_template_undef.i7
-rw-r--r--Examples/test-suite/errors/cpp_using_not.i9
-rw-r--r--Examples/test-suite/errors/cpp_using_undef.i9
-rwxr-xr-xExamples/test-suite/errors/make.sh103
-rw-r--r--Examples/test-suite/errors/nomodule.i2
-rw-r--r--Examples/test-suite/errors/pp_badeval.i11
-rw-r--r--Examples/test-suite/errors/pp_defined.i7
-rw-r--r--Examples/test-suite/errors/pp_macro_args.i7
-rw-r--r--Examples/test-suite/errors/pp_macro_badchar.i5
-rw-r--r--Examples/test-suite/errors/pp_macro_nargs.i16
-rw-r--r--Examples/test-suite/errors/pp_macro_redef.i8
-rw-r--r--Examples/test-suite/errors/pp_macro_rparen.i3
-rw-r--r--Examples/test-suite/errors/pp_macro_unterminated.i7
-rw-r--r--Examples/test-suite/errors/pp_misplaced_elif.i7
-rw-r--r--Examples/test-suite/errors/pp_misplaced_else.i7
-rw-r--r--Examples/test-suite/errors/pp_missing_enddef.i7
-rw-r--r--Examples/test-suite/errors/pp_missing_endif.i6
-rw-r--r--Examples/test-suite/errors/pp_missing_file.i3
-rw-r--r--Examples/test-suite/errors/pp_missing_rblock.i7
-rw-r--r--Examples/test-suite/errors/pp_unterm_char.i7
-rw-r--r--Examples/test-suite/errors/pp_unterm_comment.i6
-rw-r--r--Examples/test-suite/errors/pp_unterm_string.i6
-rw-r--r--Examples/test-suite/errors/swig_apply_nargs.i6
-rw-r--r--Examples/test-suite/errors/swig_identifier.i6
-rw-r--r--Examples/test-suite/errors/swig_insert_bad.i5
-rw-r--r--Examples/test-suite/errors/swig_typemap_copy.i3
-rw-r--r--Examples/test-suite/errors/swig_typemap_old.i6
-rw-r--r--Examples/test-suite/evil_diamond.i23
-rw-r--r--Examples/test-suite/evil_diamond_ns.i24
-rw-r--r--Examples/test-suite/evil_diamond_prop.i36
-rw-r--r--Examples/test-suite/explicit.i15
-rw-r--r--Examples/test-suite/extend_template.i26
-rw-r--r--Examples/test-suite/extend_template_ns.i32
-rw-r--r--Examples/test-suite/grouping.i31
-rw-r--r--Examples/test-suite/guile/.cvsignore2
-rw-r--r--Examples/test-suite/guile/Makefile44
-rw-r--r--Examples/test-suite/guile/README4
-rw-r--r--Examples/test-suite/guile/casts_runme.scm13
-rw-r--r--Examples/test-suite/guile/char_constant_runme.scm9
-rw-r--r--Examples/test-suite/guile/imports_runme.scm19
-rw-r--r--Examples/test-suite/guile/list_vector_runme.scm28
-rw-r--r--Examples/test-suite/guile/multivalue_runme.scm24
-rw-r--r--Examples/test-suite/guile/name_runme.scm10
-rw-r--r--Examples/test-suite/guile/overload_complicated_runme.scm18
-rw-r--r--Examples/test-suite/guile/overload_simple_runme.scm56
-rw-r--r--Examples/test-suite/guile/overload_subtype_runme.scm12
-rw-r--r--Examples/test-suite/guile/pointer_in_out_runme.scm18
-rw-r--r--Examples/test-suite/guile/unions_runme.scm41
-rw-r--r--Examples/test-suite/ignore_parameter.i42
-rw-r--r--Examples/test-suite/import_nomodule.h2
-rw-r--r--Examples/test-suite/import_nomodule.i24
-rw-r--r--Examples/test-suite/imports.list2
-rw-r--r--Examples/test-suite/imports_a.h7
-rw-r--r--Examples/test-suite/imports_a.i12
-rw-r--r--Examples/test-suite/imports_b.h11
-rw-r--r--Examples/test-suite/imports_b.i14
-rw-r--r--Examples/test-suite/inherit_missing.i43
-rw-r--r--Examples/test-suite/java/.cvsignore185
-rw-r--r--Examples/test-suite/java/Makefile72
-rw-r--r--Examples/test-suite/java/README6
-rw-r--r--Examples/test-suite/java/arrays_global_twodim_runme.java33
-rw-r--r--Examples/test-suite/java/cpp_typedef_runme.java30
-rw-r--r--Examples/test-suite/java/dynamic_cast_runme.java29
-rw-r--r--Examples/test-suite/java/ignore_parameter_runme.java36
-rw-r--r--Examples/test-suite/java/imports_runme.java24
-rw-r--r--Examples/test-suite/java/java_constants_runme.java29
-rw-r--r--Examples/test-suite/java/java_jnitypes_runme.java57
-rw-r--r--Examples/test-suite/java/java_lib_arrays_runme.java150
-rw-r--r--Examples/test-suite/java/java_pragmas_runme.java15
-rw-r--r--Examples/test-suite/java/java_throws_runme.java46
-rw-r--r--Examples/test-suite/java/java_typemaps_proxy_runme.java48
-rw-r--r--Examples/test-suite/java/java_typemaps_typewrapper_runme.java45
-rw-r--r--Examples/test-suite/java/lib_typemaps_runme.java85
-rw-r--r--Examples/test-suite/java/long_long_runme.java50
-rw-r--r--Examples/test-suite/java/primitive_ref_runme.java64
-rw-r--r--Examples/test-suite/java/ret_by_value_runme.java33
-rw-r--r--Examples/test-suite/java/template_classes_runme.java25
-rw-r--r--Examples/test-suite/java/unions_runme.java68
-rw-r--r--Examples/test-suite/java_constants.i30
-rw-r--r--Examples/test-suite/java_jnitypes.i29
-rw-r--r--Examples/test-suite/java_lib_arrays.i11
-rw-r--r--Examples/test-suite/java_pragmas.i48
-rw-r--r--Examples/test-suite/java_throws.i41
-rw-r--r--Examples/test-suite/java_typemaps_proxy.i53
-rw-r--r--Examples/test-suite/java_typemaps_typewrapper.i57
-rw-r--r--Examples/test-suite/kind.i34
-rw-r--r--Examples/test-suite/lib_carrays.i9
-rw-r--r--Examples/test-suite/lib_cdata.i8
-rw-r--r--Examples/test-suite/lib_cmalloc.i12
-rw-r--r--Examples/test-suite/lib_constraints.i32
-rw-r--r--Examples/test-suite/lib_cpointer.i10
-rw-r--r--Examples/test-suite/lib_cstring.i88
-rw-r--r--Examples/test-suite/lib_math.i2
-rw-r--r--Examples/test-suite/lib_std_deque.i47
-rw-r--r--Examples/test-suite/lib_std_string.i20
-rw-r--r--Examples/test-suite/lib_std_vector.i47
-rw-r--r--Examples/test-suite/lib_typemaps.i95
-rw-r--r--Examples/test-suite/list_vector.i153
-rw-r--r--Examples/test-suite/long_long.i40
-rw-r--r--Examples/test-suite/macro_2.i22
-rw-r--r--Examples/test-suite/member_template.i20
-rw-r--r--Examples/test-suite/memberin1.i63
-rw-r--r--Examples/test-suite/minherit.i80
-rw-r--r--Examples/test-suite/multivalue.i52
-rw-r--r--Examples/test-suite/mzscheme/.cvsignore1
-rw-r--r--Examples/test-suite/mzscheme/Makefile40
-rw-r--r--Examples/test-suite/mzscheme/README4
-rw-r--r--Examples/test-suite/mzscheme/casts_runme.scm7
-rw-r--r--Examples/test-suite/mzscheme/char_constant_runme.scm6
-rw-r--r--Examples/test-suite/mzscheme/import_runme.scm16
-rw-r--r--Examples/test-suite/mzscheme/name_runme.scm10
-rw-r--r--Examples/test-suite/mzscheme/unions_runme.scm38
-rw-r--r--Examples/test-suite/name.i26
-rw-r--r--Examples/test-suite/name_cxx.i16
-rw-r--r--Examples/test-suite/name_inherit.i13
-rw-r--r--Examples/test-suite/namespace_enum.i24
-rw-r--r--Examples/test-suite/namespace_extend.i34
-rw-r--r--Examples/test-suite/namespace_nested.i59
-rw-r--r--Examples/test-suite/namespace_template.i78
-rw-r--r--Examples/test-suite/namespace_typemap.i229
-rw-r--r--Examples/test-suite/nested.i34
-rw-r--r--Examples/test-suite/newobject1.i51
-rw-r--r--Examples/test-suite/newobject2.i38
-rw-r--r--Examples/test-suite/ocaml/Makefile64
-rw-r--r--Examples/test-suite/ocaml/README2
-rw-r--r--Examples/test-suite/ocaml/class_ignore_runme.ml6
-rwxr-xr-xExamples/test-suite/ocaml/makedebugtop21
-rw-r--r--Examples/test-suite/ocaml/newobject1_runme.ml25
-rw-r--r--Examples/test-suite/ocaml/overload_copy_runme.ml4
-rw-r--r--Examples/test-suite/ocaml/results180
-rw-r--r--Examples/test-suite/ocaml/sneaky1_runme.ml8
-rw-r--r--Examples/test-suite/ocaml/throw_exception_runme.ml27
-rw-r--r--Examples/test-suite/ocaml/typename_runme.ml11
-rw-r--r--Examples/test-suite/ocaml/unions_runme.ml27
-rw-r--r--Examples/test-suite/overload_complicated.i21
-rw-r--r--Examples/test-suite/overload_copy.i16
-rw-r--r--Examples/test-suite/overload_extend.i16
-rw-r--r--Examples/test-suite/overload_extendc.i16
-rw-r--r--Examples/test-suite/overload_simple.i92
-rw-r--r--Examples/test-suite/overload_subtype.i17
-rw-r--r--Examples/test-suite/overload_template.i19
-rw-r--r--Examples/test-suite/perl5/.cvsignore4
-rw-r--r--Examples/test-suite/perl5/Makefile42
-rw-r--r--Examples/test-suite/perl5/README4
-rw-r--r--Examples/test-suite/perl5/import_nomodule_runme.pl7
-rw-r--r--Examples/test-suite/perl5/imports_runme.pl5
-rw-r--r--Examples/test-suite/perl5/overload_copy_runme.pl5
-rw-r--r--Examples/test-suite/perl5/overload_simple_runme.pl120
-rw-r--r--Examples/test-suite/perl5/primitive_ref_runme.pl38
-rw-r--r--Examples/test-suite/perl5/unions_runme.pl54
-rw-r--r--Examples/test-suite/php4/Makefile67
-rw-r--r--Examples/test-suite/php4/abstract_inherit_ok_runme.php413
-rw-r--r--Examples/test-suite/php4/abstract_inherit_runme.php414
-rw-r--r--Examples/test-suite/php4/add_link_runme.php423
-rw-r--r--Examples/test-suite/php4/anonymous_arg_runme.php413
-rw-r--r--Examples/test-suite/php4/argout_runme.php437
-rw-r--r--Examples/test-suite/php4/arrayptr_runme.php415
-rw-r--r--Examples/test-suite/php4/arrays_global_runme.php416
-rw-r--r--Examples/test-suite/php4/arrays_global_twodim_runme.php425
-rw-r--r--Examples/test-suite/php4/arrays_runme.php422
-rw-r--r--Examples/test-suite/php4/arrays_scope_runme.php417
-rw-r--r--Examples/test-suite/php4/bool_default_runme.php420
-rw-r--r--Examples/test-suite/php4/casts_runme.php419
-rw-r--r--Examples/test-suite/php4/class_ignore_runme.php419
-rw-r--r--Examples/test-suite/php4/conversion_namespace_runme.php414
-rw-r--r--Examples/test-suite/php4/conversion_ns_template_runme.php410
-rw-r--r--Examples/test-suite/php4/conversion_runme.php414
-rw-r--r--Examples/test-suite/php4/cpp_static_runme.php415
-rw-r--r--Examples/test-suite/php4/enum_scope_runme.php417
-rw-r--r--Examples/test-suite/php4/enum_scope_template_runme.php417
-rw-r--r--Examples/test-suite/php4/evil_diamond_ns_runme.php419
-rw-r--r--Examples/test-suite/php4/evil_diamond_prop_runme.php438
-rw-r--r--Examples/test-suite/php4/evil_diamond_runme.php417
-rw-r--r--Examples/test-suite/php4/extend_template_ns_runme.php413
-rw-r--r--Examples/test-suite/php4/extend_template_runme.php413
-rw-r--r--Examples/test-suite/php4/grouping_runme.php424
-rw-r--r--Examples/test-suite/php4/ignore_parameter_runme.php439
-rw-r--r--Examples/test-suite/php4/lib_carrays_runme.php415
-rw-r--r--Examples/test-suite/php4/rename_scope_runme.php417
-rw-r--r--Examples/test-suite/php4/skel.php415
-rw-r--r--Examples/test-suite/php4/smart_pointer_rename_runme.php428
-rw-r--r--Examples/test-suite/php4/sym_runme.php423
-rw-r--r--Examples/test-suite/php4/template_arg_typename_runme.php419
-rw-r--r--Examples/test-suite/php4/template_construct_runme.php411
-rw-r--r--Examples/test-suite/php4/tests.php4217
-rw-r--r--Examples/test-suite/php4/typedef_reference_runme.php413
-rw-r--r--Examples/test-suite/php4/typemap_ns_using_runme.php49
-rw-r--r--Examples/test-suite/php4/using1_runme.php49
-rw-r--r--Examples/test-suite/php4/using2_runme.php49
-rw-r--r--Examples/test-suite/php4/valuewrapper_base_runme.php414
-rw-r--r--Examples/test-suite/pike/Makefile44
-rw-r--r--Examples/test-suite/pointer_in_out.i35
-rw-r--r--Examples/test-suite/pointer_reference.i17
-rw-r--r--Examples/test-suite/preproc_1.i10
-rw-r--r--Examples/test-suite/preproc_2.i22
-rw-r--r--Examples/test-suite/preproc_3.i6
-rw-r--r--Examples/test-suite/primitive_ref.i26
-rw-r--r--Examples/test-suite/private_assign.i21
-rw-r--r--Examples/test-suite/pure_virtual.i74
-rw-r--r--Examples/test-suite/python/.cvsignore5
-rw-r--r--Examples/test-suite/python/Makefile44
-rw-r--r--Examples/test-suite/python/README4
-rw-r--r--Examples/test-suite/python/abstract_typedef_runme.py11
-rw-r--r--Examples/test-suite/python/class_ignore_runme.py6
-rw-r--r--Examples/test-suite/python/constover_runme.py38
-rw-r--r--Examples/test-suite/python/cpp_namespace_runme.py45
-rw-r--r--Examples/test-suite/python/default_constructor_runme.py96
-rw-r--r--Examples/test-suite/python/dynamic_cast_runme.py12
-rw-r--r--Examples/test-suite/python/enum_runme.py7
-rw-r--r--Examples/test-suite/python/extend_template_ns_runme.py7
-rw-r--r--Examples/test-suite/python/extend_template_runme.py8
-rw-r--r--Examples/test-suite/python/grouping_runme.py13
-rw-r--r--Examples/test-suite/python/import_nomodule_runme.py7
-rw-r--r--Examples/test-suite/python/imports_runme.py9
-rw-r--r--Examples/test-suite/python/inherit_missing_runme.py17
-rw-r--r--Examples/test-suite/python/lib_std_vector_runme.py17
-rw-r--r--Examples/test-suite/python/minherit_runme.py71
-rw-r--r--Examples/test-suite/python/namespace_typemap_runme.py82
-rw-r--r--Examples/test-suite/python/overload_copy_runme.py3
-rw-r--r--Examples/test-suite/python/overload_extend_runme.py11
-rw-r--r--Examples/test-suite/python/overload_extendc_runme.py11
-rw-r--r--Examples/test-suite/python/overload_simple_runme.py97
-rw-r--r--Examples/test-suite/python/overload_subtype_runme.py11
-rw-r--r--Examples/test-suite/python/overload_template_runme.py5
-rw-r--r--Examples/test-suite/python/primitive_ref_runme.py37
-rw-r--r--Examples/test-suite/python/rename_scope_runme.py10
-rw-r--r--Examples/test-suite/python/smart_pointer_multi_runme.py15
-rw-r--r--Examples/test-suite/python/smart_pointer_multi_typedef_runme.py15
-rw-r--r--Examples/test-suite/python/smart_pointer_not_runme.py42
-rw-r--r--Examples/test-suite/python/smart_pointer_overload_runme.py21
-rw-r--r--Examples/test-suite/python/smart_pointer_rename_runme.py13
-rw-r--r--Examples/test-suite/python/smart_pointer_simple_runme.py13
-rw-r--r--Examples/test-suite/python/smart_pointer_typedef_runme.py13
-rw-r--r--Examples/test-suite/python/sneaky1_runme.py5
-rw-r--r--Examples/test-suite/python/static_const_member_2_runme.py15
-rw-r--r--Examples/test-suite/python/struct_value_runme.py9
-rw-r--r--Examples/test-suite/python/template_construct_runme.py1
-rw-r--r--Examples/test-suite/python/template_inherit_runme.py53
-rw-r--r--Examples/test-suite/python/template_ns4_runme.py5
-rw-r--r--Examples/test-suite/python/template_ns_runme.py17
-rw-r--r--Examples/test-suite/python/template_rename_runme.py12
-rw-r--r--Examples/test-suite/python/template_tbase_template_runme.py5
-rw-r--r--Examples/test-suite/python/template_type_namespace_runme.py5
-rw-r--r--Examples/test-suite/python/template_typedef_cplx2_runme.py95
-rw-r--r--Examples/test-suite/python/template_typedef_cplx3_runme.py34
-rw-r--r--Examples/test-suite/python/template_typedef_cplx4_runme.py34
-rw-r--r--Examples/test-suite/python/template_typedef_cplx_runme.py88
-rw-r--r--Examples/test-suite/python/template_typedef_import_runme.py35
-rw-r--r--Examples/test-suite/python/template_typedef_runme.py33
-rw-r--r--Examples/test-suite/python/typedef_inherit_runme.py23
-rw-r--r--Examples/test-suite/python/typedef_scope_runme.py12
-rw-r--r--Examples/test-suite/python/typemap_namespace_runme.py8
-rw-r--r--Examples/test-suite/python/typemap_ns_using_runme.py4
-rw-r--r--Examples/test-suite/python/typename_runme.py12
-rw-r--r--Examples/test-suite/python/unions_runme.py51
-rw-r--r--Examples/test-suite/python/using1_runme.py4
-rw-r--r--Examples/test-suite/python/using2_runme.py4
-rw-r--r--Examples/test-suite/python/using_composition_runme.py11
-rw-r--r--Examples/test-suite/python/using_extend_runme.py17
-rw-r--r--Examples/test-suite/python/using_inherit_runme.py8
-rw-r--r--Examples/test-suite/python/using_private_runme.py7
-rw-r--r--Examples/test-suite/python/using_protected_runme.py7
-rw-r--r--Examples/test-suite/python/voidtest_runme.py7
-rw-r--r--Examples/test-suite/rename_default.i27
-rw-r--r--Examples/test-suite/rename_scope.i49
-rw-r--r--Examples/test-suite/ret_by_value.i19
-rw-r--r--Examples/test-suite/return_value_scope.i28
-rw-r--r--Examples/test-suite/rname.i48
-rw-r--r--Examples/test-suite/ruby/.cvsignore3
-rw-r--r--Examples/test-suite/ruby/Makefile41
-rw-r--r--Examples/test-suite/ruby/README4
-rwxr-xr-xExamples/test-suite/ruby/class_ignore_runme.rb10
-rwxr-xr-xExamples/test-suite/ruby/constover_runme.rb44
-rwxr-xr-xExamples/test-suite/ruby/cpp_namespace_runme.rb51
-rwxr-xr-xExamples/test-suite/ruby/default_constructor_runme.rb94
-rwxr-xr-xExamples/test-suite/ruby/dynamic_cast_runme.rb13
-rwxr-xr-xExamples/test-suite/ruby/enum_runme.rb6
-rw-r--r--Examples/test-suite/ruby/extend_template_ns_runme.rb12
-rw-r--r--Examples/test-suite/ruby/extend_template_runme.rb10
-rw-r--r--Examples/test-suite/ruby/grouping_runme.rb15
-rwxr-xr-xExamples/test-suite/ruby/imports_runme.rb9
-rw-r--r--Examples/test-suite/ruby/inherit_missing_runme.rb20
-rwxr-xr-xExamples/test-suite/ruby/lib_std_vector_runme.rb17
-rwxr-xr-xExamples/test-suite/ruby/namespace_typemap_runme.rb33
-rw-r--r--Examples/test-suite/ruby/newobject1_runme.rb15
-rw-r--r--Examples/test-suite/ruby/newobject2_runme.rb15
-rwxr-xr-xExamples/test-suite/ruby/overload_copy_runme.rb6
-rwxr-xr-xExamples/test-suite/ruby/overload_extend_runme.rb8
-rwxr-xr-xExamples/test-suite/ruby/overload_extendc_runme.rb7
-rwxr-xr-xExamples/test-suite/ruby/overload_simple_runme.rb119
-rw-r--r--Examples/test-suite/ruby/overload_subtype_runme.rb15
-rwxr-xr-xExamples/test-suite/ruby/overload_template_runme.rb6
-rwxr-xr-xExamples/test-suite/ruby/primitive_ref_runme.rb27
-rw-r--r--Examples/test-suite/ruby/rename_scope_runme.rb10
-rw-r--r--Examples/test-suite/ruby/smart_pointer_const_runme.rb13
-rw-r--r--Examples/test-suite/ruby/smart_pointer_multi_runme.rb15
-rw-r--r--Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb14
-rw-r--r--Examples/test-suite/ruby/smart_pointer_not_runme.rb44
-rw-r--r--Examples/test-suite/ruby/smart_pointer_overload_runme.rb16
-rw-r--r--Examples/test-suite/ruby/smart_pointer_rename_runme.rb12
-rw-r--r--Examples/test-suite/ruby/smart_pointer_simple_runme.rb13
-rw-r--r--Examples/test-suite/ruby/smart_pointer_typedef_runme.rb13
-rwxr-xr-xExamples/test-suite/ruby/sneaky1_runme.rb6
-rwxr-xr-xExamples/test-suite/ruby/template_inherit_runme.rb40
-rwxr-xr-xExamples/test-suite/ruby/template_ns4_runme.rb4
-rwxr-xr-xExamples/test-suite/ruby/template_ns_runme.rb15
-rwxr-xr-xExamples/test-suite/ruby/template_rename_runme.rb12
-rwxr-xr-xExamples/test-suite/ruby/typedef_inherit_runme.rb27
-rwxr-xr-xExamples/test-suite/ruby/typedef_scope_runme.rb13
-rwxr-xr-xExamples/test-suite/ruby/typemap_namespace_runme.rb7
-rwxr-xr-xExamples/test-suite/ruby/typename_runme.rb14
-rw-r--r--Examples/test-suite/ruby/unions_runme.rb54
-rw-r--r--Examples/test-suite/sizeof_pointer.i19
-rw-r--r--Examples/test-suite/smart_pointer_const.i19
-rw-r--r--Examples/test-suite/smart_pointer_multi.i39
-rw-r--r--Examples/test-suite/smart_pointer_multi_typedef.i45
-rw-r--r--Examples/test-suite/smart_pointer_not.i39
-rw-r--r--Examples/test-suite/smart_pointer_overload.i24
-rw-r--r--Examples/test-suite/smart_pointer_protected.i29
-rw-r--r--Examples/test-suite/smart_pointer_rename.i25
-rw-r--r--Examples/test-suite/smart_pointer_simple.i19
-rw-r--r--Examples/test-suite/smart_pointer_typedef.i21
-rw-r--r--Examples/test-suite/sneaky1.i29
-rw-r--r--Examples/test-suite/static_array_member.i12
-rw-r--r--Examples/test-suite/static_const_member.i17
-rw-r--r--Examples/test-suite/static_const_member_2.i53
-rw-r--r--Examples/test-suite/struct_value.i14
-rw-r--r--Examples/test-suite/sym.i24
-rw-r--r--Examples/test-suite/tcl/.cvsignore3
-rw-r--r--Examples/test-suite/tcl/Makefile41
-rw-r--r--Examples/test-suite/tcl/README4
-rw-r--r--Examples/test-suite/tcl/import_nomodule_runme.tcl10
-rw-r--r--Examples/test-suite/tcl/imports_runme.tcl26
-rw-r--r--Examples/test-suite/tcl/overload_copy_runme.tcl18
-rw-r--r--Examples/test-suite/tcl/overload_simple_runme.tcl172
-rw-r--r--Examples/test-suite/tcl/primitive_ref_runme.tcl25
-rw-r--r--Examples/test-suite/tcl/unions_runme.tcl69
-rw-r--r--Examples/test-suite/template.i46
-rw-r--r--Examples/test-suite/template_arg_scope.i16
-rw-r--r--Examples/test-suite/template_arg_typename.i26
-rw-r--r--Examples/test-suite/template_base_template.i35
-rw-r--r--Examples/test-suite/template_classes.i30
-rw-r--r--Examples/test-suite/template_const_ref.i14
-rw-r--r--Examples/test-suite/template_construct.i15
-rw-r--r--Examples/test-suite/template_default.i10
-rw-r--r--Examples/test-suite/template_default2.i44
-rw-r--r--Examples/test-suite/template_default_arg.i34
-rw-r--r--Examples/test-suite/template_default_inherit.i25
-rw-r--r--Examples/test-suite/template_default_qualify.i56
-rw-r--r--Examples/test-suite/template_enum.i15
-rw-r--r--Examples/test-suite/template_enum_ns_inherit.i48
-rw-r--r--Examples/test-suite/template_enum_typedef.i39
-rw-r--r--Examples/test-suite/template_forward.i20
-rw-r--r--Examples/test-suite/template_inherit.i40
-rw-r--r--Examples/test-suite/template_inherit_abstract.i59
-rw-r--r--Examples/test-suite/template_int_const.i50
-rw-r--r--Examples/test-suite/template_ns.i35
-rw-r--r--Examples/test-suite/template_ns2.i16
-rw-r--r--Examples/test-suite/template_ns3.i21
-rw-r--r--Examples/test-suite/template_ns4.i66
-rw-r--r--Examples/test-suite/template_ns_enum.i18
-rw-r--r--Examples/test-suite/template_ns_enum2.i38
-rw-r--r--Examples/test-suite/template_ns_inherit.i30
-rw-r--r--Examples/test-suite/template_ns_scope.i38
-rw-r--r--Examples/test-suite/template_qualifier.i15
-rw-r--r--Examples/test-suite/template_rename.i24
-rw-r--r--Examples/test-suite/template_retvalue.i32
-rw-r--r--Examples/test-suite/template_specialization.i40
-rw-r--r--Examples/test-suite/template_static.i16
-rw-r--r--Examples/test-suite/template_tbase_template.i43
-rw-r--r--Examples/test-suite/template_type_namespace.i14
-rw-r--r--Examples/test-suite/template_typedef.i156
-rw-r--r--Examples/test-suite/template_typedef_cplx.i159
-rw-r--r--Examples/test-suite/template_typedef_cplx2.h156
-rw-r--r--Examples/test-suite/template_typedef_cplx2.i7
-rw-r--r--Examples/test-suite/template_typedef_cplx3.i37
-rw-r--r--Examples/test-suite/template_typedef_cplx4.i44
-rw-r--r--Examples/test-suite/template_typedef_import.i37
-rw-r--r--Examples/test-suite/template_typedef_import.list2
-rw-r--r--Examples/test-suite/template_virtual.i32
-rw-r--r--Examples/test-suite/template_whitespace.i22
-rw-r--r--Examples/test-suite/throw_exception.i29
-rw-r--r--Examples/test-suite/typedef_array_member.i10
-rw-r--r--Examples/test-suite/typedef_funcptr.i26
-rw-r--r--Examples/test-suite/typedef_inherit.i41
-rw-r--r--Examples/test-suite/typedef_mptr.i34
-rw-r--r--Examples/test-suite/typedef_reference.i10
-rw-r--r--Examples/test-suite/typedef_scope.i21
-rw-r--r--Examples/test-suite/typemap_namespace.i39
-rw-r--r--Examples/test-suite/typemap_ns_using.i21
-rw-r--r--Examples/test-suite/typemap_subst.i54
-rw-r--r--Examples/test-suite/typename.i34
-rw-r--r--Examples/test-suite/union_scope.i13
-rw-r--r--Examples/test-suite/unions.i35
-rw-r--r--Examples/test-suite/using1.i22
-rw-r--r--Examples/test-suite/using2.i22
-rw-r--r--Examples/test-suite/using_composition.i24
-rw-r--r--Examples/test-suite/using_extend.i37
-rw-r--r--Examples/test-suite/using_inherit.i17
-rw-r--r--Examples/test-suite/using_namespace.i56
-rw-r--r--Examples/test-suite/using_private.i17
-rw-r--r--Examples/test-suite/using_protected.i17
-rw-r--r--Examples/test-suite/valuewrapper_base.i28
-rw-r--r--Examples/test-suite/virtual_destructor.i16
-rw-r--r--Examples/test-suite/voidtest.i16
487 files changed, 13564 insertions, 0 deletions
diff --git a/Examples/test-suite/README b/Examples/test-suite/README
new file mode 100644
index 000000000..96dea942c
--- /dev/null
+++ b/Examples/test-suite/README
@@ -0,0 +1,42 @@
+SWIG testsuite README file
+--------------------------
+
+This testsuite is here to ensure SWIG can handle a wide range of c/c++
+syntax. The testsuite comprises many testcases in this directory. Each
+test case is tested under each of the language modules thereby
+thoroughly testing all of SWIG. It ensures that each of the language
+modules are at a similar standard.
+
+Those modules that support shadow classes run the tests producing
+shadow classes to test the full language module functionality.
+
+Some test cases need a runtime test. These need implementing in each
+of the language modules. The language modules look for a file in the
+language specific test-suite directory which has _runme appended after
+the testcase name. If one is found it will be run as part of the test.
+
+Some language modules add to this common set of test cases for
+language specific tests. These can be found in the appropriate
+language test-suite directory. There is also a README in each of the
+language module directories.
+
+For each testcase a message showing which testcase is being tested is
+displayed. Nothing else is printed unless the test fails.
+
+
+Some Developer Guidelines
+-------------------------
+
+Note that the whole test suite need not be run each time a testcase is
+modified. An individual testcase may be run by going to the language
+module test-suite directory and using make testcasename.xxx where xxx
+is the type of test (eg cpptest). See common.mk. make -s doesn't print
+any junk on the screen and is useful for emulating the way make check
+works from the SWIG root directory.
+
+If there are runtime tests needed, don't print anything unless there
+is an error in which case stderr is suggested.
+
+Please set the name of the module to the same name as the testcase,
+otherwise modules will not be found.
+
diff --git a/Examples/test-suite/abstract_inherit.i b/Examples/test-suite/abstract_inherit.i
new file mode 100644
index 000000000..5610c72d3
--- /dev/null
+++ b/Examples/test-suite/abstract_inherit.i
@@ -0,0 +1,20 @@
+%module abstract_inherit
+
+%warnfilter(403) Spam;
+%warnfilter(403) Bar;
+
+%inline %{
+
+class Foo {
+public:
+ virtual int blah() = 0;
+};
+
+class Bar : public Foo { };
+
+class Spam: public Foo {
+public:
+ Spam() { }
+};
+
+%}
diff --git a/Examples/test-suite/abstract_inherit_ok.i b/Examples/test-suite/abstract_inherit_ok.i
new file mode 100644
index 000000000..04715bad3
--- /dev/null
+++ b/Examples/test-suite/abstract_inherit_ok.i
@@ -0,0 +1,21 @@
+%module abstract_inherit_ok
+
+%feature("notabstract") Spam;
+%warnfilter(403) Spam;
+
+%inline %{
+
+class Foo {
+public:
+ virtual int blah() = 0;
+};
+
+class Spam: public Foo {
+public:
+ Spam() { }
+#ifndef SWIG
+ int blah() { return 0; }
+#endif
+};
+
+%}
diff --git a/Examples/test-suite/abstract_signature.i b/Examples/test-suite/abstract_signature.i
new file mode 100644
index 000000000..50ccbfc7a
--- /dev/null
+++ b/Examples/test-suite/abstract_signature.i
@@ -0,0 +1,25 @@
+%module abstract_signature
+
+%warnfilter(801) abstract_foo; // Ruby, wrong class name
+%warnfilter(801) abstract_bar; // Ruby, wrong class name
+
+%inline %{
+class abstract_foo
+{
+public:
+ abstract_foo() { };
+ virtual ~abstract_foo() { };
+ virtual int meth(int meth_param) = 0;
+};
+
+
+class abstract_bar : public abstract_foo
+{
+public:
+ abstract_bar() { };
+
+ virtual ~abstract_bar() { };
+ int meth(int meth_param_1, int meth_param_2) { return 0; }
+};
+
+%}
diff --git a/Examples/test-suite/abstract_typedef.i b/Examples/test-suite/abstract_typedef.i
new file mode 100644
index 000000000..89107dfc2
--- /dev/null
+++ b/Examples/test-suite/abstract_typedef.i
@@ -0,0 +1,52 @@
+%module abstract_typedef
+
+
+%inline %{
+ struct Engine
+ {
+ };
+
+ struct Object
+ {
+ virtual bool write(Engine& archive) const = 0;
+ };
+
+ typedef Engine PersEngine;
+ typedef Object PersClassBase;
+
+
+ class A : public PersClassBase
+ {
+ // This works always
+ // bool write(Engine& archive) const;
+
+ // This doesn't with Swig 1.3.17.
+ // But it works fine with 1.3.16
+ bool write(PersEngine& archive) const
+ {
+ return true;
+ }
+
+
+ };
+
+%}
+
+
+/*
+
+Problem related to the direct comparison of strings
+in the file allocate.cxx (line 55)
+
+ ......
+ String *local_decl = Getattr(dn,"decl");
+ if (local_decl && !Strcmp(local_decl, base_decl)) {
+ ......
+
+with the direct string comparison, no equivalent types
+are checked and the two 'write' functions appear to be
+different because
+
+ "q(const).f(r.bss::PersEngine)." != "q(const).f(r.bss::Engine)."
+
+*/
diff --git a/Examples/test-suite/add_link.i b/Examples/test-suite/add_link.i
new file mode 100644
index 000000000..dfd4b376d
--- /dev/null
+++ b/Examples/test-suite/add_link.i
@@ -0,0 +1,20 @@
+%module add_link
+
+%extend Foo {
+Foo *blah() {
+ return new Foo();
+}
+};
+
+
+%inline %{
+class Foo {
+public:
+ Foo() { };
+};
+
+%}
+
+
+
+
diff --git a/Examples/test-suite/anonymous_arg.i b/Examples/test-suite/anonymous_arg.i
new file mode 100644
index 000000000..b2417fda2
--- /dev/null
+++ b/Examples/test-suite/anonymous_arg.i
@@ -0,0 +1,12 @@
+/* This interface file checks whether the SWIG parses anonymous
+ arguments with default values. Bug reported by Annalisa Terracina
+ <annalisa.terracina@datamat.it> on 2001-07-03.
+*/
+
+%module anonymous_arg
+
+void foo(int = 7771);
+
+%{
+ void foo(int x) {}
+%}
diff --git a/Examples/test-suite/argout.i b/Examples/test-suite/argout.i
new file mode 100644
index 000000000..1584a9728
--- /dev/null
+++ b/Examples/test-suite/argout.i
@@ -0,0 +1,37 @@
+/* This interface file checks how well SWIG handles passing data back
+ through arguments WITHOUT returning it seperatly; for the cases where
+ maybe multiple values are passed by refernce and all want changing */
+
+%module argout
+
+%include cpointer.i
+%pointer_functions(int,intp);
+
+%inline %{
+// returns old value
+int incp(int *value) {
+ return (*value)++;
+}
+
+// returns old value
+int incr(int &value) {
+ return value++;
+}
+
+typedef int & IntRef;
+// returns old value
+int inctr(IntRef value) {
+ return value++;
+}
+
+// example of the old DB login type routines where you keep
+// a void* which it points to its opaque struct when you login
+// So login function takes a void**
+void voidhandle(void** handle) {
+ *handle=(void*)"Here it is";
+}
+char * handle(void* handle) {
+ return (char *)handle;
+}
+
+%}
diff --git a/Examples/test-suite/arrayptr.i b/Examples/test-suite/arrayptr.i
new file mode 100644
index 000000000..b7fe29af2
--- /dev/null
+++ b/Examples/test-suite/arrayptr.i
@@ -0,0 +1,12 @@
+// A module with a function that involves pointers to arrays
+
+%module arrayptr
+
+%inline %{
+
+void foo(int (*x)[10]) {
+
+}
+%}
+
+
diff --git a/Examples/test-suite/arrays.i b/Examples/test-suite/arrays.i
new file mode 100644
index 000000000..57912905d
--- /dev/null
+++ b/Examples/test-suite/arrays.i
@@ -0,0 +1,52 @@
+/*
+This test case tests that various types of arrays are working.
+*/
+
+%module arrays
+%pragma make_default
+
+%inline %{
+#define ARRAY_LEN 2
+
+typedef enum {One, Two, Three, Four, Five} finger;
+
+typedef struct {
+ double double_field;
+} SimpleStruct;
+
+typedef struct {
+ char array_c [ARRAY_LEN];
+ signed char array_sc[ARRAY_LEN];
+ unsigned char array_uc[ARRAY_LEN];
+ short array_s [ARRAY_LEN];
+ unsigned short array_us[ARRAY_LEN];
+ int array_i [ARRAY_LEN];
+ unsigned int array_ui[ARRAY_LEN];
+ long array_l [ARRAY_LEN];
+ unsigned long array_ul[ARRAY_LEN];
+ long long array_ll[ARRAY_LEN];
+ float array_f [ARRAY_LEN];
+ double array_d [ARRAY_LEN];
+ SimpleStruct array_struct[ARRAY_LEN];
+ SimpleStruct* array_structpointers[ARRAY_LEN];
+ int* array_ipointers [ARRAY_LEN];
+ finger array_enum[ARRAY_LEN];
+ finger* array_enumpointers[ARRAY_LEN];
+ const int array_const_i[ARRAY_LEN];
+} ArrayStruct;
+
+void fn_taking_arrays(SimpleStruct array_struct[ARRAY_LEN]) {}
+
+/* Pointer helper functions used in the Java run test */
+int* newintpointer() {
+ return (int*)malloc(sizeof(int));
+}
+void setintfrompointer(int* intptr, int value) {
+ *intptr = value;
+}
+int getintfrompointer(int* intptr) {
+ return *intptr;
+}
+
+%}
+
diff --git a/Examples/test-suite/arrays_global.i b/Examples/test-suite/arrays_global.i
new file mode 100644
index 000000000..c5140acc8
--- /dev/null
+++ b/Examples/test-suite/arrays_global.i
@@ -0,0 +1,37 @@
+/*
+This test case tests that various types of arrays are working.
+*/
+
+%module arrays_global
+%pragma make_default
+
+%inline %{
+#define ARRAY_LEN 2
+
+typedef enum {One, Two, Three, Four, Five} finger;
+
+typedef struct {
+ double double_field;
+} SimpleStruct;
+
+char array_c [ARRAY_LEN];
+signed char array_sc[ARRAY_LEN];
+unsigned char array_uc[ARRAY_LEN];
+short array_s [ARRAY_LEN];
+unsigned short array_us[ARRAY_LEN];
+int array_i [ARRAY_LEN];
+unsigned int array_ui[ARRAY_LEN];
+long array_l [ARRAY_LEN];
+unsigned long array_ul[ARRAY_LEN];
+long long array_ll[ARRAY_LEN];
+float array_f [ARRAY_LEN];
+double array_d [ARRAY_LEN];
+SimpleStruct array_struct[ARRAY_LEN];
+SimpleStruct* array_structpointers[ARRAY_LEN];
+int* array_ipointers [ARRAY_LEN];
+finger array_enum[ARRAY_LEN];
+finger* array_enumpointers[ARRAY_LEN];
+const int array_const_i[ARRAY_LEN] = {10, 20};
+
+%}
+
diff --git a/Examples/test-suite/arrays_global_twodim.i b/Examples/test-suite/arrays_global_twodim.i
new file mode 100644
index 000000000..0cacceb3e
--- /dev/null
+++ b/Examples/test-suite/arrays_global_twodim.i
@@ -0,0 +1,42 @@
+/*
+Two dimension arrays
+*/
+
+%module arrays_global_twodim
+
+%inline %{
+#define ARRAY_LEN_X 2
+#define ARRAY_LEN_Y 4
+
+typedef enum {One, Two, Three, Four, Five} finger;
+
+typedef struct {
+ double double_field;
+} SimpleStruct;
+
+char array_c [ARRAY_LEN_X][ARRAY_LEN_Y];
+signed char array_sc[ARRAY_LEN_X][ARRAY_LEN_Y];
+unsigned char array_uc[ARRAY_LEN_X][ARRAY_LEN_Y];
+short array_s [ARRAY_LEN_X][ARRAY_LEN_Y];
+unsigned short array_us[ARRAY_LEN_X][ARRAY_LEN_Y];
+int array_i [ARRAY_LEN_X][ARRAY_LEN_Y];
+unsigned int array_ui[ARRAY_LEN_X][ARRAY_LEN_Y];
+long array_l [ARRAY_LEN_X][ARRAY_LEN_Y];
+unsigned long array_ul[ARRAY_LEN_X][ARRAY_LEN_Y];
+long long array_ll[ARRAY_LEN_X][ARRAY_LEN_Y];
+float array_f [ARRAY_LEN_X][ARRAY_LEN_Y];
+double array_d [ARRAY_LEN_X][ARRAY_LEN_Y];
+SimpleStruct array_struct[ARRAY_LEN_X][ARRAY_LEN_Y];
+SimpleStruct* array_structpointers[ARRAY_LEN_X][ARRAY_LEN_Y];
+int* array_ipointers [ARRAY_LEN_X][ARRAY_LEN_Y];
+finger array_enum[ARRAY_LEN_X][ARRAY_LEN_Y];
+finger* array_enumpointers[ARRAY_LEN_X][ARRAY_LEN_Y];
+const int array_const_i[ARRAY_LEN_X][ARRAY_LEN_Y] = { {10, 11, 12, 13}, {14, 15, 16, 17} };
+
+void fn_taking_arrays(SimpleStruct array_struct[ARRAY_LEN_X][ARRAY_LEN_Y]) {}
+
+int get_2d_array(int (*array)[ARRAY_LEN_Y], int x, int y){
+ return array[x][y];
+}
+%}
+
diff --git a/Examples/test-suite/arrays_scope.i b/Examples/test-suite/arrays_scope.i
new file mode 100644
index 000000000..164f7ec32
--- /dev/null
+++ b/Examples/test-suite/arrays_scope.i
@@ -0,0 +1,19 @@
+%module arrays_scope
+
+%inline %{
+
+enum { ASIZE = 256 };
+namespace foo {
+ enum { BSIZE = 512 };
+ class Bar {
+ public:
+ enum { CSIZE = 768 };
+ int adata[ASIZE];
+ int bdata[BSIZE];
+ int cdata[CSIZE];
+ void blah(int x[ASIZE], int y[BSIZE], int z[CSIZE]) { };
+ };
+}
+
+%}
+
diff --git a/Examples/test-suite/bool_default.i b/Examples/test-suite/bool_default.i
new file mode 100644
index 000000000..b04035c1a
--- /dev/null
+++ b/Examples/test-suite/bool_default.i
@@ -0,0 +1,9 @@
+// [ 548272] Default arguments
+%module bool_default
+
+%inline %{
+
+bool foo(bool x = true) {
+ return !x;
+}
+%}
diff --git a/Examples/test-suite/casts.i b/Examples/test-suite/casts.i
new file mode 100644
index 000000000..4893756f0
--- /dev/null
+++ b/Examples/test-suite/casts.i
@@ -0,0 +1,21 @@
+%module casts
+
+%inline %{
+
+class A {
+ public:
+ A() {}
+
+ void hello()
+ {
+ }
+};
+
+class B : public A
+{
+ public:
+ B() {}
+
+};
+
+%}
diff --git a/Examples/test-suite/char_constant.i b/Examples/test-suite/char_constant.i
new file mode 100644
index 000000000..bcbc0680d
--- /dev/null
+++ b/Examples/test-suite/char_constant.i
@@ -0,0 +1,11 @@
+/* This interface file tests whether character constants are correctly
+ wrapped as procedures returning Scheme characters (rather than
+ Scheme strings).
+*/
+
+%module char_constant
+
+#define CHAR_CONSTANT 'x'
+
+#define STRING_CONSTANT "xyzzy"
+
diff --git a/Examples/test-suite/class_ignore.i b/Examples/test-suite/class_ignore.i
new file mode 100644
index 000000000..4929fca68
--- /dev/null
+++ b/Examples/test-suite/class_ignore.i
@@ -0,0 +1,20 @@
+%module class_ignore
+
+%ignore Foo;
+
+%inline %{
+class Foo {
+public:
+ virtual char *blah() = 0;
+};
+
+class Bar : public Foo {
+public:
+ virtual char *blah() { return (char *) "Bar::blah"; }
+};
+
+char *do_blah(Foo *f) {
+ return f->blah();
+}
+%}
+
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
new file mode 100644
index 000000000..f2bf9b303
--- /dev/null
+++ b/Examples/test-suite/common.mk
@@ -0,0 +1,291 @@
+#######################################################################
+# $Header$
+#
+# SWIG test suite makefile.
+# The test suite comprises many different test cases, which have
+# typically produced bugs in the past. The aim is to have the test
+# cases compiling for every language modules. Some testcase have
+# a runtime test which is written in each of the module's language.
+#
+# This makefile runs SWIG on the testcases, compiles the c/c++ code
+# then builds the object code for use by the language.
+# To complete a test in a language follow these guidelines:
+# 1) Add testcases to CPP_TEST_CASES (c++) or C_TEST_CASES (c) or
+# MULTI_CPP_TEST_CASES (multi-module c++ tests)
+# 2) If not already done, create a makefile which:
+# a) Defines LANGUAGE matching a language rule in Examples/Makefile,
+# for example LANGUAGE = java
+# b) Define rules for %.ctest, %.cpptest, %.multicpptest and %.clean.
+#
+# The variables below can be overridden after including this makefile
+#######################################################################
+
+#######################################################################
+# Variables
+#######################################################################
+TOP = ../..
+SWIG = $(TOP)/../swig
+SWIG_LIB = $(TOP)/../Lib
+TEST_SUITE = test-suite
+CXXSRCS =
+CSRCS =
+TARGETPREFIX =
+TARGETSUFFIX =
+SWIGOPT = -I$(TOP)/$(TEST_SUITE)
+INCLUDES = -I$(TOP)/$(TEST_SUITE)
+RUNTIMEDIR = ../$(TOP)/Runtime/.libs
+DYNAMIC_LIB_PATH = $(RUNTIMEDIR):.
+
+# Please keep test cases in alphabetical order.
+#
+# EXCEPTION: PLEASE PUT BROKEN TEST CASES AT THE TOP OF THIS LIST.
+
+# C++ test cases. (Can be run individually using make testcase.cpptest.)
+
+CPP_TEST_BROKEN = \
+ abstract_typedef \
+ namespace_nested \
+ template_default_arg \
+ using_namespace
+
+CPP_TEST_CASES += $(CPP_TEST_BROKEN)
+
+CPP_TEST_CASES += \
+ abstract_inherit \
+ abstract_inherit_ok \
+ abstract_signature \
+ add_link \
+ anonymous_arg \
+ argout \
+ arrays_global \
+ arrays_global_twodim \
+ arrays_scope \
+ bool_default \
+ casts \
+ class_ignore \
+ const_const_2 \
+ constant_pointers \
+ constover \
+ constructor_exception \
+ constructor_explicit \
+ constructor_value \
+ conversion \
+ conversion_namespace \
+ conversion_ns_template \
+ cplusplus_throw \
+ cpp_enum \
+ cpp_enum_scope \
+ cpp_enum_scope \
+ cpp_namespace \
+ cpp_nodefault \
+ cpp_static \
+ cpp_typedef \
+ default_cast \
+ default_constructor \
+ default_ns \
+ default_ref \
+ dynamic_cast \
+ enum_scope \
+ enum_scope_template \
+ enum_var \
+ evil_diamond \
+ evil_diamond_ns \
+ evil_diamond_prop \
+ explicit \
+ extend_template \
+ extend_template_ns \
+ grouping \
+ ignore_parameter \
+ import_nomodule \
+ inherit_missing \
+ kind \
+ lib_carrays \
+ lib_cdata \
+ lib_cpointer \
+ lib_std_deque \
+ lib_std_string \
+ lib_std_vector \
+ lib_typemaps \
+ member_template \
+ minherit \
+ name_cxx \
+ name_inherit \
+ namespace_enum \
+ namespace_extend \
+ namespace_template \
+ namespace_typemap \
+ newobject1 \
+ overload_complicated \
+ overload_copy \
+ overload_extend \
+ overload_simple \
+ overload_subtype \
+ overload_template \
+ pointer_reference \
+ primitive_ref \
+ private_assign \
+ pure_virtual \
+ rename_default \
+ rename_default \
+ rename_scope \
+ return_value_scope \
+ rname \
+ smart_pointer_const \
+ smart_pointer_multi \
+ smart_pointer_multi_typedef \
+ smart_pointer_not \
+ smart_pointer_overload \
+ smart_pointer_protected \
+ smart_pointer_rename \
+ smart_pointer_simple \
+ smart_pointer_typedef \
+ static_array_member \
+ static_const_member \
+ static_const_member_2 \
+ struct_value \
+ template \
+ template_arg_scope \
+ template_arg_typename \
+ template_base_template \
+ template_classes \
+ template_const_ref \
+ template_construct \
+ template_default \
+ template_default2 \
+ template_default_inherit \
+ template_default_qualify \
+ template_enum \
+ template_enum_ns_inherit \
+ template_enum_typedef \
+ template_forward \
+ template_inherit \
+ template_inherit_abstract \
+ template_int_const \
+ template_ns \
+ template_ns2 \
+ template_ns3 \
+ template_ns4 \
+ template_ns_enum \
+ template_ns_enum2 \
+ template_ns_inherit \
+ template_ns_scope \
+ template_qualifier \
+ template_qualifier \
+ template_rename \
+ template_retvalue \
+ template_specialization \
+ template_static \
+ template_tbase_template \
+ template_type_namespace \
+ template_typedef \
+ template_typedef_cplx \
+ template_typedef_cplx2 \
+ template_typedef_cplx3 \
+ template_typedef_cplx4 \
+ template_virtual \
+ template_whitespace \
+ throw_exception \
+ typedef_array_member \
+ typedef_funcptr \
+ typedef_inherit \
+ typedef_mptr \
+ typedef_reference \
+ typedef_scope \
+ typemap_namespace \
+ typemap_ns_using \
+ typename \
+ union_scope \
+ using1 \
+ using2 \
+ using_composition \
+ using_extend \
+ using_inherit \
+ using_private \
+ using_protected \
+ valuewrapper_base \
+ virtual_destructor \
+ voidtest
+
+# C test cases. (Can be run individually using make testcase.ctest.)
+C_TEST_CASES += \
+ arrayptr \
+ arrays \
+ char_constant \
+ const_const \
+ defineop \
+ defines \
+ enum \
+ lib_carrays \
+ lib_cdata \
+ lib_cmalloc \
+ lib_constraints \
+ lib_cpointer \
+ lib_math \
+ long_long \
+ macro_2 \
+ name \
+ nested \
+ newobject2 \
+ overload_extendc \
+ preproc_1 \
+ preproc_2 \
+ preproc_3 \
+ ret_by_value \
+ sizeof_pointer \
+ sneaky1 \
+ typemap_subst \
+ unions
+
+
+MULTI_CPP_TEST_CASES += \
+ imports \
+ template_typedef_import
+
+ALL_TEST_CASES = $(CPP_TEST_CASES:=.cpptest) \
+ $(C_TEST_CASES:=.ctest) \
+ $(MULTI_CPP_TEST_CASES:=.multicpptest)
+ALL_CLEAN = $(CPP_TEST_CASES:=.clean) \
+ $(C_TEST_CASES:=.clean) \
+ $(MULTI_CPP_TEST_CASES:=.clean)
+
+#######################################################################
+# The following applies for all module languages
+#######################################################################
+all: $(ALL_TEST_CASES)
+
+check: all
+
+swig_and_compile_cpp = \
+ $(MAKE) -f $(TOP)/Makefile CXXSRCS="$(CXXSRCS)" SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
+ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
+ TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACE="$*.i" \
+ $(LANGUAGE)$(VARIANT)_cpp
+
+swig_and_compile_c = \
+ $(MAKE) -f $(TOP)/Makefile CSRCS="$(CSRCS)" SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
+ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
+ TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACE="$*.i" \
+ $(LANGUAGE)$(VARIANT)
+
+swig_and_compile_multi_cpp = \
+ for f in `cat $(TOP)/$(TEST_SUITE)/$*.list` ; do \
+ $(MAKE) -f $(TOP)/Makefile CXXSRCS="$(CXXSRCS)" SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
+ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" RUNTIMEDIR="$(RUNTIMEDIR)" \
+ TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACE="$$f.i" \
+ NOLINK=true $(LANGUAGE)$(VARIANT)_multi_cpp; \
+ done
+
+setup = \
+ @if [ -f $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ echo "Checking testcase $* (with run test) under $(LANGUAGE)" ; \
+ else \
+ echo "Checking testcase $* under $(LANGUAGE)" ; \
+ fi;
+
+
+
+#######################################################################
+# Clean
+#######################################################################
+clean: $(ALL_CLEAN)
+
diff --git a/Examples/test-suite/const_const.i b/Examples/test-suite/const_const.i
new file mode 100644
index 000000000..7c1c92d22
--- /dev/null
+++ b/Examples/test-suite/const_const.i
@@ -0,0 +1,13 @@
+/* This interface file tests whether SWIG handles types like
+ "const int *const" right.
+
+ SWIG 1.3a5 signals a syntax error.
+*/
+
+%module const_const
+
+%typemap(in) const int *const { $1 = NULL; }
+
+%inline %{
+void foo(const int *const i) {}
+%}
diff --git a/Examples/test-suite/const_const_2.i b/Examples/test-suite/const_const_2.i
new file mode 100644
index 000000000..9094262a6
--- /dev/null
+++ b/Examples/test-suite/const_const_2.i
@@ -0,0 +1,21 @@
+/* This interface file tests whether SWIG handles doubly constant
+ methods right. SF Bug #216057 against Swig 1.3a5, reported by
+ Mike Romberg <romberg@users.sf.net>
+*/
+
+%module const_const_2
+
+%inline %{
+class Spam {
+public:
+ Spam() {}
+};
+
+class Eggs {
+ public:
+ Eggs() {}
+
+ const Spam *spam(void) const { return new Spam(); }
+};
+
+ %}
diff --git a/Examples/test-suite/constant_pointers.i b/Examples/test-suite/constant_pointers.i
new file mode 100644
index 000000000..7edc6d4fd
--- /dev/null
+++ b/Examples/test-suite/constant_pointers.i
@@ -0,0 +1,74 @@
+/*
+This testcase primarily test constant pointers, eg int* const. Only a getter is expected to be produced when wrapping constant pointer variables. A number of other const issues are also tested.
+*/
+
+%module constant_pointers
+
+%inline %{
+
+int GlobalInt;
+const int ConstInt=2;
+int* GlobalIntPtr=&GlobalInt;
+int* const GlobalConstIntPtr=&GlobalInt;
+#define ARRAY_SIZE 2
+
+class ParametersTest {
+public:
+ void param1(int* a) {}
+ void param2(const int* a) {}
+ void param3(int* const a) {}
+ void param4(int const a) {}
+ void param5(const int a) {}
+ void param6(int& a) {}
+ void param7(const int& a) {}
+ void param8(int const& a) {}
+ void param9(int*& a) {}
+ void param10(int* const& a) {}
+ void param11(const int* const a) {}
+
+ void param_array1(int* a[ARRAY_SIZE]) {}
+ void param_array2(const int* a[ARRAY_SIZE]) {}
+ void param_array3(int* const a[ARRAY_SIZE]) {}
+ void param_array4(int const a[ARRAY_SIZE]) {}
+ void param_array5(const int a[ARRAY_SIZE]) {}
+ void param_array6(const int* const a[ARRAY_SIZE]) {}
+};
+
+class MemberVariablesTest {
+public:
+ int* member1;
+ ParametersTest* member2;
+ int* const member3;
+ ParametersTest* const member4;
+
+ int* array_member1[ARRAY_SIZE];
+ ParametersTest* array_member2[ARRAY_SIZE];
+ int* const array_member3[ARRAY_SIZE];
+ ParametersTest* const array_member4[ARRAY_SIZE];
+ MemberVariablesTest() : member3(NULL), member4(NULL) {}
+};
+void foo(const int *const i) {}
+
+typedef int *typedef1, typedef2, *const typedef3;
+int int1, int2=2, *int3, *const int4 = &GlobalInt;
+
+class ReturnValuesTest {
+public:
+ typedef1 td1;
+ typedef2 td2;
+ int int1, int2, *const int3, *int4, array1[ARRAY_SIZE], *const array2[ARRAY_SIZE];
+ int ret1() {return 5;}
+ const int ret2() {return 5;}
+ int ret3() {return 5;}
+ const int* ret4() {return &ConstInt;}
+ int* const ret5() {return &GlobalInt;}
+
+ void ret6(int*& a) {}
+ int*& ret7() {return GlobalIntPtr;}
+ ReturnValuesTest() : int3(NULL) {}
+};
+
+const int* globalRet1() {return &GlobalInt;};
+int* const globalRet2() {return &GlobalInt;};
+
+%}
diff --git a/Examples/test-suite/constover.i b/Examples/test-suite/constover.i
new file mode 100644
index 000000000..06f9ac7e2
--- /dev/null
+++ b/Examples/test-suite/constover.i
@@ -0,0 +1,38 @@
+// This test checks SWIG's code generation for C++ functions
+// and methods that differ only in constness.
+
+%module constover
+
+%rename(test_pconst) test(const char *);
+%rename(test_constm) test(char *) const;
+%rename(test_pconstm) test(const char *) const;
+
+%inline %{
+
+char *test(char *x) {
+ return (char *) "test";
+}
+
+char *test(const char *x) {
+ return (char *) "test_pconst";
+}
+
+ class Foo {
+ public:
+ Foo() { }
+ char *test(char *x) {
+ return (char *) "test";
+ }
+ char *test(const char *x) {
+ return (char *) "test_pconst";
+ }
+ char *test(char *x) const {
+ return (char *) "test_constmethod";
+ }
+ char *test(const char *x) const {
+ return (char *) "test_pconstmethod";
+ }
+ };
+
+%}
+
diff --git a/Examples/test-suite/constructor_exception.i b/Examples/test-suite/constructor_exception.i
new file mode 100644
index 000000000..9904e4e1e
--- /dev/null
+++ b/Examples/test-suite/constructor_exception.i
@@ -0,0 +1,27 @@
+%module constructor_exception
+
+%inline %{
+class Error {
+};
+
+class Object {
+public:
+ Object(int x) {
+ if (x < 0) {
+ throw Error();
+ }
+ }
+};
+
+class Test {
+ Object o;
+public:
+ Test(int x) try : o(x) { }
+ catch (Error &e) {
+ }
+ catch (int y) {
+ }
+ catch (...) {
+ }
+};
+%}
diff --git a/Examples/test-suite/constructor_explicit.i b/Examples/test-suite/constructor_explicit.i
new file mode 100644
index 000000000..f7fc534f2
--- /dev/null
+++ b/Examples/test-suite/constructor_explicit.i
@@ -0,0 +1,13 @@
+%module constructor_explicit
+%inline %{
+
+class Foo {
+public:
+ explicit Foo() { }
+};
+
+Foo test(Foo x) {
+ return x;
+}
+
+%}
diff --git a/Examples/test-suite/constructor_value.i b/Examples/test-suite/constructor_value.i
new file mode 100644
index 000000000..b5c56d031
--- /dev/null
+++ b/Examples/test-suite/constructor_value.i
@@ -0,0 +1,15 @@
+%module constructor_value
+%inline %{
+
+class Foo {
+public:
+Foo(int a) {};
+};
+
+class Bar {
+public:
+Bar(Foo ci) {}
+};
+
+%}
+
diff --git a/Examples/test-suite/conversion.i b/Examples/test-suite/conversion.i
new file mode 100644
index 000000000..bad6c147a
--- /dev/null
+++ b/Examples/test-suite/conversion.i
@@ -0,0 +1,11 @@
+%module conversion
+%rename(toFoo) Bar::operator Foo();
+
+%inline %{
+ struct Foo {
+ };
+ struct Bar {
+ operator Foo () { return Foo(); }
+ };
+%}
+
diff --git a/Examples/test-suite/conversion_namespace.i b/Examples/test-suite/conversion_namespace.i
new file mode 100644
index 000000000..70d4b9ebc
--- /dev/null
+++ b/Examples/test-suite/conversion_namespace.i
@@ -0,0 +1,14 @@
+%module conversion_namespace
+%rename(toFoo) oss::Bar::operator oss::Foo();
+
+%inline %{
+ namespace oss
+ {
+ struct Foo {
+ };
+ struct Bar {
+ operator Foo () { return Foo(); }
+ };
+ }
+%}
+
diff --git a/Examples/test-suite/conversion_ns_template.i b/Examples/test-suite/conversion_ns_template.i
new file mode 100644
index 000000000..34102f98f
--- /dev/null
+++ b/Examples/test-suite/conversion_ns_template.i
@@ -0,0 +1,49 @@
+%module conversion_ns_template
+%{
+ namespace oss
+ {
+ enum Test {One, Two};
+ template <Test>
+ struct Foo {
+ };
+ template <Test T>
+ struct Bar {
+ operator int() { return 0; }
+ operator int&() { static int num = 0; return num; }
+ operator Foo<T>() { return Foo<T>(); }
+ operator Foo<T>&() { return *(new Foo<T>()); }
+ };
+ }
+%}
+
+ namespace oss
+ {
+ enum Test {One, Two};
+
+ template <Test>
+ struct Foo {
+ };
+
+ // these two works
+ %rename(hello1) Bar<One>::operator int&();
+ %ignore Bar<One>::operator int();
+
+ // these don't
+ %rename(hello2) Bar<One>::operator Foo<oss::One>&();
+ %ignore Bar<One>::operator Foo<oss::One>();
+
+ template <Test T>
+ struct Bar {
+ operator int();
+ operator int&();
+ operator Foo<T>();
+ operator Foo<T>&();
+ };
+ }
+
+
+namespace oss
+{
+ %template(Foo_One) Foo<One>;
+ %template(Bar_One) Bar<One>;
+}
diff --git a/Examples/test-suite/cplusplus_throw.i b/Examples/test-suite/cplusplus_throw.i
new file mode 100644
index 000000000..268ddc6d0
--- /dev/null
+++ b/Examples/test-suite/cplusplus_throw.i
@@ -0,0 +1,22 @@
+/* This interface file checks whether the SWIG parses the throw
+ directive in combination with the const directive. Bug reported by
+ Scott B. Drummonds, 08 June 2001.
+*/
+
+%module cplusplus_throw
+
+%pragma no_default
+
+%inline %{
+
+class Foo { };
+
+class Bar {
+public:
+ void baz() const { };
+ void foo() throw (Foo) { };
+ void bazfoo() const throw (int) { };
+};
+
+%}
+
diff --git a/Examples/test-suite/cpp_enum.i b/Examples/test-suite/cpp_enum.i
new file mode 100644
index 000000000..a66cda1c8
--- /dev/null
+++ b/Examples/test-suite/cpp_enum.i
@@ -0,0 +1,27 @@
+/*
+The primary purpose of this testcase is to ensure that enums used along with the 'enum' keyword compile under c++.
+*/
+
+%module cpp_enum
+
+%inline %{
+
+enum SOME_ENUM {ENUM_ONE, ENUM_TWO};
+
+struct StructWithEnums {
+ StructWithEnums() : some_enum(ENUM_ONE) {};
+ enum SOME_ENUM some_enum;
+ void enum_test1(enum SOME_ENUM param1, enum SOME_ENUM* param2, enum SOME_ENUM& param3) {};
+ void enum_test2(SOME_ENUM param1, SOME_ENUM* param2, SOME_ENUM& param3) {};
+
+ SOME_ENUM enum_test3() { return ENUM_ONE; };
+ enum SOME_ENUM enum_test4() { return ENUM_TWO; };
+
+ SOME_ENUM* enum_test5() { return &some_enum; };
+ enum SOME_ENUM* enum_test6() { return &some_enum; };
+
+ SOME_ENUM& enum_test7() { return some_enum; };
+ enum SOME_ENUM& enum_test8() { return some_enum; };
+};
+
+%}
diff --git a/Examples/test-suite/cpp_enum_scope.i b/Examples/test-suite/cpp_enum_scope.i
new file mode 100644
index 000000000..af3c96b70
--- /dev/null
+++ b/Examples/test-suite/cpp_enum_scope.i
@@ -0,0 +1,17 @@
+%module cpp_enum_scope
+
+// This tests to make sure default arguments are handled correctly
+// when scoped.
+
+%inline %{
+enum flavor { BITTER, SWEET };
+
+class Foo {
+public:
+ enum speed { FAST, SLOW };
+
+ // Note: default values should be Foo::FAST and SWEET
+ void blah(speed s = FAST, flavor f = SWEET) {};
+};
+
+%}
diff --git a/Examples/test-suite/cpp_namespace.i b/Examples/test-suite/cpp_namespace.i
new file mode 100644
index 000000000..39e506fe3
--- /dev/null
+++ b/Examples/test-suite/cpp_namespace.i
@@ -0,0 +1,104 @@
+// C++ namespace tests
+
+%module cpp_namespace
+
+%inline %{
+ typedef int Bad;
+
+ /* A very basic namespace */
+ namespace example {
+ typedef char *Bad;
+
+ int fact(int n) {
+ if (n <= 0) return 1;
+ else return n*fact(n-1);
+ }
+ int Foo = 42;
+
+ class Test {
+ public:
+ Test() { };
+ ~Test() { };
+ char *method() {
+ return (char *) "Test::method";
+ }
+ };
+ typedef Test *TestPtr;
+ void weird(Bad x, ::Bad y) { };
+ }
+
+ char *do_method(example::TestPtr t) {
+ return t->method();
+ }
+
+ namespace ex = example;
+
+ char *do_method2(ex::TestPtr t) {
+ return t->method();
+ }
+
+%}
+
+// Some more complicated namespace examples
+
+%inline %{
+namespace Foo {
+ typedef int Integer;
+ class Test2 {
+ public:
+ virtual char *method() {
+ return (char *) "Test2::method";
+ }
+ };
+ typedef Test2 *Test2Ptr;
+}
+
+namespace Foo2 {
+ using Foo::Integer;
+ using Foo::Test2;
+ class Test3 : public Test2 {
+ public:
+ virtual char *method() {
+ return (char *) "Test3::method";
+ }
+ };
+ typedef Test3 *Test3Ptr;
+ typedef Test3 Test3Alt;
+}
+
+namespace Foo3 {
+ using namespace Foo2;
+ class Test4 : public Test3 {
+ public:
+ virtual char *method() {
+ return (char *) "Test4::method";
+ }
+ };
+ Integer foo3(Integer x) { return x; }
+ typedef Test4 *Test4Ptr;
+
+}
+
+using Foo2::Test3Alt;
+using Foo3::Integer;
+
+class Test5 : public Test3Alt {
+public:
+ virtual char *method() {
+ return (char *) "Test5::method";
+ }
+};
+
+char *do_method3(Foo::Test2 *t, Integer x) {
+ return t->method();
+}
+
+%}
+
+
+
+
+
+
+
+
diff --git a/Examples/test-suite/cpp_nodefault.i b/Examples/test-suite/cpp_nodefault.i
new file mode 100644
index 000000000..fc2703618
--- /dev/null
+++ b/Examples/test-suite/cpp_nodefault.i
@@ -0,0 +1,42 @@
+// This file tests SWIG pass/return by value for
+// a class with no default constructor
+
+%module cpp_nodefault
+
+%inline %{
+
+class Foo {
+public:
+ int a;
+ Foo(int x, int y) { }
+ ~Foo() {
+ printf("Destroying foo\n");
+ }
+};
+
+Foo create(int x, int y) {
+ return Foo(x,y);
+}
+
+typedef Foo Foo_t;
+
+void consume(Foo f, Foo_t g) {}
+
+class Bar {
+public:
+ void consume(Foo f, Foo_t g) {}
+ Foo create(int x, int y) {
+ return Foo(x,y);
+ }
+};
+
+
+%}
+
+%{
+Foo gvar = Foo(3,4);
+%}
+
+Foo gvar;
+
+
diff --git a/Examples/test-suite/cpp_static.i b/Examples/test-suite/cpp_static.i
new file mode 100644
index 000000000..5009cf528
--- /dev/null
+++ b/Examples/test-suite/cpp_static.i
@@ -0,0 +1,24 @@
+/*
+Testcase to test c++ static member variables and static functions.
+Tests Sourceforge bug #444748.
+*/
+
+%module cpp_static
+
+%inline %{
+
+class StaticMemberTest {
+public:
+ static int static_int;
+};
+
+class StaticFunctionTest {
+public:
+ static void static_func() {};
+};
+
+%}
+
+%{
+int StaticMemberTest::static_int;
+%}
diff --git a/Examples/test-suite/cpp_typedef.i b/Examples/test-suite/cpp_typedef.i
new file mode 100644
index 000000000..f869f4d9c
--- /dev/null
+++ b/Examples/test-suite/cpp_typedef.i
@@ -0,0 +1,46 @@
+// This file tests SWIG's tracking of C++ typedef declarations
+
+%module cpp_typedef
+
+%{
+
+class Bar {
+public:
+};
+%}
+
+%inline %{
+class Foo {
+public:
+ typedef Bar SomeBar;
+ typedef SomeBar SomeOtherBar;
+ SomeOtherBar bar() {
+ SomeOtherBar b;
+ return b;
+ }
+ static SomeOtherBar sbar() {
+ SomeOtherBar b;
+ return b;
+ }
+};
+
+// Test that the correct types are used for typedef struct declarations
+typedef struct {
+} UnnamedStruct;
+
+typedef struct NamedStruct {
+} TypedefNamedStruct;
+
+typedef TypedefNamedStruct DoubleTypedef;
+
+class Test {
+public:
+ UnnamedStruct test1(UnnamedStruct a) {return a;};
+ struct NamedStruct test2(struct NamedStruct a) {return a;};
+ TypedefNamedStruct test3(TypedefNamedStruct a) {return a;};
+ DoubleTypedef test4(DoubleTypedef a) {return a;};
+};
+
+%}
+
+
diff --git a/Examples/test-suite/default_cast.i b/Examples/test-suite/default_cast.i
new file mode 100644
index 000000000..661e8bc7f
--- /dev/null
+++ b/Examples/test-suite/default_cast.i
@@ -0,0 +1,6 @@
+%module default_cast
+
+%inline %{
+void foo(const char *m = (const char *) NULL) { };
+%}
+
diff --git a/Examples/test-suite/default_constructor.i b/Examples/test-suite/default_constructor.i
new file mode 100644
index 000000000..3d9fe8bed
--- /dev/null
+++ b/Examples/test-suite/default_constructor.i
@@ -0,0 +1,109 @@
+// This module tests default constructor generation under a
+// number of different conditions
+
+%module default_constructor
+
+%warnfilter(802, 813) EB; /* Ruby, Java multiple inheritance */
+%warnfilter(802, 813) AD; /* Ruby, Java multiple inheritance */
+%warnfilter(510) F; /* friend function */
+
+%inline %{
+
+/* A class with a public default constructor */
+class A {
+public:
+ A() { };
+};
+
+/* This class should get default constructor/destructors */
+class AA : public A {
+};
+
+/* A class with a public constructor, but not default */
+
+class B {
+private:
+ B() { }
+public:
+ B(int x, int y) { }
+};
+
+/* This class should get no default constructor, but a destructor */
+class BB : public B {
+};
+
+/* A class with a protected constructor */
+class C {
+protected:
+ C() { };
+public:
+};
+
+/* This class does get a default constructor/destructor */
+class CC : public C {
+};
+
+
+/* A class with a private constructor */
+class D {
+private:
+ D() { };
+public:
+ void foo() { };
+};
+
+/* This class does not get a default constructor */
+class DD: public D {
+
+};
+
+/* No default constructor. A is okay, but D is not */
+class AD: public A, public D {
+
+};
+
+/* This class has a default constructor because of optional arguments */
+class E {
+public:
+ E(int x = 0, int y = 0) { }
+};
+
+/* This should get a default constructor */
+class EE : public E {
+};
+
+/* This class should not get a default constructor. B doesn't have one */
+
+class EB : public E, public B {
+
+};
+
+/* A class with a private destructor */
+
+class F {
+private:
+ ~F() { }
+public:
+ void foo(int, int) { }
+ friend void bar(F *);
+};
+
+void bar(F *) { }
+
+class FFF : public F {
+};
+
+/* A class with a protected destructor */
+class G {
+protected:
+ ~G() { }
+};
+
+class GG : public G {
+};
+
+%}
+
+
+
+
diff --git a/Examples/test-suite/default_ns.i b/Examples/test-suite/default_ns.i
new file mode 100644
index 000000000..3b03d9515
--- /dev/null
+++ b/Examples/test-suite/default_ns.i
@@ -0,0 +1,23 @@
+%module default_ns
+%inline %{
+namespace AType
+{
+ enum AType
+ {
+ NoType
+ };
+}
+
+void dummy(AType::AType aType = AType::NoType) {}
+
+
+namespace A {
+ namespace B {
+ int CONST_NUM = 10;
+ }
+ int function(int i = B::CONST_NUM) { return 0; }
+}
+
+%}
+
+
diff --git a/Examples/test-suite/default_ref.i b/Examples/test-suite/default_ref.i
new file mode 100644
index 000000000..25d20cd69
--- /dev/null
+++ b/Examples/test-suite/default_ref.i
@@ -0,0 +1,12 @@
+%module default_ref
+
+%inline %{
+#include <string>
+
+void test1(const int &x = 42) {
+}
+
+void test2(const std::string &x = "hello") {
+}
+%}
+
diff --git a/Examples/test-suite/defineop.i b/Examples/test-suite/defineop.i
new file mode 100644
index 000000000..d11ff3026
--- /dev/null
+++ b/Examples/test-suite/defineop.i
@@ -0,0 +1,22 @@
+/*
+This testcase tests operators for defines
+*/
+
+%module defineop
+
+#define A1 1 + 2
+#define A2 3 - 4
+#define A3 5 * 6
+#define A4 7 / 8
+#define A5 9 >> 10
+#define A6 11 << 12
+#define A7 13 & 14
+#define A8 15 | 16
+#define A9 17 ^ 18
+#define A10 19 && 20
+#define A11 21 || 21
+#define A12 ~22
+#define A13 !23
+
+
+
diff --git a/Examples/test-suite/defines.i b/Examples/test-suite/defines.i
new file mode 100644
index 000000000..70a1db6df
--- /dev/null
+++ b/Examples/test-suite/defines.i
@@ -0,0 +1,18 @@
+/*
+This testcase tests for embedded defines and embedded %constants
+*/
+
+%module defines
+%pragma make_default
+
+%inline %{
+
+typedef struct EmbeddedDefines {
+ int dummy;
+#define EMBEDDED_DEFINE 44
+#ifdef SWIG
+%constant EMBEDDED_SWIG_CONSTANT = 55;
+#endif
+} EmbeddedDefines;
+
+%}
diff --git a/Examples/test-suite/dynamic_cast.i b/Examples/test-suite/dynamic_cast.i
new file mode 100644
index 000000000..bae28f3cf
--- /dev/null
+++ b/Examples/test-suite/dynamic_cast.i
@@ -0,0 +1,65 @@
+/* File : example.i */
+%module dynamic_cast
+
+#ifndef SWIGJAVA
+%apply SWIGTYPE *DYNAMIC { Foo * };
+#endif
+
+%inline %{
+
+class Foo {
+public:
+ virtual Foo *blah() {
+ return this;
+ }
+};
+%}
+
+#ifdef SWIGJAVA
+%typemap(out) Foo *blah {
+ Bar *downcast = dynamic_cast<Bar *>($1);
+ *(Bar **)&$result = downcast;
+}
+
+%typemap(javaout) Foo * {
+ return new Bar($jnicall, $owner);
+ }
+#endif
+
+%inline %{
+
+class Bar : public Foo {
+public:
+ virtual Foo *blah() {
+ return (Foo *) this;
+ }
+ virtual char * test() {
+ return (char *) "Bar::test";
+ }
+};
+
+char *do_test(Bar *b) {
+ return b->test();
+}
+%}
+
+#ifndef SWIGJAVA
+// A general purpose function for dynamic casting of a Foo *
+%{
+static swig_type_info *
+Foo_dynamic(void **ptr) {
+ Bar *b;
+ b = dynamic_cast<Bar *>((Foo *) *ptr);
+ if (b) {
+ *ptr = (void *) b;
+ return SWIGTYPE_p_Bar;
+ }
+ return 0;
+}
+%}
+
+// Register the above casting function
+DYNAMIC_CAST(SWIGTYPE_p_Foo, Foo_dynamic);
+
+#endif
+
diff --git a/Examples/test-suite/enum.i b/Examples/test-suite/enum.i
new file mode 100644
index 000000000..bcd606c58
--- /dev/null
+++ b/Examples/test-suite/enum.i
@@ -0,0 +1,26 @@
+/* Test whether anonymous enums are supported well. */
+
+%module "enum"
+
+%inline %{
+
+typedef enum {
+ CSP_ITERATION_FWD,
+ CSP_ITERATION_BWD
+} foo1;
+
+typedef enum foo2 {
+ ABCDE = 0,
+ FGHJI = 1
+} foo3;
+
+void
+bar1(foo1 x) {}
+
+void
+bar2(enum foo2 x) {}
+
+void
+bar3(foo3 x) {}
+
+%}
diff --git a/Examples/test-suite/enum_scope.i b/Examples/test-suite/enum_scope.i
new file mode 100644
index 000000000..4afc231c6
--- /dev/null
+++ b/Examples/test-suite/enum_scope.i
@@ -0,0 +1,16 @@
+%module enum_scope
+
+#ifdef SWIGPHP
+// php internal naming conflict
+%rename (chops) chop;
+#endif
+
+%inline %{
+class Tree {
+public:
+enum types {Oak, Fir, Cedar};
+void chop(enum types type) {}
+};
+enum Tree::types chop(enum Tree::types type) { return type; }
+
+%}
diff --git a/Examples/test-suite/enum_scope_template.i b/Examples/test-suite/enum_scope_template.i
new file mode 100644
index 000000000..b6b156bd7
--- /dev/null
+++ b/Examples/test-suite/enum_scope_template.i
@@ -0,0 +1,20 @@
+%module enum_scope_template
+
+#ifdef SWIGPHP
+// php internal naming conflict
+%rename (chops) chop;
+#endif
+
+%inline %{
+
+template<class T> class Tree {
+public:
+ enum types {Oak, Fir, Cedar};
+ void chop(enum types type) {}
+};
+enum Tree<int>::types chop(enum Tree<int>::types type) { return type; }
+
+%}
+
+%template(TreeInt) Tree<int>;
+
diff --git a/Examples/test-suite/enum_var.i b/Examples/test-suite/enum_var.i
new file mode 100644
index 000000000..c8626d803
--- /dev/null
+++ b/Examples/test-suite/enum_var.i
@@ -0,0 +1,8 @@
+%module enum_var
+
+%inline %{
+
+enum Fruit { APPLE, PEAR };
+Fruit test;
+
+%}
diff --git a/Examples/test-suite/errors/c_bad_name.i b/Examples/test-suite/errors/c_bad_name.i
new file mode 100644
index 000000000..43ccb4d18
--- /dev/null
+++ b/Examples/test-suite/errors/c_bad_name.i
@@ -0,0 +1,4 @@
+%module xxx
+
+%name() int foo;
+
diff --git a/Examples/test-suite/errors/c_bad_native.i b/Examples/test-suite/errors/c_bad_native.i
new file mode 100644
index 000000000..4d09e04b0
--- /dev/null
+++ b/Examples/test-suite/errors/c_bad_native.i
@@ -0,0 +1,5 @@
+%module xxx
+
+%native(foo) int foo;
+
+
diff --git a/Examples/test-suite/errors/c_class.i b/Examples/test-suite/errors/c_class.i
new file mode 100644
index 000000000..cd168f67b
--- /dev/null
+++ b/Examples/test-suite/errors/c_class.i
@@ -0,0 +1,8 @@
+%module xxx
+
+int class(int x);
+
+
+
+
+
diff --git a/Examples/test-suite/errors/c_default_error.i b/Examples/test-suite/errors/c_default_error.i
new file mode 100644
index 000000000..f6220e11d
--- /dev/null
+++ b/Examples/test-suite/errors/c_default_error.i
@@ -0,0 +1,4 @@
+%module xxx
+
+int foo(int x = 42 || 3);
+
diff --git a/Examples/test-suite/errors/c_deprecated.i b/Examples/test-suite/errors/c_deprecated.i
new file mode 100644
index 000000000..27e74397f
--- /dev/null
+++ b/Examples/test-suite/errors/c_deprecated.i
@@ -0,0 +1,8 @@
+%module xxx
+
+int foo(%val int *x, %out int *y);
+
+
+
+
+
diff --git a/Examples/test-suite/errors/c_empty_char.i b/Examples/test-suite/errors/c_empty_char.i
new file mode 100644
index 000000000..0a669af86
--- /dev/null
+++ b/Examples/test-suite/errors/c_empty_char.i
@@ -0,0 +1,4 @@
+%module xxx
+
+int foo(int x = '');
+
diff --git a/Examples/test-suite/errors/c_enum_badvalue.i b/Examples/test-suite/errors/c_enum_badvalue.i
new file mode 100644
index 000000000..8649c03e0
--- /dev/null
+++ b/Examples/test-suite/errors/c_enum_badvalue.i
@@ -0,0 +1,7 @@
+%module xxx
+
+enum stuff {
+ FOO = 'x',
+ BAR = 3.14159
+};
+
diff --git a/Examples/test-suite/errors/c_extra_rblock.i b/Examples/test-suite/errors/c_extra_rblock.i
new file mode 100644
index 000000000..3e8e86a19
--- /dev/null
+++ b/Examples/test-suite/errors/c_extra_rblock.i
@@ -0,0 +1,8 @@
+%module xxx
+
+int foo(int x);
+
+%}
+
+
+
diff --git a/Examples/test-suite/errors/c_extra_rbrace.i b/Examples/test-suite/errors/c_extra_rbrace.i
new file mode 100644
index 000000000..0228f9b1d
--- /dev/null
+++ b/Examples/test-suite/errors/c_extra_rbrace.i
@@ -0,0 +1,7 @@
+%module xxx
+
+int foo(int);
+
+}
+
+
diff --git a/Examples/test-suite/errors/c_extra_unsigned.i b/Examples/test-suite/errors/c_extra_unsigned.i
new file mode 100644
index 000000000..f5728cf0c
--- /dev/null
+++ b/Examples/test-suite/errors/c_extra_unsigned.i
@@ -0,0 +1,6 @@
+%module xxx
+
+int foo(unsigned unsigned int x);
+int bar(signed signed y);
+int spam(unsigned signed int x);
+
diff --git a/Examples/test-suite/errors/c_insert_missing.i b/Examples/test-suite/errors/c_insert_missing.i
new file mode 100644
index 000000000..35755ccd8
--- /dev/null
+++ b/Examples/test-suite/errors/c_insert_missing.i
@@ -0,0 +1,3 @@
+%module xxx
+
+%insert("header") "missing_file.i";
diff --git a/Examples/test-suite/errors/c_long_short.i b/Examples/test-suite/errors/c_long_short.i
new file mode 100644
index 000000000..f05831a8f
--- /dev/null
+++ b/Examples/test-suite/errors/c_long_short.i
@@ -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);
diff --git a/Examples/test-suite/errors/c_missing_rbrace.i b/Examples/test-suite/errors/c_missing_rbrace.i
new file mode 100644
index 000000000..381d5008d
--- /dev/null
+++ b/Examples/test-suite/errors/c_missing_rbrace.i
@@ -0,0 +1,10 @@
+%module xxx
+
+int foo(int x) {
+ int y;
+
+
+
+
+
+
diff --git a/Examples/test-suite/errors/c_missing_semi.i b/Examples/test-suite/errors/c_missing_semi.i
new file mode 100644
index 000000000..fc20e1db1
--- /dev/null
+++ b/Examples/test-suite/errors/c_missing_semi.i
@@ -0,0 +1,4 @@
+%module xxx
+int foo(int)
+int bar(int,int);
+
diff --git a/Examples/test-suite/errors/c_redefine.i b/Examples/test-suite/errors/c_redefine.i
new file mode 100644
index 000000000..818d70722
--- /dev/null
+++ b/Examples/test-suite/errors/c_redefine.i
@@ -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);
+
+
+
+
+
+
diff --git a/Examples/test-suite/errors/c_varargs.i b/Examples/test-suite/errors/c_varargs.i
new file mode 100644
index 000000000..88f9c2e7d
--- /dev/null
+++ b/Examples/test-suite/errors/c_varargs.i
@@ -0,0 +1,3 @@
+%module xxx
+
+int foo(int x, ...);
diff --git a/Examples/test-suite/errors/c_varargs_neg.i b/Examples/test-suite/errors/c_varargs_neg.i
new file mode 100644
index 000000000..a88d8b712
--- /dev/null
+++ b/Examples/test-suite/errors/c_varargs_neg.i
@@ -0,0 +1,7 @@
+%module xxx
+
+%varargs(0,int x = 0) foo;
+int foo(int x, ...);
+
+
+
diff --git a/Examples/test-suite/errors/cpp_bad_extern.i b/Examples/test-suite/errors/cpp_bad_extern.i
new file mode 100644
index 000000000..b6895a536
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_bad_extern.i
@@ -0,0 +1,7 @@
+%module xxx
+
+extern "INTERCAL" {
+ int foo(int);
+};
+
+extern "INTERCAL" int blah(int);
diff --git a/Examples/test-suite/errors/cpp_extend_redefine.i b/Examples/test-suite/errors/cpp_extend_redefine.i
new file mode 100644
index 000000000..dfe8fe48a
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_extend_redefine.i
@@ -0,0 +1,23 @@
+%module xxx
+
+%extend foo {
+ int bar() {
+ }
+};
+
+struct foo {
+ int bar();
+ int spam();
+};
+
+%extend foo {
+ int spam();
+};
+
+
+
+
+
+
+
+
diff --git a/Examples/test-suite/errors/cpp_extend_undefined.i b/Examples/test-suite/errors/cpp_extend_undefined.i
new file mode 100644
index 000000000..808a74878
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_extend_undefined.i
@@ -0,0 +1,6 @@
+%module xxx
+
+%extend foo {
+ int bar() {
+ }
+};
diff --git a/Examples/test-suite/errors/cpp_inline_namespace.i b/Examples/test-suite/errors/cpp_inline_namespace.i
new file mode 100644
index 000000000..d92746ae0
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_inline_namespace.i
@@ -0,0 +1,7 @@
+%module xxx
+
+namespace foo {
+%inline %{
+int bar(int x) { }
+%}
+}
diff --git a/Examples/test-suite/errors/cpp_missing_rtemplate.i b/Examples/test-suite/errors/cpp_missing_rtemplate.i
new file mode 100644
index 000000000..2d87eecf1
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_missing_rtemplate.i
@@ -0,0 +1,11 @@
+%module xxx
+
+
+int foo(vector<int);
+
+
+
+
+
+
+
diff --git a/Examples/test-suite/errors/cpp_namespace_alias.i b/Examples/test-suite/errors/cpp_namespace_alias.i
new file mode 100644
index 000000000..1e45972e6
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_namespace_alias.i
@@ -0,0 +1,14 @@
+%module xxx
+
+namespace blah {
+}
+
+namespace B = blah;
+
+namespace B {
+}
+
+
+
+
+
diff --git a/Examples/test-suite/errors/cpp_namespace_aliasnot.i b/Examples/test-suite/errors/cpp_namespace_aliasnot.i
new file mode 100644
index 000000000..c52f8c1f9
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_namespace_aliasnot.i
@@ -0,0 +1,4 @@
+%module xxx
+
+int blah;
+namespace B = blah;
diff --git a/Examples/test-suite/errors/cpp_namespace_aliasundef.i b/Examples/test-suite/errors/cpp_namespace_aliasundef.i
new file mode 100644
index 000000000..25b5b7f57
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_namespace_aliasundef.i
@@ -0,0 +1,3 @@
+%module xxx
+
+namespace B = blah;
diff --git a/Examples/test-suite/errors/cpp_nested.i b/Examples/test-suite/errors/cpp_nested.i
new file mode 100644
index 000000000..625812e7d
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_nested.i
@@ -0,0 +1,13 @@
+%module xxx
+
+class Foo {
+public:
+ class Bar {
+ };
+};
+
+class Spam {
+public:
+ class Grok {
+ } x;
+};
diff --git a/Examples/test-suite/errors/cpp_no_access.i b/Examples/test-suite/errors/cpp_no_access.i
new file mode 100644
index 000000000..e04ad9d55
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_no_access.i
@@ -0,0 +1,4 @@
+%module xxx
+
+class Bar : foo {
+};
diff --git a/Examples/test-suite/errors/cpp_nobase.i b/Examples/test-suite/errors/cpp_nobase.i
new file mode 100644
index 000000000..70e6d684c
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_nobase.i
@@ -0,0 +1,7 @@
+%module xxx
+
+class Foo : public Bar {
+};
+
+class Spam : public Bar<int> {
+};
diff --git a/Examples/test-suite/errors/cpp_overload.i b/Examples/test-suite/errors/cpp_overload.i
new file mode 100644
index 000000000..34fa3cc25
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_overload.i
@@ -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);
+};
diff --git a/Examples/test-suite/errors/cpp_private_defvalue.i b/Examples/test-suite/errors/cpp_private_defvalue.i
new file mode 100644
index 000000000..15542c7bc
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_private_defvalue.i
@@ -0,0 +1,7 @@
+%module xxx
+
+class foo {
+static const int BAR = 42;
+public:
+ int blah(int x = BAR);
+};
diff --git a/Examples/test-suite/errors/cpp_private_inherit.i b/Examples/test-suite/errors/cpp_private_inherit.i
new file mode 100644
index 000000000..e8267e98f
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_private_inherit.i
@@ -0,0 +1,11 @@
+%module xxx
+
+class Foo {
+};
+
+class Bar : private Foo {
+};
+
+class Spam : protected Foo {
+};
+
diff --git a/Examples/test-suite/errors/cpp_template_argname.i b/Examples/test-suite/errors/cpp_template_argname.i
new file mode 100644
index 000000000..b87c115c1
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_argname.i
@@ -0,0 +1,8 @@
+%module xxx
+
+template<T> T blah(T x);
+
+
+
+
+
diff --git a/Examples/test-suite/errors/cpp_template_nargs.i b/Examples/test-suite/errors/cpp_template_nargs.i
new file mode 100644
index 000000000..1a4fbdc20
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_nargs.i
@@ -0,0 +1,10 @@
+%module xxx
+
+template<typename T> T blah(T x) { };
+
+%template(blahi) blah<int,double>;
+%template(blahf) blah<>;
+
+
+
+
diff --git a/Examples/test-suite/errors/cpp_template_not.i b/Examples/test-suite/errors/cpp_template_not.i
new file mode 100644
index 000000000..c8df700b5
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_not.i
@@ -0,0 +1,9 @@
+%module xxx
+
+int blah;
+
+%template(blahi) blah<int>;
+
+
+
+
diff --git a/Examples/test-suite/errors/cpp_template_partial.i b/Examples/test-suite/errors/cpp_template_partial.i
new file mode 100644
index 000000000..04ae9055e
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_partial.i
@@ -0,0 +1,4 @@
+%module xxx
+
+template<class T> class vector<T *> {
+};
diff --git a/Examples/test-suite/errors/cpp_template_repeat.i b/Examples/test-suite/errors/cpp_template_repeat.i
new file mode 100644
index 000000000..e63ffe8d9
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_repeat.i
@@ -0,0 +1,7 @@
+%module xxx
+
+template<class T> T blah(T x) { };
+
+%template(iblah) blah<int>;
+%template(iiblah) blah<int>;
+
diff --git a/Examples/test-suite/errors/cpp_template_undef.i b/Examples/test-suite/errors/cpp_template_undef.i
new file mode 100644
index 000000000..2c0afbecc
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_undef.i
@@ -0,0 +1,7 @@
+%module xxx
+
+%template(blahi) blah<int>;
+
+
+
+
diff --git a/Examples/test-suite/errors/cpp_using_not.i b/Examples/test-suite/errors/cpp_using_not.i
new file mode 100644
index 000000000..2d5b6bf61
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_using_not.i
@@ -0,0 +1,9 @@
+%module xxx
+
+int blah;
+using namespace blah;
+
+
+
+
+
diff --git a/Examples/test-suite/errors/cpp_using_undef.i b/Examples/test-suite/errors/cpp_using_undef.i
new file mode 100644
index 000000000..bc0c8c797
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_using_undef.i
@@ -0,0 +1,9 @@
+%module xxx
+
+using foo::bar;
+using namespace foo;
+
+
+
+
+
diff --git a/Examples/test-suite/errors/make.sh b/Examples/test-suite/errors/make.sh
new file mode 100755
index 000000000..0c9bd443e
--- /dev/null
+++ b/Examples/test-suite/errors/make.sh
@@ -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}'"
+
+
diff --git a/Examples/test-suite/errors/nomodule.i b/Examples/test-suite/errors/nomodule.i
new file mode 100644
index 000000000..6341be3fd
--- /dev/null
+++ b/Examples/test-suite/errors/nomodule.i
@@ -0,0 +1,2 @@
+/* No module name */
+int foo(int);
diff --git a/Examples/test-suite/errors/pp_badeval.i b/Examples/test-suite/errors/pp_badeval.i
new file mode 100644
index 000000000..aca397c7c
--- /dev/null
+++ b/Examples/test-suite/errors/pp_badeval.i
@@ -0,0 +1,11 @@
+%module xxx
+
+#if FOO==4
+#elif FOO==4+
+#endif
+
+
+
+
+
+
diff --git a/Examples/test-suite/errors/pp_defined.i b/Examples/test-suite/errors/pp_defined.i
new file mode 100644
index 000000000..e2f343079
--- /dev/null
+++ b/Examples/test-suite/errors/pp_defined.i
@@ -0,0 +1,7 @@
+%module xxx
+
+#if defined()
+#endif
+
+#if defined
+#endif
diff --git a/Examples/test-suite/errors/pp_macro_args.i b/Examples/test-suite/errors/pp_macro_args.i
new file mode 100644
index 000000000..8bbbfb104
--- /dev/null
+++ b/Examples/test-suite/errors/pp_macro_args.i
@@ -0,0 +1,7 @@
+%module xxx
+
+#define foo(a,x) a x
+
+#if foo
+#endif
+
diff --git a/Examples/test-suite/errors/pp_macro_badchar.i b/Examples/test-suite/errors/pp_macro_badchar.i
new file mode 100644
index 000000000..276011559
--- /dev/null
+++ b/Examples/test-suite/errors/pp_macro_badchar.i
@@ -0,0 +1,5 @@
+%module xxx
+
+#define f@oo(a,x) a + x
+#define foo(a@,x) a + x
+
diff --git a/Examples/test-suite/errors/pp_macro_nargs.i b/Examples/test-suite/errors/pp_macro_nargs.i
new file mode 100644
index 000000000..15e434877
--- /dev/null
+++ b/Examples/test-suite/errors/pp_macro_nargs.i
@@ -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)
+
+
+
+
+
diff --git a/Examples/test-suite/errors/pp_macro_redef.i b/Examples/test-suite/errors/pp_macro_redef.i
new file mode 100644
index 000000000..e0910e60e
--- /dev/null
+++ b/Examples/test-suite/errors/pp_macro_redef.i
@@ -0,0 +1,8 @@
+%module xxx
+
+#define foo(a,x) a+x
+#define foo 4
+
+/* Should not generate an error */
+#define foo 4
+
diff --git a/Examples/test-suite/errors/pp_macro_rparen.i b/Examples/test-suite/errors/pp_macro_rparen.i
new file mode 100644
index 000000000..cbb04fb87
--- /dev/null
+++ b/Examples/test-suite/errors/pp_macro_rparen.i
@@ -0,0 +1,3 @@
+%module xxx
+
+#define foo(a,x 3
diff --git a/Examples/test-suite/errors/pp_macro_unterminated.i b/Examples/test-suite/errors/pp_macro_unterminated.i
new file mode 100644
index 000000000..d0e32d726
--- /dev/null
+++ b/Examples/test-suite/errors/pp_macro_unterminated.i
@@ -0,0 +1,7 @@
+%module xxx
+
+#define foo(a,x) a+x
+
+foo(3,
+
+
diff --git a/Examples/test-suite/errors/pp_misplaced_elif.i b/Examples/test-suite/errors/pp_misplaced_elif.i
new file mode 100644
index 000000000..5e656f020
--- /dev/null
+++ b/Examples/test-suite/errors/pp_misplaced_elif.i
@@ -0,0 +1,7 @@
+%module xxx
+
+
+#elif foo == 3
+int x;
+#endif
+
diff --git a/Examples/test-suite/errors/pp_misplaced_else.i b/Examples/test-suite/errors/pp_misplaced_else.i
new file mode 100644
index 000000000..ad299466f
--- /dev/null
+++ b/Examples/test-suite/errors/pp_misplaced_else.i
@@ -0,0 +1,7 @@
+%module xxx
+
+
+#else
+int x;
+#endif
+
diff --git a/Examples/test-suite/errors/pp_missing_enddef.i b/Examples/test-suite/errors/pp_missing_enddef.i
new file mode 100644
index 000000000..e13deef27
--- /dev/null
+++ b/Examples/test-suite/errors/pp_missing_enddef.i
@@ -0,0 +1,7 @@
+%module xxx
+
+%define FOO
+int x;
+
+
+
diff --git a/Examples/test-suite/errors/pp_missing_endif.i b/Examples/test-suite/errors/pp_missing_endif.i
new file mode 100644
index 000000000..e83496fb2
--- /dev/null
+++ b/Examples/test-suite/errors/pp_missing_endif.i
@@ -0,0 +1,6 @@
+%module xxx
+
+#ifdef FOO
+int x;
+
+
diff --git a/Examples/test-suite/errors/pp_missing_file.i b/Examples/test-suite/errors/pp_missing_file.i
new file mode 100644
index 000000000..5e3f0ea27
--- /dev/null
+++ b/Examples/test-suite/errors/pp_missing_file.i
@@ -0,0 +1,3 @@
+%module test
+
+%include "missing_filename.i"
diff --git a/Examples/test-suite/errors/pp_missing_rblock.i b/Examples/test-suite/errors/pp_missing_rblock.i
new file mode 100644
index 000000000..55c3cc808
--- /dev/null
+++ b/Examples/test-suite/errors/pp_missing_rblock.i
@@ -0,0 +1,7 @@
+%module xxx
+
+%{
+int x;
+
+
+
diff --git a/Examples/test-suite/errors/pp_unterm_char.i b/Examples/test-suite/errors/pp_unterm_char.i
new file mode 100644
index 000000000..9b028fd3d
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unterm_char.i
@@ -0,0 +1,7 @@
+%module xxx
+
+
+const char x = 'H
+
+
+
diff --git a/Examples/test-suite/errors/pp_unterm_comment.i b/Examples/test-suite/errors/pp_unterm_comment.i
new file mode 100644
index 000000000..f9cdb8257
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unterm_comment.i
@@ -0,0 +1,6 @@
+%module xxx
+
+/* Hello
+
+
+
diff --git a/Examples/test-suite/errors/pp_unterm_string.i b/Examples/test-suite/errors/pp_unterm_string.i
new file mode 100644
index 000000000..31ed8d4bb
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unterm_string.i
@@ -0,0 +1,6 @@
+%module xxx
+
+
+const char *x = "Hello
+
+
diff --git a/Examples/test-suite/errors/swig_apply_nargs.i b/Examples/test-suite/errors/swig_apply_nargs.i
new file mode 100644
index 000000000..bb1519c1e
--- /dev/null
+++ b/Examples/test-suite/errors/swig_apply_nargs.i
@@ -0,0 +1,6 @@
+%module xxx
+
+%typemap(in) (char *str, int len) {
+}
+
+%apply (char *str, int len) { int x };
diff --git a/Examples/test-suite/errors/swig_identifier.i b/Examples/test-suite/errors/swig_identifier.i
new file mode 100644
index 000000000..3ad07362d
--- /dev/null
+++ b/Examples/test-suite/errors/swig_identifier.i
@@ -0,0 +1,6 @@
+%module xxx
+
+%rename("foo bar") foobar;
+
+int foobar(int);
+
diff --git a/Examples/test-suite/errors/swig_insert_bad.i b/Examples/test-suite/errors/swig_insert_bad.i
new file mode 100644
index 000000000..e2dd8a93e
--- /dev/null
+++ b/Examples/test-suite/errors/swig_insert_bad.i
@@ -0,0 +1,5 @@
+%module xxx
+
+%insert("foobar") %{
+some code
+%}
diff --git a/Examples/test-suite/errors/swig_typemap_copy.i b/Examples/test-suite/errors/swig_typemap_copy.i
new file mode 100644
index 000000000..17607f2fb
--- /dev/null
+++ b/Examples/test-suite/errors/swig_typemap_copy.i
@@ -0,0 +1,3 @@
+%module xxx
+
+%typemap(in) int = blah;
diff --git a/Examples/test-suite/errors/swig_typemap_old.i b/Examples/test-suite/errors/swig_typemap_old.i
new file mode 100644
index 000000000..c27ff5533
--- /dev/null
+++ b/Examples/test-suite/errors/swig_typemap_old.i
@@ -0,0 +1,6 @@
+%module xxx
+
+%typemap(in) int x {
+ $source;
+ $target;
+}
diff --git a/Examples/test-suite/evil_diamond.i b/Examples/test-suite/evil_diamond.i
new file mode 100644
index 000000000..8644c24c9
--- /dev/null
+++ b/Examples/test-suite/evil_diamond.i
@@ -0,0 +1,23 @@
+%module evil_diamond
+
+%warnfilter(801) foo; // Ruby, wrong class name
+%warnfilter(801) bar; // Ruby, wrong class name
+%warnfilter(801) baz; // Ruby, wrong class name
+%warnfilter(801,802,813) spam; // Ruby, wrong class name; Ruby & Java, multiple inheritance
+
+%inline %{
+
+class foo { };
+
+class bar : public foo {
+};
+
+class baz : public foo {
+};
+
+class spam : public bar, public baz {
+};
+
+foo *test(foo *f) { return f; }
+%}
+
diff --git a/Examples/test-suite/evil_diamond_ns.i b/Examples/test-suite/evil_diamond_ns.i
new file mode 100644
index 000000000..067805a79
--- /dev/null
+++ b/Examples/test-suite/evil_diamond_ns.i
@@ -0,0 +1,24 @@
+%module evil_diamond_ns
+
+%warnfilter(801) Blah::foo; // Ruby, wrong class name
+%warnfilter(801) Blah::bar; // Ruby, wrong class name
+%warnfilter(801) Blah::baz; // Ruby, wrong class name
+%warnfilter(801,802,813) Blah::spam; // Ruby, wrong class name; Ruby & Java, multiple inheritance
+
+%inline %{
+namespace Blah {
+class foo { };
+
+class bar : public foo {
+};
+
+class baz : public foo {
+};
+
+class spam : public bar, public baz {
+};
+
+foo *test(foo *f) { return f; }
+}
+%}
+
diff --git a/Examples/test-suite/evil_diamond_prop.i b/Examples/test-suite/evil_diamond_prop.i
new file mode 100644
index 000000000..d28a57ca2
--- /dev/null
+++ b/Examples/test-suite/evil_diamond_prop.i
@@ -0,0 +1,36 @@
+%module evil_diamond_prop
+
+%warnfilter(801) foo; // Ruby, wrong class name
+%warnfilter(801) bar; // Ruby, wrong class name
+%warnfilter(801) baz; // Ruby, wrong class name
+%warnfilter(801,802,813) spam; // Ruby, wrong class name; Ruby & Java, multiple inheritance
+
+%inline %{
+
+class foo {
+ public:
+ int _foo;
+ foo() : _foo(1) {}
+};
+
+class bar : public foo {
+ public:
+ int _bar;
+ bar() : _bar(2) {}
+};
+
+class baz : public foo {
+ public:
+ int _baz;
+ baz() : _baz(3) {}
+};
+
+class spam : public bar, public baz {
+ public:
+ int _spam;
+ spam() : _spam(4) {}
+};
+
+foo *test(foo *f) { return f; }
+%}
+
diff --git a/Examples/test-suite/explicit.i b/Examples/test-suite/explicit.i
new file mode 100644
index 000000000..738dffc41
--- /dev/null
+++ b/Examples/test-suite/explicit.i
@@ -0,0 +1,15 @@
+/* Swig 1.3.6 fails to understand the "explicit" keyword.
+ SF Bug #445233, reported by Krzysztof Kozminski
+ <kozminski@users.sf.net>.
+*/
+
+%module "explicit"
+
+%inline %{
+
+class A {
+ public:
+ explicit A(int) {};
+};
+
+%}
diff --git a/Examples/test-suite/extend_template.i b/Examples/test-suite/extend_template.i
new file mode 100644
index 000000000..a39ac546d
--- /dev/null
+++ b/Examples/test-suite/extend_template.i
@@ -0,0 +1,26 @@
+%module extend_template
+%module xxx
+namespace oss { // this doesn't
+ %extend Foo<0> {
+ int test1(int x) { return x; }
+ }
+}
+
+%extend oss::Foo<0> { // this doesn't
+ int test2(int x) { return x; }
+};
+
+
+%inline %{
+ namespace oss
+ {
+ template <int>
+ struct Foo {
+ };
+ }
+%}
+
+namespace oss
+{
+ %template(Foo_0) Foo<0>;
+}
diff --git a/Examples/test-suite/extend_template_ns.i b/Examples/test-suite/extend_template_ns.i
new file mode 100644
index 000000000..3712f2c8f
--- /dev/null
+++ b/Examples/test-suite/extend_template_ns.i
@@ -0,0 +1,32 @@
+%module extend_template_ns
+%inline %{
+namespace oss
+{
+ enum Test {One, Two};
+}
+%}
+
+namespace oss {
+ %extend Foo<One> { //************ this doesn't work
+ int test1(int x) { return x; }
+ };
+}
+
+%extend oss::Foo<oss::One> { //******** this works
+int test2(int x) { return x; }
+};
+
+%inline %{
+namespace oss
+{
+ template <Test>
+ struct Foo {
+ };
+ }
+%}
+
+namespace oss
+{
+%template(Foo_One) Foo<One>;
+}
+
diff --git a/Examples/test-suite/grouping.i b/Examples/test-suite/grouping.i
new file mode 100644
index 000000000..5632231d0
--- /dev/null
+++ b/Examples/test-suite/grouping.i
@@ -0,0 +1,31 @@
+%module grouping
+
+%inline %{
+
+typedef int Integer;
+
+int (test1)(int x) {
+ return x;
+}
+
+int *(test2)(int x) {
+ static int y;
+ y = x;
+ return &y;
+}
+
+int (test3) = 37;
+
+typedef Integer (UnaryOp)(Integer);
+
+Integer do_unary(Integer x, UnaryOp *f) {
+ return (*f)(x);
+}
+
+int negate(int x) {
+ return -x;
+}
+
+%}
+
+%constant UnaryOp *NEGATE = negate;
diff --git a/Examples/test-suite/guile/.cvsignore b/Examples/test-suite/guile/.cvsignore
new file mode 100644
index 000000000..1242e8c7e
--- /dev/null
+++ b/Examples/test-suite/guile/.cvsignore
@@ -0,0 +1,2 @@
+*wrap*
+*-guile
diff --git a/Examples/test-suite/guile/Makefile b/Examples/test-suite/guile/Makefile
new file mode 100644
index 000000000..a39bcaf0e
--- /dev/null
+++ b/Examples/test-suite/guile/Makefile
@@ -0,0 +1,44 @@
+#######################################################################
+# $Header$
+# Makefile for guile test-suite
+#######################################################################
+
+LANGUAGE = guile
+VARIANT = _passive
+SCRIPTSUFFIX = _runme.scm
+
+C_TEST_CASES = long_long list_vector pointer_in_out multivalue
+
+include ../common.mk
+
+# Overridden variables here
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup) \
+ ($(swig_and_compile_cpp); ); \
+ $(run_testcase)
+
+%.ctest:
+ $(setup) \
+ ($(swig_and_compile_c); ); \
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup) \
+ ($(swig_and_compile_multi_cpp); ); \
+ $(run_testcase)
+
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.scm appended after the testcase name.
+run_testcase = \
+ if [ -f $*\_runme.scm ]; then ( \
+ env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH guile -l $*\_runme.scm;) \
+ fi;
+
+# Clean
+%.clean:
+ @rm -f $*-guile
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile guile_clean
diff --git a/Examples/test-suite/guile/README b/Examples/test-suite/guile/README
new file mode 100644
index 000000000..37432ea4b
--- /dev/null
+++ b/Examples/test-suite/guile/README
@@ -0,0 +1,4 @@
+See ../README for common README file.
+
+Any testcases which have _runme.scm appended after the testcase name will be detected and run.
+
diff --git a/Examples/test-suite/guile/casts_runme.scm b/Examples/test-suite/guile/casts_runme.scm
new file mode 100644
index 000000000..17e7725f6
--- /dev/null
+++ b/Examples/test-suite/guile/casts_runme.scm
@@ -0,0 +1,13 @@
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_test_module" (dynamic-link "./libcasts.so"))
+
+(define x (new-B))
+
+;; This fails in 1.3a5 because the SWIG/Guile runtime code gets the
+;; source and the target of a cast the wrong way around.
+
+(A-hello x)
+
+(exit 0)
diff --git a/Examples/test-suite/guile/char_constant_runme.scm b/Examples/test-suite/guile/char_constant_runme.scm
new file mode 100644
index 000000000..2cc89b051
--- /dev/null
+++ b/Examples/test-suite/guile/char_constant_runme.scm
@@ -0,0 +1,9 @@
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_test_module" (dynamic-link "./libchar_constant.so"))
+
+(if (and (char? (CHAR-CONSTANT))
+ (string? (STRING-CONSTANT)))
+ (exit 0)
+ (exit 1))
diff --git a/Examples/test-suite/guile/imports_runme.scm b/Examples/test-suite/guile/imports_runme.scm
new file mode 100644
index 000000000..030fbfd61
--- /dev/null
+++ b/Examples/test-suite/guile/imports_runme.scm
@@ -0,0 +1,19 @@
+;;; This file is part of a test for SF bug #231619.
+;;; It shows that the %import directive does not work properly in SWIG
+;;; 1.3a5: Type information is not properly generated if a base class
+;;; comes from an %import-ed file.
+
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_imports_a_module" (dynamic-link "./libimports_a.so"))
+(dynamic-call "scm_init_imports_b_module" (dynamic-link "./libimports_b.so"))
+
+(define x (new-B))
+
+;; This fails in 1.3a5 because the SWIG runtime code does not know
+;; that x (an instance of class B) can be passed to methods of class A.
+
+(A-hello x)
+
+(exit 0)
diff --git a/Examples/test-suite/guile/list_vector_runme.scm b/Examples/test-suite/guile/list_vector_runme.scm
new file mode 100644
index 000000000..1957c9a7f
--- /dev/null
+++ b/Examples/test-suite/guile/list_vector_runme.scm
@@ -0,0 +1,28 @@
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_test_module" (dynamic-link "./liblist_vector.so"))
+
+(define-macro (check form)
+ `(if (not ,form)
+ (error "Check failed: " ',form)))
+
+(check (= (sum-list '(1 3 4 6 7)) 21))
+(check (= (sum-vector #(2 4 6 7 9)) 28))
+(check (equal? (one-to-seven-list) '(1 2 3 4 5 6 7)))
+(check (equal? (one-to-seven-vector) #(1 2 3 4 5 6 7)))
+
+(check (= (sum-list2 '(1 3 4 6 7)) 21))
+(check (= (sum-vector2 #(2 4 6 7 9)) 28))
+(check (equal? (one-to-seven-list2) '(1 2 3 4 5 6 7)))
+(check (equal? (one-to-seven-vector2) #(1 2 3 4 5 6 7)))
+
+(check (= (sum-lists '(1 2 3) '(4 5 6) '(7 8 9)) 45))
+(check (= (sum-lists2 '(1 2 3) '(4 5 6) '(7 8 9)) 45))
+(check (equal? (call-with-values produce-lists list)
+ '(#(0 1 2 3 4)
+ #(0 1 4 9 16)
+ #(0.0 1.5 3.0 4.5 6.0))))
+
+
+(exit 0)
diff --git a/Examples/test-suite/guile/multivalue_runme.scm b/Examples/test-suite/guile/multivalue_runme.scm
new file mode 100644
index 000000000..910935801
--- /dev/null
+++ b/Examples/test-suite/guile/multivalue_runme.scm
@@ -0,0 +1,24 @@
+;;;; Automatic test of multiple return values
+
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_test_module" (dynamic-link "./libmultivalue.so"))
+
+(let ((quotient/remainder (divide-l 37 5)))
+ (if (not (equal? quotient/remainder '(7 2)))
+ (exit 1)))
+
+(let ((quotient-remainder-vector (divide-v 41 7)))
+ (if (not (equal? quotient-remainder-vector #(5 6)))
+ (exit 1)))
+
+(call-with-values (lambda ()
+ (divide-mv 91 13))
+ (lambda (quotient remainder)
+ (if (not (and (= quotient 7)
+ (= remainder 0)))
+ (exit 1))))
+
+(exit 0)
+
diff --git a/Examples/test-suite/guile/name_runme.scm b/Examples/test-suite/guile/name_runme.scm
new file mode 100644
index 000000000..a7121b9d9
--- /dev/null
+++ b/Examples/test-suite/guile/name_runme.scm
@@ -0,0 +1,10 @@
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_test_module" (dynamic-link "./libname.so"))
+
+(foo-2)
+bar-2
+Baz-2
+
+(exit 0)
diff --git a/Examples/test-suite/guile/overload_complicated_runme.scm b/Examples/test-suite/guile/overload_complicated_runme.scm
new file mode 100644
index 000000000..0423aafbd
--- /dev/null
+++ b/Examples/test-suite/guile/overload_complicated_runme.scm
@@ -0,0 +1,18 @@
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_overload_complicated_module" (dynamic-link "./liboverload_complicated.so"))
+
+(define-macro (check form)
+ `(if (not ,form)
+ (error "Check failed: " ',form)))
+
+;; Check first method
+(check (= (foo 1 2 "bar" 4) 15))
+
+;; Check second method
+(check (= (foo 1 2) 4811.4))
+(check (= (foo 1 2 3.2) 4797.2))
+(check (= (foo 1 2 3.2 #\Q) 4798.2))
+
+(exit 0)
diff --git a/Examples/test-suite/guile/overload_simple_runme.scm b/Examples/test-suite/guile/overload_simple_runme.scm
new file mode 100644
index 000000000..abe95069a
--- /dev/null
+++ b/Examples/test-suite/guile/overload_simple_runme.scm
@@ -0,0 +1,56 @@
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_overload_simple_module" (dynamic-link "./liboverload_simple.so"))
+
+(if (not (string=? (foo 3) "foo:int"))
+ (error "foo(int)"))
+
+(if (not (string=? (foo 3.01) "foo:double"))
+ (error "foo(double)"))
+
+(if (not (string=? (foo "hello") "foo:char *"))
+ (error "foo(char *)"))
+
+(let ((f (new-Foo))
+ (b (new-Bar))
+ (s (new-Spam)))
+ (if (not (string=? (foo f) "foo:Foo *"))
+ (error "foo(Foo *)"))
+ (if (not (string=? (foo b) "foo:Bar *"))
+ (error "foo(Bar *)"))
+ ;; Test member functions
+ (if (not (string=? (Spam-foo s 3) "foo:int"))
+ (error "Spam::foo(int)"))
+ (if (not (string=? (Spam-foo s 3.01) "foo:double"))
+ (error "Spam::foo(double)"))
+ (if (not (string=? (Spam-foo s "hello") "foo:char *"))
+ (error "Spam::foo(char *)"))
+ (if (not (string=? (Spam-foo s f) "foo:Foo *"))
+ (error "Spam::foo(Foo *)"))
+ (if (not (string=? (Spam-foo s b) "foo:Bar *"))
+ (error "Spam::foo(Bar *)"))
+ ;; Test static member functions
+ (if (not (string=? (Spam-bar 3) "bar:int"))
+ (error "Spam::bar(int)"))
+ (if (not (string=? (Spam-bar 3.01) "bar:double"))
+ (error "Spam::bar(double)"))
+ (if (not (string=? (Spam-bar "hello") "bar:char *"))
+ (error "Spam::bar(char *)"))
+ (if (not (string=? (Spam-bar f) "bar:Foo *"))
+ (error "Spam::bar(Foo *)"))
+ (if (not (string=? (Spam-bar b) "bar:Bar *"))
+ (error "Spam::bar(Bar *)"))
+ ;; Test constructors
+ (if (not (string=? (Spam-type-get (new-Spam)) "none"))
+ (error "Spam()"))
+ (if (not (string=? (Spam-type-get (new-Spam 3)) "int"))
+ (error "Spam(int)"))
+ (if (not (string=? (Spam-type-get (new-Spam 3.4)) "double"))
+ (error "Spam(double)"))
+ (if (not (string=? (Spam-type-get (new-Spam "hello")) "char *"))
+ (error "Spam(char *)"))
+ (if (not (string=? (Spam-type-get (new-Spam b)) "Bar *"))
+ (error "Spam(Bar *)")))
+
+(exit 0)
diff --git a/Examples/test-suite/guile/overload_subtype_runme.scm b/Examples/test-suite/guile/overload_subtype_runme.scm
new file mode 100644
index 000000000..14737f144
--- /dev/null
+++ b/Examples/test-suite/guile/overload_subtype_runme.scm
@@ -0,0 +1,12 @@
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_overload_subtype_module" (dynamic-link "./liboverload_subtype.so"))
+
+(if (not (= (spam (new-Foo)) 1))
+ (error "foo"))
+
+(if (not (= (spam (new-Bar)) 2))
+ (error "bar"))
+
+(exit 0)
diff --git a/Examples/test-suite/guile/pointer_in_out_runme.scm b/Examples/test-suite/guile/pointer_in_out_runme.scm
new file mode 100644
index 000000000..68ce0aa3b
--- /dev/null
+++ b/Examples/test-suite/guile/pointer_in_out_runme.scm
@@ -0,0 +1,18 @@
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_pointer_in_out_module" (dynamic-link "./libpointer_in_out.so"))
+
+(define-macro (check form)
+ `(if (not ,form)
+ (error "Check failed: " ',form)))
+
+(define p (produce-int-pointer 47 11))
+
+(check (= (consume-int-pointer p) 47))
+
+(define q (frobnicate-int-pointer p))
+
+(check (= (consume-int-pointer q) 11))
+
+(exit 0)
diff --git a/Examples/test-suite/guile/unions_runme.scm b/Examples/test-suite/guile/unions_runme.scm
new file mode 100644
index 000000000..ce2caa8b3
--- /dev/null
+++ b/Examples/test-suite/guile/unions_runme.scm
@@ -0,0 +1,41 @@
+;;; This is the union runtime testcase. It ensures that values within a
+;;; union embedded within a struct can be set and read correctly.
+
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(dynamic-call "scm_init_unions_module" (dynamic-link "./libunions.so"))
+
+;; Create new instances of SmallStruct and BigStruct for later use
+(define small (new-SmallStruct))
+(SmallStruct-jill-set small 200)
+
+(define big (new-BigStruct))
+(BigStruct-smallstruct-set big small)
+(BigStruct-jack-set big 300)
+
+;; Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
+;; Ensure values in EmbeddedUnionTest are set correctly for each.
+(define eut (new-EmbeddedUnionTest))
+
+;; First check the SmallStruct in EmbeddedUnionTest
+(EmbeddedUnionTest-number-set eut 1)
+(EmbeddedUnionTest-uni-small-set (EmbeddedUnionTest-uni-get eut)
+ small)
+(let ((Jill1 (SmallStruct-jill-get
+ (EmbeddedUnionTest-uni-small-get
+ (EmbeddedUnionTest-uni-get eut)))))
+ (if (not (= Jill1 200))
+ (begin
+ (display "Runtime test 1 failed.")
+ (exit 1))))
+
+(let ((Num1 (EmbeddedUnionTest-number-get eut)))
+ (if (not (= Num1 1))
+ (begin
+ (display "Runtime test 2 failed.")
+ (exit 1))))
+
+;; that should do
+
+(exit 0)
diff --git a/Examples/test-suite/ignore_parameter.i b/Examples/test-suite/ignore_parameter.i
new file mode 100644
index 000000000..f64a4b32e
--- /dev/null
+++ b/Examples/test-suite/ignore_parameter.i
@@ -0,0 +1,42 @@
+// Test for %typemap(ignore)
+
+%module ignore_parameter
+
+%typemap(in,numinputs=0) char* a "static char* hi = \"hello\"; $1 = hi;";
+%typemap(in,numinputs=0) int bb "$1 = 101;";
+%typemap(in,numinputs=0) double ccc "$1 = 8.8;";
+
+%typemap(freearg) char* a ""; // ensure freearg is not generated (needed for Java at least)
+
+%inline %{
+// global function tests
+char* jaguar(char* a, int b, double c) { return a; }
+int lotus(char* aa, int bb, double cc) { return bb; }
+double tvr(char* aaa, int bbb, double ccc) { return ccc; }
+int ferrari(int bb) { return bb; }
+
+// member function tests
+struct SportsCars {
+ char* daimler(char* a, int b, double c) { return a; }
+ int astonmartin(char* aa, int bb, double cc) { return bb; }
+ double bugatti(char* aaa, int bbb, double ccc) { return ccc; }
+ int lamborghini(int bb) { return bb; }
+};
+
+// constructor tests
+struct MiniCooper {
+ MiniCooper(char* a, int b, double c) {}
+};
+struct MorrisMinor {
+ MorrisMinor(char* aa, int bb, double cc) {}
+};
+struct FordAnglia {
+ FordAnglia(char* aaa, int bbb, double ccc) {}
+};
+struct AustinAllegro {
+ AustinAllegro(int bb) {}
+};
+%}
+
+
+
diff --git a/Examples/test-suite/import_nomodule.h b/Examples/test-suite/import_nomodule.h
new file mode 100644
index 000000000..2e80e72bb
--- /dev/null
+++ b/Examples/test-suite/import_nomodule.h
@@ -0,0 +1,2 @@
+class Foo { };
+typedef int Integer;
diff --git a/Examples/test-suite/import_nomodule.i b/Examples/test-suite/import_nomodule.i
new file mode 100644
index 000000000..e280455f3
--- /dev/null
+++ b/Examples/test-suite/import_nomodule.i
@@ -0,0 +1,24 @@
+%module import_nomodule
+%{
+#include "import_nomodule.h"
+%}
+
+%import "import_nomodule.h"
+
+#ifndef SWIGJAVA
+// The proxy class does not have Bar derived from Foo, yet an instance of Bar can successfully be passed to a proxy function taking a Foo pointer.
+// This violation of the type system is not possible in Java due to its static type checking.
+%inline %{
+Foo *create_Foo() {
+ return new Foo();
+}
+
+void test1(Foo *f, Integer x) { };
+
+class Bar : public Foo { };
+
+%}
+#endif
+
+
+
diff --git a/Examples/test-suite/imports.list b/Examples/test-suite/imports.list
new file mode 100644
index 000000000..36c0802fb
--- /dev/null
+++ b/Examples/test-suite/imports.list
@@ -0,0 +1,2 @@
+imports_a
+imports_b
diff --git a/Examples/test-suite/imports_a.h b/Examples/test-suite/imports_a.h
new file mode 100644
index 000000000..ea006b12c
--- /dev/null
+++ b/Examples/test-suite/imports_a.h
@@ -0,0 +1,7 @@
+class A {
+ public:
+ A() {}
+
+ void hello()
+ {}
+};
diff --git a/Examples/test-suite/imports_a.i b/Examples/test-suite/imports_a.i
new file mode 100644
index 000000000..56e1f0e5d
--- /dev/null
+++ b/Examples/test-suite/imports_a.i
@@ -0,0 +1,12 @@
+/* This file is part of a test for SF bug #231619.
+ It shows that the %import directive does not work properly in SWIG
+ 1.3a5: Type information is not properly generated if a base class
+ comes from an %import-ed file. */
+
+%module imports_a
+
+%{
+ #include "imports_a.h"
+%}
+
+%include "imports_a.h"
diff --git a/Examples/test-suite/imports_b.h b/Examples/test-suite/imports_b.h
new file mode 100644
index 000000000..ecc8d4e2f
--- /dev/null
+++ b/Examples/test-suite/imports_b.h
@@ -0,0 +1,11 @@
+#include "imports_a.h"
+
+class B : public A
+{
+ public:
+ B() {};
+
+ void bye()
+ {} ;
+};
+
diff --git a/Examples/test-suite/imports_b.i b/Examples/test-suite/imports_b.i
new file mode 100644
index 000000000..48c51c625
--- /dev/null
+++ b/Examples/test-suite/imports_b.i
@@ -0,0 +1,14 @@
+/* This file is part of a test for SF bug #231619.
+ It shows that the %import directive does not work properly in SWIG
+ 1.3a5: Type information is not properly generated if a base class
+ comes from an %import-ed file. */
+
+%module imports_b
+
+%{
+#include "imports_b.h"
+%}
+
+%import "imports_a.i"
+
+%include "imports_b.h"
diff --git a/Examples/test-suite/inherit_missing.i b/Examples/test-suite/inherit_missing.i
new file mode 100644
index 000000000..ecde360bf
--- /dev/null
+++ b/Examples/test-suite/inherit_missing.i
@@ -0,0 +1,43 @@
+// Tests handling of inheritance when a base class isn't provided to SWIG
+%module inherit_missing
+
+%warnfilter(402);
+
+%{
+/* Define the class internally, but don't tell SWIG about it */
+class Foo {
+public:
+ virtual char *blah() {
+ return (char *) "Foo::blah";
+ }
+};
+%}
+
+/* Forward declaration. Says that Foo is a class, but doesn't provide a definition */
+
+class Foo;
+
+%inline %{
+
+class Bar : public Foo {
+ public:
+ virtual char *blah() {
+ return (char *) "Bar::blah";
+ };
+};
+
+class Spam : public Bar {
+ public:
+ virtual char *blah() {
+ return (char *) "Spam::blah";
+ };
+};
+
+Foo *new_Foo() {
+ return new Foo();
+}
+
+char *do_blah(Foo *f) {
+ return f->blah();
+}
+%}
diff --git a/Examples/test-suite/java/.cvsignore b/Examples/test-suite/java/.cvsignore
new file mode 100644
index 000000000..f51eef359
--- /dev/null
+++ b/Examples/test-suite/java/.cvsignore
@@ -0,0 +1,185 @@
+abstract_inherit
+abstract_inherit_ok
+add_link
+anonymous_arg
+argout
+arrayptr
+arrays
+arrays_global
+arrays_global_twodim
+arrays_scope
+bool_default
+casts
+char_constant
+class_ignore
+constant_pointers
+constover
+constructor_exception
+constructor_explicit
+constructor_value
+const_const
+const_const_2
+conversion
+conversion_namespace
+conversion_ns_template
+cplusplus_throw
+cpp_enum
+cpp_enum_scope
+cpp_namespace
+cpp_nodefault
+cpp_static
+cpp_typedef
+CVS
+default_cast
+default_constructor
+default_ns
+default_ref
+defineop
+defines
+dynamic_cast
+enum
+enum_scope
+enum_scope_template
+enum_var
+evil_diamond
+evil_diamond_ns
+evil_diamond_prop
+explicit
+extend_template
+extend_template_ns
+grouping
+ignore_parameter
+imports
+import_nomodule
+inherit_missing
+java_constants
+java_pragmas
+java_throws
+java_typemaps_proxy
+java_typemaps_typewrapper
+kind
+lib_carrays
+lib_cdata
+lib_cmalloc
+lib_constraints
+lib_cpointer
+lib_math
+lib_std_deque
+lib_std_string
+lib_std_vector
+lib_typemaps
+long_long
+macro_2
+member_template
+minherit
+name
+namespace_enum
+namespace_extend
+namespace_nested
+namespace_template
+namespace_typemap
+name_cxx
+name_inherit
+nested
+newobject1
+newobject2
+overload_complicated
+overload_copy
+overload_extend
+overload_extendc
+overload_simple
+overload_subtype
+overload_template
+pointer_reference
+preproc_1
+preproc_2
+preproc_3
+primitive_ref
+private_assign
+pure_virtual
+rename_default
+rename_scope
+return_value_scope
+ret_by_value
+rname
+sizeof_pointer
+smart_pointer_const
+smart_pointer_multi
+smart_pointer_multi_typedef
+smart_pointer_not
+smart_pointer_overload
+smart_pointer_protected
+smart_pointer_rename
+smart_pointer_simple
+smart_pointer_typedef
+sneaky1
+static_array_member
+static_const_member
+static_const_member_2
+struct_value
+template
+template_arg_scope
+template_arg_typename
+template_base_template
+template_classes
+template_construct
+template_const_ref
+template_default
+template_default2
+template_default_inherit
+template_default_qualify
+template_enum
+template_enum_ns_inherit
+template_enum_typedef
+template_forward
+template_inherit
+template_inherit_abstract
+template_int_const
+template_ns
+template_ns2
+template_ns3
+template_ns4
+template_ns_enum
+template_ns_enum2
+template_ns_inherit
+template_ns_scope
+template_qualifier
+template_rename
+template_retvalue
+template_specialization
+template_static
+template_tbase_template
+template_typedef
+template_typedef_cplx
+template_typedef_cplx2
+template_typedef_cplx3
+template_typedef_cplx4
+template_typedef_import
+template_type_namespace
+template_virtual
+template_whitespace
+throw_exception
+typedef_funcptr
+typedef_inherit
+typedef_mptr
+typedef_reference
+typedef_scope
+typemap_namespace
+typemap_ns_using
+typemap_subst
+typename
+unions
+union_scope
+using1
+using2
+using_composition
+using_extend
+using_inherit
+using_namespace
+using_private
+using_protected
+valuewrapper_base
+virtual_destructor
+voidtest
+
+*.class
diff --git a/Examples/test-suite/java/Makefile b/Examples/test-suite/java/Makefile
new file mode 100644
index 000000000..6cc4c6440
--- /dev/null
+++ b/Examples/test-suite/java/Makefile
@@ -0,0 +1,72 @@
+#######################################################################
+# $Header$
+# Makefile for java test-suite
+#######################################################################
+
+LANGUAGE = java
+SCRIPTSUFFIX = _runme.java
+
+C_TEST_CASES = \
+ java_lib_arrays
+
+CPP_TEST_CASES = \
+ java_constants \
+ java_jnitypes \
+ java_pragmas \
+ java_throws \
+ java_typemaps_proxy \
+ java_typemaps_typewrapper
+
+include ../common.mk
+
+# Overridden variables here
+TOP = ../../..
+SWIGOPT = -I$(TOP)/$(TEST_SUITE) -package $*
+#Target prefix cannot be used on Windows
+#TARGETPREFIX = lib
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup) \
+ (cd $*; $(swig_and_compile_cpp); ); \
+ $(run_testcase)
+
+%.ctest:
+ $(setup) \
+ (cd $*; $(swig_and_compile_c); ); \
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup) \
+ (cd $*; $(swig_and_compile_multi_cpp); ); \
+ $(run_testcase)
+
+# Makes a directory for the testcase if it does not exist
+setup = \
+ @if [ -f $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ echo "Checking testcase $* (with run test) under $(LANGUAGE)" ; \
+ else \
+ echo "Checking testcase $* under $(LANGUAGE)" ; \
+ fi; \
+ if [ ! -d $* ]; then \
+ mkdir $*; \
+ fi;
+
+# Compiles java files then runs the testcase. A testcase is only run if
+# a file is found which has _runme.java appended after the testcase name.
+# Note Java uses LD_LIBRARY_PATH under Unix and PATH under Cygwin.
+run_testcase = \
+ (cd $*; javac *.java; ); \
+ if [ -f $*\_runme.java ]; then ( \
+ javac $*\_runme.java; \
+ env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" java $*\_runme;) \
+ fi;
+
+# Clean: remove testcase directories
+%.clean:
+ @if [ -d $* ]; then \
+ rm -rf $*; \
+ fi;
+
+clean:
+ @rm -f *.class
diff --git a/Examples/test-suite/java/README b/Examples/test-suite/java/README
new file mode 100644
index 000000000..b8b7416d9
--- /dev/null
+++ b/Examples/test-suite/java/README
@@ -0,0 +1,6 @@
+See ../README for common README file.
+
+The Java implementation of the test-suite is a little different to the other languages in that all of SWIGs output goes into a subdirectory named after the individual test case. This is so that all the shadow classes can be compiled as Java classes have to go into separate files. Otherwise the Makefile wouldn't know which .java files would be relevant to the testcase. For this to work the testcase must go into a Java package.
+
+Any testcases which have _runme.java appended after the testcase name will be detected and run.
+
diff --git a/Examples/test-suite/java/arrays_global_twodim_runme.java b/Examples/test-suite/java/arrays_global_twodim_runme.java
new file mode 100644
index 000000000..2cbc0138a
--- /dev/null
+++ b/Examples/test-suite/java/arrays_global_twodim_runme.java
@@ -0,0 +1,33 @@
+// Two dimension arrays test
+
+import arrays_global_twodim.*;
+
+public class arrays_global_twodim_runme {
+ static {
+ try {
+ System.loadLibrary("arrays_global_twodim");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ SWIGTYPE_p_a_4__int constintarray2d = arrays_global_twodim.getArray_const_i();
+ SWIGTYPE_p_a_4__int intarray2d = arrays_global_twodim.getArray_i();
+
+ // Set all the non const int array members from the const int array members and check
+ arrays_global_twodim.setArray_i(constintarray2d);
+
+ int count = 10;
+ for (int x=0; x<arrays_global_twodim.ARRAY_LEN_X; x++) {
+ for (int y=0; y<arrays_global_twodim.ARRAY_LEN_Y; y++) {
+ if ( arrays_global_twodim.get_2d_array(intarray2d, x, y) != count++) {
+ System.out.println("Value incorrect array_i[" + x + "][" + y + "]");
+ System.exit(1);
+ }
+ }
+ }
+ }
+}
diff --git a/Examples/test-suite/java/cpp_typedef_runme.java b/Examples/test-suite/java/cpp_typedef_runme.java
new file mode 100644
index 000000000..38153fac2
--- /dev/null
+++ b/Examples/test-suite/java/cpp_typedef_runme.java
@@ -0,0 +1,30 @@
+
+// This is the cpp_typedef runtime testcase. It checks that shadow classes are
+// generated for typedef'd types.
+
+import cpp_typedef.*;
+
+public class cpp_typedef_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp_typedef");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ Test test = new Test();
+ UnnamedStruct unnamed = new UnnamedStruct();
+ TypedefNamedStruct named = new TypedefNamedStruct();
+
+ UnnamedStruct unnamed2 = test.test1(unnamed);
+ TypedefNamedStruct named2 = test.test2(named);
+ TypedefNamedStruct named3 = test.test3(named);
+ TypedefNamedStruct named4 = test.test4(named);
+ }
+}
+
diff --git a/Examples/test-suite/java/dynamic_cast_runme.java b/Examples/test-suite/java/dynamic_cast_runme.java
new file mode 100644
index 000000000..be1f97b35
--- /dev/null
+++ b/Examples/test-suite/java/dynamic_cast_runme.java
@@ -0,0 +1,29 @@
+
+import dynamic_cast.*;
+
+public class dynamic_cast_runme {
+ static {
+ try {
+ System.loadLibrary("dynamic_cast");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ Foo f = new Foo();
+ Bar b = new Bar();
+
+ Foo x = f.blah();
+ Foo y = b.blah();
+
+ // Note it is possible to downcast y with a Java cast.
+ String a = dynamic_cast.do_test((Bar)y);
+ if (!a.equals("Bar::test")) {
+ System.err.println("Failed!");
+ System.exit(1);
+ }
+ }
+}
diff --git a/Examples/test-suite/java/ignore_parameter_runme.java b/Examples/test-suite/java/ignore_parameter_runme.java
new file mode 100644
index 000000000..7dbcb06db
--- /dev/null
+++ b/Examples/test-suite/java/ignore_parameter_runme.java
@@ -0,0 +1,36 @@
+// Runtime test checking the %typemap(ignore) macro
+
+import ignore_parameter.*;
+
+public class ignore_parameter_runme {
+ static {
+ try {
+ System.loadLibrary("ignore_parameter");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ // Compilation will ensure the number of arguments and type are correct.
+ // Then check the return value is the same as the value given to the ignored parameter.
+ if (!ignore_parameter.jaguar(200, 0.0).equals("hello")) { System.err.println("Runtime Error in jaguar()");}
+ if (ignore_parameter.lotus("fast", 0.0) != 101) { System.err.println("Runtime Error in lotus()");}
+ if (ignore_parameter.tvr("fast", 200) != 8.8) { System.err.println("Runtime Error in tvr()");}
+ if (ignore_parameter.ferrari() != 101) { System.err.println("Runtime Error in ferrari()");}
+
+ SportsCars sc = new SportsCars();
+ if (!sc.daimler(200, 0.0).equals("hello")) { System.err.println("Runtime Error in daimler()");}
+ if (sc.astonmartin("fast", 0.0) != 101) { System.err.println("Runtime Error in astonmartin()");}
+ if (sc.bugatti("fast", 200) != 8.8) { System.err.println("Runtime Error in bugatti()");}
+ if (sc.lamborghini() != 101) { System.err.println("Runtime Error in lamborghini()");}
+
+ // Check constructors are also generated correctly
+ MiniCooper mc = new MiniCooper(200, 0.0);
+ MorrisMinor mm = new MorrisMinor("slow", 0.0);
+ FordAnglia fa = new FordAnglia("slow", 200);
+ AustinAllegro aa = new AustinAllegro();
+ }
+}
diff --git a/Examples/test-suite/java/imports_runme.java b/Examples/test-suite/java/imports_runme.java
new file mode 100644
index 000000000..b82862b67
--- /dev/null
+++ b/Examples/test-suite/java/imports_runme.java
@@ -0,0 +1,24 @@
+
+// This is the imports runtime testcase. It shows that the %import directive
+// is working correctly
+
+import imports.*;
+
+public class imports_runme {
+
+ static {
+ try {
+ System.loadLibrary("imports_a");
+ System.loadLibrary("imports_b");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ B b = new B();
+ b.hello(); //call member function in A which is in a different SWIG generated library.
+ }
+}
diff --git a/Examples/test-suite/java/java_constants_runme.java b/Examples/test-suite/java/java_constants_runme.java
new file mode 100644
index 000000000..be2ece08a
--- /dev/null
+++ b/Examples/test-suite/java/java_constants_runme.java
@@ -0,0 +1,29 @@
+
+import java_constants.*;
+
+public class java_constants_runme {
+ static {
+ try {
+ System.loadLibrary("java_constants");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ int number = 200;
+
+ // Switch statement will only compile if these constants are initialised
+ // from a constant Java value, that is not from a function call
+ switch(number) {
+ case java_constants.CHINA:
+ break;
+ case java_constants.BRISTOLS:
+ break;
+ default:
+ break;
+ }
+ }
+}
diff --git a/Examples/test-suite/java/java_jnitypes_runme.java b/Examples/test-suite/java/java_jnitypes_runme.java
new file mode 100644
index 000000000..a4950d9bd
--- /dev/null
+++ b/Examples/test-suite/java/java_jnitypes_runme.java
@@ -0,0 +1,57 @@
+
+import java_jnitypes.*;
+
+public class java_jnitypes_runme {
+
+ static {
+ try {
+ System.loadLibrary("java_jnitypes");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static class Test {
+ }
+
+ public static void main(String argv[]) {
+
+ Test test = new Test();
+ boolean booleanArray[] = new boolean[] {true, false};
+ char charArray[] = new char[] {10, 20};
+ byte byteArray[] = new byte[] {'A', 'B'};
+ short shortArray[] = new short[] {10, 20};
+ int intArray[] = new int[] {10, 20};
+ long longArray[] = new long[] {10, 20};
+ float floatArray[] = new float[] {(float)10.0, (float)20.0};
+ double doubleArray[] = new double[] {10.0, 20.0};
+ Test objectArray[] = new Test[] {new Test(), test};
+
+ if (java_jnitypes.jnifunc(true) != true) testFailed("jboolean");
+ if (java_jnitypes.jnifunc(100) != 100) testFailed("jchar");
+ if (java_jnitypes.jnifunc('A') != 'A') testFailed("jbyte");
+ if (java_jnitypes.jnifunc(100) != 100) testFailed("jshort");
+ if (java_jnitypes.jnifunc(100) != 100) testFailed("jint");
+ if (java_jnitypes.jnifunc(100) != 100) testFailed("jlong");
+ if (java_jnitypes.jnifunc(100) != 100) testFailed("jfloat");
+ if (java_jnitypes.jnifunc(100.0) != 100) testFailed("jdouble");
+ if (java_jnitypes.jnifunc("100") != "100") testFailed("jstring");
+ if (java_jnitypes.jnifunc(test) != test) testFailed("jobject");
+ if (java_jnitypes.jnifunc(booleanArray)[1] != false) testFailed("jbooleanArray");
+ if (java_jnitypes.jnifunc(charArray)[1] != 20) testFailed("jcharArray");
+ if (java_jnitypes.jnifunc(byteArray)[1] != 'B') testFailed("jbyteArray");
+ if (java_jnitypes.jnifunc(shortArray)[1] != 20) testFailed("jshortArray");
+ if (java_jnitypes.jnifunc(intArray)[1] != 20) testFailed("jintArray");
+ if (java_jnitypes.jnifunc(longArray)[1] != 20) testFailed("jlongArray");
+ if (java_jnitypes.jnifunc(floatArray)[1] != 20.0) testFailed("jfloatArray");
+ if (java_jnitypes.jnifunc(doubleArray)[1] != 20.0) testFailed("jdoubleArray");
+ if (java_jnitypes.jnifunc(objectArray)[1] != test) testFailed("jobjectArray");
+
+ }
+
+ public static void testFailed(String str) {
+ System.err.println(str + " test failed");
+ System.exit(1);
+ }
+}
diff --git a/Examples/test-suite/java/java_lib_arrays_runme.java b/Examples/test-suite/java/java_lib_arrays_runme.java
new file mode 100644
index 000000000..9490e5e2f
--- /dev/null
+++ b/Examples/test-suite/java/java_lib_arrays_runme.java
@@ -0,0 +1,150 @@
+
+// This is the java_lib_arrays runtime testcase. It ensures that a getter and a setter has
+// been produced for array members and that they function as expected. It is a
+// pretty comprehensive test for all the Java array library typemaps.
+
+import java_lib_arrays.*;
+
+public class java_lib_arrays_runme {
+
+ static {
+ try {
+ System.loadLibrary("java_lib_arrays");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ // Check array member variables
+ ArrayStruct as = new ArrayStruct();
+
+ // Create arrays for all the array types that ArrayStruct can handle
+ String array_c = "X";
+ byte[] array_sc = {10, 20};
+ short[] array_uc = {101, 201};
+ short[] array_s = {1002, 2002};
+ int[] array_us = {1003, 2003};
+ int[] array_i = {1004, 2004};
+ long[] array_ui = {1005, 2005};
+ int[] array_l = {1006, 2006};
+ long[] array_ul = {1007, 2007};
+ long[] array_ll = {1008, 2008};
+ float[] array_f = {1009.1f, 2009.1f};
+ double[] array_d = {1010.2f, 2010.2f};
+ int[] array_enum = {java_lib_arrays.Three, java_lib_arrays.Four};
+
+ SimpleStruct[] array_struct={new SimpleStruct(), new SimpleStruct()};
+ array_struct[0].setDouble_field(222.333);
+ array_struct[1].setDouble_field(444.555);
+
+ // Now set the array members and check that they have been set correctly
+ as.setArray_c(array_c);
+ check_string(array_c, as.getArray_c());
+
+ as.setArray_sc(array_sc);
+ check_byte_array(array_sc, as.getArray_sc());
+
+ as.setArray_uc(array_uc);
+ check_short_array(array_uc, as.getArray_uc());
+
+ as.setArray_s(array_s);
+ check_short_array(array_s, as.getArray_s());
+
+ as.setArray_us(array_us);
+ check_int_array(array_us, as.getArray_us());
+
+ as.setArray_i(array_i);
+ check_int_array(array_i, as.getArray_i());
+
+ as.setArray_ui(array_ui);
+ check_long_array(array_ui, as.getArray_ui());
+
+ as.setArray_l(array_l);
+ check_int_array(array_l, as.getArray_l());
+
+ as.setArray_ul(array_ul);
+ check_long_array(array_ul, as.getArray_ul());
+
+ as.setArray_ll(array_ll);
+ check_long_array(array_ll, as.getArray_ll());
+
+ as.setArray_f(array_f);
+ check_float_array(array_f, as.getArray_f());
+
+ as.setArray_d(array_d);
+ check_double_array(array_d, as.getArray_d());
+
+ as.setArray_enum(array_enum);
+ check_int_array(array_enum, as.getArray_enum());
+
+ as.setArray_struct(array_struct);
+ check_struct_array(array_struct, as.getArray_struct());
+ }
+
+ // Functions to check that the array values were set correctly
+ public static void check_string(String original, String checking) {
+ if (!checking.equals(original)) {
+ System.err.println("Runtime test failed. checking = [" + checking + "]");
+ System.exit(1);
+ }
+ }
+ public static void check_byte_array(byte[] original, byte[] checking) {
+ for (int i=0; i<original.length; i++) {
+ if (checking[i] != original[i]) {
+ System.err.println("Runtime test failed. checking[" + i + "]=" + checking[i]);
+ System.exit(1);
+ }
+ }
+ }
+ public static void check_short_array(short[] original, short[] checking) {
+ for (int i=0; i<original.length; i++) {
+ if (checking[i] != original[i]) {
+ System.err.println("Runtime test failed. checking[" + i + "]=" + checking[i]);
+ System.exit(1);
+ }
+ }
+ }
+ public static void check_int_array(int[] original, int[] checking) {
+ for (int i=0; i<original.length; i++) {
+ if (checking[i] != original[i]) {
+ System.err.println("Runtime test failed. checking[" + i + "]=" + checking[i]);
+ System.exit(1);
+ }
+ }
+ }
+ public static void check_long_array(long[] original, long[] checking) {
+ for (int i=0; i<original.length; i++) {
+ if (checking[i] != original[i]) {
+ System.err.println("Runtime test failed. checking[" + i + "]=" + checking[i]);
+ System.exit(1);
+ }
+ }
+ }
+ public static void check_float_array(float[] original, float[] checking) {
+ for (int i=0; i<original.length; i++) {
+ if (checking[i] != original[i]) {
+ System.err.println("Runtime test failed. checking[" + i + "]=" + checking[i]);
+ System.exit(1);
+ }
+ }
+ }
+ public static void check_double_array(double[] original, double[] checking) {
+ for (int i=0; i<original.length; i++) {
+ if (checking[i] != original[i]) {
+ System.err.println("Runtime test failed. checking[" + i + "]=" + checking[i]);
+ System.exit(1);
+ }
+ }
+ }
+ public static void check_struct_array(SimpleStruct[] original, SimpleStruct[] checking) {
+ for (int i=0; i<original.length; i++) {
+ if (checking[i].getDouble_field() != original[i].getDouble_field()) {
+ System.err.println("Runtime test failed. checking[" + i + "].double_field=" + checking[i].getDouble_field());
+ System.exit(1);
+ }
+ }
+ }
+}
diff --git a/Examples/test-suite/java/java_pragmas_runme.java b/Examples/test-suite/java/java_pragmas_runme.java
new file mode 100644
index 000000000..311141159
--- /dev/null
+++ b/Examples/test-suite/java/java_pragmas_runme.java
@@ -0,0 +1,15 @@
+
+import java_pragmas.*;
+
+public class java_pragmas_runme {
+
+ // No system.loadLibrary() as the JNI class will do this
+
+ public static void main(String argv[])
+ {
+ // Call a JNI class function. Normally this is not possible as the class is protected, however, the jniclassmodifiers pragma has changed this.
+ long int_pointer = java_pragmasJNI.get_int_pointer();
+
+ java_pragmas.added_function("hello");
+ }
+}
diff --git a/Examples/test-suite/java/java_throws_runme.java b/Examples/test-suite/java/java_throws_runme.java
new file mode 100644
index 000000000..63b6497bc
--- /dev/null
+++ b/Examples/test-suite/java/java_throws_runme.java
@@ -0,0 +1,46 @@
+
+import java_throws.*;
+
+public class java_throws_runme {
+
+ static {
+ try {
+ System.loadLibrary("java_throws");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[])
+ {
+ // Check the exception classes in the main typemaps
+ boolean pass = false;
+
+ // This won't compile unless all of these exceptions are in the throw clause
+ try {
+ short s = java_throws.full_of_exceptions(10);
+ }
+ catch (ClassNotFoundException e) {}
+ catch (NoSuchFieldException e) { pass = true; }
+ catch (InstantiationException e) {}
+ catch (CloneNotSupportedException e) {}
+ catch (IllegalAccessException e) {}
+
+ if (!pass) {
+ System.err.println("Test 1 failed");
+ System.exit(1);
+ }
+
+ // Check the exception class in the throw typemap
+ try {
+ java_throws.throw_spec_function(100);
+ }
+ catch (IllegalAccessException e) { pass = true; }
+
+ if (!pass) {
+ System.err.println("Test 2 failed");
+ System.exit(1);
+ }
+ }
+}
diff --git a/Examples/test-suite/java/java_typemaps_proxy_runme.java b/Examples/test-suite/java/java_typemaps_proxy_runme.java
new file mode 100644
index 000000000..997e5b8d1
--- /dev/null
+++ b/Examples/test-suite/java/java_typemaps_proxy_runme.java
@@ -0,0 +1,48 @@
+
+// This is the java_typemaps_proxy runtime testcase. Contrived example checks that the pure Java code from the Java typemaps compiles.
+
+import java_typemaps_proxy.*;
+
+public class java_typemaps_proxy_runme {
+
+ static {
+ try {
+ System.loadLibrary("java_typemaps_proxy");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ Greeting greet = new Greeting();
+ Farewell bye = new Farewell();
+
+ // Check that pure Java methods have been added
+ greet.sayhello();
+ bye.saybye(new java.math.BigDecimal(java.math.BigInteger.ONE));
+
+ // No finalize method so may as well delete manually
+ bye.delete();
+
+ // Check that Greeting is derived from Exception
+ try {
+ throw new Greeting();
+ } catch (Greeting g) {
+ String msg = g.getMessage();
+ }
+
+ // Check that Greeting has implemented the EventListener interface
+ Greeting.cheerio(greet);
+
+ // The default getCPtr() call in each method will through an exception if null is passed.
+ // Make sure the modified version works with and without null objects.
+ Greeting.ciao(null);
+ Greeting.ciao(greet);
+
+ // Create a NULL pointer for Farewell using the constructor with changed modifiers
+ Farewell nullFarewell = new Farewell(0, false);
+ }
+}
+
diff --git a/Examples/test-suite/java/java_typemaps_typewrapper_runme.java b/Examples/test-suite/java/java_typemaps_typewrapper_runme.java
new file mode 100644
index 000000000..f6769fe20
--- /dev/null
+++ b/Examples/test-suite/java/java_typemaps_typewrapper_runme.java
@@ -0,0 +1,45 @@
+
+// This is the java_typemaps_typewrapper runtime testcase. Contrived example checks that the pure Java code generated from the Java typemaps compiles.
+
+import java_typemaps_typewrapper.*;
+
+public class java_typemaps_typewrapper_runme {
+
+ static {
+ try {
+ System.loadLibrary("java_typemaps_typewrapper");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ SWIGTYPE_p_Greeting greet = SWIGTYPE_p_Greeting.CreateNullPointer();
+ SWIGTYPE_p_Farewell bye = SWIGTYPE_p_Farewell.CreateNullPointer();
+
+ // Check that pure Java methods have been added
+ greet.sayhello();
+ bye.saybye(new java.math.BigDecimal(java.math.BigInteger.ONE));
+
+ // Check that SWIGTYPE_p_Greeting is derived from Exception
+ try {
+ throw SWIGTYPE_p_Greeting.CreateNullPointer();
+ } catch (SWIGTYPE_p_Greeting g) {
+ String msg = g.getMessage();
+ }
+
+ // Check that SWIGTYPE_p_Greeting has implemented the EventListener interface
+ SWIGTYPE_p_Greeting.cheerio(greet);
+
+ // The default getCPtr() call in each method will through an exception if null is passed.
+ // Make sure the modified version works with and without null objects.
+ java_typemaps_typewrapper.solong(null);
+ java_typemaps_typewrapper.solong(bye);
+
+ // Create a NULL pointer for Farewell using the constructor with changed modifiers
+ SWIGTYPE_p_Farewell nullFarewell = new SWIGTYPE_p_Farewell(0, false);
+ }
+}
+
diff --git a/Examples/test-suite/java/lib_typemaps_runme.java b/Examples/test-suite/java/lib_typemaps_runme.java
new file mode 100644
index 000000000..443886748
--- /dev/null
+++ b/Examples/test-suite/java/lib_typemaps_runme.java
@@ -0,0 +1,85 @@
+
+// Check a few of the INPUT, OUTPUT and INOUT typemaps.
+
+import lib_typemaps.*;
+import java.math.*;
+
+public class lib_typemaps_runme {
+
+ static {
+ try {
+ System.loadLibrary("lib_typemaps");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ // Check double INPUT typemaps
+ if (lib_typemaps.in_double(22.22) != 22.22) exit_test("in_double");
+ if (lib_typemaps.inr_double(22.22) != 22.22) exit_test("inr_double");
+
+ // Check double OUTPUT typemaps
+ {
+ double[] var = {44.44};
+ lib_typemaps.out_double(22.22, var);
+ if (var[0] != 22.22) exit_test("out_double");
+ }
+ {
+ double[] var = {44.44};
+ lib_typemaps.outr_double(22.22, var);
+ if (var[0] != 22.22) exit_test("outr_double");
+ }
+
+ // Check double INOUT typemaps
+ {
+ double[] var = {44.44};
+ lib_typemaps.inout_double(var);
+ if (var[0] != 44.44) exit_test("inout_double");
+ }
+ {
+ double[] var = {44.44};
+ lib_typemaps.inoutr_double(var);
+ if (var[0] != 44.44) exit_test("inoutr_double");
+ }
+
+
+ // Check unsigned long long INPUT typemaps
+ BigInteger forty = new BigInteger("40");
+ BigInteger twenty = new BigInteger("20");
+ if (!lib_typemaps.in_ulonglong(twenty).equals(twenty)) exit_test("in_ulonglong");
+ if (!lib_typemaps.inr_ulonglong(twenty).equals(twenty)) exit_test("inr_ulonglong");
+
+ // Check unsigned long long OUTPUT typemaps
+ {
+ BigInteger[] var = {new BigInteger("40")};
+ lib_typemaps.out_ulonglong(twenty, var);
+ if (!var[0].equals(twenty)) exit_test("out_ulonglong");
+ }
+ {
+ BigInteger[] var = {new BigInteger("40")};
+ lib_typemaps.outr_ulonglong(twenty, var);
+ if (!var[0].equals(twenty)) exit_test("outr_ulonglong");
+ }
+
+ // Check unsigned long long INOUT typemaps
+ {
+ BigInteger[] var = {new BigInteger("40")};
+ lib_typemaps.inout_ulonglong(var);
+ if (!var[0].equals(forty)) exit_test("inout_ulonglong");
+ }
+ {
+ BigInteger[] var = {new BigInteger("40")};
+ lib_typemaps.inoutr_ulonglong(var);
+ if (!var[0].equals(forty)) exit_test("inoutr_ulonglong");
+ }
+ }
+
+ private static void exit_test(String funcName) {
+ System.err.println("Test FAILED in function " + funcName);
+ System.exit(1);
+ }
+}
+
diff --git a/Examples/test-suite/java/long_long_runme.java b/Examples/test-suite/java/long_long_runme.java
new file mode 100644
index 000000000..2be4cb125
--- /dev/null
+++ b/Examples/test-suite/java/long_long_runme.java
@@ -0,0 +1,50 @@
+
+// This is the long_long runtime testcase. It checks that the long long and
+// unsigned long long types map correctly to long and BigInteger respectively.
+
+import long_long.*;
+import java.math.*;
+
+public class long_long_runme {
+
+ static {
+ try {
+ System.loadLibrary("long_long");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ check_ll(0L);
+ check_ll(0x7FFFFFFFFFFFFFFFL);
+ check_ll(-10);
+
+ check_ull(new BigInteger("0"));
+ check_ull(new BigInteger("127"));
+ check_ull(new BigInteger("128"));
+ check_ull(new BigInteger("9223372036854775807")); //0x7FFFFFFFFFFFFFFFL
+ check_ull(new BigInteger("18446744073709551615")); //0xFFFFFFFFFFFFFFFFL
+ }
+
+ public static void check_ll(long ll) {
+ long_long.setLl(ll);
+ long ll_check = long_long.getLl();
+ if (ll != ll_check) {
+ System.err.println("Runtime test using long long failed. ll=" + ll + " ll_check=" + ll_check);
+ System.exit(1);
+ }
+ }
+
+ public static void check_ull(BigInteger ull) {
+ long_long.setUll(ull);
+ BigInteger ull_check = long_long.getUll();
+ if (ull.compareTo(ull_check) != 0) {
+ System.err.println("Runtime test using unsigned long long failed. ull=" + ull.toString() + " ull_check=" + ull_check.toString());
+ System.exit(1);
+ }
+ }
+}
+
diff --git a/Examples/test-suite/java/primitive_ref_runme.java b/Examples/test-suite/java/primitive_ref_runme.java
new file mode 100644
index 000000000..ec28c8616
--- /dev/null
+++ b/Examples/test-suite/java/primitive_ref_runme.java
@@ -0,0 +1,64 @@
+// Check that C++ primitive types that are passed by const reference work when
+// passed by value from Java
+
+import primitive_ref.*;
+import java.math.*;
+
+public class primitive_ref_runme {
+
+ static {
+ try {
+ System.loadLibrary("primitive_ref");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ if (primitive_ref.ref_int(3) != 3) {
+ System.err.println( "ref_int failed!" );
+ }
+ if (primitive_ref.ref_uint(3) != 3) {
+ System.err.println( "ref_uint failed!" );
+ }
+ if (primitive_ref.ref_short((short)3) != 3) {
+ System.err.println( "ref_short failed!" );
+ }
+ if (primitive_ref.ref_ushort(3) != 3) {
+ System.err.println( "ref_ushort failed!" );
+ }
+ if (primitive_ref.ref_long(3) != 3) {
+ System.err.println( "ref_long failed!" );
+ }
+ if (primitive_ref.ref_ulong(3) != 3) {
+ System.err.println( "ref_ulong failed!" );
+ }
+ if (primitive_ref.ref_schar((byte)3) != 3) {
+ System.err.println( "ref_schar failed!" );
+ }
+ if (primitive_ref.ref_uchar((short)3) != 3) {
+ System.err.println( "ref_uchar failed!" );
+ }
+ if (primitive_ref.ref_bool(true) != true) {
+ System.err.println( "ref_bool failed!" );
+ }
+ if (primitive_ref.ref_float((float)3.5) != 3.5) {
+ System.err.println( "ref_float failed!" );
+ }
+ if (primitive_ref.ref_double(3.5) != 3.5) {
+ System.err.println( "ref_double failed!" );
+ }
+ if (primitive_ref.ref_char('x') != 'x') {
+ System.err.println( "ref_char failed!" );
+ }
+ if (primitive_ref.ref_longlong(3) != '3') {
+ System.err.println( "ref_longlong failed!" );
+ }
+ BigInteger bi = new BigInteger("18446744073709551615"); //0xFFFFFFFFFFFFFFFFL
+ if (bi.compareTo(primitive_ref.ref_ulonglong(bi)) != 0) {
+ System.err.println( "ref_ulonglong failed!" );
+ }
+ }
+}
diff --git a/Examples/test-suite/java/ret_by_value_runme.java b/Examples/test-suite/java/ret_by_value_runme.java
new file mode 100644
index 000000000..44bb69796
--- /dev/null
+++ b/Examples/test-suite/java/ret_by_value_runme.java
@@ -0,0 +1,33 @@
+
+// This is the ret_by_value runtime testcase. It checks that SWIG handles
+// return by value okay.
+
+import ret_by_value.*;
+
+public class ret_by_value_runme {
+
+ static {
+ try {
+ System.loadLibrary("ret_by_value");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ // Get the test class. Note that this constructor will ensure that the memory created
+ // in the wrapper is owned by the test class.
+ test tst = ret_by_value.get_test();
+
+ if (tst.getMyInt() != 100 || tst.getMyShort() != 200) {
+ System.err.println("Runtime test failed. myInt=" + tst.getMyInt() + " myShort=" + tst.getMyShort());
+ System.exit(1);
+ }
+
+ // Delete memory manually, it should not be deleted again by the test class finalizer
+ tst.delete();
+ }
+}
+
diff --git a/Examples/test-suite/java/template_classes_runme.java b/Examples/test-suite/java/template_classes_runme.java
new file mode 100644
index 000000000..d81f7988d
--- /dev/null
+++ b/Examples/test-suite/java/template_classes_runme.java
@@ -0,0 +1,25 @@
+
+// This is the template_classes runtime testcase. It checks that SWIG handles a templated
+// class used by another templated class, in particular that the shadow classes can be used.
+
+import template_classes.*;
+
+public class template_classes_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_classes");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ RectangleInt rectint = new RectangleInt();
+ PointInt pi = rectint.getPoint();
+ int x = pi.getX();
+ }
+}
+
diff --git a/Examples/test-suite/java/unions_runme.java b/Examples/test-suite/java/unions_runme.java
new file mode 100644
index 000000000..16a5b3b87
--- /dev/null
+++ b/Examples/test-suite/java/unions_runme.java
@@ -0,0 +1,68 @@
+
+// This is the union runtime testcase. It ensures that values within a
+// union embedded within a struct can be set and read correctly.
+
+import unions.*;
+
+public class unions_runme {
+
+ static {
+ try {
+ System.loadLibrary("unions");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+
+ // Create new instances of SmallStruct and BigStruct for later use
+ SmallStruct small = new SmallStruct();
+ small.setJill((short)200);
+
+ BigStruct big = new BigStruct();
+ big.setSmallstruct(small);
+ big.setJack(300);
+
+ // Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
+ // Ensure values in EmbeddedUnionTest are set correctly for each.
+ EmbeddedUnionTest eut = new EmbeddedUnionTest();
+
+ // First check the SmallStruct in EmbeddedUnionTest
+ eut.setNumber(1);
+ eut.getUni().setSmall(small);
+ short Jill1 = eut.getUni().getSmall().getJill();
+ if (Jill1 != 200) {
+ System.err.println("Runtime test1 failed. eut.uni.small.jill=" + Jill1);
+ System.exit(1);
+ }
+
+ int Num1 = eut.getNumber();
+ if (Num1 != 1) {
+ System.err.println("Runtime test2 failed. eut.number=" + Num1);
+ System.exit(1);
+ }
+
+ // Secondly check the BigStruct in EmbeddedUnionTest
+ eut.setNumber(2);
+ eut.getUni().setBig(big);
+ int Jack1 = eut.getUni().getBig().getJack();
+ if (Jack1 != 300) {
+ System.err.println("Runtime test3 failed. eut.uni.big.jack=" + Jack1);
+ System.exit(1);
+ }
+
+ short Jill2 = eut.getUni().getBig().getSmallstruct().getJill();
+ if (Jill2 != 200) {
+ System.err.println("Runtime test4 failed. eut.uni.big.smallstruct.jill=" + Jill2);
+ System.exit(1);
+ }
+
+ int Num2 = eut.getNumber();
+ if (Num2 != 2) {
+ System.err.println("Runtime test5 failed. eut.number=" + Num2);
+ System.exit(1);
+ }
+}
+}
diff --git a/Examples/test-suite/java_constants.i b/Examples/test-suite/java_constants.i
new file mode 100644
index 000000000..d3cd48f17
--- /dev/null
+++ b/Examples/test-suite/java_constants.i
@@ -0,0 +1,30 @@
+
+// This testcase uses the %javaconst directive to control how constants are initialised
+
+%module java_constants
+
+
+%constant short DIPSTICK=100;
+
+// Set default Java const code generation
+%javaconst(1);
+
+// Modify the code generation to use JNI function call initialisation for some difficult cases
+%javaconst(0) TOM;
+%javaconst(0) ORCHESTRA_STALLS;
+%javaconst(0) PORKY;
+
+%inline %{
+#define CHINA 2*100
+#define TOM 300ULL
+#define ORCHESTRA_STALLS 400LL
+#define JAM_JAR "500"
+#define OXO '6'
+#define PORKY !7
+%}
+
+%constant int BRISTOLS=800;
+
+%javaconst(0);
+%constant long long ROSY=900LL;
+
diff --git a/Examples/test-suite/java_jnitypes.i b/Examples/test-suite/java_jnitypes.i
new file mode 100644
index 000000000..bc405793d
--- /dev/null
+++ b/Examples/test-suite/java_jnitypes.i
@@ -0,0 +1,29 @@
+
+// This testcase tests the JNI types
+
+%module java_jnitypes
+
+%inline %{
+
+jboolean jnifunc(jboolean in) { return in; }
+jchar jnifunc(jchar in) { return in; }
+jbyte jnifunc(jbyte in) { return in; }
+jshort jnifunc(jshort in) { return in; }
+jint jnifunc(jint in) { return in; }
+jlong jnifunc(jlong in) { return in; }
+jfloat jnifunc(jfloat in) { return in; }
+jdouble jnifunc(jdouble in) { return in; }
+jstring jnifunc(jstring in) { return in; }
+jobject jnifunc(jobject in) { return in; }
+jbooleanArray jnifunc(jbooleanArray in) { return in; }
+jcharArray jnifunc(jcharArray in) { return in; }
+jbyteArray jnifunc(jbyteArray in) { return in; }
+jshortArray jnifunc(jshortArray in) { return in; }
+jintArray jnifunc(jintArray in) { return in; }
+jlongArray jnifunc(jlongArray in) { return in; }
+jfloatArray jnifunc(jfloatArray in) { return in; }
+jdoubleArray jnifunc(jdoubleArray in) { return in; }
+jobjectArray jnifunc(jobjectArray in) { return in; }
+
+%}
+
diff --git a/Examples/test-suite/java_lib_arrays.i b/Examples/test-suite/java_lib_arrays.i
new file mode 100644
index 000000000..724edb87c
--- /dev/null
+++ b/Examples/test-suite/java_lib_arrays.i
@@ -0,0 +1,11 @@
+/* Testcase for the Java array typemaps which are not used by default. */
+%module java_lib_arrays
+
+/* Use the Java library typemaps */
+%include "arrays_java.i"
+
+JAVA_ARRAYSOFCLASSES(SimpleStruct)
+%apply ARRAYSOFENUMS[ANY] { finger[ANY] }
+
+%include "arrays.i"
+
diff --git a/Examples/test-suite/java_pragmas.i b/Examples/test-suite/java_pragmas.i
new file mode 100644
index 000000000..5e86c08ad
--- /dev/null
+++ b/Examples/test-suite/java_pragmas.i
@@ -0,0 +1,48 @@
+
+// Test case uses all the Java pragmas which are for tailoring the generated JNI class and Java module class.
+
+%module java_pragmas
+
+%pragma(java) jniclassimports=%{
+import java.lang.*; // For Exception
+%}
+
+%pragma(java) jniclassclassmodifiers="public"
+%pragma(java) jniclassbase="Exception"
+%pragma(java) jniclassinterfaces="Cloneable"
+
+%pragma(java) jniclasscode=%{
+ // jniclasscode pragma code: Static block so that the JNI class loads the C++ DLL/shared object when the class is loaded
+ static {
+ try {
+ System.loadLibrary("java_pragmas");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+%}
+
+
+%pragma(java) moduleimports=%{
+import java.io.*; // For Serializable
+%}
+
+%pragma(java) moduleclassmodifiers="public final"
+%pragma(java) modulebase="Object"
+%pragma(java) moduleinterfaces="Serializable"
+
+%pragma(java) modulecode=%{
+ public static void added_function(String s) {
+ // Added function
+ }
+%}
+
+
+%inline %{
+int *get_int_pointer() {
+ static int number = 10;
+ return &number;
+}
+%}
+
diff --git a/Examples/test-suite/java_throws.i b/Examples/test-suite/java_throws.i
new file mode 100644
index 000000000..7f342410c
--- /dev/null
+++ b/Examples/test-suite/java_throws.i
@@ -0,0 +1,41 @@
+// Test to check the exception classes in the throws attribute of the typemaps is working
+
+%module java_throws
+
+// Exceptions are chosen at random but are ones which have to have a try catch block to compile
+%typemap(in, throws=" ClassNotFoundException") int num {
+ $1 = (int)$input;
+}
+%typemap(freearg, throws="InstantiationException ") int num "/*not written*/"
+%typemap(argout, throws="CloneNotSupportedException ") int num "/*not written*/"
+%typemap(check, throws="NoSuchFieldException") int num {
+ if ($input == 10) {
+ jenv->ExceptionClear();
+ jclass excep = jenv->FindClass("java/lang/NoSuchFieldException");
+ if (excep)
+ jenv->ThrowNew(excep, "Value of 10 not acceptable");
+ }
+}
+
+// Duplicate exceptions should be removed from the generated throws clause
+%typemap(out, throws="IllegalAccessException, NoSuchFieldException, CloneNotSupportedException ") short {
+ $result = (jshort)$1;
+}
+
+%inline %{
+short full_of_exceptions(int num) {
+ return 0;
+}
+%}
+
+
+%typemap(throws, throws="IllegalAccessException") int {
+ jclass excep = jenv->FindClass("java/lang/IllegalAccessException");
+ if (excep)
+ jenv->ThrowNew(excep, "Test exception");
+ return $null;
+}
+%inline %{
+void throw_spec_function(int value) throw (int) { throw (int)0; }
+%}
+
diff --git a/Examples/test-suite/java_typemaps_proxy.i b/Examples/test-suite/java_typemaps_proxy.i
new file mode 100644
index 000000000..e5b317b0b
--- /dev/null
+++ b/Examples/test-suite/java_typemaps_proxy.i
@@ -0,0 +1,53 @@
+/* Tests the Java specific directives */
+
+%module java_typemaps_proxy
+
+
+%typemap(javaimports) SWIGTYPE "import java.math.*;";
+%typemap(javacode) Farewell %{
+ public void saybye(BigDecimal num_times) {
+ // BigDecimal requires the java.math library
+ }
+%}
+%typemap(javaclassmodifiers) Farewell "public final";
+
+%typemap(javaimports) Greeting %{
+import java.util.*; // for EventListener
+import java.lang.*; // for Exception
+%};
+
+%typemap(javabase) Greeting "Exception";
+%typemap(javainterfaces) Greeting "EventListener";
+%typemap(javacode) Greeting %{
+ // Pure Java code generated using %typemap(javacode)
+ public void sayhello() {
+ hello();
+ }
+
+ public static void cheerio(EventListener e) {
+ }
+%}
+
+// Create a new getCPtr() function which takes Java null
+%typemap(javagetcptr) Greeting %{
+ public static long getCPtr($javaclassname obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+%}
+
+// get rid of the finalize method for Farewell
+%typemap(javafinalize) Farewell "";
+
+// Make the pointer constructor public
+%typemap(javaptrconstructormodifiers) Farewell "public";
+
+
+%inline %{
+class Greeting {
+public:
+ void hello() {}
+ static void ciao(Greeting* g) {}
+};
+class Farewell {
+};
+%}
diff --git a/Examples/test-suite/java_typemaps_typewrapper.i b/Examples/test-suite/java_typemaps_typewrapper.i
new file mode 100644
index 000000000..b8fd4cb92
--- /dev/null
+++ b/Examples/test-suite/java_typemaps_typewrapper.i
@@ -0,0 +1,57 @@
+/* Contrived example to test the Java specific directives on the type wrapper classes */
+
+%module java_typemaps_typewrapper
+
+
+%typemap(javaimports) SWIGTYPE * "import java.math.*;";
+%typemap(javacode) Farewell * %{
+ public static $javaclassname CreateNullPointer() {
+ return new $javaclassname();
+ }
+ public void saybye(BigDecimal num_times) {
+ // BigDecimal requires the java.math library
+ }
+%}
+%typemap(javaclassmodifiers) Farewell * "public final";
+
+%typemap(javaimports) Greeting * %{
+import java.util.*; // for EventListener
+import java.lang.*; // for Exception
+%};
+
+%typemap(javabase) Greeting * "Exception";
+%typemap(javainterfaces) Greeting * "EventListener";
+%typemap(javacode) Greeting * %{
+ // Pure Java code generated using %typemap(javacode)
+ public static $javaclassname CreateNullPointer() {
+ return new $javaclassname();
+ }
+
+ public void sayhello() {
+ $javaclassname.cheerio(new $javaclassname());
+ }
+
+ public static void cheerio(EventListener e) {
+ }
+%}
+
+// Create a new getCPtr() function which takes Java null
+%typemap(javagetcptr) Farewell * %{
+ public static long getCPtr($javaclassname obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+%}
+
+// Make the pointer constructor public
+%typemap(javaptrconstructormodifiers) Farewell * "public";
+
+
+%{
+class Greeting {};
+class Farewell {};
+%}
+
+%inline %{
+ Greeting* solong(Farewell* f) { return NULL; }
+%}
+
diff --git a/Examples/test-suite/kind.i b/Examples/test-suite/kind.i
new file mode 100644
index 000000000..faaf4c369
--- /dev/null
+++ b/Examples/test-suite/kind.i
@@ -0,0 +1,34 @@
+/*
+ * This interface file tests whether the language modules handle the kind when declared
+ * with the function/member name, especially when used with shadow classes.
+*/
+
+%module kind
+
+%warnfilter(801) foo; /* Ruby, wrong class name */
+%warnfilter(801) bar; /* Ruby, wrong class name */
+%warnfilter(801) uni; /* Ruby, wrong class name */
+%warnfilter(801) test; /* Ruby, wrong class name */
+
+%inline %{
+
+class foo {};
+struct bar {};
+union uni {};
+
+struct test {
+ void foofn(class foo myfoo1, foo myfoo2, class foo* myfoo3, foo* myfoo4, class foo& myfoo5, foo& myfoo6) {}
+ void barfn(struct bar mybar1, bar mybar2, struct bar* mybar3, bar* mybar4, struct bar& mybar5, bar& mybar6) {}
+ void unifn(union uni myuni1, uni myuni2, union uni* myuni3, uni* myuni4, union myuni& myuni5, myuni& myuni6) {}
+
+ class foo myFooMember;
+ struct bar myBarMember;
+ union uni myUniMember;
+
+ class foo* mypFooMember;
+ struct bar* mypBarMember;
+ union uni* mypUniMember;
+};
+
+%}
+
diff --git a/Examples/test-suite/lib_carrays.i b/Examples/test-suite/lib_carrays.i
new file mode 100644
index 000000000..ef2f9abed
--- /dev/null
+++ b/Examples/test-suite/lib_carrays.i
@@ -0,0 +1,9 @@
+%module lib_carrays
+
+%warnfilter(801) doubleArray; /* Ruby, wrong class name */
+
+%include "carrays.i"
+
+%array_functions(int,intArray);
+%array_class(double, doubleArray);
+
diff --git a/Examples/test-suite/lib_cdata.i b/Examples/test-suite/lib_cdata.i
new file mode 100644
index 000000000..8a26d94b3
--- /dev/null
+++ b/Examples/test-suite/lib_cdata.i
@@ -0,0 +1,8 @@
+%module lib_cdata
+
+%include "cdata.i"
+
+%cdata(int);
+%cdata(double);
+
+
diff --git a/Examples/test-suite/lib_cmalloc.i b/Examples/test-suite/lib_cmalloc.i
new file mode 100644
index 000000000..f37cf6373
--- /dev/null
+++ b/Examples/test-suite/lib_cmalloc.i
@@ -0,0 +1,12 @@
+%module lib_cmalloc
+
+%warnfilter(801) sizeof_int; /* Ruby, wrong constant name */
+%warnfilter(801) sizeof_double; /* Ruby, wrong constant name */
+%warnfilter(801) sizeof_intp; /* Ruby, wrong constant name */
+
+%include "cmalloc.i"
+
+%allocators(int);
+%allocators(double);
+%allocators(void);
+%allocators(int *, intp);
diff --git a/Examples/test-suite/lib_constraints.i b/Examples/test-suite/lib_constraints.i
new file mode 100644
index 000000000..4cef26700
--- /dev/null
+++ b/Examples/test-suite/lib_constraints.i
@@ -0,0 +1,32 @@
+%module lib_constraints
+%include constraints.i
+
+%inline %{
+void test_nonnegative(double NONNEGATIVE) {
+}
+
+void test_nonpositive(double NONPOSITIVE) {
+}
+
+void test_positive(double POSITIVE) {
+}
+
+void test_negative(double POSITIVE) {
+}
+
+void test_nonzero(double NONZERO) {
+}
+
+void test_nonnull(void *NONNULL) {
+}
+
+void test_align8(void *ALIGN8) {
+}
+
+void test_align4(void *ALIGN4) {
+}
+
+void test_align2(void *ALIGN2) {
+}
+%}
+
diff --git a/Examples/test-suite/lib_cpointer.i b/Examples/test-suite/lib_cpointer.i
new file mode 100644
index 000000000..e1e6f48f9
--- /dev/null
+++ b/Examples/test-suite/lib_cpointer.i
@@ -0,0 +1,10 @@
+%module lib_cpointer
+
+%warnfilter(801) doublep; /* Ruby, wrong class name */
+
+%include "cpointer.i"
+
+%pointer_functions(int,intp);
+%pointer_class(double,doublep);
+%pointer_cast(int, unsigned int, int_to_uint);
+
diff --git a/Examples/test-suite/lib_cstring.i b/Examples/test-suite/lib_cstring.i
new file mode 100644
index 000000000..4ddbe2920
--- /dev/null
+++ b/Examples/test-suite/lib_cstring.i
@@ -0,0 +1,88 @@
+%module lib_cstring
+
+%include "cstring.i"
+
+#ifndef _CSTRING_UNIMPL
+
+%cstring_input_binary(char *in, int n);
+%cstring_bounded_output(char *out1, 512);
+%cstring_chunk_output(char *out2, 128);
+%cstring_bounded_mutable(char *out3, 512);
+%cstring_mutable(char *out4, 32);
+%cstring_output_maxsize(char *out5, int max);
+%cstring_output_withsize(char *out6, int *size);
+%cstring_output_allocate(char **out7, delete [] $1);
+%cstring_output_allocate_size(char **out8, int *size, delete [] $1);
+
+%inline %{
+
+int count(char *in, int n, char c) {
+ int r = 0;
+ while (n > 0) {
+ if (*in == c) {
+ r++;
+ }
+ in++;
+ }
+ return r;
+}
+
+void test1(char *out1) {
+ strcpy(out1,"Hello World");
+}
+
+void test2(char *out2) {
+ int i;
+ for (i = 0; i < 128; i++) {
+ *out2 = (char) i;
+ out2++;
+ }
+}
+
+void test3(char *out3) {
+ strcat(out3,"-suffix");
+}
+
+void test4(char *out4) {
+ strcat(out4,"-suffix");
+}
+
+void test5(char *out5, int max) {
+ int i;
+ for (i = strlen(out5); i < max; i++) {
+ out5[i] = 'x';
+ }
+}
+
+void test6(char *out6, int *size) {
+ int i;
+ for (i = 0; i < (*size/2); i++) {
+ out6[i] = 'x';
+ }
+ *size = (*size/2);
+}
+
+void test7(char **out7) {
+ *out7 = new char[64];
+ strcat(*out7,"Hello world!");
+}
+
+void test8(char **out8, int *sz) {
+ int i;
+ *out8 = new char[128];
+ for (i = 0; i < 128; i++) {
+ *out8[i] = (char) i;
+ }
+}
+
+%}
+
+#endif
+
+
+
+
+
+
+
+
diff --git a/Examples/test-suite/lib_math.i b/Examples/test-suite/lib_math.i
new file mode 100644
index 000000000..8e5cd0db6
--- /dev/null
+++ b/Examples/test-suite/lib_math.i
@@ -0,0 +1,2 @@
+%module lib_math
+%include math.i
diff --git a/Examples/test-suite/lib_std_deque.i b/Examples/test-suite/lib_std_deque.i
new file mode 100644
index 000000000..c0cfee020
--- /dev/null
+++ b/Examples/test-suite/lib_std_deque.i
@@ -0,0 +1,47 @@
+%module lib_std_deque
+
+%include "std_deque.i"
+
+%{
+#include <algorithm>
+#include <functional>
+#include <numeric>
+%}
+
+namespace std {
+ %template(IntDeque) deque<int>;
+}
+
+%template(DoubleDeque) std::deque<double>;
+
+%inline %{
+typedef float Real;
+%}
+
+namespace std {
+ %template(RealDeque) deque<Real>;
+}
+
+%inline %{
+
+double average(std::deque<int> v) {
+ return std::accumulate(v.begin(),v.end(),0.0)/v.size();
+}
+
+std::deque<float> half(const std::deque<float>& v) {
+ std::deque<float> w(v);
+ for (unsigned int i=0; i<w.size(); i++)
+ w[i] /= 2.0;
+ return w;
+}
+
+void halve_in_place(std::deque<double>& v) {
+ std::transform(v.begin(),v.end(),v.begin(),
+ std::bind2nd(std::divides<double>(),2.0));
+}
+
+%}
+
+
+
+
diff --git a/Examples/test-suite/lib_std_string.i b/Examples/test-suite/lib_std_string.i
new file mode 100644
index 000000000..bcbf3ba75
--- /dev/null
+++ b/Examples/test-suite/lib_std_string.i
@@ -0,0 +1,20 @@
+%module lib_std_string
+%include "std_string.i"
+
+%inline %{
+
+std::string test_value(std::string x) {
+ return x;
+}
+
+std::string *test_pointer(std::string *x) {
+ return x;
+}
+
+std::string test_reference(std::string &x) {
+ return x;
+}
+
+%}
+
+
diff --git a/Examples/test-suite/lib_std_vector.i b/Examples/test-suite/lib_std_vector.i
new file mode 100644
index 000000000..faff99b1f
--- /dev/null
+++ b/Examples/test-suite/lib_std_vector.i
@@ -0,0 +1,47 @@
+%module lib_std_vector
+
+%include "std_vector.i"
+
+%{
+#include <algorithm>
+#include <functional>
+#include <numeric>
+%}
+
+namespace std {
+ %template(IntVector) vector<int>;
+}
+
+%template(DoubleVector) std::vector<double>;
+
+%inline %{
+typedef float Real;
+%}
+
+namespace std {
+ %template(RealVector) vector<Real>;
+}
+
+%inline %{
+
+double average(std::vector<int> v) {
+ return std::accumulate(v.begin(),v.end(),0.0)/v.size();
+}
+
+std::vector<float> half(const std::vector<float>& v) {
+ std::vector<float> w(v);
+ for (unsigned int i=0; i<w.size(); i++)
+ w[i] /= 2.0;
+ return w;
+}
+
+void halve_in_place(std::vector<double>& v) {
+ std::transform(v.begin(),v.end(),v.begin(),
+ std::bind2nd(std::divides<double>(),2.0));
+}
+
+%}
+
+
+
+
diff --git a/Examples/test-suite/lib_typemaps.i b/Examples/test-suite/lib_typemaps.i
new file mode 100644
index 000000000..da4e48e28
--- /dev/null
+++ b/Examples/test-suite/lib_typemaps.i
@@ -0,0 +1,95 @@
+%module lib_typemaps
+
+%include "typemaps.i"
+
+%inline %{
+
+bool in_bool(bool *INPUT) { return *INPUT; }
+int in_int(int *INPUT) { return *INPUT; }
+long in_long(long *INPUT) { return *INPUT; }
+short in_short(short *INPUT) { return *INPUT; }
+unsigned int in_uint(unsigned int *INPUT) { return *INPUT; }
+unsigned short in_ushort(unsigned short *INPUT) { return *INPUT; }
+unsigned long in_ulong(unsigned long *INPUT) { return *INPUT; }
+unsigned char in_uchar(unsigned char *INPUT) { return *INPUT; }
+signed char in_schar(signed char *INPUT) { return *INPUT; }
+float in_float(float *INPUT) { return *INPUT; }
+double in_double(double *INPUT) { return *INPUT; }
+long long in_longlong(long long *INPUT) { return *INPUT; }
+unsigned long long in_ulonglong(unsigned long long *INPUT) { return *INPUT; }
+
+bool inr_bool(bool &INPUT) { return INPUT; }
+int inr_int(int &INPUT) { return INPUT; }
+long inr_long(long &INPUT) { return INPUT; }
+short inr_short(short &INPUT) { return INPUT; }
+unsigned int inr_uint(unsigned int &INPUT) { return INPUT; }
+unsigned short inr_ushort(unsigned short &INPUT) { return INPUT; }
+unsigned long inr_ulong(unsigned long &INPUT) { return INPUT; }
+unsigned char inr_uchar(unsigned char &INPUT) { return INPUT; }
+signed char inr_schar(signed char &INPUT) { return INPUT; }
+float inr_float(float &INPUT) { return INPUT; }
+double inr_double(double &INPUT) { return INPUT; }
+long long inr_longlong(long long &INPUT) { return INPUT; }
+unsigned long long inr_ulonglong(unsigned long long &INPUT) { return INPUT; }
+
+void out_bool(bool x, bool *OUTPUT) { *OUTPUT = x; }
+void out_int(int x, int *OUTPUT) { *OUTPUT = x; }
+void out_short(short x, short *OUTPUT) { *OUTPUT = x; }
+void out_long(long x, long *OUTPUT) { *OUTPUT = x; }
+void out_uint(unsigned int x, unsigned int *OUTPUT) { *OUTPUT = x; }
+void out_ushort(unsigned short x, unsigned short *OUTPUT) { *OUTPUT = x; }
+void out_ulong(unsigned long x, unsigned long *OUTPUT) { *OUTPUT = x; }
+void out_uchar(unsigned char x, unsigned char *OUTPUT) { *OUTPUT = x; }
+void out_schar(signed char x, signed char *OUTPUT) { *OUTPUT = x; }
+void out_float(float x, float *OUTPUT) { *OUTPUT = x; }
+void out_double(double x, double *OUTPUT) { *OUTPUT = x; }
+void out_longlong(long long x, long long *OUTPUT) { *OUTPUT = x; }
+void out_ulonglong(unsigned long long x, unsigned long long *OUTPUT) { *OUTPUT = x; }
+
+void outr_bool(bool x, bool &OUTPUT) { OUTPUT = x; }
+void outr_int(int x, int &OUTPUT) { OUTPUT = x; }
+void outr_short(short x, short &OUTPUT) { OUTPUT = x; }
+void outr_long(long x, long &OUTPUT) { OUTPUT = x; }
+void outr_uint(unsigned int x, unsigned int &OUTPUT) { OUTPUT = x; }
+void outr_ushort(unsigned short x, unsigned short &OUTPUT) { OUTPUT = x; }
+void outr_ulong(unsigned long x, unsigned long &OUTPUT) { OUTPUT = x; }
+void outr_uchar(unsigned char x, unsigned char &OUTPUT) { OUTPUT = x; }
+void outr_schar(signed char x, signed char &OUTPUT) { OUTPUT = x; }
+void outr_float(float x, float &OUTPUT) { OUTPUT = x; }
+void outr_double(double x, double &OUTPUT) { OUTPUT = x; }
+void outr_longlong(long long x, long long &OUTPUT) { OUTPUT = x; }
+void outr_ulonglong(unsigned long long x, unsigned long long &OUTPUT) { OUTPUT = x; }
+
+void inout_bool(bool *INOUT) { *INOUT = *INOUT; }
+void inout_int(int *INOUT) { *INOUT = *INOUT; }
+void inout_short(short *INOUT) { *INOUT = *INOUT; }
+void inout_long(long *INOUT) { *INOUT = *INOUT; }
+void inout_uint(unsigned int *INOUT) { *INOUT = *INOUT; }
+void inout_ushort(unsigned short *INOUT) { *INOUT = *INOUT; }
+void inout_ulong(unsigned long *INOUT) { *INOUT = *INOUT; }
+void inout_uchar(unsigned char *INOUT) { *INOUT = *INOUT; }
+void inout_schar(signed char *INOUT) { *INOUT = *INOUT; }
+void inout_float(float *INOUT) { *INOUT = *INOUT; }
+void inout_double(double *INOUT) { *INOUT = *INOUT; }
+void inout_longlong(long long *INOUT) { *INOUT = *INOUT; }
+void inout_ulonglong(unsigned long long *INOUT) { *INOUT = *INOUT; }
+
+void inoutr_bool(bool &INOUT) { INOUT = INOUT; }
+void inoutr_int(int &INOUT) { INOUT = INOUT; }
+void inoutr_short(short &INOUT) { INOUT = INOUT; }
+void inoutr_long(long &INOUT) { INOUT = INOUT; }
+void inoutr_uint(unsigned int &INOUT) { INOUT = INOUT; }
+void inoutr_ushort(unsigned short &INOUT) { INOUT = INOUT; }
+void inoutr_ulong(unsigned long &INOUT) { INOUT = INOUT; }
+void inoutr_uchar(unsigned char &INOUT) { INOUT = INOUT; }
+void inoutr_schar(signed char &INOUT) { INOUT = INOUT; }
+void inoutr_float(float &INOUT) { INOUT = INOUT; }
+void inoutr_double(double &INOUT) { INOUT = INOUT; }
+void inoutr_longlong(long long &INOUT) { INOUT = INOUT; }
+void inoutr_ulonglong(unsigned long long &INOUT) { INOUT = INOUT; }
+
+%}
+
+
+
+
diff --git a/Examples/test-suite/list_vector.i b/Examples/test-suite/list_vector.i
new file mode 100644
index 000000000..5cc30e982
--- /dev/null
+++ b/Examples/test-suite/list_vector.i
@@ -0,0 +1,153 @@
+/* -*- c -*- */
+
+%module test
+
+%include "list-vector.i"
+
+%multiple_values
+
+/* The ordinary, well behaved multi-typemap. */
+double sum_list(int LISTLENINPUT, double *LISTINPUT);
+double sum_vector(int VECTORLENINPUT, double *VECTORINPUT);
+void one_to_seven_list(int *LISTLENOUTPUT, int **LISTOUTPUT);
+void one_to_seven_vector(int *VECTORLENOUTPUT, int **VECTOROUTPUT);
+
+/* Variants with `size_t' instead of `int' length. */
+double sum_list2(size_t LISTLENINPUT, double *LISTINPUT);
+double sum_vector2(size_t VECTORLENINPUT, double *VECTORINPUT);
+void one_to_seven_list2(size_t *LISTLENOUTPUT, int **LISTOUTPUT);
+void one_to_seven_vector2(size_t *VECTORLENOUTPUT, int **VECTOROUTPUT);
+
+/* Parallel variants */
+
+double sum_lists(int PARALLEL_LISTLENINPUT,
+ double *PARALLEL_LISTINPUT,
+ int *PARALLEL_LISTINPUT,
+ int *PARALLEL_LISTINPUT);
+double sum_lists2(size_t PARALLEL_LISTLENINPUT,
+ double *PARALLEL_LISTINPUT,
+ int *PARALLEL_LISTINPUT,
+ int *PARALLEL_LISTINPUT);
+void produce_lists(int *PARALLEL_VECTORLENOUTPUT,
+ int **PARALLEL_VECTOROUTPUT,
+ int **PARALLEL_VECTOROUTPUT,
+ double **PARALLEL_VECTOROUTPUT);
+
+%{
+ double sum_list(int length, double *item)
+ {
+ int i;
+ double res = 0.0;
+ for (i = 0; i<length; i++)
+ res += item[i];
+ return res;
+ }
+
+ double sum_list2(size_t length, double *item)
+ {
+ size_t i;
+ double res = 0.0;
+ for (i = 0; i<length; i++)
+ res += item[i];
+ return res;
+ }
+
+
+ double sum_vector(int length, double *item)
+ {
+ int i;
+ double res = 0.0;
+ for (i = 0; i<length; i++)
+ res += item[i];
+ return res;
+ }
+
+ double sum_vector2(size_t length, double *item)
+ {
+ size_t i;
+ double res = 0.0;
+ for (i = 0; i<length; i++)
+ res += item[i];
+ return res;
+ }
+
+
+ void one_to_seven_list(int *length_p, int **list_p)
+ {
+ int i;
+ *length_p = 7;
+ *list_p = malloc(7 * sizeof(int));
+ for (i = 0; i<7; i++)
+ (*list_p)[i] = i+1;
+ }
+
+ void one_to_seven_list2(size_t *length_p, int **list_p)
+ {
+ size_t i;
+ *length_p = 7;
+ *list_p = malloc(7 * sizeof(int));
+ for (i = 0; i<7; i++)
+ (*list_p)[i] = i+1;
+ }
+
+ void one_to_seven_vector(int *length_p, int **list_p)
+ {
+ int i;
+ *length_p = 7;
+ *list_p = malloc(7 * sizeof(int));
+ for (i = 0; i<7; i++)
+ (*list_p)[i] = i+1;
+ }
+
+ void one_to_seven_vector2(size_t *length_p, int **list_p)
+ {
+ size_t i;
+ *length_p = 7;
+ *list_p = malloc(7 * sizeof(int));
+ for (i = 0; i<7; i++)
+ (*list_p)[i] = i+1;
+ }
+
+double sum_lists(int len,
+ double *list1,
+ int *list2,
+ int *list3)
+{
+ int i;
+ double sum;
+ for (i = 0; i<len; i++)
+ sum += (list1[i] + list2[i] + list3[i]);
+ return sum;
+}
+
+double sum_lists2(size_t len,
+ double *list1,
+ int *list2,
+ int *list3)
+{
+ size_t i;
+ double sum;
+ for (i = 0; i<len; i++)
+ sum += (list1[i] + list2[i] + list3[i]);
+ return sum;
+}
+
+void produce_lists(int *len_p,
+ int **list1_p,
+ int **list2_p,
+ double **list3_p)
+{
+ int i;
+ *len_p = 5;
+ *list1_p = malloc(sizeof(int) * 5);
+ *list2_p = malloc(sizeof(int) * 5);
+ *list3_p = malloc(sizeof(double) * 5);
+ for (i = 0; i<5; i++) {
+ (*list1_p)[i] = i;
+ (*list2_p)[i] = i*i;
+ (*list3_p)[i] = 1.5*i;
+ }
+}
+
+
+%}
diff --git a/Examples/test-suite/long_long.i b/Examples/test-suite/long_long.i
new file mode 100644
index 000000000..edda88870
--- /dev/null
+++ b/Examples/test-suite/long_long.i
@@ -0,0 +1,40 @@
+/* This interface file tests whether SWIG handles the new ISO C
+ long long types.
+*/
+
+%module long_long
+
+%warnfilter(801) lconst1; /* Ruby, wrong constant name */
+%warnfilter(801) lconst2; /* Ruby, wrong constant name */
+%warnfilter(801) lconst3; /* Ruby, wrong constant name */
+%warnfilter(801) lconst4; /* Ruby, wrong constant name */
+%warnfilter(801) lconst5; /* Ruby, wrong constant name */
+%warnfilter(801) lconst6; /* Ruby, wrong constant name */
+
+%inline %{
+void foo1(long long x) {}
+void foo2(long long int x) {}
+void foo3(signed long long int x) {}
+void foo4(unsigned long long int x) {}
+void foo5(signed long long x) {}
+void foo6(unsigned long long x) {}
+
+long long bar1() {return 0;}
+long long int bar2() {return 0;}
+signed long long int bar3() {return 0;}
+unsigned long long int bar4() {return 0;}
+signed long long bar5() {return 0;}
+unsigned long long bar6() {return 0;}
+
+long long ll;
+unsigned long long ull;
+%}
+
+%constant long long lconst1 = 1234567890LL;
+%constant unsigned long long lconst2 = 1234567890ULL;
+
+%constant lconst3 = 1234567LL;
+%constant lconst4 = 1234567ULL;
+
+#define lconst5 987654321LL
+#define lconst6 987654321ULL
diff --git a/Examples/test-suite/macro_2.i b/Examples/test-suite/macro_2.i
new file mode 100644
index 000000000..1862bc75a
--- /dev/null
+++ b/Examples/test-suite/macro_2.i
@@ -0,0 +1,22 @@
+/* This interface file tests whether SWIG's extended C
+ preprocessor is working right.
+
+ In this example, SWIG 1.3a5 reports missing macro arguments, which
+ is bogus.
+*/
+
+%define FOO(C_TYPE, GETLENGTH)
+ /* nothing */
+%enddef
+
+%define BAR(XYZZY)
+ FOO(XYZZY, 1)
+%enddef
+
+BAR(int)
+
+%module macro_2
+
+%inline %{
+ int dummy_var;
+%}
diff --git a/Examples/test-suite/member_template.i b/Examples/test-suite/member_template.i
new file mode 100644
index 000000000..aafbd98f3
--- /dev/null
+++ b/Examples/test-suite/member_template.i
@@ -0,0 +1,20 @@
+%module member_template
+
+%inline %{
+template<class T> T max(T x, T y, T z) { return (x > y) ? x : y; }
+
+template<class T> class Foo {
+ public:
+ template<class S> S max(S x, S y) { return (x > y) ? x : y; }
+};
+
+%}
+
+%extend Foo {
+ %template(maxi) max<int>;
+ %template(maxd) max<double>;
+};
+
+%template(Fooint) Foo<int>;
+%template(Foodouble) Foo<double>;
+
diff --git a/Examples/test-suite/memberin1.i b/Examples/test-suite/memberin1.i
new file mode 100644
index 000000000..920323044
--- /dev/null
+++ b/Examples/test-suite/memberin1.i
@@ -0,0 +1,63 @@
+%module memberin1
+
+%{
+class String {
+private:
+ char *str;
+public:
+ // Constructor
+ String(const char *s = 0) : str(0) {
+ if (s != 0) {
+ str = new char[strlen(s) + 1];
+ strcpy(str, s);
+ }
+ }
+
+ // Copy constructor
+ String(const String& other) {
+ delete [] str;
+ str = 0;
+ if (other.str != 0) {
+ str = new char[strlen(other.str) + 1];
+ strcpy(str, other.str);
+ }
+ }
+
+ // Assignment operator
+ String& operator=(const String& other) {
+ if (&other != this) {
+ delete [] str;
+ str = 0;
+ if (other.str != 0) {
+ str = new char[strlen(other.str) + 1];
+ strcpy(str, other.str);
+ }
+ }
+ return *this;
+ }
+
+ // String contents
+ const char *c_str() const { return str; }
+
+ // Destructor
+ ~String() { delete [] str; }
+};
+%}
+
+#ifdef SWIGRUBY
+%typemap(in) String {
+ Check_Type($input, T_STRING);
+ $1 = String(STR2CSTR($input));
+}
+#endif
+
+%typemap(memberin) String {
+ $1 = $input;
+}
+
+%inline %{
+struct Person {
+ String name;
+};
+%}
+
diff --git a/Examples/test-suite/minherit.i b/Examples/test-suite/minherit.i
new file mode 100644
index 000000000..0300f7199
--- /dev/null
+++ b/Examples/test-suite/minherit.i
@@ -0,0 +1,80 @@
+// This module tests multiple inheritance, typedef handling, and some
+// truly horrible parts of the SWIG type system. This is only tested
+// for Python since not all language modules support multiple-inheritance.
+// However, if it works for Python, things should be working for other
+// modules.
+
+%module minherit
+
+#ifdef SWIGPYTHON
+
+%inline %{
+
+class Foo {
+private:
+ int x;
+public:
+ Foo() { x = 1; }
+ virtual int xget() { return x; };
+};
+typedef Foo *FooPtr;
+
+FooPtr toFooPtr(Foo *f) { return f; }
+
+class Bar {
+private:
+ int y;
+public:
+ Bar() { y = 2; }
+ virtual int yget() { return y; }
+};
+
+typedef Bar *BarPtr;
+BarPtr toBarPtr(Bar *f) { return f; }
+
+class FooBar : public Foo, public Bar {
+private:
+ int z;
+public:
+ FooBar() { z = 3; }
+ virtual int zget() { return z; }
+};
+
+typedef FooBar *FooBarPtr;
+FooBarPtr toFooBarPtr(FooBar *f) { return f; }
+
+class Spam: public FooBar {
+private:
+ int w;
+public:
+ Spam() { w = 4; }
+ virtual int wget() { return w; }
+};
+
+typedef Spam *SpamPtr;
+SpamPtr toSpamPtr(Spam *f) { return f; }
+
+int xget(FooPtr f) {
+ return f->xget();
+}
+
+int yget(BarPtr f) {
+ return f->yget();
+}
+
+int zget(FooBarPtr f) {
+ return f->zget();
+}
+
+int wget(SpamPtr f) {
+ return f->wget();
+}
+%}
+
+#endif
+
+
+
+
+
+
diff --git a/Examples/test-suite/multivalue.i b/Examples/test-suite/multivalue.i
new file mode 100644
index 000000000..6cb3c3d7d
--- /dev/null
+++ b/Examples/test-suite/multivalue.i
@@ -0,0 +1,52 @@
+/* -*- c -*- */
+
+%module test
+
+#ifdef SWIGGUILE
+
+/* Multiple values as lists. By default, if more than one value is to
+be returned, a list of the values is created and returned; to switch
+back to this behavior, use: */
+%values_as_list;
+
+void divide_l(int a, int b, int *OUTPUT, int *OUTPUT);
+
+/* Multiple values as vectors. By issueing: */
+%values_as_vector;
+/* vectors instead of lists will be used. */
+
+void divide_v(int a, int b, int *OUTPUT, int *OUTPUT);
+
+/* Multiple values for multiple-value continuations.
+ (This is the most elegant way.) By issueing: */
+%multiple_values;
+/* multiple values are passed to the multiple-value
+ continuation, as created by `call-with-values' or the
+ convenience macro `receive'. (See the Scheme file.) */
+
+void divide_mv(int a, int b, int *OUTPUT, int *OUTPUT);
+
+#endif
+
+%{
+
+void divide_l(int a, int b, int *quotient_p, int *remainder_p)
+{
+ *quotient_p = a/b;
+ *remainder_p = a%b;
+}
+
+void divide_v(int a, int b, int *quotient_p, int *remainder_p)
+{
+ *quotient_p = a/b;
+ *remainder_p = a%b;
+}
+
+void divide_mv(int a, int b, int *quotient_p, int *remainder_p)
+{
+ *quotient_p = a/b;
+ *remainder_p = a%b;
+}
+
+%}
+
diff --git a/Examples/test-suite/mzscheme/.cvsignore b/Examples/test-suite/mzscheme/.cvsignore
new file mode 100644
index 000000000..597965c42
--- /dev/null
+++ b/Examples/test-suite/mzscheme/.cvsignore
@@ -0,0 +1 @@
+*wrap.c*
diff --git a/Examples/test-suite/mzscheme/Makefile b/Examples/test-suite/mzscheme/Makefile
new file mode 100644
index 000000000..ead394b57
--- /dev/null
+++ b/Examples/test-suite/mzscheme/Makefile
@@ -0,0 +1,40 @@
+#######################################################################
+# $Header$
+# Makefile for mzscheme test-suite
+#######################################################################
+
+LANGUAGE = mzscheme
+SCRIPTSUFFIX = _runme.scm
+
+include ../common.mk
+
+# Overridden variables here
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup) \
+ ($(swig_and_compile_cpp); ); \
+ $(run_testcase)
+
+%.ctest:
+ $(setup) \
+ ($(swig_and_compile_c); ); \
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup) \
+ ($(swig_and_compile_multi_cpp); ); \
+ $(run_testcase)
+
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.scm appended after the testcase name.
+run_testcase = \
+ if [ -f $*\_runme.scm ]; then ( \
+ env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH mzscheme -r $*\_runme.scm;) \
+ fi;
+
+# Clean
+%.clean:
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile mzscheme_clean
diff --git a/Examples/test-suite/mzscheme/README b/Examples/test-suite/mzscheme/README
new file mode 100644
index 000000000..37432ea4b
--- /dev/null
+++ b/Examples/test-suite/mzscheme/README
@@ -0,0 +1,4 @@
+See ../README for common README file.
+
+Any testcases which have _runme.scm appended after the testcase name will be detected and run.
+
diff --git a/Examples/test-suite/mzscheme/casts_runme.scm b/Examples/test-suite/mzscheme/casts_runme.scm
new file mode 100644
index 000000000..3aaa62dc6
--- /dev/null
+++ b/Examples/test-suite/mzscheme/casts_runme.scm
@@ -0,0 +1,7 @@
+(load-extension "casts.so")
+
+(define x (new-B))
+
+(A-hello x)
+
+(exit 0)
diff --git a/Examples/test-suite/mzscheme/char_constant_runme.scm b/Examples/test-suite/mzscheme/char_constant_runme.scm
new file mode 100644
index 000000000..4e3ed47ca
--- /dev/null
+++ b/Examples/test-suite/mzscheme/char_constant_runme.scm
@@ -0,0 +1,6 @@
+(load-extension "char_constant.so")
+
+(if (and (char? (CHAR-CONSTANT))
+ (string? (STRING-CONSTANT)))
+ (exit 0)
+ (exit 1))
diff --git a/Examples/test-suite/mzscheme/import_runme.scm b/Examples/test-suite/mzscheme/import_runme.scm
new file mode 100644
index 000000000..8e8f27339
--- /dev/null
+++ b/Examples/test-suite/mzscheme/import_runme.scm
@@ -0,0 +1,16 @@
+;;; This file is part of a test for SF bug #231619.
+;;; It shows that the %import directive does not work properly in SWIG
+;;; 1.3a5: Type information is not properly generated if a base class
+;;; comes from an %import-ed file.
+
+(load-extension "libimports_a.so")
+(load-extension "libimports_b.so")
+
+(define x (new-B))
+
+;; This fails in 1.3a5 because the SWIG runtime code does not know
+;; that x (an instance of class B) can be passed to methods of class A.
+
+(A-hello x)
+
+(exit 0)
diff --git a/Examples/test-suite/mzscheme/name_runme.scm b/Examples/test-suite/mzscheme/name_runme.scm
new file mode 100644
index 000000000..1782c6481
--- /dev/null
+++ b/Examples/test-suite/mzscheme/name_runme.scm
@@ -0,0 +1,10 @@
+;; The SWIG modules have "passive" Linkage, i.e., they don't generate
+;; Guile modules (namespaces) but simply put all the bindings into the
+;; current module. That's enough for such a simple test.
+(load-extension "./name.so")
+
+(foo-2)
+bar-2
+Baz-2
+
+(exit 0)
diff --git a/Examples/test-suite/mzscheme/unions_runme.scm b/Examples/test-suite/mzscheme/unions_runme.scm
new file mode 100644
index 000000000..c44847cfc
--- /dev/null
+++ b/Examples/test-suite/mzscheme/unions_runme.scm
@@ -0,0 +1,38 @@
+;;; This is the union runtime testcase. It ensures that values within a
+;;; union embedded within a struct can be set and read correctly.
+
+(load-extension "unions.so")
+
+;; Create new instances of SmallStruct and BigStruct for later use
+(define small (new-SmallStruct))
+(SmallStruct-jill-set small 200)
+
+(define big (new-BigStruct))
+(BigStruct-smallstruct-set big small)
+(BigStruct-jack-set big 300)
+
+;; Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
+;; Ensure values in EmbeddedUnionTest are set correctly for each.
+(define eut (new-EmbeddedUnionTest))
+
+;; First check the SmallStruct in EmbeddedUnionTest
+(EmbeddedUnionTest-number-set eut 1)
+(EmbeddedUnionTest-uni-small-set (EmbeddedUnionTest-uni-get eut)
+ small)
+(let ((Jill1 (SmallStruct-jill-get
+ (EmbeddedUnionTest-uni-small-get
+ (EmbeddedUnionTest-uni-get eut)))))
+ (if (not (= Jill1 200))
+ (begin
+ (display "Runtime test 1 failed.")
+ (exit 1))))
+
+(let ((Num1 (EmbeddedUnionTest-number-get eut)))
+ (if (not (= Num1 1))
+ (begin
+ (display "Runtime test 2 failed.")
+ (exit 1))))
+
+;; that should do
+
+(exit 0)
diff --git a/Examples/test-suite/name.i b/Examples/test-suite/name.i
new file mode 100644
index 000000000..8af8cd68b
--- /dev/null
+++ b/Examples/test-suite/name.i
@@ -0,0 +1,26 @@
+/* This interface file tests whether SWIG/Guile handle the %rename and
+ %name directives, which was not the case in 1.3a5.
+*/
+
+%module name
+
+#ifdef SWIGGUILE
+%rename foo_1 "foo-2";
+#else
+%rename foo_1 "foo_2";
+#endif
+%inline %{
+void foo_1() {}
+%}
+
+#ifdef SWIGGUILE
+%name("bar-2")
+#else
+%name("bar_2")
+#endif
+%inline %{
+int bar_1 = 17;
+%}
+
+%name("Baz_2")
+%constant int Baz_1 = 47;
diff --git a/Examples/test-suite/name_cxx.i b/Examples/test-suite/name_cxx.i
new file mode 100644
index 000000000..3b6965487
--- /dev/null
+++ b/Examples/test-suite/name_cxx.i
@@ -0,0 +1,16 @@
+/* This interface files tests whether SWIG handles overloaded
+ renamed functions.
+*/
+
+%module name_cxx
+
+%name("bar_int")
+%inline %{
+void bar(int i) {}
+%}
+
+%name("bar_double")
+%inline %{
+void bar(double i) {}
+%}
+
diff --git a/Examples/test-suite/name_inherit.i b/Examples/test-suite/name_inherit.i
new file mode 100644
index 000000000..3ce40d145
--- /dev/null
+++ b/Examples/test-suite/name_inherit.i
@@ -0,0 +1,13 @@
+%module name_inherit
+%{
+class A {
+};
+
+class B : public A {
+};
+
+%}
+
+%name(AA) class A { };
+class B : public A { };
+
diff --git a/Examples/test-suite/namespace_enum.i b/Examples/test-suite/namespace_enum.i
new file mode 100644
index 000000000..82a97c630
--- /dev/null
+++ b/Examples/test-suite/namespace_enum.i
@@ -0,0 +1,24 @@
+%module namespace_enum
+
+%inline %{
+
+namespace Foo {
+ enum Swig {
+ LAGER,
+ STOUT,
+ ALE
+ };
+
+ class Bar {
+ public:
+ enum Speed {
+ SLOW,
+ FAST
+ };
+ };
+}
+
+%}
+
+
+ \ No newline at end of file
diff --git a/Examples/test-suite/namespace_extend.i b/Examples/test-suite/namespace_extend.i
new file mode 100644
index 000000000..52ec0fb57
--- /dev/null
+++ b/Examples/test-suite/namespace_extend.i
@@ -0,0 +1,34 @@
+%module namespace_extend
+
+%warnfilter(801) bar; /* Ruby, wrong class name */
+
+%{
+namespace foo {
+ class bar {
+ public:
+ };
+}
+foo::bar *new_foo_bar() {
+ return new foo::bar;
+}
+void delete_foo_bar(foo::bar *self) {
+ delete self;
+}
+int foo_bar_blah(foo::bar *self, int x) {
+ return x;
+}
+%}
+
+namespace foo {
+ class bar {
+ public:
+ %extend {
+ bar();
+ ~bar();
+ int blah(int x);
+ };
+ };
+}
+
+
+
diff --git a/Examples/test-suite/namespace_nested.i b/Examples/test-suite/namespace_nested.i
new file mode 100644
index 000000000..ec75c19a6
--- /dev/null
+++ b/Examples/test-suite/namespace_nested.i
@@ -0,0 +1,59 @@
+%module namespace_nested
+
+%warnfilter(801) hello::hi::hi0; /* Ruby, wrong class name */
+%warnfilter(801) oss::hi1<hello::Hi0 >; /* Ruby, wrong class name */
+
+%inline %{
+ namespace hello
+ {
+ namespace hi
+ {
+ struct hi0
+ {
+ };
+ }
+
+ template <class _T1>
+ struct Hi : _T1
+ {
+ };
+ }
+
+%}
+
+namespace hello
+{
+ %template(Hi_hi0) Hi<hi::hi0>;
+}
+
+
+%inline %{
+
+ namespace hello
+ {
+ //
+ // This works
+ //
+ // typedef Hi<hello::hi::hi0> Hi0;
+
+ //
+ // This doesn't work
+ //
+ typedef Hi<hi::hi0> Hi0;
+ };
+
+
+ namespace oss
+ {
+ template <class _T>
+ struct hi1 : _T
+ {
+ };
+ }
+
+%}
+
+namespace oss
+{
+ %template(hi1_hi0) hi1<hello::Hi0 >;
+}
diff --git a/Examples/test-suite/namespace_template.i b/Examples/test-suite/namespace_template.i
new file mode 100644
index 000000000..1a0cfb6b2
--- /dev/null
+++ b/Examples/test-suite/namespace_template.i
@@ -0,0 +1,78 @@
+/* Tests the use of %template with namespaces */
+
+%module namespace_template
+
+%warnfilter(801) vector<int>; /* Ruby, wrong class name */
+%warnfilter(801) test2::vector<short>; /* Ruby, wrong class name */
+%warnfilter(801) test3::vector<long>; /* Ruby, wrong class name */
+%warnfilter(801) vector<test4::Integer>; /* Ruby, wrong class name */
+
+%{
+namespace test {
+ template<typename T> T max(T a, T b) { return (a > b) ? a : b; }
+ template<typename T> class vector {
+ public:
+ vector() { }
+ ~vector() { }
+ char * blah(T x) {
+ return (char *) "vector::blah";
+ }
+ };
+}
+
+namespace test2 {
+ using namespace test;
+}
+
+namespace test3 {
+ using test::max;
+ using test::vector;
+}
+
+using namespace test2;
+namespace T4 = test;
+%}
+
+namespace test {
+ template<typename T> T max(T a, T b) { return (a > b) ? a : b; }
+ template<typename T> class vector {
+ public:
+ vector() { }
+ ~vector() { }
+ char * blah(T x) {
+ return (char *) "vector::blah";
+ }
+ };
+}
+
+using namespace test;
+%template(maxint) max<int>;
+%template(vectorint) vector<int>;
+
+namespace test2 {
+ using namespace test;
+ %template(maxshort) max<short>;
+ %template(vectorshort) vector<short>;
+}
+
+namespace test3 {
+ using test::max;
+ using test::vector;
+ %template(maxlong) max<long>;
+ %template(vectorlong) vector<long>;
+}
+
+%inline %{
+
+namespace test4 {
+ using namespace test;
+ typedef int Integer;
+}
+
+%}
+
+namespace test4 {
+ %template(maxInteger) max<Integer>;
+ %template(vectorInteger) vector<Integer>;
+}
+
diff --git a/Examples/test-suite/namespace_typemap.i b/Examples/test-suite/namespace_typemap.i
new file mode 100644
index 000000000..97af110c0
--- /dev/null
+++ b/Examples/test-suite/namespace_typemap.i
@@ -0,0 +1,229 @@
+// This tests SWIG's handling of typemaps and namespaces
+%module namespace_typemap
+
+%{
+namespace test {
+ /* A minimalistic string class */
+ class string {
+ char *data;
+ public:
+ string() {
+ data = 0;
+ }
+ string(const char *s) {
+ data = new char[strlen(s)+1];
+ strcpy(data,s);
+ }
+ ~string() {
+ if (data) delete [] data;
+ }
+ char *c_str() {
+ return data;
+ };
+ };
+
+ /* A minimalistic complex class */
+ class complex {
+ double re;
+ double im;
+ public:
+ complex(double r = 0, double i = 0) {
+ re = r;
+ im = i;
+ }
+ double real() {
+ return re;
+ }
+ double imag() {
+ return im;
+ }
+ };
+}
+ %}
+
+/* SWIG interface tests */
+
+#ifdef SWIGPYTHON
+%typemap(in) test::complex * {
+ if (PyComplex_Check($input)) {
+ $1 = new complex(PyComplex_RealAsDouble($input),
+ PyComplex_ImagAsDouble($input));
+ } else {
+ PyErr_SetString(PyExc_TypeError,"Expected complex.\n");
+ return NULL;
+ }
+}
+%typemap(freearg) test::complex * {
+ delete $1;
+}
+#endif
+
+namespace test {
+ class string;
+#ifdef SWIGPYTHON
+ %typemap(in) string * {
+ $1 = new string(PyString_AsString($input));
+ }
+ %typemap(freearg) string * {
+ delete $1;
+ }
+#endif
+#ifdef SWIGRUBY
+ %typemap(in) string * {
+ $1 = new string(STR2CSTR($input));
+ }
+ %typemap(freearg) string * {
+ delete $1;
+ }
+#endif
+}
+
+%inline %{
+ namespace test {
+ class string;
+ class complex;
+
+ /* Functions in the namespace itself */
+ char *stest1(string *s) {
+ return s->c_str();
+ }
+ double ctest1(complex *c) {
+ return c->real();
+ }
+ }
+
+ namespace test2 {
+ using test::string;
+ using test::complex;
+
+ /* Functions in another namespace */
+ char *stest2(string *s) {
+ return s->c_str();
+ }
+ double ctest2(complex *c) {
+ return c->real();
+ }
+ }
+
+ namespace test3 {
+ using namespace test;
+
+ char *stest3(string *s) {
+ return s->c_str();
+ }
+ double ctest3(complex *c) {
+ return c->real();
+ }
+ }
+
+ namespace test4 {
+ using namespace test2;
+
+ char *stest4(string *s) {
+ return s->c_str();
+ }
+ double ctest4(complex *c) {
+ return c->real();
+ }
+ }
+
+ namespace test5 {
+ using namespace test3;
+
+ char *stest5(string *s) {
+ return s->c_str();
+ }
+ double ctest5(complex *c) {
+ return c->real();
+ }
+ }
+
+ char *stest6(test::string *s) {
+ return s->c_str();
+ }
+ double ctest6(test::complex *c) {
+ return c->real();
+ }
+
+ char *stest7(test2::string *s) {
+ return s->c_str();
+ }
+ double ctest7(test2::complex *c) {
+ return c->real();
+ }
+
+ char *stest8(test3::string *s) {
+ return s->c_str();
+ }
+ double ctest8(test3::complex *c) {
+ return c->real();
+ }
+
+ char *stest9(test4::string *s) {
+ return s->c_str();
+ }
+ double ctest9(test4::complex *c) {
+ return c->real();
+ }
+
+ char *stest10(test5::string *s) {
+ return s->c_str();
+ }
+ double ctest10(test5::complex *c) {
+ return c->real();
+ }
+
+ namespace test11 = test;
+
+ char *stest11(test11::string *s) {
+ return s->c_str();
+ }
+ double ctest11(test11::complex *c) {
+ return c->real();
+ }
+
+ using namespace test2;
+ using test::complex;
+
+ char *stest12(string *s) {
+ return s->c_str();
+ }
+ double ctest12(complex *c) {
+ return c->real();
+ }
+%}
+
+namespace Split {
+#ifdef SWIGPYTHON
+ %typemap(in) PosInteger {
+ $1 = PyInt_AsLong($input);
+ if ($1 < 0) {
+ PyErr_SetString(PyExc_ValueError,"domain error\n");
+ return NULL;
+ }
+ }
+#endif
+#ifdef SWIGRUBY
+ %typemap(in) PosInteger {
+ $1 = NUM2INT($input);
+ if ($1 < 0) {
+ rb_raise(rb_eRangeError, "domain error");
+ }
+ }
+#endif
+};
+
+%inline %{
+ namespace Split {
+ typedef int PosInteger;
+ PosInteger ttest1(PosInteger x) {
+ return x;
+ };
+ }
+%}
+
+
+
+
+
+
diff --git a/Examples/test-suite/nested.i b/Examples/test-suite/nested.i
new file mode 100644
index 000000000..7771fe7be
--- /dev/null
+++ b/Examples/test-suite/nested.i
@@ -0,0 +1,34 @@
+/*
+This testcase tests that nested structs/unions work. Named structs/unions declared within
+a struct produced redefinition errors in SWIG 1.3.6 as reported by SF bug #447488.
+Also tests reported error when a #define placed in a deeply embedded struct/union.
+*/
+
+%module nested
+%pragma make_default
+
+%inline %{
+
+struct TestStruct {
+ int a;
+};
+
+typedef struct OuterStruct {
+ union {
+
+ struct outer_nested_struct {
+ union inner_nested_union {
+#define BAD_STYLE 1
+ int red;
+ struct TestStruct green;
+ } InnerNestedUnion;
+
+ struct inner_nested_struct {
+ int blue;
+ } InnerNestedStruct;
+ } OuterNestedStruct;
+
+ } EmbeddedUnion;
+} OuterStruct;
+
+%}
diff --git a/Examples/test-suite/newobject1.i b/Examples/test-suite/newobject1.i
new file mode 100644
index 000000000..b5b018b2f
--- /dev/null
+++ b/Examples/test-suite/newobject1.i
@@ -0,0 +1,51 @@
+/**
+ * The purpose of this test is to confirm that a language module
+ * correctly handles the case when C++ class member functions (of both
+ * the static and non-static persuasion) have been tagged with the
+ * %newobject directive.
+ */
+
+%module newobject1
+
+%newobject Foo::makeFoo();
+%newobject Foo::makeMore();
+
+%inline %{
+class Foo
+{
+private:
+ Foo(const Foo&);
+ Foo& operator=(const Foo&);
+private:
+ static int m_fooCount;
+protected:
+ Foo() {
+ m_fooCount++;
+ }
+public:
+ // Factory function (static)
+ static Foo *makeFoo() {
+ return new Foo;
+ }
+
+ // Factory function (regular)
+ Foo *makeMore() {
+ return new Foo;
+ }
+
+ // Return the number of instances
+ static int fooCount() {
+ return m_fooCount;
+ }
+
+ // Destructor
+ ~Foo() {
+ m_fooCount--;
+ }
+};
+%}
+
+%{
+// Static member initialization (not wrapped)
+int Foo::m_fooCount = 0;
+%}
diff --git a/Examples/test-suite/newobject2.i b/Examples/test-suite/newobject2.i
new file mode 100644
index 000000000..bbe94a50e
--- /dev/null
+++ b/Examples/test-suite/newobject2.i
@@ -0,0 +1,38 @@
+/**
+ * The purpose of this test is to confirm that a language module
+ * correctly handles the case when a C function has been tagged with the
+ * %newobject directive.
+ */
+
+%module newobject2
+
+%{
+/* Global initialization (not wrapped) */
+int g_fooCount = 0;
+%}
+
+%newobject makeFoo();
+
+%inline %{
+/* Struct definition */
+typedef struct {} Foo;
+
+/* Make one */
+Foo *makeFoo() {
+ Foo *foo = (Foo *) malloc(sizeof(Foo));
+ g_fooCount++;
+ return foo;
+}
+
+/* Return the number of instances */
+int fooCount() {
+ return g_fooCount;
+}
+%}
+
+%extend Foo {
+ ~Foo() {
+ free((void *) self);
+ g_fooCount--;
+ }
+}
diff --git a/Examples/test-suite/ocaml/Makefile b/Examples/test-suite/ocaml/Makefile
new file mode 100644
index 000000000..9c9a182bf
--- /dev/null
+++ b/Examples/test-suite/ocaml/Makefile
@@ -0,0 +1,64 @@
+LANGUAGE = ocaml
+VARIANT = _static
+SCRIPTSUFFIX = _runme.ml
+
+C_TEST_CASES =
+
+run_testcase = \
+ if [ -f $*\_runme.ml ] ; then \
+ (ocamlc -c $*\_runme.ml ; \
+ ocamlc -custom -g -o runme $*\.cmo $*\_runme.cmo $*\_wrap.o ; \
+ ./runme) ; \
+ fi ;
+
+check_quant:
+ cat /dev/null > testing
+ cat /dev/null > success
+ cat /dev/null > results
+ $(MAKE) check
+ echo "Failed:" >> results
+ for element in `cat testing` ; do \
+ if grep $$element success >/dev/null 2>/dev/null ; then \
+ : ; \
+ else \
+ echo $$element >> results ; \
+ fi ; \
+ done
+ echo "Success:" >> results
+ cat success >> results
+
+include ../common.mk
+
+%.cpptest:
+ echo $@ >> testing
+ $(setup) \
+ ($(swig_and_compile_cpp); ) ; \
+ $(run_testcase) \
+ if [ -f $(@:%.cpptest=%_wrap.o) ] ; then \
+ echo $@ >> success ; \
+ fi
+
+%.ctest:
+ echo $@ >> testing
+ $(setup) \
+ ($(swig_and_compile_c); ) ; \
+ $(run_testcase) \
+ if [ -f $(@:%.ctest=%_wrap.o) ] ; then \
+ echo $@ >> success ; \
+ fi
+
+%.multicpptest:
+ echo $@ >> testing
+ $(setup) \
+ ($(swig_and_compile_multi_cpp); ) ; \
+ $(run_testcase) \
+ if [ -f $(@:%.multicpptest=%_a_wrap.o) ] ; then \
+ echo $@ >> success ; \
+ fi
+
+%.clean:
+ @rm -f $*.ml $*.mli;
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile ocaml_clean
+
diff --git a/Examples/test-suite/ocaml/README b/Examples/test-suite/ocaml/README
new file mode 100644
index 000000000..3fdea6252
--- /dev/null
+++ b/Examples/test-suite/ocaml/README
@@ -0,0 +1,2 @@
+I stole most of these runme's from the ruby runme scripts, since the current
+ocaml interface mirrors the ruby interface in many ways.
diff --git a/Examples/test-suite/ocaml/class_ignore_runme.ml b/Examples/test-suite/ocaml/class_ignore_runme.ml
new file mode 100644
index 000000000..846643aa8
--- /dev/null
+++ b/Examples/test-suite/ocaml/class_ignore_runme.ml
@@ -0,0 +1,6 @@
+open Class_ignore
+
+let a = new_Bar C_void
+let _ = (if _do_blah a <> C_string "Bar::blah" then
+ raise (Failure "We didn't really get a bar object."))
+
diff --git a/Examples/test-suite/ocaml/makedebugtop b/Examples/test-suite/ocaml/makedebugtop
new file mode 100755
index 000000000..8d712801c
--- /dev/null
+++ b/Examples/test-suite/ocaml/makedebugtop
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# Usage: makedebugtop test_name.c[pp]test
+#
+# Creates an ocaml toplevel for debugging based on a .cpptest or .ctest
+# file.
+#
+
+OCAMLINC=/usr/local/lib/ocaml
+swigtest=$1
+thetest=`echo $1 | sed -e 's/\.c[p]*test//g'`
+cppopt=""
+if echo $swigtest | grep -s cpptest ; then
+ cppopt=-xc++
+fi
+
+echo "Making the test"
+make $swigtest
+echo "Building ${thetest}_top"
+gcc -c -g $cppopt -I$OCAMLINC ${thetest}_wrap.c
+ocamlmktop -cclib -g -custom ${thetest}_wrap.o ${thetest}.cmo -o ${thetest}_top
diff --git a/Examples/test-suite/ocaml/newobject1_runme.ml b/Examples/test-suite/ocaml/newobject1_runme.ml
new file mode 100644
index 000000000..247545690
--- /dev/null
+++ b/Examples/test-suite/ocaml/newobject1_runme.ml
@@ -0,0 +1,25 @@
+open Newobject1
+
+exception RuntimeError of string * int
+
+let foo1 = ref (_Foo_makeFoo C_void)
+let _ = if get_int (_Foo_fooCount C_void) != 1 then
+ raise (RuntimeError ("(1) Foo.fooCount != 1",
+ get_int (_Foo_fooCount C_void)))
+
+let foo2 = ref ((invoke !foo1) "makeMore" C_void)
+let _ = if get_int (_Foo_fooCount C_void) != 2 then
+ raise (RuntimeError ("(2) Foo.fooCount != 2",
+ get_int (_Foo_fooCount C_void)))
+
+let _ = begin
+ foo1 := C_void ; Gc.full_major () ;
+ (if get_int (_Foo_fooCount C_void) != 1 then
+ raise (RuntimeError ("(3) Foo.fooCount != 1",
+ get_int (_Foo_fooCount C_void)))) ;
+
+ foo2 := C_void ; Gc.full_major () ;
+ (if get_int (_Foo_fooCount C_void) != 0 then
+ raise (RuntimeError ("(4) Foo.fooCount != 0",
+ get_int (_Foo_fooCount C_void)))) ;
+end
diff --git a/Examples/test-suite/ocaml/overload_copy_runme.ml b/Examples/test-suite/ocaml/overload_copy_runme.ml
new file mode 100644
index 000000000..c48f15b17
--- /dev/null
+++ b/Examples/test-suite/ocaml/overload_copy_runme.ml
@@ -0,0 +1,4 @@
+open Overload_copy
+
+let f = new_Foo C_void
+let g = new_Foo f
diff --git a/Examples/test-suite/ocaml/results b/Examples/test-suite/ocaml/results
new file mode 100644
index 000000000..7ee0f1a9c
--- /dev/null
+++ b/Examples/test-suite/ocaml/results
@@ -0,0 +1,180 @@
+Failed:
+template_typedef_import.multicpptest
+Success:
+template_specialization.cpptest
+default_cast.cpptest
+import_nomodule.cpptest
+struct_value.cpptest
+abstract_inherit.cpptest
+abstract_inherit_ok.cpptest
+add_link.cpptest
+anonymous_arg.cpptest
+argout.cpptest
+arrays_global.cpptest
+arrays_global_twodim.cpptest
+arrays_scope.cpptest
+bool_default.cpptest
+casts.cpptest
+class_ignore.cpptest
+const_const_2.cpptest
+constant_pointers.cpptest
+constover.cpptest
+constructor_exception.cpptest
+constructor_explicit.cpptest
+constructor_value.cpptest
+conversion.cpptest
+conversion_namespace.cpptest
+conversion_ns_template.cpptest
+cplusplus_throw.cpptest
+cpp_enum.cpptest
+cpp_enum_scope.cpptest
+cpp_namespace.cpptest
+cpp_nodefault.cpptest
+cpp_static.cpptest
+cpp_typedef.cpptest
+default_constructor.cpptest
+default_ns.cpptest
+default_ref.cpptest
+dynamic_cast.cpptest
+enum_scope.cpptest
+enum_scope_template.cpptest
+enum_var.cpptest
+evil_diamond.cpptest
+evil_diamond_ns.cpptest
+evil_diamond_prop.cpptest
+explicit.cpptest
+extend_template.cpptest
+extend_template_ns.cpptest
+grouping.cpptest
+ignore_parameter.cpptest
+inherit_missing.cpptest
+kind.cpptest
+lib_carrays.cpptest
+lib_cdata.cpptest
+lib_cpointer.cpptest
+lib_std_deque.cpptest
+lib_std_string.cpptest
+lib_std_vector.cpptest
+lib_typemaps.cpptest
+member_template.cpptest
+minherit.cpptest
+name_cxx.cpptest
+name_inherit.cpptest
+namespace_enum.cpptest
+namespace_extend.cpptest
+namespace_template.cpptest
+namespace_typemap.cpptest
+newobject1.cpptest
+overload_complicated.cpptest
+overload_copy.cpptest
+overload_extend.cpptest
+overload_simple.cpptest
+overload_subtype.cpptest
+overload_template.cpptest
+pointer_reference.cpptest
+primitive_ref.cpptest
+private_assign.cpptest
+pure_virtual.cpptest
+rename_default.cpptest
+rename_scope.cpptest
+return_value_scope.cpptest
+rname.cpptest
+smart_pointer_const.cpptest
+smart_pointer_multi.cpptest
+smart_pointer_multi_typedef.cpptest
+smart_pointer_not.cpptest
+smart_pointer_overload.cpptest
+smart_pointer_protected.cpptest
+smart_pointer_rename.cpptest
+smart_pointer_simple.cpptest
+smart_pointer_typedef.cpptest
+static_array_member.cpptest
+static_const_member.cpptest
+static_const_member_2.cpptest
+template.cpptest
+template_arg_scope.cpptest
+template_arg_typename.cpptest
+template_base_template.cpptest
+template_classes.cpptest
+template_const_ref.cpptest
+template_construct.cpptest
+template_default.cpptest
+template_default2.cpptest
+template_default_inherit.cpptest
+template_default_qualify.cpptest
+template_enum.cpptest
+template_enum_ns_inherit.cpptest
+template_enum_typedef.cpptest
+template_forward.cpptest
+template_inherit.cpptest
+template_inherit_abstract.cpptest
+template_int_const.cpptest
+template_ns.cpptest
+template_ns2.cpptest
+template_ns3.cpptest
+template_ns4.cpptest
+template_ns_enum.cpptest
+template_ns_enum2.cpptest
+template_ns_inherit.cpptest
+template_ns_scope.cpptest
+template_qualifier.cpptest
+template_rename.cpptest
+template_retvalue.cpptest
+template_static.cpptest
+template_tbase_template.cpptest
+template_type_namespace.cpptest
+template_typedef.cpptest
+template_typedef_cplx.cpptest
+template_typedef_cplx2.cpptest
+template_typedef_cplx3.cpptest
+template_typedef_cplx4.cpptest
+template_virtual.cpptest
+template_whitespace.cpptest
+throw_exception.cpptest
+typedef_funcptr.cpptest
+typedef_inherit.cpptest
+typedef_mptr.cpptest
+typedef_reference.cpptest
+typedef_scope.cpptest
+typemap_namespace.cpptest
+typemap_ns_using.cpptest
+typename.cpptest
+union_scope.cpptest
+using1.cpptest
+using2.cpptest
+using_composition.cpptest
+using_extend.cpptest
+using_inherit.cpptest
+using_private.cpptest
+using_protected.cpptest
+valuewrapper_base.cpptest
+virtual_destructor.cpptest
+voidtest.cpptest
+arrayptr.ctest
+arrays.ctest
+char_constant.ctest
+const_const.ctest
+defineop.ctest
+defines.ctest
+enum.ctest
+lib_carrays.ctest
+lib_cdata.ctest
+lib_cmalloc.ctest
+lib_constraints.ctest
+lib_cpointer.ctest
+lib_math.ctest
+long_long.ctest
+macro_2.ctest
+name.ctest
+nested.ctest
+newobject2.ctest
+overload_extendc.ctest
+preproc_1.ctest
+preproc_2.ctest
+preproc_3.ctest
+ret_by_value.ctest
+sizeof_pointer.ctest
+sneaky1.ctest
+typemap_subst.ctest
+unions.ctest
+imports.multicpptest
diff --git a/Examples/test-suite/ocaml/sneaky1_runme.ml b/Examples/test-suite/ocaml/sneaky1_runme.ml
new file mode 100644
index 000000000..37678b38e
--- /dev/null
+++ b/Examples/test-suite/ocaml/sneaky1_runme.ml
@@ -0,0 +1,8 @@
+(* Stolen from ruby test cases *)
+
+open Sneaky1
+
+let x = Sneaky1._add (C_list [ C_int 3; C_int 4 ])
+let y = Sneaky1._sub (C_list [ C_int 3; C_int 4 ])
+let z = Sneaky1._mul (C_list [ C_int 3; C_int 4 ])
+let w = Sneaky1._divide (C_list [ C_int 3; C_int 4 ])
diff --git a/Examples/test-suite/ocaml/throw_exception_runme.ml b/Examples/test-suite/ocaml/throw_exception_runme.ml
new file mode 100644
index 000000000..49ce884c4
--- /dev/null
+++ b/Examples/test-suite/ocaml/throw_exception_runme.ml
@@ -0,0 +1,27 @@
+(* Throw exception test *)
+
+open Throw_exception
+
+let x = new_Foo C_void ;;
+let _ =
+ try
+ (invoke x) "test_int" C_void
+ with (Failure "Exception(37): Thrown exception from C++ (int)\n") ->
+ try
+ (invoke x) "test_msg" C_void
+ with (Failure "Exception(0): Dead\n") ->
+ try
+ (invoke x) "test_cls" C_void
+ with (Failure "Exception(0): Thrown exception from C++ (unknown)\n") ->
+ try
+ (invoke x) "test_multi" (C_int 1)
+ with (Failure "Exception(37): Thrown exception from C++ (int)\n") ->
+ try
+ (invoke x) "test_multi" (C_int 2)
+ with (Failure "Exception(0): Dead\n") ->
+ try
+ (invoke x) "test_multi" (C_int 3)
+ with (Failure "Exception(0): Thrown exception from C++ (unknown)\n") ->
+ exit 0
+
+let _ = exit 1
diff --git a/Examples/test-suite/ocaml/typename_runme.ml b/Examples/test-suite/ocaml/typename_runme.ml
new file mode 100644
index 000000000..15b5eac25
--- /dev/null
+++ b/Examples/test-suite/ocaml/typename_runme.ml
@@ -0,0 +1,11 @@
+(* Fun with type names -- stolen from the ruby runme *)
+
+open Typename
+
+let f = new_Foo C_void
+let b = new_Bar C_void
+
+let x = _twoFoo f
+let _ = match x with C_double f -> () | _ -> raise (Failure "not a float")
+let y = _twoBar b
+let _ = match y with C_int i -> () | _ -> raise (Failure "not an int")
diff --git a/Examples/test-suite/ocaml/unions_runme.ml b/Examples/test-suite/ocaml/unions_runme.ml
new file mode 100644
index 000000000..b1ddf3fce
--- /dev/null
+++ b/Examples/test-suite/ocaml/unions_runme.ml
@@ -0,0 +1,27 @@
+(* Test the unions example... *)
+
+open Unions
+
+let a = new_SmallStruct C_void
+let b = new_BigStruct C_void
+let c = new_UnionTest C_void
+let d = new_EmbeddedUnionTest C_void
+
+let _ = (invoke a) "jill_set" (C_short 3)
+let _ = (invoke b) "jack_set" (C_char 'a') (* Int conversion *)
+let _ = (invoke b) "smallstruct_set" a (* Put a in b *)
+let _ = (invoke c) "bs_set" b
+
+let _ = if get_int ((invoke a) "jill_get" C_void) != 3 then
+ raise (Failure "jill value is not preserved")
+let _ = if get_int ((invoke b) "jack_get" C_void) != (int_of_char 'a') then
+ raise (Failure "jack value is not preserved")
+let _ = if get_int ((invoke ((invoke b) "smallstruct_get" C_void))
+ "jill_get" C_void) != 3 then
+ raise (Failure "jill value is not embedded in bigstruct")
+let _ = if get_int ((invoke ((invoke c) "bs_get" C_void))
+ "jack_get" C_void) != (int_of_char 'a') then
+ raise (Failure "union set of bigstruct did not take")
+let _ = if get_int ((invoke ((invoke c) "ss_get" C_void))
+ "jill_get" C_void) != (int_of_char 'a') then
+ raise (Failure "corresponding union values are not the same")
diff --git a/Examples/test-suite/overload_complicated.i b/Examples/test-suite/overload_complicated.i
new file mode 100644
index 000000000..2050e1945
--- /dev/null
+++ b/Examples/test-suite/overload_complicated.i
@@ -0,0 +1,21 @@
+// A complicated test of overloaded functions
+%module overload_complicated
+
+#ifndef SWIG_NO_OVERLOAD
+
+%typemap(in, numinputs=0) int l { $1 = 4711; }
+
+%inline %{
+
+double foo(int, int, char *, int) {
+ return 15;
+}
+
+double foo(int i, int j, double k = 17.4, int l = 18, char m = 'P') {
+ return i + j + k + l + (int) m;
+}
+
+%}
+
+#endif
+
diff --git a/Examples/test-suite/overload_copy.i b/Examples/test-suite/overload_copy.i
new file mode 100644
index 000000000..a685f76e2
--- /dev/null
+++ b/Examples/test-suite/overload_copy.i
@@ -0,0 +1,16 @@
+// Tests copy constructor
+%module overload_copy
+
+#ifndef SWIG_NO_OVERLOAD
+%inline %{
+
+class Foo {
+public:
+ Foo() { }
+ Foo(const Foo &) { }
+};
+
+%}
+
+#endif
+
diff --git a/Examples/test-suite/overload_extend.i b/Examples/test-suite/overload_extend.i
new file mode 100644
index 000000000..0498bde1b
--- /dev/null
+++ b/Examples/test-suite/overload_extend.i
@@ -0,0 +1,16 @@
+%module overload_extend
+
+%inline %{
+struct Foo {
+};
+%}
+
+%extend Foo {
+ int test(int x) { x = 0; return 1; }
+ int test(char *s) { s = 0; return 2; }
+ int test(double x, double y) { x = 0; y = 0; return 3; }
+};
+
+
+
+
diff --git a/Examples/test-suite/overload_extendc.i b/Examples/test-suite/overload_extendc.i
new file mode 100644
index 000000000..e03b3f160
--- /dev/null
+++ b/Examples/test-suite/overload_extendc.i
@@ -0,0 +1,16 @@
+%module overload_extendc
+
+%inline %{
+typedef struct Foo {
+} Foo;
+%}
+
+%extend Foo {
+ int test(int x) { x = 0; return 1; }
+ int test(char *s) { s = 0; return 2; }
+ int test(double x, double y) { x = 0; y = 0; return 3; }
+};
+
+
+
+
diff --git a/Examples/test-suite/overload_simple.i b/Examples/test-suite/overload_simple.i
new file mode 100644
index 000000000..27df10911
--- /dev/null
+++ b/Examples/test-suite/overload_simple.i
@@ -0,0 +1,92 @@
+// Simple tests of overloaded functions
+%module overload_simple
+
+#ifndef SWIG_NO_OVERLOAD
+%immutable Spam::type;
+
+%inline %{
+
+struct Foo {
+};
+
+struct Bar {
+};
+
+char *foo(int) {
+ return (char*) "foo:int";
+}
+
+char *foo(double) {
+ return (char*) "foo:double";
+}
+
+char *foo(char *) {
+ return (char*) "foo:char *";
+}
+
+char *foo(Foo *) {
+ return (char*) "foo:Foo *";
+}
+char *foo(Bar *) {
+ return (char *) "foo:Bar *";
+}
+char *foo(void *) {
+ return (char *) "foo:void *";
+}
+
+class Spam {
+public:
+ Spam() { type = "none"; }
+ Spam(int) { type = "int"; }
+ Spam(double) { type = "double"; }
+ Spam(char *) { type = "char *"; }
+ Spam(Foo *) { type = "Foo *"; }
+ Spam(Bar *) { type = "Bar *"; }
+ Spam(void *) { type = "void *"; }
+ const char *type;
+
+char *foo(int) {
+ return (char*) "foo:int";
+}
+char *foo(double) {
+ return (char*) "foo:double";
+}
+char *foo(char *) {
+ return (char*) "foo:char *";
+}
+char *foo(Foo *) {
+ return (char*) "foo:Foo *";
+}
+char *foo(Bar *) {
+ return (char *) "foo:Bar *";
+}
+char *foo(void *) {
+ return (char *) "foo:void *";
+}
+
+static char *bar(int) {
+ return (char*) "bar:int";
+}
+static char *bar(double) {
+ return (char*) "bar:double";
+}
+static char *bar(char *) {
+ return (char*) "bar:char *";
+}
+static char *bar(Foo *) {
+ return (char*) "bar:Foo *";
+}
+static char *bar(Bar *) {
+ return (char *) "bar:Bar *";
+}
+static char *bar(void *) {
+ return (char *) "bar:void *";
+}
+};
+%}
+
+%include cmalloc.i
+%malloc(void);
+
+#endif
+
diff --git a/Examples/test-suite/overload_subtype.i b/Examples/test-suite/overload_subtype.i
new file mode 100644
index 000000000..3d9645d7b
--- /dev/null
+++ b/Examples/test-suite/overload_subtype.i
@@ -0,0 +1,17 @@
+%module overload_subtype
+
+%inline %{
+
+class Foo {};
+class Bar : public Foo {};
+
+
+int spam(Foo *f) {
+ return 1;
+}
+
+int spam(Bar *b) {
+ return 2;
+}
+
+%}
diff --git a/Examples/test-suite/overload_template.i b/Examples/test-suite/overload_template.i
new file mode 100644
index 000000000..01a1dd633
--- /dev/null
+++ b/Examples/test-suite/overload_template.i
@@ -0,0 +1,19 @@
+%module overload_template
+%inline %{
+
+int foo() {
+ return 3;
+}
+template <class T>
+ int foo(int x) {
+ return x;
+ }
+
+template<class T>
+ T max(T a, T b) { return (a > b) ? a : b; }
+%}
+
+
+%template(max) max<int>;
+%template(max) max<double>;
+
diff --git a/Examples/test-suite/perl5/.cvsignore b/Examples/test-suite/perl5/.cvsignore
new file mode 100644
index 000000000..e32f11c0b
--- /dev/null
+++ b/Examples/test-suite/perl5/.cvsignore
@@ -0,0 +1,4 @@
+*wrap*
+*.pm
+*.so
+*.dll
diff --git a/Examples/test-suite/perl5/Makefile b/Examples/test-suite/perl5/Makefile
new file mode 100644
index 000000000..d8ee34446
--- /dev/null
+++ b/Examples/test-suite/perl5/Makefile
@@ -0,0 +1,42 @@
+#######################################################################
+# $Header$
+# Makefile for perl5 test-suite
+#######################################################################
+
+LANGUAGE = perl5
+SCRIPTSUFFIX = _runme.pl
+
+include ../common.mk
+
+# Overridden variables here
+SWIGOPT = -shadow -I$(TOP)/$(TEST_SUITE)
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup) \
+ ($(swig_and_compile_cpp); ); \
+ $(run_testcase)
+
+%.ctest:
+ $(setup) \
+ ($(swig_and_compile_c); ); \
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup) \
+ ($(swig_and_compile_multi_cpp); ); \
+ $(run_testcase)
+
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.pl appended after the testcase name.
+run_testcase = \
+ if [ -f $*\_runme.pl ]; then ( \
+ env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH perl $*\_runme.pl;) \
+ fi;
+
+# Clean: remove the generated .pm file
+%.clean:
+ @rm -f $*.pm;
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile perl5_clean
diff --git a/Examples/test-suite/perl5/README b/Examples/test-suite/perl5/README
new file mode 100644
index 000000000..649cca90a
--- /dev/null
+++ b/Examples/test-suite/perl5/README
@@ -0,0 +1,4 @@
+See ../README for common README file.
+
+Any testcases which have _runme.pl appended after the testcase name will be detected and run.
+
diff --git a/Examples/test-suite/perl5/import_nomodule_runme.pl b/Examples/test-suite/perl5/import_nomodule_runme.pl
new file mode 100644
index 000000000..965d10582
--- /dev/null
+++ b/Examples/test-suite/perl5/import_nomodule_runme.pl
@@ -0,0 +1,7 @@
+use import_nomodule;
+
+$f = import_nomodule::create_Foo();
+import_nomodule::test1($f,42);
+
+$b = new import_nomodule::Bar();
+import_nomodule::test1($b,37);
diff --git a/Examples/test-suite/perl5/imports_runme.pl b/Examples/test-suite/perl5/imports_runme.pl
new file mode 100644
index 000000000..fd730fedf
--- /dev/null
+++ b/Examples/test-suite/perl5/imports_runme.pl
@@ -0,0 +1,5 @@
+use imports_b;
+use imports_a;
+
+$x = imports_bc::new_B();
+imports_ac::A_hello($x);
diff --git a/Examples/test-suite/perl5/overload_copy_runme.pl b/Examples/test-suite/perl5/overload_copy_runme.pl
new file mode 100644
index 000000000..06d03f5e6
--- /dev/null
+++ b/Examples/test-suite/perl5/overload_copy_runme.pl
@@ -0,0 +1,5 @@
+
+use overload_copy;
+
+$f = new overload_copy::Foo();
+$g = new overload_copy::Foo($f);
diff --git a/Examples/test-suite/perl5/overload_simple_runme.pl b/Examples/test-suite/perl5/overload_simple_runme.pl
new file mode 100644
index 000000000..5e348fba1
--- /dev/null
+++ b/Examples/test-suite/perl5/overload_simple_runme.pl
@@ -0,0 +1,120 @@
+use overload_simple;
+
+$f = new overload_simple::Foo();
+$b = new overload_simple::Bar();
+$v = overload_simple::malloc_void(32);
+
+if (overload_simple::foo(3) != "foo:int") {
+ die("foo(int)");
+}
+
+if (overload_simple::foo(3.0) != "foo:double") {
+ die("foo(double)");
+}
+
+if (overload_simple::foo("hello") != "foo:char *") {
+ die("foo(char *)");
+}
+
+if (overload_simple::foo($f) != "foo:Foo *") {
+ die("foo(Foo *)");
+}
+
+if (overload_simple::foo($b) != "foo:Bar *") {
+ die("foo(Bar *)");
+}
+
+if (overload_simple::foo($v) != "foo:void *") {
+ die("foo(void *)");
+}
+
+$s = new overload_simple::Spam();
+
+if ($s->foo(3) != "foo:int") {
+ die("Spam::foo(int)");
+}
+
+if ($s->foo(3.0) != "foo:double") {
+ die("Spam::foo(double)");
+}
+
+if ($s->foo("hello") != "foo:char *") {
+ die("Spam::foo(char *)");
+}
+
+if ($s->foo($f) != "foo:Foo *") {
+ die("Spam::foo(Foo *)");
+}
+
+if ($s->foo($b) != "foo:Bar *") {
+ die("Spam::foo(Bar *)");
+}
+
+if ($s->foo($v) != "foo:void *") {
+ die("Spam::foo(void *)");
+}
+
+if (overload_simple::Spam::bar(3) != "bar:int") {
+ die("Spam::bar(int)");
+}
+
+if (overload_simple::Spam::bar(3.0) != "bar:double") {
+ die("Spam::bar(double)");
+}
+
+if (overload_simple::Spam::bar("hello") != "bar:char *") {
+ die("Spam::bar(char *)");
+}
+
+if (overload_simple::Spam::bar($f) != "bar:Foo *") {
+ die("Spam::bar(Foo *)");
+}
+
+if (overload_simple::Spam::bar($b) != "bar:Bar *") {
+ die("Spam::bar(Bar *)");
+}
+
+if (overload_simple::Spam::bar($v) != "bar:void *") {
+ die("Spam::bar(void *)");
+}
+
+# Test constructors
+
+$s = new overload_simple::Spam();
+if ($s->{type} != "none") {
+ die("Spam()");
+}
+
+$s = new overload_simple::Spam(3);
+if ($s->{type} != "int") {
+ die("Spam(int)");
+}
+
+$s = new overload_simple::Spam(3.0);
+if ($s->{type} != "double") {
+ die("Spam(double)");
+}
+
+$s = new overload_simple::Spam("hello");
+if ($s->{type} != "char *") {
+ die("Spam(char *)");
+}
+
+$s = new overload_simple::Spam($f);
+if ($s->{type} != "Foo *") {
+ die("Spam(Foo *)");
+}
+
+$s = new overload_simple::Spam($b);
+if ($s->{type} != "Bar *") {
+ die("Spam(Bar *)");
+}
+
+$s = new overload_simple::Spam($v);
+if ($s->{type} != "void *") {
+ die("Spam(void *)");
+}
+
+
+
+
diff --git a/Examples/test-suite/perl5/primitive_ref_runme.pl b/Examples/test-suite/perl5/primitive_ref_runme.pl
new file mode 100644
index 000000000..727b3ec6e
--- /dev/null
+++ b/Examples/test-suite/perl5/primitive_ref_runme.pl
@@ -0,0 +1,38 @@
+use primitive_ref;
+
+if (primitive_ref::ref_int(3) != 3) {
+ print "ref_int failed!\n";
+}
+if (primitive_ref::ref_uint(3) != 3) {
+ print "ref_uint failed!\n";
+}
+if (primitive_ref::ref_short(3) != 3) {
+ print "ref_short failed!\n";
+}
+if (primitive_ref::ref_ushort(3) != 3) {
+ print "ref_ushort failed!\n";
+}
+if (primitive_ref::ref_long(3) != 3) {
+ print "ref_long failed!\n";
+}
+if (primitive_ref::ref_ulong(3) != 3) {
+ print "ref_ulong failed!\n";
+}
+if (primitive_ref::ref_schar(3) != 3) {
+ print "ref_schar failed!\n";
+}
+if (primitive_ref::ref_uchar(3) != 3) {
+ print "ref_uchar failed!\n";
+}
+if (primitive_ref::ref_bool(1) != 1) {
+ print "ref_bool failed!\n";
+}
+if (primitive_ref::ref_float(3.5) != 3.5) {
+ print "ref_float failed!\n";
+}
+if (primitive_ref::ref_double(3.5) != 3.5) {
+ print "ref_double failed!\n";
+}
+if (primitive_ref::ref_char('x') != 'x') {
+ print "ref_char failed!\n";
+}
diff --git a/Examples/test-suite/perl5/unions_runme.pl b/Examples/test-suite/perl5/unions_runme.pl
new file mode 100644
index 000000000..fca499f0e
--- /dev/null
+++ b/Examples/test-suite/perl5/unions_runme.pl
@@ -0,0 +1,54 @@
+
+# This is the union runtime testcase. It ensures that values within a
+# union embedded within a struct can be set and read correctly.
+
+use unions;
+
+# Create new instances of SmallStruct and BigStruct for later use
+$small = new unions::SmallStruct();
+$small->{jill} = 200;
+
+$big = new unions::BigStruct();
+$big->{smallstruct} = $small;
+$big->{jack} = 300;
+
+# Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
+# Ensure values in EmbeddedUnionTest are set correctly for each.
+$eut = new unions::EmbeddedUnionTest();
+
+# First check the SmallStruct in EmbeddedUnionTest
+$eut->{number} = 1;
+$eut->{uni}->{small} = $small;
+$Jill1 = $eut->{uni}->{small}->{jill};
+if ($Jill1 != 200) {
+ print "Runtime test1 failed. eut.uni.small.jill=" , $Jill1, "\n";
+ exit 1;
+}
+
+$Num1 = $eut->{number};
+if ($Num1 != 1) {
+ print "Runtime test2 failed. eut.number=" , $Num1, "\n";
+ exit 1;
+}
+
+# Secondly check the BigStruct in EmbeddedUnionTest
+$eut->{number} = 2;
+$eut->{uni}->{big} = $big;
+$Jack1 = $eut->{uni}->{big}->{jack};
+if ($Jack1 != 300) {
+ print "Runtime test3 failed. eut.uni.big.jack=" , $Jack1, "\n";
+ exit 1;
+}
+
+$Jill2 = $eut->{uni}->{big}->{smallstruct}->{jill};
+if ($Jill2 != 200) {
+ print "Runtime test4 failed. eut.uni.big.smallstruct.jill=" , $Jill2, "\n";
+ exit 1;
+}
+
+$Num2 = $eut->{number};
+if ($Num2 != 2) {
+ print "Runtime test5 failed. eut.number=" , $Num2, "\n";
+ exit 1;
+}
+
diff --git a/Examples/test-suite/php4/Makefile b/Examples/test-suite/php4/Makefile
new file mode 100644
index 000000000..e286f9d5e
--- /dev/null
+++ b/Examples/test-suite/php4/Makefile
@@ -0,0 +1,67 @@
+#######################################################################
+# Makefile for php4 test-suite
+#######################################################################
+
+LANGUAGE = php4
+SCRIPTSUFFIX = _runme.php4
+
+include ../common.mk
+
+# Overridden variables here
+SWIGOPT = -I$(TOP)/../Lib -I$(TOP)/$(TEST_SUITE)
+TARGETPREFIX = php_
+
+makecpptests:
+ @bash -ec 'for test in $(CPP_TEST_CASES) ; do make clean && make $${test}.cpptest; done'
+
+maketests: makecpptests makectests
+
+makectests:
+ @bash -ec 'for test in $(C_TEST_CASES) ; do make clean && make $${test}.cpptest; done'
+
+runcpptests:
+ @bash -ec 'for test in $(CPP_TEST_CASES) ; do if [ -f $${test}_runme.php4 ] ; then make clean && make $${test}.cpptest; fi ; done'
+
+runctests:
+ @bash -ec 'for test in $(C_TEST_CASES) ; do if [ -f $${test}_runme.php4 ] ; then make clean && make $${test}.cpptest; fi; done'
+
+runtests: runcpptests runctests
+
+# write out tests without a _runme.php4
+missingcpptests:
+ @bash -ec 'for test in $(CPP_TEST_CASES) ; do test -f $${test}_runme.php4 || echo $${test}; done'
+
+missingctests:
+ @bash -ec 'for test in $(C_TEST_CASES) ; do test -f $${test}_runme.php4 || echo $${test}; done'
+
+missingtests: missingcpptests missingctests
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup) \
+ ($(swig_and_compile_cpp); ); \
+ $(run_testcase)
+
+%.ctest:
+ $(setup) \
+ ($(swig_and_compile_c); ); \
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup) \
+ ($(swig_and_compile_multi_cpp); ); \
+ $(run_testcase)
+
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.php4 appended after the testcase name.
+run_testcase = \
+ if [ -f $*\_runme.php4 ]; then ( \
+ env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH php -q -d extension_dir=. $*\_runme.php4;) \
+ fi;
+
+# Clean: remove the generated .php file
+%.clean:
+ @rm -f $*.php;
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile php4_clean
diff --git a/Examples/test-suite/php4/abstract_inherit_ok_runme.php4 b/Examples/test-suite/php4/abstract_inherit_ok_runme.php4
new file mode 100644
index 000000000..b03755a00
--- /dev/null
+++ b/Examples/test-suite/php4/abstract_inherit_ok_runme.php4
@@ -0,0 +1,13 @@
+<?php
+
+require "tests.php4";
+require "abstract_inherit_ok.php";
+
+check::classes(array(foo,spam));
+$spam=new Spam();
+
+check::equal(0,$spam->blah(),"spam object method");
+check::equal(0,Spam::blah($spam),"spam class method");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/abstract_inherit_runme.php4 b/Examples/test-suite/php4/abstract_inherit_runme.php4
new file mode 100644
index 000000000..358d2741f
--- /dev/null
+++ b/Examples/test-suite/php4/abstract_inherit_runme.php4
@@ -0,0 +1,14 @@
+<?php
+
+require "tests.php4";
+require "abstract_inherit.php";
+
+check::classes(array(foo,bar,spam));
+// This constructor attempt should fail as there isn't one
+//$spam=new Spam();
+
+//check::equal(0,$spam->blah(),"spam object method");
+//check::equal(0,Spam::blah($spam),"spam class method");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/add_link_runme.php4 b/Examples/test-suite/php4/add_link_runme.php4
new file mode 100644
index 000000000..aca3267b6
--- /dev/null
+++ b/Examples/test-suite/php4/add_link_runme.php4
@@ -0,0 +1,23 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "add_link.php";
+
+// No new functions
+check::functions(array());
+// No new classes
+check::classes(array(foo));
+
+$foo=new foo();
+check::is_a($foo,foo);
+
+$foo_blah=$foo->blah();
+check::is_a($foo_blah,foo);
+
+//fails, can't be called as a class method, should allow and make it nil?
+//$class_foo_blah=foo::blah();
+//check::is_a($class_foo_blah,foo);
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/anonymous_arg_runme.php4 b/Examples/test-suite/php4/anonymous_arg_runme.php4
new file mode 100644
index 000000000..6d9d9670b
--- /dev/null
+++ b/Examples/test-suite/php4/anonymous_arg_runme.php4
@@ -0,0 +1,13 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "anonymous_arg.php";
+
+check::functions(array(foo));
+// these two should perform without error
+foo();
+foo(7);
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/argout_runme.php4 b/Examples/test-suite/php4/argout_runme.php4
new file mode 100644
index 000000000..adb9dfbc2
--- /dev/null
+++ b/Examples/test-suite/php4/argout_runme.php4
@@ -0,0 +1,37 @@
+<?php
+
+require "tests.php4";
+require "argout.php";
+
+check::functions(array(incp,incr,inctr,new_intp,copy_intp,delete_intp,intp_assign,intp_value,voidhandle,handle));
+
+$ip=copy_intp(42);
+check::equal(42,incp($ip),"42==incp($ip)");
+check::equal(43,intp_value($ip),"43=$ip");
+
+$p=2;
+check::equal(2,incp(&$p),"2==incp($p)");
+check::equal(3,$p,"3==$p");
+
+$r=7;
+check::equal(7,incr(&$r),"7==incr($r)");
+check::equal(8,$r,"8==$r");
+
+$tr=4;
+check::equal(4,inctr(&$tr),"4==incr($tr)");
+check::equal(5,$tr,"5==$tr");
+
+# Check the voidhandle call, first with null
+unset($handle);
+voidhandle(&$handle);
+check::resource($handle,"_p_void",'$handle is not _p_void');
+$handledata=handle($handle);
+check::equal($handledata,"Here it is","\$handledata != \"Here it is\"");
+
+unset($handle);
+// without reference, should fatal error so can't test here
+//voidhandle($handle);
+//check::isnull($handle,'$handle not null');
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/arrayptr_runme.php4 b/Examples/test-suite/php4/arrayptr_runme.php4
new file mode 100644
index 000000000..c057a6772
--- /dev/null
+++ b/Examples/test-suite/php4/arrayptr_runme.php4
@@ -0,0 +1,15 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "arrayptr.php";
+
+// No new functions
+check::functions(array(foo));
+// No new classes
+check::classes(array());
+// now new vars
+check::globals(array());
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/arrays_global_runme.php4 b/Examples/test-suite/php4/arrays_global_runme.php4
new file mode 100644
index 000000000..07d3be6ef
--- /dev/null
+++ b/Examples/test-suite/php4/arrays_global_runme.php4
@@ -0,0 +1,16 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "arrays_global.php";
+
+// No new functions
+check::functions(array());
+// No new classes
+check::classes(array(simplestruct));
+check::globals(array(array_c,array_sc,array_uc,array_s,array_us,array_i,array_ui,array_l,array_ul,array_ll,array_f,array_d,array_struct,array_structpointers,array_ipointers,array_enum,array_enumpointers,array_const_i));
+check::set(array_c,"hac");
+check::equal("ha",check::get(array_c,"ha"),"set array_c");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/arrays_global_twodim_runme.php4 b/Examples/test-suite/php4/arrays_global_twodim_runme.php4
new file mode 100644
index 000000000..799dfdc2d
--- /dev/null
+++ b/Examples/test-suite/php4/arrays_global_twodim_runme.php4
@@ -0,0 +1,25 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "arrays_global_twodim.php";
+
+// No new functions
+check::functions(array(fn_taking_arrays,get_2d_array));
+// No new classes
+check::classes(array(simplestruct));
+check::globals(array(array_c,array_sc,array_uc,array_s,array_us,array_i,array_ui,array_l,array_ul,array_ll,array_f,array_d,array_struct,array_structpointers,array_ipointers,array_enum,array_enumpointers,array_const_i));
+$a1=array(10,11,12,13);
+$a2=array(14,15,16,17);
+$a=array($a1,$a2);
+
+$_a=check::get(array_const_i);
+
+for($x=0;$x<count($a1);$x++) {
+ for($y=0;$y<2;$y++) {
+ check::equal($a[$y][$x],get_2d_array($_a,$y,$x),"check array $x,$y");
+ }
+}
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/arrays_runme.php4 b/Examples/test-suite/php4/arrays_runme.php4
new file mode 100644
index 000000000..ee240e58f
--- /dev/null
+++ b/Examples/test-suite/php4/arrays_runme.php4
@@ -0,0 +1,22 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "arrays.php";
+
+// No new functions
+check::functions(array(fn_taking_arrays,newintpointer,setintfrompointer,getintfrompointer));
+// No new classes
+check::classes(array(simplestruct,arraystruct));
+// now new vars
+check::globals(array());
+
+$ss=new simplestruct();
+check::classname(simplestruct,$ss);
+
+$as=new arraystruct();
+$as->array_c="abc";
+check::equal($as->array_c,"ab",'$as->array_c=="ab"');
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/arrays_scope_runme.php4 b/Examples/test-suite/php4/arrays_scope_runme.php4
new file mode 100644
index 000000000..7d2172c72
--- /dev/null
+++ b/Examples/test-suite/php4/arrays_scope_runme.php4
@@ -0,0 +1,17 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "arrays_scope.php";
+
+// No new functions
+check::functions(array());
+// No new classes
+check::classes(array(bar));
+// now new vars
+check::globals(array());
+
+$bar=new bar();
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/bool_default_runme.php4 b/Examples/test-suite/php4/bool_default_runme.php4
new file mode 100644
index 000000000..42eadea4f
--- /dev/null
+++ b/Examples/test-suite/php4/bool_default_runme.php4
@@ -0,0 +1,20 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "bool_default.php";
+
+// No new functions
+check::functions(array(foo));
+// No new classes
+check::classes(array());
+// now new vars
+check::globals(array());
+
+check::equal(false,foo(),"foo()==false");
+check::equal(false,foo(1),"foo(1)==false");
+check::equal(false,foo(true),"foo(true)==false");
+check::equal(true,foo(false),"foo(false)==true");
+check::equal(true,foo(0),"foo(0)==true");
+check::done();
+?>
diff --git a/Examples/test-suite/php4/casts_runme.php4 b/Examples/test-suite/php4/casts_runme.php4
new file mode 100644
index 000000000..bcda296af
--- /dev/null
+++ b/Examples/test-suite/php4/casts_runme.php4
@@ -0,0 +1,19 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "casts.php";
+
+// No new functions
+check::functions(array());
+// No new classes
+check::classes(array(a,b));
+// now new vars
+check::globals(array());
+
+# Make sure $b inherites hello() from class A
+$b=new B();
+$b->hello();
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/class_ignore_runme.php4 b/Examples/test-suite/php4/class_ignore_runme.php4
new file mode 100644
index 000000000..2a202fe1b
--- /dev/null
+++ b/Examples/test-suite/php4/class_ignore_runme.php4
@@ -0,0 +1,19 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "class_ignore.php";
+
+// No new functions
+check::functions(array(do_blah));
+// No new classes
+check::classes(array(bar));
+// now new vars
+check::globals(array());
+
+$bar=new bar();
+do_blah($bar);
+check::classparent($bar,"");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/conversion_namespace_runme.php4 b/Examples/test-suite/php4/conversion_namespace_runme.php4
new file mode 100644
index 000000000..50f1539ec
--- /dev/null
+++ b/Examples/test-suite/php4/conversion_namespace_runme.php4
@@ -0,0 +1,14 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "conversion_namespace.php";
+
+check::classes(array("foo","bar"));
+$bar=new Bar;
+check::classname("bar",$bar);
+$foo=$bar->toFoo();
+check::classname("foo",$foo);
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/conversion_ns_template_runme.php4 b/Examples/test-suite/php4/conversion_ns_template_runme.php4
new file mode 100644
index 000000000..3493a3521
--- /dev/null
+++ b/Examples/test-suite/php4/conversion_ns_template_runme.php4
@@ -0,0 +1,10 @@
+<?php
+
+require "tests.php4";
+require "conversion_ns_template.php";
+
+check::classes(array("foo_one","bar_one"));
+// this is too hard, I'm not sure what to test for,
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/conversion_runme.php4 b/Examples/test-suite/php4/conversion_runme.php4
new file mode 100644
index 000000000..ef2a11c9d
--- /dev/null
+++ b/Examples/test-suite/php4/conversion_runme.php4
@@ -0,0 +1,14 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "conversion.php";
+
+check::classes(array("foo","bar"));
+$bar=new Bar;
+check::classname("bar",$bar);
+$foo=$bar->toFoo();
+check::classname("foo",$foo);
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/cpp_static_runme.php4 b/Examples/test-suite/php4/cpp_static_runme.php4
new file mode 100644
index 000000000..da42efd91
--- /dev/null
+++ b/Examples/test-suite/php4/cpp_static_runme.php4
@@ -0,0 +1,15 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "cpp_static.php";
+
+// No new functions
+check::functions(array());
+// No new classes
+check::classes(array(staticmembertest,staticfunctiontest));
+// now new vars
+check::globals(array());
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/enum_scope_runme.php4 b/Examples/test-suite/php4/enum_scope_runme.php4
new file mode 100644
index 000000000..eaa0c0179
--- /dev/null
+++ b/Examples/test-suite/php4/enum_scope_runme.php4
@@ -0,0 +1,17 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "enum_scope.php";
+
+check::classes("tree");
+check::functions("chops");
+check::equal(0,Tree_Oak,"0==Tree_Oak");
+check::equal(1,Tree_Fir,"1==Tree_Fir");
+check::equal(2,Tree_Cedar,"2==Tree_Cedar");
+check::equal(Tree_Oak,chops(Tree_Oak),"Tree_Oak==chops(Tree_Oak)");
+check::equal(Tree_Fir,chops(Tree_Fir),"Tree_Fir==chops(Tree_Fir)");
+check::equal(Tree_Cedar,chops(Tree_Cedar),"Tree_Cedar==chops(Tree_Cedar)");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/enum_scope_template_runme.php4 b/Examples/test-suite/php4/enum_scope_template_runme.php4
new file mode 100644
index 000000000..5f5d53540
--- /dev/null
+++ b/Examples/test-suite/php4/enum_scope_template_runme.php4
@@ -0,0 +1,17 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "enum_scope_template.php";
+
+check::classes("treeint");
+check::functions("chops");
+check::equal(0,TreeInt_Oak,"0==TreeInt_Oak");
+check::equal(1,TreeInt_Fir,"0==TreeInt_Fir");
+check::equal(2,TreeInt_Cedar,"0==TreeInt_Cedar");
+check::equal(TreeInt_Oak,chops(TreeInt_Oak),"TreeInt_Oak==chops(TreeInt_Oak)");
+check::equal(TreeInt_Fir,chops(TreeInt_Fir),"TreeInt_Fir==chops(TreeInt_Fir)");
+check::equal(TreeInt_Cedar,chops(TreeInt_Cedar),"TreeInt_Cedar==chops(TreeInt_Cedar)");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/evil_diamond_ns_runme.php4 b/Examples/test-suite/php4/evil_diamond_ns_runme.php4
new file mode 100644
index 000000000..ba24e9b00
--- /dev/null
+++ b/Examples/test-suite/php4/evil_diamond_ns_runme.php4
@@ -0,0 +1,19 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "evil_diamond_ns.php";
+
+check::classes(array("foo","bar","baz","spam"));
+check::functions("test");
+check::is_a("bar","foo");
+check::is_a("baz","foo");
+check::is_a("spam","foo");
+check::is_a("spam","bar");
+//No multiple inheritance
+//check::is_a("spam","baz");
+$spam=new spam();
+$_spam=test($spam);
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/evil_diamond_prop_runme.php4 b/Examples/test-suite/php4/evil_diamond_prop_runme.php4
new file mode 100644
index 000000000..971f98c10
--- /dev/null
+++ b/Examples/test-suite/php4/evil_diamond_prop_runme.php4
@@ -0,0 +1,38 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "evil_diamond_prop.php";
+
+check::classes(array("foo","bar","baz","spam"));
+check::functions("test");
+check::is_a("bar","foo");
+check::is_a("baz","foo");
+check::is_a("spam","foo");
+check::is_a("spam","bar");
+//No multiple inheritance introspection yet
+//check::is_a("spam","baz");
+
+$foo=new foo();
+check::is_a($foo,"foo");
+check::equal(1,$foo->_foo,"1==foo->_foo");
+
+$bar=new bar();
+check::is_a($bar,"bar");
+check::equal(1,$bar->_foo,"1==bar->_foo");
+check::equal(2,$bar->_bar,"2==bar->_bar");
+
+$baz=new baz();
+check::is_a($baz,"baz");
+check::equal(1,$baz->_foo,"1==baz->_foo");
+check::equal(3,$baz->_baz,"3==baz->_baz");
+
+$spam=new spam();
+check::is_a($spam,"spam");
+check::equal(1,$spam->_foo,"1==spam->_foo");
+check::equal(2,$spam->_bar,"2==spam->_bar");
+check::equal(3,$spam->_baz,"3==spam->_baz");
+check::equal(4,$spam->_spam,"4==spam->_spam");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/evil_diamond_runme.php4 b/Examples/test-suite/php4/evil_diamond_runme.php4
new file mode 100644
index 000000000..45da10115
--- /dev/null
+++ b/Examples/test-suite/php4/evil_diamond_runme.php4
@@ -0,0 +1,17 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "evil_diamond.php";
+
+check::classes(array("foo","bar","baz","spam"));
+check::functions("test");
+check::is_a("bar","foo");
+check::is_a("baz","foo");
+check::is_a("spam","foo");
+check::is_a("spam","bar");
+//No multiple inheritance
+//check::is_a("spam","baz");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/extend_template_ns_runme.php4 b/Examples/test-suite/php4/extend_template_ns_runme.php4
new file mode 100644
index 000000000..e15170e7e
--- /dev/null
+++ b/Examples/test-suite/php4/extend_template_ns_runme.php4
@@ -0,0 +1,13 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "extend_template_ns.php";
+
+check::classes(array("foo_one"));
+$foo=new Foo_One();
+check::equal(2,$foo->test1(2),"test1");
+check::equal(3,$foo->test2(3),"test2");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/extend_template_runme.php4 b/Examples/test-suite/php4/extend_template_runme.php4
new file mode 100644
index 000000000..93944f616
--- /dev/null
+++ b/Examples/test-suite/php4/extend_template_runme.php4
@@ -0,0 +1,13 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "extend_template.php";
+
+check::classes(array("foo_0"));
+$foo=new Foo_0();
+check::equal(2,$foo->test1(2),"test1");
+check::equal(3,$foo->test2(3),"test2");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/grouping_runme.php4 b/Examples/test-suite/php4/grouping_runme.php4
new file mode 100644
index 000000000..832b3df0e
--- /dev/null
+++ b/Examples/test-suite/php4/grouping_runme.php4
@@ -0,0 +1,24 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "grouping.php";
+
+check::functions(array("test1","test2","do_unary","negate"));
+check::equal(5,test1(5),"5==test1(5)");
+check::resource(test2(7),"_p_int","_p_int==test2(7)");
+check::globals(array(test3));
+
+//check::equal(37,test3_get(),'37==test3_get()');
+check::equal(37,check::get("test3"),'37==get(test3)');
+//test3_set(38);
+check::set(test3,38);
+//check::equal(38,test3_get(),'38==test3_get() after test3_set(37)');
+check::equal(38,check::get(test3),'38==get(test3) after set(test)');
+
+check::equal(-5,negate(5),"-5==negate(5)");
+check::functionref(NEGATE,"_p_UnaryOp","NEGATE=_p_UnaryOp");
+check::equal(7,do_unary(-7,NEGATE),"7=do_unary(-7,NEGATE)");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/ignore_parameter_runme.php4 b/Examples/test-suite/php4/ignore_parameter_runme.php4
new file mode 100644
index 000000000..8a2bf899e
--- /dev/null
+++ b/Examples/test-suite/php4/ignore_parameter_runme.php4
@@ -0,0 +1,39 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "ignore_parameter.php";
+
+// No new functions
+check::functions(array(jaguar,lotus,tvr,ferrari));
+// No new classes
+check::classes(array(sportscars,minicooper,morrisminor,fordanglia,austinallegro));
+// now new vars
+check::globals(array());
+
+check::equal(jaguar(2,3.4),"hello",'jaguar(2,3.4)=="hello"');
+check::equal(lotus("eek",3.4),101,'lotus("eek",3.4)==101');
+check::equal(tvr("eek",2),8.8,'tvr("eek",2)==8.8');
+check::equal(ferrari(),101,'ferrari(2)==101');
+
+$sc=new sportscars();
+check::classname("sportscars",$sc);
+check::equal($sc->daimler(2,3.4),"hello",'$sc->daimler(2,3.4)=="hello"');
+check::equal($sc->astonmartin("eek",3.4),101,'$sc->mastonmartin("eek",3.4)==101');
+check::equal($sc->bugatti("eek",2),8.8,'$sc->bugatti("eek",2)==8.8');
+check::equal($sc->lamborghini(),101,'$sc->lamborghini(2)==101');
+
+$mc=new minicooper(2,3.4);
+check::classname("minicooper",$mc);
+
+$mm=new morrisminor("eek",3.4);
+check::classname("morrisminor",$mm);
+
+$fa=new fordanglia("eek",2);
+check::classname("fordanglia",$fa);
+
+$aa=new austinallegro();
+check::classname("austinallegro",$aa);
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/lib_carrays_runme.php4 b/Examples/test-suite/php4/lib_carrays_runme.php4
new file mode 100644
index 000000000..134dbc251
--- /dev/null
+++ b/Examples/test-suite/php4/lib_carrays_runme.php4
@@ -0,0 +1,15 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "lib_carrays.php";
+
+// No new functions
+check::functions(array(new_intarray,delete_intarray,intarray_getitem,intarray_setitem));
+// No new classes
+check::classes(array(doublearray));
+// now new vars
+check::globals(array());
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/rename_scope_runme.php4 b/Examples/test-suite/php4/rename_scope_runme.php4
new file mode 100644
index 000000000..0be22ee96
--- /dev/null
+++ b/Examples/test-suite/php4/rename_scope_runme.php4
@@ -0,0 +1,17 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "rename_scope.php";
+
+check::classes(array("interface_up","interface_bp","natural_up","natural_bp"));
+
+check::classmethods("Interface_UP",array("interface_up"));
+check::classmethods("Interface_BP",array("interface_bp"));
+check::classmethods("Natural_UP",array("interface_up","natural_up","rtest"));
+check::classmethods("Natural_BP",array("interface_bp","natural_bp","rtest"));
+check::classparent("Natural_UP","interface_up");
+check::classparent("Natural_BP","interface_bp");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/skel.php4 b/Examples/test-suite/php4/skel.php4
new file mode 100644
index 000000000..d6f33758d
--- /dev/null
+++ b/Examples/test-suite/php4/skel.php4
@@ -0,0 +1,15 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "____.php";
+
+// No new functions
+check::functions(array());
+// No new classes
+check::classes(array());
+// now new vars
+check::globals(array());
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/smart_pointer_rename_runme.php4 b/Examples/test-suite/php4/smart_pointer_rename_runme.php4
new file mode 100644
index 000000000..a8b600ab2
--- /dev/null
+++ b/Examples/test-suite/php4/smart_pointer_rename_runme.php4
@@ -0,0 +1,28 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "smart_pointer_rename.php";
+
+check::classes(array("foo","bar"));
+check::classmethods("foo",array("foo","ftest1","ftest2"));
+check::classmethods("bar",array("__deref__","bar","test","ftest1","ftest2"));
+$foo=new foo();
+check::classname("foo",$foo);
+$bar=new bar($foo);
+check::classname("bar",$bar);
+
+# check foo's ftest1, ftest2
+check::equal(1,$foo->ftest1(1),"foo->ftest1");
+check::equal(2,$foo->ftest2(1,2),"foo->ftest2");
+
+# check bar's ftest1, ftest2, ftest
+check::equal(1,$bar->ftest1(1),"bar->ftest1");
+check::equal(2,$bar->ftest2(1,2),"bar->ftest2");
+check::equal(3,$bar->test(),"bar->test");
+
+# check deref returns foo
+check::classname("foo",$bar->__deref__());
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/sym_runme.php4 b/Examples/test-suite/php4/sym_runme.php4
new file mode 100644
index 000000000..ce89ea4b2
--- /dev/null
+++ b/Examples/test-suite/php4/sym_runme.php4
@@ -0,0 +1,23 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "sym.php";
+
+// No new functions
+check::functions(array());
+// No new classes
+check::classes(array(flim,flam));
+// now new vars
+check::globals(array());
+
+$flim=new flim();
+$flam=new flam();
+
+check::equal($flim->hulahoops(),"flim-jam","flim()->hulahoops==flim-jam");
+check::equal($flim->jar(),"flim-jar","flim()->jar==flim-jar");
+check::equal($flam->jam(),"flam-jam","flam()->jam==flam-jam");
+check::equal($flam->jar(),"flam-jar","flam()->jar==flam-jar");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/template_arg_typename_runme.php4 b/Examples/test-suite/php4/template_arg_typename_runme.php4
new file mode 100644
index 000000000..eb83badb6
--- /dev/null
+++ b/Examples/test-suite/php4/template_arg_typename_runme.php4
@@ -0,0 +1,19 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "template_arg_typename.php";
+
+// No new functions
+check::functions(array());
+// No new classes
+check::classes(array(unaryfunction_bool_bool,boolunaryfunction_bool));
+$ufbb=new unaryfunction_bool_bool();
+check::is_a($ufbb,"unaryfunction_bool_bool");
+
+unset($whatisthis);
+$bufb=new boolunaryfunction_bool(&$whatisthis);
+check::is_a($bufb,"boolunaryfunction_bool");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/template_construct_runme.php4 b/Examples/test-suite/php4/template_construct_runme.php4
new file mode 100644
index 000000000..95316832d
--- /dev/null
+++ b/Examples/test-suite/php4/template_construct_runme.php4
@@ -0,0 +1,11 @@
+<?php
+
+require "tests.php4";
+require "template_construct.php";
+
+check::classes(array(foo_int));
+$foo_int=new foo_int(3);
+check::is_a($foo_int,"foo_int","Made a foo_int");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/tests.php4 b/Examples/test-suite/php4/tests.php4
new file mode 100644
index 000000000..13c732042
--- /dev/null
+++ b/Examples/test-suite/php4/tests.php4
@@ -0,0 +1,217 @@
+<?php
+
+// do we have true global vars or just GETSET functions?
+// Used to filter out get/set global functions to fake vars...
+define(GETSET,1);
+
+$_original_functions=get_defined_functions();
+$_original_globals=1;
+$_original_classes=get_declared_classes();
+$_original_globals=array_keys($GLOBALS);
+
+class check {
+ function get_extra_classes($ref=FALSE) {
+ static $extra;
+ global $_original_classes;
+ if ($ref===FALSE) $f=$_original_classes;
+ if (! is_array($extra)) {
+ $df=array_flip(get_declared_classes());
+ foreach($_original_classes as $class) unset($df[$class]);
+ $extra=array_keys($df);
+ }
+ return $extra;
+ }
+
+ function get_extra_functions($ref=FALSE,$gs=false) {
+ static $extra;
+ static $extrags; // for get/setters
+ global $_original_functions;
+ if ($ref===FALSE) $f=$_original_functions;
+ if (! is_array($extra) || $gs) {
+ $extra=array();
+ $extrags=array();
+ $df=get_defined_functions();
+ $df=array_flip($df[internal]);
+ foreach($_original_functions[internal] as $func) unset($df[$func]);
+ // Now chop out any get/set accessors
+ foreach(array_keys($df) as $func) if (GETSET && ereg('_[gs]et$',$func)) $extrags[]=$func;
+ else $extra[]=$func;
+// $extra=array_keys($df);
+ }
+ if ($gs) return $extrags;
+ return $extra;
+ }
+
+ function get_extra_globals($ref=FALSE) {
+ static $extra;
+ global $_original_globals;
+ if (! is_array($extra)) {
+ if (GETSET) {
+ $_extra=array();
+ foreach(check::get_extra_functions(false,1) as $global) {
+ if (ereg('^(.*)_[sg]et$',$global,$match)) $_extra[$match[1]]=1;
+ }
+ $extra=array_keys($_extra);
+ } else {
+ if ($ref===FALSE) $ref=$_original_globals;
+ if (! is_array($extra)) {
+ $df=array_flip(array_keys($GLOBALS));
+ foreach($_original_globals as $func) unset($df[$func]);
+ // MASK xxxx_LOADED__ variables
+ foreach(array_keys($df) as $func) if (ereg('_LOADED__$',$func)) unset($df[$func]);
+ $extra=array_keys($df);
+ }
+ }
+ }
+ return $extra;
+ }
+
+ function classname($string,$object) {
+ if ($string!=($classname=get_class($object))) return check::fail("Object: $object is of class %s not class %s",$classname,$string);
+ return TRUE;
+ }
+
+ function classmethods($classname,$methods) {
+ if (is_object($classname)) $classname=get_class($classname);
+ $classmethods=array_flip(get_class_methods($classname));
+ $missing=array();
+ $extra=array();
+ foreach($methods as $method) {
+ if (! isset($classmethods[$method])) $missing[]=$method;
+ else unset($classmethods[$method]);
+ }
+ $extra=array_keys($classmethods);
+ if ($missing) $message[]="does not have these methods:\n ".join(",",$missing);
+ if ($extra) $message[]="does have these extra methods:\n ".join(",",$extra);
+ if ($message) {
+ return check::fail("Class %s %s\nFull class list:\n %s\n",$classname,join("\nbut ",$message),join("\n ",get_class_methods($classname)));
+ }
+ return TRUE;
+ }
+
+ function set($var,$value) {
+ $func=$var."_set";
+ if (GETSET) $func($value);
+ else $_GLOBALS[$var]=$value;
+ }
+
+ function &get($var) {
+ $func=$var."_get";
+ if (GETSET) return $func();
+ else return $_GLOBALS[$var];
+ }
+
+ function is_a($a,$b) {
+ if (is_object($a)) $a=strtolower(get_class($a));
+ if (is_object($b)) $a=strtolower(get_class($b));
+ $parents=array();
+ $c=$a;
+ while($c!=$b && $c) {
+ $parents[]=$c;
+ $c=strtolower(get_parent_class($c));
+ }
+ if ($c!=$b) return check::fail("Class $a does not inherit from class $b\nHierachy:\n %s\n",join("\n ",$parents));
+ return TRUE;
+ }
+
+ function classparent($a,$b) {
+ if (is_object($a)) $a=get_class($a);
+ if (is_object($b)) $a=get_class($b);
+ $parent=get_parent_class($a);
+
+ if ($parent!=$b) return check::fail("Class $a parent not actually $b but $parent");
+ return TRUE;
+ }
+
+ function classes($classes) {
+ if (! is_array($classes)) $classes=array($classes);
+ $message=array();
+ $missing=array();
+ $extra=array_flip(check::get_extra_classes());
+ foreach($classes as $class) {
+ if (! class_exists($class)) $missing[]=$class;
+ else unset($extra[$class]);
+ }
+ if ($missing) $message[]=sprintf("Classes missing: %s",join(",",$missing));
+ if ($extra) $message[]=sprintf("These extra classes are defined: %s",join(",",array_keys($extra)));
+ if ($message) return check::fail(join("\n ",$message));
+ return TRUE;
+ }
+
+ function functions($functions) {
+ if (! is_array($functions)) $functions=array($functions);
+ $message=array();
+ $missing=array();
+ $extra=array_flip(check::get_extra_functions());
+
+ foreach ($functions as $func) {
+ if (! function_exists($func)) $missing[]=$func;
+ else unset($extra[$func]);
+ }
+ if ($missing) $message[]=sprintf("Functions missing: %s",join(",",$missing));
+ if ($extra) $message[]=sprintf("These extra methods are defined: %s",join(",",array_keys($extra)));
+ if ($message) return check::fail(join("\n ",$message));
+ return TRUE;
+ }
+
+ function globals($globals) {
+ if (! is_array($globals)) $globals=array($globals);
+ $message=array();
+ $missing=array();
+ $extra=array_flip(check::get_extra_globals());
+ foreach ($globals as $glob) {
+ if (GETSET) {
+ if (! isset($extra[$glob])) $missing[]=$glob;
+ else unset($extra[$glob]);
+ } else {
+ if (! isset($GLOBALS[$glob])) $missing[]=$glob;
+ else unset($extra[$glob]);
+ }
+ }
+ if ($missing) $message[]=sprintf("Globals missing: %s",join(",",$missing));
+ if ($extra) $message[]=sprintf("These extra globals are defined: %s",join(",",array_keys($extra)));
+ if ($message) return check::fail(join("\n ",$message));
+ return TRUE;
+
+ }
+
+ function functionref($a,$type,$message) {
+ if (! eregi("^_[a-f0-9]+$type$",$a)) return check::fail($message);
+ return TRUE;
+ }
+
+ function equal($a,$b,$message) {
+ if (! ($a===$b)) return check::fail($message);
+ return TRUE;
+ }
+
+ function resource($a,$b,$message) {
+ $resource=trim(check::var_dump($a));
+ if (! eregi("^resource\([0-9]+\) of type \($b\)",$resource)) return check::fail($message);
+ return TRUE;
+ }
+
+ function isnull($a,$message) {
+ $value=trim(check::var_dump($a));
+ return check::equal($value,"NULL",$message);
+ }
+
+ function var_dump($arg) {
+ ob_start();
+ var_dump($arg);
+ $result=ob_get_contents();
+ ob_end_clean();
+ return $result;
+ }
+
+ function fail($pattern) {
+ $args=func_get_args();
+ print("Failed on: ".call_user_func_array("sprintf",$args)."\n");
+ exit(1);
+ }
+
+ function done() {
+ print $_SERVER[argv][0]." ok\n";
+ }
+}
+?>
diff --git a/Examples/test-suite/php4/typedef_reference_runme.php4 b/Examples/test-suite/php4/typedef_reference_runme.php4
new file mode 100644
index 000000000..2c64efce6
--- /dev/null
+++ b/Examples/test-suite/php4/typedef_reference_runme.php4
@@ -0,0 +1,13 @@
+<?php
+
+require "tests.php4";
+require "typedef_reference.php";
+
+check::functions(array(somefunc,otherfunc,new_intp,copy_intp,delete_intp,intp_assign,intp_value));
+$int2=copy_intp(2);
+check::equal(2,somefunc($int2)," test passing intp to somefunc");
+$int3=copy_intp(3);
+check::equal(3,otherfunc($int3)," test passing intp to otherfunc");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/typemap_ns_using_runme.php4 b/Examples/test-suite/php4/typemap_ns_using_runme.php4
new file mode 100644
index 000000000..44403d138
--- /dev/null
+++ b/Examples/test-suite/php4/typemap_ns_using_runme.php4
@@ -0,0 +1,9 @@
+<?php
+
+require "tests.php4";
+require "typemap_ns_using.php";
+if (! class_exists("_fooimpl")) die("_fooimpl class not found\n");
+if (! 3==spam(3)) die("spam function not working right\n");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/using1_runme.php4 b/Examples/test-suite/php4/using1_runme.php4
new file mode 100644
index 000000000..ed7e32b06
--- /dev/null
+++ b/Examples/test-suite/php4/using1_runme.php4
@@ -0,0 +1,9 @@
+<?php
+
+require "tests.php4";
+require "using1.php";
+if (! class_exists("_fooimpl")) die("_fooimpl class not found\n");
+if (! 3==spam(3)) die("spam function not working right\n");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/using2_runme.php4 b/Examples/test-suite/php4/using2_runme.php4
new file mode 100644
index 000000000..e57f0ce9a
--- /dev/null
+++ b/Examples/test-suite/php4/using2_runme.php4
@@ -0,0 +1,9 @@
+<?php
+
+require "tests.php4";
+require "using2.php";
+if (! class_exists("_fooimpl")) die("_fooimpl class not found\n");
+if (! 3==spam(3)) die("spam function not working right\n");
+
+check::done();
+?>
diff --git a/Examples/test-suite/php4/valuewrapper_base_runme.php4 b/Examples/test-suite/php4/valuewrapper_base_runme.php4
new file mode 100644
index 000000000..3cbef0dbb
--- /dev/null
+++ b/Examples/test-suite/php4/valuewrapper_base_runme.php4
@@ -0,0 +1,14 @@
+<?php
+// Sample test file
+
+require "tests.php4";
+require "valuewrapper_base.php";
+
+check::classes(array("base","interface_bp"));
+check::functions("make_interface_bp");
+
+$ibp=make_interface_bp();
+check::classname("interface_bp",$ibp);
+
+check::done();
+?>
diff --git a/Examples/test-suite/pike/Makefile b/Examples/test-suite/pike/Makefile
new file mode 100644
index 000000000..477230808
--- /dev/null
+++ b/Examples/test-suite/pike/Makefile
@@ -0,0 +1,44 @@
+#######################################################################
+# $Header$
+# Makefile for Pike test-suite
+#######################################################################
+
+LANGUAGE = pike
+SCRIPTSUFFIX = _runme.pike
+
+include ../common.mk
+
+# Overridden variables here
+TARGETSUFFIX =
+SWIGOPT = -I$(TOP)/$(TEST_SUITE)
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup) \
+ ($(swig_and_compile_cpp); ); \
+ $(run_testcase)
+
+%.ctest:
+ $(setup) \
+ ($(swig_and_compile_c); ); \
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup) \
+ ($(swig_and_compile_multi_cpp); ); \
+ $(run_testcase)
+
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.pike appended after the testcase name.
+run_testcase = \
+ if [ -f $*\_runme.pike ]; then ( \
+ env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH pike $*\_runme.pike;) \
+ fi;
+
+# Clean: remove the generated .pike file
+%.clean:
+ @rm -f $*.pike;
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile pike_clean
+
diff --git a/Examples/test-suite/pointer_in_out.i b/Examples/test-suite/pointer_in_out.i
new file mode 100644
index 000000000..f4b1ed440
--- /dev/null
+++ b/Examples/test-suite/pointer_in_out.i
@@ -0,0 +1,35 @@
+/* This file tests the pointer-in-out typemap library,
+ currently only available for Guile. */
+
+%module pointer_in_out
+
+%include "pointer-in-out.i"
+
+TYPEMAP_POINTER_INPUT_OUTPUT(int *, int-pointer);
+
+int consume_int_pointer(int **INPUT);
+void produce_int_pointer(int **OUTPUT, int value1, int value2);
+void frobnicate_int_pointer(int **INOUT);
+
+%{
+
+int consume_int_pointer(int **INPUT)
+{
+ return **INPUT;
+}
+
+void produce_int_pointer(int **OUTPUT, int value1, int value2)
+{
+ int *foo = malloc(2 * sizeof(int));
+ foo[0] = value1;
+ foo[1] = value2;
+ *OUTPUT = foo;
+}
+
+void frobnicate_int_pointer(int **INOUT)
+{
+ /* advance the pointer */
+ (*INOUT)++;
+}
+
+%}
diff --git a/Examples/test-suite/pointer_reference.i b/Examples/test-suite/pointer_reference.i
new file mode 100644
index 000000000..5d233e5a7
--- /dev/null
+++ b/Examples/test-suite/pointer_reference.i
@@ -0,0 +1,17 @@
+/* This interface file tests whether SWIG handles pointer-reference
+ (*&) arguments.
+
+ SWIG 1.3a5 signals a syntax error.
+*/
+
+%module pointer_reference
+
+#ifdef SWIGGUILE
+/* A silly testing typemap for feeding a doubly indirect integer */
+%typemap(in) int *&XYZZY (int temp1, int *temp2)
+ "temp1 = gh_scm2int($input); temp2 = &temp1; $1 = &temp2;";
+#endif
+
+%inline %{
+void foo(int *&XYZZY) {}
+%}
diff --git a/Examples/test-suite/preproc_1.i b/Examples/test-suite/preproc_1.i
new file mode 100644
index 000000000..134cae666
--- /dev/null
+++ b/Examples/test-suite/preproc_1.i
@@ -0,0 +1,10 @@
+/* This interface file tests whether SWIG's extended C
+ preprocessor is working right.
+
+ In this example, SWIG 1.3.6 chokes on "//" in a #define with a
+ syntax error.
+*/
+
+%module preproc_1
+
+#define SLASHSLASH "//"
diff --git a/Examples/test-suite/preproc_2.i b/Examples/test-suite/preproc_2.i
new file mode 100644
index 000000000..ca5e4c1cb
--- /dev/null
+++ b/Examples/test-suite/preproc_2.i
@@ -0,0 +1,22 @@
+/* This SWIG -*- c -*- interface is to test for some strange
+ preprocessor bug.
+
+ I get syntax errors unless I remove the apostrophe in the comment
+ or the sharp-sign substitution. (The apostrophe seems to disable
+ sharp-sign substitution.)
+*/
+
+%module preproc_2;
+
+%define TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(SCM_TYPE)
+
+ /* Don't check for NULL pointers (override checks). */
+
+ %typemap(argout, doc="($arg <vector of <" #SCM_TYPE ">>)")
+ int *VECTORLENOUTPUT
+ {
+ }
+
+%enddef
+
+TYPEMAP_LIST_VECTOR_INPUT_OUTPUT(boolean)
diff --git a/Examples/test-suite/preproc_3.i b/Examples/test-suite/preproc_3.i
new file mode 100644
index 000000000..f6135f3a2
--- /dev/null
+++ b/Examples/test-suite/preproc_3.i
@@ -0,0 +1,6 @@
+%module preproc_3
+
+#define Sum( A, B, \
+ C) \
+ A + B + C
+
diff --git a/Examples/test-suite/primitive_ref.i b/Examples/test-suite/primitive_ref.i
new file mode 100644
index 000000000..f6a7070c8
--- /dev/null
+++ b/Examples/test-suite/primitive_ref.i
@@ -0,0 +1,26 @@
+// Tests passing of references to primitive datatypes
+%module primitive_ref
+
+%define ref(type,name)
+%inline %{
+const type &ref_##name(const type &x) {
+ static type y = x;
+ return y;
+}
+%}
+%enddef
+
+ref(int,int);
+ref(unsigned int, uint);
+ref(short, short);
+ref(unsigned short, ushort);
+ref(long,long);
+ref(unsigned long, ulong);
+ref(signed char, schar);
+ref(unsigned char, uchar);
+ref(char, char);
+ref(float, float);
+ref(double, double);
+ref(bool, bool);
+ref(long long, longlong);
+ref(unsigned long long, ulonglong);
diff --git a/Examples/test-suite/private_assign.i b/Examples/test-suite/private_assign.i
new file mode 100644
index 000000000..6f95df0fb
--- /dev/null
+++ b/Examples/test-suite/private_assign.i
@@ -0,0 +1,21 @@
+// A class with a private assignment operator.
+// This is rare, but sometimes used with singletons and
+// objects that have complicated state.
+
+%module private_assign
+
+%inline %{
+ class Foo {
+ private:
+ Foo &operator=(const Foo &f) {
+ return *this;
+ }
+ public:
+ void bar() { }
+ };
+
+ Foo blah() {
+ return Foo();
+ };
+%}
+
diff --git a/Examples/test-suite/pure_virtual.i b/Examples/test-suite/pure_virtual.i
new file mode 100644
index 000000000..1dd148041
--- /dev/null
+++ b/Examples/test-suite/pure_virtual.i
@@ -0,0 +1,74 @@
+/* SF Bug #445219, submitted by Krzysztof Kozminski
+ <kozminski@users.sf.net>.
+
+ Swig 1.3.6 gets confused by pure virtual destructors,
+ as in this file:
+*/
+
+%module pure_virtual
+
+%warnfilter(802) E; /* Ruby, multiple inheritance */
+
+%nodefault C;
+%nodefault E;
+
+%inline %{
+
+class A {
+ public:
+ A() { };
+ virtual ~A() = 0;
+ virtual void something() = 0;
+ virtual void method() = 0;
+};
+
+class B : public A {
+public:
+ B() {};
+ virtual ~B() { };
+ virtual void something() { };
+ virtual void method() { };
+};
+
+/* class C is abstract because it doesn't define all methods in A */
+class C : public A {
+ public:
+ virtual ~C() { };
+ virtual void method() { };
+}
+;
+
+/* class D is not abstract, it defines everything */
+class D : public C {
+ public:
+ virtual ~D() { };
+ virtual void something() { };
+}
+;
+
+/* Another abstract class */
+class AA {
+ public:
+ virtual void method2() = 0;
+};
+
+/* Multiple inheritance between two abstract classes */
+#ifndef SWIGJAVA
+class E : public C, public AA {
+public:
+ virtual void something() { };
+};
+
+/* Fill in method from AA. This class should be constructable */
+class F : public E {
+ public:
+ virtual void method2() { }
+};
+#endif
+
+%}
+
+%{
+A::~A() {}
+%}
+
diff --git a/Examples/test-suite/python/.cvsignore b/Examples/test-suite/python/.cvsignore
new file mode 100644
index 000000000..0e238873e
--- /dev/null
+++ b/Examples/test-suite/python/.cvsignore
@@ -0,0 +1,5 @@
+*wrap*
+*.py
+*.pyc
+*.so
+*.dll
diff --git a/Examples/test-suite/python/Makefile b/Examples/test-suite/python/Makefile
new file mode 100644
index 000000000..6c563548c
--- /dev/null
+++ b/Examples/test-suite/python/Makefile
@@ -0,0 +1,44 @@
+#######################################################################
+# $Header$
+# Makefile for python test-suite
+#######################################################################
+
+LANGUAGE = python
+SCRIPTSUFFIX = _runme.py
+
+include ../common.mk
+
+# Overridden variables here
+TARGETSUFFIX =
+SWIGOPT = -I$(TOP)/$(TEST_SUITE)
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup) \
+ ($(swig_and_compile_cpp); ); \
+ $(run_testcase)
+
+%.ctest:
+ $(setup) \
+ ($(swig_and_compile_c); ); \
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup) \
+ ($(swig_and_compile_multi_cpp); ); \
+ $(run_testcase)
+
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.py appended after the testcase name.
+run_testcase = \
+ if [ -f $*\_runme.py ]; then ( \
+ env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH python $*\_runme.py;) \
+ fi;
+
+# Clean: remove the generated .py file
+%.clean:
+ @rm -f $*.py;
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile python_clean
+
diff --git a/Examples/test-suite/python/README b/Examples/test-suite/python/README
new file mode 100644
index 000000000..b86ec5289
--- /dev/null
+++ b/Examples/test-suite/python/README
@@ -0,0 +1,4 @@
+See ../README for common README file.
+
+Any testcases which have _runme.py appended after the testcase name will be detected and run.
+
diff --git a/Examples/test-suite/python/abstract_typedef_runme.py b/Examples/test-suite/python/abstract_typedef_runme.py
new file mode 100644
index 000000000..15d70aa42
--- /dev/null
+++ b/Examples/test-suite/python/abstract_typedef_runme.py
@@ -0,0 +1,11 @@
+from abstract_typedef import *
+e = Engine()
+
+a = A()
+
+
+if a.write(e) != 1:
+ raise RuntimeError
+
+
+
diff --git a/Examples/test-suite/python/class_ignore_runme.py b/Examples/test-suite/python/class_ignore_runme.py
new file mode 100644
index 000000000..782fc07e1
--- /dev/null
+++ b/Examples/test-suite/python/class_ignore_runme.py
@@ -0,0 +1,6 @@
+import class_ignore
+
+a = class_ignore.Bar()
+
+if class_ignore.do_blah(a) != "Bar::blah":
+ raise RuntimeError
diff --git a/Examples/test-suite/python/constover_runme.py b/Examples/test-suite/python/constover_runme.py
new file mode 100644
index 000000000..5c5419706
--- /dev/null
+++ b/Examples/test-suite/python/constover_runme.py
@@ -0,0 +1,38 @@
+import constover
+import sys
+error = 0
+
+p = constover.test("test")
+if p != "test":
+ print "test failed!"
+ error = 1
+
+p = constover.test_pconst("test")
+if p != "test_pconst":
+ print "test_pconst failed!"
+ error = 1
+
+f = constover.Foo()
+p = f.test("test")
+if p != "test":
+ print "member-test failed!"
+ error = 1
+
+p = f.test_pconst("test")
+if p != "test_pconst":
+ print "member-test_pconst failed!"
+ error = 1
+
+p = f.test_constm("test")
+if p != "test_constmethod":
+ print "member-test_constm failed!"
+ error = 1
+
+p = f.test_pconstm("test")
+if p != "test_pconstmethod":
+ print "member-test_pconstm failed!"
+ error = 1
+
+sys.exit(error)
+
+
diff --git a/Examples/test-suite/python/cpp_namespace_runme.py b/Examples/test-suite/python/cpp_namespace_runme.py
new file mode 100644
index 000000000..3108b4f47
--- /dev/null
+++ b/Examples/test-suite/python/cpp_namespace_runme.py
@@ -0,0 +1,45 @@
+# Note: This example assumes that namespaces are flattened
+import cpp_namespace
+
+n = cpp_namespace.fact(4)
+if n != 24:
+ raise "Bad return value!"
+
+if cpp_namespace.cvar.Foo != 42:
+ raise "Bad variable value!"
+
+t = cpp_namespace.Test()
+if t.method() != "Test::method":
+ raise "Bad method return value!"
+
+if cpp_namespace.do_method(t) != "Test::method":
+ raise "Bad return value!"
+
+if cpp_namespace.do_method2(t) != "Test::method":
+ raise "Bad return value!"
+
+cpp_namespace.weird("hello", 4)
+
+del t
+
+t2 = cpp_namespace.Test2()
+t3 = cpp_namespace.Test3()
+t4 = cpp_namespace.Test4()
+t5 = cpp_namespace.Test5()
+
+if cpp_namespace.foo3(42) != 42:
+ raise "Bad return value!"
+
+if cpp_namespace.do_method3(t2,40) != "Test2::method":
+ raise "Bad return value!"
+
+if cpp_namespace.do_method3(t3,40) != "Test3::method":
+ raise "Bad return value!"
+
+if cpp_namespace.do_method3(t4,40) != "Test4::method":
+ raise "Bad return value!"
+
+if cpp_namespace.do_method3(t5,40) != "Test5::method":
+ raise "Bad return value!"
+
+
diff --git a/Examples/test-suite/python/default_constructor_runme.py b/Examples/test-suite/python/default_constructor_runme.py
new file mode 100644
index 000000000..d7d811d4c
--- /dev/null
+++ b/Examples/test-suite/python/default_constructor_runme.py
@@ -0,0 +1,96 @@
+import _default_constructor
+
+dc = _default_constructor
+
+a = dc.new_A
+del_a = dc.delete_A
+
+aa = dc.new_AA
+del_aa = dc.delete_AA
+
+b = dc.new_B
+del_b = dc.delete_B
+
+try:
+ bb = dc.new_BB;
+ print "Whoa. new_BB created."
+except AttributeError:
+ pass
+
+del_bb = dc.delete_BB
+
+try:
+ c = dc.new_C
+ print "Whoa. new_C created."
+except AttributeError:
+ pass
+
+del_c = dc.delete_C
+
+cc = dc.new_CC
+del_cc = dc.delete_CC
+
+try:
+ d = dc.new_D;
+ print "Whoa. new_D created"
+except AttributeError:
+ pass
+
+del_d = dc.delete_D
+
+try:
+ dd = dc.new_DD
+ print "Whoa. new_DD created"
+except AttributeError:
+ pass
+
+dd = dc.delete_DD
+
+try:
+ ad = dc.new_AD
+ print "Whoa. new_AD created"
+except AttributeError:
+ pass
+
+del_ad = dc.delete_AD
+
+e = dc.new_E
+del_e = dc.delete_E
+
+ee = dc.new_EE
+del_ee = dc.delete_EE
+
+try:
+ eb = dc.new_EB
+ print "Whoa. new_EB created"
+except AttributeError:
+ pass
+
+del_eb = dc.delete_EB
+
+f = dc.new_F
+
+try:
+ del_f = dc.delete_F
+ print "Whoa. delete_F created"
+except AttributeError:
+ pass
+
+ff = dc.new_FFF
+try:
+ del_ff = dc.delete_FFF
+ print "Whoa. delete_FFF created"
+except AttributeError:
+ pass
+
+g = dc.new_G
+
+try:
+ del_g = dc.delete_G
+ print "Whoa. delete_G created"
+except AttributeError:
+ pass
+
+gg = dc.new_GG
+del_gg = dc.delete_GG
+
diff --git a/Examples/test-suite/python/dynamic_cast_runme.py b/Examples/test-suite/python/dynamic_cast_runme.py
new file mode 100644
index 000000000..68b06db50
--- /dev/null
+++ b/Examples/test-suite/python/dynamic_cast_runme.py
@@ -0,0 +1,12 @@
+import dynamic_cast
+
+f = dynamic_cast.Foo()
+b = dynamic_cast.Bar()
+
+x = f.blah()
+y = b.blah()
+
+a = dynamic_cast.do_test(y)
+if a != "Bar::test":
+ print "Failed!!"
+
diff --git a/Examples/test-suite/python/enum_runme.py b/Examples/test-suite/python/enum_runme.py
new file mode 100644
index 000000000..6581167de
--- /dev/null
+++ b/Examples/test-suite/python/enum_runme.py
@@ -0,0 +1,7 @@
+
+import _enum
+
+_enum.bar2(1)
+_enum.bar3(1)
+_enum.bar1(1)
+
diff --git a/Examples/test-suite/python/extend_template_ns_runme.py b/Examples/test-suite/python/extend_template_ns_runme.py
new file mode 100644
index 000000000..5c5feac66
--- /dev/null
+++ b/Examples/test-suite/python/extend_template_ns_runme.py
@@ -0,0 +1,7 @@
+from extend_template_ns import *
+f = Foo_One()
+if f.test1(37) != 37:
+ raise RuntimeError
+
+if f.test2(42) != 42:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/extend_template_runme.py b/Examples/test-suite/python/extend_template_runme.py
new file mode 100644
index 000000000..be6e2fc98
--- /dev/null
+++ b/Examples/test-suite/python/extend_template_runme.py
@@ -0,0 +1,8 @@
+import extend_template
+
+f = extend_template.Foo_0()
+if f.test1(37) != 37:
+ raise RuntimeError
+
+if f.test2(42) != 42:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/grouping_runme.py b/Examples/test-suite/python/grouping_runme.py
new file mode 100644
index 000000000..13f8c8c92
--- /dev/null
+++ b/Examples/test-suite/python/grouping_runme.py
@@ -0,0 +1,13 @@
+import grouping
+
+x = grouping.test1(42)
+if x != 42:
+ raise RuntimeError
+
+grouping.test2(42)
+
+x = grouping.do_unary(37, grouping.NEGATE)
+if x != -37:
+ raise RuntimeError
+
+grouping.cvar.test3 = 42
diff --git a/Examples/test-suite/python/import_nomodule_runme.py b/Examples/test-suite/python/import_nomodule_runme.py
new file mode 100644
index 000000000..41fc9d5ba
--- /dev/null
+++ b/Examples/test-suite/python/import_nomodule_runme.py
@@ -0,0 +1,7 @@
+from import_nomodule import *
+
+f = create_Foo()
+test1(f,42)
+
+b = Bar()
+test1(b,37)
diff --git a/Examples/test-suite/python/imports_runme.py b/Examples/test-suite/python/imports_runme.py
new file mode 100644
index 000000000..db2d32d3a
--- /dev/null
+++ b/Examples/test-suite/python/imports_runme.py
@@ -0,0 +1,9 @@
+# This is the import runtime testcase.
+
+import _imports_a
+import _imports_b
+import sys
+
+x = _imports_b.new_B()
+_imports_a.A_hello(x)
+
diff --git a/Examples/test-suite/python/inherit_missing_runme.py b/Examples/test-suite/python/inherit_missing_runme.py
new file mode 100644
index 000000000..60e606401
--- /dev/null
+++ b/Examples/test-suite/python/inherit_missing_runme.py
@@ -0,0 +1,17 @@
+import inherit_missing
+
+a = inherit_missing.new_Foo()
+b = inherit_missing.Bar()
+c = inherit_missing.Spam()
+
+x = inherit_missing.do_blah(a)
+if x != "Foo::blah":
+ print "Whoa! Bad return", x
+
+x = inherit_missing.do_blah(b)
+if x != "Bar::blah":
+ print "Whoa! Bad return", x
+
+x = inherit_missing.do_blah(c)
+if x != "Spam::blah":
+ print "Whoa! Bad return", x
diff --git a/Examples/test-suite/python/lib_std_vector_runme.py b/Examples/test-suite/python/lib_std_vector_runme.py
new file mode 100644
index 000000000..1b196f550
--- /dev/null
+++ b/Examples/test-suite/python/lib_std_vector_runme.py
@@ -0,0 +1,17 @@
+from lib_std_vector import *
+
+iv = IntVector(4)
+for i in range(0,4):
+ iv[i] = i
+
+x = average(iv)
+y = average([1,2,3,4])
+
+a = half([10,10.5,11,11.5])
+
+dv = DoubleVector(10)
+for i in range(0,10):
+ dv[i] = i/2.0
+
+halve_in_place(dv)
+
diff --git a/Examples/test-suite/python/minherit_runme.py b/Examples/test-suite/python/minherit_runme.py
new file mode 100644
index 000000000..d7ad0b36b
--- /dev/null
+++ b/Examples/test-suite/python/minherit_runme.py
@@ -0,0 +1,71 @@
+
+import minherit
+
+a = minherit.Foo()
+b = minherit.Bar()
+c = minherit.FooBar()
+d = minherit.Spam()
+
+if a.xget() != 1:
+ raise RuntimeError, "Bad attribute value"
+
+if b.yget() != 2:
+ raise RuntimeError, "Bad attribute value"
+
+if c.xget() != 1 or c.yget() != 2 or c.zget() != 3:
+ raise RuntimeError, "Bad attribute value"
+
+if d.xget() != 1 or d.yget() != 2 or d.zget() != 3 or d.wget() != 4:
+ raise RuntimeError, "Bad attribute value"
+
+
+if minherit.xget(a) != 1:
+ raise RuntimeError, "Bad attribute value %d" % (minherit.xget(a))
+
+if minherit.yget(b) != 2:
+ raise RuntimeError, "Bad attribute value %d" % (minherit.yget(b))
+
+if minherit.xget(c) != 1 or minherit.yget(c) != 2 or minherit.zget(c) != 3:
+ raise RuntimeError, "Bad attribute value %d %d %d" % (minherit.xget(c), minherit.yget(c), minherit.zget(c))
+
+if minherit.xget(d) != 1 or minherit.yget(d) != 2 or minherit.zget(d) != 3 or minherit.wget(d) != 4:
+ raise RuntimeError, "Bad attribute value %d %d %d %d" % (minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d))
+
+# Cleanse all of the pointers and see what happens
+
+aa = minherit.toFooPtr(a)
+bb = minherit.toBarPtr(b)
+cc = minherit.toFooBarPtr(c)
+dd = minherit.toSpamPtr(d)
+
+if aa.xget() != 1:
+ raise RuntimeError, "Bad attribute value"
+
+if bb.yget() != 2:
+ raise RuntimeError, "Bad attribute value"
+
+if cc.xget() != 1 or cc.yget() != 2 or cc.zget() != 3:
+ raise RuntimeError, "Bad attribute value"
+
+if dd.xget() != 1 or dd.yget() != 2 or dd.zget() != 3 or dd.wget() != 4:
+ raise RuntimeError, "Bad attribute value"
+
+if minherit.xget(aa) != 1:
+ raise RuntimeError, "Bad attribute value %d" % (minherit.xget(aa))
+
+if minherit.yget(bb) != 2:
+ raise RuntimeError, "Bad attribute value %d" % (minherit.yget(bb))
+
+if minherit.xget(cc) != 1 or minherit.yget(cc) != 2 or minherit.zget(cc) != 3:
+ raise RuntimeError, "Bad attribute value %d %d %d" % (minherit.xget(cc), minherit.yget(cc), minherit.zget(cc))
+
+if minherit.xget(dd) != 1 or minherit.yget(dd) != 2 or minherit.zget(dd) != 3 or minherit.wget(dd) != 4:
+ raise RuntimeError, "Bad attribute value %d %d %d %d" % (minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd))
+
+
+
+
+
+
+
+
diff --git a/Examples/test-suite/python/namespace_typemap_runme.py b/Examples/test-suite/python/namespace_typemap_runme.py
new file mode 100644
index 000000000..682ad3bb1
--- /dev/null
+++ b/Examples/test-suite/python/namespace_typemap_runme.py
@@ -0,0 +1,82 @@
+from namespace_typemap import *
+
+if stest1("hello") != "hello":
+ raise RuntimeError
+
+if stest2("hello") != "hello":
+ raise RuntimeError
+
+if stest3("hello") != "hello":
+ raise RuntimeError
+
+if stest4("hello") != "hello":
+ raise RuntimeError
+
+if stest5("hello") != "hello":
+ raise RuntimeError
+
+if stest6("hello") != "hello":
+ raise RuntimeError
+
+if stest7("hello") != "hello":
+ raise RuntimeError
+
+if stest8("hello") != "hello":
+ raise RuntimeError
+
+if stest9("hello") != "hello":
+ raise RuntimeError
+
+if stest10("hello") != "hello":
+ raise RuntimeError
+
+if stest11("hello") != "hello":
+ raise RuntimeError
+
+if stest12("hello") != "hello":
+ raise RuntimeError
+
+c = complex(2,3)
+r = c.real
+
+if ctest1(c) != r:
+ raise RuntimeError
+
+if ctest2(c) != r:
+ raise RuntimeError
+
+if ctest3(c) != r:
+ raise RuntimeError
+
+if ctest4(c) != r:
+ raise RuntimeError
+
+if ctest5(c) != r:
+ raise RuntimeError
+
+if ctest6(c) != r:
+ raise RuntimeError
+
+if ctest7(c) != r:
+ raise RuntimeError
+
+if ctest8(c) != r:
+ raise RuntimeError
+
+if ctest9(c) != r:
+ raise RuntimeError
+
+if ctest10(c) != r:
+ raise RuntimeError
+
+if ctest11(c) != r:
+ raise RuntimeError
+
+if ctest12(c) != r:
+ raise RuntimeError
+
+try:
+ ttest1(-14)
+ raise RuntimeError
+except ValueError:
+ pass
diff --git a/Examples/test-suite/python/overload_copy_runme.py b/Examples/test-suite/python/overload_copy_runme.py
new file mode 100644
index 000000000..6ccf4013e
--- /dev/null
+++ b/Examples/test-suite/python/overload_copy_runme.py
@@ -0,0 +1,3 @@
+from overload_copy import *
+f = Foo()
+g = Foo(f)
diff --git a/Examples/test-suite/python/overload_extend_runme.py b/Examples/test-suite/python/overload_extend_runme.py
new file mode 100644
index 000000000..9fb6920c3
--- /dev/null
+++ b/Examples/test-suite/python/overload_extend_runme.py
@@ -0,0 +1,11 @@
+import overload_extend
+
+f = overload_extend.Foo()
+if f.test(3) != 1:
+ raise RuntimeError
+if f.test("hello") != 2:
+ raise RuntimeError
+if f.test(3.5,2.5) != 3:
+ raise RuntimeError
+
+
diff --git a/Examples/test-suite/python/overload_extendc_runme.py b/Examples/test-suite/python/overload_extendc_runme.py
new file mode 100644
index 000000000..9fb6920c3
--- /dev/null
+++ b/Examples/test-suite/python/overload_extendc_runme.py
@@ -0,0 +1,11 @@
+import overload_extend
+
+f = overload_extend.Foo()
+if f.test(3) != 1:
+ raise RuntimeError
+if f.test("hello") != 2:
+ raise RuntimeError
+if f.test(3.5,2.5) != 3:
+ raise RuntimeError
+
+
diff --git a/Examples/test-suite/python/overload_simple_runme.py b/Examples/test-suite/python/overload_simple_runme.py
new file mode 100644
index 000000000..737ed23eb
--- /dev/null
+++ b/Examples/test-suite/python/overload_simple_runme.py
@@ -0,0 +1,97 @@
+from overload_simple import *
+
+if foo(3) != "foo:int":
+ raise RuntimeError, "foo(int)"
+
+if foo(3.0) != "foo:double":
+ raise RuntimeError, "foo(double)"
+
+if foo("hello") != "foo:char *":
+ raise RuntimeError, "foo(char *)"
+
+f = Foo()
+b = Bar()
+
+if foo(f) != "foo:Foo *":
+ raise RuntimeError, "foo(Foo *)"
+
+if foo(b) != "foo:Bar *":
+ raise RuntimeError, "foo(Bar *)"
+
+v = malloc_void(32)
+
+if foo(v) != "foo:void *":
+ raise RuntimeError, "foo(void *)"
+
+s = Spam()
+
+if s.foo(3) != "foo:int":
+ raise RuntimeError, "Spam::foo(int)"
+
+if s.foo(3.0) != "foo:double":
+ raise RuntimeError, "Spam::foo(double)"
+
+if s.foo("hello") != "foo:char *":
+ raise RuntimeError, "Spam::foo(char *)"
+
+if s.foo(f) != "foo:Foo *":
+ raise RuntimeError, "Spam::foo(Foo *)"
+
+if s.foo(b) != "foo:Bar *":
+ raise RuntimeError, "Spam::foo(Bar *)"
+
+if s.foo(v) != "foo:void *":
+ raise RuntimeError, "Spam::foo(void *)"
+
+if Spam_bar(3) != "bar:int":
+ raise RuntimeError, "Spam::bar(int)"
+
+if Spam_bar(3.0) != "bar:double":
+ raise RuntimeError, "Spam::bar(double)"
+
+if Spam_bar("hello") != "bar:char *":
+ raise RuntimeError, "Spam::bar(char *)"
+
+if Spam_bar(f) != "bar:Foo *":
+ raise RuntimeError, "Spam::bar(Foo *)"
+
+if Spam_bar(b) != "bar:Bar *":
+ raise RuntimeError, "Spam::bar(Bar *)"
+
+if Spam_bar(v) != "bar:void *":
+ raise RuntimeError, "Spam::bar(void *)"
+
+# Test constructors
+
+s = Spam()
+if s.type != "none":
+ raise RuntimeError, "Spam()"
+
+s = Spam(3)
+if s.type != "int":
+ raise RuntimeError, "Spam(int)"
+
+s = Spam(3.4)
+if s.type != "double":
+ raise RuntimeError, "Spam(double)"
+
+s = Spam("hello")
+if s.type != "char *":
+ raise RuntimeError, "Spam(char *)"
+
+s = Spam(f)
+if s.type != "Foo *":
+ raise RuntimeError, "Spam(Foo *)"
+
+s = Spam(b)
+if s.type != "Bar *":
+ raise RuntimeError, "Spam(Bar *)"
+
+s = Spam(v)
+if s.type != "void *":
+ raise RuntimeError, "Spam(void *)"
+
+
+
+
+
diff --git a/Examples/test-suite/python/overload_subtype_runme.py b/Examples/test-suite/python/overload_subtype_runme.py
new file mode 100644
index 000000000..6bf77dc59
--- /dev/null
+++ b/Examples/test-suite/python/overload_subtype_runme.py
@@ -0,0 +1,11 @@
+from overload_subtype import *
+
+f = Foo()
+b = Bar()
+
+if spam(f) != 1:
+ raise RuntimeError, "foo"
+
+if spam(b) != 2:
+ raise RuntimeError, "bar"
+
diff --git a/Examples/test-suite/python/overload_template_runme.py b/Examples/test-suite/python/overload_template_runme.py
new file mode 100644
index 000000000..1398dd739
--- /dev/null
+++ b/Examples/test-suite/python/overload_template_runme.py
@@ -0,0 +1,5 @@
+from overload_template import *
+f = foo()
+
+a = max(3,4)
+b = max(3.4,5.2)
diff --git a/Examples/test-suite/python/primitive_ref_runme.py b/Examples/test-suite/python/primitive_ref_runme.py
new file mode 100644
index 000000000..236019b7c
--- /dev/null
+++ b/Examples/test-suite/python/primitive_ref_runme.py
@@ -0,0 +1,37 @@
+from primitive_ref import *
+
+if ref_int(3) != 3:
+ raise RuntimeError
+
+if ref_uint(3) != 3:
+ raise RuntimeError
+
+if ref_short(3) != 3:
+ raise RuntimeError
+
+if ref_ushort(3) != 3:
+ raise RuntimeError
+
+if ref_long(3) != 3:
+ raise RuntimeError
+
+if ref_ulong(3) != 3:
+ raise RuntimeError
+
+if ref_schar(3) != 3:
+ raise RuntimeError
+
+if ref_uchar(3) != 3:
+ raise RuntimeError
+
+if ref_float(3.5) != 3.5:
+ raise RuntimeError
+
+if ref_double(3.5) != 3.5:
+ raise RuntimeError
+
+if ref_bool(1) != 1:
+ raise RuntimeError
+
+if ref_char('x') != 'x':
+ raise RuntimeError
diff --git a/Examples/test-suite/python/rename_scope_runme.py b/Examples/test-suite/python/rename_scope_runme.py
new file mode 100644
index 000000000..75521d38b
--- /dev/null
+++ b/Examples/test-suite/python/rename_scope_runme.py
@@ -0,0 +1,10 @@
+from rename_scope import *
+
+a = Natural_UP()
+b = Natural_BP()
+
+if a.rtest() != 1:
+ raise RuntimeError
+
+if b.rtest() != 1:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/smart_pointer_multi_runme.py b/Examples/test-suite/python/smart_pointer_multi_runme.py
new file mode 100644
index 000000000..c17053055
--- /dev/null
+++ b/Examples/test-suite/python/smart_pointer_multi_runme.py
@@ -0,0 +1,15 @@
+from smart_pointer_multi import *
+
+f = Foo()
+b = Bar(f)
+s = Spam(b)
+g = Grok(b)
+
+s.x = 3
+if s.getx() != 3:
+ raise RuntimeError
+
+g.x = 4
+if g.getx() != 4:
+ raise RuntimeError
+
diff --git a/Examples/test-suite/python/smart_pointer_multi_typedef_runme.py b/Examples/test-suite/python/smart_pointer_multi_typedef_runme.py
new file mode 100644
index 000000000..ebf4c9b09
--- /dev/null
+++ b/Examples/test-suite/python/smart_pointer_multi_typedef_runme.py
@@ -0,0 +1,15 @@
+from smart_pointer_multi_typedef import *
+
+f = Foo()
+b = Bar(f)
+s = Spam(b)
+g = Grok(b)
+
+s.x = 3
+if s.getx() != 3:
+ raise RuntimeError
+
+g.x = 4
+if g.getx() != 4:
+ raise RuntimeError
+
diff --git a/Examples/test-suite/python/smart_pointer_not_runme.py b/Examples/test-suite/python/smart_pointer_not_runme.py
new file mode 100644
index 000000000..4c90b376b
--- /dev/null
+++ b/Examples/test-suite/python/smart_pointer_not_runme.py
@@ -0,0 +1,42 @@
+from smart_pointer_not import *
+
+f = Foo()
+b = Bar(f)
+s = Spam(f)
+g = Grok(f)
+
+try:
+ x = b.x
+ print "Error! b.x"
+except:
+ pass
+
+try:
+ x = s.x
+ print "Error! s.x"
+except:
+ pass
+
+try:
+ x = g.x
+ print "Error! g.x"
+except:
+ pass
+
+try:
+ x = b.getx()
+ print "Error! b.getx()"
+except:
+ pass
+
+try:
+ x = s.getx()
+ print "Error! s.getx()"
+except:
+ pass
+
+try:
+ x = g.getx()
+ print "Error! g.getx()"
+except:
+ pass
diff --git a/Examples/test-suite/python/smart_pointer_overload_runme.py b/Examples/test-suite/python/smart_pointer_overload_runme.py
new file mode 100644
index 000000000..c9fd3a5b0
--- /dev/null
+++ b/Examples/test-suite/python/smart_pointer_overload_runme.py
@@ -0,0 +1,21 @@
+from smart_pointer_overload import *
+
+f = Foo()
+b = Bar(f)
+
+
+if f.test(3) != 1:
+ raise RuntimeError
+if f.test(3.5) != 2:
+ raise RuntimeError
+if f.test("hello") != 3:
+ raise RuntimeError
+
+if b.test(3) != 1:
+ raise RuntimeError
+if b.test(3.5) != 2:
+ raise RuntimeError
+if b.test("hello") != 3:
+ raise RuntimeError
+
+
diff --git a/Examples/test-suite/python/smart_pointer_rename_runme.py b/Examples/test-suite/python/smart_pointer_rename_runme.py
new file mode 100644
index 000000000..c6d22273c
--- /dev/null
+++ b/Examples/test-suite/python/smart_pointer_rename_runme.py
@@ -0,0 +1,13 @@
+from smart_pointer_rename import *
+
+f = Foo()
+b = Bar(f)
+
+if b.test() != 3:
+ raise RuntimeError
+
+if b.ftest1(1) != 1:
+ raise RuntimeError
+
+if b.ftest2(2,3) != 2:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/smart_pointer_simple_runme.py b/Examples/test-suite/python/smart_pointer_simple_runme.py
new file mode 100644
index 000000000..95b678aae
--- /dev/null
+++ b/Examples/test-suite/python/smart_pointer_simple_runme.py
@@ -0,0 +1,13 @@
+from smart_pointer_simple import *
+
+f = Foo()
+b = Bar(f)
+
+b.x = 3
+if b.getx() != 3:
+ raise RuntimeError
+
+fp = b.__deref__()
+fp.x = 4
+if fp.getx() != 4:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/smart_pointer_typedef_runme.py b/Examples/test-suite/python/smart_pointer_typedef_runme.py
new file mode 100644
index 000000000..eee0537f4
--- /dev/null
+++ b/Examples/test-suite/python/smart_pointer_typedef_runme.py
@@ -0,0 +1,13 @@
+from smart_pointer_typedef import *
+
+f = Foo()
+b = Bar(f)
+
+b.x = 3
+if b.getx() != 3:
+ raise RuntimeError
+
+fp = b.__deref__()
+fp.x = 4
+if fp.getx() != 4:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/sneaky1_runme.py b/Examples/test-suite/python/sneaky1_runme.py
new file mode 100644
index 000000000..7823e77ea
--- /dev/null
+++ b/Examples/test-suite/python/sneaky1_runme.py
@@ -0,0 +1,5 @@
+import sneaky1
+x = sneaky1.add(3,4)
+y = sneaky1.sub(3,4)
+z = sneaky1.mul(3,4)
+w = sneaky1.divide(3,4)
diff --git a/Examples/test-suite/python/static_const_member_2_runme.py b/Examples/test-suite/python/static_const_member_2_runme.py
new file mode 100644
index 000000000..738daf465
--- /dev/null
+++ b/Examples/test-suite/python/static_const_member_2_runme.py
@@ -0,0 +1,15 @@
+from static_const_member_2 import *
+
+c = Test_int()
+try:
+ a = c.forward_field
+ a = c.current_profile
+ a = c.RightIndex
+ a = Test_int.backward_field
+ a = Test_int.LeftIndex
+ a = Test_int.cavity_flags
+except:
+ print "Failed!!"
+
+
+
diff --git a/Examples/test-suite/python/struct_value_runme.py b/Examples/test-suite/python/struct_value_runme.py
new file mode 100644
index 000000000..727996f53
--- /dev/null
+++ b/Examples/test-suite/python/struct_value_runme.py
@@ -0,0 +1,9 @@
+import struct_value
+
+b = struct_value.Bar()
+
+b.a.x = 3
+if b.a.x != 3: raise RuntimeError
+
+b.b.x = 3
+if b.b.x != 3: raise RuntimeError
diff --git a/Examples/test-suite/python/template_construct_runme.py b/Examples/test-suite/python/template_construct_runme.py
new file mode 100644
index 000000000..3409fdd62
--- /dev/null
+++ b/Examples/test-suite/python/template_construct_runme.py
@@ -0,0 +1 @@
+import template_construct
diff --git a/Examples/test-suite/python/template_inherit_runme.py b/Examples/test-suite/python/template_inherit_runme.py
new file mode 100644
index 000000000..bb1465a2b
--- /dev/null
+++ b/Examples/test-suite/python/template_inherit_runme.py
@@ -0,0 +1,53 @@
+from template_inherit import *
+a = FooInt()
+b = FooDouble()
+c = BarInt()
+d = BarDouble()
+e = FooUInt()
+f = BarUInt()
+
+if a.blah() != "Foo":
+ raise ValueError
+
+if b.blah() != "Foo":
+ raise ValueError
+
+if e.blah() != "Foo":
+ raise ValueError
+
+if c.blah() != "Bar":
+ raise ValueError
+
+if d.blah() != "Bar":
+ raise ValueError
+
+if f.blah() != "Bar":
+ raise ValueError
+
+if c.foomethod() != "foomethod":
+ raise ValueError
+
+if d.foomethod() != "foomethod":
+ raise ValueError
+
+if f.foomethod() != "foomethod":
+ raise ValueError
+
+if invoke_blah_int(a) != "Foo":
+ raise ValueError
+
+if invoke_blah_int(c) != "Bar":
+ raise ValueError
+
+if invoke_blah_double(b) != "Foo":
+ raise ValueError
+
+if invoke_blah_double(d) != "Bar":
+ raise ValueError
+
+if invoke_blah_uint(e) != "Foo":
+ raise ValueError
+
+if invoke_blah_uint(f) != "Bar":
+ raise ValueError
+
diff --git a/Examples/test-suite/python/template_ns4_runme.py b/Examples/test-suite/python/template_ns4_runme.py
new file mode 100644
index 000000000..81107b493
--- /dev/null
+++ b/Examples/test-suite/python/template_ns4_runme.py
@@ -0,0 +1,5 @@
+from template_ns4 import *
+
+d = make_Class_DD();
+if d.test() != "test":
+ raise RuntimeError
diff --git a/Examples/test-suite/python/template_ns_runme.py b/Examples/test-suite/python/template_ns_runme.py
new file mode 100644
index 000000000..20cc9b99c
--- /dev/null
+++ b/Examples/test-suite/python/template_ns_runme.py
@@ -0,0 +1,17 @@
+from template_ns import *
+p1 = pairii(2,3)
+p2 = pairii(p1)
+
+if p2.first != 2:
+ raise RuntimeError
+if p2.second != 3:
+ raise RuntimeError
+
+p3 = pairdd(3.5,2.5)
+p4 = pairdd(p3)
+
+if p4.first != 3.5:
+ raise RuntimeError
+
+if p4.second != 2.5:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/template_rename_runme.py b/Examples/test-suite/python/template_rename_runme.py
new file mode 100644
index 000000000..1fd45ba03
--- /dev/null
+++ b/Examples/test-suite/python/template_rename_runme.py
@@ -0,0 +1,12 @@
+import template_rename
+
+i = template_rename.iFoo()
+d = template_rename.dFoo()
+
+a = i.blah_test(4)
+b = i.spam_test(5)
+c = i.grok_test(6)
+
+x = d.blah_test(7)
+y = d.spam(8)
+z = d.grok_test(9)
diff --git a/Examples/test-suite/python/template_tbase_template_runme.py b/Examples/test-suite/python/template_tbase_template_runme.py
new file mode 100644
index 000000000..d13c5f2c2
--- /dev/null
+++ b/Examples/test-suite/python/template_tbase_template_runme.py
@@ -0,0 +1,5 @@
+from template_tbase_template import *
+
+a = make_Class_dd()
+if a.test() != "test":
+ raise RuntimeError
diff --git a/Examples/test-suite/python/template_type_namespace_runme.py b/Examples/test-suite/python/template_type_namespace_runme.py
new file mode 100644
index 000000000..19ea5f5ce
--- /dev/null
+++ b/Examples/test-suite/python/template_type_namespace_runme.py
@@ -0,0 +1,5 @@
+from template_type_namespace import *
+
+if type(foo()[0]) != type(""):
+ raise RuntimeError
+
diff --git a/Examples/test-suite/python/template_typedef_cplx2_runme.py b/Examples/test-suite/python/template_typedef_cplx2_runme.py
new file mode 100644
index 000000000..51a1d4e97
--- /dev/null
+++ b/Examples/test-suite/python/template_typedef_cplx2_runme.py
@@ -0,0 +1,95 @@
+import string
+from template_typedef_cplx2 import *
+
+#
+# double case
+#
+
+try:
+ d = make_Identity_double()
+ a = d.this
+except:
+ print d, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % d)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print d, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+try:
+ e = make_Multiplies_double_double_double_double(d, d)
+ a = e.this
+except:
+ print e, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % e)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print e, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+
+#
+# complex case
+#
+
+try:
+ c = make_Identity_complex()
+ a = c.this
+except:
+ print c, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % c)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print c, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+try:
+ f = make_Multiplies_complex_complex_complex_complex(c, c)
+ a = f.this
+except:
+ print f, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % f)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print f, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+#
+# Mix case
+#
+
+try:
+ g = make_Multiplies_double_double_complex_complex(d, c)
+ a = g.this
+except:
+ print g, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % g)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print g, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+
+try:
+ h = make_Multiplies_complex_complex_double_double(c, d)
+ a = h.this
+except:
+ print h, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % g)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print g, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+try:
+ a = g.get_value()
+except:
+ print g, "has not get_value() method"
+ raise RuntimeError
+
diff --git a/Examples/test-suite/python/template_typedef_cplx3_runme.py b/Examples/test-suite/python/template_typedef_cplx3_runme.py
new file mode 100644
index 000000000..b8ac1b6ef
--- /dev/null
+++ b/Examples/test-suite/python/template_typedef_cplx3_runme.py
@@ -0,0 +1,34 @@
+import string
+from template_typedef_cplx3 import *
+
+#
+# this is OK
+#
+
+
+s = Sin()
+s.get_base_value()
+s.get_value()
+s.get_arith_value()
+my_func_r(s)
+make_Multiplies_double_double_double_double(s,s)
+
+z = CSin()
+z.get_base_value()
+z.get_value()
+z.get_arith_value()
+my_func_c(z)
+make_Multiplies_complex_complex_complex_complex(z,z)
+
+#
+# Here we fail
+#
+d = make_Identity_double()
+my_func_r(d)
+
+c = make_Identity_complex()
+my_func_c(c)
+
+
+
+
diff --git a/Examples/test-suite/python/template_typedef_cplx4_runme.py b/Examples/test-suite/python/template_typedef_cplx4_runme.py
new file mode 100644
index 000000000..faeca219f
--- /dev/null
+++ b/Examples/test-suite/python/template_typedef_cplx4_runme.py
@@ -0,0 +1,34 @@
+import string
+from template_typedef_cplx4 import *
+
+#
+# this is OK
+#
+
+
+s = Sin()
+s.get_base_value()
+s.get_value()
+s.get_arith_value()
+my_func_r(s)
+make_Multiplies_double_double_double_double(s,s)
+
+z = CSin()
+z.get_base_value()
+z.get_value()
+z.get_arith_value()
+my_func_c(z)
+make_Multiplies_complex_complex_complex_complex(z,z)
+
+#
+# Here we fail
+#
+d = make_Identity_double()
+my_func_r(d)
+
+c = make_Identity_complex()
+my_func_c(c)
+
+
+
+
diff --git a/Examples/test-suite/python/template_typedef_cplx_runme.py b/Examples/test-suite/python/template_typedef_cplx_runme.py
new file mode 100644
index 000000000..baf9fad01
--- /dev/null
+++ b/Examples/test-suite/python/template_typedef_cplx_runme.py
@@ -0,0 +1,88 @@
+import string
+from template_typedef_cplx import *
+
+#
+# double case
+#
+
+try:
+ d = make_Identity_double()
+ a = d.this
+except:
+ print d, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % d)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print d, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+try:
+ e = make_Multiplies_double_double_double_double(d, d)
+ a = e.this
+except:
+ print e, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % e)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print e, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+
+#
+# complex case
+#
+
+try:
+ c = make_Identity_complex()
+ a = c.this
+except:
+ print c, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % c)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print c, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+try:
+ f = make_Multiplies_complex_complex_complex_complex(c, c)
+ a = f.this
+except:
+ print f, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % f)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print f, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+#
+# Mix case
+#
+
+try:
+ g = make_Multiplies_double_double_complex_complex(d, c)
+ a = g.this
+except:
+ print g, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % g)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print g, "is not an ArithUnaryFunction"
+ raise RuntimeError
+
+
+try:
+ h = make_Multiplies_complex_complex_double_double(c, d)
+ a = h.this
+except:
+ print h, "is not an instance"
+ raise RuntimeError
+
+s = string.split('%s' % g)[1]
+if string.find(s, 'ArithUnaryFunction') == -1:
+ print g, "is not an ArithUnaryFunction"
+ raise RuntimeError
diff --git a/Examples/test-suite/python/template_typedef_import_runme.py b/Examples/test-suite/python/template_typedef_import_runme.py
new file mode 100644
index 000000000..48d88eda0
--- /dev/null
+++ b/Examples/test-suite/python/template_typedef_import_runme.py
@@ -0,0 +1,35 @@
+import string
+from template_typedef_cplx2 import *
+from template_typedef_import import *
+
+#
+# this is OK
+#
+
+
+s = Sin()
+s.get_base_value()
+s.get_value()
+s.get_arith_value()
+my_func_r(s)
+make_Multiplies_double_double_double_double(s,s)
+
+z = CSin()
+z.get_base_value()
+z.get_value()
+z.get_arith_value()
+my_func_c(z)
+make_Multiplies_complex_complex_complex_complex(z,z)
+
+#
+# Here we fail
+#
+d = make_Identity_double()
+my_func_r(d)
+
+c = make_Identity_complex()
+my_func_c(c)
+
+
+
+
diff --git a/Examples/test-suite/python/template_typedef_runme.py b/Examples/test-suite/python/template_typedef_runme.py
new file mode 100644
index 000000000..cf73d5919
--- /dev/null
+++ b/Examples/test-suite/python/template_typedef_runme.py
@@ -0,0 +1,33 @@
+from template_typedef import *
+
+d = make_Identity_float()
+c = make_Identity_real()
+
+
+try:
+ a = d.this
+ a = c.this
+except:
+ raise RuntimeError
+
+try:
+ e = make_Multiplies_float_float_float_float(d, d)
+ a = e.this
+except:
+ print e, "is not an instance"
+ raise RuntimeError
+
+try:
+ f = make_Multiplies_real_real_real_real(c, c)
+ a = f.this
+except:
+ print f, "is not an instance"
+ raise RuntimeError
+
+try:
+ g = make_Multiplies_float_float_real_real(d, c)
+ a = g.this
+except:
+ print g, "is not an instance"
+ raise RuntimeError
+
diff --git a/Examples/test-suite/python/typedef_inherit_runme.py b/Examples/test-suite/python/typedef_inherit_runme.py
new file mode 100644
index 000000000..6b7f2d872
--- /dev/null
+++ b/Examples/test-suite/python/typedef_inherit_runme.py
@@ -0,0 +1,23 @@
+import typedef_inherit
+
+a = typedef_inherit.Foo()
+b = typedef_inherit.Bar()
+
+x = typedef_inherit.do_blah(a)
+if x != "Foo::blah":
+ print "Whoa! Bad return", x
+
+x = typedef_inherit.do_blah(b)
+if x != "Bar::blah":
+ print "Whoa! Bad return", x
+
+c = typedef_inherit.Spam()
+d = typedef_inherit.Grok()
+
+x = typedef_inherit.do_blah2(c)
+if x != "Spam::blah":
+ print "Whoa! Bad return", x
+
+x = typedef_inherit.do_blah2(d)
+if x != "Grok::blah":
+ print "Whoa! Bad return", x
diff --git a/Examples/test-suite/python/typedef_scope_runme.py b/Examples/test-suite/python/typedef_scope_runme.py
new file mode 100644
index 000000000..37bfc97b1
--- /dev/null
+++ b/Examples/test-suite/python/typedef_scope_runme.py
@@ -0,0 +1,12 @@
+import typedef_scope
+
+b = typedef_scope.Bar()
+x = b.test1(42,"hello")
+if x != 42:
+ print "Failed!!"
+
+x = b.test2(42,"hello")
+if x != "hello":
+ print "Failed!!"
+
+
diff --git a/Examples/test-suite/python/typemap_namespace_runme.py b/Examples/test-suite/python/typemap_namespace_runme.py
new file mode 100644
index 000000000..581a0f437
--- /dev/null
+++ b/Examples/test-suite/python/typemap_namespace_runme.py
@@ -0,0 +1,8 @@
+from typemap_namespace import *
+
+if test1("hello") != "hello":
+ raise RuntimeError
+
+if test2("hello") != "hello":
+ raise RuntimeError
+
diff --git a/Examples/test-suite/python/typemap_ns_using_runme.py b/Examples/test-suite/python/typemap_ns_using_runme.py
new file mode 100644
index 000000000..802ea7f56
--- /dev/null
+++ b/Examples/test-suite/python/typemap_ns_using_runme.py
@@ -0,0 +1,4 @@
+import typemap_ns_using
+
+if typemap_ns_using.spam(37) != 37:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/typename_runme.py b/Examples/test-suite/python/typename_runme.py
new file mode 100644
index 000000000..59a0f1f76
--- /dev/null
+++ b/Examples/test-suite/python/typename_runme.py
@@ -0,0 +1,12 @@
+import typename
+import types
+f = typename.Foo()
+b = typename.Bar()
+
+x = typename.twoFoo(f)
+if not isinstance(x,types.FloatType):
+ print "Wrong return type!"
+y = typename.twoBar(b)
+if not isinstance(y,types.IntType):
+ print "Wrong return type!"
+
diff --git a/Examples/test-suite/python/unions_runme.py b/Examples/test-suite/python/unions_runme.py
new file mode 100644
index 000000000..d59e2429e
--- /dev/null
+++ b/Examples/test-suite/python/unions_runme.py
@@ -0,0 +1,51 @@
+
+# This is the union runtime testcase. It ensures that values within a
+# union embedded within a struct can be set and read correctly.
+
+import unions
+import sys
+import string
+
+# Create new instances of SmallStruct and BigStruct for later use
+small = unions.SmallStruct()
+small.jill = 200
+
+big = unions.BigStruct()
+big.smallstruct = small
+big.jack = 300
+
+# Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
+# Ensure values in EmbeddedUnionTest are set correctly for each.
+eut = unions.EmbeddedUnionTest()
+
+# First check the SmallStruct in EmbeddedUnionTest
+eut.number = 1
+eut.uni.small = small
+Jill1 = eut.uni.small.jill
+if (Jill1 != 200):
+ print "Runtime test1 failed. eut.uni.small.jill=" , Jill1
+ sys.exit(1)
+
+Num1 = eut.number
+if (Num1 != 1):
+ print "Runtime test2 failed. eut.number=" , Num1
+ sys.exit(1)
+
+# Secondly check the BigStruct in EmbeddedUnionTest
+eut.number = 2
+eut.uni.big = big
+Jack1 = eut.uni.big.jack
+if (Jack1 != 300):
+ print "Runtime test3 failed. eut.uni.big.jack=" , Jack1
+ sys.exit(1)
+
+Jill2 = eut.uni.big.smallstruct.jill
+if (Jill2 != 200):
+ print "Runtime test4 failed. eut.uni.big.smallstruct.jill=" , Jill2
+ sys.exit(1)
+
+Num2 = eut.number
+if (Num2 != 2):
+ print "Runtime test5 failed. eut.number=" , Num2
+ sys.exit(1)
+
diff --git a/Examples/test-suite/python/using1_runme.py b/Examples/test-suite/python/using1_runme.py
new file mode 100644
index 000000000..5556c1b6a
--- /dev/null
+++ b/Examples/test-suite/python/using1_runme.py
@@ -0,0 +1,4 @@
+import using1
+
+if using1.spam(37) != 37:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/using2_runme.py b/Examples/test-suite/python/using2_runme.py
new file mode 100644
index 000000000..cf657d734
--- /dev/null
+++ b/Examples/test-suite/python/using2_runme.py
@@ -0,0 +1,4 @@
+import using2
+
+if using2.spam(37) != 37:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/using_composition_runme.py b/Examples/test-suite/python/using_composition_runme.py
new file mode 100644
index 000000000..866453a2a
--- /dev/null
+++ b/Examples/test-suite/python/using_composition_runme.py
@@ -0,0 +1,11 @@
+from using_composition import *
+
+f = FooBar()
+if f.blah(3) != 3:
+ raise RuntimeError,"blah(int)"
+
+if f.blah(3.5) != 3.5:
+ raise RuntimeError,"blah(double)"
+
+if f.blah("hello") != "hello":
+ raise RuntimeError,"blah(char *)"
diff --git a/Examples/test-suite/python/using_extend_runme.py b/Examples/test-suite/python/using_extend_runme.py
new file mode 100644
index 000000000..1ddc4baa1
--- /dev/null
+++ b/Examples/test-suite/python/using_extend_runme.py
@@ -0,0 +1,17 @@
+from using_extend import *
+
+f = FooBar()
+if f.blah(3) != 3:
+ raise RuntimeError,"blah(int)"
+
+if f.blah(3.5) != 3.5:
+ raise RuntimeError,"blah(double)"
+
+if f.blah("hello") != "hello":
+ raise RuntimeError,"blah(char *)"
+
+if f.blah(3,4) != 7:
+ raise RuntimeError,"blah(int,int)"
+
+if f.blah(3.5,7.5) != (3.5+7.5):
+ raise RuntimeError,"blah(double,double)"
diff --git a/Examples/test-suite/python/using_inherit_runme.py b/Examples/test-suite/python/using_inherit_runme.py
new file mode 100644
index 000000000..15fee6698
--- /dev/null
+++ b/Examples/test-suite/python/using_inherit_runme.py
@@ -0,0 +1,8 @@
+from using_inherit import *
+
+b = Bar()
+if b.test(3) != 3:
+ raise RuntimeError,"test(int)"
+
+if b.test(3.5) != 3.5:
+ raise RuntimeError, "test(double)"
diff --git a/Examples/test-suite/python/using_private_runme.py b/Examples/test-suite/python/using_private_runme.py
new file mode 100644
index 000000000..3d33ed985
--- /dev/null
+++ b/Examples/test-suite/python/using_private_runme.py
@@ -0,0 +1,7 @@
+from using_private import *
+
+f = FooBar()
+f.x = 3
+
+if f.blah(4) != 4:
+ raise RuntimeError, "blah(int)"
diff --git a/Examples/test-suite/python/using_protected_runme.py b/Examples/test-suite/python/using_protected_runme.py
new file mode 100644
index 000000000..525a1cde4
--- /dev/null
+++ b/Examples/test-suite/python/using_protected_runme.py
@@ -0,0 +1,7 @@
+from using_protected import *
+
+f = FooBar()
+f.x = 3
+
+if f.blah(4) != 4:
+ raise RuntimeError, "blah(int)"
diff --git a/Examples/test-suite/python/voidtest_runme.py b/Examples/test-suite/python/voidtest_runme.py
new file mode 100644
index 000000000..e1f46b176
--- /dev/null
+++ b/Examples/test-suite/python/voidtest_runme.py
@@ -0,0 +1,7 @@
+import voidtest
+
+voidtest.globalfunc()
+f = voidtest.Foo()
+f.memberfunc()
+
+voidtest.Foo_staticmemberfunc()
diff --git a/Examples/test-suite/rename_default.i b/Examples/test-suite/rename_default.i
new file mode 100644
index 000000000..67094660e
--- /dev/null
+++ b/Examples/test-suite/rename_default.i
@@ -0,0 +1,27 @@
+// Here's a nice little test for renaming, symbol table management, and default arguments
+
+%module rename_default
+
+// Rename a class member
+%rename(bar2) Foo::bar;
+
+%inline %{
+
+// Define a class
+class Foo {
+public:
+ static int bar;
+ static int spam;
+
+ // Use a renamed member as a default argument. SWIG has to resolve
+ // bar to Foo::bar and not Foo::spam. SWIG-1.3.11 got this wrong.
+
+ void method1(int x = bar) {}
+
+ // Use unrenamed member as default
+ void method2(int x = spam) {}
+};
+int Foo::bar = 1;
+int Foo::spam = 2;
+%}
+
diff --git a/Examples/test-suite/rename_scope.i b/Examples/test-suite/rename_scope.i
new file mode 100644
index 000000000..adcf2be05
--- /dev/null
+++ b/Examples/test-suite/rename_scope.i
@@ -0,0 +1,49 @@
+%module rename_scope
+
+%inline
+%{
+ namespace oss
+ {
+ enum Polarization { UnaryPolarization, BinaryPolarization };
+
+ template <Polarization P>
+ struct Interface
+ {
+ };
+ }
+%}
+
+namespace oss
+{
+ // Interface
+ %template(Interface_UP) Interface<UnaryPolarization>;
+ %template(Interface_BP) Interface<BinaryPolarization>;
+
+}
+%inline
+%{
+ namespace oss
+ {
+ namespace interfaces
+ {
+ template <Polarization P>
+ struct Natural : Interface<P>
+ {
+ int test(void) { return 1; }
+ };
+ }
+ }
+%}
+
+namespace oss
+{
+ namespace interfaces
+ {
+ %rename(rtest) Natural<UnaryPolarization>::test;
+ %rename(rtest) Natural<oss::BinaryPolarization>::test;
+
+ // Natural
+ %template(Natural_UP) Natural<UnaryPolarization>;
+ %template(Natural_BP) Natural<BinaryPolarization>;
+ }
+}
diff --git a/Examples/test-suite/ret_by_value.i b/Examples/test-suite/ret_by_value.i
new file mode 100644
index 000000000..273336e00
--- /dev/null
+++ b/Examples/test-suite/ret_by_value.i
@@ -0,0 +1,19 @@
+/* Simple test to check SWIG's handling of return by value */
+
+%module ret_by_value
+
+%warnfilter(801) test; /* Ruby, wrong class name */
+
+%inline %{
+
+typedef struct {
+ int myInt;
+ short myShort;
+} test;
+
+test get_test() {
+ test myTest = {100, 200};
+ return myTest;
+}
+
+%}
diff --git a/Examples/test-suite/return_value_scope.i b/Examples/test-suite/return_value_scope.i
new file mode 100644
index 000000000..d7d97a10a
--- /dev/null
+++ b/Examples/test-suite/return_value_scope.i
@@ -0,0 +1,28 @@
+%module return_value_scope
+%inline %{
+
+namespace Hell {
+class Foo {
+public:
+ Foo(int) { };
+};
+
+class Bar {
+public:
+ typedef Foo fooref;
+};
+
+class Spam {
+public:
+ typedef Bar base;
+ typedef base::fooref rettype;
+ rettype test() {
+ return rettype(1);
+ }
+};
+}
+%}
+
+
+
+
diff --git a/Examples/test-suite/rname.i b/Examples/test-suite/rname.i
new file mode 100644
index 000000000..ad0a75d19
--- /dev/null
+++ b/Examples/test-suite/rname.i
@@ -0,0 +1,48 @@
+// This module tests various facets of the %rename directive
+
+%module rname
+
+/* Applied everywhere */
+%rename(foo_i) foo(int);
+%rename(foo_d) foo(double);
+
+/* Applied only to global scope */
+
+%rename(foo_s) ::foo(short);
+
+/* Applied only to class scope */
+
+%rename(foo_u) *::foo(unsigned);
+
+/* Rename classes in a class hierarchy */
+%rename (RenamedBase) Base;
+%rename (RenamedDerived) Derived;
+
+%inline %{
+class Bar {
+public:
+ char *foo(int) { return (char *) "Bar::foo-int"; }
+ char *foo(double) { return (char *) "Bar::foo-double"; }
+ char *foo(short) { return (char *) "Bar::foo-short"; }
+ char *foo(unsigned) { return (char *) "Bar::foo-unsigned"; }
+};
+
+char *foo(int) { return (char *) "foo-int"; }
+char *foo(double) { return (char *) "foo-double"; }
+char *foo(short) { return (char *) "foo-short"; }
+char *foo(unsigned) { return (char *) "foo-unsigned"; }
+
+class Base {
+public:
+ Base(){};
+ virtual ~Base(){};
+};
+class Derived : public Base {
+public:
+ Derived(){}
+ ~Derived(){}
+ void fn(Derived derived, Base* basePtr, Base& baseRef){} // test renamed classes in a function
+};
+
+
+%}
diff --git a/Examples/test-suite/ruby/.cvsignore b/Examples/test-suite/ruby/.cvsignore
new file mode 100644
index 000000000..09e0b6c2e
--- /dev/null
+++ b/Examples/test-suite/ruby/.cvsignore
@@ -0,0 +1,3 @@
+*wrap*
+*.so
+*.dll
diff --git a/Examples/test-suite/ruby/Makefile b/Examples/test-suite/ruby/Makefile
new file mode 100644
index 000000000..eec1f10a4
--- /dev/null
+++ b/Examples/test-suite/ruby/Makefile
@@ -0,0 +1,41 @@
+#######################################################################
+# $Header$
+# Makefile for ruby test-suite
+#######################################################################
+
+LANGUAGE = ruby
+SCRIPTSUFFIX = _runme.rb
+
+include ../common.mk
+
+# Overridden variables here
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup) \
+ ($(swig_and_compile_cpp); ); \
+ $(run_testcase)
+
+%.ctest:
+ $(setup) \
+ ($(swig_and_compile_c); ); \
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup) \
+ ($(swig_and_compile_multi_cpp); ); \
+ $(run_testcase)
+
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.rb appended after the testcase name.
+run_testcase = \
+ if [ -f $*\_runme.rb ]; then ( \
+ ruby $*\_runme.rb;) \
+ fi;
+
+# Clean
+%.clean:
+
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile ruby_clean
diff --git a/Examples/test-suite/ruby/README b/Examples/test-suite/ruby/README
new file mode 100644
index 000000000..c4ace93e6
--- /dev/null
+++ b/Examples/test-suite/ruby/README
@@ -0,0 +1,4 @@
+See ../README for common README file.
+
+Any testcases which have _runme.rb appended after the testcase name will be detected and run.
+
diff --git a/Examples/test-suite/ruby/class_ignore_runme.rb b/Examples/test-suite/ruby/class_ignore_runme.rb
new file mode 100755
index 000000000..0b47a7fad
--- /dev/null
+++ b/Examples/test-suite/ruby/class_ignore_runme.rb
@@ -0,0 +1,10 @@
+require 'class_ignore'
+
+a = Class_ignore::Bar.new
+
+# Even though we didn't wrap the Foo class, this call
+# to do_blah() should succeed.
+
+if Class_ignore.do_blah(a) != "Bar::blah"
+ raise RuntimeError
+end
diff --git a/Examples/test-suite/ruby/constover_runme.rb b/Examples/test-suite/ruby/constover_runme.rb
new file mode 100755
index 000000000..04d516b75
--- /dev/null
+++ b/Examples/test-suite/ruby/constover_runme.rb
@@ -0,0 +1,44 @@
+require 'constover'
+
+error = 0
+
+p = Constover.test("test")
+if p != "test"
+ puts "test failed!"
+ error = 1
+end
+
+p = Constover.test_pconst("test")
+if p != "test_pconst"
+ puts "test_pconst failed!"
+ error = 1
+end
+
+f = Constover::Foo.new
+p = f.test("test")
+if p != "test"
+ print "member-test failed!"
+ error = 1
+end
+
+p = f.test_pconst("test")
+if p != "test_pconst"
+ print "member-test_pconst failed!"
+ error = 1
+end
+
+p = f.test_constm("test")
+if p != "test_constmethod"
+ print "member-test_constm failed!"
+ error = 1
+end
+
+p = f.test_pconstm("test")
+if p != "test_pconstmethod"
+ print "member-test_pconstm failed!"
+ error = 1
+end
+
+exit(error)
+
+
diff --git a/Examples/test-suite/ruby/cpp_namespace_runme.rb b/Examples/test-suite/ruby/cpp_namespace_runme.rb
new file mode 100755
index 000000000..db44b45f0
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp_namespace_runme.rb
@@ -0,0 +1,51 @@
+# Note: This example assumes that namespaces are flattened
+require 'cpp_namespace'
+
+n = Cpp_namespace.fact(4)
+if n != 24
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.Foo != 42
+ raise "Bad variable value!"
+end
+
+t = Cpp_namespace::Test.new
+if t.method() != "Test::method"
+ raise "Bad method return value!"
+end
+
+if Cpp_namespace.do_method(t) != "Test::method"
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.do_method2(t) != "Test::method"
+ raise "Bad return value!"
+end
+
+Cpp_namespace.weird("hello", 4)
+
+t2 = Cpp_namespace::Test2.new
+t3 = Cpp_namespace::Test3.new
+t4 = Cpp_namespace::Test4.new
+t5 = Cpp_namespace::Test5.new
+
+if Cpp_namespace.foo3(42) != 42
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.do_method3(t2, 40) != "Test2::method"
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.do_method3(t3, 40) != "Test3::method"
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.do_method3(t4, 40) != "Test4::method"
+ raise "Bad return value!"
+end
+
+if Cpp_namespace.do_method3(t5, 40) != "Test5::method"
+ raise "Bad return value!"
+end
diff --git a/Examples/test-suite/ruby/default_constructor_runme.rb b/Examples/test-suite/ruby/default_constructor_runme.rb
new file mode 100755
index 000000000..fc1f42937
--- /dev/null
+++ b/Examples/test-suite/ruby/default_constructor_runme.rb
@@ -0,0 +1,94 @@
+require 'default_constructor'
+
+include Default_constructor
+
+# Ruby 1.6 raises NameError if you try to call Class.new where no constructor
+# is defined; Ruby 1.7 changed this to NoMethodError
+
+NoConstructorError = Kernel.const_defined?("NoMethodError") ? NoMethodError : NameError
+
+# This should be no problem
+a = A.new
+
+# Nor should this
+aa = AA.new
+
+# The default constructor for B is private, so this should raise an exception
+begin
+ b = B.new
+rescue ArgumentError
+ # pass
+end
+
+# The two-argument constructor for B should work
+b = B.new(3, 4)
+
+# BB shouldn't inherit B's default constructor, so this should raise an exception
+begin
+ bb = BB.new
+ puts "Whoa. new BB created."
+rescue NoConstructorError
+ # pass
+end
+
+# C's constructor is protected, so this should raise an exception
+begin
+ c = C.new
+ print "Whoa. new C created."
+rescue NoConstructorError
+ # pass
+end
+
+# CC gets a default constructor, so no problem here
+cc = CC.new
+
+# D's constructor is private, so this should fail
+begin
+ d = D.new
+ puts "Whoa. new D created"
+rescue NoConstructorError
+ # pass
+end
+
+# DD shouldn't get a default constructor, so this should fail
+begin
+ dd = DD.new
+ puts "Whoa. new DD created"
+rescue NoConstructorError
+ # pass
+end
+
+# AD shouldn't get a default constructor, so this should fail
+begin
+ ad = AD.new
+ puts "Whoa. new AD created"
+rescue NoConstructorError
+ # pass
+end
+
+# Both of the arguments to E's constructor have default values,
+# so this should be fine.
+e = E.new
+
+# EE should get a default constructor
+ee = EE.new
+
+# EB should not get a default constructor (because B doesn't have one)
+begin
+ eb = EB.new
+ puts "Whoa. new EB created"
+rescue NoConstructorError
+ # pass
+end
+
+# This should work fine
+f = F.new
+
+# This should work fine
+ff = FFF.new
+
+# This should work fine
+g = G.new
+
+# This should work fine
+gg = GG.new
diff --git a/Examples/test-suite/ruby/dynamic_cast_runme.rb b/Examples/test-suite/ruby/dynamic_cast_runme.rb
new file mode 100755
index 000000000..a7f327bb6
--- /dev/null
+++ b/Examples/test-suite/ruby/dynamic_cast_runme.rb
@@ -0,0 +1,13 @@
+require 'dynamic_cast'
+
+f = Dynamic_cast::Foo.new
+b = Dynamic_cast::Bar.new
+
+x = f.blah
+y = b.blah
+
+a = Dynamic_cast.do_test(y)
+if a != "Bar::test"
+ puts "Failed!!"
+end
+
diff --git a/Examples/test-suite/ruby/enum_runme.rb b/Examples/test-suite/ruby/enum_runme.rb
new file mode 100755
index 000000000..9ea9a29e2
--- /dev/null
+++ b/Examples/test-suite/ruby/enum_runme.rb
@@ -0,0 +1,6 @@
+require 'enum'
+
+Enum.bar2(1)
+Enum.bar3(1)
+Enum.bar1(1)
+
diff --git a/Examples/test-suite/ruby/extend_template_ns_runme.rb b/Examples/test-suite/ruby/extend_template_ns_runme.rb
new file mode 100644
index 000000000..a30959bb2
--- /dev/null
+++ b/Examples/test-suite/ruby/extend_template_ns_runme.rb
@@ -0,0 +1,12 @@
+require 'extend_template_ns'
+
+include Extend_template_ns
+
+f = Foo_One.new
+if f.test1(37) != 37
+ raise RuntimeError
+end
+
+if f.test2(42) != 42
+ raise RuntimeError
+end
diff --git a/Examples/test-suite/ruby/extend_template_runme.rb b/Examples/test-suite/ruby/extend_template_runme.rb
new file mode 100644
index 000000000..8787de7dc
--- /dev/null
+++ b/Examples/test-suite/ruby/extend_template_runme.rb
@@ -0,0 +1,10 @@
+require 'extend_template'
+
+f = Extend_template::Foo_0.new
+if f.test1(37) != 37
+ raise RuntimeError
+end
+
+if f.test2(42) != 42
+ raise RuntimeError
+end
diff --git a/Examples/test-suite/ruby/grouping_runme.rb b/Examples/test-suite/ruby/grouping_runme.rb
new file mode 100644
index 000000000..13cf48943
--- /dev/null
+++ b/Examples/test-suite/ruby/grouping_runme.rb
@@ -0,0 +1,15 @@
+require 'grouping'
+
+x = Grouping.test1(42)
+if x != 42
+ raise RuntimeError
+end
+
+Grouping.test2(42)
+
+x = Grouping.do_unary(37, Grouping::NEGATE)
+if x != -37
+ raise RuntimeError
+end
+
+Grouping.test3 = 42
diff --git a/Examples/test-suite/ruby/imports_runme.rb b/Examples/test-suite/ruby/imports_runme.rb
new file mode 100755
index 000000000..0290bbad2
--- /dev/null
+++ b/Examples/test-suite/ruby/imports_runme.rb
@@ -0,0 +1,9 @@
+# This is the import runtime testcase.
+
+require 'imports_a'
+require 'imports_b'
+
+x = Imports_b::B.new
+
+x.hello
+
diff --git a/Examples/test-suite/ruby/inherit_missing_runme.rb b/Examples/test-suite/ruby/inherit_missing_runme.rb
new file mode 100644
index 000000000..476ef0f7c
--- /dev/null
+++ b/Examples/test-suite/ruby/inherit_missing_runme.rb
@@ -0,0 +1,20 @@
+require 'inherit_missing'
+
+a = Inherit_missing.new_Foo()
+b = Inherit_missing::Bar.new
+c = Inherit_missing::Spam.new
+
+x = Inherit_missing.do_blah(a)
+if x != "Foo::blah"
+ puts "Whoa! Bad return #{x}"
+end
+
+x = Inherit_missing.do_blah(b)
+if x != "Bar::blah"
+ puts "Whoa! Bad return #{x}"
+end
+
+x = Inherit_missing.do_blah(c)
+if x != "Spam::blah"
+ puts "Whoa! Bad return #{x}"
+end
diff --git a/Examples/test-suite/ruby/lib_std_vector_runme.rb b/Examples/test-suite/ruby/lib_std_vector_runme.rb
new file mode 100755
index 000000000..587495f8d
--- /dev/null
+++ b/Examples/test-suite/ruby/lib_std_vector_runme.rb
@@ -0,0 +1,17 @@
+require 'lib_std_vector'
+
+include Lib_std_vector
+
+iv = IntVector.new(4)
+0.upto(3) { |i| iv[i] = i }
+
+x = average(iv)
+y = average([1, 2, 3, 4])
+
+a = half([10, 10.5, 11, 11.5])
+
+dv = DoubleVector.new(10)
+0.upto(9) { |i| dv[i] = i/2.0 }
+
+halve_in_place(dv)
+
diff --git a/Examples/test-suite/ruby/namespace_typemap_runme.rb b/Examples/test-suite/ruby/namespace_typemap_runme.rb
new file mode 100755
index 000000000..6416d615a
--- /dev/null
+++ b/Examples/test-suite/ruby/namespace_typemap_runme.rb
@@ -0,0 +1,33 @@
+require 'namespace_typemap'
+
+include Namespace_typemap
+
+raise RuntimeError if stest1("hello") != "hello"
+
+raise RuntimeError if stest2("hello") != "hello"
+
+raise RuntimeError if stest3("hello") != "hello"
+
+raise RuntimeError if stest4("hello") != "hello"
+
+raise RuntimeError if stest5("hello") != "hello"
+
+raise RuntimeError if stest6("hello") != "hello"
+
+raise RuntimeError if stest7("hello") != "hello"
+
+raise RuntimeError if stest8("hello") != "hello"
+
+raise RuntimeError if stest9("hello") != "hello"
+
+raise RuntimeError if stest10("hello") != "hello"
+
+raise RuntimeError if stest11("hello") != "hello"
+
+raise RuntimeError if stest12("hello") != "hello"
+
+begin
+ ttest1(-14)
+ raise RuntimeError
+rescue RangeError
+end
diff --git a/Examples/test-suite/ruby/newobject1_runme.rb b/Examples/test-suite/ruby/newobject1_runme.rb
new file mode 100644
index 000000000..35f77faa2
--- /dev/null
+++ b/Examples/test-suite/ruby/newobject1_runme.rb
@@ -0,0 +1,15 @@
+require 'newobject1'
+
+include Newobject1
+
+foo1 = Foo.makeFoo
+raise RuntimeError if Foo.fooCount != 1
+
+foo2 = foo1.makeMore
+raise RuntimeError if Foo.fooCount != 2
+
+foo1 = nil ; GC.start
+raise RuntimeError if Foo.fooCount != 1
+
+foo2 = nil ; GC.start
+raise RuntimeError if Foo.fooCount != 0
diff --git a/Examples/test-suite/ruby/newobject2_runme.rb b/Examples/test-suite/ruby/newobject2_runme.rb
new file mode 100644
index 000000000..4519b123e
--- /dev/null
+++ b/Examples/test-suite/ruby/newobject2_runme.rb
@@ -0,0 +1,15 @@
+require 'newobject2'
+
+include Newobject2
+
+foo1 = makeFoo
+raise RuntimeError if fooCount != 1
+
+foo2 = makeFoo
+raise RuntimeError if fooCount != 2
+
+foo1 = nil ; GC.start
+raise RuntimeError if fooCount != 1
+
+foo2 = nil ; GC.start
+raise RuntimeError if fooCount != 0
diff --git a/Examples/test-suite/ruby/overload_copy_runme.rb b/Examples/test-suite/ruby/overload_copy_runme.rb
new file mode 100755
index 000000000..2c555a62b
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_copy_runme.rb
@@ -0,0 +1,6 @@
+require 'overload_copy'
+
+include Overload_copy
+
+f = Foo.new
+g = Foo.new(f)
diff --git a/Examples/test-suite/ruby/overload_extend_runme.rb b/Examples/test-suite/ruby/overload_extend_runme.rb
new file mode 100755
index 000000000..2d252a62a
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_extend_runme.rb
@@ -0,0 +1,8 @@
+require 'overload_extend'
+
+f = Overload_extend::Foo.new
+
+raise RuntimeError if f.test(3) != 1
+raise RuntimeError if f.test("hello") != 2
+raise RuntimeError if f.test(3.5,2.5) != 3
+
diff --git a/Examples/test-suite/ruby/overload_extendc_runme.rb b/Examples/test-suite/ruby/overload_extendc_runme.rb
new file mode 100755
index 000000000..354062a5d
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_extendc_runme.rb
@@ -0,0 +1,7 @@
+require 'overload_extend'
+
+f = Overload_extend::Foo.new
+
+raise RuntimeError if f.test(3) != 1
+raise RuntimeError if f.test("hello") != 2
+raise RuntimeError if f.test(3.5,2.5) != 3
diff --git a/Examples/test-suite/ruby/overload_simple_runme.rb b/Examples/test-suite/ruby/overload_simple_runme.rb
new file mode 100755
index 000000000..3fd292a76
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_simple_runme.rb
@@ -0,0 +1,119 @@
+require 'overload_simple'
+
+include Overload_simple
+
+if foo(3) != "foo:int"
+ raise RuntimeError, "foo(int)"
+end
+
+if foo(3.0) != "foo:double"
+ raise RuntimeError, "foo(double)"
+end
+
+if foo("hello") != "foo:char *"
+ raise RuntimeError, "foo(char *)"
+end
+
+f = Foo.new
+b = Bar.new
+
+if foo(f) != "foo:Foo *"
+ raise RuntimeError, "foo(Foo *)"
+end
+
+if foo(b) != "foo:Bar *"
+ raise RuntimeError, "foo(Bar *)"
+end
+
+v = malloc_void(32)
+
+if foo(v) != "foo:void *"
+ raise RuntimeError, "foo(void *)"
+end
+
+s = Spam.new
+
+if s.foo(3) != "foo:int"
+ raise RuntimeError, "Spam::foo(int)"
+end
+
+if s.foo(3.0) != "foo:double"
+ raise RuntimeError, "Spam::foo(double)"
+end
+
+if s.foo("hello") != "foo:char *"
+ raise RuntimeError, "Spam::foo(char *)"
+end
+
+if s.foo(f) != "foo:Foo *"
+ raise RuntimeError, "Spam::foo(Foo *)"
+end
+
+if s.foo(b) != "foo:Bar *"
+ raise RuntimeError, "Spam::foo(Bar *)"
+end
+
+if s.foo(v) != "foo:void *"
+ raise RuntimeError, "Spam::foo(void *)"
+end
+
+if Spam.bar(3) != "bar:int"
+ raise RuntimeError, "Spam::bar(int)"
+end
+
+if Spam.bar(3.0) != "bar:double"
+ raise RuntimeError, "Spam::bar(double)"
+end
+
+if Spam.bar("hello") != "bar:char *"
+ raise RuntimeError, "Spam::bar(char *)"
+end
+
+if Spam.bar(f) != "bar:Foo *"
+ raise RuntimeError, "Spam::bar(Foo *)"
+end
+
+if Spam.bar(b) != "bar:Bar *"
+ raise RuntimeError, "Spam::bar(Bar *)"
+end
+
+if Spam.bar(v) != "bar:void *"
+ raise RuntimeError, "Spam::bar(void *)"
+end
+
+# Test constructors
+
+s = Spam.new
+if s.type != "none"
+ raise RuntimeError, "Spam()"
+end
+
+s = Spam.new(3)
+if s.type != "int"
+ raise RuntimeError, "Spam(int)"
+end
+
+s = Spam.new(3.4)
+if s.type != "double"
+ raise RuntimeError, "Spam(double)"
+end
+
+s = Spam.new("hello")
+if s.type != "char *"
+ raise RuntimeError, "Spam(char *)"
+end
+
+s = Spam.new(f)
+if s.type != "Foo *"
+ raise RuntimeError, "Spam(Foo *)"
+end
+
+s = Spam.new(b)
+if s.type != "Bar *"
+ raise RuntimeError, "Spam(Bar *)"
+end
+
+s = Spam.new(v)
+if s.type != "void *"
+ raise RuntimeError, "Spam(void *)"
+end
diff --git a/Examples/test-suite/ruby/overload_subtype_runme.rb b/Examples/test-suite/ruby/overload_subtype_runme.rb
new file mode 100644
index 000000000..9737c851c
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_subtype_runme.rb
@@ -0,0 +1,15 @@
+require 'overload_subtype'
+
+include Overload_subtype
+
+f = Foo.new
+b = Bar.new
+
+if spam(f) != 1
+ raise RuntimeError, "foo"
+end
+
+if spam(b) != 2
+ raise RuntimeError, "bar"
+end
+
diff --git a/Examples/test-suite/ruby/overload_template_runme.rb b/Examples/test-suite/ruby/overload_template_runme.rb
new file mode 100755
index 000000000..d01887bf4
--- /dev/null
+++ b/Examples/test-suite/ruby/overload_template_runme.rb
@@ -0,0 +1,6 @@
+require 'overload_template'
+
+f = Overload_template.foo()
+
+a = Overload_template.max(3,4)
+b = Overload_template.max(3.4,5.2)
diff --git a/Examples/test-suite/ruby/primitive_ref_runme.rb b/Examples/test-suite/ruby/primitive_ref_runme.rb
new file mode 100755
index 000000000..11bf37439
--- /dev/null
+++ b/Examples/test-suite/ruby/primitive_ref_runme.rb
@@ -0,0 +1,27 @@
+require 'primitive_ref'
+
+include Primitive_ref
+
+raise RuntimeError if ref_int(3) != 3
+
+raise RuntimeError if ref_uint(3) != 3
+
+raise RuntimeError if ref_short(3) != 3
+
+raise RuntimeError if ref_ushort(3) != 3
+
+raise RuntimeError if ref_long(3) != 3
+
+raise RuntimeError if ref_ulong(3) != 3
+
+raise RuntimeError if ref_schar(3) != 3
+
+raise RuntimeError if ref_uchar(3) != 3
+
+raise RuntimeError if ref_float(3.5) != 3.5
+
+raise RuntimeError if ref_double(3.5) != 3.5
+
+raise RuntimeError if ref_bool(true) != true
+
+raise RuntimeError if ref_char('x') != 'x'
diff --git a/Examples/test-suite/ruby/rename_scope_runme.rb b/Examples/test-suite/ruby/rename_scope_runme.rb
new file mode 100644
index 000000000..ea4fa94a6
--- /dev/null
+++ b/Examples/test-suite/ruby/rename_scope_runme.rb
@@ -0,0 +1,10 @@
+require 'rename_scope'
+
+include Rename_scope
+
+a = Natural_UP.new
+b = Natural_BP.new
+
+raise RuntimeError if a.rtest() != 1
+
+raise RuntimeError if b.rtest() != 1
diff --git a/Examples/test-suite/ruby/smart_pointer_const_runme.rb b/Examples/test-suite/ruby/smart_pointer_const_runme.rb
new file mode 100644
index 000000000..cb852cfe0
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_const_runme.rb
@@ -0,0 +1,13 @@
+require 'smart_pointer_const'
+
+include Smart_pointer_const
+
+f = Foo.new
+b = Bar.new(f)
+
+b.x = 3
+raise RuntimeError if b.getx() != 3
+
+fp = b.__deref__()
+fp.x = 4
+raise RuntimeError if fp.getx() != 4
diff --git a/Examples/test-suite/ruby/smart_pointer_multi_runme.rb b/Examples/test-suite/ruby/smart_pointer_multi_runme.rb
new file mode 100644
index 000000000..96b937a85
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_multi_runme.rb
@@ -0,0 +1,15 @@
+require 'smart_pointer_multi'
+
+include Smart_pointer_multi
+
+f = Foo.new
+b = Bar.new(f)
+s = Spam.new(b)
+g = Grok.new(b)
+
+s.x = 3
+raise RuntimeError if s.getx() != 3
+
+g.x = 4
+raise RuntimeError if g.getx() != 4
+
diff --git a/Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb b/Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb
new file mode 100644
index 000000000..52ddb44f4
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_multi_typedef_runme.rb
@@ -0,0 +1,14 @@
+require 'smart_pointer_multi_typedef'
+
+include Smart_pointer_multi_typedef
+
+f = Foo.new
+b = Bar.new(f)
+s = Spam.new(b)
+g = Grok.new(b)
+
+s.x = 3
+raise RuntimeError if s.getx() != 3
+
+g.x = 4
+raise RuntimeError if g.getx() != 4
diff --git a/Examples/test-suite/ruby/smart_pointer_not_runme.rb b/Examples/test-suite/ruby/smart_pointer_not_runme.rb
new file mode 100644
index 000000000..fcc306115
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_not_runme.rb
@@ -0,0 +1,44 @@
+require 'smart_pointer_not'
+
+include Smart_pointer_not
+
+f = Foo.new
+b = Bar.new(f)
+s = Spam.new(f)
+g = Grok.new(f)
+
+begin
+ x = b.x
+ puts "Error! b.x"
+rescue NameError
+end
+
+begin
+ x = s.x
+ puts "Error! s.x"
+rescue NameError
+end
+
+begin
+ x = g.x
+ puts "Error! g.x"
+rescue NameError
+end
+
+begin
+ x = b.getx()
+ puts "Error! b.getx()"
+rescue NameError
+end
+
+begin
+ x = s.getx()
+ puts "Error! s.getx()"
+rescue NameError
+end
+
+begin
+ x = g.getx()
+ puts "Error! g.getx()"
+rescue NameError
+end
diff --git a/Examples/test-suite/ruby/smart_pointer_overload_runme.rb b/Examples/test-suite/ruby/smart_pointer_overload_runme.rb
new file mode 100644
index 000000000..c32991331
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_overload_runme.rb
@@ -0,0 +1,16 @@
+require 'smart_pointer_overload'
+
+include Smart_pointer_overload
+
+f = Foo.new
+b = Bar.new(f)
+
+
+raise RuntimeError if f.test(3) != 1
+raise RuntimeError if f.test(3.5) != 2
+raise RuntimeError if f.test("hello") != 3
+
+raise RuntimeError if b.test(3) != 1
+raise RuntimeError if b.test(3.5) != 2
+raise RuntimeError if b.test("hello") != 3
+
diff --git a/Examples/test-suite/ruby/smart_pointer_rename_runme.rb b/Examples/test-suite/ruby/smart_pointer_rename_runme.rb
new file mode 100644
index 000000000..0ff378a4c
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_rename_runme.rb
@@ -0,0 +1,12 @@
+require 'smart_pointer_rename'
+
+include Smart_pointer_rename
+
+f = Foo.new
+b = Bar.new(f)
+
+raise RuntimeError if b.test() != 3
+
+raise RuntimeError if b.ftest1(1) != 1
+
+raise RuntimeError if b.ftest2(2,3) != 2
diff --git a/Examples/test-suite/ruby/smart_pointer_simple_runme.rb b/Examples/test-suite/ruby/smart_pointer_simple_runme.rb
new file mode 100644
index 000000000..b2a54b819
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_simple_runme.rb
@@ -0,0 +1,13 @@
+require 'smart_pointer_simple'
+
+include Smart_pointer_simple
+
+f = Foo.new
+b = Bar.new(f)
+
+b.x = 3
+raise RuntimeError if b.getx() != 3
+
+fp = b.__deref__()
+fp.x = 4
+raise RuntimeError if fp.getx() != 4
diff --git a/Examples/test-suite/ruby/smart_pointer_typedef_runme.rb b/Examples/test-suite/ruby/smart_pointer_typedef_runme.rb
new file mode 100644
index 000000000..137723078
--- /dev/null
+++ b/Examples/test-suite/ruby/smart_pointer_typedef_runme.rb
@@ -0,0 +1,13 @@
+require 'smart_pointer_typedef'
+
+include Smart_pointer_typedef
+
+f = Foo.new
+b = Bar.new(f)
+
+b.x = 3
+raise RuntimeError if b.getx() != 3
+
+fp = b.__deref__()
+fp.x = 4
+raise RuntimeError if fp.getx() != 4
diff --git a/Examples/test-suite/ruby/sneaky1_runme.rb b/Examples/test-suite/ruby/sneaky1_runme.rb
new file mode 100755
index 000000000..731e27b97
--- /dev/null
+++ b/Examples/test-suite/ruby/sneaky1_runme.rb
@@ -0,0 +1,6 @@
+require 'sneaky1'
+
+x = Sneaky1.add(3, 4)
+y = Sneaky1.sub(3, 4)
+z = Sneaky1.mul(3, 4)
+w = Sneaky1.divide(3, 4)
diff --git a/Examples/test-suite/ruby/template_inherit_runme.rb b/Examples/test-suite/ruby/template_inherit_runme.rb
new file mode 100755
index 000000000..e2c947495
--- /dev/null
+++ b/Examples/test-suite/ruby/template_inherit_runme.rb
@@ -0,0 +1,40 @@
+require 'template_inherit'
+
+include Template_inherit
+
+a = FooInt.new
+b = FooDouble.new
+c = BarInt.new
+d = BarDouble.new
+e = FooUInt.new
+f = BarUInt.new
+
+raise ValueError if a.blah() != "Foo"
+
+raise ValueError if b.blah() != "Foo"
+
+raise ValueError if e.blah() != "Foo"
+
+raise ValueError if c.blah() != "Bar"
+
+raise ValueError if d.blah() != "Bar"
+
+raise ValueError if f.blah() != "Bar"
+
+raise ValueError if c.foomethod() != "foomethod"
+
+raise ValueError if d.foomethod() != "foomethod"
+
+raise ValueError if f.foomethod() != "foomethod"
+
+raise ValueError if invoke_blah_int(a) != "Foo"
+
+raise ValueError if invoke_blah_int(c) != "Bar"
+
+raise ValueError if invoke_blah_double(b) != "Foo"
+
+raise ValueError if invoke_blah_double(d) != "Bar"
+
+raise ValueError if invoke_blah_uint(e) != "Foo"
+
+raise ValueError if invoke_blah_uint(f) != "Bar"
diff --git a/Examples/test-suite/ruby/template_ns4_runme.rb b/Examples/test-suite/ruby/template_ns4_runme.rb
new file mode 100755
index 000000000..5c55ff94f
--- /dev/null
+++ b/Examples/test-suite/ruby/template_ns4_runme.rb
@@ -0,0 +1,4 @@
+require 'template_ns4'
+
+d = Template_ns4.make_Class_DD()
+raise RuntimeError if d.test() != "test"
diff --git a/Examples/test-suite/ruby/template_ns_runme.rb b/Examples/test-suite/ruby/template_ns_runme.rb
new file mode 100755
index 000000000..d69e8e3d4
--- /dev/null
+++ b/Examples/test-suite/ruby/template_ns_runme.rb
@@ -0,0 +1,15 @@
+require 'template_ns'
+
+include Template_ns
+
+p1 = Pairii.new(2, 3)
+p2 = Pairii.new(p1)
+
+raise RuntimeError if p2.first != 2
+raise RuntimeError if p2.second != 3
+
+p3 = Pairdd.new(3.5, 2.5)
+p4 = Pairdd.new(p3)
+
+raise RuntimeError if p4.first != 3.5
+raise RuntimeError if p4.second != 2.5
diff --git a/Examples/test-suite/ruby/template_rename_runme.rb b/Examples/test-suite/ruby/template_rename_runme.rb
new file mode 100755
index 000000000..04be6c94d
--- /dev/null
+++ b/Examples/test-suite/ruby/template_rename_runme.rb
@@ -0,0 +1,12 @@
+require 'template_rename'
+
+i = Template_rename::IFoo.new
+d = Template_rename::DFoo.new
+
+a = i.blah_test(4)
+b = i.spam_test(5)
+c = i.grok_test(6)
+
+x = d.blah_test(7)
+y = d.spam(8)
+z = d.grok_test(9)
diff --git a/Examples/test-suite/ruby/typedef_inherit_runme.rb b/Examples/test-suite/ruby/typedef_inherit_runme.rb
new file mode 100755
index 000000000..591b9efdb
--- /dev/null
+++ b/Examples/test-suite/ruby/typedef_inherit_runme.rb
@@ -0,0 +1,27 @@
+require 'typedef_inherit'
+
+a = Typedef_inherit::Foo.new
+b = Typedef_inherit::Bar.new
+
+x = Typedef_inherit.do_blah(a)
+if x != "Foo::blah"
+ puts "Whoa! Bad return #{x}"
+end
+
+x = Typedef_inherit.do_blah(b)
+if x != "Bar::blah"
+ puts "Whoa! Bad return #{x}"
+end
+
+c = Typedef_inherit::Spam.new
+d = Typedef_inherit::Grok.new
+
+x = Typedef_inherit.do_blah2(c)
+if x != "Spam::blah"
+ puts "Whoa! Bad return #{x}"
+end
+
+x = Typedef_inherit.do_blah2(d)
+if x != "Grok::blah"
+ puts "Whoa! Bad return #{x}"
+end
diff --git a/Examples/test-suite/ruby/typedef_scope_runme.rb b/Examples/test-suite/ruby/typedef_scope_runme.rb
new file mode 100755
index 000000000..db7a9f2c9
--- /dev/null
+++ b/Examples/test-suite/ruby/typedef_scope_runme.rb
@@ -0,0 +1,13 @@
+require 'typedef_scope'
+
+b = Typedef_scope::Bar.new
+
+x = b.test1(42, "hello")
+if x != 42
+ puts "Failed!!"
+end
+
+x = b.test2(42, "hello")
+if x != "hello"
+ puts "Failed!!"
+end
diff --git a/Examples/test-suite/ruby/typemap_namespace_runme.rb b/Examples/test-suite/ruby/typemap_namespace_runme.rb
new file mode 100755
index 000000000..57986348d
--- /dev/null
+++ b/Examples/test-suite/ruby/typemap_namespace_runme.rb
@@ -0,0 +1,7 @@
+require 'typemap_namespace'
+
+include Typemap_namespace
+
+raise RuntimeError if test1("hello") != "hello"
+
+raise RuntimeError if test2("hello") != "hello"
diff --git a/Examples/test-suite/ruby/typename_runme.rb b/Examples/test-suite/ruby/typename_runme.rb
new file mode 100755
index 000000000..689499f12
--- /dev/null
+++ b/Examples/test-suite/ruby/typename_runme.rb
@@ -0,0 +1,14 @@
+require 'typename'
+
+f = Typename::Foo.new
+b = Typename::Bar.new
+
+x = Typename.twoFoo(f)
+unless x.is_a? Float
+ puts "Wrong return type!"
+end
+
+y = Typename.twoBar(b)
+unless y.is_a? Integer
+ puts "Wrong return type!"
+end
diff --git a/Examples/test-suite/ruby/unions_runme.rb b/Examples/test-suite/ruby/unions_runme.rb
new file mode 100644
index 000000000..17344f7e5
--- /dev/null
+++ b/Examples/test-suite/ruby/unions_runme.rb
@@ -0,0 +1,54 @@
+
+# This is the union runtime testcase. It ensures that values within a
+# union embedded within a struct can be set and read correctly.
+
+require 'unions'
+
+# Create new instances of SmallStruct and BigStruct for later use
+small = Unions::SmallStruct.new()
+small.jill = 200
+
+big = Unions::BigStruct.new()
+big.smallstruct = small
+big.jack = 300
+
+# Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
+# Ensure values in EmbeddedUnionTest are set correctly for each.
+eut = Unions::EmbeddedUnionTest.new()
+
+# First check the SmallStruct in EmbeddedUnionTest
+eut.number = 1
+eut.uni.small = small
+Jill1 = eut.uni.small.jill
+if (Jill1 != 200)
+ print "Runtime test1 failed. eut.uni.small.jill=" , Jill1 , "\n"
+ exit 1
+end
+
+Num1 = eut.number
+if (Num1 != 1)
+ print "Runtime test2 failed. eut.number=" , Num1 , "\n"
+ exit 1
+end
+
+# Secondly check the BigStruct in EmbeddedUnionTest
+eut.number = 2
+eut.uni.big = big
+Jack1 = eut.uni.big.jack
+if (Jack1 != 300)
+ print "Runtime test3 failed. eut.uni.big.jack=" , Jack1 , "\n"
+ exit 1
+end
+
+Jill2 = eut.uni.big.smallstruct.jill
+if (Jill2 != 200)
+ print "Runtime test4 failed. eut.uni.big.smallstruct.jill=" , Jill2 , "\n"
+ exit 1
+end
+
+Num2 = eut.number
+if (Num2 != 2)
+ print "Runtime test5 failed. eut.number=" , Num2 , "\n"
+ exit 1
+end
+
diff --git a/Examples/test-suite/sizeof_pointer.i b/Examples/test-suite/sizeof_pointer.i
new file mode 100644
index 000000000..993ba4de5
--- /dev/null
+++ b/Examples/test-suite/sizeof_pointer.i
@@ -0,0 +1,19 @@
+/*
+This testcase tests whether the sizeof operator on a pointer is working.
+*/
+
+%module sizeof_pointer
+
+%inline %{
+
+#define NO_PROBLEM sizeof(char)
+#define STAR_PROBLEM sizeof(char*)
+#define STAR_STAR_PROBLEM sizeof(char**)
+
+typedef struct SizeofPointerTest {
+ unsigned char array1[NO_PROBLEM];
+ unsigned char array2[STAR_PROBLEM];
+ unsigned char array3[STAR_STAR_PROBLEM];
+} SizeofPointerTest;
+
+%}
diff --git a/Examples/test-suite/smart_pointer_const.i b/Examples/test-suite/smart_pointer_const.i
new file mode 100644
index 000000000..3100a021e
--- /dev/null
+++ b/Examples/test-suite/smart_pointer_const.i
@@ -0,0 +1,19 @@
+%module smart_pointer_const
+
+%inline %{
+struct Foo {
+ int x;
+ int getx() const { return x; }
+};
+
+class Bar {
+ Foo *f;
+public:
+ Bar(Foo *f) : f(f) { }
+ Foo *operator->() {
+ return f;
+ }
+};
+%}
+
+
diff --git a/Examples/test-suite/smart_pointer_multi.i b/Examples/test-suite/smart_pointer_multi.i
new file mode 100644
index 000000000..4b0aa0e4b
--- /dev/null
+++ b/Examples/test-suite/smart_pointer_multi.i
@@ -0,0 +1,39 @@
+// Test cases for classes that do *NOT* result in smart-pointer wrapping
+%module smart_pointer_multi
+
+%inline %{
+struct Foo {
+ int x;
+ int getx() { return x; }
+};
+
+class Bar {
+ Foo *f;
+public:
+ Bar(Foo *f) : f(f) { }
+ Foo *operator->() {
+ return f;
+ }
+};
+
+class Spam {
+ Bar *b;
+public:
+ Spam(Bar *b) : b(b) { }
+ Bar operator->() {
+ return *b;
+ }
+};
+
+class Grok {
+ Bar *b;
+public:
+ Grok(Bar *b) : b(b) { }
+ Bar &operator->() {
+ return *b;
+ }
+};
+
+%}
+
+
diff --git a/Examples/test-suite/smart_pointer_multi_typedef.i b/Examples/test-suite/smart_pointer_multi_typedef.i
new file mode 100644
index 000000000..ed32b703a
--- /dev/null
+++ b/Examples/test-suite/smart_pointer_multi_typedef.i
@@ -0,0 +1,45 @@
+// Test cases for classes that do *NOT* result in smart-pointer wrapping
+%module smart_pointer_multi_typedef
+
+%inline %{
+struct Foo {
+ int x;
+ int getx() { return x; }
+};
+
+typedef Foo FooObj;
+typedef FooObj *FooPtr;
+
+class Bar {
+ Foo *f;
+public:
+ Bar(Foo *f) : f(f) { }
+ FooPtr operator->() {
+ return f;
+ }
+};
+
+typedef Bar BarObj;
+typedef Bar &BarRef;
+
+class Spam {
+ Bar *b;
+public:
+ Spam(Bar *b) : b(b) { }
+ BarObj operator->() {
+ return *b;
+ }
+};
+
+class Grok {
+ Bar *b;
+public:
+ Grok(Bar *b) : b(b) { }
+ BarRef operator->() {
+ return *b;
+ }
+};
+
+%}
+
+
diff --git a/Examples/test-suite/smart_pointer_not.i b/Examples/test-suite/smart_pointer_not.i
new file mode 100644
index 000000000..712aa48fb
--- /dev/null
+++ b/Examples/test-suite/smart_pointer_not.i
@@ -0,0 +1,39 @@
+// Test cases for classes that do *NOT* result in smart-pointer wrapping
+%module smart_pointer_not
+
+%inline %{
+struct Foo {
+ int x;
+ int getx() { return x; }
+};
+
+class Bar {
+ Foo *f;
+public:
+ Bar(Foo *f) : f(f) { }
+ Foo operator->() {
+ return *f;
+ }
+};
+
+class Spam {
+ Foo *f;
+public:
+ Spam(Foo *f) : f(f) { }
+ Foo &operator->() {
+ return *f;
+ }
+};
+
+class Grok {
+ Foo *f;
+public:
+ Grok(Foo *f) : f(f) { }
+ Foo **operator->() {
+ return &f;
+ }
+};
+
+%}
+
+
diff --git a/Examples/test-suite/smart_pointer_overload.i b/Examples/test-suite/smart_pointer_overload.i
new file mode 100644
index 000000000..ffc2097be
--- /dev/null
+++ b/Examples/test-suite/smart_pointer_overload.i
@@ -0,0 +1,24 @@
+%module smart_pointer_overload
+
+#ifndef SWIG_NO_OVERLOAD
+
+%inline %{
+struct Foo {
+ int x;
+ int test(int x) { x = 0; return 1; }
+ int test(double x) { x = 0; return 2; }
+ int test(char *s) { s = 0; return 3; }
+};
+
+class Bar {
+ Foo *f;
+public:
+ Bar(Foo *f) : f(f) { }
+ Foo *operator->() {
+ return f;
+ }
+};
+%}
+
+#endif
+
diff --git a/Examples/test-suite/smart_pointer_protected.i b/Examples/test-suite/smart_pointer_protected.i
new file mode 100644
index 000000000..8f33d9484
--- /dev/null
+++ b/Examples/test-suite/smart_pointer_protected.i
@@ -0,0 +1,29 @@
+%module smart_pointer_protected
+
+%inline %{
+
+ namespace hi
+ {
+ struct A
+ {
+ virtual int value(A*) = 0;
+ };
+
+ struct B : A
+ {
+ protected:
+ int value(A*)
+ {
+ return 1;
+ }
+ };
+
+ struct C
+ {
+ hi::B* operator->() const { return new hi::B(); }
+ };
+ }
+
+
+%}
+
diff --git a/Examples/test-suite/smart_pointer_rename.i b/Examples/test-suite/smart_pointer_rename.i
new file mode 100644
index 000000000..b137ffe71
--- /dev/null
+++ b/Examples/test-suite/smart_pointer_rename.i
@@ -0,0 +1,25 @@
+%module smart_pointer_rename
+
+%rename(ftest1) Foo::test(int);
+%rename(ftest2) Foo::test(int,int);
+
+%inline %{
+
+class Foo {
+public:
+ int test(int) { return 1; }
+ int test(int,int) { return 2; }
+};
+
+class Bar {
+ Foo *f;
+public:
+ Bar(Foo *_f) : f(_f) { }
+ Foo *operator->() { return f; }
+ int test() { return 3; }
+};
+
+%}
+
+
+
diff --git a/Examples/test-suite/smart_pointer_simple.i b/Examples/test-suite/smart_pointer_simple.i
new file mode 100644
index 000000000..ceb499c41
--- /dev/null
+++ b/Examples/test-suite/smart_pointer_simple.i
@@ -0,0 +1,19 @@
+%module smart_pointer_simple
+
+%inline %{
+struct Foo {
+ int x;
+ int getx() { return x; }
+};
+
+class Bar {
+ Foo *f;
+public:
+ Bar(Foo *f) : f(f) { }
+ Foo *operator->() {
+ return f;
+ }
+};
+%}
+
+
diff --git a/Examples/test-suite/smart_pointer_typedef.i b/Examples/test-suite/smart_pointer_typedef.i
new file mode 100644
index 000000000..d4e874f5c
--- /dev/null
+++ b/Examples/test-suite/smart_pointer_typedef.i
@@ -0,0 +1,21 @@
+%module smart_pointer_typedef
+
+%inline %{
+struct Foo {
+ int x;
+ int getx() { return x; }
+};
+
+typedef Foo *FooPtr;
+
+class Bar {
+ Foo *f;
+public:
+ Bar(Foo *f) : f(f) { }
+ FooPtr operator->() {
+ return f;
+ }
+};
+%}
+
+
diff --git a/Examples/test-suite/sneaky1.i b/Examples/test-suite/sneaky1.i
new file mode 100644
index 000000000..bacf4a978
--- /dev/null
+++ b/Examples/test-suite/sneaky1.i
@@ -0,0 +1,29 @@
+%module sneaky1
+
+%{
+int add(int x, int y) {
+ return x+y;
+}
+
+int sub(int x, int y) {
+ return x-y;
+}
+int mul(int x, int y) {
+ return x*y;
+}
+
+int divide(int x, int y) {
+ return x/y;
+}
+%}
+
+%inline %{
+typedef int binop(int,int);
+%}
+
+binop add,sub,mul,divide;
+
+
+
+
+
diff --git a/Examples/test-suite/static_array_member.i b/Examples/test-suite/static_array_member.i
new file mode 100644
index 000000000..8a7cfefae
--- /dev/null
+++ b/Examples/test-suite/static_array_member.i
@@ -0,0 +1,12 @@
+/* This interface file checks whether the SWIG parser handles static
+ array members of classes. Bug reported by Annalisa Terracina
+ <annalisa.terracina@datamat.it> on 2001-07-03.
+*/
+
+%module static_array_member
+
+%pragma no_default
+class RB {
+ static char *rberror[];
+};
+
diff --git a/Examples/test-suite/static_const_member.i b/Examples/test-suite/static_const_member.i
new file mode 100644
index 000000000..99dc89bd1
--- /dev/null
+++ b/Examples/test-suite/static_const_member.i
@@ -0,0 +1,17 @@
+/* Swig 1.3.6 does not understand initialization of static class
+ constants like this. SF Bug #445221, reported by Krzysztof
+ Kozminski <kozminski@users.sf.net>.
+*/
+
+%module static_const_member
+
+%inline %{
+
+class X {
+public:
+ static const int PN = 0;
+ static const int CN = 1;
+ static const int EN = 2;
+};
+
+%}
diff --git a/Examples/test-suite/static_const_member_2.i b/Examples/test-suite/static_const_member_2.i
new file mode 100644
index 000000000..3bd08b820
--- /dev/null
+++ b/Examples/test-suite/static_const_member_2.i
@@ -0,0 +1,53 @@
+%module static_const_member_2
+
+%warnfilter(801) oss::modules::CavityPackFlags::forward_field;
+%warnfilter(801) oss::modules::CavityPackFlags::backward_field;
+%warnfilter(801) oss::modules::Test::current_profile;
+
+%inline %{
+ namespace oss
+ {
+ namespace modules
+ {
+ struct CavityPackFlags
+ {
+ typedef unsigned int viewflags;
+ static const viewflags forward_field = 1 << 0;
+ static const viewflags backward_field = 1 << 1;
+ static const viewflags cavity_flags;
+ static viewflags flags;
+ static const int &reftest;
+ };
+
+ template <class T>
+ struct Test : CavityPackFlags
+ {
+ enum {LeftIndex, RightIndex};
+ static const viewflags current_profile = 1 << 2;
+ };
+ }
+ }
+
+%}
+
+%{
+
+int refvalue = 42;
+const int &oss::modules::CavityPackFlags::reftest = refvalue;
+
+%}
+
+%{
+ using oss::modules::CavityPackFlags;
+
+ const CavityPackFlags::viewflags
+ CavityPackFlags::cavity_flags =
+ CavityPackFlags::forward_field | CavityPackFlags::backward_field;
+
+ CavityPackFlags::viewflags
+ CavityPackFlags::flags = 0;
+
+%}
+
+%template(Test_int) oss::modules::Test<int>;
+
diff --git a/Examples/test-suite/struct_value.i b/Examples/test-suite/struct_value.i
new file mode 100644
index 000000000..bf944e2c5
--- /dev/null
+++ b/Examples/test-suite/struct_value.i
@@ -0,0 +1,14 @@
+%module struct_value
+
+%inline %{
+
+struct Foo {
+ int x;
+};
+
+struct Bar {
+ Foo a;
+ struct Foo b;
+};
+
+%}
diff --git a/Examples/test-suite/sym.i b/Examples/test-suite/sym.i
new file mode 100644
index 000000000..83226cbaa
--- /dev/null
+++ b/Examples/test-suite/sym.i
@@ -0,0 +1,24 @@
+%module sym
+// make sure different classes are allowed to have methods of the same name
+// that we properly qualify wrappers in the C namespace to avoid collisions
+
+%rename(hulahoops) Flim::Jam();
+
+%inline %{
+
+class Flim {
+public:
+ Flim() { }
+ const char * Jam() { return "flim-jam"; }
+ const char * Jar() { return "flim-jar"; }
+};
+
+class Flam {
+public:
+ Flam() { }
+ const char * Jam() { return "flam-jam"; }
+ const char * Jar() { return "flam-jar"; }
+};
+
+%}
+
diff --git a/Examples/test-suite/tcl/.cvsignore b/Examples/test-suite/tcl/.cvsignore
new file mode 100644
index 000000000..09e0b6c2e
--- /dev/null
+++ b/Examples/test-suite/tcl/.cvsignore
@@ -0,0 +1,3 @@
+*wrap*
+*.so
+*.dll
diff --git a/Examples/test-suite/tcl/Makefile b/Examples/test-suite/tcl/Makefile
new file mode 100644
index 000000000..4e54379e0
--- /dev/null
+++ b/Examples/test-suite/tcl/Makefile
@@ -0,0 +1,41 @@
+#######################################################################
+# $Header$
+# Makefile for tcl test-suite
+#######################################################################
+
+LANGUAGE = tcl
+SCRIPTSUFFIX = _runme.tcl
+
+include ../common.mk
+
+# Overridden variables here
+
+# Rules for the different types of tests
+%.cpptest:
+ $(setup) \
+ ($(swig_and_compile_cpp); ); \
+ $(run_testcase)
+
+%.ctest:
+ $(setup) \
+ ($(swig_and_compile_c); ); \
+ $(run_testcase)
+
+%.multicpptest:
+ $(setup) \
+ ($(swig_and_compile_multi_cpp); ); \
+ $(run_testcase)
+
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.tcl appended after the testcase name.
+run_testcase = \
+ if [ -f $*\_runme.tcl ]; then ( \
+ env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH tclsh $*\_runme.tcl;) \
+ fi;
+
+# Clean
+%.clean:
+
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile tcl_clean
diff --git a/Examples/test-suite/tcl/README b/Examples/test-suite/tcl/README
new file mode 100644
index 000000000..c36c3aa9a
--- /dev/null
+++ b/Examples/test-suite/tcl/README
@@ -0,0 +1,4 @@
+See ../README for common README file.
+
+Any testcases which have _runme.tcl appended after the testcase name will be detected and run.
+
diff --git a/Examples/test-suite/tcl/import_nomodule_runme.tcl b/Examples/test-suite/tcl/import_nomodule_runme.tcl
new file mode 100644
index 000000000..f53429b55
--- /dev/null
+++ b/Examples/test-suite/tcl/import_nomodule_runme.tcl
@@ -0,0 +1,10 @@
+
+if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
+ if [ catch { load ./import_nomodule.dll import_nomodule} err_msg ] {
+ puts stderr "Could not load dll:\n$err_msg"
+ }
+} else {
+ if [ catch { load ./import_nomodule.so import_nomodule} err_msg ] {
+ puts stderr "Could not load shared object:\n$err_msg"
+ }
+}
diff --git a/Examples/test-suite/tcl/imports_runme.tcl b/Examples/test-suite/tcl/imports_runme.tcl
new file mode 100644
index 000000000..c20cbad84
--- /dev/null
+++ b/Examples/test-suite/tcl/imports_runme.tcl
@@ -0,0 +1,26 @@
+
+# This is the imports runtime testcase.
+
+if { [ string match $tcl_platform(os) Windows* ] == 1 } {
+ if [ catch { load ./imports_a.dll imports_a} err_msg ] { ;# Windows
+ puts stderr "Could not load dll:\n$err_msg"
+ exit 1
+ }
+ if [ catch { load ./imports_b.dll imports_b} err_msg ] { ;# Windows
+ puts stderr "Could not load dll:\n$err_msg"
+ exit 1
+ }
+} else {
+ if [ catch { load ./imports_a.so imports_a} err_msg ] {
+ puts stderr "Could not load shared object:\n$err_msg"
+ exit 1
+ }
+ if [ catch { load ./imports_b.so imports_b} err_msg ] {
+ puts stderr "Could not load shared object:\n$err_msg"
+ exit 1
+ }
+}
+
+set x [new_B]
+A_hello $x
+
diff --git a/Examples/test-suite/tcl/overload_copy_runme.tcl b/Examples/test-suite/tcl/overload_copy_runme.tcl
new file mode 100644
index 000000000..32b62f2a9
--- /dev/null
+++ b/Examples/test-suite/tcl/overload_copy_runme.tcl
@@ -0,0 +1,18 @@
+
+if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
+ if [ catch { load ./overload_copy.dll overload_copy} err_msg ] {
+ puts stderr "Could not load dll:\n$err_msg"
+ }
+} else {
+ if [ catch { load ./overload_copy.so overload_copy} err_msg ] {
+ puts stderr "Could not load shared object:\n$err_msg"
+ }
+}
+
+Foo f
+Foo g [f cget -this]
+
+
+
+
+
diff --git a/Examples/test-suite/tcl/overload_simple_runme.tcl b/Examples/test-suite/tcl/overload_simple_runme.tcl
new file mode 100644
index 000000000..b8fa63553
--- /dev/null
+++ b/Examples/test-suite/tcl/overload_simple_runme.tcl
@@ -0,0 +1,172 @@
+
+if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
+ if [ catch { load ./overload_simple.dll overload_simple} err_msg ] {
+ puts stderr "Could not load dll:\n$err_msg"
+ }
+} else {
+ if [ catch { load ./overload_simple.so overload_simple} err_msg ] {
+ puts stderr "Could not load shared object:\n$err_msg"
+ }
+}
+
+set f [new_Foo]
+set b [new_Bar]
+set v [malloc_void 32]
+
+set x [foo 3]
+if {$x != "foo:int"} {
+ puts stderr "foo(int) test failed"
+ exit 1
+}
+
+set x [foo 3.4]
+if {$x != "foo:double"} {
+ puts stderr "foo(double) test failed"
+ exit 1
+}
+
+set x [foo hello]
+if {$x != "foo:char *"} {
+ puts stderr "foo(char *) test failed"
+ exit 1
+}
+
+set x [foo $f]
+if {$x != "foo:Foo *"} {
+ puts stderr "foo(Foo *) test failed"
+ exit 1
+}
+
+set x [foo $b]
+if {$x != "foo:Bar *"} {
+ puts stderr "foo(Bar *) test failed"
+ exit 1
+}
+
+set x [foo $v]
+if {$x != "foo:void *"} {
+ puts stderr "foo(void *) test failed"
+ exit 1
+}
+
+Spam s
+
+set x [s foo 3]
+if {$x != "foo:int"} {
+ puts stderr "Spam::foo(int) test failed"
+ exit 1
+}
+
+set x [s foo 3.4]
+if {$x != "foo:double"} {
+ puts stderr "Spam::foo(double) test failed"
+ exit 1
+}
+
+set x [s foo hello]
+if {$x != "foo:char *"} {
+ puts stderr "Spam::foo(char *) test failed"
+ exit 1
+}
+
+set x [s foo $f]
+if {$x != "foo:Foo *"} {
+ puts stderr "Spam::foo(Foo *) test failed"
+ exit 1
+}
+
+set x [s foo $b]
+if {$x != "foo:Bar *"} {
+ puts stderr "Spam::foo(Bar *) test failed"
+ exit 1
+}
+
+set x [s foo $v]
+if {$x != "foo:void *"} {
+ puts stderr "Spam::foo(void *) test failed"
+ exit 1
+}
+
+
+set x [Spam_bar 3]
+if {$x != "bar:int"} {
+ puts stderr "Spam::bar(int) test failed"
+ exit 1
+}
+
+set x [Spam_bar 3.4]
+if {$x != "bar:double"} {
+ puts stderr "Spam::bar(double) test failed"
+ exit 1
+}
+
+set x [Spam_bar hello]
+if {$x != "bar:char *"} {
+ puts stderr "Spam::bar(char *) test failed"
+ exit 1
+}
+
+set x [Spam_bar $f]
+if {$x != "bar:Foo *"} {
+ puts stderr "Spam::bar(Foo *) test failed"
+ exit 1
+}
+
+set x [Spam_bar $b]
+if {$x != "bar:Bar *"} {
+ puts stderr "Spam::bar(Bar *) test failed"
+ exit 1
+}
+
+set x [Spam_bar $v]
+if {$x != "bar:void *"} {
+ puts stderr "Spam::bar(void *) test failed"
+ exit 1
+}
+
+Spam s
+set x [s cget -type]
+if {$x != "none"} {
+ puts stderr "Spam() test failed"
+}
+
+Spam s 3
+set x [s cget -type]
+if {$x != "int"} {
+ puts stderr "Spam(int) test failed"
+}
+
+Spam s 3.4
+set x [s cget -type]
+if {$x != "double"} {
+ puts stderr "Spam(double) test failed"
+}
+
+Spam s hello
+set x [s cget -type]
+if {$x != "char *"} {
+ puts stderr "Spam(char *) test failed"
+}
+
+Spam s $f
+set x [s cget -type]
+if {$x != "Foo *"} {
+ puts stderr "Spam(Foo *) test failed"
+}
+
+Spam s $b
+set x [s cget -type]
+if {$x != "Bar *"} {
+ puts stderr "Spam(Bar *) test failed"
+}
+
+Spam s $v
+set x [s cget -type]
+if {$x != "void *"} {
+ puts stderr "Spam(void *) test failed"
+}
+
+
+
+
+
diff --git a/Examples/test-suite/tcl/primitive_ref_runme.tcl b/Examples/test-suite/tcl/primitive_ref_runme.tcl
new file mode 100644
index 000000000..b4de97fd1
--- /dev/null
+++ b/Examples/test-suite/tcl/primitive_ref_runme.tcl
@@ -0,0 +1,25 @@
+# Primitive ref testcase. Tests to make sure references to
+# primitive types are passed by value
+
+if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
+ if [ catch { load ./primitive_ref.dll primitive_ref} err_msg ] {
+ puts stderr "Could not load dll:\n$err_msg"
+ }
+} else {
+ if [ catch { load ./primitive_ref.so primitive_ref} err_msg ] {
+ puts stderr "Could not load shared object:\n$err_msg"
+ }
+}
+
+if { [ref_int 3] != 3 } { puts stderr "ref_int failed" }
+if { [ref_uint 3] != 3 } { puts stderr "ref_uint failed" }
+if { [ref_short 3] != 3 } { puts stderr "ref_short failed" }
+if { [ref_ushort 3] != 3 } { puts stderr "ref_ushort failed" }
+if { [ref_long 3] != 3 } { puts stderr "ref_long failed" }
+if { [ref_ulong 3] != 3 } { puts stderr "ref_ulong failed" }
+if { [ref_schar 3] != 3 } { puts stderr "ref_schar failed" }
+if { [ref_uchar 3] != 3 } { puts stderr "ref_uchar failed" }
+if { [ref_float 3.5] != 3.5 } { puts stderr "ref_float failed" }
+if { [ref_double 3.5] != 3.5 } { puts stderr "ref_double failed" }
+if { [ref_char x] != "x" } { puts stderr "ref_char failed" }
+
diff --git a/Examples/test-suite/tcl/unions_runme.tcl b/Examples/test-suite/tcl/unions_runme.tcl
new file mode 100644
index 000000000..7238698f5
--- /dev/null
+++ b/Examples/test-suite/tcl/unions_runme.tcl
@@ -0,0 +1,69 @@
+
+# This is the union runtime testcase. It ensures that values within a
+# union embedded within a struct can be set and read correctly.
+
+if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
+ if [ catch { load ./unions.dll unions} err_msg ] {
+ puts stderr "Could not load dll:\n$err_msg"
+ }
+} else {
+ if [ catch { load ./unions.so unions} err_msg ] {
+ puts stderr "Could not load shared object:\n$err_msg"
+ }
+}
+
+# Create new instances of SmallStruct and BigStruct for later use
+SmallStruct small
+small configure -jill 200
+
+BigStruct big
+big configure -smallstruct [small cget -this]
+big configure -jack 300
+
+# Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
+# Ensure values in EmbeddedUnionTest are set correctly for each.
+EmbeddedUnionTest eut
+
+# First check the SmallStruct in EmbeddedUnionTest
+eut configure -number 1
+
+#eut.uni.small = small
+EmbeddedUnionTest_uni_small_set [EmbeddedUnionTest_uni_get [eut cget -this] ] [small cget -this]
+
+#Jill1 = eut.uni.small.jill
+set Jill1 [SmallStruct_jill_get [EmbeddedUnionTest_uni_small_get [EmbeddedUnionTest_uni_get [eut cget -this] ] ] ]
+if {$Jill1 != 200} {
+ puts stderr "Runtime test1 failed. eut.uni.small.jill=$Jill1"
+ exit 1
+}
+
+set Num1 [eut cget -number]
+if {$Num1 != 1} {
+ puts stderr "Runtime test2 failed. eut.number=$Num1"
+ exit 1
+}
+
+# Secondly check the BigStruct in EmbeddedUnionTest
+eut configure -number 2
+#eut.uni.big = big
+EmbeddedUnionTest_uni_big_set [EmbeddedUnionTest_uni_get [eut cget -this] ] [big cget -this]
+#Jack1 = eut.uni.big.jack
+set Jack1 [BigStruct_jack_get [EmbeddedUnionTest_uni_big_get [EmbeddedUnionTest_uni_get [eut cget -this] ] ] ]
+if {$Jack1 != 300} {
+ puts stderr "Runtime test3 failed. eut.uni.big.jack=$Jack1"
+ exit 1
+}
+
+#Jill2 = eut.uni.big.smallstruct.jill
+set Jill2 [SmallStruct_jill_get [BigStruct_smallstruct_get [EmbeddedUnionTest_uni_big_get [EmbeddedUnionTest_uni_get [eut cget -this] ] ] ] ]
+if {$Jill2 != 200} {
+ puts stderr "Runtime test4 failed. eut.uni.big.smallstruct.jill=$Jill2"
+ exit 1
+}
+
+set Num2 [eut cget -number]
+if {$Num2 != 2} {
+ puts stderr "Runtime test5 failed. eut.number=$Num2"
+ exit 1
+}
+
diff --git a/Examples/test-suite/template.i b/Examples/test-suite/template.i
new file mode 100644
index 000000000..68a9aadd1
--- /dev/null
+++ b/Examples/test-suite/template.i
@@ -0,0 +1,46 @@
+/* File : example.i */
+%module "template"
+
+%warnfilter(801) vector<int>; /* Ruby, wrong class name */
+%warnfilter(801) vector<double>; /* Ruby, wrong class name */
+%warnfilter(801) vector<int (*)[10]>; /* Ruby, wrong class name */
+
+/* Let's just grab the original header file here */
+
+%inline %{
+
+template<class T> T max(const T a, const T b) { return a>b ? a : b; }
+
+template<class T> class vector {
+ T *v;
+ int sz;
+ public:
+ vector(int _sz) {
+ v = new T[_sz];
+ sz = _sz;
+ }
+ T &get(int index) {
+ return v[index];
+ }
+ void set(int index, T &val) {
+ v[index] = val;
+ }
+ // This really doesn't do anything except test const handling
+ void testconst(const T x) { }
+};
+
+%}
+
+/* Now instantiate some specific template declarations */
+
+%template(maxint) max<int>;
+%template(maxdouble) max<double>;
+%template(vecint) vector<int>;
+%template(vecdouble) vector<double>;
+
+/* Now try to break constness */
+
+%template(maxintp) max<int (*)[10]>;
+%template(vecintp) vector<int (*)[10]>;
+
+
diff --git a/Examples/test-suite/template_arg_scope.i b/Examples/test-suite/template_arg_scope.i
new file mode 100644
index 000000000..36b593c3d
--- /dev/null
+++ b/Examples/test-suite/template_arg_scope.i
@@ -0,0 +1,16 @@
+%module template_arg_scope
+%inline %{
+
+template<class T> class Foo {
+};
+
+class Bar {
+public:
+ Bar();
+ void spam(Foo<Bar> *x);
+};
+Bar::Bar() {}
+void Bar::spam(Foo<Bar> *x) {}
+
+%}
+
diff --git a/Examples/test-suite/template_arg_typename.i b/Examples/test-suite/template_arg_typename.i
new file mode 100644
index 000000000..0f4c88793
--- /dev/null
+++ b/Examples/test-suite/template_arg_typename.i
@@ -0,0 +1,26 @@
+%module template_arg_typename
+
+%inline %{
+
+
+ template <class ArgType, class ResType>
+ struct UnaryFunction
+ {
+ typedef void* vptr_type;
+ };
+
+ template <class ArgType>
+ struct BoolUnaryFunction : UnaryFunction<ArgType, bool>
+
+ {
+ typedef UnaryFunction<ArgType, bool> base;
+ BoolUnaryFunction(const typename base::vptr_type* vptrf) {}
+
+ };
+
+
+%}
+
+
+%template(UnaryFunction_bool_bool) UnaryFunction<bool, bool>;
+%template(BoolUnaryFunction_bool) BoolUnaryFunction<bool>;
diff --git a/Examples/test-suite/template_base_template.i b/Examples/test-suite/template_base_template.i
new file mode 100644
index 000000000..846240fc8
--- /dev/null
+++ b/Examples/test-suite/template_base_template.i
@@ -0,0 +1,35 @@
+%module template_base_template
+
+%warnfilter(801) traits<double, double>; /* Ruby, wrong class name */
+
+%inline %{
+ template <class ArgType, class ResType>
+ struct traits
+ {
+ typedef ArgType arg_type;
+ typedef ResType res_type;
+ };
+
+ template <class ArgType, class ResType>
+ struct Function
+ {
+ };
+
+ // Egad!
+ template <class AF, class AG>
+ struct Class
+ : Function<typename traits<AF, AG>::arg_type,
+ typename traits<AF, AG>::res_type>
+ {
+ };
+
+%}
+
+%template(traits_dd) traits <double, double>;
+%template(Function_dd) Function <double, double>;
+%template(Class_dd) Class <double, double>;
+
+
+
+
+
diff --git a/Examples/test-suite/template_classes.i b/Examples/test-suite/template_classes.i
new file mode 100644
index 000000000..346fc0d23
--- /dev/null
+++ b/Examples/test-suite/template_classes.i
@@ -0,0 +1,30 @@
+/* File : template_classes.i */
+/* Tests the use of one templated class within another */
+
+%module template_classes
+
+%inline %{
+
+template <class T>
+class Point {
+public:
+ T getX() {return x;}
+private:
+ T x;
+};
+
+template <class T>
+class Rectangle {
+public:
+ Point<T>& getPoint() {return point;}
+ void setPoint(Point<T>& value) {point = value;}
+private:
+ Point<T> point;
+};
+
+%}
+
+%template(PointInt) Point<int>;
+%template(RectangleInt) Rectangle<int>;
+
+
diff --git a/Examples/test-suite/template_const_ref.i b/Examples/test-suite/template_const_ref.i
new file mode 100644
index 000000000..196ca9005
--- /dev/null
+++ b/Examples/test-suite/template_const_ref.i
@@ -0,0 +1,14 @@
+%module template_const_ref
+%inline %{
+template <class T> class Foo {
+public:
+ char *bar(const T &obj) {
+ return (char *) "Foo::bar";
+ }
+};
+class Bar { };
+%}
+
+%template(Foob) Foo<const Bar *>;
+%template(Fooi) Foo<const int *>;
+
diff --git a/Examples/test-suite/template_construct.i b/Examples/test-suite/template_construct.i
new file mode 100644
index 000000000..a6e8c3c33
--- /dev/null
+++ b/Examples/test-suite/template_construct.i
@@ -0,0 +1,15 @@
+%module template_construct
+
+// Tests templates to make sure an extra <> in a constructor is ok.
+
+%inline %{
+template<class T>
+class Foo {
+ T y;
+public:
+ Foo<T>(T x) : y(x) { }
+};
+
+%}
+
+%template(Foo_int) Foo<int>;
diff --git a/Examples/test-suite/template_default.i b/Examples/test-suite/template_default.i
new file mode 100644
index 000000000..9de4eab38
--- /dev/null
+++ b/Examples/test-suite/template_default.i
@@ -0,0 +1,10 @@
+%module template_default
+%inline %{
+template <class T1, class T2 = T1>
+class A
+{
+};
+ %}
+
+%template(A_ii) A<int, int>;
+%template(A_d) A<double>;
diff --git a/Examples/test-suite/template_default2.i b/Examples/test-suite/template_default2.i
new file mode 100644
index 000000000..0bcd47652
--- /dev/null
+++ b/Examples/test-suite/template_default2.i
@@ -0,0 +1,44 @@
+%module template_default2
+
+%warnfilter(801) oss::traits; // Ruby, wrong class name
+
+%inline %{
+ namespace oss
+ {
+ enum Polarization { UnaryPolarization, BinaryPolarization };
+
+ template <Polarization P>
+ struct Interface
+ {
+ };
+
+ struct traits
+ {
+ static const Polarization pmode = UnaryPolarization;
+ };
+
+ template <class C,
+ Polarization P = C::pmode,
+ class Base = Interface<P> > // **** problem here *****
+ struct Module : Base
+ {
+ };
+
+ }
+%}
+
+namespace oss
+{
+ %template(Interface_UP) Interface<UnaryPolarization>;
+
+ // This works
+ %template(Module_UP1) Module<traits,
+ UnaryPolarization,
+ Interface<UnaryPolarization> >;
+
+ // These don't
+ %template(Module_UP2) Module<traits, UnaryPolarization>;
+ %template(Module_UP3) Module<traits>;
+}
+
+
diff --git a/Examples/test-suite/template_default_arg.i b/Examples/test-suite/template_default_arg.i
new file mode 100644
index 000000000..1b3612f73
--- /dev/null
+++ b/Examples/test-suite/template_default_arg.i
@@ -0,0 +1,34 @@
+%module template_default_arg
+
+%warnfilter(801) hi; /* Ruby, wrong class name */
+
+%inline %{
+ template <class T>
+ struct Hello
+ {
+ typedef unsigned int size_type;
+
+ // This works
+ // Hello(size_type n = Hello<T>::size_type(0) ) { }
+
+ // This doesn't
+ Hello(size_type n = size_type(0) ) { }
+
+ };
+%}
+
+%template(Hello_int) Hello<int>;
+
+%inline %{
+
+ struct hi : Hello<int>
+ {
+ hi(size_type n) : Hello<int>(n)
+ {
+ }
+
+ };
+%}
+
+
+
diff --git a/Examples/test-suite/template_default_inherit.i b/Examples/test-suite/template_default_inherit.i
new file mode 100644
index 000000000..442ac77c6
--- /dev/null
+++ b/Examples/test-suite/template_default_inherit.i
@@ -0,0 +1,25 @@
+%module template_default_inherit
+
+%warnfilter(801) A::nindex; /* Ruby, wrong constant name */
+
+%inline %{
+ template <class C>
+ struct A
+ {
+ typedef unsigned int size_type;
+ static const size_type nindex = static_cast<size_type>(-1);
+
+ };
+
+ template <class C>
+ struct B : A<C>
+ {
+ typedef typename A<C>::size_type size_type;
+ void say_hi(size_type index = nindex) {}
+ };
+
+%}
+
+%template(A_int) A<int>;
+%template(B_int) B<int>;
+
diff --git a/Examples/test-suite/template_default_qualify.i b/Examples/test-suite/template_default_qualify.i
new file mode 100644
index 000000000..7a411d130
--- /dev/null
+++ b/Examples/test-suite/template_default_qualify.i
@@ -0,0 +1,56 @@
+// Tests typename qualification and constant resolution in default
+// template arguments. Another Marcelo special.. :-).
+
+%module template_default_qualify
+
+%warnfilter(801) etraits; /* Ruby, wrong class name */
+
+%inline %{
+ namespace oss
+ {
+
+ enum Polarization { UnaryPolarization, BinaryPolarization };
+
+ template <Polarization P>
+ struct Interface
+ {
+ };
+
+ namespace modules
+ {
+
+ template <class traits, class base = Interface<traits::pmode> >
+ // *** problem here ****
+ struct Module : base
+ {
+ };
+ }
+ }
+ struct etraits
+ {
+ static const oss::Polarization pmode = oss::UnaryPolarization;
+ };
+
+%}
+
+namespace oss
+{
+ %template(Interface_UP) Interface<UnaryPolarization>;
+ namespace modules
+ {
+ %template(Module_etraits) Module<etraits>;
+ }
+}
+
+%inline %{
+ namespace oss
+ {
+ namespace modules
+ {
+ struct HModule1 : Module<etraits>
+ {
+ };
+ }
+ }
+%}
+
diff --git a/Examples/test-suite/template_enum.i b/Examples/test-suite/template_enum.i
new file mode 100644
index 000000000..9f6eeeb6f
--- /dev/null
+++ b/Examples/test-suite/template_enum.i
@@ -0,0 +1,15 @@
+%module template_enum
+
+%warnfilter(801) foo<int>; /* Ruby, wrong class name */
+%warnfilter(801) foo<double>; /* Ruby, wrong class name */
+
+%inline %{
+template<class T> class foo {
+public:
+ enum { FOO, BAR };
+};
+%}
+
+%template(foo_i) foo<int>;
+%template(foo_d) foo<double>;
+
diff --git a/Examples/test-suite/template_enum_ns_inherit.i b/Examples/test-suite/template_enum_ns_inherit.i
new file mode 100644
index 000000000..8992eef6d
--- /dev/null
+++ b/Examples/test-suite/template_enum_ns_inherit.i
@@ -0,0 +1,48 @@
+%module template_enum_ns_inherit
+%inline %{
+
+ namespace oss
+ {
+ enum Polarization { UnaryPolarization, BinaryPolarization };
+
+ template <Polarization P>
+ struct Interface
+ {
+ };
+
+ template <Polarization P, class C>
+ struct Module
+ {
+ };
+
+ }
+
+%}
+
+namespace oss
+{
+ %template(Interface_UP) Interface<UnaryPolarization>;
+ %template(Module_UPIUP) Module<UnaryPolarization,Interface<UnaryPolarization> >;
+}
+
+%inline %{
+ namespace oss
+ {
+ namespace hello
+ {
+ struct HInterface1 :
+ Interface<oss::UnaryPolarization> // this works (with fullns qualification)
+ {
+ };
+
+ struct HInterface2 :
+ Interface<UnaryPolarization> // this doesn't work
+ {
+ };
+
+ struct HModule1 : Module<UnaryPolarization, Interface<UnaryPolarization> > {
+ };
+
+ }
+ }
+%} \ No newline at end of file
diff --git a/Examples/test-suite/template_enum_typedef.i b/Examples/test-suite/template_enum_typedef.i
new file mode 100644
index 000000000..f1c15f182
--- /dev/null
+++ b/Examples/test-suite/template_enum_typedef.i
@@ -0,0 +1,39 @@
+%module template_enum_typedef
+
+%warnfilter(801) oss::etraits; /* Ruby, wrong class name */
+
+%inline %{
+
+ namespace oss
+ {
+ enum Polarization { UnaryPolarization, BinaryPolarization };
+
+ template <Polarization P>
+ struct Interface
+ {
+ };
+
+ struct etraits
+ {
+ static const Polarization pmode = UnaryPolarization;
+ };
+
+
+ template <class Traits>
+ struct Module
+ {
+ typedef Traits traits;
+ static const Polarization P = traits::pmode;
+
+ void get(Interface<P> arg) { }; // Here P is only replace by traits::pmode
+
+ };
+ }
+
+%}
+
+namespace oss
+{
+ %template(Interface_UP) Interface<UnaryPolarization>;
+ %template(Module_UP) Module<etraits>;
+}
diff --git a/Examples/test-suite/template_forward.i b/Examples/test-suite/template_forward.i
new file mode 100644
index 000000000..edf679568
--- /dev/null
+++ b/Examples/test-suite/template_forward.i
@@ -0,0 +1,20 @@
+%module template_forward
+
+%{
+namespace foo {
+template<class T> class bar { };
+}
+%}
+
+namespace foo {
+ template<class T> class bar;
+};
+
+%inline %{
+namespace foo {
+ double test1(const bar<double> &x) { return 0; }
+ bar<double> test2() {
+ return bar<double>();
+ }
+}
+%}
diff --git a/Examples/test-suite/template_inherit.i b/Examples/test-suite/template_inherit.i
new file mode 100644
index 000000000..e02ec5233
--- /dev/null
+++ b/Examples/test-suite/template_inherit.i
@@ -0,0 +1,40 @@
+/* File : example.i */
+%module template_inherit
+
+/* This example tests template inheritance to see if it actually works */
+
+%inline %{
+
+template<class T> class Foo {
+public:
+ virtual char *blah() {
+ return (char *) "Foo";
+ }
+ virtual char *foomethod() {
+ return (char *) "foomethod";
+ }
+};
+
+template<class T> class Bar : public Foo<T> {
+public:
+ virtual char *blah() {
+ return (char *) "Bar";
+ }
+};
+
+template<class T> char *invoke_blah(Foo<T> *x) {
+ return x->blah();
+}
+%}
+
+%template(FooInt) Foo<int>;
+%template(FooDouble) Foo<double>;
+%template(FooUInt) Foo<unsigned int>;
+%template(BarInt) Bar<int>;
+%template(BarDouble) Bar<double>;
+%template(BarUInt) Bar<unsigned>;
+%template(invoke_blah_int) invoke_blah<int>;
+%template(invoke_blah_double) invoke_blah<double>;
+%template(invoke_blah_uint) invoke_blah<int unsigned>;
+
+
diff --git a/Examples/test-suite/template_inherit_abstract.i b/Examples/test-suite/template_inherit_abstract.i
new file mode 100644
index 000000000..8cd0b998d
--- /dev/null
+++ b/Examples/test-suite/template_inherit_abstract.i
@@ -0,0 +1,59 @@
+%module template_inherit_abstract
+
+%warnfilter(801) oss::test; /* Ruby, wrong class name */
+%warnfilter(802, 813) oss::Module; /* Ruby & Java, multiple inheritance */
+
+%inline %{
+
+ namespace oss
+ {
+ template <class C>
+ struct Wrap
+ {
+ };
+
+ struct ModuleBase
+ {
+ virtual ~ModuleBase() {}
+ virtual int get() = 0;
+ };
+
+ template <class C>
+ struct Module : C, ModuleBase
+ {
+ protected:
+ Module() {}
+ };
+
+ template <class C>
+ struct HModule : Module<Wrap<C> >
+ {
+ // virtual int get(); // declaration here works
+
+ protected:
+ HModule() {}
+ };
+ }
+
+ struct B
+ {
+ };
+
+%}
+
+namespace oss
+{
+ %template(Wrap_B) Wrap<B>;
+ %template(Module_B) Module<Wrap<B> >;
+ %template(HModule_B) HModule<B>;
+}
+
+%inline %{
+ namespace oss
+ {
+ struct test : HModule<B>
+ {
+ virtual int get() {return 0;} // declaration here breaks swig
+ };
+ }
+%}
diff --git a/Examples/test-suite/template_int_const.i b/Examples/test-suite/template_int_const.i
new file mode 100644
index 000000000..7b9eea5f8
--- /dev/null
+++ b/Examples/test-suite/template_int_const.i
@@ -0,0 +1,50 @@
+%module template_int_const
+
+%warnfilter(801) interface_traits; /* Ruby, wrong class name */
+%warnfilter(801) module_traits; /* Ruby, wrong class name */
+
+%inline %{
+ enum Polarization { UnaryPolarization, BinaryPolarization };
+ struct interface_traits
+ {
+ static const Polarization polarization = UnaryPolarization;
+ };
+ template <Polarization P>
+ struct Interface
+ {
+ };
+
+ typedef unsigned int Category;
+ struct module_traits
+ {
+ static const Category category = 1;
+ };
+
+ template <Category C>
+ struct Module
+ {
+ };
+%}
+
+%template(Interface_UP) Interface<UnaryPolarization>;
+%template(Module_1) Module<1>;
+
+%inline %{
+ struct ExtInterface1 :
+ Interface<UnaryPolarization> // works
+ {
+ };
+ struct ExtInterface2 :
+ Interface<interface_traits::polarization> // doesn't work
+ {
+ };
+ struct ExtModule1 :
+ Module<1> // works
+ {
+ };
+ struct ExtModule2 :
+ Module<module_traits::category> // doesn't work
+ {
+ };
+%}
+
diff --git a/Examples/test-suite/template_ns.i b/Examples/test-suite/template_ns.i
new file mode 100644
index 000000000..90af05fac
--- /dev/null
+++ b/Examples/test-suite/template_ns.i
@@ -0,0 +1,35 @@
+// Tests the use of the %template directive with fully
+// qualified scope names
+
+%module template_ns
+
+%warnfilter(801) std::pair<int, int>; /* Ruby, wrong class name */
+%warnfilter(801) std::pair<double, double>; /* Ruby, wrong class name */
+
+%ignore std::pair::pair();
+
+%inline %{
+namespace std
+{
+template <class _T1, class _T2>
+struct pair {
+ typedef _T1 first_type;
+ typedef _T2 second_type;
+
+ _T1 first;
+ _T2 second;
+ pair() : first(_T1()), second(_T2()) {}
+ pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
+ template <class _U1, class _U2>
+ pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
+};
+}
+%}
+
+// Add copy constructor
+%extend std::pair {
+ %template(pair) pair<_T1,_T2>;
+};
+
+%template(pairii) std::pair<int,int>;
+%template(pairdd) std::pair<double,double>;
diff --git a/Examples/test-suite/template_ns2.i b/Examples/test-suite/template_ns2.i
new file mode 100644
index 000000000..f35d32654
--- /dev/null
+++ b/Examples/test-suite/template_ns2.i
@@ -0,0 +1,16 @@
+// Tests compilation of uninstantiated templates in a namespace
+
+%module template_ns2
+
+%inline %{
+
+namespace foo {
+ template<class T> class bar {
+ };
+ bar<int> *test1(bar<int> *x) { return x; }
+ typedef int Integer;
+
+ bar<Integer *> *test2(bar<Integer *> *x) { return x; }
+}
+%}
+
diff --git a/Examples/test-suite/template_ns3.i b/Examples/test-suite/template_ns3.i
new file mode 100644
index 000000000..0cc08b551
--- /dev/null
+++ b/Examples/test-suite/template_ns3.i
@@ -0,0 +1,21 @@
+%module template_ns3
+
+%warnfilter(801) foo::bar<int>; /* Ruby, wrong class name */
+
+%inline %{
+namespace foo {
+ typedef int Integer;
+
+ template<class T> class bar {
+ public:
+ Integer test(Integer x) { return x; }
+ };
+
+}
+%}
+
+%template(bari) foo::bar<int>;
+
+
+
+
diff --git a/Examples/test-suite/template_ns4.i b/Examples/test-suite/template_ns4.i
new file mode 100644
index 000000000..3769f8d0b
--- /dev/null
+++ b/Examples/test-suite/template_ns4.i
@@ -0,0 +1,66 @@
+%module template_ns4
+
+%inline %{
+ namespace hello {
+
+ class Double {
+ };
+
+ template <class ArgType, class ResType>
+ struct Function
+ {
+ char *test() { return (char *) "test"; }
+ };
+
+ template <class AF, class RF>
+ struct ArithFunction : Function<AF, RF>
+ {
+ };
+
+ template <class ArgType, class ResType>
+ struct traits
+ {
+ };
+
+ template <class ArgType>
+ struct traits<ArgType, double>
+ {
+ typedef ArgType arg_type;
+ typedef double res_type;
+ typedef ArithFunction<ArgType, double> base;
+ };
+
+ template <class ArgType>
+ struct traits<ArgType, Double>
+ {
+ typedef ArgType arg_type;
+ typedef Double res_type;
+ typedef ArithFunction<ArgType, Double> base;
+ };
+
+ template <class AF, class RF>
+ class Class : public ArithFunction< typename traits<AF, RF>::arg_type,
+ typename traits<AF, RF>::res_type >
+ {
+ };
+
+ template <class AF, class RF>
+ typename traits<AF, RF>::base
+ make_Class()
+ {
+ return Class<AF, RF>();
+ }
+
+ }
+%}
+ namespace hello {
+ //
+ // This complains only when using a namespace
+ //
+ %template() traits<Double,Double>;
+ %template(Function_DD) Function <Double, Double>;
+ %template(ArithFunction_DD) ArithFunction <Double, Double>;
+ %template(Class_DD) Class <Double, Double>;
+ %template(make_Class_DD) make_Class <Double, Double>;
+ }
+
diff --git a/Examples/test-suite/template_ns_enum.i b/Examples/test-suite/template_ns_enum.i
new file mode 100644
index 000000000..4c73e5067
--- /dev/null
+++ b/Examples/test-suite/template_ns_enum.i
@@ -0,0 +1,18 @@
+%module template_ns_enum
+%inline %{
+ namespace hello {
+ enum Hello { Hi, Hola };
+
+ template <Hello H>
+ struct traits
+ {
+ typedef double value_type;
+ };
+
+ traits<Hi>::value_type say_hi()
+ {
+ return traits<Hi>::value_type(1);
+ }
+
+ }
+%}
diff --git a/Examples/test-suite/template_ns_enum2.i b/Examples/test-suite/template_ns_enum2.i
new file mode 100644
index 000000000..616100423
--- /dev/null
+++ b/Examples/test-suite/template_ns_enum2.i
@@ -0,0 +1,38 @@
+%module template_ns_enum2
+
+%inline %{
+
+ namespace hi
+ {
+ enum Hello { Hi, Hola };
+
+ template <Hello>
+ struct traits
+ {
+ };
+
+ template <>
+ struct traits<Hi>
+ {
+ typedef int value_type;
+ };
+
+ template <>
+ struct traits<Hola>
+ {
+ typedef double value_type;
+ };
+
+ struct B
+ {
+ const traits<Hola>::value_type&
+ eval(const traits<Hola>::value_type& e) const;
+
+ };
+ const traits<Hola>::value_type&
+ B::eval(const traits<Hola>::value_type& e) const {
+ return e;
+ }
+ }
+
+%}
diff --git a/Examples/test-suite/template_ns_inherit.i b/Examples/test-suite/template_ns_inherit.i
new file mode 100644
index 000000000..fb336541a
--- /dev/null
+++ b/Examples/test-suite/template_ns_inherit.i
@@ -0,0 +1,30 @@
+// Submitted by Marcelo Matus
+%module template_ns_inherit
+
+%inline %{
+ namespace hello {
+ typedef double Double;
+ }
+ namespace hello
+ {
+ template <class ArgType, class ResType>
+ class VUnaryFunction
+ {};
+
+ template <class ArgType, class ResType>
+ class UnaryFunction : public VUnaryFunction<ArgType, ResType>
+ {};
+ }
+
+%}
+
+namespace hello
+{
+ %template(VUnaryFunction_id) VUnaryFunction<int, Double>;
+ %template(UnaryFunction_id) UnaryFunction<int, Double>;
+}
+
+
+
+
+
diff --git a/Examples/test-suite/template_ns_scope.i b/Examples/test-suite/template_ns_scope.i
new file mode 100644
index 000000000..928f628d2
--- /dev/null
+++ b/Examples/test-suite/template_ns_scope.i
@@ -0,0 +1,38 @@
+%module template_ns_scope
+// Tests a scoping bug reported by Marcelo Matus.
+
+%inline %{
+ namespace hi {
+ enum Hello { Hi, Hola };
+
+ template <Hello h>
+ struct A
+ {
+ public:
+ A() {} // *** Here, the const. breaks swig ***
+ // *** swig works without it ***
+ };
+
+ namespace hello
+ {
+ template <Hello H>
+ struct B : A<H>
+ {
+ int say_hi() { return 0; }
+ };
+ }
+ }
+
+%}
+namespace hi
+{
+ %template(A_Hi) A<Hi>;
+ namespace hello
+ {
+ %template(B_Hi) B<Hi>;
+ }
+}
+
+
+
+
diff --git a/Examples/test-suite/template_qualifier.i b/Examples/test-suite/template_qualifier.i
new file mode 100644
index 000000000..1c3b46fbc
--- /dev/null
+++ b/Examples/test-suite/template_qualifier.i
@@ -0,0 +1,15 @@
+%module template_qualifier
+
+/* Stroustruo, 3rd Ed, C.13.6 */
+%inline %{
+class X {
+public:
+ template<int> X *xalloc() { return new X(); }
+};
+
+%}
+
+%extend X {
+%template(xalloc_int) xalloc<200>;
+};
+
diff --git a/Examples/test-suite/template_rename.i b/Examples/test-suite/template_rename.i
new file mode 100644
index 000000000..8d3574e81
--- /dev/null
+++ b/Examples/test-suite/template_rename.i
@@ -0,0 +1,24 @@
+%module template_rename
+
+%warnfilter(801) Foo<int>; /* Ruby, wrong class name */
+%warnfilter(801) Foo<double>; /* Ruby, wrong class name */
+
+%rename(blah_test) Foo::blah(int);
+%rename(spam_test) Foo<int>::spam(int);
+%rename(grok_test) Foo::grok(int);
+%rename(groki_test) Foo<int>::grok(int);
+
+%inline %{
+
+template<class T> class Foo {
+public:
+ int blah(int x) { return x; }
+ int spam(int x) { return x; }
+ int grok(int x) { return x; }
+};
+
+%}
+
+%template(iFoo) Foo<int>;
+%template(dFoo) Foo<double>;
+
diff --git a/Examples/test-suite/template_retvalue.i b/Examples/test-suite/template_retvalue.i
new file mode 100644
index 000000000..9c15fea65
--- /dev/null
+++ b/Examples/test-suite/template_retvalue.i
@@ -0,0 +1,32 @@
+%module template_retvalue
+%inline %{
+
+ enum Hello
+ {
+ Hi, Hola
+ };
+
+ struct C
+ {
+ C(int) {}
+ };
+
+ template <Hello>
+ class A
+ {
+ public:
+ A(int) {}
+ };
+
+
+ template <Hello h>
+ struct B
+ {
+ C get_c() { return C(0); } // this works
+ A<h> get_a() { return A<h>(0); } // this doesn't
+ };
+
+ %}
+
+%template(A_Hi) A<Hi>;
+%template(B_Hola) B<Hola>;
diff --git a/Examples/test-suite/template_specialization.i b/Examples/test-suite/template_specialization.i
new file mode 100644
index 000000000..b14cbb939
--- /dev/null
+++ b/Examples/test-suite/template_specialization.i
@@ -0,0 +1,40 @@
+%module template_specialization
+
+%rename(__not__) *::operator!() const;
+
+#ifdef SWIGJAVA
+%rename(negate) *::operator-() const;
+#endif
+
+%inline %{
+
+ namespace vfncs {
+
+ template <class ArgType>
+ struct UnaryFunction
+ {
+ UnaryFunction operator-() const { return *this; }
+ };
+
+ template <>
+ struct UnaryFunction<bool>
+ {
+ // This works
+ // UnaryFunction<bool> operator!() const;
+
+ // This doesn't
+ UnaryFunction operator!() const { return *this; }
+
+ // Does this?
+ void foo(UnaryFunction) { }
+
+ };
+
+ }
+%}
+
+namespace vfncs {
+
+ %template(UnaryFunction_double) UnaryFunction<double>;
+ %template(UnaryFunction_bool) UnaryFunction<bool>;
+}
diff --git a/Examples/test-suite/template_static.i b/Examples/test-suite/template_static.i
new file mode 100644
index 000000000..087cb3db2
--- /dev/null
+++ b/Examples/test-suite/template_static.i
@@ -0,0 +1,16 @@
+%module template_static
+
+%warnfilter(801) foo<int>; /* Ruby, wrong class name */
+%warnfilter(801) foo<double>; /* Ruby, wrong class name */
+
+%inline %{
+template<class T> class foo {
+public:
+ static int test;
+};
+template<class T> int foo<T>::test = 0;
+%}
+
+%template(foo_i) foo<int>;
+%template(foo_d) foo<double>;
+
diff --git a/Examples/test-suite/template_tbase_template.i b/Examples/test-suite/template_tbase_template.i
new file mode 100644
index 000000000..1d57ca070
--- /dev/null
+++ b/Examples/test-suite/template_tbase_template.i
@@ -0,0 +1,43 @@
+%module template_tbase_template
+
+%warnfilter(801) traits<Double, Double>; /* Ruby, wrong class name */
+
+%inline %{
+ typedef double Double;
+
+
+ template <class ArgType, class ResType>
+ struct Function
+ {
+ char *test() { return (char *) "test"; }
+ };
+
+ template <class ArgType, class ResType>
+ struct traits
+ {
+ typedef ArgType arg_type;
+ typedef ResType res_type;
+ typedef Function<ArgType, double> base;
+ };
+
+ // Egad!
+ template <class AF, class AG>
+ struct Class
+ : Function<typename traits<AF, AG>::arg_type,
+ typename traits<AF, AG>::res_type>
+ {
+ };
+
+ template <class AF, class RF>
+ typename traits<AF, RF>::base
+ make_Class()
+ {
+ return Class<AF, RF>();
+ }
+
+%}
+
+%template(traits_dd) traits <Double, Double>;
+%template(Function_dd) Function <Double, Double>;
+%template(Class_dd) Class <Double, Double>;
+%template(make_Class_dd) make_Class<Double,Double>;
diff --git a/Examples/test-suite/template_type_namespace.i b/Examples/test-suite/template_type_namespace.i
new file mode 100644
index 000000000..719647361
--- /dev/null
+++ b/Examples/test-suite/template_type_namespace.i
@@ -0,0 +1,14 @@
+%module template_type_namespace
+
+%warnfilter(801) std::vector<std::string>; // Ruby, wrong class name
+
+%include std_string.i
+%include std_vector.i
+
+%template(string_vector) std::vector<std::string>;
+
+%inline %{
+ std::vector<std::string> foo() {
+ return std::vector<std::string>(1,"foo");
+ }
+%}
diff --git a/Examples/test-suite/template_typedef.i b/Examples/test-suite/template_typedef.i
new file mode 100644
index 000000000..1d58d53bd
--- /dev/null
+++ b/Examples/test-suite/template_typedef.i
@@ -0,0 +1,156 @@
+%module template_typedef
+
+//
+// Change this to #if 1 to test the 'test'
+//
+#if 0
+
+#define real double
+%{
+#define real double
+%}
+
+#else
+
+%inline %{
+ typedef double real;
+%}
+
+#endif
+
+
+%inline %{
+
+ // typedef double real;
+
+ namespace vfncs {
+
+ struct UnaryFunctionBase
+ {
+ };
+
+ template <class ArgType, class ResType>
+ class UnaryFunction;
+
+ template <class ArgType, class ResType>
+ class ArithUnaryFunction;
+
+ template <class ArgType, class ResType>
+ struct UnaryFunction : UnaryFunctionBase
+ {
+ };
+
+ template <class ArgType, class ResType>
+ struct ArithUnaryFunction : UnaryFunction<ArgType, ResType>
+ {
+ };
+
+ template <class ArgType, class ResType>
+ struct unary_func_traits
+ {
+ typedef ArithUnaryFunction<ArgType, ResType > base;
+ };
+
+ template <class ArgType>
+ inline
+ typename unary_func_traits< ArgType, ArgType >::base
+ make_Identity()
+ {
+ return typename unary_func_traits< ArgType, ArgType >::base();
+ }
+
+ template <class Arg1, class Arg2>
+ struct arith_traits
+ {
+ };
+
+ template<>
+ struct arith_traits< float, float >
+ {
+
+ typedef float argument_type;
+ typedef float result_type;
+ static const char* const arg_type = "float";
+ static const char* const res_type = "float";
+ };
+
+ template<>
+ struct arith_traits< real, real >
+ {
+
+ typedef real argument_type;
+ typedef real result_type;
+ static const char* const arg_type = "real";
+ static const char* const res_type = "real";
+ };
+
+ template<>
+ struct arith_traits< real, float >
+ {
+ typedef float argument_type;
+ typedef real result_type;
+ static const char* const arg_type = "float";
+ static const char* const res_type = "real";
+ };
+
+ template<>
+ struct arith_traits< float, real >
+ {
+ typedef float argument_type;
+ typedef real result_type;
+ static const char* const arg_type = "float";
+ static const char* const res_type = "real";
+ };
+
+ template <class AF, class RF, class AG, class RG>
+ inline
+ ArithUnaryFunction<typename arith_traits< AF, AG >::argument_type,
+ typename arith_traits< RF, RG >::result_type >
+ make_Multiplies(const ArithUnaryFunction<AF, RF>& f,
+ const ArithUnaryFunction<AG, RG >& g)
+ {
+ return
+ ArithUnaryFunction<typename arith_traits< AF, AG >::argument_type,
+ typename arith_traits< RF, RG >::result_type>();
+ }
+
+ }
+
+%}
+
+namespace vfncs {
+ %template(UnaryFunction_float_float) UnaryFunction<float, float >;
+ %template(ArithUnaryFunction_float_float) ArithUnaryFunction<float, float >;
+ %template() unary_func_traits<float, float >;
+ %template() arith_traits<float, float >;
+ %template(make_Identity_float) make_Identity<float >;
+
+ %template(UnaryFunction_real_real) UnaryFunction<real, real >;
+ %template(ArithUnaryFunction_real_real) ArithUnaryFunction<real, real >;
+
+ %template() unary_func_traits<real, real >;
+ %template() arith_traits<real, real >;
+ %template(make_Identity_real) make_Identity<real >;
+
+ /* [beazley] Added this part */
+ %template() unary_func_traits<float,real>;
+ %template(UnaryFunction_float_real) UnaryFunction<float,real>;
+ %template(ArithUnaryFunction_float_real) ArithUnaryFunction<float,real>;
+
+ /* */
+
+ %template() arith_traits<real, float >;
+ %template() arith_traits<float, real >;
+ %template() arith_traits<float, float >;
+
+ %template(make_Multiplies_float_float_real_real)
+ make_Multiplies<float, float, real, real>;
+
+ %template(make_Multiplies_float_float_float_float)
+ make_Multiplies<float, float, float, float>;
+
+ %template(make_Multiplies_real_real_real_real)
+ make_Multiplies<real, real, real, real>;
+
+}
+
diff --git a/Examples/test-suite/template_typedef_cplx.i b/Examples/test-suite/template_typedef_cplx.i
new file mode 100644
index 000000000..104e59910
--- /dev/null
+++ b/Examples/test-suite/template_typedef_cplx.i
@@ -0,0 +1,159 @@
+%module template_typedef_cplx
+
+//
+// Change this to #if 1 to test the 'test'
+//
+#if 0
+
+%{
+#include <complex>
+typedef std::complex<double> cmplx;
+%}
+
+%inline %{
+ typedef cmplx Complex;
+%}
+
+#else
+
+%inline %{
+#include <complex>
+ typedef std::complex<double> Complex;
+%}
+
+#endif
+
+
+%inline %{
+
+ namespace vfncs {
+
+ struct UnaryFunctionBase
+ {
+ };
+
+ template <class ArgType, class ResType>
+ class UnaryFunction;
+
+ template <class ArgType, class ResType>
+ class ArithUnaryFunction;
+
+ template <class ArgType, class ResType>
+ struct UnaryFunction : UnaryFunctionBase
+ {
+ };
+
+ template <class ArgType, class ResType>
+ struct ArithUnaryFunction : UnaryFunction<ArgType, ResType>
+ {
+ };
+
+ template <class ArgType, class ResType>
+ struct unary_func_traits
+ {
+ typedef ArithUnaryFunction<ArgType, ResType > base;
+ };
+
+ template <class ArgType>
+ inline
+ typename unary_func_traits< ArgType, ArgType >::base
+ make_Identity()
+ {
+ return typename unary_func_traits< ArgType, ArgType >::base();
+ }
+
+ template <class Arg1, class Arg2>
+ struct arith_traits
+ {
+ };
+
+ template<>
+ struct arith_traits< double, double >
+ {
+
+ typedef double argument_type;
+ typedef double result_type;
+ static const char* const arg_type = "double";
+ static const char* const res_type = "double";
+ };
+
+ template<>
+ struct arith_traits< Complex, Complex >
+ {
+
+ typedef Complex argument_type;
+ typedef Complex result_type;
+ static const char* const arg_type = "complex";
+ static const char* const res_type = "complex";
+ };
+
+ template<>
+ struct arith_traits< Complex, double >
+ {
+ typedef double argument_type;
+ typedef Complex result_type;
+ static const char* const arg_type = "double";
+ static const char* const res_type = "complex";
+ };
+
+ template<>
+ struct arith_traits< double, Complex >
+ {
+ typedef double argument_type;
+ typedef Complex result_type;
+ static const char* const arg_type = "double";
+ static const char* const res_type = "complex";
+ };
+
+ template <class AF, class RF, class AG, class RG>
+ inline
+ ArithUnaryFunction<typename arith_traits< AF, AG >::argument_type,
+ typename arith_traits< RF, RG >::result_type >
+ make_Multiplies(const ArithUnaryFunction<AF, RF>& f,
+ const ArithUnaryFunction<AG, RG >& g)
+ {
+ return
+ ArithUnaryFunction<typename arith_traits< AF, AG >::argument_type,
+ typename arith_traits< RF, RG >::result_type>();
+ }
+ }
+%}
+
+namespace vfncs {
+ %template(UnaryFunction_double_double) UnaryFunction<double, double >;
+ %template(ArithUnaryFunction_double_double) ArithUnaryFunction<double, double >;
+ %template() unary_func_traits<double, double >;
+ %template() arith_traits<double, double >;
+ %template(make_Identity_double) make_Identity<double >;
+
+ %template(UnaryFunction_complex_complex) UnaryFunction<Complex, Complex >;
+ %template(ArithUnaryFunction_complex_complex) ArithUnaryFunction<Complex, Complex >;
+
+ %template() unary_func_traits<Complex, Complex >;
+ %template() arith_traits<Complex, Complex >;
+ %template(make_Identity_complex) make_Identity<Complex >;
+
+ /* [beazley] Added this part */
+ %template() unary_func_traits<double,Complex>;
+ %template(UnaryFunction_double_complex) UnaryFunction<double,Complex>;
+ %template(ArithUnaryFunction_double_complex) ArithUnaryFunction<double,Complex>;
+
+ /* */
+
+ %template() arith_traits<Complex, double >;
+ %template() arith_traits<double, Complex >;
+
+ %template(make_Multiplies_double_double_complex_complex)
+ make_Multiplies<double, double, Complex, Complex>;
+
+ %template(make_Multiplies_double_double_double_double)
+ make_Multiplies<double, double, double, double>;
+
+ %template(make_Multiplies_complex_complex_complex_complex)
+ make_Multiplies<Complex, Complex, Complex, Complex>;
+
+ %template(make_Multiplies_complex_complex_double_double)
+ make_Multiplies<Complex, Complex, double, double>;
+
+}
+
diff --git a/Examples/test-suite/template_typedef_cplx2.h b/Examples/test-suite/template_typedef_cplx2.h
new file mode 100644
index 000000000..df19e5ad6
--- /dev/null
+++ b/Examples/test-suite/template_typedef_cplx2.h
@@ -0,0 +1,156 @@
+#ifndef ___typedef_import_h__
+#define ___typedef_import_h__
+
+#ifdef SWIG
+%module template_typedef_cplx2;
+#endif
+
+#include <complex>
+typedef std::complex<double> Complex;
+
+namespace vfncs {
+
+ struct UnaryFunctionBase
+ {
+ int get_base_value()
+ {
+ return 0;
+ }
+ };
+
+ template <class ArgType, class ResType>
+ class UnaryFunction;
+
+ template <class ArgType, class ResType>
+ class ArithUnaryFunction;
+
+ template <class ArgType, class ResType>
+ struct UnaryFunction : UnaryFunctionBase
+ {
+ int get_value()
+ {
+ return 1;
+ }
+ };
+
+ template <class ArgType, class ResType>
+ struct ArithUnaryFunction : UnaryFunction<ArgType, ResType>
+ {
+ int get_arith_value()
+ {
+ return 2;
+ }
+ };
+
+ template <class ArgType, class ResType>
+ struct unary_func_traits
+ {
+ typedef ArithUnaryFunction<ArgType, ResType > base;
+ };
+
+ template <class ArgType>
+ inline
+ typename unary_func_traits< ArgType, ArgType >::base
+ make_Identity()
+ {
+ return typename unary_func_traits< ArgType, ArgType >::base();
+ }
+
+ template <class Arg1, class Arg2>
+ struct arith_traits
+ {
+ };
+
+ template<>
+ struct arith_traits< double, double >
+ {
+ typedef double argument_type;
+ typedef double result_type;
+ static const char* const arg_type = "double";
+ static const char* const res_type = "double";
+ };
+
+ template<>
+ struct arith_traits< Complex, Complex >
+ {
+
+ typedef Complex argument_type;
+ typedef Complex result_type;
+ static const char* const arg_type = "complex";
+ static const char* const res_type = "complex";
+ };
+
+ template<>
+ struct arith_traits< Complex, double >
+ {
+ typedef double argument_type;
+ typedef Complex result_type;
+ static const char* const arg_type = "double";
+ static const char* const res_type = "complex";
+ };
+
+ template<>
+ struct arith_traits< double, Complex >
+ {
+ typedef double argument_type;
+ typedef Complex result_type;
+ static const char* const arg_type = "double";
+ static const char* const res_type = "complex";
+ };
+
+ template <class AF, class RF, class AG, class RG>
+ inline
+ ArithUnaryFunction<typename arith_traits< AF, AG >::argument_type,
+ typename arith_traits< RF, RG >::result_type >
+ make_Multiplies(const ArithUnaryFunction<AF, RF>& f,
+ const ArithUnaryFunction<AG, RG >& g)
+ {
+ return
+ ArithUnaryFunction<typename arith_traits< AF, AG >::argument_type,
+ typename arith_traits< RF, RG >::result_type>();
+ }
+}
+
+#ifdef SWIG
+
+namespace vfncs {
+ %template(UnaryFunction_double_double) UnaryFunction<double, double >;
+ %template(ArithUnaryFunction_double_double) ArithUnaryFunction<double, double >;
+ %template() unary_func_traits<double, double >;
+ %template() arith_traits<double, double >;
+ %template(make_Identity_double) make_Identity<double >;
+
+ %template(UnaryFunction_complex_complex) UnaryFunction<Complex, Complex >;
+ %template(ArithUnaryFunction_complex_complex) ArithUnaryFunction<Complex, Complex >;
+
+ %template() unary_func_traits<Complex, Complex >;
+ %template() arith_traits<Complex, Complex >;
+ %template(make_Identity_complex) make_Identity<Complex >;
+
+ /* [beazley] Added this part */
+ %template() unary_func_traits<double,Complex>;
+ %template(UnaryFunction_double_complex) UnaryFunction<double,Complex>;
+ %template(ArithUnaryFunction_double_complex) ArithUnaryFunction<double,Complex>;
+
+ /* */
+
+ %template() arith_traits<Complex, double >;
+ %template() arith_traits<double, Complex >;
+
+ %template(make_Multiplies_double_double_complex_complex)
+ make_Multiplies<double, double, Complex, Complex>;
+
+ %template(make_Multiplies_double_double_double_double)
+ make_Multiplies<double, double, double, double>;
+
+ %template(make_Multiplies_complex_complex_complex_complex)
+ make_Multiplies<Complex, Complex, Complex, Complex>;
+
+ %template(make_Multiplies_complex_complex_double_double)
+ make_Multiplies<Complex, Complex, double, double>;
+
+}
+
+#endif
+
+#endif //___template_typedef_h__
diff --git a/Examples/test-suite/template_typedef_cplx2.i b/Examples/test-suite/template_typedef_cplx2.i
new file mode 100644
index 000000000..6f99e8996
--- /dev/null
+++ b/Examples/test-suite/template_typedef_cplx2.i
@@ -0,0 +1,7 @@
+%module template_typedef_cplx2
+
+%{
+#include "template_typedef_cplx2.h"
+%}
+
+%include "template_typedef_cplx2.h"
diff --git a/Examples/test-suite/template_typedef_cplx3.i b/Examples/test-suite/template_typedef_cplx3.i
new file mode 100644
index 000000000..71fcf5e3e
--- /dev/null
+++ b/Examples/test-suite/template_typedef_cplx3.i
@@ -0,0 +1,37 @@
+%module template_typedef_cplx3
+%{
+#include "template_typedef_cplx2.h"
+%}
+
+%include "template_typedef_cplx2.h"
+
+%inline %{
+
+ typedef vfncs::ArithUnaryFunction<double, double> RFunction;
+ typedef vfncs::ArithUnaryFunction<Complex, Complex> CFunction;
+
+
+ int my_func_r(RFunction* hello)
+ {
+ return 0;
+ }
+
+ int my_func_c(CFunction* hello)
+ {
+ return 1;
+ }
+
+ struct Sin : RFunction
+ {
+ };
+
+ struct CSin : CFunction
+ {
+ };
+
+%}
+
+
+
+
+
diff --git a/Examples/test-suite/template_typedef_cplx4.i b/Examples/test-suite/template_typedef_cplx4.i
new file mode 100644
index 000000000..a2457acdf
--- /dev/null
+++ b/Examples/test-suite/template_typedef_cplx4.i
@@ -0,0 +1,44 @@
+%module template_typedef_cplx4
+%{
+#include "template_typedef_cplx2.h"
+%}
+
+%include "template_typedef_cplx2.h"
+
+%inline %{
+
+ typedef vfncs::ArithUnaryFunction<double, double> RFunction;
+ // **** these two work ****
+ // typedef vfncs::ArithUnaryFunction<Complex, Complex > CFunction;
+ // typedef vfncs::ArithUnaryFunction<std::complex<double>, std::complex<double> > CFunction;
+
+ // **** these ones don't ***
+ // typedef vfncs::ArithUnaryFunction<Complex, std::complex<double> > CFunction;
+ typedef vfncs::ArithUnaryFunction<std::complex<double>, Complex > CFunction;
+
+
+
+ int my_func_r(RFunction* hello)
+ {
+ return 0;
+ }
+
+ int my_func_c(CFunction* hello)
+ {
+ return 1;
+ }
+
+ struct Sin : RFunction
+ {
+ };
+
+ struct CSin : CFunction
+ {
+ };
+
+%}
+
+
+
+
+
diff --git a/Examples/test-suite/template_typedef_import.i b/Examples/test-suite/template_typedef_import.i
new file mode 100644
index 000000000..10bc61763
--- /dev/null
+++ b/Examples/test-suite/template_typedef_import.i
@@ -0,0 +1,37 @@
+%module template_typedef_import
+%{
+#include "template_typedef_cplx2.h"
+%}
+
+%import "template_typedef_cplx2.h"
+
+%inline %{
+
+ typedef vfncs::ArithUnaryFunction<double, double> RFunction;
+ typedef vfncs::ArithUnaryFunction<Complex, Complex> CFunction;
+
+
+ int my_func_r(RFunction* hello)
+ {
+ return 0;
+ }
+
+ int my_func_c(CFunction* hello)
+ {
+ return 1;
+ }
+
+ struct Sin : RFunction
+ {
+ };
+
+ struct CSin : CFunction
+ {
+ };
+
+%}
+
+
+
+
+
diff --git a/Examples/test-suite/template_typedef_import.list b/Examples/test-suite/template_typedef_import.list
new file mode 100644
index 000000000..c7622b4da
--- /dev/null
+++ b/Examples/test-suite/template_typedef_import.list
@@ -0,0 +1,2 @@
+template_typedef_cplx2
+template_typedef_import
diff --git a/Examples/test-suite/template_virtual.i b/Examples/test-suite/template_virtual.i
new file mode 100644
index 000000000..cc5949a4f
--- /dev/null
+++ b/Examples/test-suite/template_virtual.i
@@ -0,0 +1,32 @@
+%module template_virtual
+
+// Submitted by Marcelo Matus
+// assertion emmitted with templates + derivation + pure virtual member
+// allocate.cxx:47: int Allocate::is_abstract_inherit(Node*, Node*):
+// Assertion `dn' failed.
+
+%inline %{
+
+ template <class T>
+ class A
+ {
+ public:
+ virtual void say_hi() = 0; // only fails with pure virtual methods
+
+ virtual void say_hello(); // this works fine
+
+ protected:
+ A() { } // defined protected as swig generates constructor by default
+ };
+
+ template <class T>
+ class B : public A<T>
+ {
+ protected:
+ B() { } // defined protected as swig generates constructor by default
+ };
+
+%}
+
+%template(A_int) A<int>;
+%template(B_int) B<int>; // !!!! it crashes right here !!!!!
diff --git a/Examples/test-suite/template_whitespace.i b/Examples/test-suite/template_whitespace.i
new file mode 100644
index 000000000..ea3d28a1a
--- /dev/null
+++ b/Examples/test-suite/template_whitespace.i
@@ -0,0 +1,22 @@
+/* This interface file tests whether whitespace in angle brackets
+ effects the SWIG types. SF Bug #221917, reported by
+ burchanb@cs.tamu.edu. */
+
+%module template_whitespace
+
+%{
+template<class T> class vector {
+};
+template<class T, class U> class map {
+};
+%}
+
+//%typemap(in) vector<int> "$target = new vector<int>();";
+//%typemap(in) vector<unsigned int> "$target = new vector<unsigned int>();";
+//%typemap(in) map<int,int> "$target = new map<int, int>();";
+
+%inline %{
+void foo(vector<int > v) {}
+void var(vector<unsigned int> v) {}
+void baz(map < int , int > p) {}
+%}
diff --git a/Examples/test-suite/throw_exception.i b/Examples/test-suite/throw_exception.i
new file mode 100644
index 000000000..0c170a5f3
--- /dev/null
+++ b/Examples/test-suite/throw_exception.i
@@ -0,0 +1,29 @@
+%module throw_exception
+
+// Tests SWIG's automatic exception mechanism
+
+%inline %{
+
+class Error {
+};
+
+class Foo {
+public:
+ void test_int() throw(int) {
+ throw 37;
+ }
+ void test_msg() throw(const char *) {
+ throw "Dead";
+ }
+ void test_cls() throw(Error) {
+ throw Error();
+ }
+ void test_multi(int x) throw(int, const char *, Error) {
+ if (x == 1) throw 37;
+ if (x == 2) throw "Dead";
+ if (x == 3) throw Error();
+ }
+};
+
+ %}
+
diff --git a/Examples/test-suite/typedef_array_member.i b/Examples/test-suite/typedef_array_member.i
new file mode 100644
index 000000000..8663fd335
--- /dev/null
+++ b/Examples/test-suite/typedef_array_member.i
@@ -0,0 +1,10 @@
+%module typedef_array_member
+%inline %{
+
+typedef char amember[20];
+
+struct Foo {
+ amember x;
+};
+
+%}
diff --git a/Examples/test-suite/typedef_funcptr.i b/Examples/test-suite/typedef_funcptr.i
new file mode 100644
index 000000000..9ef220282
--- /dev/null
+++ b/Examples/test-suite/typedef_funcptr.i
@@ -0,0 +1,26 @@
+// Tests typedef through function pointers
+
+%module typedef_funcptr
+
+%warnfilter(801) addf; /* Ruby, wrong constant name */
+%warnfilter(801) subf; /* Ruby, wrong constant name */
+
+%{
+int addf(int x, int y) {
+ return x+y;
+}
+int subf(int x, int y) {
+ return x-y;
+}
+%}
+
+%inline %{
+typedef int Integer;
+
+Integer do_op(Integer x, Integer y, Integer (*op)(Integer, Integer)) {
+ return (*op)(x,y);
+}
+%}
+
+%constant int addf(int x, int y);
+%constant Integer subf(Integer x, Integer y);
diff --git a/Examples/test-suite/typedef_inherit.i b/Examples/test-suite/typedef_inherit.i
new file mode 100644
index 000000000..c22253a32
--- /dev/null
+++ b/Examples/test-suite/typedef_inherit.i
@@ -0,0 +1,41 @@
+// Inheritance through a typedef name
+%module typedef_inherit
+
+%inline %{
+class Foo {
+public:
+ virtual char *blah() {
+ return (char *) "Foo::blah";
+ }
+};
+
+typedef Foo FooObj;
+
+class Bar : public FooObj {
+ public:
+ virtual char *blah() {
+ return (char *) "Bar::blah";
+ };
+};
+
+char *do_blah(FooObj *f) {
+ return f->blah();
+}
+
+typedef struct {
+ virtual char *blah() {
+ return (char *) "Spam::blah";
+ }
+} Spam;
+
+struct Grok : public Spam {
+ virtual char *blah() {
+ return (char *) "Grok::blah";
+ }
+};
+
+char *do_blah2(Spam *s) {
+ return s->blah();
+}
+%}
+
diff --git a/Examples/test-suite/typedef_mptr.i b/Examples/test-suite/typedef_mptr.i
new file mode 100644
index 000000000..5e64c8ac7
--- /dev/null
+++ b/Examples/test-suite/typedef_mptr.i
@@ -0,0 +1,34 @@
+// Tests typedef through member pointers
+
+%module typedef_mptr
+
+#ifdef SWIGPYTHON
+
+%inline %{
+
+class Foo {
+public:
+ int add(int x, int y) {
+ return x+y;
+ }
+ int sub(int x, int y) {
+ return x-y;
+ }
+ int do_op(int x, int y, int (Foo::*op)(int, int)) {
+ return (this->*op)(x,y);
+ }
+};
+
+typedef Foo FooObj;
+typedef int Integer;
+
+Integer do_op(Foo *f, Integer x, Integer y, Integer (FooObj::*op)(Integer, Integer)) {
+ return f->do_op(x,y,op);
+}
+%}
+#endif
+
+#ifdef SWIGPYTHON
+%constant int (Foo::*add)(int,int) = &Foo::add;
+%constant Integer (FooObj::*sub)(Integer,Integer) = &FooObj::sub;
+#endif
diff --git a/Examples/test-suite/typedef_reference.i b/Examples/test-suite/typedef_reference.i
new file mode 100644
index 000000000..5146317a1
--- /dev/null
+++ b/Examples/test-suite/typedef_reference.i
@@ -0,0 +1,10 @@
+%module typedef_reference
+
+%include cpointer.i
+%pointer_functions(int, intp);
+
+%inline %{
+ typedef int & IntRef;
+ int somefunc(IntRef i) { return i; }
+ int otherfunc(int &i) { return i; }
+%}
diff --git a/Examples/test-suite/typedef_scope.i b/Examples/test-suite/typedef_scope.i
new file mode 100644
index 000000000..65adc8df8
--- /dev/null
+++ b/Examples/test-suite/typedef_scope.i
@@ -0,0 +1,21 @@
+// Tests some subtle issues of typedef scoping in C++
+
+%module typedef_scope
+
+%inline %{
+
+typedef char * FooType;
+class Bar {
+public:
+ typedef int FooType;
+ FooType test1(FooType n, ::FooType data) {
+ return n;
+ }
+ ::FooType test2(FooType n, ::FooType data) {
+ return data;
+ }
+};
+%}
+
+
+
diff --git a/Examples/test-suite/typemap_namespace.i b/Examples/test-suite/typemap_namespace.i
new file mode 100644
index 000000000..1c312bcfa
--- /dev/null
+++ b/Examples/test-suite/typemap_namespace.i
@@ -0,0 +1,39 @@
+%module typemap_namespace
+
+/* Secret typedefs */
+%{
+namespace Foo {
+ typedef char Str1;
+ typedef char Str2;
+}
+%}
+
+namespace Foo {
+ struct Str1;
+ struct Str2;
+
+#ifdef SWIGJAVA
+ %typemap(jni) Str1 * = char *;
+ %typemap(jtype) Str1 * = char *;
+ %typemap(jstype) Str1 * = char *;
+ %typemap(freearg) Str1 * = char *;
+ %typemap(javain) Str1 * = char *;
+ %typemap(javaout) Str1 * = char *;
+#endif
+ %typemap(in) Str1 * = char *;
+ %apply char * { Str2 * };
+}
+
+%inline %{
+namespace Foo {
+ char *test1(Str1 *s) {
+ return s;
+ }
+ char *test2(Str2 *s) {
+ return s;
+ }
+}
+%}
+
+
+
diff --git a/Examples/test-suite/typemap_ns_using.i b/Examples/test-suite/typemap_ns_using.i
new file mode 100644
index 000000000..6f3357016
--- /dev/null
+++ b/Examples/test-suite/typemap_ns_using.i
@@ -0,0 +1,21 @@
+%module typemap_ns_using
+
+%warnfilter(801) X::_FooImpl; /* Ruby, wrong class name */
+
+%inline %{
+namespace X {
+ typedef int Integer;
+
+ class _FooImpl {
+ public:
+ typedef Integer value_type;
+ };
+ typedef _FooImpl Foo;
+}
+
+using X::Foo;
+
+int spam(Foo::value_type x) { return x; }
+
+%}
+
diff --git a/Examples/test-suite/typemap_subst.i b/Examples/test-suite/typemap_subst.i
new file mode 100644
index 000000000..f9bc8dd6e
--- /dev/null
+++ b/Examples/test-suite/typemap_subst.i
@@ -0,0 +1,54 @@
+/* This interface file tests for type-related typemap substitutions.
+ */
+
+%module typemap_subst
+
+%warnfilter(801) xyzzy; /* Ruby, wrong class name */
+
+%inline %{
+ struct xyzzy {
+ int member;
+ };
+%}
+
+%typemap(in) const struct xyzzy **TEST
+ ($type temp, $*type startemp, $&type amptemp, $basetype basetemp)
+{
+ { /* Test C type name substitutions */
+ $ltype a = (struct xyzzy **) NULL;
+ const struct xyzzy **b = ($type) NULL;
+ $&ltype c = (struct xyzzy ***) NULL;
+ const struct xyzzy ***d = ($&type) NULL;
+ $*ltype e = *a;
+ $basetype f;
+ f.member = 42;
+ }
+ { /* Test locals */
+ basetemp.member = 0;
+ startemp = &basetemp;
+ temp = &startemp;
+ amptemp = &temp;
+ }
+ /* Java module doesn't seem to use SWIG's type system? */
+ { /* Test descriptors */
+ void *desc = $descriptor;
+ void *stardesc = $*descriptor;
+ void *ampdesc = $&descriptor;
+ }
+ { /* Test mangled names */
+ void *desc = SWIGTYPE$mangle;
+ void *stardesc = SWIGTYPE$*mangle;
+ void *ampdesc = SWIGTYPE$&mangle;
+ }
+ $1 = ($ltype) temp;
+}
+
+#ifndef SWIGJAVA
+%inline %{
+ void foo(const struct xyzzy **TEST) {}
+%}
+#endif
+
+
+
+
diff --git a/Examples/test-suite/typename.i b/Examples/test-suite/typename.i
new file mode 100644
index 000000000..4253e0846
--- /dev/null
+++ b/Examples/test-suite/typename.i
@@ -0,0 +1,34 @@
+%module "typename"
+
+// Tests the typename handling in templates.
+
+%inline %{
+class Foo {
+public:
+ typedef double Number;
+ Number blah() {
+ return 2.1828;
+ }
+};
+
+class Bar {
+public:
+ typedef int Number;
+ Number blah() {
+ return 42;
+ }
+};
+
+template<typename T> typename T::Number twoblah(T &obj) {
+ return 2*(obj.blah());
+}
+
+Bar::Number spam() { return 3; }
+
+%}
+
+%template(twoFoo) twoblah<Foo>;
+%template(twoBar) twoblah<Bar>;
+
+
+ \ No newline at end of file
diff --git a/Examples/test-suite/union_scope.i b/Examples/test-suite/union_scope.i
new file mode 100644
index 000000000..b58585c2a
--- /dev/null
+++ b/Examples/test-suite/union_scope.i
@@ -0,0 +1,13 @@
+%module union_scope
+
+%warnfilter(801) nRState; // Ruby, wrong class name
+%warnfilter(801) nRState_rstate; // Ruby, wrong class name
+
+%inline %{
+class nRState {
+public:
+ union {
+ int i;
+ } rstate;
+};
+%}
diff --git a/Examples/test-suite/unions.i b/Examples/test-suite/unions.i
new file mode 100644
index 000000000..b5f162b89
--- /dev/null
+++ b/Examples/test-suite/unions.i
@@ -0,0 +1,35 @@
+/*
+This testcase checks that unions can be set and read.
+*/
+
+%module unions
+%pragma make_default
+
+%inline %{
+
+typedef struct SmallStruct {
+ short jill;
+} SmallStruct;
+
+typedef struct BigStruct {
+ int jack;
+ SmallStruct smallstruct;
+} BigStruct;
+
+/* This union is just to check the parser */
+typedef union {
+ BigStruct bs;
+ SmallStruct ss;
+} UnionTest;
+
+/* This union checks the parser and will be used in a runtime test */
+typedef struct {
+ union
+ {
+ BigStruct big;
+ SmallStruct small;
+ } uni;
+ int number;
+} EmbeddedUnionTest;
+
+%}
diff --git a/Examples/test-suite/using1.i b/Examples/test-suite/using1.i
new file mode 100644
index 000000000..cd1fe8aac
--- /dev/null
+++ b/Examples/test-suite/using1.i
@@ -0,0 +1,22 @@
+%module using1
+
+%warnfilter(801) X::_FooImpl; /* Ruby, wrong class name */
+
+%inline %{
+
+namespace X {
+ typedef int Integer;
+
+ class _FooImpl {
+ public:
+ typedef Integer value_type;
+ };
+ typedef _FooImpl Foo;
+}
+
+namespace Y = X;
+using namespace Y;
+
+int spam(Foo::value_type x) { return x; }
+
+%}
diff --git a/Examples/test-suite/using2.i b/Examples/test-suite/using2.i
new file mode 100644
index 000000000..29fee1b1c
--- /dev/null
+++ b/Examples/test-suite/using2.i
@@ -0,0 +1,22 @@
+%module using2
+
+%warnfilter(801) X::_FooImpl; /* Ruby, wrong class name */
+
+%inline %{
+
+namespace X {
+ typedef int Integer;
+
+ class _FooImpl {
+ public:
+ typedef Integer value_type;
+ };
+ typedef _FooImpl Foo;
+}
+
+namespace Y = X;
+using Y::Foo;
+
+int spam(Foo::value_type x) { return x; }
+
+%}
diff --git a/Examples/test-suite/using_composition.i b/Examples/test-suite/using_composition.i
new file mode 100644
index 000000000..c7cff1d9d
--- /dev/null
+++ b/Examples/test-suite/using_composition.i
@@ -0,0 +1,24 @@
+%module using_composition
+
+%warnfilter(802, 813) FooBar; // Ruby, Java multiple inheritance
+
+%inline %{
+class Foo {
+public:
+ int blah(int x) { return x; }
+ char *blah(char *x) { return x; }
+};
+
+class Bar {
+public:
+ double blah(double x) { return x; }
+};
+
+class FooBar : public Foo, public Bar {
+public:
+ using Foo::blah;
+ using Bar::blah;
+ char *blah(char *x) { return x; }
+};
+
+%}
diff --git a/Examples/test-suite/using_extend.i b/Examples/test-suite/using_extend.i
new file mode 100644
index 000000000..8bc670e83
--- /dev/null
+++ b/Examples/test-suite/using_extend.i
@@ -0,0 +1,37 @@
+%module using_extend
+
+%warnfilter(802, 813) FooBar; // Ruby, Java multiple inheritance
+
+%extend Foo {
+ int blah(int x, int y) {
+ return x+y;
+ }
+};
+
+%extend Bar {
+ double blah(double x, double y) {
+ return x+y;
+ }
+};
+
+%inline %{
+class Foo {
+public:
+ int blah(int x) { return x; }
+ char *blah(char *x) { return x; }
+};
+
+class Bar {
+public:
+ double blah(double x) { return x; }
+};
+
+class FooBar : public Foo, public Bar {
+public:
+ using Foo::blah;
+ using Bar::blah;
+ char *blah(char *x) { return x; }
+};
+
+%}
+
diff --git a/Examples/test-suite/using_inherit.i b/Examples/test-suite/using_inherit.i
new file mode 100644
index 000000000..d4eca3707
--- /dev/null
+++ b/Examples/test-suite/using_inherit.i
@@ -0,0 +1,17 @@
+%module using_inherit
+
+%inline %{
+
+class Foo {
+public:
+ int test(int x) { return x; }
+ double test(double x) { return x; };
+};
+
+class Bar : public Foo {
+public:
+ using Foo::test;
+};
+
+%}
+
diff --git a/Examples/test-suite/using_namespace.i b/Examples/test-suite/using_namespace.i
new file mode 100644
index 000000000..886dd2a3e
--- /dev/null
+++ b/Examples/test-suite/using_namespace.i
@@ -0,0 +1,56 @@
+%module using_namespace
+
+%warnfilter(801) hi::hi0; /* Ruby, wrong class name */
+%warnfilter(801) hi::hi1; /* Ruby, wrong class name */
+
+%warnfilter(802, 813) Hi<hello::Hello, hi::hi0>; // Ruby, Java multiple inheritance
+
+%inline %{
+ namespace hello
+ {
+ struct Hello
+ {
+ };
+
+ template <class _T1, class _T2>
+ struct Hi : _T1, _T2
+ {
+ int value1() const
+ {
+ return 1;
+ }
+ };
+ }
+
+ namespace hi
+ {
+
+ struct hi0
+ {
+ };
+
+ }
+%}
+
+namespace hello
+{
+ %template(Hi_hi0) Hi<hello::Hello, hi::hi0>;
+}
+
+
+%inline %{
+ namespace hi
+ {
+ struct hi1 : private hello::Hi< hello::Hello, hi0 >
+ {
+ // This works
+ // using hello::Hi< hello::Hello, hi::hi0 >::value1;
+
+ // This doesn't
+ using hello::Hi< hello::Hello, hi0 >::value1;
+
+ };
+
+ }
+
+%}
diff --git a/Examples/test-suite/using_private.i b/Examples/test-suite/using_private.i
new file mode 100644
index 000000000..cd5a7974b
--- /dev/null
+++ b/Examples/test-suite/using_private.i
@@ -0,0 +1,17 @@
+%module using_private
+
+%inline %{
+class Foo {
+public:
+ int x;
+ int blah(int x) { return x; }
+};
+
+class FooBar : private Foo {
+public:
+ using Foo::blah;
+ using Foo::x;
+};
+
+%}
+
diff --git a/Examples/test-suite/using_protected.i b/Examples/test-suite/using_protected.i
new file mode 100644
index 000000000..93d48cb49
--- /dev/null
+++ b/Examples/test-suite/using_protected.i
@@ -0,0 +1,17 @@
+%module using_protected
+
+%inline %{
+class Foo {
+protected:
+ int x;
+ int blah(int x) { return x; }
+};
+
+class FooBar : public Foo {
+public:
+ using Foo::blah;
+ using Foo::x;
+};
+
+%}
+
diff --git a/Examples/test-suite/valuewrapper_base.i b/Examples/test-suite/valuewrapper_base.i
new file mode 100644
index 000000000..1698c3e03
--- /dev/null
+++ b/Examples/test-suite/valuewrapper_base.i
@@ -0,0 +1,28 @@
+%module valuewrapper_base
+%inline
+%{
+ namespace oss
+ {
+ enum Polarization { UnaryPolarization, BinaryPolarization };
+
+ struct Base
+ {
+ };
+
+ template <Polarization P>
+ struct Interface : Base
+ {
+ Interface(const Base& b) { };
+ };
+
+ template <class Result>
+ Result make() { return Result(*new Base()); }
+ }
+%}
+
+namespace oss
+{
+ // Interface
+ %template(Interface_BP) Interface<BinaryPolarization>;
+ %template(make_Interface_BP) make<Interface<BinaryPolarization> >;
+}
diff --git a/Examples/test-suite/virtual_destructor.i b/Examples/test-suite/virtual_destructor.i
new file mode 100644
index 000000000..da357c4a3
--- /dev/null
+++ b/Examples/test-suite/virtual_destructor.i
@@ -0,0 +1,16 @@
+/*
+This testcase checks that a virtual destructor with void as a parameter is
+correctly handled.
+*/
+
+%module virtual_destructor
+
+%inline %{
+
+class VirtualVoidDestructor {
+public:
+ VirtualVoidDestructor() {};
+ virtual ~VirtualVoidDestructor(void) { };
+};
+
+%}
diff --git a/Examples/test-suite/voidtest.i b/Examples/test-suite/voidtest.i
new file mode 100644
index 000000000..37d6d9fc5
--- /dev/null
+++ b/Examples/test-suite/voidtest.i
@@ -0,0 +1,16 @@
+%module voidtest
+
+%inline %{
+
+void globalfunc(void) {
+};
+
+class Foo {
+public:
+ Foo() { };
+ void memberfunc(void) { };
+ static void staticmemberfunc(void) { };
+};
+
+%}
+ \ No newline at end of file