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

ruby-changes:30606

From: nobu <ko1@a...>
Date: Mon, 26 Aug 2013 12:37:24 +0900 (JST)
Subject: [ruby-changes:30606] nobu:r42685 (trunk): sizes.c.tmpl: autogenerate

nobu	2013-08-26 12:37:15 +0900 (Mon, 26 Aug 2013)

  New Revision: 42685

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

  Log:
    sizes.c.tmpl: autogenerate
    
    * template/sizes.c.tmpl: generate automatically by extracting
      RUBY_CHECK_SIZEOF from configure.in.

  Added files:
    trunk/template/sizes.c.tmpl
  Removed files:
    trunk/sizes.c
  Modified directories:
    trunk/
  Modified files:
    trunk/.gitignore
    trunk/ChangeLog
    trunk/common.mk
    trunk/miniinit.c
Index: sizes.c
===================================================================
--- sizes.c	(revision 42684)
+++ sizes.c	(revision 42685)
@@ -1,55 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/sizes.c#L0
-#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));
-
-#if SIZEOF_INT != 0
-    DEFINE(int, INT);
-#endif
-#if SIZEOF_SHORT != 0
-    DEFINE(short, SHORT);
-#endif
-#if SIZEOF_LONG != 0
-    DEFINE(long, LONG);
-#endif
-#if SIZEOF_LONG_LONG != 0 && defined(HAVE_TRUE_LONG_LONG)
-    DEFINE(long long, LONG_LONG);
-#endif
-#if SIZEOF___INT64 != 0
-    DEFINE(__int64, __INT64);
-#endif
-#if SIZEOF___INT128 != 0
-    DEFINE(__int128, __INT128);
-#endif
-#if SIZEOF_OFF_T != 0
-    DEFINE(off_t, OFF_T);
-#endif
-#if SIZEOF_VOIDP != 0
-    DEFINE(void*, VOIDP);
-#endif
-#if SIZEOF_FLOAT != 0
-    DEFINE(float, FLOAT);
-#endif
-#if SIZEOF_DOUBLE != 0
-    DEFINE(double, DOUBLE);
-#endif
-#if SIZEOF_TIME_T != 0
-    DEFINE(time_t, TIME_T);
-#endif
-#if SIZEOF_CLOCK_T != 0
-    DEFINE(clock_t, CLOCK_T);
-#endif
-#if SIZEOF_SIZE_T != 0
-    DEFINE(size_t, SIZE_T);
-#endif
-#if SIZEOF_PTRDIFF_T != 0
-    DEFINE(ptrdiff_t, PTRDIFF_T);
-#endif
-
-#undef DEFINE
-}
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42684)
+++ ChangeLog	(revision 42685)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Aug 26 12:37:10 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* template/sizes.c.tmpl: generate automatically by extracting
+	  RUBY_CHECK_SIZEOF from configure.in.
+
 Mon Aug 26 10:16:59 2013  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* process.c (gcd_timetick_int): Renamed from gcd_timtick_int.
Index: miniinit.c
===================================================================
--- miniinit.c	(revision 42684)
+++ miniinit.c	(revision 42685)
@@ -28,3 +28,9 @@ Init_enc_set_filesystem_encoding(void) https://github.com/ruby/ruby/blob/trunk/miniinit.c#L28
 {
     return rb_enc_to_index(rb_default_external_encoding());
 }
+
+/* sizes.c */
+void
+Init_sizes(void)
+{
+}
Index: common.mk
===================================================================
--- common.mk	(revision 42684)
+++ common.mk	(revision 42685)
@@ -95,7 +95,6 @@ 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)
@@ -103,6 +102,7 @@ COMMONOBJS    = array.$(OBJEXT) \ https://github.com/ruby/ruby/blob/trunk/common.mk#L102
 EXPORTOBJS    = $(DLNOBJ) \
 		localeinit.$(OBJEXT) \
 		loadpath.$(OBJEXT) \
+		sizes.$(OBJEXT) \
 		$(COMMONOBJS)
 
 OBJS          = $(EXPORTOBJS) prelude.$(OBJEXT)
@@ -883,7 +883,7 @@ INSNS2VMOPT = --srcdir="$(srcdir)" https://github.com/ruby/ruby/blob/trunk/common.mk#L883
 
 {$(VPATH)}vm.inc: $(srcdir)/template/vm.inc.tmpl
 
-srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c {$(VPATH)}newline.c {$(VPATH)}id.c srcs-ext srcs-enc
+srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c {$(VPATH)}newline.c {$(VPATH)}id.c {$(VPATH)}sizes.c srcs-ext srcs-enc
 
 EXT_SRCS = $(srcdir)/ext/ripper/ripper.c $(srcdir)/ext/json/parser/parser.c \
 	   $(srcdir)/ext/dl/callback/callback.c
