[前][次][番号順一覧][スレッド一覧]

ruby-changes:30192

From: nobu <ko1@a...>
Date: Mon, 29 Jul 2013 22:55:40 +0900 (JST)
Subject: [ruby-changes:30192] nobu:r42244 (trunk): sizes.c: RbConfig::SIZEOF

nobu	2013-07-29 22:55:29 +0900 (Mon, 29 Jul 2013)

  New Revision: 42244

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42244

  Log:
    sizes.c: RbConfig::SIZEOF
    
    * sizes.c (Init_sizes): define RbConfig::SIZEOF.  [Feature #8568]

  Added files:
    trunk/sizes.c
  Modified files:
    trunk/ChangeLog
    trunk/common.mk
    trunk/inits.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42243)
+++ ChangeLog	(revision 42244)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jul 29 22:55:26 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* sizes.c (Init_sizes): define RbConfig::SIZEOF.  [Feature #8568]
+
 Mon Jul 29 22:25:20 2013  Zachary Scott  <e@z...>
 
 	* ext/curses/curses.c: [DOC] Update location of samples
Index: common.mk
===================================================================
--- common.mk	(revision 42243)
+++ common.mk	(revision 42244)
@@ -95,6 +95,7 @@ COMMONOBJS    = array.$(OBJEXT) \ https://github.com/ruby/ruby/blob/trunk/common.mk#L95
 		vm_trace.$(OBJEXT) \
 		thread.$(OBJEXT) \
 		cont.$(OBJEXT) \
+		sizes.$(OBJEXT) \
 		$(BUILTIN_ENCOBJS) \
 		$(BUILTIN_TRANSOBJS) \
 		$(MISSING)
@@ -818,6 +819,8 @@ golf_prelude.$(OBJEXT): {$(VPATH)}golf_p https://github.com/ruby/ruby/blob/trunk/common.mk#L819
 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 \
Index: inits.c
===================================================================
--- inits.c	(revision 42243)
+++ inits.c	(revision 42244)
@@ -61,5 +61,6 @@ rb_call_inits(void) https://github.com/ruby/ruby/blob/trunk/inits.c#L61
     CALL(Complex);
     CALL(version);
     CALL(vm_trace);
+    CALL(sizes);
 }
 #undef CALL
Index: sizes.c
===================================================================
--- sizes.c	(revision 0)
+++ sizes.c	(revision 42244)
@@ -0,0 +1,52 @@ https://github.com/ruby/ruby/blob/trunk/sizes.c#L1
+#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
+}

Property changes on: sizes.c
___________________________________________________________________
Added: svn:eol-style
   + LF


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]