summaryrefslogtreecommitdiff
path: root/Lib/r
Commit message (Collapse)AuthorAgeFilesLines
* R rtypecheck typemapsWilliam S Fulton2022-11-051-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | Further switch to use rtypecheck typemaps instead of hard coded logic. The full switch to typemaps is deferred until swig-4.2 as it can't be fully backwards compatible. For now a warning is provided to help the transition. It provides the full typemap that should be placed into a user's interface file, for example: %typemap("rtype") int32_t * "integer" void testmethod(int32_t * i); void testmethod(); If there is no rtypecheck typemap for int32_t *, the warning shown is: example.i:7: Warning 750: Optional rtypecheck code is deprecated. Add the following typemap to fix as the next version of SWIG will not work without it: %typemap("rtypecheck") int32_t * %{ (is.integer($arg) || is.numeric($arg)) %} The warning is shown for any code that previously used "numeric", "integer" or "character" for the rtype typemap. Copying the rtypecheck typemap as shown into the user interface file will provide the appropriate fix and the warning will disappear. This is important to do as swig-4.2 will not be able to provide this helpful warning.
* Overloading fixes for R and rtypecheck typemapWilliam S Fulton2022-11-051-0/+6
| | | | | | | | - Fix for special variable $argtype expansion in rtypecheck typemap. - Remove unnecessary () brackets when using rtypecheck typemap for single parameter functions. - Add rtypecheck typemaps for shared_ptr so that NULL can be used in overloaded functions taking shared_ptr.
* Fix memory leak in R shared_ptr wrappersWilliam S Fulton2022-11-052-6/+16
| | | | | | | | | Fix leak when a cast up a class inheritance chain is required. Adds implementation of SWIG_ConvertPtrAndOwn for R. Closes #2386
* R shared_ptr fixesWilliam S Fulton2022-10-241-0/+19
| | | | | | | | Fix problems in shared_ptr wrappers where the class names were not consistent when using the shared_ptr template or the actual underlying type. Move $R_class substitution to typemaps. Issue #2386
* R - Add support for std::vector<std::vector<std::string>>William S Fulton2022-10-171-3/+35
| | | | Closes #2385
* Correct new Raise functions to be staticWilliam S Fulton2022-10-141-1/+1
|
* Remove STRING_VALUE to keep supporting older versions of RWilliam S Fulton2022-10-141-1/+1
| | | | | STRING_VALUE does not work with R_NO_REMAP in older versions (it broke 3.0.2)
* Add missing SWIGTYPE *const& typemapsWilliam S Fulton2022-10-131-2/+7
|
* Javascript, Octave, R - Improve exceptions for %catchesWilliam S Fulton2022-09-191-3/+7
| | | | | | | | | and exception specifications for native types. Now the raised exception contains the string value as the exception message instead of just the C/C++ type of the exception. R exceptions were completely swallowed beforehand
* Provide SWIGTYPE MOVE typemaps in swigmove.iWilliam S Fulton2022-09-161-0/+1
| | | | | | | | | | | | For implementing full move semantics when passing parameters by value. Based on SWIGTYPE && and std::unique_ptr typemaps which implement move semantics. Added for all languages, but untested for: Go, Ocaml, R, Scilab (and unlikely to be fully functional for same reasons as for std::unique_ptr support). Issue #999
* Cosmetic stray semi-colon removal after %typemap using quotesWilliam S Fulton2022-08-313-28/+28
|
* More move semantics improvementsWilliam S Fulton2022-07-041-2/+2
| | | | | More removal of casts in the out typemaps when copying objects to enable C++ compilers to possibly make use of move semantics.
* Performance optimisation for directors for classes passed by valueWilliam S Fulton2022-07-041-1/+1
| | | | | | | The directorin typemaps in the director methods now use std::move on the input parameter when copying the object from the stack to the heap prior to the callback into the target language, thereby taking advantage of move semantics if available.
* Renames performed by `%namewarn` with `rename=` are printed in warning messageSeth R Johnson2022-02-061-2/+2
| | | | | | This is necessary for regex-like renames (where you can't use the #define trick as is done in many of the %keywordwarn directives). It's now unnecessary to print the "renaming to '`x`'" code explicitly by the kw.swg files.
* fixed some missing semicolons. Each one caused a compile error in generated codekhoran2020-03-251-5/+5
|
* Minor refactor of R error handling codeWilliam S Fulton2020-01-311-34/+32
|
* Fix R memory leak on exceptionArnaud Barré2020-01-302-4/+43
| | | | | | | | | | There is a possible memory leak in case the SWIG_exception_fail macro is called. The problem is related to its definition that call the function Rf_warning. This function (as well as Rf_error) involves a longjmp over C++ destructors on the stack. Thus, all the objects allocated on the heap are not freed. Closes #914
* Fix R return by C++11 const ref enum classesWilliam S Fulton2019-03-181-1/+1
|
* FIX: references to enums now functioningRichard Beare2019-03-082-4/+8
| | | | | | | | | | | | | 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.
* Setting enum values with calls to the C code.Richard Beare2019-03-081-1/+1
|
* Create a consistent stl.i library fileWilliam S Fulton2019-02-121-9/+8
| | | | | Same file now for all languages except R which is still missing std_map.i. Recent Java changes adding in std_set.i removed.
* Fix overloading for non-pointers and NULL - RWilliam S Fulton2018-12-302-2/+2
|
* Add std_shared_ptr.i for Scilab and R as boost_shared_ptr.i is already availableWilliam S Fulton2018-03-091-0/+2
|
* add new tests and coercion files for null fix #1124Joseph C Wang2017-11-261-5/+12
|
* fix null changes to work with C90 compilersJoseph C Wang2017-11-261-1/+2
|
* fix #1124 - return R_NilValue for null pointer objectsJoseph C Wang2017-11-241-0/+3
| | | | This fixes #1124 and returns R_NilValue for null pointer objects
* Enhancements for directorin typemapsWilliam S Fulton2017-10-161-29/+29
| | | | | | | | | 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.
* Director shared_ptr typemaps for scripting languagesWilliam S Fulton2017-10-131-0/+82
| | | | | | | 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.
* R memory handling standardisationWilliam S Fulton2017-10-131-4/+2
| | | | | | | | | | | | | | | 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.
* Scilab, R and Octave shared_ptr typemaps null fixWilliam S Fulton2017-10-111-4/+3
| | | | | Merge changes from Python/Ruby equivalent files to obtain a fix for NULL handling of T*const& typemaps.
* Octave and R shared_ptr typemaps updateWilliam S Fulton2017-10-111-7/+18
| | | | | Synchronize typemaps with other identical typemaps in Scilab/Ruby. Adds some missing $disown support.
* Fix overloading of shared_ptr method overloadingWilliam S Fulton2017-09-231-1/+1
| | | | | Add 'equivalent' attribute to typecheck typemap. Closes #1098.
* Fix various comment and documentation typosOlly Betts2017-08-132-2/+2
|
* as() no longer uses memset and always throws.Mike Romberg2017-07-201-11/+5
|
* Fix warning in generated code - traits_asptr.William S Fulton2017-06-131-1/+1
| | | | | Visual Studio 2015 debug builds: error C4703: potentially uninitialized local pointer variable 'p' used
* Consistent whitespace amongst all the shared_ptr and intrusive_ptr typemapsWilliam S Fulton2017-04-201-11/+11
| | | | [skip ci]
* Remove illegal operator overload names in RWilliam S Fulton2016-12-221-38/+0
| | | | https://github.com/swig/swig/pull/853
* Revert "Merge pull request #853 from ivannp/underscores"William S Fulton2016-12-221-26/+38
| | | | | | | | This reverts commit a96409875462468c8ebdbadb8bc9e5f7566f7794, reversing changes made to bda3a11f9e167629300cecdea3139505c3cf4c84. SWIG should only provide default operator names that provide special standard or conventional meaning in the target language.
* Renamed all operators beginning with underscore.Ivan Popivanov2016-12-171-38/+26
|
* Fix #555 - Add stdio.hJoseph C Wang2016-11-121-0/+1
| | | | This corrects for compilers that need stdio.h
* Writing R extensions says:Richard Beare2016-08-051-11/+11
| | | | | | | 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.
* UTL STL container descriptor checksWilliam S Fulton2016-07-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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; } };
* Remove unused code in R wrappersWilliam S Fulton2016-06-051-4/+0
|
* cleaned up constantsRichard Beare2016-04-211-45/+52
|
* R delete an old trace statementRichard Beare2016-04-191-2/+1
|
* Missing definitions for vector referencesRichard Beare2016-04-191-27/+27
|
* run test and copying typemaps to std::stringRichard Beare2016-04-051-4/+14
|
* added R string vector to C++ std::vector of stringsRichard Beare2016-04-051-2/+36
|
* Merge pull request #633 from sbpcs59/masterjoequant2016-03-261-2/+2
|\ | | | | Suppress unmessage at package load
| * Suppress message at package load - Creating a generic function for ↵sbpcs592016-03-101-2/+2
| | | | | | | | ‘print’ from package ‘base’ in package <some package>