@@ -910,6 +910,11 @@ id.c: $(srcdir)/tool/generic_erb.rb $(sr https://github.com/ruby/ruby/blob/trunk/common.mk#L910
 	$(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb --output=$@ \
 		$(srcdir)/template/id.c.tmpl
 
+sizes.c: $(srcdir)/tool/generic_erb.rb $(srcdir)/template/sizes.c.tmpl $(srcdir)/configure.in
+	$(ECHO) generating $@
+	$(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb --output=$@ \
+		$(srcdir)/template/sizes.c.tmpl $(srcdir)/configure.in
+
 node_name.inc: {$(VPATH)}node.h
 	$(ECHO) generating $@
 	$(Q) $(BASERUBY) -n $(srcdir)/tool/node_name.rb < $? > $@
Index: .gitignore
===================================================================
--- .gitignore	(revision 42684)
+++ .gitignore	(revision 42685)
@@ -82,6 +82,7 @@ y.tab.c https://github.com/ruby/ruby/blob/trunk/.gitignore#L82
 /rubicon
 /ruby
 /ruby-man.rd.gz
+/sizes.c
 /test.rb
 /tmp
 /transdb.h
Index: template/sizes.c.tmpl
===================================================================
--- template/sizes.c.tmpl	(revision 0)
+++ template/sizes.c.tmpl	(revision 42685)
@@ -0,0 +1,30 @@ https://github.com/ruby/ruby/blob/trunk/template/sizes.c.tmpl#L1
+%#  -*- c -*-
+#include "ruby/ruby.h"
+<%
+class String
+  def tr_cpp
+    strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P")
+  end
+end
+types = ARGF.grep(/^\s*RUBY_CHECK_SIZEOF\((\w[^\[\],#]*)[^#]*\)/) {$1}
+conditions = {
+  "long long" => 'defined(HAVE_TRUE_LONG_LONG)',
+}
+%>
+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));
+
+% types.each do |type|
+%   cond = conditions[type]
+#if SIZEOF_<%= type.tr_cpp %> != 0<%= " && #{cond}" if cond %>
+    DEFINE(<%= type %>, <%= type.tr_cpp %>);
+#endif
+% end
+
+#undef DEFINE
+}

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


Property changes on: .
___________________________________________________________________
Modified: svn:ignore
   - *.bak
*.dylib
*.inc
*.orig
*.pc
*.rej
*.sav
*.swp
*_prelude.c
*~
.*-*
.*.list
.*.time
.DS_Store
.ccmalloc
.ext
.git
.pc
.ppack
.svn
.time.id.h
COPYING.LIB
ChangeLog-1.8.0
ChangeLog.pre-alpha
ChangeLog.pre1_1
Doxyfile
GNUmakefile
Makefile
README.atheos
README.fat-patch
README.v6
TAGS
archive
autom4te*.cache
automake
beos
bmlog-*
breakpoints.gdb
change.log
config.cache
config.h
config.h.in
config.log
config.status
config.status.lineno
configure
enc.mk
enc/trans/*.c
encdb.h
ext/win32ole/.document
exts.mk
goruby
id.[ch]
largefile.h
lex.c
libruby*.*
miniprelude.c
miniruby
newdate.rb
newline.c
newver.rb
parse.c
parse.h
patches
patches-master
pitest.rb
ppack
prelude.c
preview
probes.dmyh
probes.h
rbconfig.rb
rename2.h
repack
revision.h
riscos
rubicon
ruby
ruby-man.rd.gz
test.rb
tmp
transdb.h
uncommon.mk
verconf.h
web
y.output
y.tab.c
yasmdata.rb

   + *.bak
*.dylib
*.inc
*.orig
*.pc
*.rej
*.sav
*.swp
*_prelude.c
*~
.*-*
.*.list
.*.time
.DS_Store
.ccmalloc
.ext
.git
.pc
.ppack
.svn
.time.id.h
COPYING.LIB
ChangeLog-1.8.0
ChangeLog.pre-alpha
ChangeLog.pre1_1
Doxyfile
GNUmakefile
Makefile
README.atheos
README.fat-patch
README.v6
TAGS
archive
autom4te*.cache
automake
beos
bmlog-*
breakpoints.gdb
change.log
config.cache
config.h
config.h.in
config.log
config.status
config.status.lineno
configure
enc.mk
enc/trans/*.c
encdb.h
ext/win32ole/.document
exts.mk
goruby
id.[ch]
largefile.h
lex.c
libruby*.*
miniprelude.c
miniruby
newdate.rb
newline.c
newver.rb
parse.c
parse.h
patches
patches-master
pitest.rb
ppack
prelude.c
preview
probes.dmyh
probes.h
rbconfig.rb
rename2.h
repack
revision.h
riscos
rubicon
ruby
ruby-man.rd.gz
sizes.c
test.rb
tmp
transdb.h
uncommon.mk
verconf.h
web
y.output
y.tab.c
yasmdata.rb



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

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