Feature #8568 ยป sizeof.diff
| i/common.mk | ||
|---|---|---|
|
vm_trace.$(OBJEXT) \
|
||
|
thread.$(OBJEXT) \
|
||
|
cont.$(OBJEXT) \
|
||
|
sizes.$(OBJEXT) \
|
||
|
$(BUILTIN_ENCOBJS) \
|
||
|
$(BUILTIN_TRANSOBJS) \
|
||
|
$(MISSING)
|
||
| ... | ... | |
|
goruby.$(OBJEXT): {$(VPATH)}goruby.c {$(VPATH)}main.c $(RUBY_H_INCLUDES) \
|
||
|
{$(VPATH)}vm_debug.h {$(VPATH)}node.h $(hdrdir)/ruby.h
|
||
|
sizes.$(OBJEXT): {$(VPATH)}sizes.c $(RUBY_H_INCLUDES)
|
||
|
ascii.$(OBJEXT): {$(VPATH)}ascii.c {$(VPATH)}regenc.h {$(VPATH)}config.h \
|
||
|
{$(VPATH)}oniguruma.h {$(VPATH)}missing.h $(RUBY_H_INCLUDES)
|
||
|
us_ascii.$(OBJEXT): {$(VPATH)}us_ascii.c {$(VPATH)}regenc.h \
|
||
| i/inits.c | ||
|---|---|---|
|
CALL(Complex);
|
||
|
CALL(version);
|
||
|
CALL(vm_trace);
|
||
|
CALL(sizes);
|
||
|
}
|
||
|
#undef CALL
|
||
| i/sizes.c | ||
|---|---|---|
|
#include "ruby/ruby.h"
|
||
|
void
|
||
|
Init_sizes(void)
|
||
|
{
|
||
|
VALUE s = rb_hash_new();
|
||
|
rb_define_const(rb_define_module("RbConfig"), "SIZEOF", s);
|
||
|
#define DEFINE(type, size) rb_hash_aset(s, rb_str_new_cstr(#type), INT2FIX(SIZEOF_##size));
|
||
|
#ifdef SIZEOF_INT
|
||
|
DEFINE(int, INT);
|
||
|
#endif
|
||
|
#ifdef SIZEOF_SHORT
|
||
|
DEFINE(short, SHORT);
|
||
|
#endif
|
||
|
#ifdef SIZEOF_LONG
|
||
|
DEFINE(long, LONG);
|
||
|
#endif
|
||
|
#ifdef SIZEOF_LONG_LONG
|
||
|
DEFINE(long long, LONG_LONG);
|
||
|
#endif
|
||
|
#ifdef SIZEOF___INT64
|
||
|
DEFINE(__int64, __INT64);
|
||
|
#endif
|
||
|
#ifdef SIZEOF___INT128
|
||
|
DEFINE(__int128, __INT128);
|
||
|
#endif
|
||
|
#ifdef SIZEOF_OFF_T
|
||
|
DEFINE(off_t, OFF_T);
|
||
|
#endif
|
||
|
#ifdef SIZEOF_VOIDP
|
||
|
DEFINE(void*, VOIDP);
|
||
|
#endif
|
||
|
#ifdef SIZEOF_FLOAT
|
||
|
DEFINE(float, FLOAT);
|
||
|
#endif
|
||
|
#ifdef SIZEOF_DOUBLE
|
||
|
DEFINE(double, DOUBLE);
|
||
|
#endif
|
||
|
#ifdef SIZEOF_TIME_T
|
||
|
DEFINE(time_t, TIME_T);
|
||
|
#endif
|
||
|
#ifdef SIZEOF_SIZE_T
|
||
|
DEFINE(size_t, SIZE_T);
|
||
|
#endif
|
||
|
#ifdef SIZEOF_PTRDIFF_T
|
||
|
DEFINE(ptrdiff_t, PTRDIFF_T);
|
||
|
#endif
|
||
|
#undef DEFINE
|
||
|
}
|
||