The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5fcae5eb66
commit
12a43edc2d
1508 changed files with 125983 additions and 44037 deletions
35
Lib/ruby/std_common.i
Normal file
35
Lib/ruby/std_common.i
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// SWIG typemaps for STL - common utilities
|
||||
// Luigi Ballabio
|
||||
// Aug 3, 2002
|
||||
//
|
||||
// Ruby implementation
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
|
||||
#define SWIG_FLOAT_P(x) ((TYPE(x) == T_FLOAT) || FIXNUM_P(x))
|
||||
|
||||
bool SWIG_BOOL_P(VALUE) {
|
||||
// dummy test, RTEST should take care of everything
|
||||
return true;
|
||||
}
|
||||
bool SWIG_RB2BOOL(VALUE x) {
|
||||
return RTEST(x);
|
||||
}
|
||||
VALUE SWIG_BOOL2RB(bool b) {
|
||||
return b ? Qtrue : Qfalse;
|
||||
}
|
||||
double SWIG_NUM2DBL(VALUE x) {
|
||||
return (FIXNUM_P(x) ? FIX2INT(x) : NUM2DBL(x));
|
||||
}
|
||||
bool SWIG_STRING_P(VALUE x) {
|
||||
return TYPE(x) == T_STRING;
|
||||
}
|
||||
std::string SWIG_RB2STR(VALUE x) {
|
||||
return std::string(STR2CSTR(x));
|
||||
}
|
||||
VALUE SWIG_STR2RB(const std::string& s) {
|
||||
return rb_str_new2(s.c_str());
|
||||
}
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue