Commit graph

358 commits

Author SHA1 Message Date
Alec Cooper
4e2fc7d115 Don't use long long if it isn't available
Adds preprocessor checks to avoid defining functions that use long long if it isn't available
Effects the following languages: javascript, octave, perl, python, r, ruby, tcl
2016-01-06 16:52:37 -05:00
William S Fulton
4f2dcfaeeb Fixes for Ruby and using -Wmissing-field-initializers 2015-12-19 16:21:22 +00:00
William S Fulton
6b4e57245d Fix STL wrappers to not generate <: digraphs.
For example std::vector<::X::Y> was sometimes generated, now
corrected to std::vector< ::X::Y >.
2015-12-12 14:05:46 +00:00
William S Fulton
93eb7eae0b Limited Python/Ruby support for boost::array
Hack to use the std::array support for boost::array.
Is limited as it currently exposes some 'using' bugs in SWIG.
For example, the type system fails to see that pointers to std::array
and pointers to boost::array are the same.

This approach saves having to maintain separate boost::array support.
The 'using' bug ought to be fixed, otherwise separate boost_array.i
files could be easily made from the std_array.i files.
2015-11-27 19:30:22 +00:00
William S Fulton
bb2523a003 Ruby STL container setting slices fixes
Setting an STL container wrapper slice better matches the way Ruby
arrays work. The behaviour is now the same as Ruby arrays. The only
exception is the default value used when expanding a container
cannot be nil as this is not a valid type/value for C++ container
elements.
2015-11-25 10:13:30 +00:00
William S Fulton
cd33aba427 Ruby STL container ranges and slices fixes.
Access via ranges and slices now behave identically to Ruby arrays.
The fixes are mostly for out of range indices and lengths.
- Zero length slice requests return an empty container instead of nil.
- Slices which request a length greater than the size of the container
  no longer chop off the last element.
- Ranges which used to return nil now return an empty array when the
  the start element is a valid index.
2015-11-25 09:19:13 +00:00
William S Fulton
fe09f05beb Ruby STL container negative indexing support improved
Using negative indexes to set values works the same as Ruby arrays, eg

%template(IntVector) std::vector<int>;

