summaryrefslogtreecommitdiff
path: root/Examples/test-suite
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite')
-rw-r--r--Examples/test-suite/allegrocl/Makefile.in16
-rw-r--r--Examples/test-suite/allowexcept.i2
-rw-r--r--Examples/test-suite/autodoc.i8
-rw-r--r--Examples/test-suite/cffi/Makefile.in16
-rw-r--r--Examples/test-suite/chicken/Makefile.in24
-rw-r--r--Examples/test-suite/clisp/Makefile.in16
-rw-r--r--Examples/test-suite/common.mk33
-rw-r--r--Examples/test-suite/constant_directive.i28
-rw-r--r--Examples/test-suite/cpp11_constexpr.i6
-rw-r--r--Examples/test-suite/cpp11_function_objects.i18
-rw-r--r--Examples/test-suite/cpp11_strongly_typed_enumerations.i183
-rw-r--r--Examples/test-suite/cpp11_strongly_typed_enumerations_simple.i5
-rw-r--r--Examples/test-suite/csharp/Makefile.in15
-rw-r--r--Examples/test-suite/csharp/cpp11_strongly_typed_enumerations_runme.cs169
-rw-r--r--Examples/test-suite/csharp/csharp_exceptions_runme.cs6
-rw-r--r--Examples/test-suite/d/Makefile.in18
-rw-r--r--Examples/test-suite/d/li_boost_shared_ptr_runme.2.d274
-rw-r--r--Examples/test-suite/default_args.i28
-rw-r--r--Examples/test-suite/default_constructor.i8
-rw-r--r--Examples/test-suite/director_abstract.i2
-rw-r--r--Examples/test-suite/director_exception.i28
-rw-r--r--Examples/test-suite/director_keywords.i9
-rw-r--r--Examples/test-suite/director_nested_class.i25
-rw-r--r--Examples/test-suite/director_nestedmodule.i29
-rw-r--r--Examples/test-suite/director_property.i151
-rw-r--r--Examples/test-suite/enum_rename.i2
-rw-r--r--Examples/test-suite/enum_thorough.i12
-rw-r--r--Examples/test-suite/equality.i69
-rw-r--r--Examples/test-suite/errors/.gitignore4
-rw-r--r--Examples/test-suite/errors/Makefile.in30
-rw-r--r--Examples/test-suite/errors/c_extra_rblock.stderr2
-rw-r--r--Examples/test-suite/errors/c_missing_semi.stderr2
-rw-r--r--Examples/test-suite/errors/cpp_extra_brackets.stderr2
-rw-r--r--Examples/test-suite/errors/pp_constant.i4
-rw-r--r--Examples/test-suite/errors/pp_constant.stderr8
-rw-r--r--Examples/test-suite/errors/pp_missing_enddef.stderr2
-rw-r--r--Examples/test-suite/errors/pp_missing_endif.stderr2
-rw-r--r--Examples/test-suite/errors/pp_missing_endoffile.i7
-rw-r--r--Examples/test-suite/errors/pp_missing_endoffile.stderr1
-rw-r--r--Examples/test-suite/errors/pp_missing_rblock.stderr2
-rw-r--r--Examples/test-suite/errors/pp_unknowndirective.i7
-rw-r--r--Examples/test-suite/errors/pp_unknowndirective.stderr1
-rw-r--r--Examples/test-suite/errors/pp_unknowndirective2.i11
-rw-r--r--Examples/test-suite/errors/pp_unknowndirective2.stderr1
-rw-r--r--Examples/test-suite/errors/pp_unterm_char.stderr2
-rw-r--r--Examples/test-suite/errors/pp_unterm_comment.stderr2
-rw-r--r--Examples/test-suite/errors/pp_unterm_string.stderr2
-rw-r--r--Examples/test-suite/errors/pp_unterminated_block.i5
-rw-r--r--Examples/test-suite/errors/pp_unterminated_block.stderr1
-rw-r--r--Examples/test-suite/exception_order.i7
-rw-r--r--Examples/test-suite/exception_partial_info.i2
-rw-r--r--Examples/test-suite/extend_default.i2
-rw-r--r--Examples/test-suite/extend_special_variables.i16
-rw-r--r--Examples/test-suite/go/Makefile.in25
-rw-r--r--Examples/test-suite/go/argout_runme.go41
-rw-r--r--Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go171
-rw-r--r--Examples/test-suite/go/go_director_inout_runme.go32
-rw-r--r--Examples/test-suite/go/go_inout_runme.go43
-rw-r--r--Examples/test-suite/go/overload_polymorphic_runme.go11
-rw-r--r--Examples/test-suite/go_director_inout.i121
-rw-r--r--Examples/test-suite/go_inout.i199
-rw-r--r--Examples/test-suite/guile/Makefile.in18
-rw-r--r--Examples/test-suite/import_nomodule.i9
-rw-r--r--Examples/test-suite/infinity.i28
-rw-r--r--Examples/test-suite/java/Makefile.in15
-rw-r--r--Examples/test-suite/java/constant_directive_runme.java22
-rw-r--r--Examples/test-suite/java/cpp11_strongly_typed_enumerations_runme.java176
-rw-r--r--Examples/test-suite/java/cpp11_strongly_typed_enumerations_simple_runme.java176
-rw-r--r--Examples/test-suite/java/director_nested_class_runme.java41
-rw-r--r--Examples/test-suite/java/java_director_runme.java2
-rw-r--r--Examples/test-suite/java/java_lib_various_runme.java19
-rw-r--r--Examples/test-suite/java/kwargs_feature_runme.java23
-rw-r--r--Examples/test-suite/java/li_boost_intrusive_ptr_runme.java20
-rw-r--r--Examples/test-suite/java/li_boost_shared_ptr_runme.java2
-rw-r--r--Examples/test-suite/java/li_std_auto_ptr_runme.java4
-rw-r--r--Examples/test-suite/java/nested_extend_c_runme.java45
-rw-r--r--Examples/test-suite/java/nested_template_base_runme.java27
-rw-r--r--Examples/test-suite/java/preproc_line_file_runme.java16
-rw-r--r--Examples/test-suite/java/smart_pointer_const_overload_runme.java2
-rw-r--r--Examples/test-suite/java/template_default_class_parms_runme.java5
-rw-r--r--Examples/test-suite/java/template_templated_constructors_runme.java26
-rw-r--r--Examples/test-suite/java/template_typedef_typedef_runme.java6
-rw-r--r--Examples/test-suite/java_lib_various.i4
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/javascript/Makefile.in57
-rw-r--r--Examples/test-suite/javascript/abstract_access_runme.js2
-rw-r--r--Examples/test-suite/javascript/abstract_inherit_runme.js2
-rw-r--r--Examples/test-suite/javascript/abstract_typedef2_runme.js2
-rw-r--r--Examples/test-suite/javascript/abstract_typedef_runme.js2
-rw-r--r--Examples/test-suite/javascript/abstract_virtual_runme.js2
-rw-r--r--Examples/test-suite/javascript/array_member_runme.js2
-rw-r--r--Examples/test-suite/javascript/arrays_global_runme.js2
-rw-r--r--Examples/test-suite/javascript/callback_runme.js2
-rw-r--r--Examples/test-suite/javascript/char_binary_runme.js2
-rw-r--r--Examples/test-suite/javascript/char_strings_runme.js2
-rw-r--r--Examples/test-suite/javascript/class_ignore_runme.js2
-rw-r--r--Examples/test-suite/javascript/class_scope_weird_runme.js2
-rw-r--r--Examples/test-suite/javascript/complextest_runme.js2
-rw-r--r--Examples/test-suite/javascript/constover_runme.js2
-rw-r--r--Examples/test-suite/javascript/constructor_copy_runme.js2
-rw-r--r--Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js165
-rw-r--r--Examples/test-suite/javascript/cpp_enum_runme.js2
-rw-r--r--Examples/test-suite/javascript/cpp_namespace_runme.js2
-rw-r--r--Examples/test-suite/javascript/cpp_static_runme.js2
-rw-r--r--Examples/test-suite/javascript/director_alternating_runme.js2
-rw-r--r--Examples/test-suite/javascript/disown_runme.js2
-rw-r--r--Examples/test-suite/javascript/dynamic_cast_runme.js2
-rw-r--r--Examples/test-suite/javascript/empty_runme.js2
-rw-r--r--Examples/test-suite/javascript/enum_template_runme.js2
-rw-r--r--Examples/test-suite/javascript/infinity_runme.js3
-rw-r--r--Examples/test-suite/javascript/namespace_virtual_method_runme.js2
-rw-r--r--Examples/test-suite/javascript/node_template/binding.gyp.in2
-rw-r--r--Examples/test-suite/javascript/nspace_extend_runme.js2
-rw-r--r--Examples/test-suite/javascript/nspace_runme.js2
-rw-r--r--Examples/test-suite/javascript/null_pointer_runme.js9
-rw-r--r--Examples/test-suite/javascript/overload_copy_runme.js2
-rw-r--r--Examples/test-suite/javascript/preproc_include_runme.js2
-rw-r--r--Examples/test-suite/javascript/preproc_runme.js2
-rw-r--r--Examples/test-suite/javascript/rename1_runme.js2
-rw-r--r--Examples/test-suite/javascript/rename2_runme.js2
-rw-r--r--Examples/test-suite/javascript/rename3_runme.js2
-rw-r--r--Examples/test-suite/javascript/rename4_runme.js2
-rw-r--r--Examples/test-suite/javascript/rename_scope_runme.js2
-rw-r--r--Examples/test-suite/javascript/rename_simple_runme.js2
-rw-r--r--Examples/test-suite/javascript/ret_by_value_runme.js2
-rw-r--r--Examples/test-suite/javascript/setup_test.sh6
-rw-r--r--Examples/test-suite/javascript/string_simple_runme.js2
-rw-r--r--Examples/test-suite/javascript/struct_value_runme.js2
-rw-r--r--Examples/test-suite/javascript/template_static_runme.js2
-rw-r--r--Examples/test-suite/javascript/typedef_class_runme.js2
-rw-r--r--Examples/test-suite/javascript/typedef_inherit_runme.js2
-rw-r--r--Examples/test-suite/javascript/typedef_scope_runme.js2
-rw-r--r--Examples/test-suite/javascript/typemap_arrays_runme.js2
-rw-r--r--Examples/test-suite/javascript/typemap_delete_runme.js2
-rw-r--r--Examples/test-suite/javascript/typemap_namespace_runme.js2
-rw-r--r--Examples/test-suite/javascript/typemap_ns_using_runme.js2
-rw-r--r--Examples/test-suite/javascript/using1_runme.js2
-rw-r--r--Examples/test-suite/javascript/using2_runme.js2
-rw-r--r--Examples/test-suite/javascript/varargs_runme.js2
-rw-r--r--Examples/test-suite/kwargs_feature.i18
-rw-r--r--Examples/test-suite/li_boost_intrusive_ptr.i15
-rw-r--r--Examples/test-suite/li_std_except_as_class.i8
-rw-r--r--Examples/test-suite/li_std_string_extra.i6
-rw-r--r--Examples/test-suite/li_std_wstring.i6
-rw-r--r--Examples/test-suite/li_swigtype_inout.i12
-rw-r--r--Examples/test-suite/lua/Makefile.in17
-rw-r--r--Examples/test-suite/lua/cpp11_strongly_typed_enumerations_runme.lua174
-rw-r--r--Examples/test-suite/lua/cpp_basic_runme.lua11
-rw-r--r--Examples/test-suite/lua/equality_runme.lua47
-rw-r--r--Examples/test-suite/lua/operator_overload_runme.lua8
-rw-r--r--Examples/test-suite/mzscheme/Makefile.in13
-rw-r--r--Examples/test-suite/nested_class.i6
-rw-r--r--Examples/test-suite/nested_extend_c.i102
-rw-r--r--Examples/test-suite/nested_scope.i38
-rw-r--r--Examples/test-suite/nested_template_base.i38
-rw-r--r--Examples/test-suite/ocaml/Makefile.in15
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ocaml/makedebugtop0
-rw-r--r--Examples/test-suite/octave/Makefile.in29
-rw-r--r--Examples/test-suite/octave/cpp11_strongly_typed_enumerations_runme.m166
-rw-r--r--Examples/test-suite/octave/director_detect_runme.m4
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/octave/iadd_runme.m0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/octave/overload_complicated_runme.m0
-rw-r--r--Examples/test-suite/overload_polymorphic.i22
-rw-r--r--Examples/test-suite/perl5/Makefile.in14
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/char_binary_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/class_ignore_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/contract_runme.pl0
-rw-r--r--Examples/test-suite/perl5/cpp11_strongly_typed_enumerations_runme.pl168
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/enum_template_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/grouping_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/ignore_parameter_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/inherit_missing_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/li_std_except_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/minherit_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/naturalvar_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/preproc_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/primitive_types_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/reference_global_vars_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/rename_scope_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/return_const_value_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/run-perl-test.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/sizet_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/sneaky1_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/template_typedef_cplx2_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/typedef_class_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/typename_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/using1_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/using2_runme.pl0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/perl5/wrapmacro_runme.pl0
-rw-r--r--Examples/test-suite/php/Makefile.in24
-rw-r--r--Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php169
-rw-r--r--Examples/test-suite/php/director_exception_runme.php53
-rw-r--r--Examples/test-suite/php/exception_order_runme.php2
-rw-r--r--Examples/test-suite/php/import_nomodule_runme.php2
-rw-r--r--Examples/test-suite/php/php_iterator_runme.php24
-rw-r--r--Examples/test-suite/php/threads_exception_runme.php4
-rw-r--r--Examples/test-suite/php_iterator.i20
-rw-r--r--Examples/test-suite/pike/Makefile.in12
-rw-r--r--Examples/test-suite/preproc.i17
-rw-r--r--Examples/test-suite/preproc_constants.i2
-rw-r--r--Examples/test-suite/python/Makefile.in94
-rw-r--r--Examples/test-suite/python/autodoc_runme.py211
-rw-r--r--Examples/test-suite/python/cpp11_function_objects_runme.py11
-rw-r--r--Examples/test-suite/python/cpp11_strongly_typed_enumerations_runme.py164
-rw-r--r--Examples/test-suite/python/default_args_runme.py152
-rw-r--r--Examples/test-suite/python/default_constructor_runme.py6
-rw-r--r--Examples/test-suite/python/director_exception_runme.py19
-rw-r--r--Examples/test-suite/python/director_keywords_runme.py5
-rw-r--r--Examples/test-suite/python/director_property_runme.py18
-rw-r--r--Examples/test-suite/python/exception_order_runme.py2
-rw-r--r--Examples/test-suite/python/import_nomodule_runme.py5
-rw-r--r--Examples/test-suite/python/kwargs_feature_runme.py4
-rw-r--r--Examples/test-suite/python/li_std_except_as_class_runme.py24
-rw-r--r--Examples/test-suite/python/li_std_string_extra_runme.py13
-rw-r--r--Examples/test-suite/python/li_std_wstring_runme.py15
-rw-r--r--Examples/test-suite/python/nested_template_base_runme.py13
-rw-r--r--Examples/test-suite/python/preproc_runme.py2
-rw-r--r--Examples/test-suite/python/python_abstractbase_runme3.py2
-rw-r--r--Examples/test-suite/python/python_append_runme.py9
-rw-r--r--Examples/test-suite/python/python_threads_runme.py10
-rw-r--r--Examples/test-suite/python/smart_pointer_const_overload_runme.py2
-rw-r--r--Examples/test-suite/python/threads_exception_runme.py19
-rw-r--r--Examples/test-suite/python/unicode_strings_runme.py14
-rw-r--r--Examples/test-suite/python_abstractbase.i8
-rw-r--r--Examples/test-suite/python_append.i27
-rw-r--r--Examples/test-suite/python_nondynamic.i2
-rw-r--r--Examples/test-suite/python_threads.i40
-rw-r--r--Examples/test-suite/r/Makefile.in25
-rw-r--r--Examples/test-suite/r_overload_array.i7
-rw-r--r--Examples/test-suite/ruby/Makefile.in14
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/abstract_access_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/access_change_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/add_link_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/anonymous_bitfield_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/apply_signed_char_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/apply_strings_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/argout_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/arrays_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/cast_operator_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/casts_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/check_missing_tests.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/class_ignore_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/const_const_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/constover_runme.rb0
-rw-r--r--Examples/test-suite/ruby/cpp11_strongly_typed_enumerations_runme.rb177
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/cpp_namespace_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/default_constructor_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/dynamic_cast_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/enum_thorough_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/function_typedef_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/imports_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/integers_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_cstring_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_math_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_functors_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_map_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_multimap_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_pair_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_queue_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_set_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_speed2_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_stack_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_stream_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_vector_enum_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/li_std_vector_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/namespace_typemap_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/overload_bool_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/overload_copy_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/overload_extend_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/overload_extendc_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/overload_simple_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/overload_template_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/primitive_ref_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/ruby_li_std_speed_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/sneaky1_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/std_containers_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/stl_new_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/swig_assert.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/swig_gc.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/template_inherit_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/template_ns4_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/template_ns_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/template_rename_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/typedef_inherit_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/typedef_scope_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/typemap_namespace_runme.rb0
-rw-r--r--[-rwxr-xr-x]Examples/test-suite/ruby/typename_runme.rb0
-rw-r--r--Examples/test-suite/smart_pointer_const_overload.i2
-rw-r--r--Examples/test-suite/smart_pointer_templatemethods.i2
-rw-r--r--Examples/test-suite/struct_initialization.i2
-rw-r--r--Examples/test-suite/tcl/Makefile.in15
-rw-r--r--Examples/test-suite/tcl/cpp11_strongly_typed_enumerations_runme.tcl172
-rw-r--r--Examples/test-suite/template_default_class_parms.i46
-rw-r--r--Examples/test-suite/template_templated_constructors.i47
-rw-r--r--Examples/test-suite/template_typedef_typedef.i8
-rw-r--r--Examples/test-suite/threads_exception.i6
-rw-r--r--Examples/test-suite/throw_exception.i32
-rw-r--r--Examples/test-suite/typemap_array_qualifiers.i14
-rw-r--r--Examples/test-suite/typemap_directorout.i2
-rw-r--r--Examples/test-suite/typemap_variables.i27
-rw-r--r--Examples/test-suite/uffi/Makefile.in16
-rw-r--r--Examples/test-suite/unicode_strings.i15
301 files changed, 5030 insertions, 750 deletions
diff --git a/Examples/test-suite/allegrocl/Makefile.in b/Examples/test-suite/allegrocl/Makefile.in
index 5f75bfc08..02ef8e302 100644
--- a/Examples/test-suite/allegrocl/Makefile.in
+++ b/Examples/test-suite/allegrocl/Makefile.in
@@ -5,6 +5,7 @@
LANGUAGE = allegrocl
ALLEGROCL = @ALLEGROCLBIN@
SCRIPTSUFFIX = _runme.lisp
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -12,7 +13,7 @@ top_builddir = @top_builddir@
# these cpp tests generate warnings/errors when compiling
# the wrapper .cxx file.
-CPP_TEST_BROKEN_CXX =
+CPP_TEST_BROKEN_CXX =
# the error is wrap:action code generated by swig. \
# error: can't convert [std::string] 'b' to 'bool' \
# might just need a bool overload op for std::string. \
@@ -71,7 +72,7 @@ CPP_TEST_CASES_ACL_UNSUPPORTED = \
extern_throws \
throw_exception \
using_pointers \
-
+
C_TEST_CASES_ACL_BROKEN = \
# 'cdate.i' module support \
li_cdata \
@@ -96,7 +97,7 @@ include $(srcdir)/../common.mk
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -106,7 +107,7 @@ include $(srcdir)/../common.mk
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -114,13 +115,12 @@ include $(srcdir)/../common.mk
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
%.clean:
@rm -f $*.cl
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile allegrocl_clean
-
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" allegrocl_clean
diff --git a/Examples/test-suite/allowexcept.i b/Examples/test-suite/allowexcept.i
index 37b01cd75..c901295df 100644
--- a/Examples/test-suite/allowexcept.i
+++ b/Examples/test-suite/allowexcept.i
@@ -21,7 +21,7 @@ UVW Bar::static_member_variable;
%}
-// Now test the allowexcept feature by making the usual $action uncompileable and ensuring the %exception is picked up
+// Now test the allowexcept feature by making the usual $action uncompilable and ensuring the %exception is picked up
struct XYZ {
};
diff --git a/Examples/test-suite/autodoc.i b/Examples/test-suite/autodoc.i
index 599a3f12f..d85899756 100644
--- a/Examples/test-suite/autodoc.i
+++ b/Examples/test-suite/autodoc.i
@@ -133,3 +133,11 @@ typedef int Integer;
void banana(S *a, const struct tagS *b, int c, Integer d) {}
%}
+%inline %{
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+%}
+
diff --git a/Examples/test-suite/cffi/Makefile.in b/Examples/test-suite/cffi/Makefile.in
index aa8b40aec..ee7e3f61e 100644
--- a/Examples/test-suite/cffi/Makefile.in
+++ b/Examples/test-suite/cffi/Makefile.in
@@ -5,6 +5,7 @@
LANGUAGE = cffi
CFFI = @CFFIBIN@
SCRIPTSUFFIX = _runme.lisp
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -14,13 +15,13 @@ include $(srcdir)/../common.mk
# Overridden variables here
# no C++ tests for now
CPP_TEST_CASES =
-#C_TEST_CASES +=
+#C_TEST_CASES +=
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -30,7 +31,7 @@ CPP_TEST_CASES =
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -38,14 +39,13 @@ CPP_TEST_CASES =
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFI) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFI) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we dont generate extra cffi code)
%.clean:
-
+ @exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile cffi_clean
-
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" cffi_clean
diff --git a/Examples/test-suite/chicken/Makefile.in b/Examples/test-suite/chicken/Makefile.in
index 3c2f3de54..31ab311bb 100644
--- a/Examples/test-suite/chicken/Makefile.in
+++ b/Examples/test-suite/chicken/Makefile.in
@@ -3,12 +3,14 @@
#######################################################################
LANGUAGE = chicken
-VARIANT =
+VARIANT =
SCRIPTSUFFIX = _runme.ss
PROXYSUFFIX = _runme_proxy.ss
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
+
CHICKEN_CSI = @CHICKEN_CSI@ -quiet -batch -no-init
SO = @SO@
@@ -17,7 +19,7 @@ SO = @SO@
# Skip the STD cases for now, except for li_std_string.i
SKIP_CPP_STD_CASES = Yes
-CPP_TEST_CASES += li_std_string
+CPP_TEST_CASES += li_std_string
EXTRA_TEST_CASES += chicken_ext_test.externaltest
@@ -39,11 +41,11 @@ SWIGOPT += -nounit
%.multiproxy: SCRIPTSUFFIX = $(PROXYSUFFIX)
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
$(MAKE) $*.cppproxy; \
fi
@@ -51,15 +53,15 @@ SWIGOPT += -nounit
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
$(MAKE) $*.cproxy; \
fi
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \
$(MAKE) $*.multiproxy; \
fi
@@ -86,14 +88,14 @@ SWIGOPT += -nounit
# 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 $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:
-
+ @exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile chicken_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" chicken_clean
rm -f *.scm
diff --git a/Examples/test-suite/clisp/Makefile.in b/Examples/test-suite/clisp/Makefile.in
index 24655a60f..6837ed60b 100644
--- a/Examples/test-suite/clisp/Makefile.in
+++ b/Examples/test-suite/clisp/Makefile.in
@@ -5,6 +5,7 @@
LANGUAGE = clisp
CLISP = @CLISPBIN@
SCRIPTSUFFIX = _runme.lisp
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -14,13 +15,13 @@ include $(srcdir)/../common.mk
# Overridden variables here
# no C++ tests for now
CPP_TEST_CASES =
-#C_TEST_CASES +=
+#C_TEST_CASES +=
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -30,7 +31,7 @@ CPP_TEST_CASES =
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -38,14 +39,13 @@ CPP_TEST_CASES =
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISP) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISP) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we dont generate extra clisp code)
%.clean:
-
+ @exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile clisp_clean
-
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" clisp_clean
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 2a4591524..ac2dfd4dd 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -69,7 +69,13 @@ INCLUDES = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
LIBS = -L.
LIBPREFIX = lib
ACTION = check
-INTERFACEDIR = $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/
+INTERFACEDIR = ../
+SRCDIR = $(srcdir)/
+SCRIPTDIR = $(srcdir)
+
+# Regenerate Makefile if Makefile.in or config.status have changed.
+Makefile: $(srcdir)/Makefile.in ../../../config.status
+ cd ../../../ && $(SHELL) ./config.status $(EXAMPLES)/$(TEST_SUITE)/$(LANGUAGE)/Makefile
#
# Please keep test cases in alphabetical order.
@@ -80,6 +86,7 @@ INTERFACEDIR = $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/
CPP_TEST_BROKEN += \
constants \
cpp_broken \
+ director_nested_class \
exception_partial_info \
extend_variable \
li_std_vector_ptr \
@@ -136,6 +143,7 @@ CPP_TEST_CASES += \
class_scope_weird \
compactdefaultargs \
const_const_2 \
+ constant_directive \
constant_pointers \
constover \
constructor_copy \
@@ -166,6 +174,7 @@ CPP_TEST_CASES += \
director_abstract \
director_alternating \
director_basic \
+ director_property \
director_binary_string \
director_classes \
director_classic \
@@ -204,6 +213,7 @@ CPP_TEST_CASES += \
enum_template \
enum_thorough \
enum_var \
+ equality \
evil_diamond \
evil_diamond_ns \
evil_diamond_prop \
@@ -241,6 +251,7 @@ CPP_TEST_CASES += \
insert_directive \
keyword_rename \
kind \
+ kwargs_feature \
langobj \
li_attribute \
li_attribute_template \
@@ -288,6 +299,7 @@ CPP_TEST_CASES += \
nested_directors \
nested_comment \
nested_scope \
+ nested_template_base \
nested_workaround \
newobject1 \
null_pointer \
@@ -301,6 +313,7 @@ CPP_TEST_CASES += \
overload_extend \
overload_method \
overload_numeric \
+ overload_polymorphic \
overload_rename \
overload_return_type \
overload_simple \
@@ -371,6 +384,7 @@ CPP_TEST_CASES += \
template_classes \
template_const_ref \
template_construct \
+ template_templated_constructors \
template_default \
template_default2 \
template_default_arg \
@@ -409,7 +423,6 @@ CPP_TEST_CASES += \
template_partial_specialization \
template_partial_specialization_typedef \
template_qualifier \
- template_qualifier \
template_ref_type \
template_rename \
template_retvalue \
@@ -468,6 +481,7 @@ CPP_TEST_CASES += \
typemap_various \
typename \
types_directive \
+ unicode_strings \
union_scope \
using1 \
using2 \
@@ -518,6 +532,7 @@ CPP11_TEST_CASES = \
cpp11_rvalue_reference3 \
cpp11_sizeof_object \
cpp11_static_assert \
+ cpp11_strongly_typed_enumerations \
cpp11_thread_local \
cpp11_template_double_brackets \
cpp11_template_explicit \
@@ -530,7 +545,6 @@ CPP11_TEST_CASES = \
# Broken C++11 test cases.
CPP11_TEST_BROKEN = \
# cpp11_hash_tables \ # not fully implemented yet
-# cpp11_strongly_typed_enumerations \ # SWIG not quite getting this right yet in all langs
# cpp11_variadic_templates \ # Broken for some languages (such as Java)
# cpp11_reference_wrapper \ # No typemaps
@@ -602,6 +616,7 @@ C_TEST_CASES += \
memberin_extend_c \
name \
nested \
+ nested_extend_c \
nested_structs \
newobject2 \
overload_extend \
@@ -682,14 +697,14 @@ partialcheck:
$(MAKE) check CC=true CXX=true LDSHARED=true CXXSHARED=true RUNTOOL=true COMPILETOOL=true
swig_and_compile_cpp = \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
$(LANGUAGE)$(VARIANT)_cpp
swig_and_compile_c = \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CSRCS="$(CSRCS)" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CSRCS="$(CSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
@@ -697,7 +712,7 @@ swig_and_compile_c = \
swig_and_compile_multi_cpp = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
@@ -705,11 +720,11 @@ swig_and_compile_multi_cpp = \
done
swig_and_compile_external = \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
TARGET="$*_wrap_hdr.h" \
$(LANGUAGE)$(VARIANT)_externalhdr; \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS) $*_external.cxx" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS) $*_external.cxx" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
@@ -718,7 +733,7 @@ swig_and_compile_external = \
swig_and_compile_runtime = \
setup = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
diff --git a/Examples/test-suite/constant_directive.i b/Examples/test-suite/constant_directive.i
new file mode 100644
index 000000000..8204720d6
--- /dev/null
+++ b/Examples/test-suite/constant_directive.i
@@ -0,0 +1,28 @@
+%module constant_directive
+
+// %constant and struct
+%{
+ struct Type1 {
+ Type1(int val = 0) : val(val) {}
+ int val;
+ };
+ static Type1 TYPE1_CONSTANT1(1);
+ static Type1 TYPE1_CONST2(2);
+ static Type1 TYPE1_CONST3(3);
+%}
+
+struct Type1 {
+ Type1(int val = 0) : val(val) {}
+ int val;
+};
+
+%inline %{
+Type1 getType1Instance() { return Type1(111); }
+%}
+
+%constant Type1 TYPE1_CONSTANT1;
+%constant Type1 TYPE1_CONSTANT2 = TYPE1_CONST2;
+%constant Type1 *TYPE1_CONSTANT3 = &TYPE1_CONST3;
+
+%constant int TYPE_INT = 0;
+
diff --git a/Examples/test-suite/cpp11_constexpr.i b/Examples/test-suite/cpp11_constexpr.i
index 412b8132a..d91107cc6 100644
--- a/Examples/test-suite/cpp11_constexpr.i
+++ b/Examples/test-suite/cpp11_constexpr.i
@@ -18,6 +18,12 @@ struct ConstExpressions {
static const int LLL = 300;
constexpr int MMM() { return 400; }
constexpr const int NNN() { return 500; }
+ // Regression tests for support added in SWIG 3.0.4:
+ static constexpr const int JJJ1 = 101;
+ constexpr static int KKK1 = 201;
+ // Regression tests for https://github.com/swig/swig/issues/284 :
+ explicit constexpr ConstExpressions(int) { }
+ constexpr explicit ConstExpressions(double) { }
};
%}
diff --git a/Examples/test-suite/cpp11_function_objects.i b/Examples/test-suite/cpp11_function_objects.i
index fb75edea6..e80f60a2f 100644
--- a/Examples/test-suite/cpp11_function_objects.i
+++ b/Examples/test-suite/cpp11_function_objects.i
@@ -3,25 +3,31 @@
Function objects are objects which overload the operator() function.
The std::function does not provide any seamless support in the target languages yet.
*/
-%module cpp11_function_objects
+%module(directors="1") cpp11_function_objects
%rename(__call__) Test::operator();
+%feature("director") Test;
+
%inline %{
-struct Test {
+class Test {
+public:
int value;
- void operator()(int x, int y) {
+ virtual void operator()(int x, int y) {
value=x+y;
}
Test() : value(0) {}
-} test;
+ virtual ~Test() {}
+};
+
+Test test;
#include <functional>
std::function<void ( int, int )> pF = test;
-int testit1(Test new_test, int a, int b) {
- pF = new_test;
+int testit1(Test &new_test, int a, int b) {
+ pF = std::ref(new_test);
pF(a, b);
return new_test.value;
}
diff --git a/Examples/test-suite/cpp11_strongly_typed_enumerations.i b/Examples/test-suite/cpp11_strongly_typed_enumerations.i
index ed466369e..3a4ee107a 100644
--- a/Examples/test-suite/cpp11_strongly_typed_enumerations.i
+++ b/Examples/test-suite/cpp11_strongly_typed_enumerations.i
@@ -1,11 +1,9 @@
-/* This testcase checks whether SWIG produces the correct wrapper for the
- strongly typed enums. Enums with the same type are comparable. Enum classes
- require support for nested classes. */
+// This testcase checks whether SWIG produces the correct wrappers for strongly typed enums.
+
%module cpp11_strongly_typed_enumerations
-%warnfilter(302) Val1;
-%warnfilter(302) Val2;
-%warnfilter(302) Val3;
-%warnfilter(302) Val4;
+
+%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Class1::Struct1;
+%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Class2::Struct1;
/* Forward declarations (illegally accepted by SWIG - oh well!) */
enum Enum1 : short;
@@ -17,15 +15,19 @@ enum : unsigned short;
enum class Enum1 {
Val1,
Val2,
- Val3 = 100,
- Val4 /* = 101 */
+ Val3 = 13,
+ Val4,
+ Val5a = 13,
+ Val6a
};
enum class Enum2 : short {
Val1,
Val2,
- Val3 = 100,
- Val4
+ Val3 = 23,
+ Val4,
+ Val5b = 23,
+ Val6b
};
%}
@@ -39,24 +41,24 @@ enum class Enum5; // Legal in C++11, because enum class declarati
enum class Enum6 : unsigned int; // Legal C++11.
enum Enum4 : unsigned int {
- Val1, Val2, Val3 = 100, Val4
+ Val1, Val2, Val3 = 43, Val4
};
enum class Enum5 {
- Val1, Val2, Val3 = 100, Val4
+ Val1, Val2, Val3 = 53, Val4
};
enum class Enum6 : unsigned int {
- Val1, Val2, Val3 = 300, Val4
+ Val1, Val2, Val3 = 63, Val4
};
typedef enum class Enum7 : unsigned int {
- Val1, Val2, Val3 = 300, Val4
+ Val1, Val2, Val3 = 73, Val4
} Enum7td;
// enum inherits from non-primitive type
enum class Enum8 : size_t {
- Val1, Val2, Val3 = 300, Val4
+ Val1, Val2, Val3 = 83, Val4
};
template <typename T> struct TType {
@@ -64,7 +66,7 @@ template <typename T> struct TType {
};
enum class Enum10 : TType<int>::type_name {
- Val1, Val2, Val3 = 300, Val4
+ Val1, Val2, Val3 = 103, Val4
};
// forward declaration, no definition of enum
@@ -73,15 +75,144 @@ struct UseEnum11 {
Enum11 myenum11;
};
-/*
-TODO
-enum class MyClass {AAA, BBB, CCC};
-namespace Space {
-enum MyEnum {XXX, YYY, ZZZ};
-}
-struct SSS {
- MyClass m;
+class Class1
+{
+public:
+ enum class Enum12
+ {
+ Val1 = 1121,
+ Val2 = 1122,
+ Val3,
+ Val4,
+ Val5c = 1121,
+ Val6c
+ };
+
+ enum Enum13
+ {
+ Val1 = 1131,
+ Val2 = 1132,
+ Val3,
+ Val4,
+ Val5d = 1131,
+ Val6d
+ };
+
+ enum class Enum14
+ {
+ Val1 = 1141,
+ Val2 = 1142,
+ Val3,
+ Val4,
+ Val5e = 1141,
+ Val6e
+ };
+
+ struct Struct1
+ {
+ enum class Enum12
+ {
+ Val1 = 3121,
+ Val2 = 3122,
+ Val3,
+ Val4,
+ Val5f = 3121,
+ Val6f
+ };
+
+ enum Enum13
+ {
+ Val1 = 3131,
+ Val2 = 3132,
+ Val3,
+ Val4,
+ };
+
+ enum class Enum14
+ {
+ Val1 = 3141,
+ Val2 = 3142,
+ Val3,
+ Val4,
+ Val5g = 3141,
+ Val6g
+ };
+ };
+ Enum1 class1Test1(Enum1 e) { return e; }
+ Enum12 class1Test2(Enum12 e) { return e; }
+ Struct1::Enum12 class1Test3(Struct1::Enum12 e) { return e; }
+};
+
+class Class2
+{
+public:
+ enum class Enum12
+ {
+ Val1 = 2121,
+ Val2 = 2122,
+ Val3,
+ Val4,
+ Val5h = 2121,
+ Val6h
+ };
+
+ enum Enum13
+ {
+ Val1 = 2131,
+ Val2 = 2132,
+ Val3,
+ Val4,
+ Val5i = 2131,
+ Val6i
+ };
+
+ enum class Enum14
+ {
+ Val1 = 2141,
+ Val2 = 2142,
+ Val3,
+ Val4,
+ Val5j = 2141,
+ Val6j
+ };
+
+ struct Struct1
+ {
+ enum class Enum12
+ {
+ Val1 = 4121,
+ Val2 = 4122,
+ Val3,
+ Val4,
+ Val5k = 4121,
+ Val6k
+ };
+
+ enum Enum13
+ {
+ Val1 = 4131,
+ Val2 = 4132,
+ Val3,
+ Val4,
+ Val5l = 4131,
+ Val6l
+ };
+
+ enum class Enum14
+ {
+ Val1 = 4141,
+ Val2 = 4142,
+ Val3,
+ Val4,
+ Val5m = 4141,
+ Val6m
+ };
+ };
};
-*/
+
+Enum1 globalTest1(Enum1 e) { return e; }
+Class1::Enum12 globalTest2(Class1::Enum12 e) { return e; }
+Class1::Struct1::Enum12 globalTest3(Class1::Struct1::Enum12 e) { return e; }
+
%}
diff --git a/Examples/test-suite/cpp11_strongly_typed_enumerations_simple.i b/Examples/test-suite/cpp11_strongly_typed_enumerations_simple.i
new file mode 100644
index 000000000..3848d2940
--- /dev/null
+++ b/Examples/test-suite/cpp11_strongly_typed_enumerations_simple.i
@@ -0,0 +1,5 @@
+%module cpp11_strongly_typed_enumerations_simple
+
+%include <enumsimple.swg>
+
+%include "cpp11_strongly_typed_enumerations.i"
diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in
index 993699bc8..292c751e4 100644
--- a/Examples/test-suite/csharp/Makefile.in
+++ b/Examples/test-suite/csharp/Makefile.in
@@ -8,6 +8,7 @@ CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@"
CSHARPCYGPATH_W = @CSHARPCYGPATH_W@
+
srcdir = @srcdir@
top_srcdir = ../@top_srcdir@
top_builddir = ../@top_builddir@
@@ -27,9 +28,13 @@ CPP_TEST_CASES = \
intermediary_classname \
li_boost_intrusive_ptr
+CPP11_TEST_CASES = \
+ cpp11_strongly_typed_enumerations_simple \
+
include $(srcdir)/../common.mk
# Overridden variables here
+SRCDIR = ../$(srcdir)/
SWIGOPT += -namespace $*Namespace
CSHARPFLAGSSPECIAL =
@@ -40,7 +45,7 @@ csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe
csharp_swig2_compatibility.cpptest: SWIGOPT += -DSWIG2_CSHARP
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+(cd $* && $(swig_and_compile_cpp))
+$(run_testcase)
@@ -50,14 +55,14 @@ csharp_swig2_compatibility.cpptest: SWIGOPT += -DSWIG2_CSHARP
+(cd $* && $(swig_and_compile_c))
+$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+(cd $* && $(swig_and_compile_multi_cpp))
+$(run_testcase)
# Makes a directory for the testcase if it does not exist
setup = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
@@ -71,10 +76,10 @@ setup = \
# Note C# uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows and SHLIB_PATH on HPUX.
# DYLD_FALLBACK_LIBRARY_PATH is cleared for MacOSX.
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
- CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \
+ CSHARPSRCS='`$(CSHARPCYGPATH_W) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$*_runme.exe; \
else \
cd $* && \
diff --git a/Examples/test-suite/csharp/cpp11_strongly_typed_enumerations_runme.cs b/Examples/test-suite/csharp/cpp11_strongly_typed_enumerations_runme.cs
new file mode 100644
index 000000000..f2c25e7a2
--- /dev/null
+++ b/Examples/test-suite/csharp/cpp11_strongly_typed_enumerations_runme.cs
@@ -0,0 +1,169 @@
+using System;
+using cpp11_strongly_typed_enumerationsNamespace;
+
+public class cpp11_strongly_typed_enumerations_runme {
+
+ public static int enumCheck(int actual, int expected) {
+ if (actual != expected)
+ throw new ApplicationException("Enum value mismatch. Expected " + expected + " Actual: " + actual);
+ return expected + 1;
+ }
+
+ public static void Main() {
+ int val = 0;
+ val = enumCheck((int)Enum1.Val1, val);
+ val = enumCheck((int)Enum1.Val2, val);
+ val = enumCheck((int)Enum1.Val3, 13);
+ val = enumCheck((int)Enum1.Val4, val);
+ val = enumCheck((int)Enum1.Val5a, 13);
+ val = enumCheck((int)Enum1.Val6a, val);
+
+ val = 0;
+ val = enumCheck((int)Enum2.Val1, val);
+ val = enumCheck((int)Enum2.Val2, val);
+ val = enumCheck((int)Enum2.Val3, 23);
+ val = enumCheck((int)Enum2.Val4, val);
+ val = enumCheck((int)Enum2.Val5b, 23);
+ val = enumCheck((int)Enum2.Val6b, val);
+
+ val = 0;
+ val = enumCheck((int)Enum4.Val1, val);
+ val = enumCheck((int)Enum4.Val2, val);
+ val = enumCheck((int)Enum4.Val3, 43);
+ val = enumCheck((int)Enum4.Val4, val);
+
+ val = 0;
+ val = enumCheck((int)Enum5.Val1, val);
+ val = enumCheck((int)Enum5.Val2, val);
+ val = enumCheck((int)Enum5.Val3, 53);
+ val = enumCheck((int)Enum5.Val4, val);
+
+ val = 0;
+ val = enumCheck((int)Enum6.Val1, val);
+ val = enumCheck((int)Enum6.Val2, val);
+ val = enumCheck((int)Enum6.Val3, 63);
+ val = enumCheck((int)Enum6.Val4, val);
+
+ val = 0;
+ val = enumCheck((int)Enum7td.Val1, val);
+ val = enumCheck((int)Enum7td.Val2, val);
+ val = enumCheck((int)Enum7td.Val3, 73);
+ val = enumCheck((int)Enum7td.Val4, val);
+
+ val = 0;
+ val = enumCheck((int)Enum8.Val1, val);
+ val = enumCheck((int)Enum8.Val2, val);
+ val = enumCheck((int)Enum8.Val3, 83);
+ val = enumCheck((int)Enum8.Val4, val);
+
+ val = 0;
+ val = enumCheck((int)Enum10.Val1, val);
+ val = enumCheck((int)Enum10.Val2, val);
+ val = enumCheck((int)Enum10.Val3, 103);
+ val = enumCheck((int)Enum10.Val4, val);
+
+ val = 0;
+ val = enumCheck((int)Class1.Enum12.Val1, 1121);
+ val = enumCheck((int)Class1.Enum12.Val2, 1122);
+ val = enumCheck((int)Class1.Enum12.Val3, val);
+ val = enumCheck((int)Class1.Enum12.Val4, val);
+ val = enumCheck((int)Class1.Enum12.Val5c, 1121);
+ val = enumCheck((int)Class1.Enum12.Val6c, val);
+
+ val = 0;
+ val = enumCheck((int)Class1.Enum13.Val1, 1131);
+ val = enumCheck((int)Class1.Enum13.Val2, 1132);
+ val = enumCheck((int)Class1.Enum13.Val3, val);
+ val = enumCheck((int)Class1.Enum13.Val4, val);
+ val = enumCheck((int)Class1.Enum13.Val5d, 1131);
+ val = enumCheck((int)Class1.Enum13.Val6d, val);
+
+ val = 0;
+ val = enumCheck((int)Class1.Enum14.Val1, 1141);
+ val = enumCheck((int)Class1.Enum14.Val2, 1142);
+ val = enumCheck((int)Class1.Enum14.Val3, val);
+ val = enumCheck((int)Class1.Enum14.Val4, val);
+ val = enumCheck((int)Class1.Enum14.Val5e, 1141);
+ val = enumCheck((int)Class1.Enum14.Val6e, val);
+
+ val = 0;
+ val = enumCheck((int)Class1.Struct1.Enum12.Val1, 3121);
+ val = enumCheck((int)Class1.Struct1.Enum12.Val2, 3122);
+ val = enumCheck((int)Class1.Struct1.Enum12.Val3, val);
+ val = enumCheck((int)Class1.Struct1.Enum12.Val4, val);
+ val = enumCheck((int)Class1.Struct1.Enum12.Val5f, 3121);
+ val = enumCheck((int)Class1.Struct1.Enum12.Val6f, val);
+
+ val = 0;
+ val = enumCheck((int)Class1.Struct1.Enum13.Val1, 3131);
+ val = enumCheck((int)Class1.Struct1.Enum13.Val2, 3132);
+ val = enumCheck((int)Class1.Struct1.Enum13.Val3, val);
+ val = enumCheck((int)Class1.Struct1.Enum13.Val4, val);
+
+ val = 0;
+ val = enumCheck((int)Class1.Struct1.Enum14.Val1, 3141);
+ val = enumCheck((int)Class1.Struct1.Enum14.Val2, 3142);
+ val = enumCheck((int)Class1.Struct1.Enum14.Val3, val);
+ val = enumCheck((int)Class1.Struct1.Enum14.Val4, val);
+ val = enumCheck((int)Class1.Struct1.Enum14.Val5g, 3141);
+ val = enumCheck((int)Class1.Struct1.Enum14.Val6g, val);
+
+ val = 0;
+ val = enumCheck((int)Class2.Enum12.Val1, 2121);
+ val = enumCheck((int)Class2.Enum12.Val2, 2122);
+ val = enumCheck((int)Class2.Enum12.Val3, val);
+ val = enumCheck((int)Class2.Enum12.Val4, val);
+ val = enumCheck((int)Class2.Enum12.Val5h, 2121);
+ val = enumCheck((int)Class2.Enum12.Val6h, val);
+
+ val = 0;
+ val = enumCheck((int)Class2.Enum13.Val1, 2131);
+ val = enumCheck((int)Class2.Enum13.Val2, 2132);
+ val = enumCheck((int)Class2.Enum13.Val3, val);
+ val = enumCheck((int)Class2.Enum13.Val4, val);
+ val = enumCheck((int)Class2.Enum13.Val5i, 2131);
+ val = enumCheck((int)Class2.Enum13.Val6i, val);
+
+ val = 0;
+ val = enumCheck((int)Class2.Enum14.Val1, 2141);
+ val = enumCheck((int)Class2.Enum14.Val2, 2142);
+ val = enumCheck((int)Class2.Enum14.Val3, val);
+ val = enumCheck((int)Class2.Enum14.Val4, val);
+ val = enumCheck((int)Class2.Enum14.Val5j, 2141);
+ val = enumCheck((int)Class2.Enum14.Val6j, val);
+
+ val = 0;
+ val = enumCheck((int)Class2.Struct1.Enum12.Val1, 4121);
+ val = enumCheck((int)Class2.Struct1.Enum12.Val2, 4122);
+ val = enumCheck((int)Class2.Struct1.Enum12.Val3, val);
+ val = enumCheck((int)Class2.Struct1.Enum12.Val4, val);
+ val = enumCheck((int)Class2.Struct1.Enum12.Val5k, 4121);
+ val = enumCheck((int)Class2.Struct1.Enum12.Val6k, val);
+
+ val = 0;
+ val = enumCheck((int)Class2.Struct1.Enum13.Val1, 4131);
+ val = enumCheck((int)Class2.Struct1.Enum13.Val2, 4132);
+ val = enumCheck((int)Class2.Struct1.Enum13.Val3, val);
+ val = enumCheck((int)Class2.Struct1.Enum13.Val4, val);
+ val = enumCheck((int)Class2.Struct1.Enum13.Val5l, 4131);
+ val = enumCheck((int)Class2.Struct1.Enum13.Val6l, val);
+
+ val = 0;
+ val = enumCheck((int)Class2.Struct1.Enum14.Val1, 4141);
+ val = enumCheck((int)Class2.Struct1.Enum14.Val2, 4142);
+ val = enumCheck((int)Class2.Struct1.Enum14.Val3, val);
+ val = enumCheck((int)Class2.Struct1.Enum14.Val4, val);
+ val = enumCheck((int)Class2.Struct1.Enum14.Val5m, 4141);
+ val = enumCheck((int)Class2.Struct1.Enum14.Val6m, val);
+
+ Class1 class1 = new Class1();
+ enumCheck((int)class1.class1Test1(Enum1.Val5a), 13);
+ enumCheck((int)class1.class1Test2(Class1.Enum12.Val5c), 1121);
+ enumCheck((int)class1.class1Test3(Class1.Struct1.Enum12.Val5f), 3121);
+
+ enumCheck((int)cpp11_strongly_typed_enumerations.globalTest1(Enum1.Val5a), 13);
+ enumCheck((int)cpp11_strongly_typed_enumerations.globalTest2(Class1.Enum12.Val5c), 1121);
+ enumCheck((int)cpp11_strongly_typed_enumerations.globalTest3(Class1.Struct1.Enum12.Val5f), 3121);
+ }
+}
+
diff --git a/Examples/test-suite/csharp/csharp_exceptions_runme.cs b/Examples/test-suite/csharp/csharp_exceptions_runme.cs
index 43585b106..51805ce87 100644
--- a/Examples/test-suite/csharp/csharp_exceptions_runme.cs
+++ b/Examples/test-suite/csharp/csharp_exceptions_runme.cs
@@ -323,7 +323,9 @@ public class TestThread {
} catch (ArgumentOutOfRangeException e) {
String expectedMessage = "caught:" + i + "\n" + "Parameter name: input";
if (e.Message.Replace(runme.CRLF,"\n") != expectedMessage)
- throw new Exception("Exception message incorrect. Expected:\n[" + expectedMessage + "]\n" + "Received:\n[" + e.Message + "]");
+ throw new Exception("Exception message incorrect. Expected:\n[" +
+ expectedMessage + "]\n" + "Received:\n[" +
+ e.Message + "]");
if (e.ParamName != "input")
throw new Exception("Exception ParamName incorrect. Expected:\n[input]\n" + "Received:\n[" + e.ParamName + "]");
if (e.InnerException != null)
@@ -333,7 +335,7 @@ public class TestThread {
throw new Exception("throwsException.dub = " + throwsClass.dub + " expected: 1234.5678");
}
} catch (Exception e) {
- Console.Error.WriteLine("Test failed (thread " + threadId + "): " + e.Message);
+ Console.Error.WriteLine("Test failed (thread " + threadId + "): " + e.Message + "\n TestThread Inner stack trace: " + e.StackTrace);
Failed = true;
}
}
diff --git a/Examples/test-suite/d/Makefile.in b/Examples/test-suite/d/Makefile.in
index 61c2749dc..3333df110 100644
--- a/Examples/test-suite/d/Makefile.in
+++ b/Examples/test-suite/d/Makefile.in
@@ -3,17 +3,22 @@
#######################################################################
LANGUAGE = d
+
srcdir = @srcdir@
top_srcdir = ../@top_srcdir@
top_builddir = ../@top_builddir@
+ifeq (,$(D_VERSION))
+ D_VERSION = @DDEFAULTVERSION@
+endif
+
ifeq (2,$(D_VERSION))
VERSIONSUFFIX = .2
else
VERSIONSUFFIX = .1
endif
-TESTSUFFIX = _runme$(VERSIONSUFFIX).d
+SCRIPTSUFFIX = _runme$(VERSIONSUFFIX).d
CPP_TEST_CASES = \
d_nativepointers \
@@ -21,10 +26,9 @@ CPP_TEST_CASES = \
include $(srcdir)/../common.mk
-# Override some variables from common.mk:
-
+# Overridden variables here
+SRCDIR = ../$(srcdir)/
TARGETSUFFIX = _wrap
-
SWIGOPT+=-splitproxy -package $*
# Rules for the different types of tests
@@ -45,7 +49,7 @@ SWIGOPT+=-splitproxy -package $*
# Makes a directory for the testcase if it does not exist
setup = \
- if [ -f $(srcdir)/$(TESTPREFIX)$*$(TESTSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
@@ -60,11 +64,11 @@ setup = \
# Compiles D files then runs the testcase. A testcase is only run if
# a file is found which has _runme.d appended after the testcase name.
run_testcase = \
- if [ -f $(srcdir)/$(TESTPREFIX)$*$(TESTSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
cd $*$(VERSIONSUFFIX) && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
DFLAGS='-of$*_runme' \
- DSRCS='../$(srcdir)/$(TESTPREFIX)$*$(TESTSUFFIX) `find $* -name *.d`' d_compile && \
+ DSRCS='../$(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) `find $* -name *.d`' d_compile && \
env LD_LIBRARY_PATH=".:$$LD_LIBRARY_PATH" $(RUNTOOL) ./$*_runme; \
else \
cd $*$(VERSIONSUFFIX) && \
diff --git a/Examples/test-suite/d/li_boost_shared_ptr_runme.2.d b/Examples/test-suite/d/li_boost_shared_ptr_runme.2.d
index 0027aad05..028929543 100644
--- a/Examples/test-suite/d/li_boost_shared_ptr_runme.2.d
+++ b/Examples/test-suite/d/li_boost_shared_ptr_runme.2.d
@@ -2,6 +2,7 @@ module li_boost_shared_ptr_runme;
import core.memory;
import core.thread;
+import core.time;
import std.conv;
import std.exception;
import std.stdio;
@@ -31,15 +32,6 @@ void main() {
if (TRACE)
writeln("---> NEARLY FINISHED <---");
- // Try to get the GC to collect everything not referenced anymore.
- int countdown = 100;
- while (--countdown) {
- GC.collect();
- if (Klass.getTotal_count() == 1)
- break;
- Thread.sleep(100);
- }
-
// A single remaining instance expected: the global variable (GlobalValue).
if (Klass.getTotal_count() != 1)
throw new Exception("Klass.total_count=" ~ to!string(Klass.getTotal_count()));
@@ -55,9 +47,15 @@ void main() {
}
void runTest() {
+ // We want to check whether all the C++ Klass instances have been properly
+ // destructed after the tests have run. However, as it is legal for the GC
+ // to leave an object around even if it is unreachable, use deterministic
+ // memory management here.
+ import std.typecons : scoped;
+
// simple shared_ptr usage - created in C++
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
string val = k.getValue();
verifyValue("me oh my", val);
verifyCount(1, k);
@@ -73,7 +71,7 @@ void runTest() {
// pass by shared_ptr
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = smartpointertest(k);
string val = kret.getValue();
verifyValue("me oh my smartpointertest", val);
@@ -83,7 +81,7 @@ void runTest() {
// pass by shared_ptr pointer
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = smartpointerpointertest(k);
string val = kret.getValue();
verifyValue("me oh my smartpointerpointertest", val);
@@ -93,7 +91,7 @@ void runTest() {
// pass by shared_ptr reference
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = smartpointerreftest(k);
string val = kret.getValue();
verifyValue("me oh my smartpointerreftest", val);
@@ -103,7 +101,7 @@ void runTest() {
// pass by shared_ptr pointer reference
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = smartpointerpointerreftest(k);
string val = kret.getValue();
verifyValue("me oh my smartpointerpointerreftest", val);
@@ -113,7 +111,7 @@ void runTest() {
// const pass by shared_ptr
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = constsmartpointertest(k);
string val = kret.getValue();
verifyValue("me oh my", val);
@@ -123,7 +121,7 @@ void runTest() {
// const pass by shared_ptr pointer
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = constsmartpointerpointertest(k);
string val = kret.getValue();
verifyValue("me oh my", val);
@@ -133,7 +131,7 @@ void runTest() {
// const pass by shared_ptr reference
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = constsmartpointerreftest(k);
string val = kret.getValue();
verifyValue("me oh my", val);
@@ -143,7 +141,7 @@ void runTest() {
// pass by value
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = valuetest(k);
string val = kret.getValue();
verifyValue("me oh my valuetest", val);
@@ -153,7 +151,7 @@ void runTest() {
// pass by pointer
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = pointertest(k);
string val = kret.getValue();
verifyValue("me oh my pointertest", val);
@@ -163,7 +161,7 @@ void runTest() {
// pass by reference
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = reftest(k);
string val = kret.getValue();
verifyValue("me oh my reftest", val);
@@ -173,7 +171,7 @@ void runTest() {
// pass by pointer reference
{
- auto k = new Klass("me oh my");
+ auto k = scoped!Klass("me oh my");
auto kret = pointerreftest(k);
string val = kret.getValue();
verifyValue("me oh my pointerreftest", val);
@@ -215,7 +213,7 @@ void runTest() {
////////////////////////////////// Derived classes ////////////////////////////////////////
// derived pass by shared_ptr
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = derivedsmartptrtest(k);
string val = kret.getValue();
verifyValue("me oh my derivedsmartptrtest-Derived", val);
@@ -224,7 +222,7 @@ void runTest() {
}
// derived pass by shared_ptr pointer
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = derivedsmartptrpointertest(k);
string val = kret.getValue();
verifyValue("me oh my derivedsmartptrpointertest-Derived", val);
@@ -233,7 +231,7 @@ void runTest() {
}
// derived pass by shared_ptr ref
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = derivedsmartptrreftest(k);
string val = kret.getValue();
verifyValue("me oh my derivedsmartptrreftest-Derived", val);
@@ -242,7 +240,7 @@ void runTest() {
}
// derived pass by shared_ptr pointer ref
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = derivedsmartptrpointerreftest(k);
string val = kret.getValue();
verifyValue("me oh my derivedsmartptrpointerreftest-Derived", val);
@@ -251,7 +249,7 @@ void runTest() {
}
// derived pass by pointer
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = derivedpointertest(k);
string val = kret.getValue();
verifyValue("me oh my derivedpointertest-Derived", val);
@@ -260,7 +258,7 @@ void runTest() {
}
// derived pass by ref
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = derivedreftest(k);
string val = kret.getValue();
verifyValue("me oh my derivedreftest-Derived", val);
@@ -271,7 +269,7 @@ void runTest() {
////////////////////////////////// Derived and base class mixed ////////////////////////////////////////
// pass by shared_ptr (mixed)
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = smartpointertest(k);
string val = kret.getValue();
verifyValue("me oh my smartpointertest-Derived", val);
@@ -281,7 +279,7 @@ void runTest() {
// pass by shared_ptr pointer (mixed)
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = smartpointerpointertest(k);
string val = kret.getValue();
verifyValue("me oh my smartpointerpointertest-Derived", val);
@@ -291,7 +289,7 @@ void runTest() {
// pass by shared_ptr reference (mixed)
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = smartpointerreftest(k);
string val = kret.getValue();
verifyValue("me oh my smartpointerreftest-Derived", val);
@@ -301,7 +299,7 @@ void runTest() {
// pass by shared_ptr pointer reference (mixed)
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = smartpointerpointerreftest(k);
string val = kret.getValue();
verifyValue("me oh my smartpointerpointerreftest-Derived", val);
@@ -311,7 +309,7 @@ void runTest() {
// pass by value (mixed)
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = valuetest(k);
string val = kret.getValue();
verifyValue("me oh my valuetest", val); // note slicing
@@ -321,7 +319,7 @@ void runTest() {
// pass by pointer (mixed)
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = pointertest(k);
string val = kret.getValue();
verifyValue("me oh my pointertest-Derived", val);
@@ -331,7 +329,7 @@ void runTest() {
// pass by ref (mixed)
{
- auto k = new KlassDerived("me oh my");
+ auto k = scoped!KlassDerived("me oh my");
auto kret = reftest(k);
string val = kret.getValue();
verifyValue("me oh my reftest-Derived", val);
@@ -341,7 +339,7 @@ void runTest() {
// 3rd derived class
{
- auto k = new Klass3rdDerived("me oh my");
+ auto k = scoped!Klass3rdDerived("me oh my");
string val = k.getValue();
verifyValue("me oh my-3rdDerived", val);
verifyCount(3, k); // 3 classes in inheritance chain == 3 swigCPtr values
@@ -353,128 +351,140 @@ void runTest() {
////////////////////////////////// Member variables ////////////////////////////////////////
// smart pointer by value
{
- auto m = new MemberVariables();
- auto k = new Klass("smart member value");
- m.SmartMemberValue = k;
- string val = k.getValue();
- verifyValue("smart member value", val);
- verifyCount(2, k);
-
- auto kmember = m.SmartMemberValue;
- val = kmember.getValue();
- verifyValue("smart member value", val);
- verifyCount(3, kmember);
- verifyCount(3, k);
-
- delete m;
+ auto k = scoped!Klass("smart member value");
+ Klass kmember;
+
+ {
+ auto m = scoped!MemberVariables();
+ m.SmartMemberValue = k;
+ string val = k.getValue();
+ verifyValue("smart member value", val);
+ verifyCount(2, k);
+
+ kmember = m.SmartMemberValue;
+ val = kmember.getValue();
+ verifyValue("smart member value", val);
+ verifyCount(3, kmember);
+ verifyCount(3, k);
+ }
verifyCount(2, kmember);
verifyCount(2, k);
}
// smart pointer by pointer
{
- auto m = new MemberVariables();
- auto k = new Klass("smart member pointer");
- m.SmartMemberPointer = k;
- string val = k.getValue();
- verifyValue("smart member pointer", val);
- verifyCount(1, k);
-
- auto kmember = m.SmartMemberPointer;
- val = kmember.getValue();
- verifyValue("smart member pointer", val);
- verifyCount(2, kmember);
- verifyCount(2, k);
-
- delete m;
+ auto k = scoped!Klass("smart member pointer");
+ Klass kmember;
+
+ {
+ auto m = scoped!MemberVariables();
+ m.SmartMemberPointer = k;
+ string val = k.getValue();
+ verifyValue("smart member pointer", val);
+ verifyCount(1, k);
+
+ kmember = m.SmartMemberPointer;
+ val = kmember.getValue();
+ verifyValue("smart member pointer", val);
+ verifyCount(2, kmember);
+ verifyCount(2, k);
+ }
verifyCount(2, kmember);
verifyCount(2, k);
}
// smart pointer by reference
{
- auto m = new MemberVariables();
- auto k = new Klass("smart member reference");
- m.SmartMemberReference = k;
- string val = k.getValue();
- verifyValue("smart member reference", val);
- verifyCount(2, k);
-
- auto kmember = m.SmartMemberReference;
- val = kmember.getValue();
- verifyValue("smart member reference", val);
- verifyCount(3, kmember);
- verifyCount(3, k);
-
- // The C++ reference refers to SmartMemberValue...
- auto kmemberVal = m.SmartMemberValue;
- val = kmember.getValue();
- verifyValue("smart member reference", val);
- verifyCount(4, kmemberVal);
- verifyCount(4, kmember);
- verifyCount(4, k);
-
- delete m;
+ auto k = scoped!Klass("smart member reference");
+ Klass kmember;
+
+ {
+ auto m = scoped!MemberVariables();
+ m.SmartMemberReference = k;
+ string val = k.getValue();
+ verifyValue("smart member reference", val);
+ verifyCount(2, k);
+
+ kmember = m.SmartMemberReference;
+ val = kmember.getValue();
+ verifyValue("smart member reference", val);
+ verifyCount(3, kmember);
+ verifyCount(3, k);
+
+ // The C++ reference refers to SmartMemberValue...
+ auto kmemberVal = m.SmartMemberValue;
+ val = kmember.getValue();
+ verifyValue("smart member reference", val);
+ verifyCount(4, kmemberVal);
+ verifyCount(4, kmember);
+ verifyCount(4, k);
+ }
verifyCount(3, kmember);
verifyCount(3, k);
}
// plain by value
{
- auto m = new MemberVariables();
- auto k = new Klass("plain member value");
- m.MemberValue = k;
- string val = k.getValue();
- verifyValue("plain member value", val);
- verifyCount(1, k);
-
- auto kmember = m.MemberValue;
- val = kmember.getValue();
- verifyValue("plain member value", val);
- verifyCount(1, kmember);
- verifyCount(1, k);
-
- delete m;
+ auto k = scoped!Klass("plain member value");
+ Klass kmember;
+
+ {
+ auto m = scoped!MemberVariables();
+ m.MemberValue = k;
+ string val = k.getValue();
+ verifyValue("plain member value", val);
+ verifyCount(1, k);
+
+ kmember = m.MemberValue;
+ val = kmember.getValue();
+ verifyValue("plain member value", val);
+ verifyCount(1, kmember);
+ verifyCount(1, k);
+ }
verifyCount(1, kmember);
verifyCount(1, k);
}
// plain by pointer
{
- auto m = new MemberVariables();
- auto k = new Klass("plain member pointer");
- m.MemberPointer = k;
- string val = k.getValue();
- verifyValue("plain member pointer", val);
- verifyCount(1, k);
-
- auto kmember = m.MemberPointer;
- val = kmember.getValue();
- verifyValue("plain member pointer", val);
- verifyCount(1, kmember);
- verifyCount(1, k);
-
- delete m;
+ auto k = scoped!Klass("plain member pointer");
+ Klass kmember;
+
+ {
+ auto m = scoped!MemberVariables();
+ m.MemberPointer = k;
+ string val = k.getValue();
+ verifyValue("plain member pointer", val);
+ verifyCount(1, k);
+
+ kmember = m.MemberPointer;
+ val = kmember.getValue();
+ verifyValue("plain member pointer", val);
+ verifyCount(1, kmember);
+ verifyCount(1, k);
+ }
verifyCount(1, kmember);
verifyCount(1, k);
}
// plain by reference
{
- auto m = new MemberVariables();
- auto k = new Klass("plain member reference");
- m.MemberReference = k;
- string val = k.getValue();
- verifyValue("plain member reference", val);
- verifyCount(1, k);
-
- auto kmember = m.MemberReference;
- val = kmember.getValue();
- verifyValue("plain member reference", val);
- verifyCount(1, kmember);
- verifyCount(1, k);
-
- delete m;
+ auto k = scoped!Klass("plain member reference");
+ Klass kmember;
+
+ {
+ auto m = scoped!MemberVariables();
+ m.MemberReference = k;
+ string val = k.getValue();
+ verifyValue("plain member reference", val);
+ verifyCount(1, k);
+
+ kmember = m.MemberReference;
+ val = kmember.getValue();
+ verifyValue("plain member reference", val);
+ verifyCount(1, kmember);
+ verifyCount(1, k);
+ }
verifyCount(1, kmember);
verifyCount(1, k);
@@ -482,7 +492,7 @@ void runTest() {
// null member variables
{
- auto m = new MemberVariables();
+ auto m = scoped!MemberVariables();
// shared_ptr by value
auto k = m.SmartMemberValue;
@@ -504,7 +514,7 @@ void runTest() {
auto kglobal = GlobalSmartValue;
enforce(kglobal is null, "expected null");
- auto k = new Klass("smart global value");
+ auto k = scoped!Klass("smart global value");
GlobalSmartValue = k;
verifyCount(2, k);
@@ -520,7 +530,7 @@ void runTest() {
{
Klass kglobal;
- auto k = new Klass("global value");
+ auto k = scoped!Klass("global value");
GlobalValue = k;
verifyCount(1, k);
@@ -538,7 +548,7 @@ void runTest() {
auto kglobal = GlobalPointer;
enforce(kglobal is null, "expected null");
- auto k = new Klass("global pointer");
+ auto k = scoped!Klass("global pointer");
GlobalPointer = k;
verifyCount(1, k);
@@ -553,7 +563,7 @@ void runTest() {
{
Klass kglobal;
- auto k = new Klass("global reference");
+ auto k = scoped!Klass("global reference");
GlobalReference = k;
verifyCount(1, k);
diff --git a/Examples/test-suite/default_args.i b/Examples/test-suite/default_args.i
index 839d28e3e..bcb8766a8 100644
--- a/Examples/test-suite/default_args.i
+++ b/Examples/test-suite/default_args.i
@@ -13,6 +13,27 @@
%inline %{
#include <string>
+ // All kinds of numbers: hex, octal (which pose special problems to Python), negative...
+ void trickyvalue1(int first, int pos = -1) {}
+ void trickyvalue2(int first, unsigned rgb = 0xabcdef) {}
+ void trickyvalue3(int first, int mode = 0644) {}
+
+ void doublevalue1(int first, double num = 0.0e-1) {}
+ void doublevalue2(int first, double num = -0.0E2) {}
+
+ // Long long arguments are not handled at Python level currently but still work.
+ void seek(long long offset = 0LL) {}
+ void seek2(unsigned long long offset = 0ULL) {}
+ void seek3(long offset = 0L) {}
+ void seek4(unsigned long offset = 0UL) {}
+ void seek5(unsigned long offset = 0U) {}
+ void seek6(unsigned long offset = 02U) {}
+ void seek7(unsigned long offset = 00U) {}
+ void seek8(unsigned long offset = 1U) {}
+ void seek9(long offset = 1L) {}
+ void seekA(long long offset = 1LL) {}
+ void seekB(unsigned long long offset = 1ULL) {}
+
// Anonymous arguments
int anonymous(int = 7771);
int anonymous(int x) { return x; }
@@ -29,6 +50,12 @@
bool blah(speed s = FAST, flavor f = SWEET) { return (s == FAST && f == SWEET); };
};
+ // using base class enum in a derived class
+ class DerivedEnumClass : public EnumClass {
+ public:
+ void accelerate(speed s = SLOW) { }
+ };
+
// casts
const char * casts1(const char *m = (const char *) NULL) {
char *ret = NULL;
@@ -199,6 +226,7 @@ namespace Space {
struct Klass {
int val;
Klass(int val = -1) : val(val) {}
+ static Klass inc(int n = 1, const Klass& k = Klass()) { return Klass(k.val + n); }
};
Klass constructorcall(const Klass& k = Klass()) { return k; }
diff --git a/Examples/test-suite/default_constructor.i b/Examples/test-suite/default_constructor.i
index 091adff20..f7fc8cfa6 100644
--- a/Examples/test-suite/default_constructor.i
+++ b/Examples/test-suite/default_constructor.i
@@ -168,5 +168,11 @@ public:
}
};
-
+%inline %{
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+%}
diff --git a/Examples/test-suite/director_abstract.i b/Examples/test-suite/director_abstract.i
index cc9dca55a..7dfcc8984 100644
--- a/Examples/test-suite/director_abstract.i
+++ b/Examples/test-suite/director_abstract.i
@@ -156,7 +156,7 @@ namespace ns
class Example3
{
protected:
- /* the default constructor is always emitter, even when protected,
+ /* the default constructor is always emitted, even when protected,
having another public constructor, and 'dirprot' is not used.
This is just for Java compatibility */
Example3()
diff --git a/Examples/test-suite/director_exception.i b/Examples/test-suite/director_exception.i
index 3fd3e563c..2559ae566 100644
--- a/Examples/test-suite/director_exception.i
+++ b/Examples/test-suite/director_exception.i
@@ -1,5 +1,7 @@
%module(directors="1") director_exception
+%warnfilter(SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) return_const_char_star;
+
%{
#if defined(_MSC_VER)
@@ -106,7 +108,7 @@ Foo *launder(Foo *f) {
%}
%feature("director") Bar;
-
+%feature("director") ReturnAllTypes;
%inline %{
struct Exception1
@@ -132,4 +134,28 @@ Foo *launder(Foo *f) {
virtual std::string pang() throw () { return "Bar::pang()"; }
};
+ // Class to allow regression testing SWIG/PHP not checking if an exception
+ // had been thrown in directorout typemaps.
+ class ReturnAllTypes
+ {
+ public:
+ int call_int() { return return_int(); }
+ double call_double() { return return_double(); }
+ const char * call_const_char_star() { return return_const_char_star(); }
+ std::string call_std_string() { return return_std_string(); }
+ Bar call_Bar() { return return_Bar(); }
+
+ virtual int return_int() { return 0; }
+ virtual double return_double() { return 0.0; }
+ virtual const char * return_const_char_star() { return ""; }
+ virtual std::string return_std_string() { return std::string(); }
+ virtual Bar return_Bar() { return Bar(); }
+ virtual ~ReturnAllTypes() {}
+ };
+
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
%}
diff --git a/Examples/test-suite/director_keywords.i b/Examples/test-suite/director_keywords.i
index 473786c00..53f36a8f6 100644
--- a/Examples/test-suite/director_keywords.i
+++ b/Examples/test-suite/director_keywords.i
@@ -1,13 +1,16 @@
// Checks if collisions of argument names with target language keywords are
-// resolved properly when directors are used (currently only »abstract« for
-// C#, D and Java is checked).
+// resolved properly when directors are used
%module(directors="1") director_keywords
+%warnfilter(SWIGWARN_PARSE_KEYWORD);
+
%feature("director") Foo;
%inline %{
struct Foo {
virtual ~Foo() {}
- virtual void bar(int abstract) {}
+ virtual void check_abstract(int abstract) {} // for Java, C#, D...
+ virtual void check_self(int self) {} // self for Python
+ virtual void check_from(int from) {} // for Python
};
%}
diff --git a/Examples/test-suite/director_nested_class.i b/Examples/test-suite/director_nested_class.i
new file mode 100644
index 000000000..f3d627f3c
--- /dev/null
+++ b/Examples/test-suite/director_nested_class.i
@@ -0,0 +1,25 @@
+%module(directors="1") director_nested_class
+
+
+%feature("director") DirectorOuter::DirectorInner;
+%feature("director") DirectorOuter::DirectorInner::DirectorInnerInner;
+
+%inline %{
+struct DirectorOuter {
+ struct DirectorInner {
+ virtual ~DirectorInner() {}
+ virtual int vmethod(int input) const = 0;
+ struct DirectorInnerInner {
+ DirectorInnerInner(DirectorInner *din = 0) {}
+ virtual ~DirectorInnerInner() {}
+ virtual int innervmethod(int input) const = 0;
+ };
+ };
+ static int callMethod(const DirectorInner &di, int value) {
+ return di.vmethod(value);
+ }
+ static int callInnerInnerMethod(const DirectorInner::DirectorInnerInner &di, int value) {
+ return di.innervmethod(value);
+ }
+};
+%}
diff --git a/Examples/test-suite/director_nestedmodule.i b/Examples/test-suite/director_nestedmodule.i
new file mode 100644
index 000000000..4e304340f
--- /dev/null
+++ b/Examples/test-suite/director_nestedmodule.i
@@ -0,0 +1,29 @@
+%module(directors="1") "director::nestedmodule"
+
+%{
+#include <string>
+
+class Foo {
+ public:
+ virtual ~Foo() {}
+ virtual std::string ping() { return "Foo::ping()"; }
+ virtual std::string pong() { return "Foo::pong();" + ping(); }
+
+ static Foo* get_self(Foo *slf) {return slf;}
+};
+
+%}
+
+%include <std_string.i>
+
+%feature("director") Foo;
+
+
+class Foo {
+ public:
+ virtual ~Foo();
+ virtual std::string ping();
+ virtual std::string pong();
+
+ static Foo* get_self(Foo *slf);
+};
diff --git a/Examples/test-suite/director_property.i b/Examples/test-suite/director_property.i
new file mode 100644
index 000000000..3363c3c4f
--- /dev/null
+++ b/Examples/test-suite/director_property.i
@@ -0,0 +1,151 @@
+%module(directors="1") director_property
+
+%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) MyClass::pmethod;
+
+%{
+ #include <string>
+
+ class Foo {
+ private:
+ std::string a;
+ public:
+ virtual ~Foo() {}
+ virtual std::string ping() { return "Foo::ping()"; }
+ virtual std::string pong() { return "Foo::pong();" + ping(); }
+ virtual std::string getA() { return this->a; }
+ virtual void setA(std::string a) { this->a = a; }
+
+ static Foo* get_self(Foo *slf) {return slf;}
+
+ };
+
+ %}
+
+ %include <std_string.i>
+
+ %feature("director") Foo;
+
+
+ class Foo {
+ public:
+ virtual ~Foo();
+ virtual std::string ping();
+ virtual std::string pong();
+ virtual std::string getA();
+ virtual void setA(std::string a);
+
+ static Foo* get_self(Foo *slf);
+
+ };
+
+ %{
+ #include <complex>
+ %}
+ %feature("director") A;
+
+ // basic renaming
+ %rename(rg) A::gg;
+ %feature("nodirector") hi::A1::gg;
+
+ %inline %{
+
+ struct A{
+ A(std::complex<int> i, double d=0.0) {}
+ A(int i, bool j=false) {}
+ virtual ~A() {}
+
+ virtual int f(int i=0) {return i;}
+ virtual int gg(int i=0) {return i;}
+ };
+
+ namespace hi {
+
+ struct A1 : public A {
+ A1(std::complex<int> i, double d=0.0) : A(i, d) {}
+ A1(int i, bool j=false) : A(i, j) {}
+
+ virtual int ff(int i = 0) {return i;}
+ };
+ }
+
+
+ %}
+
+
+ %feature("director") MyClass;
+
+ %inline %{
+
+ typedef void VoidType;
+
+ struct Bar
+ {
+ int x;
+ Bar(int _x = 0) : x(_x)
+ {
+ }
+ };
+
+
+
+class MyClass {
+public:
+ MyClass(int a = 0)
+ {
+ }
+
+ virtual void method(VoidType *)
+ {
+ }
+
+ virtual ~MyClass()
+ {
+ }
+
+ virtual Bar vmethod(Bar b)
+ {
+ b.x += 13;
+ return b;
+ }
+
+ virtual Bar* pmethod(Bar *b)
+ {
+ b->x += 12;
+ return b;
+ }
+
+ Bar cmethod(const Bar &b)
+ {
+ return vmethod(b);
+ }
+
+ static MyClass *get_self(MyClass *c)
+ {
+ return c;
+ }
+
+ static Bar * call_pmethod(MyClass *myclass, Bar *b) {
+ return myclass->pmethod(b);
+ }
+};
+
+template<class T>
+class MyClassT {
+public:
+ MyClassT(int a = 0)
+ {
+ }
+
+ virtual void method(VoidType *)
+ {
+ }
+
+ virtual ~MyClassT()
+ {
+ }
+
+};
+
+%}
+
+%template(MyClassT_i) MyClassT<int>;
diff --git a/Examples/test-suite/enum_rename.i b/Examples/test-suite/enum_rename.i
index 0cab4d0d8..23e100db9 100644
--- a/Examples/test-suite/enum_rename.i
+++ b/Examples/test-suite/enum_rename.i
@@ -2,7 +2,7 @@
%warnfilter(SWIGWARN_PARSE_REDEFINED) S_May;
-// %rename using regex can do the equivalent of these two renames, which was resulting in uncompileable code
+// %rename using regex can do the equivalent of these two renames, which was resulting in uncompilable code
%rename(May) M_May;
%rename(May) S_May;
diff --git a/Examples/test-suite/enum_thorough.i b/Examples/test-suite/enum_thorough.i
index ec31c2787..3ece5471b 100644
--- a/Examples/test-suite/enum_thorough.i
+++ b/Examples/test-suite/enum_thorough.i
@@ -277,6 +277,18 @@ OldNameStruct::doublenametag renameTest6(OldNameStruct::doublenametag e)
OldNameStruct::singlename renameTest7(OldNameStruct::singlename e) { return e; }
%}
+%rename(Clash1_di1) Clash1::di1;
+%rename(Clash1_di2) Clash1::di2;
+%rename(Clash1_di3) Clash1::di3;
+%inline %{
+namespace Clash1 {
+ enum DuplicateItems1 { di1, di2 = 10, di3 };
+}
+namespace Clash2 {
+ enum DuplicateItems2 { di1, di2 = 10, di3 };
+}
+%}
+
%inline %{
struct TreesClass {
enum trees {oak, fir, pine };
diff --git a/Examples/test-suite/equality.i b/Examples/test-suite/equality.i
new file mode 100644
index 000000000..cdabc4892
--- /dev/null
+++ b/Examples/test-suite/equality.i
@@ -0,0 +1,69 @@
+/* File : equality.i */
+/*
+ Specific test for operator== overload. Partially overlaps with
+ operator_overload.i
+*/
+
+%module equality
+
+%warnfilter(SWIGWARN_LANG_IDENTIFIER) operator==;
+
+%inline %{
+
+/* Point has no equality operator */
+typedef struct Point
+{
+ double x;
+ double y;
+} Point;
+
+static const Point s_zeroPoint = { 0.0, 0.0 };
+/* stack version */
+Point MakePoint(double x, double y)
+ { Point new_point = {x, y}; return new_point; }
+
+const Point* GetZeroPointPtr() { return &s_zeroPoint; }
+Point GetZeroPointCopy() { return s_zeroPoint; }
+
+/* EqualOpDefined has correct equality operator */
+class EqualOpDefined {
+public:
+ EqualOpDefined():
+ x(5) {}
+ EqualOpDefined(int val):
+ x(val) {}
+
+ int x;
+};
+
+/* EqualOpWrong has logically incorrect equality operator */
+class EqualOpWrong {
+public:
+ inline static const EqualOpWrong* GetStaticObject();
+};
+
+static EqualOpWrong s_wrongEqOp;
+
+const EqualOpWrong* EqualOpWrong::GetStaticObject()
+ { return &s_wrongEqOp; }
+
+
+inline bool operator==( const EqualOpDefined& first, const EqualOpDefined& second )
+ { return first.x == second.x; }
+
+inline bool operator==( const EqualOpWrong& first, const EqualOpWrong& second )
+ { return false; }
+
+%}
+
+/*
+ in order to wrapper this correctly
+ we need to extend the class
+ to make the friends & non members part of the class
+*/
+%extend EqualOpDefined {
+ bool operator==(const EqualOpDefined& b){return (*$self) == b;}
+}
+%extend EqualOpWrong {
+ bool operator==(const EqualOpWrong& b){return (*$self) == b;}
+}
diff --git a/Examples/test-suite/errors/.gitignore b/Examples/test-suite/errors/.gitignore
new file mode 100644
index 000000000..22ca11947
--- /dev/null
+++ b/Examples/test-suite/errors/.gitignore
@@ -0,0 +1,4 @@
+*.newerr
+cpp_recursive_typedef.py
+cpp_shared_ptr.py
+xxx.py
diff --git a/Examples/test-suite/errors/Makefile.in b/Examples/test-suite/errors/Makefile.in
index 601dcd303..4c61001e7 100644
--- a/Examples/test-suite/errors/Makefile.in
+++ b/Examples/test-suite/errors/Makefile.in
@@ -13,42 +13,44 @@
# file (.stderr) in addition to the test case itself.
#######################################################################
-LANGUAGE = python
+LANGUAGE = errors
ERROR_EXT = newerr
-# Portable dos2unix / todos for stripping CR
-TODOS = tr -d '\r'
-#TODOS = sed -e 's/\r$$//' # On OSX behaves as if written 's/r$$//'
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
# All .i files with prefix 'cpp_' will be treated as C++ input and remaining .i files as C input
-ALL_ERROR_TEST_CASES := $(patsubst %.i,%, $(wildcard *.i))
+ALL_ERROR_TEST_CASES := $(patsubst %.i,%, $(notdir $(wildcard $(srcdir)/*.i)))
CPP_ERROR_TEST_CASES := $(filter cpp_%, $(ALL_ERROR_TEST_CASES))
C_ERROR_TEST_CASES := $(filter-out $(CPP_ERROR_TEST_CASES), $(ALL_ERROR_TEST_CASES))
ERROR_TEST_CASES := $(CPP_ERROR_TEST_CASES:=.cpptest) \
- $(C_ERROR_TEST_CASES:=.ctest)
+ $(C_ERROR_TEST_CASES:=.ctest)
include $(srcdir)/../common.mk
+# Portable dos2unix / todos for stripping CR
+TODOS = tr -d '\r'
+#TODOS = sed -e 's/\r$$//' # On OSX behaves as if written 's/r$$//'
+
+# strip source directory from output, so that diffs compare
+STRIP_SRCDIR = sed -e 's|\\|/|g' -e 's|^$(SRCDIR)||'
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
echo "$(ACTION)ing errors testcase $*"
- -$(SWIG) -c++ -python -Wall -Fstandard $(SWIGOPT) $*.i 2>&1 | $(TODOS) > $*.$(ERROR_EXT)
- $(COMPILETOOL) diff -c $*.stderr $*.$(ERROR_EXT)
+ -$(SWIG) -c++ -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
+ $(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
%.ctest:
echo "$(ACTION)ing errors testcase $*"
- -$(SWIG) -python -Wall -Fstandard $(SWIGOPT) $*.i 2>&1 | $(TODOS) > $*.$(ERROR_EXT)
- $(COMPILETOOL) diff -c $*.stderr $*.$(ERROR_EXT)
+ -$(SWIG) -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
+ $(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
%.clean:
-
+ @exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile $(LANGUAGE)_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" python_clean
@rm -f *.$(ERROR_EXT) *.py
-
diff --git a/Examples/test-suite/errors/c_extra_rblock.stderr b/Examples/test-suite/errors/c_extra_rblock.stderr
index 82877023a..be14eee4c 100644
--- a/Examples/test-suite/errors/c_extra_rblock.stderr
+++ b/Examples/test-suite/errors/c_extra_rblock.stderr
@@ -1 +1 @@
-c_extra_rblock.i:5: Error: Syntax error in input(1).
+c_extra_rblock.i:5: Error: Syntax error. Extraneous '%}'
diff --git a/Examples/test-suite/errors/c_missing_semi.stderr b/Examples/test-suite/errors/c_missing_semi.stderr
index 791b959ca..18befaa1b 100644
--- a/Examples/test-suite/errors/c_missing_semi.stderr
+++ b/Examples/test-suite/errors/c_missing_semi.stderr
@@ -1 +1 @@
-c_missing_semi.i:3: Error: Syntax error in input(1).
+c_missing_semi.i:3: Error: Syntax error - possibly a missing semicolon.
diff --git a/Examples/test-suite/errors/cpp_extra_brackets.stderr b/Examples/test-suite/errors/cpp_extra_brackets.stderr
index 12bb1f327..f1fabc78d 100644
--- a/Examples/test-suite/errors/cpp_extra_brackets.stderr
+++ b/Examples/test-suite/errors/cpp_extra_brackets.stderr
@@ -1 +1 @@
-cpp_extra_brackets.i:5: Error: Syntax error in input(3).
+cpp_extra_brackets.i:5: Error: Unexpected ')'.
diff --git a/Examples/test-suite/errors/pp_constant.i b/Examples/test-suite/errors/pp_constant.i
index 2be108e83..c29f4c86d 100644
--- a/Examples/test-suite/errors/pp_constant.i
+++ b/Examples/test-suite/errors/pp_constant.i
@@ -29,7 +29,9 @@ comment */
%constant int ddd=;
#define E1 1234
-#/*C comment*/define E2 1234
+// This case doesn't actually work, but appeared to before we gave an error
+// for unknown preprocessor directives.
+// #/*C comment*/define E2 1234
#define E3 1234
%constant int eee=;
diff --git a/Examples/test-suite/errors/pp_constant.stderr b/Examples/test-suite/errors/pp_constant.stderr
index 9c79ec2be..54a87edfe 100644
--- a/Examples/test-suite/errors/pp_constant.stderr
+++ b/Examples/test-suite/errors/pp_constant.stderr
@@ -2,7 +2,7 @@ pp_constant.i:9: Warning 305: Bad constant value (ignored).
pp_constant.i:15: Warning 305: Bad constant value (ignored).
pp_constant.i:23: Warning 305: Bad constant value (ignored).
pp_constant.i:29: Warning 305: Bad constant value (ignored).
-pp_constant.i:35: Warning 305: Bad constant value (ignored).
-pp_constant.i:42: Warning 305: Bad constant value (ignored).
-pp_constant.i:46: Warning 305: Bad constant value (ignored).
-pp_constant.i:49: Warning 305: Bad constant value (ignored).
+pp_constant.i:37: Warning 305: Bad constant value (ignored).
+pp_constant.i:44: Warning 305: Bad constant value (ignored).
+pp_constant.i:48: Warning 305: Bad constant value (ignored).
+pp_constant.i:51: Warning 305: Bad constant value (ignored).
diff --git a/Examples/test-suite/errors/pp_missing_enddef.stderr b/Examples/test-suite/errors/pp_missing_enddef.stderr
index bb4ea3c75..c461699e6 100644
--- a/Examples/test-suite/errors/pp_missing_enddef.stderr
+++ b/Examples/test-suite/errors/pp_missing_enddef.stderr
@@ -1 +1 @@
-pp_missing_enddef.i:EOF: Error: Missing %enddef for macro starting on line 3
+pp_missing_enddef.i:3: Error: Missing %enddef for macro starting here
diff --git a/Examples/test-suite/errors/pp_missing_endif.stderr b/Examples/test-suite/errors/pp_missing_endif.stderr
index 0bbfad7f2..4db4021aa 100644
--- a/Examples/test-suite/errors/pp_missing_endif.stderr
+++ b/Examples/test-suite/errors/pp_missing_endif.stderr
@@ -1 +1 @@
-pp_missing_endif.i:EOF: Error: Missing #endif for conditional starting on line 3
+pp_missing_endif.i:3: Error: Missing #endif for conditional starting here
diff --git a/Examples/test-suite/errors/pp_missing_endoffile.i b/Examples/test-suite/errors/pp_missing_endoffile.i
new file mode 100644
index 000000000..2074495a8
--- /dev/null
+++ b/Examples/test-suite/errors/pp_missing_endoffile.i
@@ -0,0 +1,7 @@
+%module xxx
+/* %beginfile and %endoffile are internal directives inserted when %include is
+ * used. Users should never use them directly, but test coverage for this
+ * error message still seems useful to have.
+ */
+%includefile "dummy.i" %beginfile
+
diff --git a/Examples/test-suite/errors/pp_missing_endoffile.stderr b/Examples/test-suite/errors/pp_missing_endoffile.stderr
new file mode 100644
index 000000000..7269f2e92
--- /dev/null
+++ b/Examples/test-suite/errors/pp_missing_endoffile.stderr
@@ -0,0 +1 @@
+pp_missing_endoffile.i:6: Error: Missing %endoffile for file inclusion block starting here
diff --git a/Examples/test-suite/errors/pp_missing_rblock.stderr b/Examples/test-suite/errors/pp_missing_rblock.stderr
index 8f4a54c0a..f00457d73 100644
--- a/Examples/test-suite/errors/pp_missing_rblock.stderr
+++ b/Examples/test-suite/errors/pp_missing_rblock.stderr
@@ -1 +1 @@
-pp_missing_rblock.i:EOF: Error: Unterminated %{ ... %} block starting on line 3
+pp_missing_rblock.i:3: Error: Unterminated %{ ... %} block
diff --git a/Examples/test-suite/errors/pp_unknowndirective.i b/Examples/test-suite/errors/pp_unknowndirective.i
new file mode 100644
index 000000000..659a997d3
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unknowndirective.i
@@ -0,0 +1,7 @@
+%module xxx
+
+/* This used to give the rather cryptic "Syntax error in input(1)." prior to
+ * SWIG 3.0.4. This testcase checks that the improved message is actually
+ * issued.
+ */
+%remane("typo") tyop;
diff --git a/Examples/test-suite/errors/pp_unknowndirective.stderr b/Examples/test-suite/errors/pp_unknowndirective.stderr
new file mode 100644
index 000000000..d0d5e249f
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unknowndirective.stderr
@@ -0,0 +1 @@
+pp_unknowndirective.i:7: Error: Unknown directive '%remane'.
diff --git a/Examples/test-suite/errors/pp_unknowndirective2.i b/Examples/test-suite/errors/pp_unknowndirective2.i
new file mode 100644
index 000000000..889e6c5b2
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unknowndirective2.i
@@ -0,0 +1,11 @@
+%module xxx
+
+#ifdef FOO
+long long i;
+/* Check we get an error for an unknown directive (this should be #elif).
+ * Unknown directives were silently ignored by SWIG < 3.0.3. */
+#elsif defined(BAR)
+long i;
+#else
+int i;
+#endif
diff --git a/Examples/test-suite/errors/pp_unknowndirective2.stderr b/Examples/test-suite/errors/pp_unknowndirective2.stderr
new file mode 100644
index 000000000..70afa670c
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unknowndirective2.stderr
@@ -0,0 +1 @@
+pp_unknowndirective2.i:7: Error: Unknown SWIG preprocessor directive: elsif (if this is a block of target language code, delimit it with %{ and %})
diff --git a/Examples/test-suite/errors/pp_unterm_char.stderr b/Examples/test-suite/errors/pp_unterm_char.stderr
index 4386e933d..147e3859d 100644
--- a/Examples/test-suite/errors/pp_unterm_char.stderr
+++ b/Examples/test-suite/errors/pp_unterm_char.stderr
@@ -1 +1 @@
-pp_unterm_char.i:EOF: Error: Unterminated character constant starting at line 4
+pp_unterm_char.i:4: Error: Unterminated character constant
diff --git a/Examples/test-suite/errors/pp_unterm_comment.stderr b/Examples/test-suite/errors/pp_unterm_comment.stderr
index 4ff34230c..ab1edac14 100644
--- a/Examples/test-suite/errors/pp_unterm_comment.stderr
+++ b/Examples/test-suite/errors/pp_unterm_comment.stderr
@@ -1 +1 @@
-pp_unterm_comment.i:EOF: Error: Unterminated comment starting on line 3
+pp_unterm_comment.i:3: Error: Unterminated comment
diff --git a/Examples/test-suite/errors/pp_unterm_string.stderr b/Examples/test-suite/errors/pp_unterm_string.stderr
index 16b4034f3..14e110ebb 100644
--- a/Examples/test-suite/errors/pp_unterm_string.stderr
+++ b/Examples/test-suite/errors/pp_unterm_string.stderr
@@ -1 +1 @@
-pp_unterm_string.i:EOF: Error: Unterminated string constant starting at line 4
+pp_unterm_string.i:4: Error: Unterminated string constant
diff --git a/Examples/test-suite/errors/pp_unterminated_block.i b/Examples/test-suite/errors/pp_unterminated_block.i
new file mode 100644
index 000000000..99f5f0bc2
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unterminated_block.i
@@ -0,0 +1,5 @@
+%module xxx
+
+%{
+int foo(int x);
+
diff --git a/Examples/test-suite/errors/pp_unterminated_block.stderr b/Examples/test-suite/errors/pp_unterminated_block.stderr
new file mode 100644
index 000000000..03c16a45f
--- /dev/null
+++ b/Examples/test-suite/errors/pp_unterminated_block.stderr
@@ -0,0 +1 @@
+pp_unterminated_block.i:3: Error: Unterminated %{ ... %} block
diff --git a/Examples/test-suite/exception_order.i b/Examples/test-suite/exception_order.i
index 4dd13858a..bca745c7e 100644
--- a/Examples/test-suite/exception_order.i
+++ b/Examples/test-suite/exception_order.i
@@ -125,6 +125,13 @@
}
};
int A::sfoovar = 1;
+
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+
%}
%template(ET_i) ET<int>;
diff --git a/Examples/test-suite/exception_partial_info.i b/Examples/test-suite/exception_partial_info.i
index 37b87ef50..47b046735 100644
--- a/Examples/test-suite/exception_partial_info.i
+++ b/Examples/test-suite/exception_partial_info.i
@@ -1,6 +1,6 @@
%module exception_partial_info
-// This produced compileable code for Tcl, Python in 1.3.27, fails in 1.3.29
+// This produced compilable code for Tcl, Python in 1.3.27, fails in 1.3.29
%{
#if defined(_MSC_VER)
diff --git a/Examples/test-suite/extend_default.i b/Examples/test-suite/extend_default.i
index 097b5332e..d4a015f55 100644
--- a/Examples/test-suite/extend_default.i
+++ b/Examples/test-suite/extend_default.i
@@ -93,7 +93,7 @@ struct OverAfter {
// %extend overrides the class definition
%extend Override {
int over(int a) { return a*a; } // SWIG should give a warning then choose this one over the real one
- int overload(int a) { return a*a; } // Similarly, but this one generated uncompileable code in SWIG-1.3.22
+ int overload(int a) { return a*a; } // Similarly, but this one generated uncompilable code in SWIG-1.3.22
}
%inline %{
struct Override {
diff --git a/Examples/test-suite/extend_special_variables.i b/Examples/test-suite/extend_special_variables.i
index dd68e7531..1f218a8b9 100644
--- a/Examples/test-suite/extend_special_variables.i
+++ b/Examples/test-suite/extend_special_variables.i
@@ -19,3 +19,19 @@
struct ForExtension {
};
%}
+
+%inline %{
+namespace Space {
+ template <class T> class ExtendTemplate {};
+}
+%}
+
+%extend Space::ExtendTemplate
+{
+ void extending() {
+ $parentclassname tmp;
+ (void)tmp;
+ }
+}
+
+%template(ExtendTemplateInt) Space::ExtendTemplate<int>;
diff --git a/Examples/test-suite/go/Makefile.in b/Examples/test-suite/go/Makefile.in
index 535d05a6e..4480ecf1f 100644
--- a/Examples/test-suite/go/Makefile.in
+++ b/Examples/test-suite/go/Makefile.in
@@ -24,12 +24,16 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
+CPP_TEST_CASES = \
+ go_inout \
+ go_director_inout
+
include $(srcdir)/../common.mk
.SUFFIXES: .cpptest .ctest .multicpptest
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase_cpp)
@@ -39,7 +43,7 @@ include $(srcdir)/../common.mk
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_multi_testcase)
@@ -47,7 +51,7 @@ include $(srcdir)/../common.mk
multi_import.multicpptest:
$(setup)
for f in multi_import_b multi_import_a; do \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
@@ -57,8 +61,8 @@ multi_import.multicpptest:
# Runs the testcase.
run_testcase = \
- if test -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
+ if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.@OBJEXT@ $*_wrap.@OBJEXT@; \
elif $(GO12) || $(GO13); then \
@@ -70,8 +74,8 @@ run_testcase = \
fi
run_testcase_cpp = \
- if test -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
+ if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
if $(GOGCC) ; then \
$(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.@OBJEXT@ $*_wrap.@OBJEXT@ -lstdc++; \
elif $(GO12) || $(GO13); then \
@@ -83,8 +87,8 @@ run_testcase_cpp = \
fi
run_multi_testcase = \
- if test -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
+ if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
if $(GOGCC) ; then \
files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
$(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ `for f in $$files; do echo $$f.@OBJEXT@ $${f}_wrap.@OBJEXT@; done` -lstdc++; \
@@ -100,11 +104,12 @@ run_multi_testcase = \
@rm -f $*.go $*_gc.c $*_wrap.* $*_runme
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile go_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" go_clean
rm -f mod_a.go mod_b.go imports_a.go imports_b.go
rm -f clientdata_prop_a.go clientdata_prop_b.go
rm -f multi_import_a.go multi_import_b.go
rm -f packageoption_a.go packageoption_b.go packageoption_c.go
+ rm -f import_stl_a.go import_stl_b.go
cvsignore:
@echo '*_gc.c *_wrap.* *.so *.dll *.exp *.lib'
diff --git a/Examples/test-suite/go/argout_runme.go b/Examples/test-suite/go/argout_runme.go
new file mode 100644
index 000000000..5f7017e73
--- /dev/null
+++ b/Examples/test-suite/go/argout_runme.go
@@ -0,0 +1,41 @@
+package main
+
+import wrap "./argout"
+
+func main() {
+ ip := wrap.New_intp()
+ wrap.Intp_assign(ip, 42)
+ if r := wrap.Incp(ip); r != 42 {
+ panic(r)
+ }
+ if r := wrap.Intp_value(ip); r != 43 {
+ panic(r)
+ }
+
+ p := wrap.New_intp()
+ wrap.Intp_assign(p, 2)
+ if r := wrap.Incp(p); r != 2 {
+ panic(r)
+ }
+ if r := wrap.Intp_value(p); r != 3 {
+ panic(r)
+ }
+
+ r := wrap.New_intp()
+ wrap.Intp_assign(r, 7)
+ if r := wrap.Incr(r); r != 7 {
+ panic(r)
+ }
+ if r := wrap.Intp_value(r); r != 8 {
+ panic(r)
+ }
+
+ tr := wrap.New_intp()
+ wrap.Intp_assign(tr, 4)
+ if r := wrap.Inctr(tr); r != 4 {
+ panic(r)
+ }
+ if r := wrap.Intp_value(tr); r != 5 {
+ panic(r)
+ }
+}
diff --git a/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
new file mode 100644
index 000000000..f4b84b1ee
--- /dev/null
+++ b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go
@@ -0,0 +1,171 @@
+package main
+
+import "fmt"
+import . "./cpp11_strongly_typed_enumerations"
+
+func enumCheck(actual int, expected int) int {
+ if actual != expected {
+ panic(fmt.Sprintf("Enum value mismatch. Expected: %d Actual: %d", expected, actual))
+ }
+ return expected + 1
+}
+
+func main() {
+ var val = 0
+ val = enumCheck(int(Enum1_Val1), val)
+ val = enumCheck(int(Enum1_Val2), val)
+ val = enumCheck(int(Enum1_Val3), 13)
+ val = enumCheck(int(Enum1_Val4), val)
+ val = enumCheck(int(Enum1_Val5a), 13)
+ val = enumCheck(int(Enum1_Val6a), val)
+
+ val = 0
+ val = enumCheck(int(Enum2_Val1), val)
+ val = enumCheck(int(Enum2_Val2), val)
+ val = enumCheck(int(Enum2_Val3), 23)
+ val = enumCheck(int(Enum2_Val4), val)
+ val = enumCheck(int(Enum2_Val5b), 23)
+ val = enumCheck(int(Enum2_Val6b), val)
+
+ val = 0
+ val = enumCheck(int(Val1), val)
+ val = enumCheck(int(Val2), val)
+ val = enumCheck(int(Val3), 43)
+ val = enumCheck(int(Val4), val)
+
+ val = 0
+ val = enumCheck(int(Enum5_Val1), val)
+ val = enumCheck(int(Enum5_Val2), val)
+ val = enumCheck(int(Enum5_Val3), 53)
+ val = enumCheck(int(Enum5_Val4), val)
+
+ val = 0
+ val = enumCheck(int(Enum6_Val1), val)
+ val = enumCheck(int(Enum6_Val2), val)
+ val = enumCheck(int(Enum6_Val3), 63)
+ val = enumCheck(int(Enum6_Val4), val)
+
+ val = 0
+ val = enumCheck(int(Enum7td_Val1), val)
+ val = enumCheck(int(Enum7td_Val2), val)
+ val = enumCheck(int(Enum7td_Val3), 73)
+ val = enumCheck(int(Enum7td_Val4), val)
+
+ val = 0
+ val = enumCheck(int(Enum8_Val1), val)
+ val = enumCheck(int(Enum8_Val2), val)
+ val = enumCheck(int(Enum8_Val3), 83)
+ val = enumCheck(int(Enum8_Val4), val)
+
+ val = 0
+ val = enumCheck(int(Enum10_Val1), val)
+ val = enumCheck(int(Enum10_Val2), val)
+ val = enumCheck(int(Enum10_Val3), 103)
+ val = enumCheck(int(Enum10_Val4), val)
+
+ val = 0
+ val = enumCheck(int(Class1Enum12_Val1), 1121)
+ val = enumCheck(int(Class1Enum12_Val2), 1122)
+ val = enumCheck(int(Class1Enum12_Val3), val)
+ val = enumCheck(int(Class1Enum12_Val4), val)
+ val = enumCheck(int(Class1Enum12_Val5c), 1121)
+ val = enumCheck(int(Class1Enum12_Val6c), val)
+
+ val = 0
+ val = enumCheck(int(Class1Val1), 1131)
+ val = enumCheck(int(Class1Val2), 1132)
+ val = enumCheck(int(Class1Val3), val)
+ val = enumCheck(int(Class1Val4), val)
+ val = enumCheck(int(Class1Val5d), 1131)
+ val = enumCheck(int(Class1Val6d), val)
+
+ val = 0
+ val = enumCheck(int(Class1Enum14_Val1), 1141)
+ val = enumCheck(int(Class1Enum14_Val2), 1142)
+ val = enumCheck(int(Class1Enum14_Val3), val)
+ val = enumCheck(int(Class1Enum14_Val4), val)
+ val = enumCheck(int(Class1Enum14_Val5e), 1141)
+ val = enumCheck(int(Class1Enum14_Val6e), val)
+
+ // Requires nested class support to work
+ //val = 0
+ //val = enumCheck(int(Class1Struct1Enum12_Val1), 3121)
+ //val = enumCheck(int(Class1Struct1Enum12_Val2), 3122)
+ //val = enumCheck(int(Class1Struct1Enum12_Val3), val)
+ //val = enumCheck(int(Class1Struct1Enum12_Val4), val)
+ //val = enumCheck(int(Class1Struct1Enum12_Val5f), 3121)
+ //val = enumCheck(int(Class1Struct1Enum12_Val6f), val)
+ //
+ //val = 0
+ //val = enumCheck(int(Class1Struct1Val1), 3131)
+ //val = enumCheck(int(Class1Struct1Val2), 3132)
+ //val = enumCheck(int(Class1Struct1Val3), val)
+ //val = enumCheck(int(Class1Struct1Val4), val)
+ //
+ //val = 0
+ //val = enumCheck(int(Class1Struct1Enum14_Val1), 3141)
+ //val = enumCheck(int(Class1Struct1Enum14_Val2), 3142)
+ //val = enumCheck(int(Class1Struct1Enum14_Val3), val)
+ //val = enumCheck(int(Class1Struct1Enum14_Val4), val)
+ //val = enumCheck(int(Class1Struct1Enum14_Val5g), 3141)
+ //val = enumCheck(int(Class1Struct1Enum14_Val6g), val)
+
+ val = 0
+ val = enumCheck(int(Class2Enum12_Val1), 2121)
+ val = enumCheck(int(Class2Enum12_Val2), 2122)
+ val = enumCheck(int(Class2Enum12_Val3), val)
+ val = enumCheck(int(Class2Enum12_Val4), val)
+ val = enumCheck(int(Class2Enum12_Val5h), 2121)
+ val = enumCheck(int(Class2Enum12_Val6h), val)
+
+ val = 0
+ val = enumCheck(int(Class2Val1), 2131)
+ val = enumCheck(int(Class2Val2), 2132)
+ val = enumCheck(int(Class2Val3), val)
+ val = enumCheck(int(Class2Val4), val)
+ val = enumCheck(int(Class2Val5i), 2131)
+ val = enumCheck(int(Class2Val6i), val)
+
+ val = 0
+ val = enumCheck(int(Class2Enum14_Val1), 2141)
+ val = enumCheck(int(Class2Enum14_Val2), 2142)
+ val = enumCheck(int(Class2Enum14_Val3), val)
+ val = enumCheck(int(Class2Enum14_Val4), val)
+ val = enumCheck(int(Class2Enum14_Val5j), 2141)
+ val = enumCheck(int(Class2Enum14_Val6j), val)
+
+ // Requires nested class support to work
+ //val = 0
+ //val = enumCheck(int(Class2Struct1Enum12_Val1), 4121)
+ //val = enumCheck(int(Class2Struct1Enum12_Val2), 4122)
+ //val = enumCheck(int(Class2Struct1Enum12_Val3), val)
+ //val = enumCheck(int(Class2Struct1Enum12_Val4), val)
+ //val = enumCheck(int(Class2Struct1Enum12_Val5k), 4121)
+ //val = enumCheck(int(Class2Struct1Enum12_Val6k), val)
+ //
+ //val = 0
+ //val = enumCheck(int(Class2Struct1Val1), 4131)
+ //val = enumCheck(int(Class2Struct1Val2), 4132)
+ //val = enumCheck(int(Class2Struct1Val3), val)
+ //val = enumCheck(int(Class2Struct1Val4), val)
+ //val = enumCheck(int(Class2Struct1Val5l), 4131)
+ //val = enumCheck(int(Class2Struct1Val6l), val)
+ //
+ //val = 0
+ //val = enumCheck(int(Class2Struct1Enum14_Val1), 4141)
+ //val = enumCheck(int(Class2Struct1Enum14_Val2), 4142)
+ //val = enumCheck(int(Class2Struct1Enum14_Val3), val)
+ //val = enumCheck(int(Class2Struct1Enum14_Val4), val)
+ //val = enumCheck(int(Class2Struct1Enum14_Val5m), 4141)
+ //val = enumCheck(int(Class2Struct1Enum14_Val6m), val)
+
+ class1 := NewClass1()
+ enumCheck(int(class1.Class1Test1(Enum1_Val5a)), 13)
+ enumCheck(int(class1.Class1Test2(Class1Enum12_Val5c)), 1121)
+ //enumCheck(int(class1.Class1Test3(Class1Struct1Enum12_Val5f)), 3121)
+
+ enumCheck(int(GlobalTest1(Enum1_Val5a)), 13)
+ enumCheck(int(GlobalTest2(Class1Enum12_Val5c)), 1121)
+ //enumCheck(int(GlobalTest3(Class1Struct1Enum12_Val5f)), 3121)
+
+}
diff --git a/Examples/test-suite/go/go_director_inout_runme.go b/Examples/test-suite/go/go_director_inout_runme.go
new file mode 100644
index 000000000..9b9df318e
--- /dev/null
+++ b/Examples/test-suite/go/go_director_inout_runme.go
@@ -0,0 +1,32 @@
+package main
+
+import (
+ wrap "./go_director_inout"
+)
+
+type GoMyClass struct {}
+
+func (p *GoMyClass) Adjust(m map[string]interface{}) wrap.GoRetStruct {
+ s := ""
+ for k, v := range m {
+ s += k + "," + v.(string) + ";"
+ }
+ return wrap.GoRetStruct{s}
+}
+
+func main() {
+ a := wrap.NewDirectorMyClass(&GoMyClass{})
+ m := map[string]interface{}{
+ "first": "second",
+ }
+ s := a.Adjust(m)
+ if s.Str != "first,second;" {
+ panic(s)
+ }
+
+ a = wrap.NewDirectorMyClass(nil)
+ s = a.Adjust(m)
+ if s.Str != `{"first":"second"}` {
+ panic(s.Str)
+ }
+}
diff --git a/Examples/test-suite/go/go_inout_runme.go b/Examples/test-suite/go/go_inout_runme.go
new file mode 100644
index 000000000..13c429b87
--- /dev/null
+++ b/Examples/test-suite/go/go_inout_runme.go
@@ -0,0 +1,43 @@
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "reflect"
+
+ "./go_inout"
+)
+
+type S struct {
+ A int
+ B string
+ C float64
+}
+
+func (p *S) MarshalJSON() ([]byte, error) {
+ return json.Marshal(*p)
+}
+
+func main() {
+ v := &S{12, "hi", 34.5}
+ m := go_inout.Same(v)
+ want := map[string]interface{}{
+ // The type of A changes from int to float64 because
+ // JSON has no ints.
+ "A": float64(12),
+ "B": "hi",
+ "C": 34.5,
+ }
+ if !reflect.DeepEqual(m, want) {
+ fmt.Println("got", m, "want", want)
+ panic(m)
+ }
+
+ a := []string{"a", "bc", "def"}
+ go_inout.DoubleArray(&a)
+ dwant := []string{"a", "bc", "def", "aa", "bcbc", "defdef"}
+ if !reflect.DeepEqual(a, dwant) {
+ fmt.Println("got", a, "want", dwant)
+ panic(a)
+ }
+}
diff --git a/Examples/test-suite/go/overload_polymorphic_runme.go b/Examples/test-suite/go/overload_polymorphic_runme.go
new file mode 100644
index 000000000..1720e1a4d
--- /dev/null
+++ b/Examples/test-suite/go/overload_polymorphic_runme.go
@@ -0,0 +1,11 @@
+package main
+
+import "./overload_polymorphic"
+
+func main(){
+ t := overload_polymorphic.NewDerived()
+
+ if overload_polymorphic.Test(t) != 0 {
+ panic("failed")
+ }
+}
diff --git a/Examples/test-suite/go_director_inout.i b/Examples/test-suite/go_director_inout.i
new file mode 100644
index 000000000..af59e313c
--- /dev/null
+++ b/Examples/test-suite/go_director_inout.i
@@ -0,0 +1,121 @@
+// Test the goin and goout typemaps for directors.
+
+%module(directors="1") go_director_inout
+
+%{
+#include <string>
+%}
+
+%inline
+%{
+
+struct MyStruct {
+ std::string str;
+};
+
+struct RetStruct {
+ std::string str;
+};
+
+%}
+
+%go_import("encoding/json")
+
+%insert(go_header)
+%{
+
+type GoRetStruct struct {
+ Str string
+}
+
+%}
+
+%typemap(gotype) RetStruct "GoRetStruct"
+
+%typemap(imtype) RetStruct "string"
+
+%typemap(goin) RetStruct
+%{
+ $result = $input.Str
+%}
+
+%typemap(in) RetStruct
+%{
+ $result.str.assign($input.p, $input.n);
+%}
+
+%typemap(out) RetStruct
+%{
+ $result = _swig_makegostring($1.str.data(), $1.str.length());
+%}
+
+%typemap(goout) RetStruct
+%{
+ $result = GoRetStruct{Str: $input}
+%}
+
+%typemap(godirectorout) RetStruct
+%{
+ $result = $input.Str
+%}
+
+%typemap(directorout) RetStruct
+%{
+ $result.str.assign($input.p, $input.n);
+%}
+
+%typemap(godirectorin) RetStruct
+%{
+%}
+
+%typemap(gotype) MyStruct "map[string]interface{}"
+
+%typemap(imtype) MyStruct "string"
+
+%typemap(goin) MyStruct
+%{
+ if b, err := json.Marshal($input); err != nil {
+ panic(err)
+ } else {
+ $result = string(b)
+ }
+%}
+
+%typemap(directorin) MyStruct
+%{
+ $input = _swig_makegostring($1.str.data(), $1.str.length());
+%}
+
+%typemap(out) MyStruct
+%{
+ $result = _swig_makegostring($1.str.data(), $1.str.length());
+%}
+
+%typemap(godirectorin) MyStruct
+%{
+ if err := json.Unmarshal([]byte($input), &$result); err != nil {
+ panic(err)
+ }
+%}
+
+%typemap(in) MyStruct
+%{
+ $1.str.assign($input.p, $input.n);
+%}
+
+%feature("director") MyClass;
+
+%inline
+%{
+
+class MyClass {
+ public:
+ virtual ~MyClass() {}
+ virtual RetStruct Adjust(MyStruct s) {
+ RetStruct r;
+ r.str = s.str;
+ return r;
+ }
+};
+
+%}
diff --git a/Examples/test-suite/go_inout.i b/Examples/test-suite/go_inout.i
new file mode 100644
index 000000000..510ed68e0
--- /dev/null
+++ b/Examples/test-suite/go_inout.i
@@ -0,0 +1,199 @@
+// Test the goin, goout, and goargout typemaps.
+
+%module go_inout
+
+%{
+#include <string>
+#include <vector>
+#include <stdint.h>
+%}
+
+%inline
+%{
+
+struct MyStruct {
+ std::string str;
+};
+
+struct RetStruct {
+ std::string str;
+};
+
+%}
+
+// Write a typemap that calls C++ by converting in and out of JSON.
+
+%go_import("encoding/json", "bytes", "encoding/binary")
+
+%insert(go_header)
+%{
+
+type In json.Marshaler
+
+%}
+
+%typemap(gotype) MyStruct "In"
+
+%typemap(imtype) MyStruct "string"
+
+%typemap(goin) MyStruct
+%{
+ {
+ b, err := $input.MarshalJSON()
+ if err != nil {
+ panic(err)
+ }
+ $result = string(b)
+ }
+%}
+
+%typemap(in) MyStruct
+%{
+ $1.str.assign($input.p, $input.n);
+%}
+
+%typemap(gotype) RetStruct "map[string]interface{}"
+
+%typemap(imtype) RetStruct "string"
+
+%typemap(out) RetStruct
+%{
+ $result = _swig_makegostring($1.str.data(), $1.str.length());
+%}
+
+%typemap(goout) RetStruct
+%{
+ if err := json.Unmarshal([]byte($1), &$result); err != nil {
+ panic(err)
+ }
+%}
+
+%inline
+%{
+
+RetStruct Same(MyStruct s)
+{
+ RetStruct r;
+ r.str = s.str;
+ return r;
+}
+
+%}
+
+%inline
+%{
+
+struct MyArray {
+ std::vector<std::string> strings;
+};
+
+static uint64_t getuint64(const char* s) {
+ uint64_t ret = 0;
+ for (int i = 0; i < 8; i++, s++) {
+ ret |= static_cast<uint64_t>(*s) << i * 8;
+ }
+ return ret;
+}
+
+static void putuint64(std::string *s, size_t off, uint64_t v) {
+ for (int i = 0; i < 8; i++) {
+ (*s)[off + i] = (v >> (i * 8)) & 0xff;
+ }
+}
+
+%}
+
+%typemap(gotype) MyArray* "*[]string"
+
+%typemap(imtype) MyArray* "*string"
+
+// Encode the slice as a single string, with length prefixes.
+%typemap(goin) MyArray*
+%{
+ {
+ var buf bytes.Buffer
+ bin := binary.LittleEndian
+ var b [8]byte
+ bin.PutUint64(b[:], uint64(len(*$input)))
+ buf.Write(b[:])
+ for _, s := range *$input {
+ bin.PutUint64(b[:], uint64(len(s)))
+ buf.Write(b[:])
+ buf.WriteString(s)
+ }
+ str := buf.String()
+ $result = &str
+ }
+%}
+
+// Unpack the string holding the packed slice.
+%typemap(in) MyArray* (MyArray t)
+%{
+ {
+ _gostring_ *s = $input;
+ const char *p = static_cast<const char *>(s->p);
+ uint64_t len = getuint64(p);
+ p += 8;
+ t.strings.resize(len);
+ for (uint64_t i = 0; i < len; i++) {
+ uint64_t slen = getuint64(p);
+ p += 8;
+ t.strings[i].assign(p, slen);
+ p += slen;
+ }
+ $1 = &t;
+ }
+%}
+
+// Pack the vector into a string.
+%typemap(argout) MyArray*
+%{
+ {
+ size_t tot = 8;
+ std::vector<std::string>::const_iterator p;
+ for (p = $1->strings.begin(); p != $1->strings.end(); ++p) {
+ tot += 8 + p->size();
+ }
+ std::string str;
+ str.resize(tot);
+ putuint64(&str, 0, $1->strings.size());
+ size_t off = 8;
+ for (p = $1->strings.begin(); p != $1->strings.end(); ++p) {
+ putuint64(&str, off, p->size());
+ off += 8;
+ str.replace(off, p->size(), *p);
+ off += p->size();
+ }
+ *$input = _swig_makegostring(str.data(), str.size());
+ }
+%}
+
+// Unpack the string into a []string.
+%typemap(goargout) MyArray*
+%{
+ {
+ str := *$input
+ bin := binary.LittleEndian
+ size := bin.Uint64([]byte(str[:8]))
+ str = str[8:]
+ r := make([]string, size)
+ for i := range r {
+ len := bin.Uint64([]byte(str[:8]))
+ str = str[8:]
+ r[i] = str[:len]
+ str = str[len:]
+ }
+ *$1 = r
+ }
+
+%}
+
+%inline
+%{
+void DoubleArray(MyArray* v) {
+ size_t size = v->strings.size();
+ for (size_t i = 0; i < size; i++) {
+ v->strings.push_back(v->strings[i] + v->strings[i]);
+ }
+}
+%}
diff --git a/Examples/test-suite/guile/Makefile.in b/Examples/test-suite/guile/Makefile.in
index 0c7b3137c..9050d76f5 100644
--- a/Examples/test-suite/guile/Makefile.in
+++ b/Examples/test-suite/guile/Makefile.in
@@ -7,16 +7,18 @@ EXTRA_TEST_CASES += guile_ext_test.externaltest
LANGUAGE = guile
VARIANT =
SCRIPTSUFFIX = _runme.scm
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
+
GUILE = @GUILE@
GUILE_RUNTIME=
C_TEST_CASES = long_long \
- list_vector \
- multivalue \
- pointer_in_out
+ list_vector \
+ multivalue \
+ pointer_in_out
include $(srcdir)/../common.mk
@@ -28,7 +30,7 @@ INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guile
%.multicpptest: SWIGOPT += $(GUILE_RUNTIME)
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -38,7 +40,7 @@ INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guile
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -51,8 +53,8 @@ INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guile
# 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 $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env GUILE_AUTO_COMPILE=0 LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env GUILE_AUTO_COMPILE=0 LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
@@ -60,4 +62,4 @@ run_testcase = \
@rm -f $*-guile
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile guile_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" guile_clean
diff --git a/Examples/test-suite/import_nomodule.i b/Examples/test-suite/import_nomodule.i
index 4fd5cbf65..60ef7e0f6 100644
--- a/Examples/test-suite/import_nomodule.i
+++ b/Examples/test-suite/import_nomodule.i
@@ -8,7 +8,7 @@
%import "import_nomodule.h"
-#if !defined(SWIGJAVA) && !defined(SWIGRUBY) && !defined(SWIGCSHARP) && !defined(SWIGD)
+#if !defined(SWIGJAVA) && !defined(SWIGRUBY) && !defined(SWIGCSHARP) && !defined(SWIGD) && !defined(SWIGPYTHON_BUILTIN)
/**
* The proxy class does not have Bar derived from Foo, yet an instance of Bar
@@ -40,3 +40,10 @@ class Bar : public Foo { };
#endif
+%inline %{
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+%}
diff --git a/Examples/test-suite/infinity.i b/Examples/test-suite/infinity.i
index 726150f02..e95bdf9cf 100644
--- a/Examples/test-suite/infinity.i
+++ b/Examples/test-suite/infinity.i
@@ -10,15 +10,16 @@
#include <math.h>
/* C99 math.h defines INFINITY. If not available, this is the fallback. */
-#ifndef INFINITY
- #ifdef _MSC_VER
+#if !defined(INFINITY)
+ #if defined(_MSC_VER)
union MSVC_EVIL_FLOAT_HACK
{
unsigned __int8 Bytes[4];
float Value;
};
- static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
+ const union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
#define INFINITY (INFINITY_HACK.Value)
+ #define INFINITY_NO_CONST
#endif
#ifdef __GNUC__
@@ -33,15 +34,28 @@
#define INFINITY (1e1000)
#endif
#endif
-%}
-%inline %{
-/* This will allow us to bind the real INFINITY value through SWIG via MYINFINITY. Use %rename to fix the name. */
+#ifdef INFINITY_NO_CONST
+/* To void: error C2099: initializer is not a constant */
+double MYINFINITY = 0.0;
+void initialise_MYINFINITY(void) {
+ MYINFINITY = INFINITY;
+}
+#else
const double MYINFINITY = INFINITY;
+void initialise_MYINFINITY(void) {
+}
+#endif
-/* Use of float is intentional because the original bug was in the float conversion due to overflow checking. */
float use_infinity(float inf_val)
{
return inf_val;
}
%}
+
+/* This will allow us to bind the real INFINITY value through SWIG via MYINFINITY. Use %rename to fix the name. */
+const double MYINFINITY = INFINITY;
+void initialise_MYINFINITY(void);
+/* Use of float is intentional because the original bug was in the float conversion due to overflow checking. */
+float use_infinity(float inf_val);
+
diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in
index 059325c13..310f1a773 100644
--- a/Examples/test-suite/java/Makefile.in
+++ b/Examples/test-suite/java/Makefile.in
@@ -7,6 +7,7 @@ JAVA = @JAVA@
JAVAC = @JAVAC@
JAVAFLAGS = -Xcheck:jni
SCRIPTSUFFIX = _runme.java
+
srcdir = @srcdir@
top_srcdir = ../@top_srcdir@
top_builddir = ../@top_builddir@
@@ -39,9 +40,13 @@ CPP_TEST_CASES = \
java_typemaps_typewrapper
# li_boost_intrusive_ptr
+CPP11_TEST_CASES = \
+ cpp11_strongly_typed_enumerations_simple \
+
include $(srcdir)/../common.mk
# Overridden variables here
+SRCDIR = ../$(srcdir)/
JAVA_PACKAGE = $*
JAVA_PACKAGEOPT = -package $(JAVA_PACKAGE)
SWIGOPT += $(JAVA_PACKAGEOPT)
@@ -55,7 +60,7 @@ director_nspace.%: JAVA_PACKAGE = $*Package
director_nspace_director_name_collision.%: JAVA_PACKAGE = $*Package
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+(cd $(JAVA_PACKAGE) && $(swig_and_compile_cpp))
$(run_testcase)
@@ -65,14 +70,14 @@ director_nspace_director_name_collision.%: JAVA_PACKAGE = $*Package
+(cd $(JAVA_PACKAGE) && $(swig_and_compile_c))
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+(cd $(JAVA_PACKAGE) && $(swig_and_compile_multi_cpp))
$(run_testcase)
# Makes a directory for the testcase if it does not exist
setup = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
@@ -86,8 +91,8 @@ setup = \
# Note Java uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows, SHLIB_PATH on HPUX and DYLD_LIBRARY_PATH on Mac OS X.
run_testcase = \
cd $(JAVA_PACKAGE) && $(COMPILETOOL) $(JAVAC) -classpath . `find . -name "*.java"` && cd .. && \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- $(COMPILETOOL) $(JAVAC) -classpath . -d . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ $(COMPILETOOL) $(JAVAC) -classpath . -d . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
env LD_LIBRARY_PATH="$(JAVA_PACKAGE):$$LD_LIBRARY_PATH" PATH="$(JAVA_PACKAGE):$$PATH" SHLIB_PATH="$(JAVA_PACKAGE):$$SHLIB_PATH" DYLD_LIBRARY_PATH="$(JAVA_PACKAGE):$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) $(JAVAFLAGS) -classpath . $*_runme; \
fi
diff --git a/Examples/test-suite/java/constant_directive_runme.java b/Examples/test-suite/java/constant_directive_runme.java
new file mode 100644
index 000000000..b5135a499
--- /dev/null
+++ b/Examples/test-suite/java/constant_directive_runme.java
@@ -0,0 +1,22 @@
+import constant_directive.*;
+
+public class constant_directive_runme {
+
+ static {
+ try {
+ System.loadLibrary("constant_directive");
+ } 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 (constant_directive.TYPE1_CONSTANT1.getVal() != 1)
+ throw new RuntimeException("fail");
+ if (constant_directive.TYPE1_CONSTANT2.getVal() != 2)
+ throw new RuntimeException("fail");
+ if (constant_directive.TYPE1_CONSTANT3.getVal() != 3)
+ throw new RuntimeException("fail");
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_strongly_typed_enumerations_runme.java b/Examples/test-suite/java/cpp11_strongly_typed_enumerations_runme.java
new file mode 100644
index 000000000..3e0b3f651
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_strongly_typed_enumerations_runme.java
@@ -0,0 +1,176 @@
+import cpp11_strongly_typed_enumerations.*;
+
+public class cpp11_strongly_typed_enumerations_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_strongly_typed_enumerations");
+ } 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 int enumCheck(int actual, int expected) {
+ if (actual != expected)
+ throw new RuntimeException("Enum value mismatch. Expected " + expected + " Actual: " + actual);
+ return expected + 1;
+ }
+
+ public static void main(String argv[]) {
+ int val = 0;
+ val = enumCheck(Enum1.Val1.swigValue(), val);
+ val = enumCheck(Enum1.Val2.swigValue(), val);
+ val = enumCheck(Enum1.Val3.swigValue(), 13);
+ val = enumCheck(Enum1.Val4.swigValue(), val);
+ val = enumCheck(Enum1.Val5a.swigValue(), 13);
+ val = enumCheck(Enum1.Val6a.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Enum2.Val1.swigValue(), val);
+ val = enumCheck(Enum2.Val2.swigValue(), val);
+ val = enumCheck(Enum2.Val3.swigValue(), 23);
+ val = enumCheck(Enum2.Val4.swigValue(), val);
+ val = enumCheck(Enum2.Val5b.swigValue(), 23);
+ val = enumCheck(Enum2.Val6b.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Enum4.Val1.swigValue(), val);
+ val = enumCheck(Enum4.Val2.swigValue(), val);
+ val = enumCheck(Enum4.Val3.swigValue(), 43);
+ val = enumCheck(Enum4.Val4.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Enum5.Val1.swigValue(), val);
+ val = enumCheck(Enum5.Val2.swigValue(), val);
+ val = enumCheck(Enum5.Val3.swigValue(), 53);
+ val = enumCheck(Enum5.Val4.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Enum6.Val1.swigValue(), val);
+ val = enumCheck(Enum6.Val2.swigValue(), val);
+ val = enumCheck(Enum6.Val3.swigValue(), 63);
+ val = enumCheck(Enum6.Val4.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Enum7td.Val1.swigValue(), val);
+ val = enumCheck(Enum7td.Val2.swigValue(), val);
+ val = enumCheck(Enum7td.Val3.swigValue(), 73);
+ val = enumCheck(Enum7td.Val4.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Enum8.Val1.swigValue(), val);
+ val = enumCheck(Enum8.Val2.swigValue(), val);
+ val = enumCheck(Enum8.Val3.swigValue(), 83);
+ val = enumCheck(Enum8.Val4.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Enum10.Val1.swigValue(), val);
+ val = enumCheck(Enum10.Val2.swigValue(), val);
+ val = enumCheck(Enum10.Val3.swigValue(), 103);
+ val = enumCheck(Enum10.Val4.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class1.Enum12.Val1.swigValue(), 1121);
+ val = enumCheck(Class1.Enum12.Val2.swigValue(), 1122);
+ val = enumCheck(Class1.Enum12.Val3.swigValue(), val);
+ val = enumCheck(Class1.Enum12.Val4.swigValue(), val);
+ val = enumCheck(Class1.Enum12.Val5c.swigValue(), 1121);
+ val = enumCheck(Class1.Enum12.Val6c.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class1.Enum13.Val1.swigValue(), 1131);
+ val = enumCheck(Class1.Enum13.Val2.swigValue(), 1132);
+ val = enumCheck(Class1.Enum13.Val3.swigValue(), val);
+ val = enumCheck(Class1.Enum13.Val4.swigValue(), val);
+ val = enumCheck(Class1.Enum13.Val5d.swigValue(), 1131);
+ val = enumCheck(Class1.Enum13.Val6d.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class1.Enum14.Val1.swigValue(), 1141);
+ val = enumCheck(Class1.Enum14.Val2.swigValue(), 1142);
+ val = enumCheck(Class1.Enum14.Val3.swigValue(), val);
+ val = enumCheck(Class1.Enum14.Val4.swigValue(), val);
+ val = enumCheck(Class1.Enum14.Val5e.swigValue(), 1141);
+ val = enumCheck(Class1.Enum14.Val6e.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class1.Struct1.Enum12.Val1.swigValue(), 3121);
+ val = enumCheck(Class1.Struct1.Enum12.Val2.swigValue(), 3122);
+ val = enumCheck(Class1.Struct1.Enum12.Val3.swigValue(), val);
+ val = enumCheck(Class1.Struct1.Enum12.Val4.swigValue(), val);
+ val = enumCheck(Class1.Struct1.Enum12.Val5f.swigValue(), 3121);
+ val = enumCheck(Class1.Struct1.Enum12.Val6f.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class1.Struct1.Enum13.Val1.swigValue(), 3131);
+ val = enumCheck(Class1.Struct1.Enum13.Val2.swigValue(), 3132);
+ val = enumCheck(Class1.Struct1.Enum13.Val3.swigValue(), val);
+ val = enumCheck(Class1.Struct1.Enum13.Val4.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class1.Struct1.Enum14.Val1.swigValue(), 3141);
+ val = enumCheck(Class1.Struct1.Enum14.Val2.swigValue(), 3142);
+ val = enumCheck(Class1.Struct1.Enum14.Val3.swigValue(), val);
+ val = enumCheck(Class1.Struct1.Enum14.Val4.swigValue(), val);
+ val = enumCheck(Class1.Struct1.Enum14.Val5g.swigValue(), 3141);
+ val = enumCheck(Class1.Struct1.Enum14.Val6g.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class2.Enum12.Val1.swigValue(), 2121);
+ val = enumCheck(Class2.Enum12.Val2.swigValue(), 2122);
+ val = enumCheck(Class2.Enum12.Val3.swigValue(), val);
+ val = enumCheck(Class2.Enum12.Val4.swigValue(), val);
+ val = enumCheck(Class2.Enum12.Val5h.swigValue(), 2121);
+ val = enumCheck(Class2.Enum12.Val6h.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class2.Enum13.Val1.swigValue(), 2131);
+ val = enumCheck(Class2.Enum13.Val2.swigValue(), 2132);
+ val = enumCheck(Class2.Enum13.Val3.swigValue(), val);
+ val = enumCheck(Class2.Enum13.Val4.swigValue(), val);
+ val = enumCheck(Class2.Enum13.Val5i.swigValue(), 2131);
+ val = enumCheck(Class2.Enum13.Val6i.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class2.Enum14.Val1.swigValue(), 2141);
+ val = enumCheck(Class2.Enum14.Val2.swigValue(), 2142);
+ val = enumCheck(Class2.Enum14.Val3.swigValue(), val);
+ val = enumCheck(Class2.Enum14.Val4.swigValue(), val);
+ val = enumCheck(Class2.Enum14.Val5j.swigValue(), 2141);
+ val = enumCheck(Class2.Enum14.Val6j.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class2.Struct1.Enum12.Val1.swigValue(), 4121);
+ val = enumCheck(Class2.Struct1.Enum12.Val2.swigValue(), 4122);
+ val = enumCheck(Class2.Struct1.Enum12.Val3.swigValue(), val);
+ val = enumCheck(Class2.Struct1.Enum12.Val4.swigValue(), val);
+ val = enumCheck(Class2.Struct1.Enum12.Val5k.swigValue(), 4121);
+ val = enumCheck(Class2.Struct1.Enum12.Val6k.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class2.Struct1.Enum13.Val1.swigValue(), 4131);
+ val = enumCheck(Class2.Struct1.Enum13.Val2.swigValue(), 4132);
+ val = enumCheck(Class2.Struct1.Enum13.Val3.swigValue(), val);
+ val = enumCheck(Class2.Struct1.Enum13.Val4.swigValue(), val);
+ val = enumCheck(Class2.Struct1.Enum13.Val5l.swigValue(), 4131);
+ val = enumCheck(Class2.Struct1.Enum13.Val6l.swigValue(), val);
+
+ val = 0;
+ val = enumCheck(Class2.Struct1.Enum14.Val1.swigValue(), 4141);
+ val = enumCheck(Class2.Struct1.Enum14.Val2.swigValue(), 4142);
+ val = enumCheck(Class2.Struct1.Enum14.Val3.swigValue(), val);
+ val = enumCheck(Class2.Struct1.Enum14.Val4.swigValue(), val);
+ val = enumCheck(Class2.Struct1.Enum14.Val5m.swigValue(), 4141);
+ val = enumCheck(Class2.Struct1.Enum14.Val6m.swigValue(), val);
+
+ Class1 class1 = new Class1();
+ enumCheck(class1.class1Test1(Enum1.Val5a).swigValue(), 13);
+ enumCheck(class1.class1Test2(Class1.Enum12.Val5c).swigValue(), 1121);
+ enumCheck(class1.class1Test3(Class1.Struct1.Enum12.Val5f).swigValue(), 3121);
+
+ enumCheck(cpp11_strongly_typed_enumerations.globalTest1(Enum1.Val5a).swigValue(), 13);
+ enumCheck(cpp11_strongly_typed_enumerations.globalTest2(Class1.Enum12.Val5c).swigValue(), 1121);
+ enumCheck(cpp11_strongly_typed_enumerations.globalTest3(Class1.Struct1.Enum12.Val5f).swigValue(), 3121);
+ }
+}
diff --git a/Examples/test-suite/java/cpp11_strongly_typed_enumerations_simple_runme.java b/Examples/test-suite/java/cpp11_strongly_typed_enumerations_simple_runme.java
new file mode 100644
index 000000000..b50e94893
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_strongly_typed_enumerations_simple_runme.java
@@ -0,0 +1,176 @@
+import cpp11_strongly_typed_enumerations_simple.*;
+
+public class cpp11_strongly_typed_enumerations_simple_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_strongly_typed_enumerations_simple");
+ } 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 int enumCheck(int actual, int expected) {
+ if (actual != expected)
+ throw new RuntimeException("Enum value mismatch. Expected " + expected + " Actual: " + actual);
+ return expected + 1;
+ }
+
+ public static void main(String argv[]) {
+ int val = 0;
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val1, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val2, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val3, 13);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val4, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val5a, 13);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val6a, val);
+
+ val = 0;
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val1, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val2, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val3, 23);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val4, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val5b, 23);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val6b, val);
+
+ val = 0;
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val1, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val2, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val3, 43);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val4, val);
+
+ val = 0;
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val1, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val2, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val3, 53);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val4, val);
+
+ val = 0;
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val1, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val2, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val3, 63);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val4, val);
+
+ val = 0;
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val1, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val2, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val3, 73);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val4, val);
+
+ val = 0;
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val1, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val2, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val3, 83);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val4, val);
+
+ val = 0;
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val1, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val2, val);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val3, 103);
+ val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val4, val);
+
+ val = 0;
+ val = enumCheck(Class1.Enum12_Val1, 1121);
+ val = enumCheck(Class1.Enum12_Val2, 1122);
+ val = enumCheck(Class1.Enum12_Val3, val);
+ val = enumCheck(Class1.Enum12_Val4, val);
+ val = enumCheck(Class1.Enum12_Val5c, 1121);
+ val = enumCheck(Class1.Enum12_Val6c, val);
+
+ val = 0;
+ val = enumCheck(Class1.Val1, 1131);
+ val = enumCheck(Class1.Val2, 1132);
+ val = enumCheck(Class1.Val3, val);
+ val = enumCheck(Class1.Val4, val);
+ val = enumCheck(Class1.Val5d, 1131);
+ val = enumCheck(Class1.Val6d, val);
+
+ val = 0;
+ val = enumCheck(Class1.Enum14_Val1, 1141);
+ val = enumCheck(Class1.Enum14_Val2, 1142);
+ val = enumCheck(Class1.Enum14_Val3, val);
+ val = enumCheck(Class1.Enum14_Val4, val);
+ val = enumCheck(Class1.Enum14_Val5e, 1141);
+ val = enumCheck(Class1.Enum14_Val6e, val);
+
+ val = 0;
+ val = enumCheck(Class1.Struct1.Enum12_Val1, 3121);
+ val = enumCheck(Class1.Struct1.Enum12_Val2, 3122);
+ val = enumCheck(Class1.Struct1.Enum12_Val3, val);
+ val = enumCheck(Class1.Struct1.Enum12_Val4, val);
+ val = enumCheck(Class1.Struct1.Enum12_Val5f, 3121);
+ val = enumCheck(Class1.Struct1.Enum12_Val6f, val);
+
+ val = 0;
+ val = enumCheck(Class1.Struct1.Val1, 3131);
+ val = enumCheck(Class1.Struct1.Val2, 3132);
+ val = enumCheck(Class1.Struct1.Val3, val);
+ val = enumCheck(Class1.Struct1.Val4, val);
+
+ val = 0;
+ val = enumCheck(Class1.Struct1.Enum14_Val1, 3141);
+ val = enumCheck(Class1.Struct1.Enum14_Val2, 3142);
+ val = enumCheck(Class1.Struct1.Enum14_Val3, val);
+ val = enumCheck(Class1.Struct1.Enum14_Val4, val);
+ val = enumCheck(Class1.Struct1.Enum14_Val5g, 3141);
+ val = enumCheck(Class1.Struct1.Enum14_Val6g, val);
+
+ val = 0;
+ val = enumCheck(Class2.Enum12_Val1, 2121);
+ val = enumCheck(Class2.Enum12_Val2, 2122);
+ val = enumCheck(Class2.Enum12_Val3, val);
+ val = enumCheck(Class2.Enum12_Val4, val);
+ val = enumCheck(Class2.Enum12_Val5h, 2121);
+ val = enumCheck(Class2.Enum12_Val6h, val);
+
+ val = 0;
+ val = enumCheck(Class2.Val1, 2131);
+ val = enumCheck(Class2.Val2, 2132);
+ val = enumCheck(Class2.Val3, val);
+ val = enumCheck(Class2.Val4, val);
+ val = enumCheck(Class2.Val5i, 2131);
+ val = enumCheck(Class2.Val6i, val);
+
+ val = 0;
+ val = enumCheck(Class2.Enum14_Val1, 2141);
+ val = enumCheck(Class2.Enum14_Val2, 2142);
+ val = enumCheck(Class2.Enum14_Val3, val);
+ val = enumCheck(Class2.Enum14_Val4, val);
+ val = enumCheck(Class2.Enum14_Val5j, 2141);
+ val = enumCheck(Class2.Enum14_Val6j, val);
+
+ val = 0;
+ val = enumCheck(Class2.Struct1.Enum12_Val1, 4121);
+ val = enumCheck(Class2.Struct1.Enum12_Val2, 4122);
+ val = enumCheck(Class2.Struct1.Enum12_Val3, val);
+ val = enumCheck(Class2.Struct1.Enum12_Val4, val);
+ val = enumCheck(Class2.Struct1.Enum12_Val5k, 4121);
+ val = enumCheck(Class2.Struct1.Enum12_Val6k, val);
+
+ val = 0;
+ val = enumCheck(Class2.Struct1.Val1, 4131);
+ val = enumCheck(Class2.Struct1.Val2, 4132);
+ val = enumCheck(Class2.Struct1.Val3, val);
+ val = enumCheck(Class2.Struct1.Val4, val);
+ val = enumCheck(Class2.Struct1.Val5l, 4131);
+ val = enumCheck(Class2.Struct1.Val6l, val);
+
+ val = 0;
+ val = enumCheck(Class2.Struct1.Enum14_Val1, 4141);
+ val = enumCheck(Class2.Struct1.Enum14_Val2, 4142);
+ val = enumCheck(Class2.Struct1.Enum14_Val3, val);
+ val = enumCheck(Class2.Struct1.Enum14_Val4, val);
+ val = enumCheck(Class2.Struct1.Enum14_Val5m, 4141);
+ val = enumCheck(Class2.Struct1.Enum14_Val6m, val);
+
+ Class1 class1 = new Class1();
+ enumCheck(class1.class1Test1(cpp11_strongly_typed_enumerations_simple.Enum1_Val5a), 13);
+ enumCheck(class1.class1Test2(Class1.Enum12_Val5c), 1121);
+ enumCheck(class1.class1Test3(Class1.Struct1.Enum12_Val5f), 3121);
+
+ enumCheck(cpp11_strongly_typed_enumerations_simple.globalTest1(cpp11_strongly_typed_enumerations_simple.Enum1_Val5a), 13);
+ enumCheck(cpp11_strongly_typed_enumerations_simple.globalTest2(Class1.Enum12_Val5c), 1121);
+ enumCheck(cpp11_strongly_typed_enumerations_simple.globalTest3(Class1.Struct1.Enum12_Val5f), 3121);
+ }
+}
diff --git a/Examples/test-suite/java/director_nested_class_runme.java b/Examples/test-suite/java/director_nested_class_runme.java
new file mode 100644
index 000000000..5144413b7
--- /dev/null
+++ b/Examples/test-suite/java/director_nested_class_runme.java
@@ -0,0 +1,41 @@
+
+import director_nested_class.*;
+
+public class director_nested_class_runme {
+
+ static {
+ try {
+ System.loadLibrary("director_nested_class");
+ } 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[]) {
+
+ director_nested_class_Derived d = new director_nested_class_Derived();
+
+ if (DirectorOuter.callMethod(d, 999) != 9990) {
+ throw new RuntimeException("callMethod(999) failed");
+ }
+
+ director_nested_class_DerivedInnerInner dinner = new director_nested_class_DerivedInnerInner();
+
+ if (DirectorOuter.callInnerInnerMethod(dinner, 999) != 999000) {
+ throw new RuntimeException("callMethod(999) failed");
+ }
+ }
+}
+
+class director_nested_class_Derived extends DirectorOuter.DirectorInner {
+ public int vmethod(int input) {
+ return input * 10;
+ }
+}
+
+class director_nested_class_DerivedInnerInner extends DirectorOuter.DirectorInner.DirectorInnerInner {
+ public int innervmethod(int input) {
+ return input * 1000;
+ }
+}
diff --git a/Examples/test-suite/java/java_director_runme.java b/Examples/test-suite/java/java_director_runme.java
index 812e791f4..2167d2621 100644
--- a/Examples/test-suite/java/java_director_runme.java
+++ b/Examples/test-suite/java/java_director_runme.java
@@ -53,7 +53,7 @@ public class java_director_runme {
};
int actualCount = Quux.instances();
if (actualCount != expectedCount)
- throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
+ System.err.println("GC failed to run (java_director). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
/* Test Quux1's director disconnect method rename */
diff --git a/Examples/test-suite/java/java_lib_various_runme.java b/Examples/test-suite/java/java_lib_various_runme.java
index 203a30ec2..6d9e13e31 100644
--- a/Examples/test-suite/java/java_lib_various_runme.java
+++ b/Examples/test-suite/java/java_lib_various_runme.java
@@ -83,6 +83,25 @@ public class java_lib_various_runme {
if (byjove[i] != b[i])
throw new RuntimeException("By jove, it failed: [" + new String(b) + "]");
}
+
+ // NIOBUFFER typemap check
+ java.nio.ByteBuffer buf = java.nio.ByteBuffer.allocateDirect(10);
+ java_lib_various.niobuffer_fill_hello(buf);
+ if (
+ (char)buf.get(0) != 'h' ||
+ (char)buf.get(1) != 'e' ||
+ (char)buf.get(2) != 'l' ||
+ (char)buf.get(3) != 'l' ||
+ (char)buf.get(4) != 'o'
+ )
+ throw new RuntimeException(
+ "nio test failed: " +
+ (char)buf.get(0) +
+ (char)buf.get(1) +
+ (char)buf.get(2) +
+ (char)buf.get(3) +
+ (char)buf.get(4)
+ );
}
}
diff --git a/Examples/test-suite/java/kwargs_feature_runme.java b/Examples/test-suite/java/kwargs_feature_runme.java
new file mode 100644
index 000000000..ba742d9ec
--- /dev/null
+++ b/Examples/test-suite/java/kwargs_feature_runme.java
@@ -0,0 +1,23 @@
+import kwargs_feature.*;
+
+public class kwargs_feature_runme {
+
+ static {
+ try {
+ System.loadLibrary("kwargs_feature");
+ } 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 normal overloading still works (no compactdefaultargs) if the kwargs feature is used,
+ // as the kwargs feature is not supported
+ Foo f = new Foo(99);
+ if (f.foo() != 1)
+ throw new RuntimeException("It went wrong");
+ if (Foo.statfoo(2) != 2)
+ throw new RuntimeException("It went wrong");
+ }
+}
diff --git a/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java b/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java
index 530008a87..750ec5067 100644
--- a/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java
+++ b/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java
@@ -33,7 +33,7 @@ public class li_boost_intrusive_ptr_runme {
// Change loop count to run for a long time to monitor memory
final int loopCount = 5000; //5000;
for (int i=0; i<loopCount; i++) {
- new li_boost_intrusive_ptr_runme().runtest();
+ new li_boost_intrusive_ptr_runme().runtest(i);
System.gc();
System.runFinalization();
try {
@@ -78,7 +78,9 @@ public class li_boost_intrusive_ptr_runme {
System.out.println("Finished");
}
- private void runtest() {
+ private int loopCount = 0;
+ private void runtest(int loopCount) {
+ this.loopCount = loopCount;
// simple shared_ptr usage - created in C++
{
Klass k = new Klass("me oh my");
@@ -671,36 +673,36 @@ private void toIgnore() {
}
private void verifyValue(String expected, String got) {
if (!expected.equals(got))
- throw new RuntimeException("verify value failed. Expected: " + expected + " Got: " + got);
+ throw new RuntimeException("verify value failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount);
}
private void verifyCount(int expected, Klass k) {
int got = li_boost_intrusive_ptr.use_count(k);
if (expected != got)
- throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got);
+ throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount);
}
private void verifyCount(int expected, KlassDerived kd) {
int got = li_boost_intrusive_ptr.use_count(kd);
if (expected != got)
- throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got);
+ throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount);
}
private void verifyCount(int expected, KlassDerivedDerived kdd) {
int got = li_boost_intrusive_ptr.use_count(kdd);
if (expected != got)
- throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got);
+ throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount);
}
private void verifyIntrusiveCount(int expected, Klass k) {
int got = k.use_count();
if (expected != got)
- throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got);
+ throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount);
}
private void verifyIntrusiveCount(int expected, KlassDerived kd) {
int got = kd.use_count();
if (expected != got)
- throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got);
+ throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount);
}
private void verifyIntrusiveCount(int expected, KlassDerivedDerived kdd) {
int got = kdd.use_count();
if (expected != got)
- throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got);
+ throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount);
}
}
diff --git a/Examples/test-suite/java/li_boost_shared_ptr_runme.java b/Examples/test-suite/java/li_boost_shared_ptr_runme.java
index aa355c86a..64c356f8e 100644
--- a/Examples/test-suite/java/li_boost_shared_ptr_runme.java
+++ b/Examples/test-suite/java/li_boost_shared_ptr_runme.java
@@ -59,7 +59,7 @@ public class li_boost_shared_ptr_runme {
}
int actualCount = Klass.getTotal_count();
if (actualCount != expectedCount)
- throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
+ System.err.println("GC failed to run (li_boost_shared_ptr). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
int wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count();
diff --git a/Examples/test-suite/java/li_std_auto_ptr_runme.java b/Examples/test-suite/java/li_std_auto_ptr_runme.java
index db34fb529..50ed113a4 100644
--- a/Examples/test-suite/java/li_std_auto_ptr_runme.java
+++ b/Examples/test-suite/java/li_std_auto_ptr_runme.java
@@ -43,7 +43,7 @@ public class li_std_auto_ptr_runme {
}
int actualCount = Klass.getTotal_count();
if (actualCount != expectedCount)
- throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
+ System.err.println("GC failed to run (li_std_auto_ptr 1). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
if (!k2.getLabel().equals("second"))
@@ -62,7 +62,7 @@ public class li_std_auto_ptr_runme {
};
int actualCount = Klass.getTotal_count();
if (actualCount != expectedCount)
- throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount);
+ System.err.println("GC failed to run (li_std_auto_ptr 2). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
}
}
diff --git a/Examples/test-suite/java/nested_extend_c_runme.java b/Examples/test-suite/java/nested_extend_c_runme.java
new file mode 100644
index 000000000..5d9d861da
--- /dev/null
+++ b/Examples/test-suite/java/nested_extend_c_runme.java
@@ -0,0 +1,45 @@
+import nested_extend_c.*;
+
+public class nested_extend_c_runme {
+
+ static {
+ try {
+ System.loadLibrary("nested_extend_c");
+ } 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[]) throws Throwable
+ {
+ {
+ hiA hi = new hiA();
+ if (hi.hi_extend() != 'h')
+ throw new RuntimeException("test failed");
+ }
+ {
+ lowA low = new lowA();
+ if (low.low_extend() != 99)
+ throw new RuntimeException("test failed");
+ }
+
+ {
+ hiB hi = new hiB();
+ if (hi.hi_extend() != 'h')
+ throw new RuntimeException("test failed");
+ }
+ {
+ lowB low = new lowB();
+ if (low.low_extend() != 99)
+ throw new RuntimeException("test failed");
+ }
+ {
+ FOO_bar foobar = new FOO_bar();
+ foobar.setD(1234);
+ if (foobar.getD() != 1234)
+ throw new RuntimeException("test failed");
+ foobar.bar_extend();
+ }
+ }
+}
diff --git a/Examples/test-suite/java/nested_template_base_runme.java b/Examples/test-suite/java/nested_template_base_runme.java
new file mode 100644
index 000000000..8404afe04
--- /dev/null
+++ b/Examples/test-suite/java/nested_template_base_runme.java
@@ -0,0 +1,27 @@
+import nested_template_base.*;
+
+public class nested_template_base_runme {
+
+ static {
+ try {
+ System.loadLibrary("nested_template_base");
+ } 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[]) {
+ OuterC.InnerS ois = new OuterC.InnerS(123);
+ OuterC.InnerC oic = new OuterC.InnerC();
+
+ // Check base method is available
+ if (oic.outer(ois).getVal() != 123)
+ throw new RuntimeException("Wrong value calling outer");
+
+ // Check non-derived class using base class
+ if (oic.innerc().outer(ois).getVal() != 123)
+ throw new RuntimeException("Wrong value calling innerc");
+
+ }
+}
diff --git a/Examples/test-suite/java/preproc_line_file_runme.java b/Examples/test-suite/java/preproc_line_file_runme.java
index 123753fd9..7726b613b 100644
--- a/Examples/test-suite/java/preproc_line_file_runme.java
+++ b/Examples/test-suite/java/preproc_line_file_runme.java
@@ -13,13 +13,21 @@ public class preproc_line_file_runme {
private static void test_file(String file, String suffix) throws Throwable
{
- String FILENAME_WINDOWS = "Examples\\test-suite\\preproc_line_file.i";
- String FILENAME_UNIX = "Examples/test-suite/preproc_line_file.i";
+// For swig-3.0.1 and earlier
+// String FILENAME_WINDOWS = "Examples\\test-suite\\preproc_line_file.i";
+// String FILENAME_UNIX = "Examples/test-suite/preproc_line_file.i";
+
+ String FILENAME_WINDOWS2 = "Examples\\test-suite\\java\\..\\preproc_line_file.i";
+ String FILENAME_UNIX2 = "Examples/test-suite/java/../preproc_line_file.i";
+
+ String FILENAME_WINDOWS3 = "..\\.\\..\\preproc_line_file.i";
+ String FILENAME_UNIX3 = ".././../preproc_line_file.i";
// We don't test for exact equality here because the file names are relative to the build directory, which can be different from the source directory,
// under Unix. But they do need to end with the same path components.
- if (!file.endsWith(FILENAME_UNIX + suffix) && !file.endsWith(FILENAME_WINDOWS + suffix))
- throw new RuntimeException("file \"" + file + "\" doesn't end with " + FILENAME_UNIX + suffix);
+ if (!file.endsWith(FILENAME_UNIX2 + suffix) && !file.endsWith(FILENAME_WINDOWS2 + suffix) &&
+ !file.endsWith(FILENAME_UNIX3 + suffix) && !file.endsWith(FILENAME_WINDOWS3 + suffix))
+ throw new RuntimeException("file \"" + file + "\" doesn't end with " + FILENAME_UNIX2 + suffix + " or " + FILENAME_UNIX3 + suffix);
}
public static void main(String argv[]) throws Throwable
diff --git a/Examples/test-suite/java/smart_pointer_const_overload_runme.java b/Examples/test-suite/java/smart_pointer_const_overload_runme.java
index bb4ae2c8f..9c10dedb2 100644
--- a/Examples/test-suite/java/smart_pointer_const_overload_runme.java
+++ b/Examples/test-suite/java/smart_pointer_const_overload_runme.java
@@ -41,7 +41,7 @@ public class smart_pointer_const_overload_runme {
Assert(f.getAccess() == MUTABLE_ACCESS);
// Test static method
- b.stat();
+ b.statMethod();
Assert(f.getAccess() == CONST_ACCESS);
diff --git a/Examples/test-suite/java/template_default_class_parms_runme.java b/Examples/test-suite/java/template_default_class_parms_runme.java
index 406915b82..0a6571fa8 100644
--- a/Examples/test-suite/java/template_default_class_parms_runme.java
+++ b/Examples/test-suite/java/template_default_class_parms_runme.java
@@ -45,6 +45,11 @@ public class template_default_class_parms_runme {
foo.setTType(a);
a = foo.method(a);
}
+
+ {
+ MapDefaults md = new MapDefaults();
+ md.test_func(10, 20, new DefaultNodeType());
+ }
}
}
diff --git a/Examples/test-suite/java/template_templated_constructors_runme.java b/Examples/test-suite/java/template_templated_constructors_runme.java
new file mode 100644
index 000000000..cd3f31d21
--- /dev/null
+++ b/Examples/test-suite/java/template_templated_constructors_runme.java
@@ -0,0 +1,26 @@
+
+import template_templated_constructors.*;
+
+public class template_templated_constructors_runme {
+
+ static {
+ try {
+ System.loadLibrary("template_templated_constructors");
+ } 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[]) {
+ TConstructor1 t1 = new TConstructor1(123);
+ TConstructor2 t2a = new TConstructor2();
+ TConstructor2 t2b = new TConstructor2(123);
+
+ TClass1Int tc1 = new TClass1Int(123.4);
+ TClass2Int tc2a = new TClass2Int();
+ TClass2Int tc2b = new TClass2Int(123.4);
+
+ }
+}
+
diff --git a/Examples/test-suite/java/template_typedef_typedef_runme.java b/Examples/test-suite/java/template_typedef_typedef_runme.java
index f5f368561..5a3af0099 100644
--- a/Examples/test-suite/java/template_typedef_typedef_runme.java
+++ b/Examples/test-suite/java/template_typedef_typedef_runme.java
@@ -12,13 +12,13 @@ public class template_typedef_typedef_runme {
}
public static void main(String argv[]) {
- ObjectBase ob1 = new ObjectBase();
- ob1.getBlabla1(new ObjectBase());
+ Object1Base ob1 = new Object1Base();
+ ob1.getBlabla1(new Object1Base());
Object2Base ob2 = new Object2Base();
ob2.getBlabla2(new Object2Base());
Factory factory = new Factory();
- factory.getBlabla3(new ObjectBase());
+ factory.getBlabla3(new Object1Base());
factory.getBlabla4(new Object2Base());
}
}
diff --git a/Examples/test-suite/java_lib_various.i b/Examples/test-suite/java_lib_various.i
index 716ae9139..180d07569 100644
--- a/Examples/test-suite/java_lib_various.i
+++ b/Examples/test-suite/java_lib_various.i
@@ -8,6 +8,7 @@
%apply char **STRING_ARRAY { char **languages };
%apply char *BYTE { char *chars };
%apply char **STRING_OUT { char **string_ptr };
+%apply unsigned char *NIOBUFFER { unsigned char *buf };
%typemap(freearg) char **languages "" // don't delete memory when setting global variable
%{
@@ -47,5 +48,8 @@ void char_ptr_ptr_out(char **string_ptr) {
*string_ptr = ret;
}
+void niobuffer_fill_hello(unsigned char *buf) {
+ sprintf ((char*)buf,"hello");
+}
%}
diff --git a/Examples/test-suite/javascript/Makefile.in b/Examples/test-suite/javascript/Makefile.in
index 7368ea9a3..83b15f822 100755..100644
--- a/Examples/test-suite/javascript/Makefile.in
+++ b/Examples/test-suite/javascript/Makefile.in
@@ -4,10 +4,15 @@
LANGUAGE = javascript
NODEGYP = @NODEGYP@
+NODEJS = @NODEJS@
SCRIPTSUFFIX = _runme.js
+OBJEXT = @OBJEXT@
+SO = @SO@
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
+
SWIG = $(top_builddir)/preinst_swig
ifneq (, $(ENGINE))
@@ -16,23 +21,23 @@ else
JSENGINE=node
endif
+ifneq (, $(V8_VERSION))
+ JSV8_VERSION=$(V8_VERSION)
+else
+ JSV8_VERSION=0x031110
+endif
+
include $(srcdir)/../common.mk
+SWIGOPT += -DV8_VERSION=$(JSV8_VERSION)
+
_setup = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $* (with run test)" ; \
else \
echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $*" ; \
fi;
-ifneq (jsc,$(ENGINE))
-
- # This test can not be run with v8 as it uses v8 API incompatible output typemaps
- typemap_variables.cpptest:
- echo "skipping $(LANGUAGE) ($(JSENGINE)) testcase typemap_variables" ;
-
-endif
-
ifeq (node,$(JSENGINE))
SWIGOPT += -v8 -DBUILDING_NODE_EXTENSION=1
@@ -47,20 +52,27 @@ ifeq (node,$(JSENGINE))
constant_pointers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
enum_thorough.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+ setup_node = \
+ test -d $* || mkdir $*; \
+ sed -e 's|$$testcase|$*|g; s|$$cflags|$(GYP_CFLAGS)|g; s|$$srcdir|$(srcdir)|g' \
+ $(srcdir)/node_template/binding.gyp.in > $*/binding.gyp; \
+ sed -e 's|$$testcase|$*|g;' \
+ $(srcdir)/node_template/index.js.in > $*/index.js
+
# Note: we need to use swig in C parse mode, but make node-gyp believe it is c++ (via file extension)
swig_and_compile_c = \
- sh ./setup_test.sh $* $(GYP_CFLAGS); \
- $(SWIG) -javascript $(SWIGOPT) -o $*_wrap.cxx ../$*.i; \
+ $(setup_node); \
+ $(SWIG) -javascript $(SWIGOPT) -o $*_wrap.cxx $(srcdir)/../$*.i; \
$(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
swig_and_compile_cpp = \
- sh ./setup_test.sh $* $(GYP_CFLAGS); \
- $(SWIG) -c++ -javascript $(SWIGOPT) ../$*.i; \
+ $(setup_node); \
+ $(SWIG) -c++ -javascript $(SWIGOPT) $(srcdir)/../$*.i; \
$(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
run_testcase = \
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
- node $(srcdir)/$*$(SCRIPTSUFFIX); \
+ env NODE_PATH=$$PWD:$(srcdir) $(NODEJS) $(srcdir)/$*$(SCRIPTSUFFIX); \
fi
@@ -83,7 +95,7 @@ else
run_testcase = \
if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
- $(top_srcdir)/Tools/javascript/javascript -$(JSENGINE) $(srcdir)/$*$(SCRIPTSUFFIX); \
+ $(RUNTOOL) $(top_builddir)/Tools/javascript/javascript -$(JSENGINE) $(srcdir)/$*$(SCRIPTSUFFIX); \
fi
%.ctest:
@@ -105,10 +117,15 @@ endif
%.clean:
- rm -rf $*
+ @rm -rf $*
+ @rm -f $*_wrap.* $*$(SO) $*.$(OBJEXT)
clean:
- rm -f *_wrap.cxx
- rm -f *_wrap.c
- rm -f *.so
- rm -f *.o
+ for ext in _wrap.cxx _wrap.$(OBJEXT) $(SO); do \
+ rm -f clientdata_prop_a$${ext} clientdata_prop_b$${ext}; \
+ rm -f imports_a$${ext} imports_b$${ext}; \
+ rm -f import_stl_a$${ext} import_stl_b$${ext}; \
+ rm -f mod_a$${ext} mod_b$${ext}; \
+ rm -f multi_import_a$${ext} multi_import_b$${ext}; \
+ rm -f packageoption_a$${ext} packageoption_b$${ext} packageoption_c$${ext}; \
+ done
diff --git a/Examples/test-suite/javascript/abstract_access_runme.js b/Examples/test-suite/javascript/abstract_access_runme.js
index 8f87d2105..f61bb4358 100644
--- a/Examples/test-suite/javascript/abstract_access_runme.js
+++ b/Examples/test-suite/javascript/abstract_access_runme.js
@@ -1,4 +1,4 @@
-var abstract_access = require("./abstract_access");
+var abstract_access = require("abstract_access");
var d = new abstract_access.D()
if (d.do_x() != 1) {
diff --git a/Examples/test-suite/javascript/abstract_inherit_runme.js b/Examples/test-suite/javascript/abstract_inherit_runme.js
index 3af2eae74..f732e8767 100644
--- a/Examples/test-suite/javascript/abstract_inherit_runme.js
+++ b/Examples/test-suite/javascript/abstract_inherit_runme.js
@@ -1,4 +1,4 @@
-var abstract_inherit = require("./abstract_inherit");
+var abstract_inherit = require("abstract_inherit");
// Shouldn't be able to instantiate any of these classes
// since none of them implements the pure virtual function
diff --git a/Examples/test-suite/javascript/abstract_typedef2_runme.js b/Examples/test-suite/javascript/abstract_typedef2_runme.js
index c177e49c3..d8a533ab1 100644
--- a/Examples/test-suite/javascript/abstract_typedef2_runme.js
+++ b/Examples/test-suite/javascript/abstract_typedef2_runme.js
@@ -1,4 +1,4 @@
-var abstract_typedef2 = require("./abstract_typedef2");
+var abstract_typedef2 = require("abstract_typedef2");
var a = new abstract_typedef2.A_UF();
diff --git a/Examples/test-suite/javascript/abstract_typedef_runme.js b/Examples/test-suite/javascript/abstract_typedef_runme.js
index abcfc581d..286328fa8 100644
--- a/Examples/test-suite/javascript/abstract_typedef_runme.js
+++ b/Examples/test-suite/javascript/abstract_typedef_runme.js
@@ -1,4 +1,4 @@
-var abstract_typedef = require("./abstract_typedef");
+var abstract_typedef = require("abstract_typedef");
var e = new abstract_typedef.Engine();
var a = new abstract_typedef.A()
diff --git a/Examples/test-suite/javascript/abstract_virtual_runme.js b/Examples/test-suite/javascript/abstract_virtual_runme.js
index 9e2814e41..9a9ce9988 100644
--- a/Examples/test-suite/javascript/abstract_virtual_runme.js
+++ b/Examples/test-suite/javascript/abstract_virtual_runme.js
@@ -1,4 +1,4 @@
-var abstract_virtual = require("./abstract_virtual");
+var abstract_virtual = require("abstract_virtual");
d = new abstract_virtual.D()
diff --git a/Examples/test-suite/javascript/array_member_runme.js b/Examples/test-suite/javascript/array_member_runme.js
index 8c4ef1da5..3d9bb0e5b 100644
--- a/Examples/test-suite/javascript/array_member_runme.js
+++ b/Examples/test-suite/javascript/array_member_runme.js
@@ -1,4 +1,4 @@
-var array_member = require("./array_member");
+var array_member = require("array_member");
var f = new array_member.Foo();
f.data = array_member.global_data;
diff --git a/Examples/test-suite/javascript/arrays_global_runme.js b/Examples/test-suite/javascript/arrays_global_runme.js
index fdb365f83..0cbb28efb 100644
--- a/Examples/test-suite/javascript/arrays_global_runme.js
+++ b/Examples/test-suite/javascript/arrays_global_runme.js
@@ -1,4 +1,4 @@
-var arrays_global = require("./arrays_global");
+var arrays_global = require("arrays_global");
arrays_global.array_i = arrays_global.array_const_i;
diff --git a/Examples/test-suite/javascript/callback_runme.js b/Examples/test-suite/javascript/callback_runme.js
index 9b1ef01a3..021888641 100644
--- a/Examples/test-suite/javascript/callback_runme.js
+++ b/Examples/test-suite/javascript/callback_runme.js
@@ -1,4 +1,4 @@
-var callback = require("./callback");
+var callback = require("callback");
if (callback.foo(2) !== 2) {
throw new Error("Failed.");
diff --git a/Examples/test-suite/javascript/char_binary_runme.js b/Examples/test-suite/javascript/char_binary_runme.js
index 42abe6060..b2aac920c 100644
--- a/Examples/test-suite/javascript/char_binary_runme.js
+++ b/Examples/test-suite/javascript/char_binary_runme.js
@@ -1,4 +1,4 @@
-var char_binary = require("./char_binary");
+var char_binary = require("char_binary");
var t = new char_binary.Test();
if (t.strlen('hile') != 4) {
diff --git a/Examples/test-suite/javascript/char_strings_runme.js b/Examples/test-suite/javascript/char_strings_runme.js
index cca50d851..fe17cb982 100644
--- a/Examples/test-suite/javascript/char_strings_runme.js
+++ b/Examples/test-suite/javascript/char_strings_runme.js
@@ -1,4 +1,4 @@
-var char_strings = require("./char_strings");
+var char_strings = require("char_strings");
var assertIsEqual = function(expected, actual) {
if (expected !== actual) {
diff --git a/Examples/test-suite/javascript/class_ignore_runme.js b/Examples/test-suite/javascript/class_ignore_runme.js
index f0a32a1c4..ffbe021c7 100644
--- a/Examples/test-suite/javascript/class_ignore_runme.js
+++ b/Examples/test-suite/javascript/class_ignore_runme.js
@@ -1,4 +1,4 @@
-var class_ignore = require("./class_ignore");
+var class_ignore = require("class_ignore");
a = new class_ignore.Bar();
diff --git a/Examples/test-suite/javascript/class_scope_weird_runme.js b/Examples/test-suite/javascript/class_scope_weird_runme.js
index ac745d023..73c118d61 100644
--- a/Examples/test-suite/javascript/class_scope_weird_runme.js
+++ b/Examples/test-suite/javascript/class_scope_weird_runme.js
@@ -1,4 +1,4 @@
-var class_scope_weird = require("./class_scope_weird");
+var class_scope_weird = require("class_scope_weird");
f = new class_scope_weird.Foo();
g = new class_scope_weird.Foo(3);
diff --git a/Examples/test-suite/javascript/complextest_runme.js b/Examples/test-suite/javascript/complextest_runme.js
index 1fcc97648..b87d6bffa 100644
--- a/Examples/test-suite/javascript/complextest_runme.js
+++ b/Examples/test-suite/javascript/complextest_runme.js
@@ -1,4 +1,4 @@
-var complextest = require("./complextest");
+var complextest = require("complextest");
a = [-1,2];
diff --git a/Examples/test-suite/javascript/constover_runme.js b/Examples/test-suite/javascript/constover_runme.js
index 764d8b328..9b192b5ff 100644
--- a/Examples/test-suite/javascript/constover_runme.js
+++ b/Examples/test-suite/javascript/constover_runme.js
@@ -1,4 +1,4 @@
-var constover = require("./constover");
+var constover = require("constover");
p = constover.test("test");
if (p != "test") {
diff --git a/Examples/test-suite/javascript/constructor_copy_runme.js b/Examples/test-suite/javascript/constructor_copy_runme.js
index 39dce52ce..179b9fb40 100644
--- a/Examples/test-suite/javascript/constructor_copy_runme.js
+++ b/Examples/test-suite/javascript/constructor_copy_runme.js
@@ -1,4 +1,4 @@
-var constructor_copy = require("./constructor_copy");
+var constructor_copy = require("constructor_copy");
f1 = new constructor_copy.Foo1(3);
f11 = new constructor_copy.Foo1(f1);
diff --git a/Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js b/Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js
new file mode 100644
index 000000000..ad9d4e883
--- /dev/null
+++ b/Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js
@@ -0,0 +1,165 @@
+var cpp11_strongly_typed_enumerations = require("cpp11_strongly_typed_enumerations");
+
+function enumCheck(actual, expected) {
+ if (actual != expected) {
+ throw new Error("Enum value mismatch. Expected: " + expected + " Actual: " + actual);
+ }
+ return expected + 1;
+}
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val3, 13);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val5a, 13);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val6a, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val3, 23);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val5b, 23);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val6b, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Val3, 43);
+val = enumCheck(cpp11_strongly_typed_enumerations.Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val3, 53);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val3, 63);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val3, 73);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val3, 83);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val3, 103);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val1, 1121);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val2, 1122);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c, 1121);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val6c, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val1, 1131);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val2, 1132);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val5d, 1131);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val6d, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val1, 1141);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val2, 1142);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val5e, 1141);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val6e, val);
+
+// Requires nested class support to work
+//val = 0;
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val1, 3121);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val2, 3122);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val3, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val4, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val5f, 3121);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val6f, val);
+//
+//val = 0;
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val1, 3131);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val2, 3132);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val3, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val4, val);
+//
+//val = 0;
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val1, 3141);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val2, 3142);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val3, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val4, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val5g, 3141);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val6g, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val1, 2121);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val2, 2122);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val5h, 2121);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val6h, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val1, 2131);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val2, 2132);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val5i, 2131);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val6i, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val1, 2141);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val2, 2142);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val5j, 2141);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val6j, val);
+
+// Requires nested class support to work
+//val = 0;
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val1, 4121);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val2, 4122);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val3, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val4, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val5k, 4121);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val6k, val);
+//
+//val = 0;
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val1, 4131);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val2, 4132);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val3, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val4, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val5l, 4131);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val6l, val);
+//
+//val = 0;
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val1, 4141);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val2, 4142);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val3, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val4, val);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val5m, 4141);
+//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val6m, val);
+
+class1 = new cpp11_strongly_typed_enumerations.Class1();
+enumCheck(class1.class1Test1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13);
+enumCheck(class1.class1Test2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121);
+//enumCheck(class1.class1Test3(cpp11_strongly_typed_enumerations.Class1.Struct1_Enum12_Val5f), 3121);
+
+enumCheck(cpp11_strongly_typed_enumerations.globalTest1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13);
+enumCheck(cpp11_strongly_typed_enumerations.globalTest2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121);
+//enumCheck(globalTest3(cpp11_strongly_typed_enumerations.Class1.Struct1_Enum12_Val5f), 3121);
diff --git a/Examples/test-suite/javascript/cpp_enum_runme.js b/Examples/test-suite/javascript/cpp_enum_runme.js
index 35f7c60ac..8a248c372 100644
--- a/Examples/test-suite/javascript/cpp_enum_runme.js
+++ b/Examples/test-suite/javascript/cpp_enum_runme.js
@@ -1,4 +1,4 @@
-var cpp_enum = require("./cpp_enum");
+var cpp_enum = require("cpp_enum");
var f = new cpp_enum.Foo()
diff --git a/Examples/test-suite/javascript/cpp_namespace_runme.js b/Examples/test-suite/javascript/cpp_namespace_runme.js
index 3bdfef3e9..a6ab79964 100644
--- a/Examples/test-suite/javascript/cpp_namespace_runme.js
+++ b/Examples/test-suite/javascript/cpp_namespace_runme.js
@@ -1,4 +1,4 @@
-var cpp_namespace = require("./cpp_namespace");
+var cpp_namespace = require("cpp_namespace");
var n = cpp_namespace.fact(4);
if (n != 24){
diff --git a/Examples/test-suite/javascript/cpp_static_runme.js b/Examples/test-suite/javascript/cpp_static_runme.js
index 2579aeafe..c7917e12e 100644
--- a/Examples/test-suite/javascript/cpp_static_runme.js
+++ b/Examples/test-suite/javascript/cpp_static_runme.js
@@ -1,4 +1,4 @@
-var cpp_static = require("./cpp_static");
+var cpp_static = require("cpp_static");
cpp_static.StaticFunctionTest.static_func();
cpp_static.StaticFunctionTest.static_func_2(1);
diff --git a/Examples/test-suite/javascript/director_alternating_runme.js b/Examples/test-suite/javascript/director_alternating_runme.js
index a0411eace..cff288d35 100644
--- a/Examples/test-suite/javascript/director_alternating_runme.js
+++ b/Examples/test-suite/javascript/director_alternating_runme.js
@@ -1,4 +1,4 @@
-var director_alternating = require("./director_alternating");
+var director_alternating = require("director_alternating");
id = director_alternating.getBar().id();
if (id != director_alternating.idFromGetBar())
diff --git a/Examples/test-suite/javascript/disown_runme.js b/Examples/test-suite/javascript/disown_runme.js
index a4a6fd880..ea742b51e 100644
--- a/Examples/test-suite/javascript/disown_runme.js
+++ b/Examples/test-suite/javascript/disown_runme.js
@@ -1,4 +1,4 @@
-var disown = require("./disown");
+var disown = require("disown");
var a = new disown.A();
var tmp = a.thisown;
diff --git a/Examples/test-suite/javascript/dynamic_cast_runme.js b/Examples/test-suite/javascript/dynamic_cast_runme.js
index 0029cb0f8..32eabcf8b 100644
--- a/Examples/test-suite/javascript/dynamic_cast_runme.js
+++ b/Examples/test-suite/javascript/dynamic_cast_runme.js
@@ -1,4 +1,4 @@
-var dynamic_cast = require("./dynamic_cast");
+var dynamic_cast = require("dynamic_cast");
var f = new dynamic_cast.Foo();
var b = new dynamic_cast.Bar();
diff --git a/Examples/test-suite/javascript/empty_runme.js b/Examples/test-suite/javascript/empty_runme.js
index db06b3902..7894379be 100644
--- a/Examples/test-suite/javascript/empty_runme.js
+++ b/Examples/test-suite/javascript/empty_runme.js
@@ -1 +1 @@
-var empty = require("./empty"); \ No newline at end of file
+var empty = require("empty"); \ No newline at end of file
diff --git a/Examples/test-suite/javascript/enum_template_runme.js b/Examples/test-suite/javascript/enum_template_runme.js
index 20f8c3482..1e71e5f64 100644
--- a/Examples/test-suite/javascript/enum_template_runme.js
+++ b/Examples/test-suite/javascript/enum_template_runme.js
@@ -1,4 +1,4 @@
-var enum_template = require("./enum_template");
+var enum_template = require("enum_template");
if (enum_template.MakeETest() != 1)
throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/infinity_runme.js b/Examples/test-suite/javascript/infinity_runme.js
index 7b5182ff6..8ebe496a6 100644
--- a/Examples/test-suite/javascript/infinity_runme.js
+++ b/Examples/test-suite/javascript/infinity_runme.js
@@ -1,4 +1,5 @@
-var infinity = require("./infinity");
+var infinity = require("infinity");
+infinity.initialise_MYINFINITY();
var my_infinity = infinity.INFINITY;
var ret_val = infinity.use_infinity(my_infinity);
diff --git a/Examples/test-suite/javascript/namespace_virtual_method_runme.js b/Examples/test-suite/javascript/namespace_virtual_method_runme.js
index 24d3bd487..4f1e05c84 100644
--- a/Examples/test-suite/javascript/namespace_virtual_method_runme.js
+++ b/Examples/test-suite/javascript/namespace_virtual_method_runme.js
@@ -1,3 +1,3 @@
-var namespace_virtual_method = require("./namespace_virtual_method");
+var namespace_virtual_method = require("namespace_virtual_method");
x = new namespace_virtual_method.Spam();
diff --git a/Examples/test-suite/javascript/node_template/binding.gyp.in b/Examples/test-suite/javascript/node_template/binding.gyp.in
index 209774ae0..a82ac2f3e 100644
--- a/Examples/test-suite/javascript/node_template/binding.gyp.in
+++ b/Examples/test-suite/javascript/node_template/binding.gyp.in
@@ -3,7 +3,7 @@
{
"target_name": "$testcase",
"sources":[ "../$testcase_wrap.cxx" ],
- "include_dirs": ["../.."],
+ "include_dirs": ["../$srcdir/.."],
'defines': [
'BUILDING_NODE_EXTENSION=1',
],
diff --git a/Examples/test-suite/javascript/nspace_extend_runme.js b/Examples/test-suite/javascript/nspace_extend_runme.js
index ab81c19d3..8cabfe945 100644
--- a/Examples/test-suite/javascript/nspace_extend_runme.js
+++ b/Examples/test-suite/javascript/nspace_extend_runme.js
@@ -1,4 +1,4 @@
-var nspace_extend = require("./nspace_extend");
+var nspace_extend = require("nspace_extend");
// constructors and destructors
var color1 = new nspace_extend.Outer.Inner1.Color();
diff --git a/Examples/test-suite/javascript/nspace_runme.js b/Examples/test-suite/javascript/nspace_runme.js
index f1afff428..993610dd6 100644
--- a/Examples/test-suite/javascript/nspace_runme.js
+++ b/Examples/test-suite/javascript/nspace_runme.js
@@ -1,4 +1,4 @@
-var nspace = require("./nspace");
+var nspace = require("nspace");
var color1 = new nspace.Outer.Inner1.Color();
var color = new nspace.Outer.Inner1.Color(color1);
diff --git a/Examples/test-suite/javascript/null_pointer_runme.js b/Examples/test-suite/javascript/null_pointer_runme.js
new file mode 100644
index 000000000..7c0d61244
--- /dev/null
+++ b/Examples/test-suite/javascript/null_pointer_runme.js
@@ -0,0 +1,9 @@
+var null_pointer = require("null_pointer");
+
+if (!null_pointer.func(null)) {
+ throw new Error("Javascript 'null' should be converted into NULL.");
+}
+
+if (null_pointer.getnull() != null) {
+ throw new Error("NULL should be converted into Javascript 'null'.");
+}
diff --git a/Examples/test-suite/javascript/overload_copy_runme.js b/Examples/test-suite/javascript/overload_copy_runme.js
index 1039ffda1..e2f610788 100644
--- a/Examples/test-suite/javascript/overload_copy_runme.js
+++ b/Examples/test-suite/javascript/overload_copy_runme.js
@@ -1,4 +1,4 @@
-var overload_copy = require("./overload_copy");
+var overload_copy = require("overload_copy");
f = new overload_copy.Foo();
g = new overload_copy.Foo(f);
diff --git a/Examples/test-suite/javascript/preproc_include_runme.js b/Examples/test-suite/javascript/preproc_include_runme.js
index 4b827fbcc..5ec72b842 100644
--- a/Examples/test-suite/javascript/preproc_include_runme.js
+++ b/Examples/test-suite/javascript/preproc_include_runme.js
@@ -1,4 +1,4 @@
-var preproc_include = require("./preproc_include");
+var preproc_include = require("preproc_include");
if (preproc_include.multiply10(10) != 100)
throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/preproc_runme.js b/Examples/test-suite/javascript/preproc_runme.js
index 669f9d1f0..167ca5ac1 100644
--- a/Examples/test-suite/javascript/preproc_runme.js
+++ b/Examples/test-suite/javascript/preproc_runme.js
@@ -1,4 +1,4 @@
-var preproc = require("./preproc");
+var preproc = require("preproc");
if (preproc.endif != 1)
throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/rename1_runme.js b/Examples/test-suite/javascript/rename1_runme.js
index 8374e6a89..68ecc11b6 100644
--- a/Examples/test-suite/javascript/rename1_runme.js
+++ b/Examples/test-suite/javascript/rename1_runme.js
@@ -1,4 +1,4 @@
-var rename = require("./rename1");
+var rename = require("rename1");
function part1() {
var xyz = new rename.XYZInt();
diff --git a/Examples/test-suite/javascript/rename2_runme.js b/Examples/test-suite/javascript/rename2_runme.js
index bc6a95a59..99f478596 100644
--- a/Examples/test-suite/javascript/rename2_runme.js
+++ b/Examples/test-suite/javascript/rename2_runme.js
@@ -1,4 +1,4 @@
-var rename = require("./rename2");
+var rename = require("rename2");
function part1() {
var xyz = new rename.XYZInt();
diff --git a/Examples/test-suite/javascript/rename3_runme.js b/Examples/test-suite/javascript/rename3_runme.js
index 9e57e80ea..237029fbb 100644
--- a/Examples/test-suite/javascript/rename3_runme.js
+++ b/Examples/test-suite/javascript/rename3_runme.js
@@ -1,4 +1,4 @@
-var rename = require("./rename3");
+var rename = require("rename3");
function part1() {
var xyz = new rename.XYZInt();
diff --git a/Examples/test-suite/javascript/rename4_runme.js b/Examples/test-suite/javascript/rename4_runme.js
index d651fc7a1..fed50dceb 100644
--- a/Examples/test-suite/javascript/rename4_runme.js
+++ b/Examples/test-suite/javascript/rename4_runme.js
@@ -1,4 +1,4 @@
-var rename = require("./rename4");
+var rename = require("rename4");
function part1() {
var xyz = new rename.XYZInt();
diff --git a/Examples/test-suite/javascript/rename_scope_runme.js b/Examples/test-suite/javascript/rename_scope_runme.js
index c0226df69..fea4d2ca9 100644
--- a/Examples/test-suite/javascript/rename_scope_runme.js
+++ b/Examples/test-suite/javascript/rename_scope_runme.js
@@ -1,4 +1,4 @@
-var rename_scope = require("./rename_scope");
+var rename_scope = require("rename_scope");
var a = new rename_scope.Natural_UP();
var b = new rename_scope.Natural_BP();
diff --git a/Examples/test-suite/javascript/rename_simple_runme.js b/Examples/test-suite/javascript/rename_simple_runme.js
index 918dd68a5..21350cd3e 100644
--- a/Examples/test-suite/javascript/rename_simple_runme.js
+++ b/Examples/test-suite/javascript/rename_simple_runme.js
@@ -1,4 +1,4 @@
-var rename_simple = require("./rename_simple");
+var rename_simple = require("rename_simple");
var NewStruct = rename_simple.NewStruct;
var s = new NewStruct();
diff --git a/Examples/test-suite/javascript/ret_by_value_runme.js b/Examples/test-suite/javascript/ret_by_value_runme.js
index d9a77a20b..9d0840602 100644
--- a/Examples/test-suite/javascript/ret_by_value_runme.js
+++ b/Examples/test-suite/javascript/ret_by_value_runme.js
@@ -1,4 +1,4 @@
-var ret_by_value = require("./ret_by_value");
+var ret_by_value = require("ret_by_value");
a = ret_by_value.get_test();
if (a.myInt != 100)
diff --git a/Examples/test-suite/javascript/setup_test.sh b/Examples/test-suite/javascript/setup_test.sh
deleted file mode 100644
index 913a74c4b..000000000
--- a/Examples/test-suite/javascript/setup_test.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-if [ ! -d $1 ]; then
- mkdir $1;
-fi
-sed -e "s/\$testcase/$1/" -e "s/\$cflags/$2/" < node_template/binding.gyp.in > $1/binding.gyp
-sed s/\$testcase/$1/ node_template/index.js.in > $1/index.js
diff --git a/Examples/test-suite/javascript/string_simple_runme.js b/Examples/test-suite/javascript/string_simple_runme.js
index dbdd4136d..39ae84e9e 100644
--- a/Examples/test-suite/javascript/string_simple_runme.js
+++ b/Examples/test-suite/javascript/string_simple_runme.js
@@ -1,4 +1,4 @@
-var string_simple = require("./string_simple");
+var string_simple = require("string_simple");
// Test unicode string
var str = "olé";
diff --git a/Examples/test-suite/javascript/struct_value_runme.js b/Examples/test-suite/javascript/struct_value_runme.js
index d6b26f726..5b171b8fe 100644
--- a/Examples/test-suite/javascript/struct_value_runme.js
+++ b/Examples/test-suite/javascript/struct_value_runme.js
@@ -1,4 +1,4 @@
-var struct_value = require("./struct_value");
+var struct_value = require("struct_value");
b = new struct_value.Bar();
diff --git a/Examples/test-suite/javascript/template_static_runme.js b/Examples/test-suite/javascript/template_static_runme.js
index 477d97249..d6106138a 100644
--- a/Examples/test-suite/javascript/template_static_runme.js
+++ b/Examples/test-suite/javascript/template_static_runme.js
@@ -1,3 +1,3 @@
-var template_static = require("./template_static");
+var template_static = require("template_static");
template_static.Foo.bar_double(1);
diff --git a/Examples/test-suite/javascript/typedef_class_runme.js b/Examples/test-suite/javascript/typedef_class_runme.js
index 3e4dc9093..64e0051c3 100644
--- a/Examples/test-suite/javascript/typedef_class_runme.js
+++ b/Examples/test-suite/javascript/typedef_class_runme.js
@@ -1,4 +1,4 @@
-var typedef_class = require("./typedef_class");
+var typedef_class = require("typedef_class");
a = new typedef_class.RealA();
a.a = 3;
diff --git a/Examples/test-suite/javascript/typedef_inherit_runme.js b/Examples/test-suite/javascript/typedef_inherit_runme.js
index 4abcc2536..7590e1e6e 100644
--- a/Examples/test-suite/javascript/typedef_inherit_runme.js
+++ b/Examples/test-suite/javascript/typedef_inherit_runme.js
@@ -1,4 +1,4 @@
-var typedef_inherit = require("./typedef_inherit");
+var typedef_inherit = require("typedef_inherit");
a = new typedef_inherit.Foo();
b = new typedef_inherit.Bar();
diff --git a/Examples/test-suite/javascript/typedef_scope_runme.js b/Examples/test-suite/javascript/typedef_scope_runme.js
index 0ac56884c..5c1368ab7 100644
--- a/Examples/test-suite/javascript/typedef_scope_runme.js
+++ b/Examples/test-suite/javascript/typedef_scope_runme.js
@@ -1,4 +1,4 @@
-var typedef_scope = require("./typedef_scope");
+var typedef_scope = require("typedef_scope");
b = new typedef_scope.Bar();
x = b.test1(42,"hello");
diff --git a/Examples/test-suite/javascript/typemap_arrays_runme.js b/Examples/test-suite/javascript/typemap_arrays_runme.js
index cd6827ac9..610ecdd9c 100644
--- a/Examples/test-suite/javascript/typemap_arrays_runme.js
+++ b/Examples/test-suite/javascript/typemap_arrays_runme.js
@@ -1,4 +1,4 @@
-var typemap_arrays = require("./typemap_arrays");
+var typemap_arrays = require("typemap_arrays");
if (typemap_arrays.sumA(null) != 60)
throw "RuntimeError, Sum is wrong";
diff --git a/Examples/test-suite/javascript/typemap_delete_runme.js b/Examples/test-suite/javascript/typemap_delete_runme.js
index 4b3174956..1d42ce4da 100644
--- a/Examples/test-suite/javascript/typemap_delete_runme.js
+++ b/Examples/test-suite/javascript/typemap_delete_runme.js
@@ -1,4 +1,4 @@
-var typemap_delete = require("./typemap_delete");
+var typemap_delete = require("typemap_delete");
r = new typemap_delete.Rect(123);
if (r.val != 123)
diff --git a/Examples/test-suite/javascript/typemap_namespace_runme.js b/Examples/test-suite/javascript/typemap_namespace_runme.js
index 614e0ffeb..2aa358024 100644
--- a/Examples/test-suite/javascript/typemap_namespace_runme.js
+++ b/Examples/test-suite/javascript/typemap_namespace_runme.js
@@ -1,4 +1,4 @@
-var typemap_namespace = require("./typemap_namespace");
+var typemap_namespace = require("typemap_namespace");
if (typemap_namespace.test1("hello") != "hello")
throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/typemap_ns_using_runme.js b/Examples/test-suite/javascript/typemap_ns_using_runme.js
index 9115c16ae..7e4019ab2 100644
--- a/Examples/test-suite/javascript/typemap_ns_using_runme.js
+++ b/Examples/test-suite/javascript/typemap_ns_using_runme.js
@@ -1,4 +1,4 @@
-var typemap_ns_using = require("./typemap_ns_using");
+var typemap_ns_using = require("typemap_ns_using");
if (typemap_ns_using.spam(37) != 37)
throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/using1_runme.js b/Examples/test-suite/javascript/using1_runme.js
index a2e37fcb6..2415156f0 100644
--- a/Examples/test-suite/javascript/using1_runme.js
+++ b/Examples/test-suite/javascript/using1_runme.js
@@ -1,4 +1,4 @@
-var using1 = require("./using1");
+var using1 = require("using1");
if (using1.spam(37) != 37)
throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/using2_runme.js b/Examples/test-suite/javascript/using2_runme.js
index aa5e9b15f..2ef08faca 100644
--- a/Examples/test-suite/javascript/using2_runme.js
+++ b/Examples/test-suite/javascript/using2_runme.js
@@ -1,4 +1,4 @@
-var using2 = require("./using2");
+var using2 = require("using2");
if (using2.spam(37) != 37)
throw "RuntimeError";
diff --git a/Examples/test-suite/javascript/varargs_runme.js b/Examples/test-suite/javascript/varargs_runme.js
index 69d761e63..fc6d945c1 100644
--- a/Examples/test-suite/javascript/varargs_runme.js
+++ b/Examples/test-suite/javascript/varargs_runme.js
@@ -1,4 +1,4 @@
-var varargs = require("./varargs");
+var varargs = require("varargs");
if (varargs.test("Hello") != "Hello") {
throw new Error("Failed");
diff --git a/Examples/test-suite/kwargs_feature.i b/Examples/test-suite/kwargs_feature.i
index 87153109a..a935b25f3 100644
--- a/Examples/test-suite/kwargs_feature.i
+++ b/Examples/test-suite/kwargs_feature.i
@@ -1,7 +1,7 @@
%module kwargs_feature
%nocopyctor;
-%kwargs;
+%feature("kwargs");
%rename(myDel) del;
%inline
@@ -35,9 +35,7 @@
virtual ~Foo() {
}
-
};
-
%}
@@ -64,8 +62,7 @@
// Functions
%inline %{
- int foo(int a = 1, int b = 0) {return a + b; }
-
+ int foo_fn(int a = 1, int b = 0) {return a + b; }
template<typename T> T templatedfunction(T a = 1, T b = 0) { return a + b; }
%}
@@ -73,10 +70,8 @@
%template(templatedfunction) templatedfunction<int>;
-// Deafult args with references
-%inline
-%{
-
+// Default args with references
+%inline %{
typedef int size_type;
struct Hello
@@ -84,13 +79,10 @@
static const size_type hello = 3;
};
-
-
int rfoo( const size_type& x = Hello::hello, const Hello& y = Hello() )
{
return x;
}
-
%}
%{
const int Hello::hello;
@@ -104,9 +96,7 @@
int foo_kw(int from = 1, int except = 2) {return from + except; }
-
int foo_nu(int from = 1, int = 0) {return from; }
int foo_mm(int min = 1, int max = 2) {return min + max; }
-
%}
diff --git a/Examples/test-suite/li_boost_intrusive_ptr.i b/Examples/test-suite/li_boost_intrusive_ptr.i
index 4916d0285..c3b211208 100644
--- a/Examples/test-suite/li_boost_intrusive_ptr.i
+++ b/Examples/test-suite/li_boost_intrusive_ptr.i
@@ -6,6 +6,9 @@
// count the instances of intrusive_ptr. Uncomment the INTRUSIVE_PTR_WRAPPER macro to turn this on.
//
// Also note the debug_shared flag which can be set from the target language.
+//
+// Usage of intrusive_ptr_add_ref and intrusive_ptr_release based on boost testing:
+// http://www.boost.org/doc/libs/1_36_0/libs/smart_ptr/test/intrusive_ptr_test.cpp
%module li_boost_intrusive_ptr
@@ -13,10 +16,10 @@
%warnfilter(SWIGWARN_LANG_SMARTPTR_MISSING) KlassDerived;
%warnfilter(SWIGWARN_LANG_SMARTPTR_MISSING) KlassDerivedDerived;
-%{
-template<typename T> void intrusive_ptr_add_ref(const T* r) { r->addref(); }
-template<typename T> void intrusive_ptr_release(const T* r) { r->release(); }
+%ignore intrusive_ptr_add_ref;
+%ignore intrusive_ptr_release;
+%{
#include <boost/shared_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/detail/atomic_count.hpp>
@@ -132,6 +135,8 @@ struct Klass {
void release(void) const { if (--count == 0) delete this; }
int use_count(void) const { return count; }
static long getTotal_count() { return total_count; }
+ friend void intrusive_ptr_add_ref(const Klass* r) { r->addref(); }
+ friend void intrusive_ptr_release(const Klass* r) { r->release(); }
private:
static void increment() { ++total_count; if (debug_shared) cout << " ++xxxxx Klass::increment tot: " << total_count << endl;}
@@ -177,6 +182,8 @@ struct IgnoredRefCountingBase {
void addref(void) const { ++count; }
void release(void) const { if (--count == 0) delete this; }
int use_count(void) const { return count; }
+ inline friend void intrusive_ptr_add_ref(const IgnoredRefCountingBase* r) { r->addref(); }
+ inline friend void intrusive_ptr_release(const IgnoredRefCountingBase* r) { r->release(); }
static long getTotal_count() { return total_count; }
private:
@@ -414,6 +421,8 @@ template <class T1, class T2> struct Base {
void addref(void) const { count++; }
void release(void) const { if (--count == 0) delete this; }
int use_count(void) const { return count; }
+ inline friend void intrusive_ptr_add_ref(const Base<T1, T2>* r) { r->addref(); }
+ inline friend void intrusive_ptr_release(const Base<T1, T2>* r) { r->release(); }
};
%}
diff --git a/Examples/test-suite/li_std_except_as_class.i b/Examples/test-suite/li_std_except_as_class.i
index 0400c9a82..01ed1f07c 100644
--- a/Examples/test-suite/li_std_except_as_class.i
+++ b/Examples/test-suite/li_std_except_as_class.i
@@ -23,3 +23,11 @@ void test_domain_error() throw(std::domain_error)
%include <std_except.i>
void test_domain_error() throw(std::domain_error)
{ throw std::domain_error("std::domain_error"); }
+
+%inline %{
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+%}
diff --git a/Examples/test-suite/li_std_string_extra.i b/Examples/test-suite/li_std_string_extra.i
index aa758532a..6bef12ff4 100644
--- a/Examples/test-suite/li_std_string_extra.i
+++ b/Examples/test-suite/li_std_string_extra.i
@@ -49,6 +49,12 @@ std::basic_string<char,std::char_traits<char>,std::allocator<char> > test_value_
return x;
}
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+
%}
%include "li_std_string.i"
diff --git a/Examples/test-suite/li_std_wstring.i b/Examples/test-suite/li_std_wstring.i
index e0ecde53b..80f860338 100644
--- a/Examples/test-suite/li_std_wstring.i
+++ b/Examples/test-suite/li_std_wstring.i
@@ -92,6 +92,12 @@ void test_throw() throw(std::wstring){
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+
%}
diff --git a/Examples/test-suite/li_swigtype_inout.i b/Examples/test-suite/li_swigtype_inout.i
index 9d7e9a4c6..136c9fa9e 100644
--- a/Examples/test-suite/li_swigtype_inout.i
+++ b/Examples/test-suite/li_swigtype_inout.i
@@ -13,28 +13,28 @@
#include <iostream>
struct XXX {
XXX(int v) : value(v) {
- if (debug) std::cout << "Default Constructor " << value << " " << this << std::endl;
+ if (debugging) std::cout << "Default Constructor " << value << " " << this << std::endl;
count++;
}
XXX(const XXX &other) {
value = other.value;
- if (debug) std::cout << "Copy Constructor " << value << " " << this << std::endl;
+ if (debugging) std::cout << "Copy Constructor " << value << " " << this << std::endl;
count++;
}
XXX& operator=(const XXX &other) {
value = other.value;
- if (debug) std::cout << "Assignment operator " << value << " " << this << std::endl;
+ if (debugging) std::cout << "Assignment operator " << value << " " << this << std::endl;
return *this;
}
~XXX() {
- if (debug) std::cout << "Destructor " << value << " " << this << std::endl;
+ if (debugging) std::cout << "Destructor " << value << " " << this << std::endl;
count--;
}
void showInfo() {
- if (debug) std::cout << "Info " << value << " " << this << std::endl;
+ if (debugging) std::cout << "Info " << value << " " << this << std::endl;
}
int value;
- static const bool debug = false;
+ static const bool debugging = false;
static int count;
};
int XXX::count = 0;
diff --git a/Examples/test-suite/lua/Makefile.in b/Examples/test-suite/lua/Makefile.in
index 66a0d2da9..c562f09df 100644
--- a/Examples/test-suite/lua/Makefile.in
+++ b/Examples/test-suite/lua/Makefile.in
@@ -5,6 +5,7 @@
LANGUAGE = lua
LUA = @LUABIN@
SCRIPTSUFFIX = _runme.lua
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -28,7 +29,7 @@ LIBS = -L.
lua_no_module_global.%: SWIGOPT += -nomoduleglobal
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -38,7 +39,7 @@ lua_no_module_global.%: SWIGOPT += -nomoduleglobal
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -46,19 +47,19 @@ lua_no_module_global.%: SWIGOPT += -nomoduleglobal
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lua appended after the testcase name.
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LUA_PATH="$(srcdir)/?.lua;" $(RUNTOOL) $(LUA) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LUA_PATH="$(srcdir)/?.lua;" $(RUNTOOL) $(LUA) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we dont generate extra lua code)
%.clean:
-
+ @exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile lua_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" lua_clean
cvsignore:
@echo '*wrap* *.so *.dll *.exp *.lib'
@echo Makefile
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.lua; done
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.lua CVS/Entries ; then echo $${i}_runme.lua; fi; done
+ @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.lua; done
+ @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.lua CVS/Entries ; then echo $${i}_runme.lua; fi; done
diff --git a/Examples/test-suite/lua/cpp11_strongly_typed_enumerations_runme.lua b/Examples/test-suite/lua/cpp11_strongly_typed_enumerations_runme.lua
new file mode 100644
index 000000000..983e25aa2
--- /dev/null
+++ b/Examples/test-suite/lua/cpp11_strongly_typed_enumerations_runme.lua
@@ -0,0 +1,174 @@
+require("import") -- the import fn
+import("cpp11_strongly_typed_enumerations") -- import lib
+
+-- catch "undefined" global variables
+local env = _ENV -- Lua 5.2
+if not env then env = getfenv () end -- Lua 5.1
+setmetatable(env, {__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
+
+function enumCheck(actual, expected)
+ if not (actual == expected) then
+ error("Enum value mismatch. Expected: "..expected.." Actual: "..actual)
+ end
+ return expected + 1
+end
+
+--val = 0
+--val = enumCheck(cpp11_strongly_typed_enumerations.cpp11_strongly_typed_enumerations.Enum1_Val1, val)
+local val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val1, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val2, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val3, 13)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val4, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val5a, 13)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val6a, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val1, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val2, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val3, 23)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val4, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val5b, 23)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val6b, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Val1, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Val2, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Val3, 43)
+val = enumCheck(cpp11_strongly_typed_enumerations.Val4, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val1, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val2, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val3, 53)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val4, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val1, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val2, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val3, 63)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val4, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val1, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val2, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val3, 73)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val4, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val1, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val2, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val3, 83)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val4, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val1, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val2, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val3, 103)
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val4, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val1, 1121)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val2, 1122)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val3, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val4, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c, 1121)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val6c, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val1, 1131)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val2, 1132)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val3, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val4, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val5d, 1131)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val6d, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val1, 1141)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val2, 1142)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val3, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val4, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val5e, 1141)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val6e, val)
+
+-- Requires nested class support to work
+--val = 0
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val1, 3121)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val2, 3122)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val3, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val4, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val5f, 3121)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val6f, val)
+--
+--val = 0
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val1, 3131)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val2, 3132)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val3, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val4, val)
+--
+--val = 0
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val1, 3141)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val2, 3142)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val3, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val4, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val5g, 3141)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val6g, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val1, 2121)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val2, 2122)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val3, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val4, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val5h, 2121)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val6h, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val1, 2131)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val2, 2132)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val3, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val4, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val5i, 2131)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val6i, val)
+
+val = 0
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val1, 2141)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val2, 2142)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val3, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val4, val)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val5j, 2141)
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val6j, val)
+
+-- Requires nested class support to work
+--val = 0
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val1, 4121)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val2, 4122)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val3, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val4, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val5k, 4121)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val6k, val)
+--
+--val = 0
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val1, 4131)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val2, 4132)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val3, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val4, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val5l, 4131)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val6l, val)
+--
+--val = 0
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val1, 4141)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val2, 4142)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val3, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val4, val)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val5m, 4141)
+--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val6m, val)
+
+class1 = cpp11_strongly_typed_enumerations.Class1()
+enumCheck(class1:class1Test1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13)
+enumCheck(class1:class1Test2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121)
+--enumCheck(class1:class1Test3(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val5f), 3121)
+
+enumCheck(cpp11_strongly_typed_enumerations.globalTest1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13)
+enumCheck(cpp11_strongly_typed_enumerations.globalTest2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121)
+--enumCheck(globalTest3(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val5f), 3121)
+
diff --git a/Examples/test-suite/lua/cpp_basic_runme.lua b/Examples/test-suite/lua/cpp_basic_runme.lua
index c7e0325c5..5a0e1c699 100644
--- a/Examples/test-suite/lua/cpp_basic_runme.lua
+++ b/Examples/test-suite/lua/cpp_basic_runme.lua
@@ -86,3 +86,14 @@ f4_name = tostring(f4)
assert( f2_name == "Foo" )
assert( f3_name == "Foo" )
assert( f4_name == "FooSubSub" )
+
+-- Test __eq implementation supplied by default
+
+-- eq_f1 and eq_f2 must be different userdata with same Foo* pointer. If eq_f1 and eq_f2 are the same userdata (e.g.)
+-- > eq_f1 = smth
+-- > eq_f2 = eq_f1
+-- then default Lua equality comparison kicks in and considers them equal. Access to global_fptr is actually a
+-- function call (internally) and it returns new userdata each time.
+eq_f1 = cb.Bar.global_fptr
+eq_f2 = cb.Bar.global_fptr
+assert( eq_f1 == eq_f2 )
diff --git a/Examples/test-suite/lua/equality_runme.lua b/Examples/test-suite/lua/equality_runme.lua
new file mode 100644
index 000000000..cadbede0a
--- /dev/null
+++ b/Examples/test-suite/lua/equality_runme.lua
@@ -0,0 +1,47 @@
+require("import") -- the import fn
+import("equality") -- import code
+eq=equality -- renaming import
+
+-- catch "undefined" global variables
+local env = _ENV -- Lua 5.2
+if not env then env = getfenv () end -- Lua 5.1
+setmetatable(env, {__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
+
+-- === No equality operator ===
+
+-- logically same data without equality operator are not equal
+p1 = eq.MakePoint(10,9);
+p2 = eq.MakePoint(10,9);
+
+assert( p1 ~= p2 );
+
+-- different wrappers for same Point* are equal
+p3 = eq.GetZeroPointPtr()
+p4 = eq.GetZeroPointPtr()
+
+assert( p3 == p4 )
+
+
+-- === Logically correct equality operator ===
+
+ed1 = eq.EqualOpDefined(10)
+ed2 = eq.EqualOpDefined(10)
+ed3 = eq.EqualOpDefined(15)
+
+assert( ed1 == ed2 )
+assert( ed1 ~= ed3 )
+
+
+-- === Logically incorrect equality operator ===
+
+ew1 = eq.EqualOpWrong()
+ew2 = eq.EqualOpWrong()
+
+assert( ew1 ~= ew2 );
+
+ew3 = eq.EqualOpWrong.GetStaticObject()
+ew4 = eq.EqualOpWrong.GetStaticObject()
+
+-- Even though these are pointers to same object, operator== overload should
+-- state that they are not equal
+assert( ew3 ~= ew4 )
diff --git a/Examples/test-suite/lua/operator_overload_runme.lua b/Examples/test-suite/lua/operator_overload_runme.lua
index 5ba06ff08..c34c09021 100644
--- a/Examples/test-suite/lua/operator_overload_runme.lua
+++ b/Examples/test-suite/lua/operator_overload_runme.lua
@@ -1,4 +1,4 @@
--- demo of lua swig capacilities (operator overloading)
+-- demo of lua swig capacities (operator overloading)
require("import") -- the import fn
import("operator_overload") -- import lib
@@ -33,7 +33,7 @@ assert(b>=c)
assert(b>d)
assert(b>=d)
--- lua does not support += operators: skiping
+-- lua does not support += operators: skipping
-- test +
f=Op(1)
@@ -50,7 +50,7 @@ assert(f/g==Op(1))
--lua 5.0.2 defines that unary - is __unm(self,nil)
--lua 5.1.2 defines that unary - is __unm(self,self)
---C++ expectes unary - as operator-()
+--C++ expects unary - as operator-()
--however the latest version of SWIG strictly checks the number of args
--and will complain if too many args are provided
--therefore disabling these tests for now
@@ -79,7 +79,7 @@ assert(tostring(Op(1))=="Op(1)")
assert(tostring(Op(-3))=="Op(-3)")
--- check that operator overloads are correctly propogated down inheritance hierarchy
+-- check that operator overloads are correctly propagated down inheritance hierarchy
a_d=OpDerived()
b_d=OpDerived(5)
diff --git a/Examples/test-suite/mzscheme/Makefile.in b/Examples/test-suite/mzscheme/Makefile.in
index fcaf33a48..da92f76fd 100644
--- a/Examples/test-suite/mzscheme/Makefile.in
+++ b/Examples/test-suite/mzscheme/Makefile.in
@@ -5,6 +5,7 @@
LANGUAGE = mzscheme
MZSCHEME = mzscheme
SCRIPTSUFFIX = _runme.scm
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -18,7 +19,7 @@ include $(srcdir)/../common.mk
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -28,7 +29,7 @@ include $(srcdir)/../common.mk
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -36,13 +37,13 @@ include $(srcdir)/../common.mk
# 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 $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(MZSCHEME) -r $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(MZSCHEME) -r $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:
-
+ @exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile mzscheme_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" mzscheme_clean
diff --git a/Examples/test-suite/nested_class.i b/Examples/test-suite/nested_class.i
index ccb7ecac1..fe405479c 100644
--- a/Examples/test-suite/nested_class.i
+++ b/Examples/test-suite/nested_class.i
@@ -49,6 +49,9 @@ struct Outer {
struct {
Integer b;
};
+#else
+ Integer a;
+ Integer b;
#endif
union {
@@ -164,6 +167,9 @@ struct Outer {
public:
Integer yy;
};
+#else
+ Integer xx;
+ Integer yy;
#endif
///////////////////////////////////////////
diff --git a/Examples/test-suite/nested_extend_c.i b/Examples/test-suite/nested_extend_c.i
new file mode 100644
index 000000000..64727b9ea
--- /dev/null
+++ b/Examples/test-suite/nested_extend_c.i
@@ -0,0 +1,102 @@
+%module nested_extend_c
+
+#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8)
+%extend hiA {
+ hiA() {
+ union hiA *self = (union hiA *)malloc(sizeof(union hiA));
+ self->c = 'h';
+ return self;
+ }
+ char hi_extend() {
+ return $self->c;
+ }
+ static const long swig_size = sizeof(union hiA);
+}
+%extend lowA {
+ lowA() {
+ struct lowA *self = (struct lowA *)malloc(sizeof(struct lowA));
+ self->name = 0;
+ self->num = 99;
+ return self;
+ }
+ int low_extend() {
+ return $self->num;
+ }
+ static const long swig_size = sizeof(struct lowA);
+}
+
+%extend hiB {
+ hiB() {
+ union hiB *self = (union hiB *)malloc(sizeof(union hiB));
+ self->c = 'h';
+ return self;
+ }
+ char hi_extend() {
+ return $self->c;
+ }
+ static const long swig_size = sizeof(union hiB);
+}
+%extend lowB {
+ lowB() {
+ struct lowB *self = (struct lowB *)malloc(sizeof(struct lowB));
+ self->name = 0;
+ self->num = 99;
+ return self;
+ }
+ int low_extend() {
+ return $self->num;
+ }
+ static const long swig_size = sizeof(struct lowB);
+}
+
+%extend FOO_bar {
+ void bar_extend() {
+ $self->d = 1;
+ }
+};
+%extend NestedA {
+ static const long swig_size = sizeof(struct NestedA);
+}
+
+#endif
+
+%inline %{
+typedef struct NestedA {
+ int a;
+ union hiA {
+ char c;
+ int d;
+ } hiA_instance;
+
+ struct lowA {
+ char *name;
+ int num;
+ } lowA_instance;
+} NestedA;
+
+typedef struct {
+ int a;
+ union hiB {
+ char c;
+ int d;
+ } hiB_instance;
+
+ struct lowB {
+ char *name;
+ int num;
+ } lowB_instance;
+} NestedB;
+
+typedef struct {
+ int a;
+ union {
+ char c;
+ int d;
+ } bar;
+} FOO;
+
+struct {
+ int i;
+} THING;
+%}
+
diff --git a/Examples/test-suite/nested_scope.i b/Examples/test-suite/nested_scope.i
index 789478361..bd66eec73 100644
--- a/Examples/test-suite/nested_scope.i
+++ b/Examples/test-suite/nested_scope.i
@@ -26,4 +26,42 @@ namespace ns {
#endif
};
}
+ class Outer1 {
+ struct Nested1;
+ public:
+ struct Nested2;
+#ifdef __clang__
+ struct Nested2 {
+ int data;
+ };
+#endif
+ template <class T> class AbstractClass;
+ class Real;
+ };
+#ifndef __clang__
+ struct Outer1::Nested2 {
+ int data;
+ };
+#endif
+
+ class Klass {
+ public:
+ template <class T> class AbstractClass;
+ class Real;
+ };
+
+ template <class T> class Klass::AbstractClass {
+ public:
+ virtual void Method() = 0;
+ virtual ~AbstractClass() {}
+ };
+%}
+
+%template(abstract_int) Klass::AbstractClass <int>;
+
+%inline %{
+ class Klass::Real : public AbstractClass <int> {
+ public:
+ virtual void Method() {}
+ };
%}
diff --git a/Examples/test-suite/nested_template_base.i b/Examples/test-suite/nested_template_base.i
new file mode 100644
index 000000000..0b0272224
--- /dev/null
+++ b/Examples/test-suite/nested_template_base.i
@@ -0,0 +1,38 @@
+%module nested_template_base
+
+%inline %{
+ template <class T> class OuterT {
+ public:
+ T outer(T t) { return t; }
+ };
+%}
+
+// The %template goes after OuterT and before OuterC as OuterC::InnerC's base is handled inside OuterC
+%template(OuterTInnerS) OuterT<OuterC::InnerS>;
+
+#if !defined(SWIGCSHARP) && !defined(SWIGJAVA)
+%feature("flatnested") OuterC::InnerS;
+%feature("flatnested") OuterC::InnerC;
+#endif
+
+
+%inline %{
+ class OuterC {
+ public:
+ struct InnerS;
+ class InnerC;
+ };
+
+ struct OuterC::InnerS {
+ int val;
+ InnerS(int val = 0) : val(val) {}
+ };
+
+
+ class OuterC::InnerC : public OuterT<InnerS> {
+ public:
+ OuterT<InnerS>& innerc() {
+ return *this;
+ }
+ };
+%}
diff --git a/Examples/test-suite/ocaml/Makefile.in b/Examples/test-suite/ocaml/Makefile.in
index f16c3da95..9a4e008b9 100644
--- a/Examples/test-suite/ocaml/Makefile.in
+++ b/Examples/test-suite/ocaml/Makefile.in
@@ -6,22 +6,23 @@ LANGUAGE = ocaml
OCAMLC = ocamlc
VARIANT = _static
SCRIPTSUFFIX = _runme.ml
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-C_TEST_CASES =
+C_TEST_CASES =
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) -a \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) -a \
-f $(top_srcdir)/Examples/test-suite/$*.list ] ; then \
- $(COMPILETOOL) $(OCAMLC) -c $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ $(COMPILETOOL) $(OCAMLC) -c $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
$(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme `cat $(top_srcdir)/Examples/test-suite/$(*).list | sed -e 's/\(.*\)/\1_wrap.o \1.cmo/g'`&& $(RUNTOOL) ./runme; \
- elif [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- $(COMPILETOOL) $(OCAMLC) -c $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ elif [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ $(COMPILETOOL) $(OCAMLC) -c $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
$(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme $(srcdir)/$(*).cmo $(srcdir)/$(*)_runme.cmo $(srcdir)/$(*)_wrap.o && \
$(RUNTOOL) ./runme; \
- fi ;
+ fi ;
check_quant:
cat /dev/null > testing
@@ -80,4 +81,4 @@ include $(srcdir)/../common.mk
@rm -f $*.ml $*.mli;
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile ocaml_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" ocaml_clean
diff --git a/Examples/test-suite/ocaml/makedebugtop b/Examples/test-suite/ocaml/makedebugtop
index d51439a75..d51439a75 100755..100644
--- a/Examples/test-suite/ocaml/makedebugtop
+++ b/Examples/test-suite/ocaml/makedebugtop
diff --git a/Examples/test-suite/octave/Makefile.in b/Examples/test-suite/octave/Makefile.in
index dc309e8c6..fbffd240c 100644
--- a/Examples/test-suite/octave/Makefile.in
+++ b/Examples/test-suite/octave/Makefile.in
@@ -5,6 +5,7 @@
LANGUAGE = octave
OCTAVE = @OCTAVE@
SCRIPTSUFFIX = _runme.m
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -21,7 +22,7 @@ CPP_TEST_BROKEN += \
li_std_set \
li_std_stream
-#C_TEST_CASES +=
+#C_TEST_CASES +=
#
# This test only works with modern C compilers
@@ -33,13 +34,13 @@ include $(srcdir)/../common.mk
# Overridden variables here
LIBS = -L.
-CSRCS = $(srcdir)/octave_empty.c
+CSRCS = octave_empty.c
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -49,7 +50,7 @@ CSRCS = $(srcdir)/octave_empty.c
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -57,8 +58,8 @@ CSRCS = $(srcdir)/octave_empty.c
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.m appended after the testcase name.
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVE_PATH=$(srcdir):$$OCTAVE_PATH $(RUNTOOL) $(OCTAVE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVE_PATH=$(srcdir):$$OCTAVE_PATH $(RUNTOOL) $(OCTAVE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: remove the generated .m file
@@ -67,18 +68,18 @@ run_testcase = \
@rm -f $*.m;
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile octave_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" octave_clean
cvsignore:
@echo '*wrap* *.mc *.so *.dll *.exp *.lib'
@echo Makefile
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.m; done
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.m CVS/Entries ; then echo $${i}_runme.m; fi; done
- @echo clientdata_prop_a.m
- @echo clientdata_prop_b.m
- @echo imports_a.m
- @echo imports_b.m
- @echo mod_a.m mod_b.m
+ @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.m; done
+ @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.m CVS/Entries ; then echo $${i}_runme.m; fi; done
+ @echo clientdata_prop_a.m
+ @echo clientdata_prop_b.m
+ @echo imports_a.m
+ @echo imports_b.m
+ @echo mod_a.m mod_b.m
@echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.m hugemod_b.m hugemod_runme.m
@echo template_typedef_import.m
diff --git a/Examples/test-suite/octave/cpp11_strongly_typed_enumerations_runme.m b/Examples/test-suite/octave/cpp11_strongly_typed_enumerations_runme.m
new file mode 100644
index 000000000..f66d3d569
--- /dev/null
+++ b/Examples/test-suite/octave/cpp11_strongly_typed_enumerations_runme.m
@@ -0,0 +1,166 @@
+cpp11_strongly_typed_enumerations
+
+function newvalue = enumCheck(actual, expected)
+ if (actual != expected);
+ error("Enum value mismatch. Expected: %d Actual: %d", expected, actual);
+ endif
+ newvalue = expected + 1;
+end
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val3, 13);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val5a, 13);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val6a, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val3, 23);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val5b, 23);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val6b, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Val3, 43);
+val = enumCheck(cpp11_strongly_typed_enumerations.Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val3, 53);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val3, 63);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val3, 73);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val3, 83);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val1, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val2, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val3, 103);
+val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val4, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val1, 1121);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val2, 1122);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val5c, 1121);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val6c, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val1, 1131);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val2, 1132);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val5d, 1131);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val6d, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val1, 1141);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val2, 1142);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val5e, 1141);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val6e, val);
+
+# Requires nested class support to work
+#val = 0;
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val1, 3121);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val2, 3122);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val3, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val4, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val5f, 3121);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val6f, val);
+#
+#val = 0;
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Val1, 3131);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Val2, 3132);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Val3, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Val4, val);
+#
+#val = 0;
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val1, 3141);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val2, 3142);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val3, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val4, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val5g, 3141);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val6g, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val1, 2121);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val2, 2122);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val5h, 2121);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val6h, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val1, 2131);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val2, 2132);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val5i, 2131);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val6i, val);
+
+val = 0;
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val1, 2141);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val2, 2142);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val3, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val4, val);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val5j, 2141);
+val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val6j, val);
+
+# Requires nested class support to work
+#val = 0;
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val1, 4121);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val2, 4122);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val3, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val4, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val5k, 4121);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val6k, val);
+#
+#val = 0;
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val1, 4131);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val2, 4132);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val3, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val4, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val5l, 4131);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val6l, val);
+#
+#val = 0;
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val1, 4141);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val2, 4142);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val3, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val4, val);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val5m, 4141);
+#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val6m, val);
+
+class1 = Class1();
+enumCheck(class1.class1Test1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13);
+enumCheck(class1.class1Test2(cpp11_strongly_typed_enumerations.Class1_Enum12_Val5c), 1121);
+#enumCheck(class1.class1Test3(cpp11_strongly_typed_enumerations.Class1_Struct1_Enum12_Val5f), 3121);
+
+enumCheck(cpp11_strongly_typed_enumerations.globalTest1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13);
+enumCheck(cpp11_strongly_typed_enumerations.globalTest2(cpp11_strongly_typed_enumerations.Class1_Enum12_Val5c), 1121);
+#enumCheck(globalTest3(cpp11_strongly_typed_enumerations.Class1_Struct1_Enum12_Val5f), 3121);
+
diff --git a/Examples/test-suite/octave/director_detect_runme.m b/Examples/test-suite/octave/director_detect_runme.m
index f2d8c8dd2..21925712a 100644
--- a/Examples/test-suite/octave/director_detect_runme.m
+++ b/Examples/test-suite/octave/director_detect_runme.m
@@ -1,7 +1,7 @@
director_detect
-global MyBar=@(val=2) \
- subclass(director_detect.Bar(),'val',val,@get_value,@get_class,@just_do_it,@clone);
+global MyBar=@(val=2) subclass(director_detect.Bar(),'val',val,@get_value,@get_class,@just_do_it,@clone);
+
function val=get_value(self)
self.val = self.val + 1;
val = self.val;
diff --git a/Examples/test-suite/octave/iadd_runme.m b/Examples/test-suite/octave/iadd_runme.m
index c386c669e..c386c669e 100755..100644
--- a/Examples/test-suite/octave/iadd_runme.m
+++ b/Examples/test-suite/octave/iadd_runme.m
diff --git a/Examples/test-suite/octave/overload_complicated_runme.m b/Examples/test-suite/octave/overload_complicated_runme.m
index 0313be954..0313be954 100755..100644
--- a/Examples/test-suite/octave/overload_complicated_runme.m
+++ b/Examples/test-suite/octave/overload_complicated_runme.m
diff --git a/Examples/test-suite/overload_polymorphic.i b/Examples/test-suite/overload_polymorphic.i
new file mode 100644
index 000000000..a1f123b9d
--- /dev/null
+++ b/Examples/test-suite/overload_polymorphic.i
@@ -0,0 +1,22 @@
+%module overload_polymorphic
+
+%inline %{
+
+class Base {
+public:
+ Base(){}
+ virtual ~Base(){}
+};
+
+class Derived : public Base {
+public:
+ Derived(){}
+ virtual ~Derived(){}
+};
+
+
+
+int test(Base* base){ return 0;}
+int test(int hello){ return 1; }
+
+%}
diff --git a/Examples/test-suite/perl5/Makefile.in b/Examples/test-suite/perl5/Makefile.in
index 67eaf5c9a..ccd12d6e4 100644
--- a/Examples/test-suite/perl5/Makefile.in
+++ b/Examples/test-suite/perl5/Makefile.in
@@ -5,7 +5,8 @@
LANGUAGE = perl5
PERL = @PERL@
SCRIPTSUFFIX = _runme.pl
-TEST_RUNNER = run-perl-test.pl
+TEST_RUNNER = $(srcdir)/run-perl-test.pl
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -16,6 +17,7 @@ CPP_TEST_CASES += \
li_cstring \
li_cdata_carrays \
li_reference \
+ director_nestedmodule \
C_TEST_CASES += \
li_cdata \
@@ -31,7 +33,7 @@ include $(srcdir)/../common.mk
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -41,7 +43,7 @@ include $(srcdir)/../common.mk
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -49,8 +51,8 @@ include $(srcdir)/../common.mk
# 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 $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PERL) $(TEST_RUNNER) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PERL) $(TEST_RUNNER) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: remove the generated .pm file
@@ -58,4 +60,4 @@ run_testcase = \
@rm -f $*.pm;
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile perl5_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" perl5_clean
diff --git a/Examples/test-suite/perl5/char_binary_runme.pl b/Examples/test-suite/perl5/char_binary_runme.pl
index 4c50ee700..4c50ee700 100755..100644
--- a/Examples/test-suite/perl5/char_binary_runme.pl
+++ b/Examples/test-suite/perl5/char_binary_runme.pl
diff --git a/Examples/test-suite/perl5/class_ignore_runme.pl b/Examples/test-suite/perl5/class_ignore_runme.pl
index 989150c3f..989150c3f 100755..100644
--- a/Examples/test-suite/perl5/class_ignore_runme.pl
+++ b/Examples/test-suite/perl5/class_ignore_runme.pl
diff --git a/Examples/test-suite/perl5/contract_runme.pl b/Examples/test-suite/perl5/contract_runme.pl
index fb162e691..fb162e691 100755..100644
--- a/Examples/test-suite/perl5/contract_runme.pl
+++ b/Examples/test-suite/perl5/contract_runme.pl
diff --git a/Examples/test-suite/perl5/cpp11_strongly_typed_enumerations_runme.pl b/Examples/test-suite/perl5/cpp11_strongly_typed_enumerations_runme.pl
new file mode 100644
index 000000000..db19bbfa6
--- /dev/null
+++ b/Examples/test-suite/perl5/cpp11_strongly_typed_enumerations_runme.pl
@@ -0,0 +1,168 @@
+use strict;
+use warnings;
+use Test::More tests => 78;
+BEGIN { use_ok('cpp11_strongly_typed_enumerations') }
+require_ok('cpp11_strongly_typed_enumerations');
+
+sub enumCheck { my($actual, $expected) = @_;
+ is($actual, $expected);
+ return $expected + 1;
+}
+
+my $val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val1, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val2, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val3, 13);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val4, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val5a, 13);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val6a, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val1, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val2, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val3, 23);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val4, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val5b, 23);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val6b, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Val1, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Val2, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Val3, 43);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Val4, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum5_Val1, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum5_Val2, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum5_Val3, 53);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum5_Val4, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum6_Val1, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum6_Val2, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum6_Val3, 63);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum6_Val4, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum7td_Val1, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum7td_Val2, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum7td_Val3, 73);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum7td_Val4, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum8_Val1, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum8_Val2, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum8_Val3, 83);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum8_Val4, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum10_Val1, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum10_Val2, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum10_Val3, 103);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Enum10_Val4, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val1, 1121);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val2, 1122);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val3, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val4, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val5c, 1121);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val6c, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val1, 1131);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val2, 1132);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val3, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val4, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val5d, 1131);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val6d, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val1, 1141);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val2, 1142);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val3, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val4, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val5e, 1141);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val6e, $val);
+
+# Requires nested class support to work
+#$val = 0;
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val1, 3121);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val2, 3122);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val3, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val4, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val5f, 3121);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val6f, $val);
+#
+#$val = 0;
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Val1, 3131);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Val2, 3132);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Val3, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Val4, $val);
+#
+#$val = 0;
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val1, 3141);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val2, 3142);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val3, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val4, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val5g, 3141);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val6g, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val1, 2121);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val2, 2122);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val3, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val4, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val5h, 2121);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val6h, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val1, 2131);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val2, 2132);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val3, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val4, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val5i, 2131);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val6i, $val);
+
+$val = 0;
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val1, 2141);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val2, 2142);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val3, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val4, $val);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val5j, 2141);
+$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val6j, $val);
+
+# Requires nested class support to work
+#$val = 0;
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val1, 4121);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val2, 4122);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val3, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val4, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val5k, 4121);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val6k, $val);
+#
+#$val = 0;
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val1, 4131);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val2, 4132);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val3, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val4, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val5l, 4131);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val6l, $val);
+#
+#$val = 0;
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val1, 4141);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val2, 4142);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val3, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val4, $val);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val5m, 4141);
+#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val6m, $val);
+
+my $class1 = cpp11_strongly_typed_enumerations::Class1->new();
+enumCheck($class1->class1Test1($cpp11_strongly_typed_enumerations::Enum1_Val5a), 13);
+enumCheck($class1->class1Test2($cpp11_strongly_typed_enumerations::Class1::Enum12_Val5c), 1121);
+#enumCheck($class1->class1Test3($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val5f), 3121);
+
+enumCheck(cpp11_strongly_typed_enumerations::globalTest1($cpp11_strongly_typed_enumerations::Enum1_Val5a), 13);
+enumCheck(cpp11_strongly_typed_enumerations::globalTest2($cpp11_strongly_typed_enumerations::Class1::Enum12_Val5c), 1121);
+#enumCheck(cpp11_strongly_typed_enumerations::globalTest3($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val5f), 3121);
+
diff --git a/Examples/test-suite/perl5/enum_template_runme.pl b/Examples/test-suite/perl5/enum_template_runme.pl
index bdaaa8534..bdaaa8534 100755..100644
--- a/Examples/test-suite/perl5/enum_template_runme.pl
+++ b/Examples/test-suite/perl5/enum_template_runme.pl
diff --git a/Examples/test-suite/perl5/grouping_runme.pl b/Examples/test-suite/perl5/grouping_runme.pl
index 2009cce73..2009cce73 100755..100644
--- a/Examples/test-suite/perl5/grouping_runme.pl
+++ b/Examples/test-suite/perl5/grouping_runme.pl
diff --git a/Examples/test-suite/perl5/ignore_parameter_runme.pl b/Examples/test-suite/perl5/ignore_parameter_runme.pl
index 8e75e0b0e..8e75e0b0e 100755..100644
--- a/Examples/test-suite/perl5/ignore_parameter_runme.pl
+++ b/Examples/test-suite/perl5/ignore_parameter_runme.pl
diff --git a/Examples/test-suite/perl5/inherit_missing_runme.pl b/Examples/test-suite/perl5/inherit_missing_runme.pl
index bc2260215..bc2260215 100755..100644
--- a/Examples/test-suite/perl5/inherit_missing_runme.pl
+++ b/Examples/test-suite/perl5/inherit_missing_runme.pl
diff --git a/Examples/test-suite/perl5/li_std_except_runme.pl b/Examples/test-suite/perl5/li_std_except_runme.pl
index 59d3126ea..59d3126ea 100755..100644
--- a/Examples/test-suite/perl5/li_std_except_runme.pl
+++ b/Examples/test-suite/perl5/li_std_except_runme.pl
diff --git a/Examples/test-suite/perl5/minherit_runme.pl b/Examples/test-suite/perl5/minherit_runme.pl
index 1f3afadd2..1f3afadd2 100755..100644
--- a/Examples/test-suite/perl5/minherit_runme.pl
+++ b/Examples/test-suite/perl5/minherit_runme.pl
diff --git a/Examples/test-suite/perl5/naturalvar_runme.pl b/Examples/test-suite/perl5/naturalvar_runme.pl
index c0f972d68..c0f972d68 100755..100644
--- a/Examples/test-suite/perl5/naturalvar_runme.pl
+++ b/Examples/test-suite/perl5/naturalvar_runme.pl
diff --git a/Examples/test-suite/perl5/preproc_runme.pl b/Examples/test-suite/perl5/preproc_runme.pl
index 89e25f896..89e25f896 100755..100644
--- a/Examples/test-suite/perl5/preproc_runme.pl
+++ b/Examples/test-suite/perl5/preproc_runme.pl
diff --git a/Examples/test-suite/perl5/primitive_types_runme.pl b/Examples/test-suite/perl5/primitive_types_runme.pl
index 311c138e0..311c138e0 100755..100644
--- a/Examples/test-suite/perl5/primitive_types_runme.pl
+++ b/Examples/test-suite/perl5/primitive_types_runme.pl
diff --git a/Examples/test-suite/perl5/reference_global_vars_runme.pl b/Examples/test-suite/perl5/reference_global_vars_runme.pl
index 89d73b03d..89d73b03d 100755..100644
--- a/Examples/test-suite/perl5/reference_global_vars_runme.pl
+++ b/Examples/test-suite/perl5/reference_global_vars_runme.pl
diff --git a/Examples/test-suite/perl5/rename_scope_runme.pl b/Examples/test-suite/perl5/rename_scope_runme.pl
index 71c0cfc6f..71c0cfc6f 100755..100644
--- a/Examples/test-suite/perl5/rename_scope_runme.pl
+++ b/Examples/test-suite/perl5/rename_scope_runme.pl
diff --git a/Examples/test-suite/perl5/return_const_value_runme.pl b/Examples/test-suite/perl5/return_const_value_runme.pl
index 4b31c0b26..4b31c0b26 100755..100644
--- a/Examples/test-suite/perl5/return_const_value_runme.pl
+++ b/Examples/test-suite/perl5/return_const_value_runme.pl
diff --git a/Examples/test-suite/perl5/run-perl-test.pl b/Examples/test-suite/perl5/run-perl-test.pl
index 106bf002b..106bf002b 100755..100644
--- a/Examples/test-suite/perl5/run-perl-test.pl
+++ b/Examples/test-suite/perl5/run-perl-test.pl
diff --git a/Examples/test-suite/perl5/sizet_runme.pl b/Examples/test-suite/perl5/sizet_runme.pl
index 5f29773b3..5f29773b3 100755..100644
--- a/Examples/test-suite/perl5/sizet_runme.pl
+++ b/Examples/test-suite/perl5/sizet_runme.pl
diff --git a/Examples/test-suite/perl5/sneaky1_runme.pl b/Examples/test-suite/perl5/sneaky1_runme.pl
index 097d44678..097d44678 100755..100644
--- a/Examples/test-suite/perl5/sneaky1_runme.pl
+++ b/Examples/test-suite/perl5/sneaky1_runme.pl
diff --git a/Examples/test-suite/perl5/template_typedef_cplx2_runme.pl b/Examples/test-suite/perl5/template_typedef_cplx2_runme.pl
index e0a3003d2..e0a3003d2 100755..100644
--- a/Examples/test-suite/perl5/template_typedef_cplx2_runme.pl
+++ b/Examples/test-suite/perl5/template_typedef_cplx2_runme.pl
diff --git a/Examples/test-suite/perl5/typedef_class_runme.pl b/Examples/test-suite/perl5/typedef_class_runme.pl
index a7b88a771..a7b88a771 100755..100644
--- a/Examples/test-suite/perl5/typedef_class_runme.pl
+++ b/Examples/test-suite/perl5/typedef_class_runme.pl
diff --git a/Examples/test-suite/perl5/typename_runme.pl b/Examples/test-suite/perl5/typename_runme.pl
index 543080d8c..543080d8c 100755..100644
--- a/Examples/test-suite/perl5/typename_runme.pl
+++ b/Examples/test-suite/perl5/typename_runme.pl
diff --git a/Examples/test-suite/perl5/using1_runme.pl b/Examples/test-suite/perl5/using1_runme.pl
index 8551b6fc6..8551b6fc6 100755..100644
--- a/Examples/test-suite/perl5/using1_runme.pl
+++ b/Examples/test-suite/perl5/using1_runme.pl
diff --git a/Examples/test-suite/perl5/using2_runme.pl b/Examples/test-suite/perl5/using2_runme.pl
index 3a31bb364..3a31bb364 100755..100644
--- a/Examples/test-suite/perl5/using2_runme.pl
+++ b/Examples/test-suite/perl5/using2_runme.pl
diff --git a/Examples/test-suite/perl5/wrapmacro_runme.pl b/Examples/test-suite/perl5/wrapmacro_runme.pl
index 8e0154057..8e0154057 100755..100644
--- a/Examples/test-suite/perl5/wrapmacro_runme.pl
+++ b/Examples/test-suite/perl5/wrapmacro_runme.pl
diff --git a/Examples/test-suite/php/Makefile.in b/Examples/test-suite/php/Makefile.in
index fcdcac2b9..c3f8af5cb 100644
--- a/Examples/test-suite/php/Makefile.in
+++ b/Examples/test-suite/php/Makefile.in
@@ -4,11 +4,13 @@
LANGUAGE = php
SCRIPTSUFFIX = _runme.php
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
CPP_TEST_CASES += \
+ php_iterator \
php_namewarn_rename \
include $(srcdir)/../common.mk
@@ -29,7 +31,7 @@ missingctests:
missingtests: missingcpptests missingctests
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
+$(run_testcase)
@@ -39,7 +41,7 @@ missingtests: missingcpptests missingctests
+$(swig_and_compile_c)
+$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
+$(run_testcase)
@@ -56,15 +58,21 @@ missingtests: missingcpptests missingctests
# Runs the testcase. Tries to run testcase_runme.php, and if that's not
# found, runs testcase.php, except for multicpptests.
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL="$(RUNTOOL)" php_run; \
- elif [ -f $(srcdir)/$(SCRIPTPREFIX)$*.php -a ! -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(srcdir)/$(SCRIPTPREFIX)$*.php RUNTOOL="$(RUNTOOL)" php_run; \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL="$(RUNTOOL)" php_run; \
+ elif [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php -a ! -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php RUNTOOL="$(RUNTOOL)" php_run; \
fi
# Clean: remove the generated .php file
%.clean:
- @rm -f $*.php;
+ @rm -f $*.php php_$*.h
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile php_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" php_clean
+ rm -f clientdata_prop_a.php clientdata_prop_b.php php_clientdata_prop_a.h php_clientdata_prop_b.h
+ rm -f import_stl_a.php import_stl_b.php php_import_stl_a.h php_import_stl_b.h
+ rm -f imports_a.php imports_b.php php_imports_a.h php_imports_b.h
+ rm -f mod_a.php mod_b.php php_mod_a.h php_mod_b.h
+ rm -f multi_import_a.php multi_import_b.php php_multi_import_a.h php_multi_import_b.h
+ rm -f packageoption_a.php packageoption_b.php packageoption_c.php php_packageoption_a.h php_packageoption_b.h php_packageoption_c.h
diff --git a/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php b/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php
new file mode 100644
index 000000000..bee59b209
--- /dev/null
+++ b/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php
@@ -0,0 +1,169 @@
+<?php
+
+require "tests.php";
+require "cpp11_strongly_typed_enumerations.php";
+
+function enumCheck($actual, $expected) {
+ check::equal($actual, $expected, "Enum value mismatch");
+ return $expected + 1;
+}
+
+
+$val = 0;
+$val = enumCheck(Enum1_Val1, $val);
+$val = enumCheck(Enum1_Val2, $val);
+$val = enumCheck(Enum1_Val3, 13);
+$val = enumCheck(Enum1_Val4, $val);
+$val = enumCheck(Enum1_Val5a, 13);
+$val = enumCheck(Enum1_Val6a, $val);
+
+$val = 0;
+$val = enumCheck(Enum2_Val1, $val);
+$val = enumCheck(Enum2_Val2, $val);
+$val = enumCheck(Enum2_Val3, 23);
+$val = enumCheck(Enum2_Val4, $val);
+$val = enumCheck(Enum2_Val5b, 23);
+$val = enumCheck(Enum2_Val6b, $val);
+
+$val = 0;
+$val = enumCheck(Val1, $val);
+$val = enumCheck(Val2, $val);
+$val = enumCheck(Val3, 43);
+$val = enumCheck(Val4, $val);
+
+$val = 0;
+$val = enumCheck(Enum5_Val1, $val);
+$val = enumCheck(Enum5_Val2, $val);
+$val = enumCheck(Enum5_Val3, 53);
+$val = enumCheck(Enum5_Val4, $val);
+
+$val = 0;
+$val = enumCheck(Enum6_Val1, $val);
+$val = enumCheck(Enum6_Val2, $val);
+$val = enumCheck(Enum6_Val3, 63);
+$val = enumCheck(Enum6_Val4, $val);
+
+$val = 0;
+$val = enumCheck(Enum7td_Val1, $val);
+$val = enumCheck(Enum7td_Val2, $val);
+$val = enumCheck(Enum7td_Val3, 73);
+$val = enumCheck(Enum7td_Val4, $val);
+
+$val = 0;
+$val = enumCheck(Enum8_Val1, $val);
+$val = enumCheck(Enum8_Val2, $val);
+$val = enumCheck(Enum8_Val3, 83);
+$val = enumCheck(Enum8_Val4, $val);
+
+$val = 0;
+$val = enumCheck(Enum10_Val1, $val);
+$val = enumCheck(Enum10_Val2, $val);
+$val = enumCheck(Enum10_Val3, 103);
+$val = enumCheck(Enum10_Val4, $val);
+
+$val = 0;
+$val = enumCheck(Class1::Enum12_Val1, 1121);
+$val = enumCheck(Class1::Enum12_Val2, 1122);
+$val = enumCheck(Class1::Enum12_Val3, $val);
+$val = enumCheck(Class1::Enum12_Val4, $val);
+$val = enumCheck(Class1::Enum12_Val5c, 1121);
+$val = enumCheck(Class1::Enum12_Val6c, $val);
+
+$val = 0;
+$val = enumCheck(Class1::Val1, 1131);
+$val = enumCheck(Class1::Val2, 1132);
+$val = enumCheck(Class1::Val3, $val);
+$val = enumCheck(Class1::Val4, $val);
+$val = enumCheck(Class1::Val5d, 1131);
+$val = enumCheck(Class1::Val6d, $val);
+
+$val = 0;
+$val = enumCheck(Class1::Enum14_Val1, 1141);
+$val = enumCheck(Class1::Enum14_Val2, 1142);
+$val = enumCheck(Class1::Enum14_Val3, $val);
+$val = enumCheck(Class1::Enum14_Val4, $val);
+$val = enumCheck(Class1::Enum14_Val5e, 1141);
+$val = enumCheck(Class1::Enum14_Val6e, $val);
+
+# Requires nested class support to work
+#$val = 0;
+#$val = enumCheck(Class1::Struct1.Enum12_Val1, 3121);
+#$val = enumCheck(Class1::Struct1.Enum12_Val2, 3122);
+#$val = enumCheck(Class1::Struct1.Enum12_Val3, $val);
+#$val = enumCheck(Class1::Struct1.Enum12_Val4, $val);
+#$val = enumCheck(Class1::Struct1.Enum12_Val5f, 3121);
+#$val = enumCheck(Class1::Struct1.Enum12_Val6f, $val);
+#
+#$val = 0;
+#$val = enumCheck(Class1::Struct1.$val1, 3131);
+#$val = enumCheck(Class1::Struct1.$val2, 3132);
+#$val = enumCheck(Class1::Struct1.$val3, $val);
+#$val = enumCheck(Class1::Struct1.$val4, $val);
+#
+#$val = 0;
+#$val = enumCheck(Class1::Struct1.Enum14_Val1, 3141);
+#$val = enumCheck(Class1::Struct1.Enum14_Val2, 3142);
+#$val = enumCheck(Class1::Struct1.Enum14_Val3, $val);
+#$val = enumCheck(Class1::Struct1.Enum14_Val4, $val);
+#$val = enumCheck(Class1::Struct1.Enum14_Val5g, 3141);
+#$val = enumCheck(Class1::Struct1.Enum14_Val6g, $val);
+
+$val = 0;
+$val = enumCheck(Class2::Enum12_Val1, 2121);
+$val = enumCheck(Class2::Enum12_Val2, 2122);
+$val = enumCheck(Class2::Enum12_Val3, $val);
+$val = enumCheck(Class2::Enum12_Val4, $val);
+$val = enumCheck(Class2::Enum12_Val5h, 2121);
+$val = enumCheck(Class2::Enum12_Val6h, $val);
+
+$val = 0;
+$val = enumCheck(Class2::Val1, 2131);
+$val = enumCheck(Class2::Val2, 2132);
+$val = enumCheck(Class2::Val3, $val);
+$val = enumCheck(Class2::Val4, $val);
+$val = enumCheck(Class2::Val5i, 2131);
+$val = enumCheck(Class2::Val6i, $val);
+
+$val = 0;
+$val = enumCheck(Class2::Enum14_Val1, 2141);
+$val = enumCheck(Class2::Enum14_Val2, 2142);
+$val = enumCheck(Class2::Enum14_Val3, $val);
+$val = enumCheck(Class2::Enum14_Val4, $val);
+$val = enumCheck(Class2::Enum14_Val5j, 2141);
+$val = enumCheck(Class2::Enum14_Val6j, $val);
+
+# Requires nested class support to work
+#$val = 0;
+#$val = enumCheck(Class2::Struct1.Enum12_Val1, 4121);
+#$val = enumCheck(Class2::Struct1.Enum12_Val2, 4122);
+#$val = enumCheck(Class2::Struct1.Enum12_Val3, $val);
+#$val = enumCheck(Class2::Struct1.Enum12_Val4, $val);
+#$val = enumCheck(Class2::Struct1.Enum12_Val5k, 4121);
+#$val = enumCheck(Class2::Struct1.Enum12_Val6k, $val);
+#
+#$val = 0;
+#$val = enumCheck(Class2::Struct1.$val1, 4131);
+#$val = enumCheck(Class2::Struct1.$val2, 4132);
+#$val = enumCheck(Class2::Struct1.$val3, $val);
+#$val = enumCheck(Class2::Struct1.$val4, $val);
+#$val = enumCheck(Class2::Struct1.$val5l, 4131);
+#$val = enumCheck(Class2::Struct1.$val6l, $val);
+#
+#$val = 0;
+#$val = enumCheck(Class2::Struct1.Enum14_Val1, 4141);
+#$val = enumCheck(Class2::Struct1.Enum14_Val2, 4142);
+#$val = enumCheck(Class2::Struct1.Enum14_Val3, $val);
+#$val = enumCheck(Class2::Struct1.Enum14_Val4, $val);
+#$val = enumCheck(Class2::Struct1.Enum14_Val5m, 4141);
+#$val = enumCheck(Class2::Struct1.Enum14_Val6m, $val);
+
+$class1 = new Class1();
+enumCheck($class1->class1Test1(Enum1_Val5a), 13);
+enumCheck($class1->class1Test2(Class1::Enum12_Val5c), 1121);
+#enumCheck($class1.class1Test3(Class1::Struct1.Enum12_Val5f), 3121);
+
+enumCheck(globalTest1(Enum1_Val5a), 13);
+enumCheck(globalTest2(Class1::Enum12_Val5c), 1121);
+#enumCheck(globalTest3(Class1::Struct1.Enum12_Val5f), 3121);
+
+?>
diff --git a/Examples/test-suite/php/director_exception_runme.php b/Examples/test-suite/php/director_exception_runme.php
index 33e6e9b52..8b852c2ce 100644
--- a/Examples/test-suite/php/director_exception_runme.php
+++ b/Examples/test-suite/php/director_exception_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "director_exception.php";
// No new functions
-check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,bar_pang));
+check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,bar_pang,returnalltypes_return_int,returnalltypes_return_double,returnalltypes_return_const_char_star,returnalltypes_return_std_string,returnalltypes_return_bar,returnalltypes_call_int,returnalltypes_call_double,returnalltypes_call_const_char_star,returnalltypes_call_std_string,returnalltypes_call_bar,is_python_builtin));
// No new classes
-check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar));
+check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar,ReturnAllTypes));
// now new vars
check::globals(array());
@@ -74,5 +74,54 @@ try {
} catch (Exception1 $e1) {
}
+// Check that we can throw exceptions from director methods (this didn't used
+// to work in all cases, as the exception gets "set" in PHP and the method
+// then returns PHP NULL, which the directorout template may fail to convert.
+
+class Bad extends ReturnAllTypes {
+ function return_int() { throw new Exception("bad int"); }
+ function return_double() { throw new Exception("bad double"); }
+ function return_const_char_star() { throw new Exception("bad const_char_star"); }
+ function return_std_string() { throw new Exception("bad std_string"); }
+ function return_Bar() { throw new Exception("bad Bar"); }
+}
+
+$bad = new Bad();
+
+try {
+ $bad->call_int();
+ check::fail("Exception wasn't propagated from Bad::return_int()");
+} catch (Exception $e) {
+ check::equal($e->getMessage(), "bad int", "propagated exception incorrect");
+}
+
+try {
+ $bad->call_double();
+ check::fail("Exception wasn't propagated from Bad::return_double()");
+} catch (Exception $e) {
+ check::equal($e->getMessage(), "bad double", "propagated exception incorrect");
+}
+
+try {
+ $bad->call_const_char_star();
+ check::fail("Exception wasn't propagated from Bad::return_const_char_star()");
+} catch (Exception $e) {
+ check::equal($e->getMessage(), "bad const_char_star", "propagated exception incorrect");
+}
+
+try {
+ $bad->call_std_string();
+ check::fail("Exception wasn't propagated from Bad::return_std_string()");
+} catch (Exception $e) {
+ check::equal($e->getMessage(), "bad std_string", "propagated exception incorrect");
+}
+
+try {
+ $bad->call_Bar();
+ check::fail("Exception wasn't propagated from Bad::return_Bar()");
+} catch (Exception $e) {
+ check::equal($e->getMessage(), "bad Bar", "propagated exception incorrect");
+}
+
check::done();
?>
diff --git a/Examples/test-suite/php/exception_order_runme.php b/Examples/test-suite/php/exception_order_runme.php
index a83598170..acb83561a 100644
--- a/Examples/test-suite/php/exception_order_runme.php
+++ b/Examples/test-suite/php/exception_order_runme.php
@@ -2,7 +2,7 @@
require "tests.php";
require "exception_order.php";
-check::functions(array(a_foo,a_bar,a_foobar,a_barfoo));
+check::functions(array(a_foo,a_bar,a_foobar,a_barfoo,is_python_builtin));
check::classes(array(A,E1,E2,E3,exception_order,ET_i,ET_d));
check::globals(array(efoovar,foovar,cfoovar,a_sfoovar,a_foovar,a_efoovar));
diff --git a/Examples/test-suite/php/import_nomodule_runme.php b/Examples/test-suite/php/import_nomodule_runme.php
index 84191fba9..41836ba0f 100644
--- a/Examples/test-suite/php/import_nomodule_runme.php
+++ b/Examples/test-suite/php/import_nomodule_runme.php
@@ -3,7 +3,7 @@ require "tests.php";
require "import_nomodule.php";
// No new functions
-check::functions(array(create_foo,delete_foo,test1));
+check::functions(array(create_foo,delete_foo,test1,is_python_builtin));
// No new classes
check::classes(array(import_nomodule,Bar));
// now new vars
diff --git a/Examples/test-suite/php/php_iterator_runme.php b/Examples/test-suite/php/php_iterator_runme.php
new file mode 100644
index 000000000..d69a5b385
--- /dev/null
+++ b/Examples/test-suite/php/php_iterator_runme.php
@@ -0,0 +1,24 @@
+<?php
+
+require "tests.php";
+require "php_iterator.php";
+
+check::functions(array(myiterator_rewind,myiterator_key,myiterator_current,myiterator_next,myiterator_valid));
+check::classes(array(MyIterator));
+// No new global variables.
+check::globals(array());
+
+$s = '';
+foreach (new MyIterator(1, 6) as $i) {
+ $s .= $i;
+}
+check::equal($s, '12345', 'Simple iteration failed');
+
+$s = '';
+foreach (new MyIterator(2, 5) as $k => $v) {
+ $s .= "($k=>$v)";
+}
+check::equal($s, '(0=>2)(1=>3)(2=>4)', 'Simple iteration failed');
+
+check::done();
+?>
diff --git a/Examples/test-suite/php/threads_exception_runme.php b/Examples/test-suite/php/threads_exception_runme.php
index 31148a1e1..9e4d04e10 100644
--- a/Examples/test-suite/php/threads_exception_runme.php
+++ b/Examples/test-suite/php/threads_exception_runme.php
@@ -4,9 +4,9 @@ require "tests.php";
require "threads_exception.php";
// Check functions
-check::functions(array(test_simple,test_message,test_hosed,test_unknown,test_multi));
+check::functions(array(test_simple,test_message,test_hosed,test_unknown,test_multi,is_python_builtin));
// Check classes.
-check::classes(array(Exc,Test));
+check::classes(array(Exc,Test,threads_exception));
// Chek globals.
check::globals(array(exc_code,exc_msg));
diff --git a/Examples/test-suite/php_iterator.i b/Examples/test-suite/php_iterator.i
new file mode 100644
index 000000000..43ab68b55
--- /dev/null
+++ b/Examples/test-suite/php_iterator.i
@@ -0,0 +1,20 @@
+/* php_iterator.i - PHP-specific testcase for wrapping to a PHP Iterator */
+%module php_iterator
+
+%typemap("phpinterfaces") MyIterator "Iterator";
+
+%inline %{
+
+class MyIterator {
+ int i, from, to;
+public:
+ MyIterator(int from_, int to_)
+ : i(from_), from(from_), to(to_) { }
+ void rewind() { i = from; }
+ bool valid() const { return i != to; }
+ int key() const { return i - from; }
+ int current() const { return i; }
+ void next() { ++i; }
+};
+
+%}
diff --git a/Examples/test-suite/pike/Makefile.in b/Examples/test-suite/pike/Makefile.in
index 389dc74f8..92054dd9d 100644
--- a/Examples/test-suite/pike/Makefile.in
+++ b/Examples/test-suite/pike/Makefile.in
@@ -5,6 +5,7 @@
LANGUAGE = pike
PIKE = pike
SCRIPTSUFFIX = _runme.pike
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -18,7 +19,7 @@ include $(srcdir)/../common.mk
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -28,7 +29,7 @@ include $(srcdir)/../common.mk
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -36,8 +37,8 @@ include $(srcdir)/../common.mk
# 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 $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PIKE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PIKE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: remove the generated .pike file
@@ -45,5 +46,4 @@ run_testcase = \
@rm -f $*.pike;
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile pike_clean
-
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" pike_clean
diff --git a/Examples/test-suite/preproc.i b/Examples/test-suite/preproc.i
index e052bff28..779c41e97 100644
--- a/Examples/test-suite/preproc.i
+++ b/Examples/test-suite/preproc.i
@@ -346,3 +346,20 @@ int method(struct TypeNameTraits tnt) {
return tnt.val;
}
%}
+
+/* Null directive */
+# /* comment 1 */
+# // comment 2
+# /** comment 3 */
+# /* comment 4 */ /*comment 5*/
+# /** comment 6
+#
+# more comment 6 */
+#
+#
+#
+int methodX(int x);
+%{
+int methodX(int x) { return x+100; }
+%}
+
diff --git a/Examples/test-suite/preproc_constants.i b/Examples/test-suite/preproc_constants.i
index 7507d632c..ef5c35e12 100644
--- a/Examples/test-suite/preproc_constants.i
+++ b/Examples/test-suite/preproc_constants.i
@@ -85,6 +85,8 @@
/// constant assignment in enum
#if defined(SWIGCSHARP)
%csconstvalue("1<<2") kValue;
+#elif defined(SWIGD)
+%dconstvalue("1<<2") kValue;
#endif
%{
diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in
index e7db32fb7..82a0e9db1 100644
--- a/Examples/test-suite/python/Makefile.in
+++ b/Examples/test-suite/python/Makefile.in
@@ -10,10 +10,13 @@ endif
LANGUAGE = python
PYTHON = $(PYBIN)
+PEP8 = @PEP8@
+PEP8_FLAGS = --ignore=E402,E501,E30,W291,W391
#*_runme.py for Python 2.x, *_runme3.py for Python 3.x
PY2SCRIPTSUFFIX = _runme.py
PY3SCRIPTSUFFIX = _runme3.py
+PY2TO3 = 2to3 -x import
ifeq (,$(PY3))
SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX)
@@ -25,10 +28,6 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-
-PY2TO3 = 2to3 -x import
-
-
CPP_TEST_CASES += \
argcargvtest \
callback \
@@ -41,7 +40,6 @@ CPP_TEST_CASES += \
inout \
inplaceadd \
input \
- kwargs_feature \
li_cstring \
li_cwstring \
li_factory \
@@ -88,82 +86,89 @@ C_TEST_CASES += \
include $(srcdir)/../common.mk
-BUILTIN_BROKEN = \
- default_constructor.cpptest \
- director_exception.cpptest \
- exception_order.cpptest \
- li_std_string_extra.cpptest \
- li_std_wstring.cpptest \
- python_abstractbase.cpptest \
- threads_exception.cpptest
-
-BUILTIN_NOT_BROKEN = $(filter-out $(BUILTIN_BROKEN),$(NOT_BROKEN_TEST_CASES))
-
-builtin-check : $(BUILTIN_NOT_BROKEN)
-
# Overridden variables here
-LIBS = -L.
+SCRIPTDIR = .
+LIBS = -L.
VALGRIND_OPT += --suppressions=pythonswig.supp
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
+$(convert_testcase)
$(setup)
+$(swig_and_compile_cpp)
+ $(check_pep8)
$(run_testcase)
%.ctest:
+$(convert_testcase)
$(setup)
+$(swig_and_compile_c)
+ $(check_pep8)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
+$(convert_testcase)
$(setup)
+$(swig_and_compile_multi_cpp)
+ $(check_pep8_multi_cpp)
$(run_testcase)
-# Call 2to3 to generate Python 3.x test from the Python 2.x's *_runme.py file
-%$(PY3SCRIPTSUFFIX): %$(PY2SCRIPTSUFFIX)
- cp $< $@
- $(PY2TO3) -w $@ >/dev/null 2>&1
-
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.py (or _runme3.py for Python 3) appended after the testcase name.
-run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
+py_runme = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
+py2_runme = $(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
+py3_runme = $(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
+
+check_pep8 = \
+ if [ -n "$(PEP8)" ]; then \
+ $(PEP8) $(PEP8_FLAGS) $(SCRIPTPREFIX)$*.py;\
+ fi
+
+check_pep8_multi_cpp = \
+ if [ -n "$(PEP8)" ]; then \
+ for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
+ $(PEP8) $(PEP8_FLAGS) $$f.py; \
+ done \
+ fi
-py2_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
-py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
+run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(py_runme)
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(py_runme) ]; then \
$(run_python);\
fi
-ifeq (,$(PY3))
+# No copying/conversion needed for in-source-tree Python 2 scripts
+ifeq ($(SCRIPTDIR)|$(SCRIPTSUFFIX),$(srcdir)|$(PY2SCRIPTSUFFIX))
convert_testcase =
else
+
convert_testcase = \
- if [ -f $(py2_runme) ]; then \
- $(MAKE) -f $(srcdir)/Makefile $(py3_runme); \
+ if [ -f $(srcdir)/$(py2_runme) ]; then \
+ $(MAKE) $(SCRIPTDIR)/$(py_runme); \
fi
+
+$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX): $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
+ test x$< = x$@ || cp $< $@ || exit 1
+ test x$(PY3) = x || $(PY2TO3) -w $@ >/dev/null 2>&1 || exit 1
+
endif
# Clean: remove the generated .py file
+# We only remove the _runme3.py if it is generated by 2to3 from a _runme.py.
%.clean:
- @rm -f $*.py;
- @#We only remove the _runme3.py if it is generated by 2to3 from a _runme.py.
- @if [ -f $(py2_runme) ]; then rm -f $(py3_runme) $(py3_runme).bak; fi
+ @rm -f $*.py
+ @if test -f $(srcdir)/$(py2_runme); then rm -f $(SCRIPTDIR)/$(py3_runme) $(SCRIPTDIR)/$(py3_runme).bak; fi
+ @if test "x$(SCRIPTDIR)" != "x$(srcdir)"; then rm -f $(SCRIPTDIR)/$(py2_runme); fi
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" python_clean
rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
rm -f clientdata_prop_a.py clientdata_prop_b.py import_stl_a.py import_stl_b.py
rm -f imports_a.py imports_b.py mod_a.py mod_b.py multi_import_a.py
@@ -172,12 +177,12 @@ clean:
cvsignore:
@echo '*wrap* *.pyc *.so *.dll *.exp *.lib'
@echo Makefile
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done
- @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.py CVS/Entries ; then echo $${i}_runme.py; fi; done
- @echo clientdata_prop_a.py
- @echo clientdata_prop_b.py
- @echo imports_a.py
- @echo imports_b.py
+ @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done
+ @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.py CVS/Entries ; then echo $${i}_runme.py; fi; done
+ @echo clientdata_prop_a.py
+ @echo clientdata_prop_b.py
+ @echo imports_a.py
+ @echo imports_b.py
@echo mod_a.py mod_b.py
@echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
@echo template_typedef_import.py
@@ -185,9 +190,8 @@ cvsignore:
hugemod_runme = hugemod$(SCRIPTPREFIX)
hugemod:
- perl hugemod.pl $(hugemod_runme)
+ perl hugemod.pl $(hugemod_runme)
$(MAKE) hugemod_a.cpptest
$(MAKE) hugemod_b.cpptest
sh -c "time $(PYTHON) $(hugemod_runme)"
sh -c "time $(PYTHON) $(hugemod_runme)"
-
diff --git a/Examples/test-suite/python/autodoc_runme.py b/Examples/test-suite/python/autodoc_runme.py
index 5776ad3ef..756b85904 100644
--- a/Examples/test-suite/python/autodoc_runme.py
+++ b/Examples/test-suite/python/autodoc_runme.py
@@ -1,15 +1,26 @@
from autodoc import *
import sys
-def check(got, expected):
- if expected != got:
- raise RuntimeError("\n" + "Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]")
+def check(got, expected, expected_builtin = None, skip = False):
+ if not skip:
+ expect = expected
+ if is_python_builtin() and expected_builtin != None:
+ expect = expected_builtin
+ if expect != got:
+ raise RuntimeError("\n" + "Expected: [" + str(expect) + "]\n" + "Got : [" + str(got) + "]")
-check(A.__doc__, "Proxy of C++ A class")
+skip = True # skip builtin check - the autodoc is missing, but it probably should not be
+
+check(A.__doc__, "Proxy of C++ A class", "::A")
check(A.funk.__doc__, "just a string")
-check(A.func0.__doc__, "func0(self, arg2, hello) -> int")
-check(A.func1.__doc__, "func1(A self, short arg2, Tuple hello) -> int")
-check(A.func2.__doc__, "\n"
+check(A.func0.__doc__,
+"func0(self, arg2, hello) -> int",
+"func0(arg2, hello) -> int")
+check(A.func1.__doc__,
+"func1(A self, short arg2, Tuple hello) -> int",
+"func1(short arg2, Tuple hello) -> int")
+check(A.func2.__doc__,
+"\n"
" func2(self, arg2, hello) -> int\n"
"\n"
" Parameters:\n"
@@ -17,8 +28,18 @@ check(A.func2.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
+,
+"\n"
+"func2(arg2, hello) -> int\n"
+"\n"
+"Parameters:\n"
+" arg2: short\n"
+" hello: int tuple[2]\n"
+"\n"
+""
)
-check(A.func3.__doc__, "\n"
+check(A.func3.__doc__,
+"\n"
" func3(A self, short arg2, Tuple hello) -> int\n"
"\n"
" Parameters:\n"
@@ -26,19 +47,41 @@ check(A.func3.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
+,
+"\n"
+"func3(short arg2, Tuple hello) -> int\n"
+"\n"
+"Parameters:\n"
+" arg2: short\n"
+" hello: int tuple[2]\n"
+"\n"
+""
)
-check(A.func0default.__doc__, "\n"
+check(A.func0default.__doc__,
+"\n"
" func0default(self, e, arg3, hello, f=2) -> int\n"
" func0default(self, e, arg3, hello) -> int\n"
" "
+,
+"\n"
+"func0default(e, arg3, hello, f=2) -> int\n"
+"func0default(e, arg3, hello) -> int\n"
+""
)
-check(A.func1default.__doc__, "\n"
+check(A.func1default.__doc__,
+"\n"
" func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
" func1default(A self, A e, short arg3, Tuple hello) -> int\n"
" "
+,
+"\n"
+"func1default(A e, short arg3, Tuple hello, double f=2) -> int\n"
+"func1default(A e, short arg3, Tuple hello) -> int\n"
+""
)
-check(A.func2default.__doc__, "\n"
+check(A.func2default.__doc__,
+"\n"
" func2default(self, e, arg3, hello, f=2) -> int\n"
"\n"
" Parameters:\n"
@@ -55,8 +98,27 @@ check(A.func2default.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
+,
+"\n"
+"func2default(e, arg3, hello, f=2) -> int\n"
+"\n"
+"Parameters:\n"
+" e: A *\n"
+" arg3: short\n"
+" hello: int tuple[2]\n"
+" f: double\n"
+"\n"
+"func2default(e, arg3, hello) -> int\n"
+"\n"
+"Parameters:\n"
+" e: A *\n"
+" arg3: short\n"
+" hello: int tuple[2]\n"
+"\n"
+""
)
-check(A.func3default.__doc__, "\n"
+check(A.func3default.__doc__,
+"\n"
" func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
"\n"
" Parameters:\n"
@@ -73,19 +135,50 @@ check(A.func3default.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
+,
+"\n"
+"func3default(A e, short arg3, Tuple hello, double f=2) -> int\n"
+"\n"
+"Parameters:\n"
+" e: A *\n"
+" arg3: short\n"
+" hello: int tuple[2]\n"
+" f: double\n"
+"\n"
+"func3default(A e, short arg3, Tuple hello) -> int\n"
+"\n"
+"Parameters:\n"
+" e: A *\n"
+" arg3: short\n"
+" hello: int tuple[2]\n"
+"\n"
+""
)
-check(A.func0static.__doc__, "\n"
+check(A.func0static.__doc__,
+"\n"
" func0static(e, arg2, hello, f=2) -> int\n"
" func0static(e, arg2, hello) -> int\n"
" "
+,
+"\n"
+"func0static(e, arg2, hello, f=2) -> int\n"
+"func0static(e, arg2, hello) -> int\n"
+""
)
-check(A.func1static.__doc__, "\n"
+check(A.func1static.__doc__,
+"\n"
" func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
" func1static(A e, short arg2, Tuple hello) -> int\n"
" "
+,
+"\n"
+"func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
+"func1static(A e, short arg2, Tuple hello) -> int\n"
+""
)
-check(A.func2static.__doc__, "\n"
+check(A.func2static.__doc__,
+"\n"
" func2static(e, arg2, hello, f=2) -> int\n"
"\n"
" Parameters:\n"
@@ -102,8 +195,27 @@ check(A.func2static.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
+,
+"\n"
+"func2static(e, arg2, hello, f=2) -> int\n"
+"\n"
+"Parameters:\n"
+" e: A *\n"
+" arg2: short\n"
+" hello: int tuple[2]\n"
+" f: double\n"
+"\n"
+"func2static(e, arg2, hello) -> int\n"
+"\n"
+"Parameters:\n"
+" e: A *\n"
+" arg2: short\n"
+" hello: int tuple[2]\n"
+"\n"
+""
)
-check(A.func3static.__doc__, "\n"
+check(A.func3static.__doc__,
+"\n"
" func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
" Parameters:\n"
@@ -120,31 +232,65 @@ check(A.func3static.__doc__, "\n"
" hello: int tuple[2]\n"
"\n"
" "
+,
+"\n"
+"func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
+"\n"
+"Parameters:\n"
+" e: A *\n"
+" arg2: short\n"
+" hello: int tuple[2]\n"
+" f: double\n"
+"\n"
+"func3static(A e, short arg2, Tuple hello) -> int\n"
+"\n"
+"Parameters:\n"
+" e: A *\n"
+" arg2: short\n"
+" hello: int tuple[2]\n"
+"\n"
+""
)
if sys.version_info[0:2] > (2, 4):
# Python 2.4 does not seem to work
- check(A.variable_a.__doc__, "A_variable_a_get(self) -> int")
- check(A.variable_b.__doc__, "A_variable_b_get(A self) -> int")
- check(A.variable_c.__doc__, "\n"
+ check(A.variable_a.__doc__,
+ "A_variable_a_get(self) -> int",
+ "A.variable_a"
+ )
+ check(A.variable_b.__doc__,
+ "A_variable_b_get(A self) -> int",
+ "A.variable_b"
+ )
+ check(A.variable_c.__doc__,
+ "\n"
"A_variable_c_get(self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
"\n"
+ ,
+ "A.variable_c"
)
- check(A.variable_d.__doc__, "\n"
+ check(A.variable_d.__doc__,
+ "\n"
"A_variable_d_get(A self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
"\n"
+ ,
+ "A.variable_d"
)
-check(B.__doc__, "Proxy of C++ B class")
-check(C.__init__.__doc__, "__init__(self, a, b, h) -> C")
-check(D.__init__.__doc__, "__init__(D self, int a, int b, Hola h) -> D")
-check(E.__init__.__doc__, "\n"
+check(B.__doc__,
+"Proxy of C++ B class",
+"::B"
+)
+check(C.__init__.__doc__, "__init__(self, a, b, h) -> C", None, skip)
+check(D.__init__.__doc__, "__init__(D self, int a, int b, Hola h) -> D", None, skip)
+check(E.__init__.__doc__,
+"\n"
" __init__(self, a, b, h) -> E\n"
"\n"
" Parameters:\n"
@@ -153,8 +299,10 @@ check(E.__init__.__doc__, "\n"
" h: enum Hola\n"
"\n"
" "
+, None, skip
)
-check(F.__init__.__doc__, "\n"
+check(F.__init__.__doc__,
+"\n"
" __init__(F self, int a, int b, Hola h) -> F\n"
"\n"
" Parameters:\n"
@@ -163,14 +311,23 @@ check(F.__init__.__doc__, "\n"
" h: enum Hola\n"
"\n"
" "
+, None, skip
)
-check(B.funk.__doc__, "funk(B self, int c, int d) -> int")
+check(B.funk.__doc__,
+"funk(B self, int c, int d) -> int",
+"funk(int c, int d) -> int")
check(funk.__doc__, "funk(A e, short arg2, int c, int d) -> int")
-check(funkdefaults.__doc__, "\n"
+check(funkdefaults.__doc__,
+"\n"
" funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
" funkdefaults(A e, short arg2, int c, int d) -> int\n"
" "
+,
+"\n"
+"funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
+"funkdefaults(A e, short arg2, int c, int d) -> int\n"
+""
)
check(func_input.__doc__, "func_input(int * INPUT) -> int")
diff --git a/Examples/test-suite/python/cpp11_function_objects_runme.py b/Examples/test-suite/python/cpp11_function_objects_runme.py
index aac7f9c5f..5a63b632b 100644
--- a/Examples/test-suite/python/cpp11_function_objects_runme.py
+++ b/Examples/test-suite/python/cpp11_function_objects_runme.py
@@ -1,6 +1,13 @@
import cpp11_function_objects
import sys
+class Test1(cpp11_function_objects.Test):
+ def __init__(self):
+ cpp11_function_objects.Test.__init__(self)
+
+ def __call__(self, a, b):
+ self.value = a * b
+
t = cpp11_function_objects.Test()
if t.value != 0:
raise RuntimeError("Runtime cpp11_function_objects failed. t.value should be 0, but is " + str(t.value))
@@ -10,3 +17,7 @@ t(1,2) # adds numbers and sets value
if t.value != 3:
raise RuntimeError("Runtime cpp11_function_objects failed. t.value not changed - should be 3, but is " + str(t.value))
+t2 = Test1()
+a = cpp11_function_objects.testit1(t2, 4,3)
+if a != 12:
+ raise RuntimeError("Runtime cpp11_function_objects failed. t.value not changed - should be 12, but is " + str(a))
diff --git a/Examples/test-suite/python/cpp11_strongly_typed_enumerations_runme.py b/Examples/test-suite/python/cpp11_strongly_typed_enumerations_runme.py
new file mode 100644
index 000000000..6509ba873
--- /dev/null
+++ b/Examples/test-suite/python/cpp11_strongly_typed_enumerations_runme.py
@@ -0,0 +1,164 @@
+from cpp11_strongly_typed_enumerations import *
+
+def enumCheck(actual, expected):
+ if actual != expected:
+ raise RuntimeError("Enum value mismatch. Expected " + str(expected) + " Actual: " + str(actual))
+ return expected + 1
+
+val = 0
+val = enumCheck(Enum1_Val1, val)
+val = enumCheck(Enum1_Val2, val)
+val = enumCheck(Enum1_Val3, 13)
+val = enumCheck(Enum1_Val4, val)
+val = enumCheck(Enum1_Val5a, 13)
+val = enumCheck(Enum1_Val6a, val)
+
+val = 0
+val = enumCheck(Enum2_Val1, val)
+val = enumCheck(Enum2_Val2, val)
+val = enumCheck(Enum2_Val3, 23)
+val = enumCheck(Enum2_Val4, val)
+val = enumCheck(Enum2_Val5b, 23)
+val = enumCheck(Enum2_Val6b, val)
+
+val = 0
+val = enumCheck(Val1, val)
+val = enumCheck(Val2, val)
+val = enumCheck(Val3, 43)
+val = enumCheck(Val4, val)
+
+val = 0
+val = enumCheck(Enum5_Val1, val)
+val = enumCheck(Enum5_Val2, val)
+val = enumCheck(Enum5_Val3, 53)
+val = enumCheck(Enum5_Val4, val)
+
+val = 0
+val = enumCheck(Enum6_Val1, val)
+val = enumCheck(Enum6_Val2, val)
+val = enumCheck(Enum6_Val3, 63)
+val = enumCheck(Enum6_Val4, val)
+
+val = 0
+val = enumCheck(Enum7td_Val1, val)
+val = enumCheck(Enum7td_Val2, val)
+val = enumCheck(Enum7td_Val3, 73)
+val = enumCheck(Enum7td_Val4, val)
+
+val = 0
+val = enumCheck(Enum8_Val1, val)
+val = enumCheck(Enum8_Val2, val)
+val = enumCheck(Enum8_Val3, 83)
+val = enumCheck(Enum8_Val4, val)
+
+val = 0
+val = enumCheck(Enum10_Val1, val)
+val = enumCheck(Enum10_Val2, val)
+val = enumCheck(Enum10_Val3, 103)
+val = enumCheck(Enum10_Val4, val)
+
+val = 0
+val = enumCheck(Class1.Enum12_Val1, 1121)
+val = enumCheck(Class1.Enum12_Val2, 1122)
+val = enumCheck(Class1.Enum12_Val3, val)
+val = enumCheck(Class1.Enum12_Val4, val)
+val = enumCheck(Class1.Enum12_Val5c, 1121)
+val = enumCheck(Class1.Enum12_Val6c, val)
+
+val = 0
+val = enumCheck(Class1.Val1, 1131)
+val = enumCheck(Class1.Val2, 1132)
+val = enumCheck(Class1.Val3, val)
+val = enumCheck(Class1.Val4, val)
+val = enumCheck(Class1.Val5d, 1131)
+val = enumCheck(Class1.Val6d, val)
+
+val = 0
+val = enumCheck(Class1.Enum14_Val1, 1141)
+val = enumCheck(Class1.Enum14_Val2, 1142)
+val = enumCheck(Class1.Enum14_Val3, val)
+val = enumCheck(Class1.Enum14_Val4, val)
+val = enumCheck(Class1.Enum14_Val5e, 1141)
+val = enumCheck(Class1.Enum14_Val6e, val)
+
+# Requires nested class support to work
+#val = 0
+#val = enumCheck(Class1.Struct1.Enum12_Val1, 3121)
+#val = enumCheck(Class1.Struct1.Enum12_Val2, 3122)
+#val = enumCheck(Class1.Struct1.Enum12_Val3, val)
+#val = enumCheck(Class1.Struct1.Enum12_Val4, val)
+#val = enumCheck(Class1.Struct1.Enum12_Val5f, 3121)
+#val = enumCheck(Class1.Struct1.Enum12_Val6f, val)
+#
+#val = 0
+#val = enumCheck(Class1.Struct1.Val1, 3131)
+#val = enumCheck(Class1.Struct1.Val2, 3132)
+#val = enumCheck(Class1.Struct1.Val3, val)
+#val = enumCheck(Class1.Struct1.Val4, val)
+#
+#val = 0
+#val = enumCheck(Class1.Struct1.Enum14_Val1, 3141)
+#val = enumCheck(Class1.Struct1.Enum14_Val2, 3142)
+#val = enumCheck(Class1.Struct1.Enum14_Val3, val)
+#val = enumCheck(Class1.Struct1.Enum14_Val4, val)
+#val = enumCheck(Class1.Struct1.Enum14_Val5g, 3141)
+#val = enumCheck(Class1.Struct1.Enum14_Val6g, val)
+
+val = 0
+val = enumCheck(Class2.Enum12_Val1, 2121)
+val = enumCheck(Class2.Enum12_Val2, 2122)
+val = enumCheck(Class2.Enum12_Val3, val)
+val = enumCheck(Class2.Enum12_Val4, val)
+val = enumCheck(Class2.Enum12_Val5h, 2121)
+val = enumCheck(Class2.Enum12_Val6h, val)
+
+val = 0
+val = enumCheck(Class2.Val1, 2131)
+val = enumCheck(Class2.Val2, 2132)
+val = enumCheck(Class2.Val3, val)
+val = enumCheck(Class2.Val4, val)
+val = enumCheck(Class2.Val5i, 2131)
+val = enumCheck(Class2.Val6i, val)
+
+val = 0
+val = enumCheck(Class2.Enum14_Val1, 2141)
+val = enumCheck(Class2.Enum14_Val2, 2142)
+val = enumCheck(Class2.Enum14_Val3, val)
+val = enumCheck(Class2.Enum14_Val4, val)
+val = enumCheck(Class2.Enum14_Val5j, 2141)
+val = enumCheck(Class2.Enum14_Val6j, val)
+
+# Requires nested class support to work
+#val = 0
+#val = enumCheck(Class2.Struct1.Enum12_Val1, 4121)
+#val = enumCheck(Class2.Struct1.Enum12_Val2, 4122)
+#val = enumCheck(Class2.Struct1.Enum12_Val3, val)
+#val = enumCheck(Class2.Struct1.Enum12_Val4, val)
+#val = enumCheck(Class2.Struct1.Enum12_Val5k, 4121)
+#val = enumCheck(Class2.Struct1.Enum12_Val6k, val)
+#
+#val = 0
+#val = enumCheck(Class2.Struct1.Val1, 4131)
+#val = enumCheck(Class2.Struct1.Val2, 4132)
+#val = enumCheck(Class2.Struct1.Val3, val)
+#val = enumCheck(Class2.Struct1.Val4, val)
+#val = enumCheck(Class2.Struct1.Val5l, 4131)
+#val = enumCheck(Class2.Struct1.Val6l, val)
+#
+#val = 0
+#val = enumCheck(Class2.Struct1.Enum14_Val1, 4141)
+#val = enumCheck(Class2.Struct1.Enum14_Val2, 4142)
+#val = enumCheck(Class2.Struct1.Enum14_Val3, val)
+#val = enumCheck(Class2.Struct1.Enum14_Val4, val)
+#val = enumCheck(Class2.Struct1.Enum14_Val5m, 4141)
+#val = enumCheck(Class2.Struct1.Enum14_Val6m, val)
+
+class1 = Class1()
+enumCheck(class1.class1Test1(Enum1_Val5a), 13)
+enumCheck(class1.class1Test2(Class1.Enum12_Val5c), 1121)
+#enumCheck(class1.class1Test3(Class1.Struct1.Enum12_Val5f), 3121)
+
+enumCheck(globalTest1(Enum1_Val5a), 13)
+enumCheck(globalTest2(Class1.Enum12_Val5c), 1121)
+#enumCheck(globalTest3(Class1.Struct1.Enum12_Val5f), 3121)
+
diff --git a/Examples/test-suite/python/default_args_runme.py b/Examples/test-suite/python/default_args_runme.py
index 091a92376..f24e825ad 100644
--- a/Examples/test-suite/python/default_args_runme.py
+++ b/Examples/test-suite/python/default_args_runme.py
@@ -1,64 +1,90 @@
-import default_args
-
-
-if default_args.Statics_staticMethod() != 60:
- raise RuntimeError
-
-if default_args.cfunc1(1) != 2:
- raise RuntimeError
-
-if default_args.cfunc2(1) != 3:
- raise RuntimeError
-
-if default_args.cfunc3(1) != 4:
- raise RuntimeError
-
-
-f = default_args.Foo()
-
-f.newname()
-f.newname(1)
-
-
-try:
- f = default_args.Foo(1)
- error = 1
-except:
- error = 0
-if error: raise RuntimeError,"Foo::Foo ignore is not working"
-
-try:
- f = default_args.Foo(1,2)
- error = 1
-except:
- error = 0
-if error: raise RuntimeError,"Foo::Foo ignore is not working"
-
-try:
- f = default_args.Foo(1,2,3)
- error = 1
-except:
- error = 0
-if error: raise RuntimeError,"Foo::Foo ignore is not working"
-
-try:
- m = f.meth(1)
- error = 1
-except:
- error = 0
-if error: raise RuntimeError,"Foo::meth ignore is not working"
-
-try:
- m = f.meth(1,2)
- error = 1
-except:
- error = 0
-if error: raise RuntimeError,"Foo::meth ignore is not working"
-
-try:
- m = f.meth(1,2,3)
- error = 1
-except:
- error = 0
-if error: raise RuntimeError,"Foo::meth ignore is not working"
+# Note that this test is also used by python_default_args_runme.py hence the use of __main__ and the run function
+
+def run(module_name):
+ default_args = __import__(module_name)
+ ec = default_args.EnumClass()
+ if not ec.blah():
+ raise RuntimeError("EnumClass::blah() default arguments don't work")
+
+ de = default_args.DerivedEnumClass()
+ de.accelerate()
+ de.accelerate(default_args.EnumClass.SLOW)
+
+ if default_args.Statics_staticMethod() != 60:
+ raise RuntimeError
+
+ if default_args.cfunc1(1) != 2:
+ raise RuntimeError
+
+ if default_args.cfunc2(1) != 3:
+ raise RuntimeError
+
+ if default_args.cfunc3(1) != 4:
+ raise RuntimeError
+
+
+ f = default_args.Foo()
+
+ f.newname()
+ f.newname(1)
+
+
+ try:
+ f = default_args.Foo(1)
+ error = 1
+ except:
+ error = 0
+ if error: raise RuntimeError("Foo::Foo ignore is not working")
+
+ try:
+ f = default_args.Foo(1,2)
+ error = 1
+ except:
+ error = 0
+ if error: raise RuntimeError("Foo::Foo ignore is not working")
+
+ try:
+ f = default_args.Foo(1,2,3)
+ error = 1
+ except:
+ error = 0
+ if error: raise RuntimeError("Foo::Foo ignore is not working")
+
+ try:
+ m = f.meth(1)
+ error = 1
+ except:
+ error = 0
+ if error: raise RuntimeError("Foo::meth ignore is not working")
+
+ try:
+ m = f.meth(1,2)
+ error = 1
+ except:
+ error = 0
+ if error: raise RuntimeError("Foo::meth ignore is not working")
+
+ try:
+ m = f.meth(1,2,3)
+ error = 1
+ except:
+ error = 0
+ if error: raise RuntimeError("Foo::meth ignore is not working")
+
+ if default_args.Klass.inc(100, default_args.Klass(22)).val != 122:
+ raise RuntimeError("Klass::inc failed")
+
+ if default_args.Klass.inc(100).val != 99:
+ raise RuntimeError("Klass::inc failed")
+
+ if default_args.Klass.inc().val != 0:
+ raise RuntimeError("Klass::inc failed")
+
+ default_args.trickyvalue1(10); default_args.trickyvalue1(10, 10)
+ default_args.trickyvalue2(10); default_args.trickyvalue2(10, 10)
+ default_args.trickyvalue3(10); default_args.trickyvalue3(10, 10)
+ default_args.seek(); default_args.seek(10)
+
+if __name__=="__main__":
+ run('default_args')
diff --git a/Examples/test-suite/python/default_constructor_runme.py b/Examples/test-suite/python/default_constructor_runme.py
index 59b130559..e6532031b 100644
--- a/Examples/test-suite/python/default_constructor_runme.py
+++ b/Examples/test-suite/python/default_constructor_runme.py
@@ -1,8 +1,10 @@
+import _default_constructor
+
# This test is expected to fail with -builtin option.
# It uses the old static syntax (e.g., dc.new_A() rather than dc.A()),
# which is not provided with the -builtin option.
-
-import _default_constructor
+if _default_constructor.is_python_builtin():
+ exit(0)
dc = _default_constructor
diff --git a/Examples/test-suite/python/director_exception_runme.py b/Examples/test-suite/python/director_exception_runme.py
index 510845a5a..de3ef22a5 100644
--- a/Examples/test-suite/python/director_exception_runme.py
+++ b/Examples/test-suite/python/director_exception_runme.py
@@ -68,14 +68,13 @@ if not ok:
# This is expected to fail with -builtin option
# Throwing builtin classes as exceptions not supported
-try:
- raise Exception2()
-except Exception2:
- pass
+if not is_python_builtin():
+ try:
+ raise Exception2()
+ except Exception2:
+ pass
-# This is expected to fail with -builtin option
-# Throwing builtin classes as exceptions not supported
-try:
- raise Exception1()
-except Exception1:
- pass
+ try:
+ raise Exception1()
+ except Exception1:
+ pass
diff --git a/Examples/test-suite/python/director_keywords_runme.py b/Examples/test-suite/python/director_keywords_runme.py
new file mode 100644
index 000000000..03a50206a
--- /dev/null
+++ b/Examples/test-suite/python/director_keywords_runme.py
@@ -0,0 +1,5 @@
+from director_keywords import *
+
+f = Foo()
+f.check_self(20)
+
diff --git a/Examples/test-suite/python/director_property_runme.py b/Examples/test-suite/python/director_property_runme.py
new file mode 100644
index 000000000..303e53b67
--- /dev/null
+++ b/Examples/test-suite/python/director_property_runme.py
@@ -0,0 +1,18 @@
+import director_property
+
+class PyFoo(director_property.Foo):
+ a = property(director_property.Foo.getA, director_property.Foo.setA)
+
+ def ping(self):
+ return "PyFoo::ping()"
+
+
+foo = PyFoo()
+
+foo.setA("BLABLA")
+if foo.getA() != "BLABLA":
+ raise RuntimeError
+
+foo.a = "BIBI"
+if foo.a != "BIBI":
+ raise RuntimeError
diff --git a/Examples/test-suite/python/exception_order_runme.py b/Examples/test-suite/python/exception_order_runme.py
index 38b53eb0c..8f095eb98 100644
--- a/Examples/test-suite/python/exception_order_runme.py
+++ b/Examples/test-suite/python/exception_order_runme.py
@@ -2,6 +2,8 @@ from exception_order import *
# This test is expected to fail with -builtin option.
# Throwing builtin classes as exceptions not supported
+if is_python_builtin():
+ exit(0)
a = A()
diff --git a/Examples/test-suite/python/import_nomodule_runme.py b/Examples/test-suite/python/import_nomodule_runme.py
index ba0abfd9a..efcff9c48 100644
--- a/Examples/test-suite/python/import_nomodule_runme.py
+++ b/Examples/test-suite/python/import_nomodule_runme.py
@@ -1,5 +1,10 @@
from import_nomodule import *
+# This test is expected to fail with -builtin option.
+# The base class is needed for the builtin class hierarchy
+if is_python_builtin():
+ exit(0)
+
f = create_Foo()
test1(f,42)
delete_Foo(f)
diff --git a/Examples/test-suite/python/kwargs_feature_runme.py b/Examples/test-suite/python/kwargs_feature_runme.py
index 5539e211d..7792e2e06 100644
--- a/Examples/test-suite/python/kwargs_feature_runme.py
+++ b/Examples/test-suite/python/kwargs_feature_runme.py
@@ -44,10 +44,10 @@ if BarInt_sbar(b=2) != 3:
if templatedfunction(b=2) != 3:
raise RuntimeError
-if foo(a=1,b=2) != 3:
+if foo_fn(a=1,b=2) != 3:
raise RuntimeError
-if foo(b=2) != 3:
+if foo_fn(b=2) != 3:
raise RuntimeError
diff --git a/Examples/test-suite/python/li_std_except_as_class_runme.py b/Examples/test-suite/python/li_std_except_as_class_runme.py
index 386a878bf..a86e7a562 100644
--- a/Examples/test-suite/python/li_std_except_as_class_runme.py
+++ b/Examples/test-suite/python/li_std_except_as_class_runme.py
@@ -1,9 +1,19 @@
from li_std_except_as_class import *
-# std::domain_error hierarchy
-try: test_domain_error()
-except domain_error: pass
-try: test_domain_error()
-except logic_error: pass
-try: test_domain_error()
-except exception: pass
+# This test is expected to fail with -builtin option.
+# Throwing builtin classes as exceptions not supported
+if is_python_builtin():
+ try: test_domain_error()
+ except RuntimeError: pass
+ try: test_domain_error()
+ except RuntimeError: pass
+ try: test_domain_error()
+ except RuntimeError: pass
+else:
+ # std::domain_error hierarchy
+ try: test_domain_error()
+ except domain_error: pass
+ try: test_domain_error()
+ except logic_error: pass
+ try: test_domain_error()
+ except exception: pass
diff --git a/Examples/test-suite/python/li_std_string_extra_runme.py b/Examples/test-suite/python/li_std_string_extra_runme.py
index 9e9e3d2c3..503d09eb5 100644
--- a/Examples/test-suite/python/li_std_string_extra_runme.py
+++ b/Examples/test-suite/python/li_std_string_extra_runme.py
@@ -56,14 +56,13 @@ if a + " world" != "hello world":
# This is expected to fail with -builtin option
# Reverse operators not supported in builtin types
-if "hello" + b != "hello world":
- raise RuntimeError, "bad string mapping"
+if not li_std_string_extra.is_python_builtin():
+ if "hello" + b != "hello world":
+ raise RuntimeError, "bad string mapping"
-# This is expected to fail with -builtin option
-# Reverse operators not supported in builtin types
-c = "hello" + b
-if c.find_last_of("l") != 9:
- raise RuntimeError, "bad string mapping"
+ c = "hello" + b
+ if c.find_last_of("l") != 9:
+ raise RuntimeError, "bad string mapping"
s = "hello world"
diff --git a/Examples/test-suite/python/li_std_wstring_runme.py b/Examples/test-suite/python/li_std_wstring_runme.py
index fecc527e0..a467ae8bc 100644
--- a/Examples/test-suite/python/li_std_wstring_runme.py
+++ b/Examples/test-suite/python/li_std_wstring_runme.py
@@ -60,13 +60,14 @@ if a + " world" != "hello world":
raise RuntimeError("bad string mapping")
# This is expected to fail if -builtin is used
-if "hello" + b != "hello world":
- raise RuntimeError("bad string mapping")
-
-# This is expected to fail if -builtin is used
-c = "hello" + b
-if c.find_last_of("l") != 9:
- raise RuntimeError("bad string mapping")
+# Reverse operators not supported in builtin types
+if not li_std_wstring.is_python_builtin():
+ if "hello" + b != "hello world":
+ raise RuntimeError("bad string mapping")
+
+ c = "hello" + b
+ if c.find_last_of("l") != 9:
+ raise RuntimeError("bad string mapping")
s = "hello world"
diff --git a/Examples/test-suite/python/nested_template_base_runme.py b/Examples/test-suite/python/nested_template_base_runme.py
new file mode 100644
index 000000000..3d54b8391
--- /dev/null
+++ b/Examples/test-suite/python/nested_template_base_runme.py
@@ -0,0 +1,13 @@
+from nested_template_base import *
+
+
+ois = InnerS(123);
+oic = InnerC();
+
+# Check base method is available
+if (oic.outer(ois).val != 123):
+ raise RuntimeError("Wrong value calling outer");
+
+# Check non-derived class using base class
+if (oic.innerc().outer(ois).val != 123):
+ raise RuntimeError("Wrong value calling innerc");
diff --git a/Examples/test-suite/python/preproc_runme.py b/Examples/test-suite/python/preproc_runme.py
index c989294b6..3049f00ab 100644
--- a/Examples/test-suite/python/preproc_runme.py
+++ b/Examples/test-suite/python/preproc_runme.py
@@ -12,3 +12,5 @@ if preproc.defined != 1:
if 2*preproc.one != preproc.two:
raise RuntimeError
+if preproc.methodX(99) != 199:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/python_abstractbase_runme3.py b/Examples/test-suite/python/python_abstractbase_runme3.py
index 94dee3ff7..9b189964d 100644
--- a/Examples/test-suite/python/python_abstractbase_runme3.py
+++ b/Examples/test-suite/python/python_abstractbase_runme3.py
@@ -3,6 +3,8 @@ from collections import *
# This is expected to fail with -builtin option
# Builtin types can't inherit from pure-python abstract bases
+if is_python_builtin():
+ exit(0)
assert issubclass(Mapii, MutableMapping)
assert issubclass(Multimapii, MutableMapping)
diff --git a/Examples/test-suite/python/python_append_runme.py b/Examples/test-suite/python/python_append_runme.py
index 41cebad58..54d7a3e00 100644
--- a/Examples/test-suite/python/python_append_runme.py
+++ b/Examples/test-suite/python/python_append_runme.py
@@ -1,11 +1,16 @@
from python_append import *
+
+# test not relevant for -builtin
+if is_python_builtin():
+ exit(0)
+
t=Test()
t.func()
t.static_func()
if grabpath() != os.path.dirname(mypath):
- raise RuntimeError
+ raise RuntimeError("grabpath failed")
if grabstaticpath() != os.path.basename(mypath):
- raise RuntimeError
+ raise RuntimeError("grabstaticpath failed")
diff --git a/Examples/test-suite/python/python_threads_runme.py b/Examples/test-suite/python/python_threads_runme.py
new file mode 100644
index 000000000..d00e2458f
--- /dev/null
+++ b/Examples/test-suite/python/python_threads_runme.py
@@ -0,0 +1,10 @@
+from python_threads import *
+
+action = ActionGroup()
+count = 1
+for child in action.GetActionList():
+ if child.val != count:
+ raise RuntimeError("Expected: " + str(count) + " got: " + str(child.val))
+ count = count + 1
+
+# Was seg faulting at the end here
diff --git a/Examples/test-suite/python/smart_pointer_const_overload_runme.py b/Examples/test-suite/python/smart_pointer_const_overload_runme.py
index f1be315a5..098e5b4c3 100644
--- a/Examples/test-suite/python/smart_pointer_const_overload_runme.py
+++ b/Examples/test-suite/python/smart_pointer_const_overload_runme.py
@@ -56,7 +56,7 @@ def test(b, f):
raise RuntimeError
# Test static method
- b.stat()
+ b.statMethod()
if f.access != CONST_ACCESS:
raise RuntimeError
diff --git a/Examples/test-suite/python/threads_exception_runme.py b/Examples/test-suite/python/threads_exception_runme.py
index d4b8855fc..6fe6947ec 100644
--- a/Examples/test-suite/python/threads_exception_runme.py
+++ b/Examples/test-suite/python/threads_exception_runme.py
@@ -20,15 +20,16 @@ except RuntimeError,e:
# This is expected fail with -builtin option
# Throwing builtin classes as exceptions not supported
-try:
- t.hosed()
-except threads_exception.Exc,e:
- code = e.code
- if code != 42:
- raise RuntimeError, "bad... code: %d" % code
- msg = e.msg
- if msg != "Hosed":
- raise RuntimeError, "bad... msg: '%s' len: %d" % (msg, len(msg))
+if not threads_exception.is_python_builtin():
+ try:
+ t.hosed()
+ except threads_exception.Exc,e:
+ code = e.code
+ if code != 42:
+ raise RuntimeError, "bad... code: %d" % code
+ msg = e.msg
+ if msg != "Hosed":
+ raise RuntimeError, "bad... msg: '%s' len: %d" % (msg, len(msg))
for i in range(1,4):
try:
diff --git a/Examples/test-suite/python/unicode_strings_runme.py b/Examples/test-suite/python/unicode_strings_runme.py
new file mode 100644
index 000000000..e1fc7adec
--- /dev/null
+++ b/Examples/test-suite/python/unicode_strings_runme.py
@@ -0,0 +1,14 @@
+import sys
+
+import unicode_strings
+
+# The 'u' string prefix isn't valid in Python 3.0 - 3.2 and is redundant
+# in 3.3+. Since this file is run through 2to3 before testing, though,
+# mark this as a unicode string in 2.x so it'll become a str in 3.x.
+test_string = u'h\udce9llo w\u00f6rld'
+
+if sys.version_info[0:2] >= (3, 1):
+ if unicode_strings.non_utf8_c_str() != test_string:
+ raise ValueError('Test comparison mismatch')
+ if unicode_strings.non_utf8_std_string() != test_string:
+ raise ValueError('Test comparison mismatch')
diff --git a/Examples/test-suite/python_abstractbase.i b/Examples/test-suite/python_abstractbase.i
index f72688237..65f3d9931 100644
--- a/Examples/test-suite/python_abstractbase.i
+++ b/Examples/test-suite/python_abstractbase.i
@@ -16,3 +16,11 @@ namespace std
%template(IntVector) vector<int>;
%template(IntList) list<int>;
}
+
+%inline %{
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
+%}
diff --git a/Examples/test-suite/python_append.i b/Examples/test-suite/python_append.i
index e263c392b..f37a6c199 100644
--- a/Examples/test-suite/python_append.i
+++ b/Examples/test-suite/python_append.i
@@ -5,22 +5,22 @@ Testcase to test %pythonprepend and %pythonappend %pythoncode %pythonbegin
%module python_append
%pythoncode %{
- mypath = os.path.dirname("/a/b/c/d.txt")
- funcpath = None
- staticfuncpath = None
- def grabpath():
+mypath = os.path.dirname("/a/b/c/d.txt")
+funcpath = None
+staticfuncpath = None
+def grabpath():
return funcpath
- def grabstaticpath():
+def grabstaticpath():
return staticfuncpath
%}
%pythonappend Test::func %{
- funcpath = os.path.dirname(funcpath)
+funcpath = os.path.dirname(funcpath)
%}
%pythonprepend Test::func %{
- global funcpath
- funcpath = mypath
+global funcpath
+funcpath = mypath
%}
%pythonappend Test::static_func %{
@@ -29,9 +29,9 @@ pass
%}
%pythonprepend Test::static_func {
- global staticfuncpath
- staticfuncpath = mypath
- pass
+global staticfuncpath
+staticfuncpath = mypath
+pass
}
%pythonbegin %{
@@ -46,5 +46,10 @@ public:
void func() {};
};
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
%}
diff --git a/Examples/test-suite/python_nondynamic.i b/Examples/test-suite/python_nondynamic.i
index 26c69644d..54a3f28ca 100644
--- a/Examples/test-suite/python_nondynamic.i
+++ b/Examples/test-suite/python_nondynamic.i
@@ -1,7 +1,7 @@
%module python_nondynamic
/*
- Use the %pythonnondynamic directuve to make the wrapped class a
+ Use the %pythonnondynamic directive to make the wrapped class a
nondynamic one, ie, a python class that doesn't dynamically add new
attributes. Hence, for the class
diff --git a/Examples/test-suite/python_threads.i b/Examples/test-suite/python_threads.i
new file mode 100644
index 000000000..08eddef11
--- /dev/null
+++ b/Examples/test-suite/python_threads.i
@@ -0,0 +1,40 @@
+%module(threads=1) python_threads
+
+%include <std_vector.i>
+
+%inline %{
+struct Action {
+ int val;
+ Action(int val = 0) : val(val) {}
+};
+%}
+
+%template(VectorActionPtr) std::vector<Action *>;
+
+%inline %{
+#include <vector>
+#include <iostream>
+template <typename T> struct myStlVector : public std::vector<T> {
+};
+typedef myStlVector <Action *> ActionList;
+
+%}
+
+%template(ActionList) myStlVector<Action *>;
+
+%inline %{
+class ActionGroup
+{
+public:
+ ActionList &GetActionList () const {
+ static ActionList list;
+ list.push_back(new Action(1));
+ list.push_back(new Action(2));
+ list.push_back(new Action(3));
+ list.push_back(new Action(4));
+ return list;
+ }
+};
+%}
+
+
diff --git a/Examples/test-suite/r/Makefile.in b/Examples/test-suite/r/Makefile.in
index 18e2d4b25..d0489531f 100644
--- a/Examples/test-suite/r/Makefile.in
+++ b/Examples/test-suite/r/Makefile.in
@@ -6,6 +6,7 @@ LANGUAGE = r
SCRIPTSUFFIX = _runme.R
WRAPSUFFIX = .R
RUNR = R CMD BATCH --no-save --no-restore
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -28,7 +29,7 @@ include $(srcdir)/../common.mk
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -38,34 +39,34 @@ include $(srcdir)/../common.mk
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_multitestcase)
# Runs the testcase.
-#
-# Run the runme if it exists. If not just load the R wrapper to
+#
+# Run the runme if it exists. If not just load the R wrapper to
# check for syntactic correctness
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" $(RUNTOOL) $(RUNR) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
else \
- $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(WRAPSUFFIX); \
+ $(RUNTOOL) $(RUNR) ./$(SCRIPTPREFIX)$*$(WRAPSUFFIX); \
fi
run_multitestcase = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) ]; then \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" \
- $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX); \
+ $(RUNTOOL) $(RUNR) $(SCRIPTDIR)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX); \
else \
- $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(WRAPSUFFIX); \
+ $(RUNTOOL) $(RUNR) ./$(SCRIPTPREFIX)$${f}$(WRAPSUFFIX); \
fi; \
done
# Clean
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile r_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" r_clean
%.clean:
@rm -f $*.R $*_wrap.so $*_wrap.cpp $*_wrap.c $*_wrap.o $*_runme.Rout $*.Rout
@@ -74,5 +75,3 @@ clean:
rm -f $${f}.R $${f}.Rout ; \
done \
fi
-
-
diff --git a/Examples/test-suite/r_overload_array.i b/Examples/test-suite/r_overload_array.i
index 1474661c4..aa714dfdb 100644
--- a/Examples/test-suite/r_overload_array.i
+++ b/Examples/test-suite/r_overload_array.i
@@ -1,7 +1,8 @@
%module r_overload_array
-%include "stl.i"
-# this tests the situation in which there is a scalar function
-# corresponding with a vector one
+
+%include <stl.i>
+// this tests the situation in which there is a scalar function
+// corresponding with a vector one
%inline %{
class Foo {
diff --git a/Examples/test-suite/ruby/Makefile.in b/Examples/test-suite/ruby/Makefile.in
index ab366ccd4..ae4995882 100644
--- a/Examples/test-suite/ruby/Makefile.in
+++ b/Examples/test-suite/ruby/Makefile.in
@@ -5,12 +5,12 @@
LANGUAGE = ruby
RUBY = @RUBY@
SCRIPTSUFFIX = _runme.rb
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
CPP_TEST_CASES = \
- kwargs_feature \
li_cdata \
li_cstring \
li_factory \
@@ -42,7 +42,7 @@ SWIGOPT += -w801 -noautorename -features autodoc=4
ruby_naming.cpptest: SWIGOPT += -autorename
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -52,7 +52,7 @@ ruby_naming.cpptest: SWIGOPT += -autorename
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -60,13 +60,13 @@ ruby_naming.cpptest: SWIGOPT += -autorename
# 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 $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) -I$(srcdir):. $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) -I$(srcdir):. $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:
-
+ @exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile ruby_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" ruby_clean
diff --git a/Examples/test-suite/ruby/abstract_access_runme.rb b/Examples/test-suite/ruby/abstract_access_runme.rb
index 6f91702c9..6f91702c9 100755..100644
--- a/Examples/test-suite/ruby/abstract_access_runme.rb
+++ b/Examples/test-suite/ruby/abstract_access_runme.rb
diff --git a/Examples/test-suite/ruby/access_change_runme.rb b/Examples/test-suite/ruby/access_change_runme.rb
index 5b3e99c58..5b3e99c58 100755..100644
--- a/Examples/test-suite/ruby/access_change_runme.rb
+++ b/Examples/test-suite/ruby/access_change_runme.rb
diff --git a/Examples/test-suite/ruby/add_link_runme.rb b/Examples/test-suite/ruby/add_link_runme.rb
index 8f726d27a..8f726d27a 100755..100644
--- a/Examples/test-suite/ruby/add_link_runme.rb
+++ b/Examples/test-suite/ruby/add_link_runme.rb
diff --git a/Examples/test-suite/ruby/anonymous_bitfield_runme.rb b/Examples/test-suite/ruby/anonymous_bitfield_runme.rb
index 6949a3f28..6949a3f28 100755..100644
--- a/Examples/test-suite/ruby/anonymous_bitfield_runme.rb
+++ b/Examples/test-suite/ruby/anonymous_bitfield_runme.rb
diff --git a/Examples/test-suite/ruby/apply_signed_char_runme.rb b/Examples/test-suite/ruby/apply_signed_char_runme.rb
index 3256e1f02..3256e1f02 100755..100644
--- a/Examples/test-suite/ruby/apply_signed_char_runme.rb
+++ b/Examples/test-suite/ruby/apply_signed_char_runme.rb
diff --git a/Examples/test-suite/ruby/apply_strings_runme.rb b/Examples/test-suite/ruby/apply_strings_runme.rb
index 299b96bb6..299b96bb6 100755..100644
--- a/Examples/test-suite/ruby/apply_strings_runme.rb
+++ b/Examples/test-suite/ruby/apply_strings_runme.rb
diff --git a/Examples/test-suite/ruby/argout_runme.rb b/Examples/test-suite/ruby/argout_runme.rb
index 54cb8f30f..54cb8f30f 100755..100644
--- a/Examples/test-suite/ruby/argout_runme.rb
+++ b/Examples/test-suite/ruby/argout_runme.rb
diff --git a/Examples/test-suite/ruby/arrays_runme.rb b/Examples/test-suite/ruby/arrays_runme.rb
index 749d81758..749d81758 100755..100644
--- a/Examples/test-suite/ruby/arrays_runme.rb
+++ b/Examples/test-suite/ruby/arrays_runme.rb
diff --git a/Examples/test-suite/ruby/cast_operator_runme.rb b/Examples/test-suite/ruby/cast_operator_runme.rb
index 4879befbf..4879befbf 100755..100644
--- a/Examples/test-suite/ruby/cast_operator_runme.rb
+++ b/Examples/test-suite/ruby/cast_operator_runme.rb
diff --git a/Examples/test-suite/ruby/casts_runme.rb b/Examples/test-suite/ruby/casts_runme.rb
index d1f536d75..d1f536d75 100755..100644
--- a/Examples/test-suite/ruby/casts_runme.rb
+++ b/Examples/test-suite/ruby/casts_runme.rb
diff --git a/Examples/test-suite/ruby/check_missing_tests.rb b/Examples/test-suite/ruby/check_missing_tests.rb
index 97e197e3a..97e197e3a 100755..100644
--- a/Examples/test-suite/ruby/check_missing_tests.rb
+++ b/Examples/test-suite/ruby/check_missing_tests.rb
diff --git a/Examples/test-suite/ruby/class_ignore_runme.rb b/Examples/test-suite/ruby/class_ignore_runme.rb
index 28e432486..28e432486 100755..100644
--- a/Examples/test-suite/ruby/class_ignore_runme.rb
+++ b/Examples/test-suite/ruby/class_ignore_runme.rb
diff --git a/Examples/test-suite/ruby/const_const_runme.rb b/Examples/test-suite/ruby/const_const_runme.rb
index cadc73a94..cadc73a94 100755..100644
--- a/Examples/test-suite/ruby/const_const_runme.rb
+++ b/Examples/test-suite/ruby/const_const_runme.rb
diff --git a/Examples/test-suite/ruby/constover_runme.rb b/Examples/test-suite/ruby/constover_runme.rb
index 49c0c81e8..49c0c81e8 100755..100644
--- a/Examples/test-suite/ruby/constover_runme.rb
+++ b/Examples/test-suite/ruby/constover_runme.rb
diff --git a/Examples/test-suite/ruby/cpp11_strongly_typed_enumerations_runme.rb b/Examples/test-suite/ruby/cpp11_strongly_typed_enumerations_runme.rb
new file mode 100644
index 000000000..897a44281
--- /dev/null
+++ b/Examples/test-suite/ruby/cpp11_strongly_typed_enumerations_runme.rb
@@ -0,0 +1,177 @@
+#!/usr/bin/env ruby
+#
+# Put description here
+#
+#
+#
+#
+#
+
+require 'swig_assert'
+
+require 'cpp11_strongly_typed_enumerations'
+
+include Cpp11_strongly_typed_enumerations
+
+def enumCheck(actual, expected)
+ raise RuntimeError,"Enum value mismatch. Expected #{expected} Actual: #{actual}" if actual != expected
+ return expected + 1
+end
+
+val = 0
+val = enumCheck(Enum1_Val1, val)
+val = enumCheck(Enum1_Val2, val)
+val = enumCheck(Enum1_Val3, 13)
+val = enumCheck(Enum1_Val4, val)
+val = enumCheck(Enum1_Val5a, 13)
+val = enumCheck(Enum1_Val6a, val)
+
+val = 0
+val = enumCheck(Enum2_Val1, val)
+val = enumCheck(Enum2_Val2, val)
+val = enumCheck(Enum2_Val3, 23)
+val = enumCheck(Enum2_Val4, val)
+val = enumCheck(Enum2_Val5b, 23)
+val = enumCheck(Enum2_Val6b, val)
+
+val = 0
+val = enumCheck(Val1, val)
+val = enumCheck(Val2, val)
+val = enumCheck(Val3, 43)
+val = enumCheck(Val4, val)
+
+val = 0
+val = enumCheck(Enum5_Val1, val)
+val = enumCheck(Enum5_Val2, val)
+val = enumCheck(Enum5_Val3, 53)
+val = enumCheck(Enum5_Val4, val)
+
+val = 0
+val = enumCheck(Enum6_Val1, val)
+val = enumCheck(Enum6_Val2, val)
+val = enumCheck(Enum6_Val3, 63)
+val = enumCheck(Enum6_Val4, val)
+
+val = 0
+val = enumCheck(Enum7td_Val1, val)
+val = enumCheck(Enum7td_Val2, val)
+val = enumCheck(Enum7td_Val3, 73)
+val = enumCheck(Enum7td_Val4, val)
+
+val = 0
+val = enumCheck(Enum8_Val1, val)
+val = enumCheck(Enum8_Val2, val)
+val = enumCheck(Enum8_Val3, 83)
+val = enumCheck(Enum8_Val4, val)
+
+val = 0
+val = enumCheck(Enum10_Val1, val)
+val = enumCheck(Enum10_Val2, val)
+val = enumCheck(Enum10_Val3, 103)
+val = enumCheck(Enum10_Val4, val)
+
+val = 0
+val = enumCheck(Class1::Enum12_Val1, 1121)
+val = enumCheck(Class1::Enum12_Val2, 1122)
+val = enumCheck(Class1::Enum12_Val3, val)
+val = enumCheck(Class1::Enum12_Val4, val)
+val = enumCheck(Class1::Enum12_Val5c, 1121)
+val = enumCheck(Class1::Enum12_Val6c, val)
+
+val = 0
+val = enumCheck(Class1::Val1, 1131)
+val = enumCheck(Class1::Val2, 1132)
+val = enumCheck(Class1::Val3, val)
+val = enumCheck(Class1::Val4, val)
+val = enumCheck(Class1::Val5d, 1131)
+val = enumCheck(Class1::Val6d, val)
+
+val = 0
+val = enumCheck(Class1::Enum14_Val1, 1141)
+val = enumCheck(Class1::Enum14_Val2, 1142)
+val = enumCheck(Class1::Enum14_Val3, val)
+val = enumCheck(Class1::Enum14_Val4, val)
+val = enumCheck(Class1::Enum14_Val5e, 1141)
+val = enumCheck(Class1::Enum14_Val6e, val)
+
+# Requires nested class support to work
+#val = 0
+#val = enumCheck(Class1::Struct1.Enum12_Val1, 3121)
+#val = enumCheck(Class1::Struct1.Enum12_Val2, 3122)
+#val = enumCheck(Class1::Struct1.Enum12_Val3, val)
+#val = enumCheck(Class1::Struct1.Enum12_Val4, val)
+#val = enumCheck(Class1::Struct1.Enum12_Val5f, 3121)
+#val = enumCheck(Class1::Struct1.Enum12_Val6f, val)
+#
+#val = 0
+#val = enumCheck(Class1::Struct1.Val1, 3131)
+#val = enumCheck(Class1::Struct1.Val2, 3132)
+#val = enumCheck(Class1::Struct1.Val3, val)
+#val = enumCheck(Class1::Struct1.Val4, val)
+#
+#val = 0
+#val = enumCheck(Class1::Struct1.Enum14_Val1, 3141)
+#val = enumCheck(Class1::Struct1.Enum14_Val2, 3142)
+#val = enumCheck(Class1::Struct1.Enum14_Val3, val)
+#val = enumCheck(Class1::Struct1.Enum14_Val4, val)
+#val = enumCheck(Class1::Struct1.Enum14_Val5g, 3141)
+#val = enumCheck(Class1::Struct1.Enum14_Val6g, val)
+
+val = 0
+val = enumCheck(Class2::Enum12_Val1, 2121)
+val = enumCheck(Class2::Enum12_Val2, 2122)
+val = enumCheck(Class2::Enum12_Val3, val)
+val = enumCheck(Class2::Enum12_Val4, val)
+val = enumCheck(Class2::Enum12_Val5h, 2121)
+val = enumCheck(Class2::Enum12_Val6h, val)
+
+val = 0
+val = enumCheck(Class2::Val1, 2131)
+val = enumCheck(Class2::Val2, 2132)
+val = enumCheck(Class2::Val3, val)
+val = enumCheck(Class2::Val4, val)
+val = enumCheck(Class2::Val5i, 2131)
+val = enumCheck(Class2::Val6i, val)
+
+val = 0
+val = enumCheck(Class2::Enum14_Val1, 2141)
+val = enumCheck(Class2::Enum14_Val2, 2142)
+val = enumCheck(Class2::Enum14_Val3, val)
+val = enumCheck(Class2::Enum14_Val4, val)
+val = enumCheck(Class2::Enum14_Val5j, 2141)
+val = enumCheck(Class2::Enum14_Val6j, val)
+
+# Requires nested class support to work
+#val = 0
+#val = enumCheck(Class2::Struct1.Enum12_Val1, 4121)
+#val = enumCheck(Class2::Struct1.Enum12_Val2, 4122)
+#val = enumCheck(Class2::Struct1.Enum12_Val3, val)
+#val = enumCheck(Class2::Struct1.Enum12_Val4, val)
+#val = enumCheck(Class2::Struct1.Enum12_Val5k, 4121)
+#val = enumCheck(Class2::Struct1.Enum12_Val6k, val)
+#
+#val = 0
+#val = enumCheck(Class2::Struct1.Val1, 4131)
+#val = enumCheck(Class2::Struct1.Val2, 4132)
+#val = enumCheck(Class2::Struct1.Val3, val)
+#val = enumCheck(Class2::Struct1.Val4, val)
+#val = enumCheck(Class2::Struct1.Val5l, 4131)
+#val = enumCheck(Class2::Struct1.Val6l, val)
+#
+#val = 0
+#val = enumCheck(Class2::Struct1.Enum14_Val1, 4141)
+#val = enumCheck(Class2::Struct1.Enum14_Val2, 4142)
+#val = enumCheck(Class2::Struct1.Enum14_Val3, val)
+#val = enumCheck(Class2::Struct1.Enum14_Val4, val)
+#val = enumCheck(Class2::Struct1.Enum14_Val5m, 4141)
+#val = enumCheck(Class2::Struct1.Enum14_Val6m, val)
+
+class1 = Class1.new
+enumCheck(class1.class1Test1(Enum1_Val5a), 13)
+enumCheck(class1.class1Test2(Class1::Enum12_Val5c), 1121)
+#enumCheck(class1.class1Test3(Class1::Struct1.Enum12_Val5f), 3121)
+
+enumCheck(globalTest1(Enum1_Val5a), 13)
+enumCheck(globalTest2(Class1::Enum12_Val5c), 1121)
+#enumCheck(globalTest3(Class1::Struct1.Enum12_Val5f), 3121)
+
diff --git a/Examples/test-suite/ruby/cpp_namespace_runme.rb b/Examples/test-suite/ruby/cpp_namespace_runme.rb
index 53649faf5..53649faf5 100755..100644
--- a/Examples/test-suite/ruby/cpp_namespace_runme.rb
+++ b/Examples/test-suite/ruby/cpp_namespace_runme.rb
diff --git a/Examples/test-suite/ruby/default_constructor_runme.rb b/Examples/test-suite/ruby/default_constructor_runme.rb
index 2706f67ca..2706f67ca 100755..100644
--- a/Examples/test-suite/ruby/default_constructor_runme.rb
+++ b/Examples/test-suite/ruby/default_constructor_runme.rb
diff --git a/Examples/test-suite/ruby/dynamic_cast_runme.rb b/Examples/test-suite/ruby/dynamic_cast_runme.rb
index 8239051b1..8239051b1 100755..100644
--- a/Examples/test-suite/ruby/dynamic_cast_runme.rb
+++ b/Examples/test-suite/ruby/dynamic_cast_runme.rb
diff --git a/Examples/test-suite/ruby/enum_thorough_runme.rb b/Examples/test-suite/ruby/enum_thorough_runme.rb
index e4a1ec719..e4a1ec719 100755..100644
--- a/Examples/test-suite/ruby/enum_thorough_runme.rb
+++ b/Examples/test-suite/ruby/enum_thorough_runme.rb
diff --git a/Examples/test-suite/ruby/function_typedef_runme.rb b/Examples/test-suite/ruby/function_typedef_runme.rb
index c17f44d19..c17f44d19 100755..100644
--- a/Examples/test-suite/ruby/function_typedef_runme.rb
+++ b/Examples/test-suite/ruby/function_typedef_runme.rb
diff --git a/Examples/test-suite/ruby/imports_runme.rb b/Examples/test-suite/ruby/imports_runme.rb
index 8bd242e86..8bd242e86 100755..100644
--- a/Examples/test-suite/ruby/imports_runme.rb
+++ b/Examples/test-suite/ruby/imports_runme.rb
diff --git a/Examples/test-suite/ruby/integers_runme.rb b/Examples/test-suite/ruby/integers_runme.rb
index b6ca45891..b6ca45891 100755..100644
--- a/Examples/test-suite/ruby/integers_runme.rb
+++ b/Examples/test-suite/ruby/integers_runme.rb
diff --git a/Examples/test-suite/ruby/li_cstring_runme.rb b/Examples/test-suite/ruby/li_cstring_runme.rb
index a4ffcad02..a4ffcad02 100755..100644
--- a/Examples/test-suite/ruby/li_cstring_runme.rb
+++ b/Examples/test-suite/ruby/li_cstring_runme.rb
diff --git a/Examples/test-suite/ruby/li_math_runme.rb b/Examples/test-suite/ruby/li_math_runme.rb
index 038278315..038278315 100755..100644
--- a/Examples/test-suite/ruby/li_math_runme.rb
+++ b/Examples/test-suite/ruby/li_math_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_functors_runme.rb b/Examples/test-suite/ruby/li_std_functors_runme.rb
index 5623d49f0..5623d49f0 100755..100644
--- a/Examples/test-suite/ruby/li_std_functors_runme.rb
+++ b/Examples/test-suite/ruby/li_std_functors_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_map_runme.rb b/Examples/test-suite/ruby/li_std_map_runme.rb
index 0ec8cac84..0ec8cac84 100755..100644
--- a/Examples/test-suite/ruby/li_std_map_runme.rb
+++ b/Examples/test-suite/ruby/li_std_map_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_multimap_runme.rb b/Examples/test-suite/ruby/li_std_multimap_runme.rb
index b0c2bb359..b0c2bb359 100755..100644
--- a/Examples/test-suite/ruby/li_std_multimap_runme.rb
+++ b/Examples/test-suite/ruby/li_std_multimap_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_pair_runme.rb b/Examples/test-suite/ruby/li_std_pair_runme.rb
index 685046fd2..685046fd2 100755..100644
--- a/Examples/test-suite/ruby/li_std_pair_runme.rb
+++ b/Examples/test-suite/ruby/li_std_pair_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_queue_runme.rb b/Examples/test-suite/ruby/li_std_queue_runme.rb
index 63101ed6e..63101ed6e 100755..100644
--- a/Examples/test-suite/ruby/li_std_queue_runme.rb
+++ b/Examples/test-suite/ruby/li_std_queue_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_set_runme.rb b/Examples/test-suite/ruby/li_std_set_runme.rb
index efc163bee..efc163bee 100755..100644
--- a/Examples/test-suite/ruby/li_std_set_runme.rb
+++ b/Examples/test-suite/ruby/li_std_set_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_speed2_runme.rb b/Examples/test-suite/ruby/li_std_speed2_runme.rb
index 1c4e15f2d..1c4e15f2d 100755..100644
--- a/Examples/test-suite/ruby/li_std_speed2_runme.rb
+++ b/Examples/test-suite/ruby/li_std_speed2_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_stack_runme.rb b/Examples/test-suite/ruby/li_std_stack_runme.rb
index 806bba029..806bba029 100755..100644
--- a/Examples/test-suite/ruby/li_std_stack_runme.rb
+++ b/Examples/test-suite/ruby/li_std_stack_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_stream_runme.rb b/Examples/test-suite/ruby/li_std_stream_runme.rb
index 80c5166f3..80c5166f3 100755..100644
--- a/Examples/test-suite/ruby/li_std_stream_runme.rb
+++ b/Examples/test-suite/ruby/li_std_stream_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_vector_enum_runme.rb b/Examples/test-suite/ruby/li_std_vector_enum_runme.rb
index c997fd04f..c997fd04f 100755..100644
--- a/Examples/test-suite/ruby/li_std_vector_enum_runme.rb
+++ b/Examples/test-suite/ruby/li_std_vector_enum_runme.rb
diff --git a/Examples/test-suite/ruby/li_std_vector_runme.rb b/Examples/test-suite/ruby/li_std_vector_runme.rb
index fe3d9e0ce..fe3d9e0ce 100755..100644
--- a/Examples/test-suite/ruby/li_std_vector_runme.rb
+++ b/Examples/test-suite/ruby/li_std_vector_runme.rb
diff --git a/Examples/test-suite/ruby/namespace_typemap_runme.rb b/Examples/test-suite/ruby/namespace_typemap_runme.rb
index 42a5e23a7..42a5e23a7 100755..100644
--- a/Examples/test-suite/ruby/namespace_typemap_runme.rb
+++ b/Examples/test-suite/ruby/namespace_typemap_runme.rb
diff --git a/Examples/test-suite/ruby/overload_bool_runme.rb b/Examples/test-suite/ruby/overload_bool_runme.rb
index 8b7568e94..8b7568e94 100755..100644
--- a/Examples/test-suite/ruby/overload_bool_runme.rb
+++ b/Examples/test-suite/ruby/overload_bool_runme.rb
diff --git a/Examples/test-suite/ruby/overload_copy_runme.rb b/Examples/test-suite/ruby/overload_copy_runme.rb
index eb184b83c..eb184b83c 100755..100644
--- a/Examples/test-suite/ruby/overload_copy_runme.rb
+++ b/Examples/test-suite/ruby/overload_copy_runme.rb
diff --git a/Examples/test-suite/ruby/overload_extend_runme.rb b/Examples/test-suite/ruby/overload_extend_runme.rb
index 255793fb4..255793fb4 100755..100644
--- a/Examples/test-suite/ruby/overload_extend_runme.rb
+++ b/Examples/test-suite/ruby/overload_extend_runme.rb
diff --git a/Examples/test-suite/ruby/overload_extendc_runme.rb b/Examples/test-suite/ruby/overload_extendc_runme.rb
index a2682bf42..a2682bf42 100755..100644
--- a/Examples/test-suite/ruby/overload_extendc_runme.rb
+++ b/Examples/test-suite/ruby/overload_extendc_runme.rb
diff --git a/Examples/test-suite/ruby/overload_simple_runme.rb b/Examples/test-suite/ruby/overload_simple_runme.rb
index 88cee4411..88cee4411 100755..100644
--- a/Examples/test-suite/ruby/overload_simple_runme.rb
+++ b/Examples/test-suite/ruby/overload_simple_runme.rb
diff --git a/Examples/test-suite/ruby/overload_template_runme.rb b/Examples/test-suite/ruby/overload_template_runme.rb
index b099fd3ea..b099fd3ea 100755..100644
--- a/Examples/test-suite/ruby/overload_template_runme.rb
+++ b/Examples/test-suite/ruby/overload_template_runme.rb
diff --git a/Examples/test-suite/ruby/primitive_ref_runme.rb b/Examples/test-suite/ruby/primitive_ref_runme.rb
index 5e97c7a6c..5e97c7a6c 100755..100644
--- a/Examples/test-suite/ruby/primitive_ref_runme.rb
+++ b/Examples/test-suite/ruby/primitive_ref_runme.rb
diff --git a/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb b/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb
index e79cb46a8..e79cb46a8 100755..100644
--- a/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb
+++ b/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb
diff --git a/Examples/test-suite/ruby/sneaky1_runme.rb b/Examples/test-suite/ruby/sneaky1_runme.rb
index c30fdaf2a..c30fdaf2a 100755..100644
--- a/Examples/test-suite/ruby/sneaky1_runme.rb
+++ b/Examples/test-suite/ruby/sneaky1_runme.rb
diff --git a/Examples/test-suite/ruby/std_containers_runme.rb b/Examples/test-suite/ruby/std_containers_runme.rb
index 73d443218..73d443218 100755..100644
--- a/Examples/test-suite/ruby/std_containers_runme.rb
+++ b/Examples/test-suite/ruby/std_containers_runme.rb
diff --git a/Examples/test-suite/ruby/stl_new_runme.rb b/Examples/test-suite/ruby/stl_new_runme.rb
index 80d4ceab3..80d4ceab3 100755..100644
--- a/Examples/test-suite/ruby/stl_new_runme.rb
+++ b/Examples/test-suite/ruby/stl_new_runme.rb
diff --git a/Examples/test-suite/ruby/swig_assert.rb b/Examples/test-suite/ruby/swig_assert.rb
index 200b08384..200b08384 100755..100644
--- a/Examples/test-suite/ruby/swig_assert.rb
+++ b/Examples/test-suite/ruby/swig_assert.rb
diff --git a/Examples/test-suite/ruby/swig_gc.rb b/Examples/test-suite/ruby/swig_gc.rb
index 30f6dfa42..30f6dfa42 100755..100644
--- a/Examples/test-suite/ruby/swig_gc.rb
+++ b/Examples/test-suite/ruby/swig_gc.rb
diff --git a/Examples/test-suite/ruby/template_inherit_runme.rb b/Examples/test-suite/ruby/template_inherit_runme.rb
index 609508891..609508891 100755..100644
--- a/Examples/test-suite/ruby/template_inherit_runme.rb
+++ b/Examples/test-suite/ruby/template_inherit_runme.rb
diff --git a/Examples/test-suite/ruby/template_ns4_runme.rb b/Examples/test-suite/ruby/template_ns4_runme.rb
index bf2c5f566..bf2c5f566 100755..100644
--- a/Examples/test-suite/ruby/template_ns4_runme.rb
+++ b/Examples/test-suite/ruby/template_ns4_runme.rb
diff --git a/Examples/test-suite/ruby/template_ns_runme.rb b/Examples/test-suite/ruby/template_ns_runme.rb
index 6446127cd..6446127cd 100755..100644
--- a/Examples/test-suite/ruby/template_ns_runme.rb
+++ b/Examples/test-suite/ruby/template_ns_runme.rb
diff --git a/Examples/test-suite/ruby/template_rename_runme.rb b/Examples/test-suite/ruby/template_rename_runme.rb
index 18cfd4caa..18cfd4caa 100755..100644
--- a/Examples/test-suite/ruby/template_rename_runme.rb
+++ b/Examples/test-suite/ruby/template_rename_runme.rb
diff --git a/Examples/test-suite/ruby/typedef_inherit_runme.rb b/Examples/test-suite/ruby/typedef_inherit_runme.rb
index 029b80c70..029b80c70 100755..100644
--- a/Examples/test-suite/ruby/typedef_inherit_runme.rb
+++ b/Examples/test-suite/ruby/typedef_inherit_runme.rb
diff --git a/Examples/test-suite/ruby/typedef_scope_runme.rb b/Examples/test-suite/ruby/typedef_scope_runme.rb
index 4858a2ef6..4858a2ef6 100755..100644
--- a/Examples/test-suite/ruby/typedef_scope_runme.rb
+++ b/Examples/test-suite/ruby/typedef_scope_runme.rb
diff --git a/Examples/test-suite/ruby/typemap_namespace_runme.rb b/Examples/test-suite/ruby/typemap_namespace_runme.rb
index 09eb57e39..09eb57e39 100755..100644
--- a/Examples/test-suite/ruby/typemap_namespace_runme.rb
+++ b/Examples/test-suite/ruby/typemap_namespace_runme.rb
diff --git a/Examples/test-suite/ruby/typename_runme.rb b/Examples/test-suite/ruby/typename_runme.rb
index 65de7334d..65de7334d 100755..100644
--- a/Examples/test-suite/ruby/typename_runme.rb
+++ b/Examples/test-suite/ruby/typename_runme.rb
diff --git a/Examples/test-suite/smart_pointer_const_overload.i b/Examples/test-suite/smart_pointer_const_overload.i
index e3b000b52..75a137b73 100644
--- a/Examples/test-suite/smart_pointer_const_overload.i
+++ b/Examples/test-suite/smart_pointer_const_overload.i
@@ -34,7 +34,7 @@ struct Foo {
Foo() : x(0), xp(&x), y(0), yp(&y), access(0) { }
int getx() const { return x; }
void setx(int x_) { x = x_; }
- static void stat() {}
+ static void statMethod() {}
};
%}
diff --git a/Examples/test-suite/smart_pointer_templatemethods.i b/Examples/test-suite/smart_pointer_templatemethods.i
index f79bbcc9d..bd8808aff 100644
--- a/Examples/test-suite/smart_pointer_templatemethods.i
+++ b/Examples/test-suite/smart_pointer_templatemethods.i
@@ -45,7 +45,7 @@ public:
%template(QueryInterfaceObjct) Objct::QueryInterface<Objct>;
#endif
-}; // namespace
+} // namespace
%}
diff --git a/Examples/test-suite/struct_initialization.i b/Examples/test-suite/struct_initialization.i
index c378ba31d..da1604f1b 100644
--- a/Examples/test-suite/struct_initialization.i
+++ b/Examples/test-suite/struct_initialization.i
@@ -3,7 +3,7 @@
%inline %{
-// Named types
+/* Named types */
struct StructA {
int x;
} instanceA1;
diff --git a/Examples/test-suite/tcl/Makefile.in b/Examples/test-suite/tcl/Makefile.in
index 49d2a7826..82c59dee4 100644
--- a/Examples/test-suite/tcl/Makefile.in
+++ b/Examples/test-suite/tcl/Makefile.in
@@ -4,7 +4,8 @@
LANGUAGE = tcl
TCLSH = tclsh
-SCRIPTSUFFIX = _runme.tcl
+SCRIPTSUFFIX = _runme.tcl
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -27,7 +28,7 @@ include $(srcdir)/../common.mk
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -37,7 +38,7 @@ include $(srcdir)/../common.mk
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -45,13 +46,13 @@ include $(srcdir)/../common.mk
# 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 $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(TCLSH) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(TCLSH) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:
-
+ @exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile tcl_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" tcl_clean
diff --git a/Examples/test-suite/tcl/cpp11_strongly_typed_enumerations_runme.tcl b/Examples/test-suite/tcl/cpp11_strongly_typed_enumerations_runme.tcl
new file mode 100644
index 000000000..5132101ad
--- /dev/null
+++ b/Examples/test-suite/tcl/cpp11_strongly_typed_enumerations_runme.tcl
@@ -0,0 +1,172 @@
+
+if [ catch { load ./cpp11_strongly_typed_enumerations[info sharedlibextension] cpp11_strongly_typed_enumerations} err_msg ] {
+ puts stderr "Could not load shared object:\n$err_msg"
+}
+
+proc enumCheck {actual expected} {
+ if {$actual != $expected} {
+ error "Enum value mismatch. Expected $expected. Actual: $actual"
+ }
+ return [expr $expected + 1]
+}
+
+#set val 0
+#set val [enumCheck $Enum1_Val1 $val]
+#set val [enumCheck $Enum1_Val2 $val]
+
+set val 0
+set val [enumCheck $Enum1_Val1 $val]
+set val [enumCheck $Enum1_Val2 $val]
+set val [enumCheck $Enum1_Val3 13]
+set val [enumCheck $Enum1_Val4 $val]
+set val [enumCheck $Enum1_Val5a 13]
+set val [enumCheck $Enum1_Val6a $val]
+
+set val 0
+set val [enumCheck $Enum2_Val1 $val]
+set val [enumCheck $Enum2_Val2 $val]
+set val [enumCheck $Enum2_Val3 23]
+set val [enumCheck $Enum2_Val4 $val]
+set val [enumCheck $Enum2_Val5b 23]
+set val [enumCheck $Enum2_Val6b $val]
+
+set val 0
+set val [enumCheck $Val1 $val]
+set val [enumCheck $Val2 $val]
+set val [enumCheck $Val3 43]
+set val [enumCheck $Val4 $val]
+
+set val 0
+set val [enumCheck $Enum5_Val1 $val]
+set val [enumCheck $Enum5_Val2 $val]
+set val [enumCheck $Enum5_Val3 53]
+set val [enumCheck $Enum5_Val4 $val]
+
+set val 0
+set val [enumCheck $Enum6_Val1 $val]
+set val [enumCheck $Enum6_Val2 $val]
+set val [enumCheck $Enum6_Val3 63]
+set val [enumCheck $Enum6_Val4 $val]
+
+set val 0
+set val [enumCheck $Enum7td_Val1 $val]
+set val [enumCheck $Enum7td_Val2 $val]
+set val [enumCheck $Enum7td_Val3 73]
+set val [enumCheck $Enum7td_Val4 $val]
+
+set val 0
+set val [enumCheck $Enum8_Val1 $val]
+set val [enumCheck $Enum8_Val2 $val]
+set val [enumCheck $Enum8_Val3 83]
+set val [enumCheck $Enum8_Val4 $val]
+
+set val 0
+set val [enumCheck $Enum10_Val1 $val]
+set val [enumCheck $Enum10_Val2 $val]
+set val [enumCheck $Enum10_Val3 103]
+set val [enumCheck $Enum10_Val4 $val]
+
+set val 0
+set val [enumCheck $Class1_Enum12_Val1 1121]
+set val [enumCheck $Class1_Enum12_Val2 1122]
+set val [enumCheck $Class1_Enum12_Val3 $val]
+set val [enumCheck $Class1_Enum12_Val4 $val]
+set val [enumCheck $Class1_Enum12_Val5c 1121]
+set val [enumCheck $Class1_Enum12_Val6c $val]
+
+set val 0
+set val [enumCheck $Class1_Val1 1131]
+set val [enumCheck $Class1_Val2 1132]
+set val [enumCheck $Class1_Val3 $val]
+set val [enumCheck $Class1_Val4 $val]
+set val [enumCheck $Class1_Val5d 1131]
+set val [enumCheck $Class1_Val6d $val]
+
+set val 0
+set val [enumCheck $Class1_Enum14_Val1 1141]
+set val [enumCheck $Class1_Enum14_Val2 1142]
+set val [enumCheck $Class1_Enum14_Val3 $val]
+set val [enumCheck $Class1_Enum14_Val4 $val]
+set val [enumCheck $Class1_Enum14_Val5e 1141]
+set val [enumCheck $Class1_Enum14_Val6e $val]
+
+# Requires nested class support to work
+#set val 0
+#set val [enumCheck $Class1_Struct1_Enum12_Val1 3121]
+#set val [enumCheck $Class1_Struct1_Enum12_Val2 3122]
+#set val [enumCheck $Class1_Struct1_Enum12_Val3 $val]
+#set val [enumCheck $Class1_Struct1_Enum12_Val4 $val]
+#set val [enumCheck $Class1_Struct1_Enum12_Val5f 3121]
+#set val [enumCheck $Class1_Struct1_Enum12_Val6f $val]
+#
+#set val 0
+#set val [enumCheck $Class1_Struct1_Val1 3131]
+#set val [enumCheck $Class1_Struct1_Val2 3132]
+#set val [enumCheck $Class1_Struct1_Val3 $val]
+#set val [enumCheck $Class1_Struct1_Val4 $val]
+#
+#set val 0
+#set val [enumCheck $Class1_Struct1_Enum14_Val1 3141]
+#set val [enumCheck $Class1_Struct1_Enum14_Val2 3142]
+#set val [enumCheck $Class1_Struct1_Enum14_Val3 $val]
+#set val [enumCheck $Class1_Struct1_Enum14_Val4 $val]
+#set val [enumCheck $Class1_Struct1_Enum14_Val5g 3141]
+#set val [enumCheck $Class1_Struct1_Enum14_Val6g $val]
+
+set val 0
+set val [enumCheck $Class2_Enum12_Val1 2121]
+set val [enumCheck $Class2_Enum12_Val2 2122]
+set val [enumCheck $Class2_Enum12_Val3 $val]
+set val [enumCheck $Class2_Enum12_Val4 $val]
+set val [enumCheck $Class2_Enum12_Val5h 2121]
+set val [enumCheck $Class2_Enum12_Val6h $val]
+
+set val 0
+set val [enumCheck $Class2_Val1 2131]
+set val [enumCheck $Class2_Val2 2132]
+set val [enumCheck $Class2_Val3 $val]
+set val [enumCheck $Class2_Val4 $val]
+set val [enumCheck $Class2_Val5i 2131]
+set val [enumCheck $Class2_Val6i $val]
+
+set val 0
+set val [enumCheck $Class2_Enum14_Val1 2141]
+set val [enumCheck $Class2_Enum14_Val2 2142]
+set val [enumCheck $Class2_Enum14_Val3 $val]
+set val [enumCheck $Class2_Enum14_Val4 $val]
+set val [enumCheck $Class2_Enum14_Val5j 2141]
+set val [enumCheck $Class2_Enum14_Val6j $val]
+
+# Requires nested class support to work
+#set val 0
+#set val [enumCheck $Class2_Struct1_Enum12_Val1 4121]
+#set val [enumCheck $Class2_Struct1_Enum12_Val2 4122]
+#set val [enumCheck $Class2_Struct1_Enum12_Val3 $val]
+#set val [enumCheck $Class2_Struct1_Enum12_Val4 $val]
+#set val [enumCheck $Class2_Struct1_Enum12_Val5k 4121]
+#set val [enumCheck $Class2_Struct1_Enum12_Val6k $val]
+#
+#set val 0
+#set val [enumCheck $Class2_Struct1_Val1 4131]
+#set val [enumCheck $Class2_Struct1_Val2 4132]
+#set val [enumCheck $Class2_Struct1_Val3 $val]
+#set val [enumCheck $Class2_Struct1_Val4 $val]
+#set val [enumCheck $Class2_Struct1_Val5l 4131]
+#set val [enumCheck $Class2_Struct1_Val6l $val]
+#
+#set val 0
+#set val [enumCheck $Class2_Struct1_Enum14_Val1 4141]
+#set val [enumCheck $Class2_Struct1_Enum14_Val2 4142]
+#set val [enumCheck $Class2_Struct1_Enum14_Val3 $val]
+#set val [enumCheck $Class2_Struct1_Enum14_Val4 $val]
+#set val [enumCheck $Class2_Struct1_Enum14_Val5m 4141]
+#set val [enumCheck $Class2_Struct1_Enum14_Val6m $val]
+
+set class1 [Class1]
+enumCheck [$class1 class1Test1 $Enum1_Val5a] 13
+enumCheck [$class1 class1Test2 $Class1_Enum12_Val5c] 1121
+#enumCheck [$class1 class1Test3 $Class1_Struct1_Enum12_Val5f] 3121
+
+enumCheck [globalTest1 $Enum1_Val5a] 13
+enumCheck [globalTest2 $Class1_Enum12_Val5c] 1121
+#enumCheck [globalTest3 $Class1_Struct1_Enum12_Val5f] 3121
diff --git a/Examples/test-suite/template_default_class_parms.i b/Examples/test-suite/template_default_class_parms.i
index cd37269d3..e5a8c9d49 100644
--- a/Examples/test-suite/template_default_class_parms.i
+++ b/Examples/test-suite/template_default_class_parms.i
@@ -31,3 +31,49 @@ namespace Space {
%template(FooAnotherType) Space::Foo<Space::AnotherType>;
%template() Space::ATemplate<>;
+
+
+// Github issue #280 segfault
+%inline %{
+namespace Teuchos {
+ class Describable {};
+}
+namespace KokkosClassic {
+ namespace DefaultNode {
+ struct DefaultNodeType {};
+ };
+}
+
+namespace Tpetra {
+ template <class LocalOrdinal = int,
+ class GlobalOrdinal = LocalOrdinal,
+ class Node = KokkosClassic::DefaultNode::DefaultNodeType>
+ class Map : public Teuchos::Describable {
+ public:
+ typedef LocalOrdinal local_ordinal_type;
+ typedef GlobalOrdinal global_ordinal_type;
+ typedef Node node_type;
+ void test_func(LocalOrdinal, GlobalOrdinal, Node) {}
+ };
+}
+%}
+
+#ifdef SWIGJAVA
+// Fixes still required for other languages
+%template(MapDefaults) Tpetra::Map<>;
+#endif
+
+%inline %{
+namespace Details {
+ template < class LO = ::Tpetra::Map<>::local_ordinal_type,
+ class GO = typename ::Tpetra::Map<LO>::global_ordinal_type,
+ class NT = typename ::Tpetra::Map<LO, GO>::node_type >
+ class Transfer : public Teuchos::Describable {
+ public:
+ void transfer_func(LO, GO, NT) {}
+ };
+}
+%}
+
+// Below is not resolving correctly yet
+//%template(TransferDefaults) Details::Transfer<>;
diff --git a/Examples/test-suite/template_templated_constructors.i b/Examples/test-suite/template_templated_constructors.i
new file mode 100644
index 000000000..ee9df94bb
--- /dev/null
+++ b/Examples/test-suite/template_templated_constructors.i
@@ -0,0 +1,47 @@
+%module template_templated_constructors
+
+%inline %{
+namespace ConstructSpace {
+
+class TConstructor1 {
+public:
+ template<typename T> TConstructor1(T val) {}
+ ~TConstructor1() {}
+};
+
+class TConstructor2 {
+public:
+ TConstructor2() {}
+ template<typename T> TConstructor2(T val) {}
+ ~TConstructor2() {}
+};
+
+template<typename T> class TClass1 {
+public:
+ template<typename Y> TClass1(Y t) {}
+};
+
+template<typename T> class TClass2 {
+public:
+ TClass2() {}
+ template<typename Y> TClass2(Y t) {}
+};
+
+}
+%}
+
+%extend ConstructSpace::TConstructor1 {
+ %template(TConstructor1) TConstructor1<int>;
+}
+
+%template(TConstructor2) ConstructSpace::TConstructor2::TConstructor2<int>;
+
+%template(TClass1Int) ConstructSpace::TClass1<int>;
+%extend ConstructSpace::TClass1<int> {
+ %template(TClass1Int) TClass1<double>;
+}
+
+%template(TClass2Int) ConstructSpace::TClass2<int>;
+%extend ConstructSpace::TClass2<int> {
+ %template(TClass2Int) TClass2<double>;
+}
diff --git a/Examples/test-suite/template_typedef_typedef.i b/Examples/test-suite/template_typedef_typedef.i
index 30077c484..ac96b2db8 100644
--- a/Examples/test-suite/template_typedef_typedef.i
+++ b/Examples/test-suite/template_typedef_typedef.i
@@ -1,7 +1,7 @@
%module template_typedef_typedef
// Github issue #50
-// The Object2::getBlabla2 and Object::getBlabla1 functions were not resolving to the correct template types
+// The Object2::getBlabla2 and Object1::getBlabla1 functions were not resolving to the correct template types
%inline%{
@@ -20,7 +20,7 @@ namespace TT{
};
};
template <typename T>
- class Object:public T {
+ class Object1:public T {
public:
void getBlabla1(typename T::ABCD::CC1 c) {
};
@@ -29,7 +29,7 @@ namespace TT{
class Factory {
public:
- typedef TT::Object<Base> CC1;
+ typedef TT::Object1<Base> CC1;
typedef TT::Object2<Base> CC2;
void getBlabla4(CC2 c) {
};
@@ -38,6 +38,6 @@ class Factory {
};
%}
-%template(ObjectBase) TT::Object<Base>;
+%template(Object1Base) TT::Object1<Base>;
%template(Object2Base) TT::Object2<Base>;
diff --git a/Examples/test-suite/threads_exception.i b/Examples/test-suite/threads_exception.i
index b374f0ce6..caa79c78e 100644
--- a/Examples/test-suite/threads_exception.i
+++ b/Examples/test-suite/threads_exception.i
@@ -52,4 +52,10 @@ public:
return 1;
}
};
+
+#ifdef SWIGPYTHON_BUILTIN
+bool is_python_builtin() { return true; }
+#else
+bool is_python_builtin() { return false; }
+#endif
%}
diff --git a/Examples/test-suite/throw_exception.i b/Examples/test-suite/throw_exception.i
index c1ad945fb..396c633a6 100644
--- a/Examples/test-suite/throw_exception.i
+++ b/Examples/test-suite/throw_exception.i
@@ -16,15 +16,15 @@
%inline %{
-class Error {
+class CError {
};
-void test_is_Error(Error *r) {}
+void test_is_Error(CError *r) {}
namespace Namespace {
- typedef Error ErrorTypedef;
- typedef const Error& ErrorRef;
- typedef const Error* ErrorPtr;
+ typedef CError ErrorTypedef;
+ typedef const CError& ErrorRef;
+ typedef const CError* ErrorPtr;
typedef int IntArray[10];
enum EnumTest { enum1, enum2 };
}
@@ -36,26 +36,26 @@ public:
void test_msg() throw(const char *) {
throw "Dead";
}
- void test_cls() throw(Error) {
- throw Error();
+ void test_cls() throw(CError) {
+ throw CError();
}
- void test_cls_ptr() throw(Error *) {
- static Error StaticError;
+ void test_cls_ptr() throw(CError *) {
+ static CError StaticError;
throw &StaticError;
}
- void test_cls_ref() throw(Error &) {
- static Error StaticError;
+ void test_cls_ref() throw(CError &) {
+ static CError StaticError;
throw StaticError;
}
void test_cls_td() throw(Namespace::ErrorTypedef) {
- throw Error();
+ throw CError();
}
void test_cls_ptr_td() throw(Namespace::ErrorPtr) {
- static Error StaticError;
+ static CError StaticError;
throw &StaticError;
}
void test_cls_ref_td() throw(Namespace::ErrorRef) {
- static Error StaticError;
+ static CError StaticError;
throw StaticError;
}
void test_array() throw(Namespace::IntArray) {
@@ -68,10 +68,10 @@ public:
void test_enum() throw(Namespace::EnumTest) {
throw Namespace::enum2;
}
- void test_multi(int x) throw(int, const char *, Error) {
+ void test_multi(int x) throw(int, const char *, CError) {
if (x == 1) throw 37;
if (x == 2) throw "Dead";
- if (x == 3) throw Error();
+ if (x == 3) throw CError();
}
};
diff --git a/Examples/test-suite/typemap_array_qualifiers.i b/Examples/test-suite/typemap_array_qualifiers.i
index 14df649d3..cbc6c95ff 100644
--- a/Examples/test-suite/typemap_array_qualifiers.i
+++ b/Examples/test-suite/typemap_array_qualifiers.i
@@ -43,8 +43,8 @@ $1 = 0;
/* Correct typemap for $symname: $type */
}
%inline %{
- void func1a(myarray x) {};
- void func1b(volatile myarray x) {};
+ void func1a(myarray x) {}
+ void func1b(volatile myarray x) {}
%}
CLEAR_SWIGTYPE_TYPEMAPS;
@@ -57,9 +57,9 @@ $1 = 0;
/* Correct typemap for $symname: $type */
}
%inline %{
- void func2a(const myarray x) {};
- void func2b(const myconstarray x) {};
- void func2c(const volatile myconstarray x) {};
+ void func2a(const myarray x) {}
+ void func2b(const myconstarray x) {}
+ void func2c(const volatile myconstarray x) {}
%}
CLEAR_SWIGTYPE_TYPEMAPS;
@@ -72,7 +72,7 @@ $1 = 0;
/* Correct typemap for $symname: $type */
}
%inline %{
- void func3a(const mycrazyarray x, const mycrazyarray y[7]) {};
+ void func3a(const mycrazyarray x, const mycrazyarray y[7]) {}
%}
CLEAR_SWIGTYPE_TYPEMAPS;
@@ -81,5 +81,5 @@ $1 = 0;
/* Correct typemap for $symname: $type */
}
%inline %{
- void func4a(mycrazyfunc *const x, const mycrazyfuncptr y) {};
+ void func4a(mycrazyfunc *const x, const mycrazyfuncptr y) {}
%}
diff --git a/Examples/test-suite/typemap_directorout.i b/Examples/test-suite/typemap_directorout.i
index 4a85bd47c..79d0f8d94 100644
--- a/Examples/test-suite/typemap_directorout.i
+++ b/Examples/test-suite/typemap_directorout.i
@@ -23,7 +23,7 @@
#ifdef SWIGD
%typemap(ddirectorout) MyType & %{ WILL_NOT_COMPILE %}
%typemap(ddirectorout) MyType &USEME = SWIGTYPE &;
-%typemap(ddirectorout) MyType &Class1::foo2, MyType &foo1 %{ /* special start */ $typemap(ddirectorout, MyType &USEME) /* special end */ %}
+%typemap(ddirectorout, nativepointer="cast(void*)$dcall") MyType &Class1::foo2, MyType &foo1 %{ /* special start */ $typemap(ddirectorout, MyType &USEME) /* special end */ %}
#endif
#ifdef SWIGJAVA
diff --git a/Examples/test-suite/typemap_variables.i b/Examples/test-suite/typemap_variables.i
index 142e35060..687cae1da 100644
--- a/Examples/test-suite/typemap_variables.i
+++ b/Examples/test-suite/typemap_variables.i
@@ -13,33 +13,44 @@
%}
#endif
+// For Javascript V8 we can not use '0' for out typemaps
+#if defined(SWIG_JAVASCRIPT_V8)
+%header %{
+#define OUT_NULL_VALUE SWIGV8_NULL()
+%}
+#else
+%header %{
+#define OUT_NULL_VALUE 0
+%}
+#endif
+
// Scripting languages use varin/varout for variables (except non-static member variables where in/out are used ???)
%typemap(varin) int "this_will_not_compile_varin "
%typemap(varout) int "this_will_not_compile_varout"
%typemap(varin) int globul "/*int globul varin */ TYPEMAP_VARIABLES_FAIL"
-%typemap(varout) int globul "/*int globul varout*/ $result=0;"
+%typemap(varout) int globul "/*int globul varout*/ $result=OUT_NULL_VALUE;"
%typemap(varin) int Space::nspace "/*int nspace varin */ TYPEMAP_VARIABLES_FAIL"
-%typemap(varout) int Space::nspace "/*int nspace varout*/ $result=0;"
+%typemap(varout) int Space::nspace "/*int nspace varout*/ $result=OUT_NULL_VALUE;"
//%typemap(varin) int member "/*int member varin */"
-//%typemap(varout) int member "/*int member varout*/ $result=0;"
+//%typemap(varout) int member "/*int member varout*/ $result=OUT_NULL_VALUE;"
%typemap(varin) int Space::Struct::smember "/*int smember varin */ TYPEMAP_VARIABLES_FAIL"
-%typemap(varout) int Space::Struct::smember "/*int smember varout*/ $result=0;"
+%typemap(varout) int Space::Struct::smember "/*int smember varout*/ $result=OUT_NULL_VALUE;"
// Statically typed languages use in/out for variables
%typemap(in) int "this_will_not_compile_in "
%typemap(out) int "this_will_not_compile_out"
%typemap(in) int globul "/*int globul in */ $1=0;"
-%typemap(out) int globul "/*int globul out*/ $result=0;"
+%typemap(out) int globul "/*int globul out*/ $result=OUT_NULL_VALUE;"
%typemap(in) int Space::nspace "/*int nspace in */ $1=0;"
-%typemap(out) int Space::nspace "/*int nspace out*/ $result=0;"
+%typemap(out) int Space::nspace "/*int nspace out*/ $result=OUT_NULL_VALUE;"
%typemap(in) int member "/*int member in */ $1=0;"
#ifdef SWIGTCL
%typemap(out) int member "/*int member out*/"
#else
-%typemap(out) int member "/*int member out*/ $result=0;"
+%typemap(out) int member "/*int member out*/ $result=OUT_NULL_VALUE;"
#endif
%typemap(in) int Space::Struct::smember "/*int smember in */ $1=0;"
-%typemap(out) int Space::Struct::smember "/*int smember out*/ $result=0;"
+%typemap(out) int Space::Struct::smember "/*int smember out*/ $result=OUT_NULL_VALUE;"
%typemap(javain) int "this_will_not_compile_javain "
%typemap(javaout) int "this_will_not_compile_javaout"
diff --git a/Examples/test-suite/uffi/Makefile.in b/Examples/test-suite/uffi/Makefile.in
index 8ad153961..275778c87 100644
--- a/Examples/test-suite/uffi/Makefile.in
+++ b/Examples/test-suite/uffi/Makefile.in
@@ -5,6 +5,7 @@
LANGUAGE = uffi
UFFI = @UFFIBIN@
SCRIPTSUFFIX = _runme.lisp
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
@@ -14,13 +15,13 @@ include $(srcdir)/../common.mk
# Overridden variables here
# no C++ tests for now
CPP_TEST_CASES =
-#C_TEST_CASES +=
+#C_TEST_CASES +=
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
-%.cpptest:
+%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
@@ -30,7 +31,7 @@ CPP_TEST_CASES =
+$(swig_and_compile_c)
$(run_testcase)
-%.multicpptest:
+%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@@ -38,14 +39,13 @@ CPP_TEST_CASES =
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
- if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
- env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(UFFI) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
+ if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(UFFI) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we dont generate extra uffi code)
%.clean:
-
+ @exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile uffi_clean
-
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" uffi_clean
diff --git a/Examples/test-suite/unicode_strings.i b/Examples/test-suite/unicode_strings.i
new file mode 100644
index 000000000..56063c8a4
--- /dev/null
+++ b/Examples/test-suite/unicode_strings.i
@@ -0,0 +1,15 @@
+%module unicode_strings
+
+%include <std_string.i>
+
+%inline %{
+
+const char* non_utf8_c_str(void) {
+ return "h\xe9llo w\xc3\xb6rld";
+}
+
+std::string non_utf8_std_string(void) {
+ return std::string("h\xe9llo w\xc3\xb6rld");
+}
+
+%}