use type checks to order r outputs
add noreturn exception handler git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12935 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7461134b80
commit
efa5edbe5b
2 changed files with 38 additions and 2 deletions
|
|
@ -361,6 +361,11 @@ SWIG_R_ConvertPacked(SEXP obj, void *ptr, size_t sz, swig_type_info *ty) {
|
|||
return SWIG_OK;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <exception>
|
||||
#define SWIG_exception_noreturn(code, msg) do { throw std::runtime_error(msg); } while(0);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -36,7 +36,37 @@
|
|||
%typemap("rtype") SWIGTYPE & "$R_class";
|
||||
%typemap("rtype") SWIGTYPE "$&R_class";
|
||||
|
||||
%typemap("rtypecheck") int, int &, long, long &,
|
||||
unsigned char, unsigned char &
|
||||
%{ is.integer($arg) || is.numeric($arg) %}
|
||||
%typemap("rtypecheck") int *, long *, unsigned char *
|
||||
%{ (is.integer($arg) || is.numeric($arg)) && length($arg) == 1 %}
|
||||
|
||||
%typemap("rtypecheck") double, double &, float, float &
|
||||
%{ is.numeric($arg) && length($arg) == 1 %}
|
||||
%typemap("rtypecheck") double*, float *
|
||||
%{ is.numeric($arg) %}
|
||||
|
||||
%typemap("rtypecheck") bool, bool &
|
||||
%{ is.logical($arg) && length($arg) == 1 %}
|
||||
%typemap("rtypecheck") bool *
|
||||
%{ is.logical($arg) % }
|
||||
|
||||
/*
|
||||
Set up type checks to insure overloading precedence.
|
||||
We would like non pointer items to shadow pointer items, so that
|
||||
they get called if length = 1
|
||||
*/
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_BOOL_PTR) bool * {}
|
||||
%typecheck(SWIG_TYPECHECK_INT32_PTR) int * {}
|
||||
%typecheck(SWIG_TYPECHECK_FLOAT_PTR) float * {}
|
||||
%typecheck(SWIG_TYPECHECK_DOUBLE_PTR) double * {}
|
||||
%typecheck(SWIG_TYPECHECK_CHAR_PTR) char * {}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_INT32_ARRAY) int[ANY] {}
|
||||
%typecheck(SWIG_TYPECHECK_FLOAT_ARRAY) float[ANY] {}
|
||||
%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) double [ANY] {}
|
||||
|
||||
/* Have to be careful that as(x, "numeric") is different from as.numeric(x).
|
||||
The latter makes a REALSXP, whereas the former leaves an INTSXP as an
|
||||
|
|
@ -170,10 +200,11 @@ string &, std::string &
|
|||
signed long,
|
||||
signed long &,
|
||||
unsigned long,
|
||||
unsigned long &
|
||||
unsigned long &,
|
||||
unsigned char *,
|
||||
unsigned char &
|
||||
%{ %}
|
||||
|
||||
|
||||
#if 0
|
||||
Just examining the values for a SWIGTYPE.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue