fix varout typemaps for swigtypes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8681 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b4ade94169
commit
2396ded0f4
3 changed files with 25 additions and 5 deletions
6
Examples/test-suite/perl5/global_vars_runme.pl
Normal file
6
Examples/test-suite/perl5/global_vars_runme.pl
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
use global_vars;
|
||||||
|
|
||||||
|
|
||||||
|
$an = new global_vars::A();
|
||||||
|
$global_vars::ap = $an;
|
||||||
|
|
||||||
|
|
@ -82,3 +82,19 @@
|
||||||
/* Include the unified typemap library */
|
/* Include the unified typemap library */
|
||||||
%include <typemaps/swigtypemaps.swg>
|
%include <typemaps/swigtypemaps.swg>
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------
|
||||||
|
* Perl extra typemaps
|
||||||
|
* ------------------------------------------------------------ */
|
||||||
|
|
||||||
|
%typemap(varout,type="$1_descriptor") SWIGTYPE *, SWIGTYPE []
|
||||||
|
"sv_setiv(SvRV($result),(IV) $1);";
|
||||||
|
|
||||||
|
%typemap(varout,type="$1_descriptor") SWIGTYPE &
|
||||||
|
"sv_setiv(SvRV($result),(IV) &$1);";
|
||||||
|
|
||||||
|
%typemap(varout,type="$&1_descriptor") SWIGTYPE
|
||||||
|
"sv_setiv(SvRV($result), (IV) &$1);";
|
||||||
|
|
||||||
|
%typemap(varout,type="$1_descriptor") SWIGTYPE (CLASS::*) {
|
||||||
|
SWIG_MakePackedObj($result, (void *) &$1, sizeof($1_type), $1_descriptor);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -726,7 +726,7 @@ public:
|
||||||
"fail:\n",
|
"fail:\n",
|
||||||
cleanup,
|
cleanup,
|
||||||
"croak(Nullch);\n"
|
"croak(Nullch);\n"
|
||||||
"XSRETURN(0); }\n"
|
"}\n"
|
||||||
"}\n",
|
"}\n",
|
||||||
NIL);
|
NIL);
|
||||||
|
|
||||||
|
|
@ -801,7 +801,6 @@ public:
|
||||||
/* ------------------------------------------------------------
|
/* ------------------------------------------------------------
|
||||||
* variableWrapper()
|
* variableWrapper()
|
||||||
* ------------------------------------------------------------ */
|
* ------------------------------------------------------------ */
|
||||||
|
|
||||||
virtual int variableWrapper(Node *n) {
|
virtual int variableWrapper(Node *n) {
|
||||||
String *name = Getattr(n,"name");
|
String *name = Getattr(n,"name");
|
||||||
String *iname = Getattr(n,"sym:name");
|
String *iname = Getattr(n,"sym:name");
|
||||||
|
|
@ -809,8 +808,8 @@ public:
|
||||||
Wrapper *getf, *setf;
|
Wrapper *getf, *setf;
|
||||||
String *tm;
|
String *tm;
|
||||||
|
|
||||||
String *set_name = Swig_name_set(iname);
|
String *set_name = Swig_name_wrapper(Swig_name_set(iname));
|
||||||
String *val_name = Swig_name_get(iname);
|
String *val_name = Swig_name_wrapper(Swig_name_get(iname));
|
||||||
|
|
||||||
if (!addSymbol(iname,n)) return SWIG_ERROR;
|
if (!addSymbol(iname,n)) return SWIG_ERROR;
|
||||||
|
|
||||||
|
|
@ -853,7 +852,6 @@ public:
|
||||||
|
|
||||||
int addfail = 0;
|
int addfail = 0;
|
||||||
if ((tm = Swig_typemap_lookup_new("varout",n,name,0))) {
|
if ((tm = Swig_typemap_lookup_new("varout",n,name,0))) {
|
||||||
SwigType *t = Getattr(n,"type");
|
|
||||||
Replaceall(tm,"$target","sv");
|
Replaceall(tm,"$target","sv");
|
||||||
Replaceall(tm,"$result","sv");
|
Replaceall(tm,"$result","sv");
|
||||||
Replaceall(tm,"$source",name);
|
Replaceall(tm,"$source",name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue