Commit graph

440 commits

Author SHA1 Message Date
William S Fulton
4ce77ffb77 Ruby - catch exceptions by const reference 2020-02-18 22:06:20 +00:00
William S Fulton
c08e0d19f9 Merge branch 'catch-value'
* catch-value:
  Catch exceptions by reference rather than by value.
2020-02-18 22:00:45 +00:00
Daniel Mach
70f6ee9656 Catch exceptions by reference rather than by value.
Fixes -Wcatch-value gcc warnings.
2020-02-14 12:58:49 +01:00
William S Fulton
6cec69ef7b Remove an unnecessary shared_ptr reference count increment in Ruby wrappers
When wrapping STL containers, remove a shared_ptr reference count
increment when an upcast is needed when checking type conversion
in traits_check::check.
2020-02-13 19:48:30 +00:00
Vadim Zeitlin
7cc94808b6 Extend std::auto_ptr<> support to Ruby
This is trivial as exactly the same typemap as for Python can be used
for Ruby too, all the differenced are abstracted by the unified typemap
library.
2020-01-17 15:09:17 +01:00
Thomas Reitmayr
f5908eca76 Improve description of cast macros for Ruby
The macros for casting function pointers are now fully described and also
clarify why the macros act transparently for C even before Ruby 2.7.

In addition, an "if (CPlusPlus)" was removed in the code generator for
global variables in order to keep the distinction between C and C++ in
one place, which is at the definition of said macros.
2020-01-04 18:37:35 +01:00
Thomas Reitmayr
5542cc228a Move new macros for Ruby to their dedicated namespace 2020-01-03 21:45:53 +01:00
Thomas Reitmayr
00e291b319 Add support for Ruby 2.7
This commit fixes the signatures of various callback methods
and cleans up the macro definitions used for casting callbacks.

Note that the transparent version of the macro RUBY_METHOD_FUNC
is currently masked behind RUBY_DEVEL, see commit
1d91feaf13
In order to still support strict signature checking and prevent
nasty deprecation warnings, the use of RUBY_METHOD_FUNC had to
be replaced with VALUEFUNC.
2019-12-31 17:53:53 +01:00
William S Fulton
86cb3a9532 Python STL container method overloading fix
Fix method overloading of methods that take STL containers of different types.
Due to some error handling that was not cleared during typehecking.
2019-08-06 19:36:14 +01:00
William S Fulton
b655d3138b Remove the UnknownExceptionHandler director error handling class
Done in order to be C++17 compliant as it uses std::unexpected_handler
which was removed in C++17. This class was intended for director
exception handling but was never used by SWIG and was never documented.

Closes #1538
2019-06-27 07:40:49 +01:00
William S Fulton
5c1c69d140 Replace std::unexpected_handler with std::terminate_handler to be c++17 compliant
Closes #1538
2019-06-27 07:40:49 +01:00
William S Fulton
f3e2ab9195 Include all template parameters for std_unordered_multiset and std_unordered_set 2019-03-12 21:47:45 +00:00
William S Fulton
4a25ddbb97 Correct unordered_set/unordered_multiset template Key parameter name 2019-03-12 20:21:19 +00:00
William S Fulton
30f59ffe22 Include all template parameters for std_unordered_multimap and std_unordered_map 2019-03-12 20:03:14 +00:00
William S Fulton
a006091b0f Add in a definition for RTYPEDDATA_P for Ruby<1.9.3
This definition ensures the SWIG wrappers keep compiling in older versions
of Ruby given the previous change (which uses RTYPEDDATA_P and hence
requires Ruby 1.9.3). The definition of RTYPEDDATA_P is such that the
previous commit plus the definition should keep the behaviour the same
as before.
2019-02-22 19:55:55 +00:00
Takashi Tamura
ff9e9f9f98 [ruby] check whether object is of RTypedData using RTYPEDDATA_P. 2019-02-22 19:55:54 +00:00
William S Fulton
6d0c495fd0 Add missing parameter names in STL container wrappers
Mostly in STL copy constructors.

