ext/rbconfig/sizeof/sizes.c

Go to the documentation of this file.
00001 #include "ruby/ruby.h"
00002 
00003 void
00004 Init_sizeof(void)
00005 {
00006     VALUE s = rb_hash_new();
00007     rb_define_const(rb_define_module("RbConfig"), "SIZEOF", s);
00008 
00009 #define DEFINE(type, size) rb_hash_aset(s, rb_str_new_cstr(#type), INT2FIX(SIZEOF_##size));
00010 
00011 #if SIZEOF_INT != 0
00012     DEFINE(int, INT);
00013 #endif
00014 #if SIZEOF_SHORT != 0
00015     DEFINE(short, SHORT);
00016 #endif
00017 #if SIZEOF_LONG != 0
00018     DEFINE(long, LONG);
00019 #endif
00020 #if SIZEOF_LONG_LONG != 0 && defined(HAVE_TRUE_LONG_LONG)
00021     DEFINE(long long, LONG_LONG);
00022 #endif
00023 #if SIZEOF___INT64 != 0
00024     DEFINE(__int64, __INT64);
00025 #endif
00026 #if SIZEOF___INT128 != 0
00027     DEFINE(__int128, __INT128);
00028 #endif
00029 #if SIZEOF_OFF_T != 0
00030     DEFINE(off_t, OFF_T);
00031 #endif
00032 #if SIZEOF_VOIDP != 0
00033     DEFINE(void*, VOIDP);
00034 #endif
00035 #if SIZEOF_FLOAT != 0
00036     DEFINE(float, FLOAT);
00037 #endif
00038 #if SIZEOF_DOUBLE != 0
00039     DEFINE(double, DOUBLE);
00040 #endif
00041 #if SIZEOF_TIME_T != 0
00042     DEFINE(time_t, TIME_T);
00043 #endif
00044 #if SIZEOF_CLOCK_T != 0
00045     DEFINE(clock_t, CLOCK_T);
00046 #endif
00047 #if SIZEOF_SIZE_T != 0
00048     DEFINE(size_t, SIZE_T);
00049 #endif
00050 #if SIZEOF_PTRDIFF_T != 0
00051     DEFINE(ptrdiff_t, PTRDIFF_T);
00052 #endif
00053 
00054 #undef DEFINE
00055 }
00056 

Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7