Commit graph

109 commits

Author SHA1 Message Date
William S Fulton
39e3c3b9d7 Fix R return by C++11 const ref enum classes 2019-03-18 17:49:24 +00:00
Richard Beare
43af20ab3b FIX: references to enums now functioning
There is some consolidation work to be done. The
core of the change is getRClassName2, which will
probably eventually replace getRClassName.

getRClassName seems to be in a funny state, with
a middle argument that is commented out and never
used.

My next step is to verify whether the new version
can replace it.
2019-03-08 21:56:36 +11:00
Richard Beare
e9b39797cc Setting enum values with calls to the C code. 2019-03-08 21:56:36 +11: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
f181d20dd1 Fix overloading for non-pointers and NULL - R 2018-12-30 13:46:51 +00:00
William S Fulton
3ce3ce0683 Add std_shared_ptr.i for Scilab and R as boost_shared_ptr.i is already available 2018-03-09 06:58:08 +00:00
Joseph C Wang
4e8c515d36 add new tests and coercion files for null fix #1124 2017-11-26 03:43:39 +08:00
Joseph C Wang
9c32a1e722 fix null changes to work with C90 compilers 2017-11-26 03:42:32 +08:00
Joseph C Wang
0b97170f1d fix #1124 - return R_NilValue for null pointer objects
This fixes #1124 and returns R_NilValue for null pointer objects
2017-11-24 23:43:02 +08: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
fcd7ecd9e2 R memory handling standardisation
Replace R_SWIG_EXTERNAL and R_SWIG_OWNER with the standard equivalent
macros. I can't see where these were actually used, but in case they are,
equivalent backwards compatibility can be obtained using:

  #define R_SWIG_EXTERNAL 0
  #define R_SWIG_OWNER SWIG_POINTER_OWN

SWIG_MakePtr does not seem to be used within the R SWIG code base so I
havn't added the above as backwards compatibility macros.
There seems to be no memory management in R. I've made this change
to fit in with the rest of SWIG though in preparation for an upcoming
commit to use the same shared_ptr macros as is used elsewhere.
2017-10-13 07:34:38 +01:00
William S Fulton
114fab31a1 Scilab, R and Octave shared_ptr typemaps null fix
Merge changes from Python/Ruby equivalent files to obtain a fix
for NULL handling of T*const& typemaps.
2017-10-11 18:08:32 +01:00
William S Fulton
a674edebf5 Octave and R shared_ptr typemaps update
Synchronize typemaps with other identical typemaps in Scilab/Ruby.
Adds some missing $disown support.
2017-10-11 08:33:02 +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
a2e3cc0709 as() no longer uses memset and always throws. 2017-07-20 13:07:59 -06: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
ab1e9f5bd9 Consistent whitespace amongst all the shared_ptr and intrusive_ptr typemaps
[skip ci]
2017-04-20 19:21:47 +01:00
William S Fulton
94e7482e48 Remove illegal operator overload names in R
https://github.com/swig/swig/pull/853
2016-12-22 19:59:58 +00:00
William S Fulton
f9158e525f Revert "Merge pull request #853 from ivannp/underscores"
This reverts commit a964098754, reversing
changes made to bda3a11f9e.

SWIG should only provide default operator names that provide special
standard or conventional meaning in the target language.
2016-12-22 19:47:54 +00:00
Ivan Popivanov
5ec5266284 Renamed all operators beginning with underscore. 2016-12-17 16:26:10 -08:00
Joseph C Wang
377f756f49 Fix #555 - Add stdio.h
This corrects for compilers that need stdio.h
2016-11-12 00:28:39 +08:00
Richard Beare
c334efd36b Writing R extensions says:
Most R header files can be included within C++ programs but they should
not be included within an extern "C" block (as they include system headers).

