From 098ad126120fb7aa01d89940303bf6acab66974f Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Sat, 30 Oct 2004 11:40:34 +0000 Subject: [PATCH] add directorin/directorout for prim. types + ref git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6566 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Lib/ruby/rubyprimtypes.swg | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/SWIG/Lib/ruby/rubyprimtypes.swg b/SWIG/Lib/ruby/rubyprimtypes.swg index eb82fd226..8c5e9e3bf 100644 --- a/SWIG/Lib/ruby/rubyprimtypes.swg +++ b/SWIG/Lib/ruby/rubyprimtypes.swg @@ -177,24 +177,27 @@ /* directorin typemaps */ -%typemap(directorin) int "$input = INT2NUM($1);"; -%typemap(directorin) short "$input = INT2NUM($1);"; -%typemap(directorin) long "$input = LONG2NUM($1);"; -%typemap(directorin) signed char "$input = INT2NUM($1);"; -%typemap(directorin) float "$input = rb_float_new($1);"; -%typemap(directorin) double "$input = rb_float_new($1);"; -%typemap(directorin) bool "$input = $1 ? Qtrue : Qfalse;"; - -%typemap(directorin) unsigned int "$input = UINT2NUM($1);"; -%typemap(directorin) unsigned short "$input = UINT2NUM($1);"; -%typemap(directorin) unsigned long "$input = ULONG2NUM($1);"; -%typemap(directorin) unsigned char "$input = UINT2NUM($1);"; +%typemap(directorin) int , const int& "$input = INT2NUM($1);"; +%typemap(directorin) short , const short& "$input = INT2NUM($1);"; +%typemap(directorin) long , const long& "$input = LONG2NUM($1);"; +%typemap(directorin) signed char , const signed char& "$input = INT2NUM($1);"; +%typemap(directorin) float , const float& "$input = rb_float_new($1);"; +%typemap(directorin) double , const double& "$input = rb_float_new($1);"; +%typemap(directorin) bool , const bool& "$input = $1 ? Qtrue : Qfalse;"; +%typemap(directorin) unsigned int , const unsigned int& "$input = UINT2NUM($1);"; +%typemap(directorin) unsigned short, const unsigned short& "$input = UINT2NUM($1);"; +%typemap(directorin) unsigned long , const unsigned long& "$input = ULONG2NUM($1);"; +%typemap(directorin) unsigned char , const unsigned char& "$input = UINT2NUM($1);"; /* --- directorout typemaps --- */ %define DIRECTOROUT_TYPEMAP(type, converter) %typemap(directorargout) type *DIRECTOROUT "*$result = (type) converter($input);"; %typemap(directorout) type "$result = (type) converter($input);"; +%typemap(directorout) const type& { + $basetype temp = converter($input); + $result = &temp; +} %typemap(directorout) type &DIRECTOROUT = type %enddef