summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-18 13:41:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-18 13:41:54 +0000
commit52f5f410e4ce1614793328d38d55f84f66371e6e (patch)
tree3b010757fccaa8b5f9a40754b9d586c953f1d506
parent2082417a48d56295796e2bbfc2001ecf5008a88a (diff)
* internal.h: add for internal use only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--class.c1
-rw-r--r--common.mk18
-rw-r--r--ext/digest/digest.c4
-rw-r--r--ext/objspace/depend3
-rw-r--r--ext/objspace/objspace.c1
-rw-r--r--gc.c1
-rw-r--r--include/ruby/intern.h1
-rw-r--r--include/ruby/ruby.h6
-rw-r--r--internal.h35
-rw-r--r--marshal.c1
-rw-r--r--object.c3
-rw-r--r--proc.c1
-rw-r--r--struct.c1
-rw-r--r--variable.c1
-rw-r--r--vm_insnhelper.c1
16 files changed, 66 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 2dc90ea..6f7ebdd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed May 18 22:41:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h: add for internal use only.
+
Wed May 18 22:36:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (setup_exception): internal exception should be hidden
diff --git a/class.c b/class.c
index 39e5e14..8479bac 100644
--- a/class.c
+++ b/class.c
@@ -28,6 +28,7 @@
#include "method.h"
#include "constant.h"
#include "vm_core.h"
+#include "internal.h"
#include <ctype.h>
extern st_table *rb_class_tbl;
diff --git a/common.mk b/common.mk
index bc37a4c..6dab4b3 100644
--- a/common.mk
+++ b/common.mk
@@ -585,7 +585,7 @@ VM_CORE_H_INCLUDES = {$(VPATH)}vm_core.h {$(VPATH)}thread_$(THREAD_MODEL).h \
array.$(OBJEXT): {$(VPATH)}array.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h
bignum.$(OBJEXT): {$(VPATH)}bignum.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h
class.$(OBJEXT): {$(VPATH)}class.c $(RUBY_H_INCLUDES) \
- $(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h {$(VPATH)}internal.h
compar.$(OBJEXT): {$(VPATH)}compar.c $(RUBY_H_INCLUDES)
complex.$(OBJEXT): {$(VPATH)}complex.c $(RUBY_H_INCLUDES)
dir.$(OBJEXT): {$(VPATH)}dir.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
@@ -616,7 +616,7 @@ file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
{$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
- {$(VPATH)}debug.h
+ {$(VPATH)}debug.h {$(VPATH)}internal.h
hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h
inits.$(OBJEXT): {$(VPATH)}inits.c $(RUBY_H_INCLUDES)
io.$(OBJEXT): {$(VPATH)}io.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
@@ -624,13 +624,14 @@ io.$(OBJEXT): {$(VPATH)}io.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
main.$(OBJEXT): {$(VPATH)}main.c $(RUBY_H_INCLUDES) {$(VPATH)}debug.h \
{$(VPATH)}node.h
marshal.$(OBJEXT): {$(VPATH)}marshal.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
- $(ENCODING_H_INCLUDES) {$(VPATH)}util.h
+ $(ENCODING_H_INCLUDES) {$(VPATH)}util.h {$(VPATH)}internal.h
math.$(OBJEXT): {$(VPATH)}math.c $(RUBY_H_INCLUDES)
node.$(OBJEXT): {$(VPATH)}node.c $(RUBY_H_INCLUDES) \
$(VM_CORE_H_INCLUDES)
numeric.$(OBJEXT): {$(VPATH)}numeric.c $(RUBY_H_INCLUDES) \
{$(VPATH)}util.h $(ENCODING_H_INCLUDES)
-object.$(OBJEXT): {$(VPATH)}object.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h
+object.$(OBJEXT): {$(VPATH)}object.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ {$(VPATH)}internal.h
pack.$(OBJEXT): {$(VPATH)}pack.c $(RUBY_H_INCLUDES) {$(VPATH)}encoding.h \
{$(VPATH)}oniguruma.h
parse.$(OBJEXT): {$(VPATH)}parse.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h \
@@ -640,7 +641,7 @@ parse.$(OBJEXT): {$(VPATH)}parse.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h \
{$(VPATH)}parse.h
proc.$(OBJEXT): {$(VPATH)}proc.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \
- {$(VPATH)}debug.h
+ {$(VPATH)}debug.h {$(VPATH)}internal.h
process.$(OBJEXT): {$(VPATH)}process.c $(RUBY_H_INCLUDES) \
{$(VPATH)}util.h {$(VPATH)}io.h $(ENCODING_H_INCLUDES) {$(VPATH)}dln.h \
$(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h
@@ -681,7 +682,7 @@ strftime.$(OBJEXT): {$(VPATH)}strftime.c {$(VPATH)}ruby.h \
{$(VPATH)}intern.h {$(VPATH)}st.h {$(VPATH)}timev.h
string.$(OBJEXT): {$(VPATH)}string.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES)
-struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES)
+struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h
thread.$(OBJEXT): {$(VPATH)}thread.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \
{$(VPATH)}debug.h {$(VPATH)}thread_$(THREAD_MODEL).c
@@ -695,7 +696,7 @@ time.$(OBJEXT): {$(VPATH)}time.c $(RUBY_H_INCLUDES) \
util.$(OBJEXT): {$(VPATH)}util.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h
variable.$(OBJEXT): {$(VPATH)}variable.c $(RUBY_H_INCLUDES) \
{$(VPATH)}node.h {$(VPATH)}util.h {$(VPATH)}encoding.h \
- {$(VPATH)}oniguruma.h
+ {$(VPATH)}oniguruma.h {$(VPATH)}internal.h
version.$(OBJEXT): {$(VPATH)}version.c $(RUBY_H_INCLUDES) \
{$(VPATH)}version.h $(srcdir)/version.h $(srcdir)/revision.h {$(VPATH)}config.h
dmyversion.$(OBJEXT): {$(VPATH)}dmyversion.c version.$(OBJEXT)
@@ -712,7 +713,8 @@ vm.$(OBJEXT): {$(VPATH)}vm.c {$(VPATH)}gc.h {$(VPATH)}iseq.h \
$(VM_CORE_H_INCLUDES) {$(VPATH)}vm_method.c {$(VPATH)}vm_eval.c \
{$(VPATH)}vm_insnhelper.c {$(VPATH)}vm_insnhelper.h {$(VPATH)}vm_exec.c \
{$(VPATH)}vm_exec.h {$(VPATH)}insns.def {$(VPATH)}vmtc.inc \
- {$(VPATH)}vm.inc {$(VPATH)}insns.inc {$(VPATH)}debug.h
+ {$(VPATH)}vm.inc {$(VPATH)}insns.inc {$(VPATH)}debug.h \
+ {$(VPATH)}internal.h
vm_dump.$(OBJEXT): {$(VPATH)}vm_dump.c $(RUBY_H_INCLUDES) \
$(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h
debug.$(OBJEXT): {$(VPATH)}debug.c $(RUBY_H_INCLUDES) \
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index 6f9149c..d535b35 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -436,14 +436,14 @@ get_digest_base_metadata(VALUE klass)
VALUE obj;
rb_digest_metadata_t *algo;
- for (p = klass; p; p = RCLASS_SUPER(p)) {
+ for (p = klass; !NIL_P(p); p = rb_class_superclass(p)) {
if (rb_ivar_defined(p, id_metadata)) {
obj = rb_ivar_get(p, id_metadata);
break;
}
}
- if (!p)
+ if (NIL_P(p))
rb_raise(rb_eRuntimeError, "Digest::Base cannot be directly inherited in Ruby");
Data_Get_Struct(obj, rb_digest_metadata_t, algo);
diff --git a/ext/objspace/depend b/ext/objspace/depend
new file mode 100644
index 0000000..83a08f7
--- /dev/null
+++ b/ext/objspace/depend
@@ -0,0 +1,3 @@
+objspace.o: $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/re.h $(top_srcdir)/node.h $(top_srcdir)/gc.h \
+ $(top_srcdir)/regint.h $(top_srcdir)/internal.h
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index e61eda8..8e8b29f 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -30,6 +30,7 @@
#include "node.h"
#include "gc.h"
#include "regint.h"
+#include "internal.h"
size_t rb_str_memsize(VALUE);
size_t rb_ary_memsize(VALUE);
diff --git a/gc.c b/gc.c
index e703471..8886da0 100644
--- a/gc.c
+++ b/gc.c
@@ -18,6 +18,7 @@
#include "ruby/util.h"
#include "eval_intern.h"
#include "vm_core.h"
+#include "internal.h"
#include "gc.h"
#include "constant.h"
#include <stdio.h>
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 71fc3fc..bc3c449 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -518,6 +518,7 @@ VALUE rb_obj_id(VALUE);
VALUE rb_obj_class(VALUE);
VALUE rb_class_real(VALUE);
VALUE rb_class_inherited_p(VALUE, VALUE);
+VALUE rb_class_superclass(VALUE);
VALUE rb_convert_type(VALUE,int,const char*,const char*);
VALUE rb_check_convert_type(VALUE,int,const char*,const char*);
VALUE rb_check_to_integer(VALUE, const char *);
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index c8790df..38bfe3f 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -609,11 +609,7 @@ struct RObject {
ROBJECT(o)->as.heap.iv_index_tbl)
/** @internal */
-typedef struct {
- VALUE super;
- struct st_table *iv_tbl;
- struct st_table *const_tbl;
-} rb_classext_t;
+typedef struct rb_classext_struct rb_classext_t;
struct RClass {
struct RBasic basic;
diff --git a/internal.h b/internal.h
new file mode 100644
index 0000000..ca4220a
--- /dev/null
+++ b/internal.h
@@ -0,0 +1,35 @@
+/**********************************************************************
+
+ internal.h -
+
+ $Author$
+ created at: Tue May 17 11:42:20 JST 2011
+
+ Copyright (C) 2011 Yukihiro Matsumoto
+
+**********************************************************************/
+
+#ifndef RUBY_INTERNAL_H
+#define RUBY_INTERNAL_H 1
+
+#if defined(__cplusplus)
+extern "C" {
+#if 0
+} /* satisfy cc-mode */
+#endif
+#endif
+
+struct rb_classext_struct {
+ VALUE super;
+ struct st_table *iv_tbl;
+ struct st_table *const_tbl;
+};
+
+#if defined(__cplusplus)
+#if 0
+{ /* satisfy cc-mode */
+#endif
+} /* extern "C" { */
+#endif
+
+#endif /* RUBY_INTERNAL_H */
diff --git a/marshal.c b/marshal.c
index 0353739..1412880 100644
--- a/marshal.c
+++ b/marshal.c
@@ -14,6 +14,7 @@
#include "ruby/st.h"
#include "ruby/util.h"
#include "ruby/encoding.h"
+#include "internal.h"
#include <math.h>
#ifdef HAVE_FLOAT_H
diff --git a/object.c b/object.c
index 5e19eb3..861f17c 100644
--- a/object.c
+++ b/object.c
@@ -20,6 +20,7 @@
#include <math.h>
#include <float.h>
#include "constant.h"
+#include "internal.h"
VALUE rb_cBasicObject;
VALUE rb_mKernel;
@@ -1601,7 +1602,7 @@ rb_class_new_instance(int argc, VALUE *argv, VALUE klass)
*
*/
-static VALUE
+VALUE
rb_class_superclass(VALUE klass)
{
VALUE super = RCLASS_SUPER(klass);
diff --git a/proc.c b/proc.c
index f81118a..ad171c9 100644
--- a/proc.c
+++ b/proc.c
@@ -10,6 +10,7 @@
**********************************************************************/
#include "eval_intern.h"
+#include "internal.h"
#include "gc.h"
struct METHOD {
diff --git a/struct.c b/struct.c
index 5572a92..136ba0a 100644
--- a/struct.c
+++ b/struct.c
@@ -10,6 +10,7 @@
**********************************************************************/
#include "ruby/ruby.h"
+#include "internal.h"
VALUE rb_cStruct;
static ID id_members;
diff --git a/variable.c b/variable.c
index 3c9fe71..426d58f 100644
--- a/variable.c
+++ b/variable.c
@@ -17,6 +17,7 @@
#include "ruby/encoding.h"
#include "node.h"
#include "constant.h"
+#include "internal.h"
void rb_vm_change_state(void);
void rb_vm_inc_const_missing_count(void);
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 3398b95..f40dfdf 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -12,6 +12,7 @@
#include "insns.inc"
#include <math.h>
#include "constant.h"
+#include "internal.h"
/* control stack frame */