This patch moves the Rdefines.h and Rversion.h outside the extern block.
2016-08-05 15:46:14 +10: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
a293ee6a15 Remove unused code in R wrappers 2016-06-05 21:40:03 +01:00
Richard Beare
85f0930f73 cleaned up constants 2016-04-21 18:11:56 +10:00
Richard Beare
3f75b2917d R delete an old trace statement 2016-04-19 14:41:26 +10:00
Richard Beare
1403610518 Missing definitions for vector references 2016-04-19 14:26:37 +10:00
Richard Beare
f7b794a4f3 run test and copying typemaps to std::string 2016-04-05 10:06:42 +10:00
Richard Beare
720c4d3dfc added R string vector to C++ std::vector of strings 2016-04-05 09:39:47 +10:00
joequant
7e3165848b Merge pull request #633 from sbpcs59/master
Suppress unmessage at package load
2016-03-26 13:20:38 +08:00
Richard Beare
0821ec0b45 Support for more numeric types in std::vector for R.
This change allows R to automatically convert std::vectors of
signed and unsigned 8, 16, 32 and 64 bit integer types.

rtype, rtypecheck, scoercein and scoerceout typemaps are copied
across integer types.
2016-03-15 12:03:25 +11:00
sbpcs59
2ea53f2dd1 Suppress message at package load - Creating a generic function for ‘print’ from package ‘base’ in package <some package> 2016-03-10 20:29:15 -08:00
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
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
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
Joseph C Wang
fe39ef5fae suppress warning for ExternalReference print 2015-07-04 13:22:55 +08:00
William S Fulton
5fb344e0e6 R - fix duplicate generation of 'self' parameter.
Fixes director_keywords test case.
2015-06-12 20:25:00 +01:00
William S Fulton
1891b82e00 R - Call to SWIG_createNewRef in copyToC was incorrectly named.
Closes #430
2015-06-12 20:23:56 +01:00
William S Fulton
ede1e9544c Fix R Lib files and testcase failing due to new preprocessor checks
Fixes unknown preprocessor directive error introduced in #217
commit 255c929c56
These were probably intended as script comments using # when C/C++
comments using // or /* */ should have been used.
2014-10-29 23:11:09 +00:00
William S Fulton
8da4d6712d Fix Visual Studio compile error in C++ wrappers due to #include <exception> within extern "C" block.
Fixes SF #1340
2013-10-17 21:54:58 +01:00
William S Fulton
bcb7aee022 Merge branch 'master' into gsoc2009-matevz
Conflicts:
	Examples/Makefile.in
	Examples/guile/Makefile.in
	Lib/php/php.swg
	Makefile.in
	Source/CParse/parser.y
	configure.ac
2013-10-10 07:26:09 +01:00
William S Fulton
0431664b18 Guile OUTPUT typemap fix
Fixes 'attempt to free a non-heap object' in some OUTPUT typemaps.
2013-09-15 10:43:49 +01:00
joequant
93b63969f9 change to allow file SEXP return values 2013-07-14 20:28:17 +08:00
William S Fulton
e805d5f925 Merge branch 'master' into gsoc2009-matevz
parser.y still to be fixed up

Conflicts:
	Doc/Devel/engineering.html
	Examples/Makefile.in
	Lib/allegrocl/allegrocl.swg
	Lib/csharp/csharp.swg
	Lib/csharp/enums.swg
	Lib/csharp/enumsimple.swg
	Lib/csharp/enumtypesafe.swg
	Lib/java/java.swg
	Lib/python/pydocs.swg
	Lib/r/rtype.swg
	Source/Include/swigwarn.h
	Source/Modules/octave.cxx
	Source/Modules/python.cxx
	Source/Modules/ruby.cxx
	Source/Swig/scanner.c
	Source/Swig/stype.c
	Source/Swig/swig.h
	configure.ac
2013-01-28 07:01:37 +00:00
William S Fulton
ac74c90fb0 Add rvalue reference typemaps 2013-01-24 20:27:29 +00:00
joequant
beb40008b1 add boost_shared_ptr for R 2013-01-07 06:03:37 +08:00
joequant
308b5dab3f r changes to handle external pointers 2013-01-06 19:42:12 +08: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