From 6370fab025605ccf09e2d14e220a2cb02476427d Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 24 Oct 2022 16:21:29 +0100 Subject: [PATCH] R - fix $typemap() for R specific typemaps Add support for special variable replacement in the $typemap() special variable macro for R specific typemaps (rtype, rtypecheck, scoercein, scoereout). --- CHANGES.current | 5 +++++ Source/Modules/r.cxx | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGES.current b/CHANGES.current index e5971db72..2ad66dd59 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,11 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.1.0 (in progress) =========================== +2022-10-24: wsfulton + [R] Add support for special variable replacement in the $typemap() + special variable macro for R specific typemaps (rtype, rtypecheck, + scoercein, scoereout). + 2022-10-24: wsfulton [R] Polymorphism in the wrappers was only working for C++ classes, now this works for C++ structs too. diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index 2256610d5..c51198fed 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -242,8 +242,8 @@ public: return status; } - // Not used: String *runtimeCode(); + void replaceSpecialVariables(String *method, String *tm, Parm *parm); protected: int addRegistrationRoutine(String *rname, int nargs); @@ -2666,6 +2666,16 @@ String * R::runtimeCode() { return s; } +/*---------------------------------------------------------------------- + * replaceSpecialVariables() + *--------------------------------------------------------------------*/ + +void R::replaceSpecialVariables(String *method, String *tm, Parm *parm) { + (void)method; + SwigType *type = Getattr(parm, "type"); + replaceRClass(tm, type); +} + /* ----------------------------------------------------------------------- * Called when SWIG wants to initialize this