Commit graph

27 commits

Author SHA1 Message Date
Thomas Reitmayr
5a10e10399 Ruby: Fix warnings in generated code about missing parameter in variadic macro
The Ruby C API function 'rb_funcall' is used in various places in generated
code for invoking a Ruby method without parameters. The C function uses a
variadic parameter list for the arguments passed to Ruby, therefore in these
cases the list of variadic parameters is empty.
As an optimization Ruby may implement the 'rb_funcall' function as a macro
which however will not accept an empty list of arguments for '...' as of
C99 and C++11.
In order to prevent compiler warnings, this commit replaces all such
occurrences with a call to 'rb_funcall2' (which in its current name
'rb_funcallv' is invoked by the 'rb_funcall' macro anyway, at least for
Ruby 2.6.6).
2022-01-29 11:07:57 +13: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
Jason Turner
8339a2d441 Fix shared data problem on MacOS 10.9 with xcode 5.1
Move to construct on first use idiom for singleton definition,
which prevents problems with singletons between ruby swig modules
in an environment with multiple modules on MacOS 10.9 with xcode 5.1.

Before this fix, data was being shared between modules which caused
a crash on shutdown of the ruby interpreter if more than one
module was loaded at a time.
2014-06-04 14:11:18 -06:00
William S Fulton
5ae6ff404d Cosmetic - use C comments instead of C++ comments for recent Ruby change 2013-04-08 07:58:09 +01:00
William S Fulton
bb3fe8c906 Rewrite Ruby's GC_VALUE without use of macros for easier debugging 2013-04-06 02:20:56 +01:00
William S Fulton
8484c2de9b More rb_protect rewrite to use rb_rescue for Ruby 1.9 2013-04-06 00:30:50 +01:00
William S Fulton
5d529d5a76 Ruby 1.9 fixes.
SF Bug#1292 - Runtime fixes for Proc changes in ruby-1.9 when using STL wrappers that override the default predicate, such as:

  %template(Map) std::map<swig::LANGUAGE_OBJ, swig::LANGUAGE_OBJ, swig::BinaryPredicate<> >;

Fixes li_std_functors testcases for Ruby 1.9.

Also rb_respond_to return values have changed subtely in 1.9 and return should be treated as a flag instead of checking for Qtrue, see SF Bug #1159.

Also fix li_std_map, li_std_set silently failing - rb_protect behaviour seems to have changed when an exception is thrown, so code has been changed to use rb_rescue. A call to 'rb_set_errinfo(Qnil)' could have solved this after the rb_protect call, but it is only available in 1.9+ and Ruby API changes are not easily and transparently detectable.
2013-04-05 23:41:59 +01:00
William S Fulton
e13e1cba9e Fix seg fault when using STL containers of generic Ruby types, GC_VALUE or LANGUAGE_OBJECT, on exit of the Ruby interpreter. Observed on 64 bit Linux in the std_li_set testcase. The global hash which is meant to hold GC references was being deleted by the interpreter on exit before the GC_VALUES destructors were being called. 2013-03-31 00:55:34 +00:00
William S Fulton
dfa13b658e Fix import_stl testcase
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12688 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-19 06:42:56 +00:00
Gonzalo Garramuno
32b10ee9b7 Dramatically sped up comparison functions for
integers.  This speeds up most std::set<int>, etc.
insertion operations.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9830 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-23 12:46:57 +00:00
Gonzalo Garramuno
776398cd1d Made hash store a counter to the ruby VALUE object.
This should avoid a potential subtle bug when
using operator=.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9829 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-23 11:54:36 +00:00
Gonzalo Garramuno
0b36bc6940 Removed & test and changed it for a simpler T_NONE
test.  This seems to avoid issues and is slightly
faster.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9827 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-19 16:51:39 +00:00
Gonzalo Garramuno
7c2e64a8dd Made check in rubyclasses a little bit safer
to exit early on ints, nil, false, true, symbols,
internal nodes and none.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9825 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-19 09:41:23 +00:00
Gonzalo Garramuno
1cf8d3dd36 Dramatically sped up all STL containers when
they contain swig::GC_VALUEs.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9824 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-19 08:45:09 +00:00
Gonzalo Garramuno
c18feb2af3 Fixed type_name of some std classes.
Remove cmp_id from GC_VALUE.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9784 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-06 12:46:40 +00:00
Gonzalo Garramuno
949b6238e8 Fixed small typo in comment.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9783 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-06 07:43:36 +00:00
Gonzalo Garramuno
ddbce633fd Removed std::less functor and redefined all operators
for GC_VALUE instead.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9782 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-06 07:38:38 +00:00
Gonzalo Garramuno
f92ebdbe07 remove std::set from new extended functions, as
it was failing due to non-assignable iterator.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9774 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-05 11:19:54 +00:00
Gonzalo Garramuno
1c46a18c50 Added new rubycontainer_extended.swg file.
This file contains standard ruby algorithms but
which place some restriction on the class inside
the STL container.
Fixed GC_VALUE so that it cannot be instantiated
from the language manually.
Fixed delete autodoc.
Started documenting each portion of the SWIG
templates/macros so it makes sense to people.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9773 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-05 10:26:59 +00:00
Gonzalo Garramuno
4cd98d3865 Improved algorithm of renaming of methods with numbers at the end.
Fixed some const issues.
Improved report on overloaded function error.
Fixed some minor iterator potential problems.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9770 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-04 13:12:31 +00:00
Gonzalo Garramuno
cea5ba04fa Fixed last test in std_set test suite that was
failing due to having been done with old hash sort.

Improved rubycontainer a little bit.  Made GC_VALUE
sort an rb_protect function to prevent bad sorting
attempt of an Array against a String.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9747 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-02 01:28:21 +00:00
Gonzalo Garramuno
a6fa331dae Fixed VALUE less compare function to be a good GC_VALUE
less compare function.  This is used for hashing.
Moved the functor over to rubyclasses to avoid bloat
when GC_VALUE is not used.
Updated std::map test to check for equivalence.
Updated CHANGES.current a tad to move the STL
stuff as last and merge two feature updates as one.




git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9740 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 09:55:44 +00:00
Gonzalo Garramuno
293750eaea Moved the GC_VALUE class over to rubystdcommon
so that it will only get added when STL is used.

Documented swig_assert interface.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9731 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 01:21:26 +00:00
Gonzalo Garramuno
a100f16bbd Fixes to std_map and multimap. There's still a problem
of const correctness in the std swig STL library.  
Need to bring it up in the swig-devel list.

Added new functions to swig_assert.
Changed some tests to reflect these changes.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9730 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 01:08:17 +00:00
Gonzalo Garramuno
8ea7856ef3 Improved GC_VALUE so it gets printed nicely
and works properly with std::pair.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9725 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-04-30 19:26:18 +00:00
Gonzalo Garramuno
6999e71c07 Several fixes to GC_VALUE, and map containers.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9724 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-04-30 18:33:27 +00:00
Gonzalo Garramuno
a0b74a907e Updated Ruby's STL to new framework.
Still need to add new tests for multimap,
multiset, list, etc.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9719 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-04-30 06:36:55 +00:00