Commit graph

21 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
William S Fulton
91aba9f719 UTL STL container descriptor checks
The vector of pointers (just fixed) were not working correctly because the
descriptors returned from swig::type_info() were sometimes returning
zero. Zero should only be used for void * as the subsequent call to
SWIG_ConvertPtr will blindly cast the pointer without checking
descriptor.

std::vector<void *> does not work and will require further changes:
specializing traits_info<void *> to return 0 and traits_asptr<void *>.
I tried this and traits_asptr<void> also needs to be added in which
seems odd and requires further investigation...

Lib/python/pystdcommon.swg:
  template <> struct traits_info<void *> {
    static swig_type_info *type_info() {
      static swig_type_info *info = 0;
    }
  };

Lib/std/std_common.i:
  template <>
  struct traits_asptr<void *> {
    static int asptr(PyObject *obj, void ***val) {
      void **p;
      swig_type_info *descriptor = 0;
      int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
      if (SWIG_IsOK(res)) {
	if (val) *val = p;
      }
      return res;
    }
  };

  // this is needed, but am not sure this is expected
  template <>
  struct traits_asptr<void> {
    static int asptr(PyObject *obj, void **val) {
      void **p;
      swig_type_info *descriptor = 0;
      int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
      if (SWIG_IsOK(res)) {
	if (val) *val = p;
      }
      return res;
    }
  };
2016-07-28 22:51:29 +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
830de4d2f1 Various ruby-1.9.x compile fixes including patch from Nibble
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11862 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-13 16:59:41 +00:00
Gonzalo Garramuno
b20fd0d06f Moved functors away from std_set.i and std_map.i
into their own std_functors.i file.
Made binarypredicate, etc. be templates to allow more
strict predicates/functors.




git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9815 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-16 22:48:01 +00:00
Gonzalo Garramuno
d4eec2670b Fixed renames of std_* containers to a safer
%rename directive.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9810 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-16 21:27:08 +00:00
Gonzalo Garramuno
315bd2da6e Added new iterator changes to std.
This change does not break backwards compatability
with python, so all works.
The python stuff, however, will still not do all
that ruby can now do.
Updated manual to reflect the change and improve
typemap documentation on the ruby side.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9787 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-07 05:00:46 +00:00
Gonzalo Garramuno
1cf8fd332b Added constructor that can take functors to all
containers that can use one.
Created file rubystdfunctors.swg to allow passing in
Ruby procs as functors to STL functions (swig-user list
suggestion for Python).
Fixed a bug in type_info() always failing for std::set.
Fixed a bug in type_info() always accepting any failed
conversion which could lead to overloaded functions to
fail when input wrong parameters.




git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9775 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-06 03:56:33 +00:00
Gonzalo Garramuno
81c84b7e8c Rename fixes to STL.
Removed object reporting in non-verbose from 
newobject demos.
Made wstring treat them as normal strings as
advertised.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9771 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-05 00:46:20 +00:00
Gonzalo Garramuno
f8ee6e65fe Updated Ruby manual to enhance section on the STL.
Fixed inspect() method on map and rubycontainer
not using inspect to print out elements.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9759 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-03 06:58:55 +00:00
Gonzalo Garramuno
c6ece2bb93 Made autodoc ignore numinputs=0.
Added more typemap(doc) for documenting STL
and standard ruby methods.
Added missing RUBY_SELF typemap.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9754 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-02 22:09:06 +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
c0a7c7e081 Added proper each(), printing and other methods to map
and multimap.




git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9733 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 05:43:30 +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
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
Olly Betts
2f6a268e55 Support building with recent versions of the Ruby 1.9 development branch.
Fixes bug #1560092.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9333 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-09-23 21:39:09 +00:00
William S Fulton
49be05f4fd Common template for head of each file detailing licence, distribution and authors information
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8973 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-03-07 00:14:10 +00:00
William S Fulton
03a67698a9 use exception specification instead of %exception to handle STL error checking
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7352 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-07-27 20:09:42 +00:00
Luigi Ballabio
03658fcb4c std::map ready for prime time (hopefully)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4510 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-03-11 15:38:02 +00:00
Luigi Ballabio
9d50216d9c Support for std::map (thanks, Dave)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4414 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-02-27 10:05:55 +00:00