iv = IntVector.new([1,2,3,4])
iv[-4] = 9 # => [1,2,3,9]
iv[-5] = 9 # => IndexError
2015-11-25 09:19:13 +00:00
William S Fulton
b8feb85f0e Add Ruby std_array.i - std::array wrappers 2015-11-25 09:19:05 +00:00
William S Fulton
146252ff21 SWIG_Ruby_ConvertPtrAndOwn changes for smartptr feature
rb_obj_is_kind_of can no longer be used for type checking as the
smartptr feature type, eg shared_ptr<Derived> cannot be cast to
a smartptr of the base class, eg shared_ptr<Base>.
Previously Derived could be cast to Base as they were in an
inheritance chain and the call to rb_define_class_under() used
SWIGTYPE_p_Base->clientdata for all derived classes.
Now SWIG_TypeCheck is always used.
2015-09-25 22:58:00 +01:00
William S Fulton
fcb383b46b shared_ptr typemap error message fix for global variables
$argnum was not being expanded in the generated code
Correct to use the error message from the standard typemaps
2015-09-25 22:57:59 +01:00
William S Fulton
4677dbb796 Add Ruby shared_ptr typemaps 2015-09-25 22:57:53 +01:00
William S Fulton
3d1e20248f Ruby ownership refactor ready for smart pointers
ruby_owntype replaced with swig_ruby_owntype which contains a member own
for forthcoming smart pointer support.
2015-09-14 07:20:43 +01:00
William S Fulton
604b3d009c Ruby trackings bug fix support for 1.8
Issue #225
2015-09-13 20:09:50 +01:00
William S Fulton
e14b392596 Ruby trackings patch tidy up and add changes entry
Closes #225
2015-09-13 14:53:26 +01:00
Klaus Kämpf
0e725b5d9b Fix Ruby tracking code to use C hash
This is a patch to resolve SF bug 2034216 (Github issue #225)
The bug is that the tracking code uses a ruby hash and thus may
allocate objects (Bignum) while running the GC. This was tolerated in
1.8 but is invalid (raises an exception) in 1.9.
The patch uses a C hash (also used by ruby) instead.
2015-09-13 14:53:25 +01:00
Olly Betts
d1a8675ac4 Fix incorrect comments 2015-05-09 21:59:03 +12: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
3191473523 Fix compiler warnings in generated code when using -std=c++98 -std=gnu89 -pedantic -Wreturn-type 2014-05-24 14:13:19 +01:00
Karl Wette
d5b765d388 Whitespace cleanup of all Makefiles*
- some of the %.clean rules in the test-suite Makefiles were using a single tab
  as an empty rule, dangerous! I've replaced these with the safer '@exit 0'.
2014-05-02 20:06:11 +02:00
William S Fulton
e897733b08 Fix missing fragments in Ruby wstring typemaps 2014-03-07 13:15:53 +00:00
Olly Betts
2f3bf144c6 Fix assorted comment and documentation typos 2014-02-23 17:15:22 +13:00
William S Fulton
0d9a8721f4 Move some header file includes into fragments for UTL languages 2014-02-21 19:02:14 +00:00
Olly Betts
b761131fec "if (strlen(msg))" -> "if (msg[0])" 2014-02-17 16:26:48 +13:00
William S Fulton
cc650e692e Director exceptions now derive from std::exception 2014-01-20 19:40:52 +00:00
William S Fulton
1a19451c1b Error out attempting to use directors without -c++
Remove redundant #ifdef __cplusplus markers in director.swg
2013-12-23 20:23:54 +00:00
William S Fulton
135a7cc558 Beautify director.swg files
Also some comment corrections for Perl
2013-12-23 19:50:41 +00:00
William S Fulton
1c5246ad66 Fix some gcc -Wall unused warnings in the Ruby wrappers
Fixes SF bug 1333.
2013-10-18 18:13:11 +01:00
William S Fulton
48eed4f9e4 Fix unused variable warning in Ruby wrappers when using gcc -Wall 2013-10-18 06:49:20 +01:00
William S Fulton
80f8d1d922 Fix for missing C++ code in std::multimap wrappers.
%template for a std::multimap generated uncompilable code unless a
%template for a std::map of the same template types was also coded up.

This patch is needed in conjunction with previous commit - 5f1fff1849

Closes #64
Closes #65
2013-08-06 07:02:49 +01:00
William S Fulton
3834036e13 Fix Ruby regression with missing rb_complex_new function.
Affects Ruby versions prior to 1.9 using std::complex wrappers if just using std::complex
as an output type. Also fix the Complex helper functions external visibility (to static by default).

Closes #52
2013-06-07 19:56:38 +01:00
Nishant Rodrigues
5fd059d80f Patch fixing warning 322 in rubycontainer_extended
'rubycontainer_extended.swg' generates warnings:

 Warning 322: Redundant redeclaration of 'map_bang',
 Warning 322: previous declaration of 'map_bang'.

The fix is to remove a redundant call to swig_container_extend for
swig::GC_VALUE.

Thanks

========================================================
2013-04-08 18:58:01 +01: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
9aaf4ad03c Fixes for Ruby 1.9 std::complex wrappers.
New native Ruby complex numbers are used.
2013-04-02 20:14:51 +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
2e0d1b12dc Fix delete_if (reject!) for the STL container wrappers.
Previously they would sometimes seg fault or not work.
2013-03-29 06:28:15 +00:00
Olly Betts
b72aca1d07 Fix typo in comment (swift->swig) 2013-03-20 15:39:03 +13:00
Klaus Kämpf
23771ef027 Ruby: Replace all occurences of STR2CSTR macro with calls to StringValuePtr
STR2CSTR was deprecated in Ruby since years and got finally removed
in Ruby 1.9


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13967 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-12-14 15:48:31 +00:00
William S Fulton
2c74c90430 Fix for gcc warning -Wunused-value without triggering -Wunused-parameter
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13735 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-07 06:06:00 +00:00
William S Fulton
5effbc386c Apply patch #3517769 from Robin Stocker to fix compile error on MacRuby using RSTRING_PTR
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12980 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-14 16:18:04 +00:00
William S Fulton
347f2782d2 Fix missing stddef.h when %import of STL containers. Was causing compile failures witht g++-4.6.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12939 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-03-20 20:07:56 +00:00
William S Fulton
50693941c6 Fix #3475492 - iterating through std::vector wrappers of enumerations.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12916 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-03-13 07:10:24 +00:00
William S Fulton
58e74e8675 Rename python_kwargs testcase to kwargs_feature. Add kwargs_feature to Ruby and fix Ruby warnings when using kwargs feature. Add %kwargs macro for Ruby
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12739 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-06-13 17:38:08 +00:00
William S Fulton
f8270079eb remove unused macro
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12689 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-19 06:44:17 +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
William S Fulton
7d700cc999 patch #3176274 - Ruby typecheck typemap for time_t.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12459 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-13 22:19:46 +00:00
Olly Betts
28e277f8c5 Fix typo "the the" -> "the"
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12285 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-10-19 06:31:31 +00:00
Olly Betts
045066e802 Fix typo in comment
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12236 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-10-01 04:17:55 +00:00