Add missing SWIGTYPE *const& typemaps

This commit is contained in:
William S Fulton 2022-10-13 22:22:18 +01:00
commit 752b7e82cd
3 changed files with 24 additions and 2 deletions

View file

@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.1.0 (in progress)
===========================
2022-10-13: wsfulton
[R] Add missing SWIGTYPE *const& typemaps for supporting pointers
by const reference.
2022-10-10: wsfulton
#2160 Fix compile error when using templates with more than one template
parameter and used as an input parameter in a virtual method in a

View file

@ -0,0 +1,13 @@
clargs <- commandArgs(trailing=TRUE)
source(file.path(clargs[1], "unittest.R"))
dyn.load(paste("constant_pointers", .Platform$dynlib.ext, sep=""))
source("constant_pointers.R")
cacheMetaData(1)
myb <- B()
bret = bar(myb)
bret2 = cbar(myb)
bret3 = bar(bret2)
q(save="no")

View file

@ -14,12 +14,13 @@
%typemap("rtype") bool, bool * "logical"
%typemap("rtype") enum SWIGTYPE "character"
%typemap("rtype") enum SWIGTYPE * "character"
%typemap("rtype") enum SWIGTYPE *const "character"
%typemap("rtype") enum SWIGTYPE *const& "character"
%typemap("rtype") enum SWIGTYPE & "character"
%typemap("rtype") const enum SWIGTYPE & "character"
%typemap("rtype") enum SWIGTYPE && "character"
%typemap("rtype") SWIGTYPE * "$R_class"
%typemap("rtype") SWIGTYPE *const "$R_class"
%typemap("rtype") SWIGTYPE *const& "$*R_class"
%typemap("rtype") SWIGTYPE & "$R_class"
%typemap("rtype") SWIGTYPE && "$R_class"
%typemap("rtype") SWIGTYPE "$&R_class"
@ -93,7 +94,7 @@
%typemap(scoercein) enum SWIGTYPE *const
%{ $input = enumToInteger($input, "$R_class"); %}
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE &&
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE *const&, SWIGTYPE &, SWIGTYPE &&
%{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref"); %}
/*
@ -172,6 +173,10 @@ string &, std::string &
%{ $result <- if (is.null($result)) $result
else new("$R_class", ref=$result); %}
%typemap(scoerceout) SWIGTYPE *const&
%{ $result <- if (is.null($result)) $result
else new("$*R_class", ref=$result); %}
/* Override the SWIGTYPE * above. */
%typemap(scoerceout) char,