fix varout typemaps for swigtypes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8681 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a06eb9c981
commit
8f8673bd2c
3 changed files with 25 additions and 5 deletions
6
SWIG/Examples/test-suite/perl5/global_vars_runme.pl
Normal file
6
SWIG/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 <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",
|
||||
cleanup,
|
||||
"croak(Nullch);\n"
|
||||
"XSRETURN(0); }\n"
|
||||
"}\n"
|
||||
"}\n",
|
||||
NIL);
|
||||
|
||||
|
|
@ -801,7 +801,6 @@ public:
|
|||
/* ------------------------------------------------------------
|
||||
* variableWrapper()
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
virtual int variableWrapper(Node *n) {
|
||||
String *name = Getattr(n,"name");
|
||||
String *iname = Getattr(n,"sym:name");
|
||||
|
|
@ -809,8 +808,8 @@ public:
|
|||
Wrapper *getf, *setf;
|
||||
String *tm;
|
||||
|
||||
String *set_name = Swig_name_set(iname);
|
||||
String *val_name = Swig_name_get(iname);
|
||||
String *set_name = Swig_name_wrapper(Swig_name_set(iname));
|
||||
String *val_name = Swig_name_wrapper(Swig_name_get(iname));
|
||||
|
||||
if (!addSymbol(iname,n)) return SWIG_ERROR;
|
||||
|
||||
|
|
@ -853,7 +852,6 @@ public:
|
|||
|
||||
int addfail = 0;
|
||||
if ((tm = Swig_typemap_lookup_new("varout",n,name,0))) {
|
||||
SwigType *t = Getattr(n,"type");
|
||||
Replaceall(tm,"$target","sv");
|
||||
Replaceall(tm,"$result","sv");
|
||||
Replaceall(tm,"$source",name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue