Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / share / swig / 1.3.26 / ruby / std_common.i
CommitLineData
920dae64
AT
1//
2// SWIG typemaps for STL - common utilities
3// Luigi Ballabio
4// Aug 3, 2002
5//
6// Ruby implementation
7
8%include <std/std_except.i>
9
10%apply size_t { std::size_t };
11
12%{
13#include <string>
14
15#define SWIG_FLOAT_P(x) ((TYPE(x) == T_FLOAT) || FIXNUM_P(x))
16
17bool SWIG_BOOL_P(VALUE) {
18 // dummy test, RTEST should take care of everything
19 return true;
20}
21bool SWIG_RB2BOOL(VALUE x) {
22 return RTEST(x);
23}
24VALUE SWIG_BOOL2RB(bool b) {
25 return b ? Qtrue : Qfalse;
26}
27double SWIG_NUM2DBL(VALUE x) {
28 return (FIXNUM_P(x) ? FIX2INT(x) : NUM2DBL(x));
29}
30bool SWIG_STRING_P(VALUE x) {
31 return TYPE(x) == T_STRING;
32}
33std::string SWIG_RB2STR(VALUE x) {
34 return std::string(StringValuePtr(x));
35}
36VALUE SWIG_STR2RB(const std::string& s) {
37 return rb_str_new2(s.c_str());
38}
39%}