Best to have parameter names as they make their way into the wrappers in
some target languages.
2019-02-13 22:45:47 +00:00
William S Fulton
68e86614ff Create a consistent stl.i library file
Same file now for all languages except R which is still missing std_map.i.
Recent Java changes adding in std_set.i removed.
2019-02-12 18:46:05 +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
3915e7bd08 Remove final remnants of GCJ - jstring.i 2018-06-15 06:57:53 +01:00
luz.paz
6f69830321 follow-up typos 2018-05-17 10:26:00 -04:00
luz.paz
60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04:00
William S Fulton
c44adff7b9
Merge pull request #1177 from Sigill/sigabrt_rubyunlinkobject_fix
Do not abort when unlinking non-data ruby objects
2018-01-07 12:23:47 +00:00
William S Fulton
cd9b7c3c34 std_basic_string.i fixes
- Remove python code from octave's std_basic_string.i
- Correctly return an error to fix error handling when using std::basic_string in
  overloaded methods - issue #1171.
2018-01-04 07:00:26 +00:00
Cyrille Faucheux
a4884e45e1 Do not abort when unlinking non-data ruby objects
Fixes issue #1168.
Remove a call to abort() (introduced by commit
0e725b5d9b) made when SWIG_RubyUnlinkObjects()
is called on non T_DATA objects. It can happen when the destruction of T_DATA
objects is deferred: the Ruby GC first turn them to T_ZOMBIE, then calls their
free method (SWIG_RubyUnlinkObjects()).
2017-12-27 14:40:26 +01:00
William S Fulton
3f8b8fe734 Enhancements for directorin typemaps
The directorin typemaps will now generate a temporary variable
(specified after the type), such as:
%typemap(directorin) MyType (MyType *temp) { ... use temp ... }

The shared_ptr director typemaps have been fixed for use in functions
that take more than one parameter.
2017-10-16 19:28:27 +01:00
William S Fulton
6470fe8c36 Director shared_ptr typemaps for scripting languages
Modify the Python and Ruby director shared_ptr typemaps to be language neutral.
Port the director modifications to other scripting languages that
have shared_ptr support - Octave, R and Scilab. Scilab shared_ptr
support is not fully working and needs work though.
2017-10-13 07:34:38 +01:00
William S Fulton
d0615d98a9 Merge branch 'radarsat1-fix-null-shared_ptr-directors'
* radarsat1-fix-null-shared_ptr-directors:
  Remove duplicate director shared_ptr pointer reference typemaps
  For shared_ptr directorin, make copy of shared_ptr in all cases.
  Add directorin typemap for Python and Ruby shared_ptr.
2017-10-11 09:03:01 +01:00
William S Fulton
000e63e0f8 Remove duplicate director shared_ptr pointer reference typemaps 2017-10-11 07:08:46 +01:00
William S Fulton
e7f0c6d6ad Suppress Ruby std::wstring, std::string, std::basic_string warnings
Lib/std/std_basic_string.i:235: Warning 365: operator+= ignored
Lib/std/std_wstring.i:8: Warning 378: operator!= ignored

