Commit graph

48 commits

Author SHA1 Message Date
Mike Romberg
dd26e8a014 as() now always throws and never creates an invalid object with memset() 2017-07-03 15:35:24 -06:00
Anthony Heading
1871acd4bc Remove inheritance from std::unary_function and std::binary_function,
they are deprecated in C++11 and already removed in Visual C++ '15'
running with /std:c++latest

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3145.html
2016-12-29 00:56:46 -05: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
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
0d9a8721f4 Move some header file includes into fragments for UTL languages 2014-02-21 19:02:14 +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
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
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
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
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
William S Fulton
4308dd03cf SWIG license change - The Examples and Lib move to a very permissive license in the LICENSE file, removing the BSD license restrictions as agreed by committers since it was inadvertently introduced. Remove some examples where the impact of the license change is not clear.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11874 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-27 23:26:02 +00: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
William S Fulton
12b89ff406 Apply patch from Patrick Bennett to fix RARRAY_LEN and RARRAY_PTR usage for Ruby 1.9.x
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11859 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-13 15:06:26 +00:00
William S Fulton
55170f0f88 Add Ruby missing methods for vector<bool> specialization
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11576 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-15 00:17:21 +00:00
William S Fulton
67f5931952 Fix crashing in the Ruby reject method in the STL wrappers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10543 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-06-21 20:45:32 +00:00
William S Fulton
da8791792b STL fixes when using %import rather than %include and the Solaris Workshop compiler
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10424 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-05-07 21:33:19 +00:00
Gonzalo Garramuno
c7ec8c691d Made set_err false by default, as that gives a better overloaded
message.  Unfortunately, in ruby we cannot concatenate exception
messages as in python.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10213 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-01-19 04:41:46 +00:00
Gonzalo Garramuno
f2f29c9ba5 Moved the std::pair< iterator, bool > typemap to std_set.i
where it belongs.
This solves the problem with swig conflicts (at least for now).



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10071 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-10-29 22:12:56 +00:00
William S Fulton
c01ba3666c more signed / unsigned mismatch fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10047 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-10-26 00:31:01 +00:00
William S Fulton
bee6b6650f signed / unsigned mismatch fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10046 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-10-26 00:23:58 +00:00
Gonzalo Garramuno
5aaf3003b6 Added a partial specialization for swig::GC_VALUE
to avoid the need to check each element in the container
during copy constructors.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9828 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-20 15:23:43 +00:00
Gonzalo Garramuno
211ee4eb0a Fix for std::pair< iterator, iterator > making the
iterator non-consts, when the key is always const
and will prevent modification.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9816 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-17 10:28:20 +00:00
Gonzalo Garramuno
72b118220f Added some spaces in template names to avoid
potential compilation errors.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9812 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-16 21:29:34 +00:00
Gonzalo Garramuno
d162646475 Fixed swig::ConstIterator to use a GC_VALUE
instead of a normal value.
Fixed container iterator typemaps to pass self
in as sequence (this makes iterator print itself ok)
Fixed typo in rubycomplex comment.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9790 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-08 10:11:41 +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
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
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
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
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
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
1b349d4749 Fixed a bug with argout values being incorrectly
returned when the first argout/returned element
was an array.

Made std::pair and container returned elements be
frozen (like tuples in python).

Added the std_containers.i test from python and
created a ruby runme file for it.




git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9746 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 22:40:55 +00:00
Gonzalo Garramuno
68b52c4ee5 Added support for complex numbers.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9743 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 10:37:09 +00:00
Gonzalo Garramuno
eb4817c9ee Added select() function to sequences.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9742 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 10:08:24 +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
8564ff90c0 Improved multimap, vector and set by rearranging
some methods.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9739 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 06:43:56 +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
aa3c28e230 Yet even better swig assert.
Added more tests to std::vector for map.
Added dup() function to containers.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9732 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 01:54:02 +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
8986650322 Typo fix.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9722 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-04-30 09:49:58 +00:00
Gonzalo Garramuno
806d9040c5 Updated CHANGES.current.
Fixed problems with insert() and unshift() functions in std::vector for ruby.
Updated Ruby documentation.
Improved swig_assert.rb.
Added "second" singleton to std_pair in ruby.
Modified two tests to follow the new STL stuff.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9721 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-04-30 09:45:10 +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
Gonzalo Garramuno
3dc18ec7ca Added rubycontainer.swg.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9705 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-04-29 19:42:27 +00:00