Commit graph

4,934 commits

Author SHA1 Message Date
Zackery Spytz
5bdb52b319 [OCaml] class_scope_weird, cpp_static, and ignore_parameter runtime tests
They are based on the corresponding python runtime tests.
2019-01-11 19:35:17 +00:00
William S Fulton
b64d685d5f Merge branch 'ZackerySpytz-OCaml-fix-member-var-access'
* ZackerySpytz-OCaml-fix-member-var-access:
  OCaml's classHandler() requires name, not sym:name.
  [OCaml] Fix member var getters and setters
2019-01-11 18:42:19 +00:00
Zackery Spytz
4ca6fdc551 OCaml's classHandler() requires name, not sym:name.
In classHandler(), assign sym:name to the classname global so that it
can be used in membervariableHandler().

Add a small runme test for li_std_vector.
Use swigp4 when compiling the runme tests.
2019-01-08 20:10:07 -07:00
William S Fulton
4e4bb54fe7
Merge pull request #1393 from ZackerySpytz/OCaml-examples
[OCaml] Fix some of the OCaml examples
2019-01-08 08:04:20 +00:00
Zackery Spytz
8d9d4cc5f1 [OCaml] Improve "make clean" and similar
When cleaning, remove the runme file and generated *.mli files.
Remove unneeded MLFILE variables from Makefiles.
2019-01-07 14:24:58 -07:00
Zackery Spytz
8f7bc4cc10 [OCaml] Rename example_prog.ml to runme.ml in the OCaml examples
Name the output executable "runme" in the examples.
Replace use of "foolib" in the string_from_ptr example.
Fix a warning in the std_vector example.
Add strings_test to Examples/ocaml/check.list.
Disable two tests that were causing the OCaml test suite to fail.
2019-01-07 11:59:07 -07:00
Zackery Spytz
4a912668fc [OCaml] Fix member var getters and setters
Add `membervariableHandler()` to the `OCAML` class in ocaml.cxx (it is
partly based on the code in python.cxx and octave.cxx).

In Lib/ocaml/class.swg, wrapped classes/structs were not being added
to `class_master_list`. This is fixed by adding a call to
`register_class_byname`.

Add a unit test in the form of struct_value_runme.ml.
2019-01-06 09:40:25 -07:00
William S Fulton
0c4491eaae Add more tests for C++11 raw string literals
Test added to check fixes for:

- Issue #948 and issue #1019 and issue #1273 - raw string delimiters
  not being stripped off
- Issue #538 - Ruby support for "docstring" feature
2019-01-06 00:10:01 +00:00
Zackery Spytz
1be9f5fec3 [OCaml] Fix some of the OCaml examples
Update some of the OCaml examples so that they run successfully with
`make check-ocaml-examples` (important for the CI). Some of the
examples were written to depend on passed arguments.

Temporarily disable the broken std_string example.
2019-01-03 07:34:25 -07:00
William S Fulton
6a80ec314a Merge branch 'typecheck-null-nonpointers'
* typecheck-null-nonpointers:
  Fix overloading for non-pointers and NULL - MzScheme
  Overloading for non-pointers and NULL - Chicken
  Fix overloading for non-pointers and NULL - Scilab
  Fix overloading for non-pointers and NULL - R
  Fix overloading for non-pointers and NULL - Php
  Fix overloading for non-pointers and NULL - Octave
  Fix overloading for non-pointers and NULL - Lua
  Overloading for non-pointers and NULL - Javascript
  Fix overloading for non-pointers and NULL - Guile
  Fix overloading for non-pointers and NULL - Tcl
  Fix overloading for non-pointers and NULL - Perl
  Fix overloading for non-pointers and NULL - Ruby
  Add test for overloading and NULL
  Correct Python implicitconv code
  Fix typecheck typemaps for non-pointers and NULL
2019-01-03 08:13:19 +00:00
William S Fulton
f17e993ed7 Remove some non-standard cruft from OCaml test-suite 2019-01-03 07:54:29 +00:00
William S Fulton
d247388fdf Merge branch 'ZackerySpytz-OCaml-out-of-source'
* ZackerySpytz-OCaml-out-of-source:
  Don't override SCRIPTDIR.
  Replace mv hack.
  [OCaml] Update OCaml for out-of-source builds
