make ExternalReference slot ref to contain reference

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13721 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Joseph Wang 2012-08-26 03:35:04 +00:00
commit 33bb317b61
3 changed files with 126 additions and 42 deletions

View file

@ -4,4 +4,8 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.9 (in progress)
===========================
2012-08-26: drjoe
[R] make ExternalReference slot ref to contain reference
2012-08-26: drjoe
[R] fix Examples/Makefile to use C in $(CC) rather than $(CXX)

View file

@ -4,24 +4,9 @@
*/
%typemap("rtype") int, int *, int & "integer";
%apply int {size_t}
%apply int {std::size_t}
%apply int {ptrdiff_t}
%apply int {std::ptrdiff_t}
%apply int {signed int}
%apply int {unsigned int}
%apply int {short}
%apply int {unsigned short}
%typemap("rtype") long, long *, long & "integer";
%apply long {long long}
%apply long {signed long long}
%apply long {unsigned long long}
%apply long {signed long}
%apply long {unsigned long}
%typemap("rtype") float, float*, float & "numeric";
%typemap("rtype") double, double*, double & "numeric";
%typemap("rtype") float, float *, float & "numeric";
%typemap("rtype") char *, char ** "character";
%typemap("rtype") char "character";
%typemap("rtype") string, string *, string & "character";
@ -36,16 +21,15 @@
%typemap("rtype") SWIGTYPE & "$R_class";
%typemap("rtype") SWIGTYPE "$&R_class";
%typemap("rtypecheck") int, int &, long, long &,
unsigned char, unsigned char &
%typemap("rtypecheck") int, int &, long, long &
%{ (is.integer($arg) || is.numeric($arg)) && length($arg) == 1 %}
%typemap("rtypecheck") int *, long *, unsigned char *
%typemap("rtypecheck") int *, long *
%{ is.integer($arg) || is.numeric($arg) %}
%typemap("rtypecheck") double, double &, float, float &
%typemap("rtypecheck") float, double
%{ is.numeric($arg) && length($arg) == 1 %}
%typemap("rtypecheck") double*, float *
%typemap("rtypecheck") float *, double *
%{ is.numeric($arg) %}
%typemap("rtypecheck") bool, bool &
@ -88,9 +72,8 @@
%{ $input = as.integer($input); %}
%typemap(scoercein) long, long *, long &
%{ $input = as.integer($input); %}
%typemap(scoercein) double, double *, double &
%{ %}
%typemap(scoercein) float, float *, float &
%typemap(scoercein) float, float*, float &,
double, double *, double &
%{ %}
%typemap(scoercein) char, char *, char &
%{ $input = as($input, "character"); %}
@ -107,9 +90,8 @@
%typemap(scoercein) enum SWIGTYPE *const
%{ $input = enumToInteger($input, "$R_class"); %}
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &
%{ %}
%{ $input = slot($input,"ref") %}
/*
%typemap(scoercein) SWIGTYPE *, SWIGTYPE *const
@ -136,12 +118,10 @@
%typemap(scoercein) int,
int *,
int &,
int[ANY],
long,
long *,
long &,
long[ANY]
"$input = as.integer($input); ";
long &
"$input = as.integer($input);";
%typemap(scoercein) char *, string, std::string,
string &, std::string &
@ -159,27 +139,41 @@ string &, std::string &
%typemap(scoerceout) enum SWIGTYPE *const
%{ $result = enumToInteger($result, "$R_class"); %}
#%typemap(scoerceout) SWIGTYPE
# %{ class($result) <- "$&R_class"; %}
%typemap(scoerceout) SWIGTYPE
%{ class($result) <- "$&R_class"; %}
#%typemap(scoerceout) SWIGTYPE &
# %{ class($result) <- "$R_class"; %}
%typemap(scoerceout) SWIGTYPE &
%{ class($result) <- "$R_class"; %}
#%typemap(scoerceout) SWIGTYPE *
# %{ class($result) <- "$R_class"; %}
%typemap(scoerceout) SWIGTYPE *
%{ class($result) <- "$R_class"; %}
#%typemap(scoerceout) SWIGTYPE *const
# %{ class($result) <- "$R_class"; %}
%typemap(scoerceout) SWIGTYPE
%{ $result <- new("$&R_class", ref=$result); %}
%typemap(scoerceout) SWIGTYPE &
%{ $result <- new("$R_class", ref=$result) ; %}
%typemap(scoerceout) SWIGTYPE *
%{ $result <- new("$R_class", ref=$result) ; %}
%typemap(scoerceout) SWIGTYPE *const
%{ $result <- new("$R_class", ref=$result) ; %}
%typemap(scoerceout) SWIGTYPE *const
%{ class($result) <- "$R_class"; %}
/* Override the SWIGTYPE * above. */
%typemap(scoerceout) char,
char *,
char &,
double,
double &,
float,
double,
float*,
double*,
float &,
double &,
int,
int &,
long,
@ -208,10 +202,94 @@ string &, std::string &
signed long &,
unsigned long,
unsigned long &,
unsigned char *,
unsigned char &
signed char,
signed char &,
unsigned char,
unsigned char &
%{ %}
%apply int {size_t,
std::size_t,
ptrdiff_t,
std::ptrdiff_t,
signed int,
unsigned int,
short,
unsigned short,
signed char,
unsigned char}
%apply int* {size_t[],
std::size_t[],
ptrdiff_t[],
std::ptrdiff_t[],
signed int[],
unsigned int[],
short[],
unsigned short[],
signed char[],
unsigned char[]}
%apply int* {size_t[ANY],
std::size_t[ANY],
ptrdiff_t[ANY],
std::ptrdiff_t[ANY],
signed int[ANY],
unsigned int[ANY],
short[ANY],
unsigned short[ANY],
signed char[ANY],
unsigned char[ANY]}
%apply int* {size_t*,
std::size_t*,
ptrdiff_t*,
std::ptrdiff_t*,
signed int*,
unsigned int*,
short*,
unsigned short*,
signed char*,
unsigned char*}
%apply long {
long long,
signed long long,
unsigned long long,
signed long,
unsigned long}
%apply long* {
long long*,
signed long long*,
unsigned long long*,
signed long*,
unsigned long*,
long long[],
signed long long[],
unsigned long long[],
signed long[],
unsigned long[],
long long[ANY],
signed long long[ANY],
unsigned long long[ANY],
signed long[ANY],
unsigned long[ANY]}
%apply float* {
float[],
float[ANY]
}
%apply double * {
double[],
double[ANY]
}
%apply bool* {
bool[],
bool[ANY]
}
#if 0
Just examining the values for a SWIGTYPE.

View file

@ -1903,6 +1903,8 @@ int R::functionWrapper(Node *n) {
"\n};\n",
"if(is(", name, ", \"NativeSymbolInfo\")) {\n",
name, " = ", name, "$address", ";\n}\n",
"if(is(", name, ", \"ExternalReference\")) {\n",
name, " = ", name, "@ref;\n}\n",
"}; \n",
NIL);
} else {