typelib_ruby.cc
Go to the documentation of this file.
00001 #include "typelib.hh"
00002 
00003 #include <typelib/typevisitor.hh>
00004 #include <typelib/pluginmanager.hh>
00005 #include <typelib/importer.hh>
00006 #include <typelib/utilmm/configset.hh>
00007 
00008 using namespace Typelib;
00009 using utilmm::config_set;
00010 using std::string;
00011 
00012 using namespace typelib_ruby;
00013 static VALUE mTypelib   = Qnil;
00014 
00015 /**********************************************************************
00016  *
00017  * Extension of the standard libraries
00018  *
00019  */
00020 
00021 static VALUE kernel_is_immediate(VALUE klass, VALUE object)
00022 { return IMMEDIATE_P(object) ? Qtrue : Qfalse; }
00023 /* call-seq:
00024  *  numeric?    => true or false
00025  *
00026  * Returns true if the receiver is either a Fixnum or a Float
00027  */
00028 static VALUE kernel_is_numeric(VALUE klass, VALUE object)
00029 { 
00030     return (FIXNUM_P(object) || TYPE(object) == T_FLOAT || TYPE(object) == T_BIGNUM) ? Qtrue : Qfalse;
00031 }
00032 
00033 
00034 
00035 static VALUE typelib_is_big_endian(VALUE mod)
00036 {
00037 #if defined(BOOST_BIG_ENDIAN)
00038     return Qtrue;
00039 #elif defined(BOOST_LITTLE_ENDIAN)
00040     return Qfalse;
00041 #endif
00042 }
00043 
00044 extern "C" void Init_typelib_ruby()
00045 {
00046     mTypelib  = rb_define_module("Typelib");
00047     Typelib_init_values();
00048     Typelib_init_strings();
00049     Typelib_init_registry();
00050     Typelib_init_memory();
00051     Typelib_init_metadata();
00052     
00053     rb_define_singleton_method(mTypelib, "big_endian?", RUBY_METHOD_FUNC(typelib_is_big_endian), 0);
00054 
00055     rb_define_singleton_method(rb_mKernel, "immediate?", RUBY_METHOD_FUNC(kernel_is_immediate), 1);
00056     rb_define_singleton_method(rb_mKernel, "numeric?", RUBY_METHOD_FUNC(kernel_is_numeric), 1);
00057 }
00058 


typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Sat Jun 8 2019 18:49:22