2019-01-03 07:12:31 +00:00
Zackery Spytz
f2a05bda8b Don't override SCRIPTDIR. 2019-01-02 05:01:54 -07:00
Zackery Spytz
5f941bc3c7 Replace mv hack. 2019-01-02 01:33:53 -07:00
Zackery Spytz
5c19f4de2f [OCaml] Add missing warning filters for OCaml keywords in the test suite 2018-12-31 05:55:10 -07:00
William S Fulton
b48339cfca Fix overloading for non-pointers and NULL - Scilab 2018-12-30 14:22:13 +00:00
William S Fulton
f181d20dd1 Fix overloading for non-pointers and NULL - R 2018-12-30 13:46:51 +00:00
William S Fulton
b7db45661a Fix overloading for non-pointers and NULL - Php 2018-12-30 12:00:49 +00:00
William S Fulton
e354ba8cdc Fix overloading for non-pointers and NULL - Octave 2018-12-30 11:25:41 +00:00
William S Fulton
cd7772a274 Fix overloading for non-pointers and NULL - Lua 2018-12-30 10:54:53 +00:00
William S Fulton
ec8d978995 Overloading for non-pointers and NULL - Javascript
Overloading support for Javascript is generally incomplete as there are
no typecheck typemaps, so the overloading and NULL support added here
doesn't work and won't work until the typecheck typemaps are
implemented.
2018-12-30 10:11:35 +00:00
William S Fulton
eb151e43be Fix overloading for non-pointers and NULL - Guile 2018-12-30 09:26:33 +00:00
Zackery Spytz
9973628268 [OCaml] Update OCaml for out-of-source builds
This is one of the steps needed to fix the OCaml test suite.

In addition, disable the creation of toplevels by default in the OCaml
examples (toplevels are currently broken).
2018-12-29 08:24:24 -07:00
William S Fulton
12eb0f81ae Fix overloading for non-pointers and NULL - Tcl 2018-12-29 14:55:43 +00:00
William S Fulton
b1178cf130 Fix overloading for non-pointers and NULL - Perl 2018-12-29 14:15:59 +00:00
William S Fulton
d14c97408d Fix overloading for non-pointers and NULL - Ruby 2018-12-29 14:15:51 +00:00
William S Fulton
2769a8763c Add test for overloading and NULL 2018-12-29 14:15:45 +00:00
William S Fulton
3efea1f4ab Fix typecheck typemaps for non-pointers and NULL
The typecheck typemaps succeed for non pointers (SWIGTYPE, SWIGTYPE&,
SWIGTYPE&&) when the equivalent to C NULL is passed from the target
language. This commit implements a fix for Python to not accept a Python
None for non-pointer types.

Issue #1202
2018-12-29 11:45:46 +00:00
William S Fulton
315c7dab06 Remove debug display in python_pythoncode testcase 2018-12-22 18:47:34 +00:00
William S Fulton
5a388863fa director_thread test fixes for MacOS
Add extra debugging and correctly detect MacOS using __APPLE__ macro
2018-12-21 19:08:15 +00:00
William S Fulton
1faf5a879f Avoid thread name checking testing on MacOS
It's not working!
2018-12-21 09:13:09 +00:00
William S Fulton
50f223f454 Fix director_thread test for MacOS
pthread_setname_np is defined differently on MacOS
2018-12-21 09:13:09 +00:00
William S Fulton
d835c69d65 Merge branch 'java-director-thread-name'
* java-director-thread-name:
  Add changes entry for setting Java thread name
  Increased Java thread name size.
  Java directors - more generic thread name setting
  Use prctl method to get thread names, which is available on all NDK versions
  Actually, pthread_getname_np is only available in recent versions of Android (API level >= 26).
  Set thread name when attaching to Android JVM in SWIG Java director
2018-12-20 21:23:29 +00:00
William S Fulton
d9ecff1fca Merge branch 'chlandsi-master'
* chlandsi-master:
  Testcase for testing __new__ override Python 3.6 fix
  fix for creating new shadow class in python 3.6
2018-12-20 08:12:41 +00:00
William S Fulton
6e2b54be2f Testcase for testing __new__ override Python 3.6 fix
Issue #1357
2018-12-20 08:10:35 +00:00
William S Fulton
398ac5f01c Remove redundant Python options: -nocastmode -nodirvtable -noextranative -nofastproxy
Also remove redundant %module options: nocastmode, noextranative
Issue #1340
2018-12-18 19:51:32 +00:00
William S Fulton
3119bc3e23 Merge branch 'python-obfuscated-import-errors'
* python-obfuscated-import-errors:
  More Python module loading simplification
  Simpler Python module loading
  The Python module import logic has changed to stop obfuscating real ImportError problems.
2018-12-18 08:10:02 +00:00
William S Fulton
03323f5c8b The Python module import logic has changed to stop obfuscating real ImportError problems.
Only one import of the low-level C/C++ module from the pure Python module is
attempted now. Previously a second import of the low-level C/C++ module was attempted
after an ImportError occurred and was done to support 'split modules'. A 'split module' is
a configuration where the pure Python module is a module within a Python package and the
low-level C/C++ module is a global Python module. Now a 'split module' configuration is
no longer supported by default. This configuration can be supported with a simple
customization, such as:

  %module(package="mypackage", moduleimport="import $module") foo