Correct 801 warning suppressions (which are normally suppressed in the test-suite):
Lib/std/std_wstring.i:13: Warning 801: Wrong class name (corrected to `Wstring')

Similarly for std::string when including basic_string.i class.
2017-10-10 07:52:10 +01:00
Olly Betts
5a9422d980 Remove GCJ support
GCC7 dropped GCJ.

Closes https://sourceforge.net/p/swig/bugs/823/
2017-10-09 08:32:01 +13:00
William S Fulton
e01cfd70c7 Add missing declaration for std::complex
Fixes missing type information for std::complex in scripting languages.
Closes #732.

Update Javascript and Octave complextest, although they don't actually
get run as they don't work
2017-10-02 19:07:24 +01:00
Stephen Sinclair
52ca39b5ab For shared_ptr directorin, make copy of shared_ptr in all cases. 2017-09-27 18:10:59 -03:00
Stephen Sinclair
bda750ee15 Add directorin typemap for Python and Ruby shared_ptr. 2017-09-27 11:22:30 -03:00
William S Fulton
eca67ee880 Ruby and Scilab shared_ptr typemap fragment correction
Remove some left over cruft from the python port
2017-09-25 08:45:31 +01:00
William S Fulton
ed4b84f4d3 Fix overloading of shared_ptr method overloading
Add 'equivalent' attribute to typecheck typemap.
Closes #1098.
2017-09-23 15:19:34 +01:00
Olly Betts
90f9117e10 Fix various comment and documentation typos 2017-08-13 18:04:33 +12:00
Mike Romberg
a67eff0ae9 remove bool from shared_ptr as well. 2017-07-03 20:55:40 -06:00
Mike Romberg
dd26e8a014 as() now always throws and never creates an invalid object with memset() 2017-07-03 15:35:24 -06:00
William S Fulton
e9e9531dc3 Merge branch 'tamuratak-fix_ruby_wstring'
* tamuratak-fix_ruby_wstring:
  [ruby] use %fragment to clarify the dependency of code.
  [ruby] should initialize static variables inside %init{}, in which it will not be        excuted concurrently by multiple threads.
  [ruby] * use static variable to avoid creating stirngs every time.        * fix possible overflow.
  [ruby] add std::wstring tests for string including a null terminator.
  [ruby] * rewrite SWIG_AsWCharPtrAndSize and SWIG_FromWCharPtrAndSize        * use UTF-32LE and UTF-16LE to avoid BOM        * add tests
  [ruby] use WCHAR_MAX to determine the encoding of std::wstring.
  [ruby] add a few tests for std::wstring
  [ruby] fix support for std::wstring.
2017-06-20 20:13:01 +01:00
William S Fulton
82969b0755 Fix warning in generated code - traits_asptr.
Visual Studio 2015 debug builds:
error C4703: potentially uninitialized local pointer variable 'p' used
2017-06-13 19:02:59 +01:00
William S Fulton
32855cfb69 Merge branch 'tamuratak-fix_ruby_unordered_set'
* tamuratak-fix_ruby_unordered_set:
  [ruby] add simple tests for std unordered containers.
  [ruby] clarify dependency of fragments for unordered_set containers.

 Conflicts:
	Examples/test-suite/ruby/Makefile.in
2017-04-24 20:44:12 +01:00
William S Fulton
ee44f9ba67 Merge branch 'tamuratak-fix_ruby_null_shared_ptr'
* tamuratak-fix_ruby_null_shared_ptr:
  [ruby] add a test.
  [ruby] use std::vector::back() method.
  [ruby] enable a test for null shared_ptr in containers.
  [ruby] add a test for null shared_ptr in containers.
  [ruby] treat null shared_ptr in std containers properly.

Conflicts:
	Examples/test-suite/ruby/Makefile.in
2017-04-24 19:50:59 +01:00
Takashi Tamura
43c3ca3767 [ruby] clarify dependency of fragments for unordered_set containers. 2017-04-22 16:35:25 +09:00
William S Fulton
71e5ff406f Merge branch 'tamuratak-fix_ruby_director_and_shared_ptr'
* tamuratak-fix_ruby_director_and_shared_ptr:
  Rename shared_ptr testcase
  [ruby] use boost/shared_ptr and boost_shared_ptr.i. not use auto.
  [ruby] delete unnecessary changes.
  [ruby] add %typemap(directorin) for shared_ptr.
  [ruby] enable a test, cpp11_shared_ptr_director.
  [ruby] add %typemap(directorin) and %typemap(directorout) for shared_ptr.
  [ruby] add %typemap(directorout) for shared_ptr.
  add a test for shared_ptr with director

Conflicts:
	CHANGES.current
2017-04-21 19:31:25 +01:00
Takashi Tamura
6672338cc0 [ruby] delete unnecessary changes. 2017-04-21 22:44:38 +09:00
William S Fulton
b4377488f7 Add assert for invalid NULL type parameter when calling SWIG_Ruby_NewPointerObj.
Closes #935
2017-04-20 18:51:45 +01:00
Takashi Tamura
0020fc97b0 [ruby] add %typemap(directorin) for shared_ptr. 2017-04-20 19:20:55 +09:00
Takashi Tamura
17b4e0c66e [ruby] add %typemap(directorin) and %typemap(directorout) for shared_ptr. 2017-04-20 19:20:11 +09:00
Takashi Tamura
b3c2b1c51c [ruby] add %typemap(directorout) for shared_ptr. 2017-04-20 19:20:11 +09:00