or if using -builtin:

  %module(package="mypackage", moduleimport="from $module import *") foo

instead of

  %module(package="mypackage") foo

See the updated Python chapter titled "Location of modules" in the documentation.

Closes #848 #1343
2018-12-16 16:41:39 +00:00
Robert Stone
871ece78e6 repair uses of EXTEND() in Perl typemaps
closes #1374
 * enhance testing around multiple return values
   Examples/test-suite/perl5/scilab_multivalue_runme.pl fails in
   perl-5.28.1 compiled with -DDEBUGING without the typemap updates
 * repair EXTEND() handling in typemaps
 * Use PL_sv_undef for VOID_Object
2018-12-11 15:51:14 -08:00
William S Fulton
51dadaeacd Add example to test the Python module being renamed to __init__.py
This examples tests the SWIG generated module being placed into a directory and
then renamed __init__.py to convert the module into a package. This ability
stopped working in swig-3.0.9. However, only Python 2.7 or 3.3 and later work. If
Python 3.2 support is needed, use moduleimport in %module to customise the import
code.

Issue #1282
2018-12-08 22:31:26 +00:00
William S Fulton
525c757322 Merge branch 'vadz-add-nested-in-template-test'
* vadz-add-nested-in-template-test:
  Avoid comparing doubles in nested_in_template.i unit test
  Add recently added nested_in_template to the list of test cases
2018-12-06 07:21:04 +00:00
William S Fulton
84dcb9bfff Revert "Temporarily remove Python import_packages testcase"
This reverts commit 8d6f3010ea.
2018-12-06 06:55:24 +00:00
William S Fulton
ff93f2e26e Skip Python subprocess calls in import_packages testcase on Windows
Getting these kind of errors on Appveyor which uses mingw/cygwin to run
a Python interpreter:

Native windows Python 3.6 running under cygwin and mingw Python 3.7 running under mingw:
  Fatal Python error: _Py_HashRandomization_Init: failed to get random
  numbers to initialize Python

Cygwin Python 2.7 running under cygwin:
  0 [main] python2.7 496 child_info_fork::abort: address space needed by '_foo.dll' (0x6D0000)
  is already occupied
2018-12-06 06:50:57 +00:00
William S Fulton
8d6f3010ea Temporarily remove Python import_packages testcase
The subprocess.check_call seems broken on Windows, needs investigation.
2018-12-04 22:35:47 +00:00
Vadim Zeitlin
5e7426dcc6 Avoid comparing doubles in nested_in_template.i unit test
This should also have been part of
30bb977a64

See #1358.
2018-12-04 20:46:35 +01:00
William S Fulton
604ae7186b Fix for running 'python -m' when using swig -builtin
Same as e05b5ea for -builtin.

Also added runtime tests to check 'python -m'.
2018-12-04 19:12:13 +00:00
William S Fulton
9e83d5d5d9 Fix nstest.py test
Use subprocess.check_call as os.system won't stop the test in case of
errors.
2018-12-04 06:49:55 +00:00
William S Fulton
6030f59741 Fix operator Python example for -builtin
Output was incorrect for -builtin as custom __str__ was not being
called.
2018-11-28 08:18:28 +00:00
Vadim Zeitlin
73ea48ba4a Add recently added nested_in_template to the list of test cases
This should have been part of 30bb977a64

See #1358.
2018-11-25 23:39:15 +01:00
Vadim Zeitlin
30bb977a64 Fix handling of abstract base classes nested inside templates
Code handling %template in the parser created a totally new top-level
module child of namespace type when handling templates inside a
namespace and copied the nodes from the previously parsed C++ template
declaration to it. However copies of this node kept their original
values of "abstracts" attribute, which contained pointers to the classes
in the original template declaration, i.e. outside of the subtree
created for the instantiated template. This, in turn, meant that during
the types resolution pass, the code in TypePass did not update the types
used in the methods of the classes appearing in the "abstracts" List,
even though it did update the types for the children of the instantiated
template subtree.

And this finally resulted in wrongly detecting overridden virtual
methods as abstract in Allocate::is_abstract_inherit() during the next
pass, as the signatures of the overridden method -- using resolved types
-- and of the method from the class pointed to by "abstract" -- using
the original types from C++ code -- didn't match.

Resolve this simply by not copying "abstracts" attributes when creating
the template subtree and doing another pass over this tree to recreate
them using the new nodes, just as it's already done for "defaultargs"
attribute, presumably for similar reasons. Note that doing another pass
over the tree is not as efficient as doing everything in a single pass,
but merging the new update_abstracts() with update_defaultargs() is not
completely obvious, so for now keep it simple and optimize it later if
necessary.

Also, add a test checking for the situation described above.

Closes #1353.
2018-11-24 19:21:47 +01:00