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

ruby-changes:39770

From: nobu <ko1@a...>
Date: Sun, 13 Sep 2015 11:03:44 +0900 (JST)
Subject: [ruby-changes:39770] nobu:r51851 (trunk): ruby.h: add prefix

nobu	2015-09-13 11:03:31 +0900 (Sun, 13 Sep 2015)

  New Revision: 51851

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

  Log:
    ruby.h: add prefix
    
    * include/ruby/ruby.h: prefix RUBY or RB to global symbols to get
      rid of name conflicts with other headers.
    * include/ruby/encoding.h, include/ruby/intern.h: ditto.

  Modified files:
    trunk/ChangeLog
    trunk/debug.c
    trunk/include/ruby/encoding.h
    trunk/include/ruby/intern.h
    trunk/include/ruby/ruby.h
Index: debug.c
===================================================================
--- debug.c	(revision 51850)
+++ debug.c	(revision 51851)
@@ -25,42 +25,11 @@ const union { https://github.com/ruby/ruby/blob/trunk/debug.c#L25
     enum node_type              node_type;
     enum ruby_method_ids        method_ids;
     enum ruby_id_types          id_types;
+    enum ruby_fl_type           fl_types;
+    enum ruby_encoding_consts   encoding_consts;
+    enum ruby_coderange_type    enc_coderange_types;
+    enum ruby_econv_flag_type   econv_flag_types;
     enum {
-        RUBY_ENCODING_INLINE_MAX = ENCODING_INLINE_MAX,
-        RUBY_ENCODING_SHIFT = ENCODING_SHIFT,
-        RUBY_ENC_CODERANGE_MASK    = ENC_CODERANGE_MASK,
-        RUBY_ENC_CODERANGE_UNKNOWN = ENC_CODERANGE_UNKNOWN,
-        RUBY_ENC_CODERANGE_7BIT    = ENC_CODERANGE_7BIT,
-        RUBY_ENC_CODERANGE_VALID   = ENC_CODERANGE_VALID,
-        RUBY_ENC_CODERANGE_BROKEN  = ENC_CODERANGE_BROKEN,
-        RUBY_FL_PROMOTED0   = FL_PROMOTED0,
-        RUBY_FL_PROMOTED1   = FL_PROMOTED1,
-        RUBY_FL_PROMOTED    = FL_PROMOTED0|FL_PROMOTED1,
-        RUBY_FL_FINALIZE    = FL_FINALIZE,
-        RUBY_FL_TAINT       = FL_TAINT,
-        RUBY_FL_EXIVAR      = FL_EXIVAR,
-        RUBY_FL_FREEZE      = FL_FREEZE,
-        RUBY_FL_SINGLETON   = FL_SINGLETON,
-        RUBY_FL_USER0       = FL_USER0,
-        RUBY_FL_USER1       = FL_USER1,
-        RUBY_FL_USER2       = FL_USER2,
-        RUBY_FL_USER3       = FL_USER3,
-        RUBY_FL_USER4       = FL_USER4,
-        RUBY_FL_USER5       = FL_USER5,
-        RUBY_FL_USER6       = FL_USER6,
-        RUBY_FL_USER7       = FL_USER7,
-        RUBY_FL_USER8       = FL_USER8,
-        RUBY_FL_USER9       = FL_USER9,
-        RUBY_FL_USER10      = FL_USER10,
-        RUBY_FL_USER11      = FL_USER11,
-        RUBY_FL_USER12      = FL_USER12,
-        RUBY_FL_USER13      = FL_USER13,
-        RUBY_FL_USER14      = FL_USER14,
-        RUBY_FL_USER15      = FL_USER15,
-        RUBY_FL_USER16      = FL_USER16,
-        RUBY_FL_USER17      = FL_USER17,
-        RUBY_FL_USER18      = FL_USER18,
-        RUBY_FL_USHIFT      = FL_USHIFT,
         RUBY_NODE_TYPESHIFT = NODE_TYPESHIFT,
         RUBY_NODE_TYPEMASK  = NODE_TYPEMASK,
         RUBY_NODE_LSHIFT    = NODE_LSHIFT,
@@ -68,9 +37,7 @@ const union { https://github.com/ruby/ruby/blob/trunk/debug.c#L37
     } various;
 } ruby_dummy_gdb_enums;
 
-const VALUE RUBY_FL_USER19    = FL_USER19;
 const SIGNED_VALUE RUBY_NODE_LMASK = NODE_LMASK;
-const VALUE RUBY_ENCODING_MASK  = ENCODING_MASK;
 
 int
 ruby_debug_print_indent(int level, int debug_level, int indent_level)
Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 51850)
+++ include/ruby/intern.h	(revision 51851)
@@ -287,8 +287,9 @@ rb_check_trusted_inline(VALUE obj) https://github.com/ruby/ruby/blob/trunk/include/ruby/intern.h#L287
 #endif
 void rb_check_copyable(VALUE obj, VALUE orig);
 
-#define OBJ_INIT_COPY(obj, orig) \
+#define RB_OBJ_INIT_COPY(obj, orig) \
     ((obj) != (orig) && (rb_obj_init_copy((obj), (orig)), 1))
+#define OBJ_INIT_COPY(obj, orig) RB_OBJ_INIT_COPY(obj, orig)
 
 /* eval.c */
 int rb_sourceline(void);
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 51850)
+++ include/ruby/ruby.h	(revision 51851)
@@ -241,10 +241,12 @@ typedef char ruby_check_sizeof_voidp[SIZ https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L241
 # endif
 #endif
 
-#define FIXNUM_MAX (LONG_MAX>>1)
-#define FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
+#define RUBY_FIXNUM_MAX (LONG_MAX>>1)
+#define RUBY_FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
+#define FIXNUM_MAX RUBY_FIXNUM_MAX
+#define FIXNUM_MIN RUBY_FIXNUM_MIN
 
-#define INT2FIX(i) (((VALUE)(i))<<1 | FIXNUM_FLAG)
+#define INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
 #define LONG2FIX(i) INT2FIX(i)
 #define rb_fix_new(v) INT2FIX(v)
 VALUE rb_int2inum(SIGNED_VALUE);
@@ -358,22 +360,44 @@ rb_long2int_inline(long n) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L360
 #define MODET2NUM(v) INT2NUM(v)
 #endif
 
-#define FIX2LONG(x) ((long)RSHIFT((SIGNED_VALUE)(x),1))
-#define FIX2ULONG(x) ((unsigned long)FIX2LONG(x))
-#define FIXNUM_P(f) (((int)(SIGNED_VALUE)(f))&FIXNUM_FLAG)
-#define POSFIXABLE(f) ((f) < FIXNUM_MAX+1)
-#define NEGFIXABLE(f) ((f) >= FIXNUM_MIN)
-#define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
+#define RB_FIX2LONG(x) ((long)RSHIFT((SIGNED_VALUE)(x),1))
+static inline long
+rb_fix2long(VALUE x)
+{
+    return RB_FIX2LONG(x);
+}
+#define RB_FIX2ULONG(x) ((unsigned long)RB_FIX2LONG(x))
+static inline unsigned long
+rb_fix2ulong(VALUE x)
+{
+    return RB_FIX2ULONG(x);
+}
+#define RB_FIXNUM_P(f) (((int)(SIGNED_VALUE)(f))&RUBY_FIXNUM_FLAG)
+#define RB_POSFIXABLE(f) ((f) < RUBY_FIXNUM_MAX+1)
+#define RB_NEGFIXABLE(f) ((f) >= RUBY_FIXNUM_MIN)
+#define RB_FIXABLE(f) (RB_POSFIXABLE(f) && RB_NEGFIXABLE(f))
+#define FIX2LONG(x) RB_FIX2LONG(x)
+#define FIX2ULONG(x) RB_FIX2ULONG(x)
+#define FIXNUM_P(f) RB_FIXNUM_P(f)
+#define POSFIXABLE(f) RB_POSFIXABLE(f)
+#define NEGFIXABLE(f) RB_NEGFIXABLE(f)
+#define FIXABLE(f) RB_FIXABLE(f)
 
-#define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK)
+#define RB_IMMEDIATE_P(x) ((VALUE)(x) & RUBY_IMMEDIATE_MASK)
+#define IMMEDIATE_P(x) RB_IMMEDIATE_P(x)
 
 ID rb_sym2id(VALUE);
 VALUE rb_id2sym(ID);
-#define STATIC_SYM_P(x) (((VALUE)(x)&~((~(VALUE)0)<<RUBY_SPECIAL_SHIFT))==SYMBOL_FLAG)
-#define DYNAMIC_SYM_P(x) (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) == (T_SYMBOL))
-#define SYMBOL_P(x) (STATIC_SYM_P(x)||DYNAMIC_SYM_P(x))
-#define ID2SYM(x) (rb_id2sym(x))
-#define SYM2ID(x) (rb_sym2id(x))
+#define RB_STATIC_SYM_P(x) (((VALUE)(x)&~((~(VALUE)0)<<RUBY_SPECIAL_SHIFT)) == RUBY_SYMBOL_FLAG)
+#define RB_DYNAMIC_SYM_P(x) (!RB_SPECIAL_CONST_P(x) && RB_BUILTIN_TYPE(x) == (RUBY_T_SYMBOL))
+#define RB_SYMBOL_P(x) (RB_STATIC_SYM_P(x)||RB_DYNAMIC_SYM_P(x))
+#define RB_ID2SYM(x) (rb_id2sym(x))
+#define RB_SYM2ID(x) (rb_sym2id(x))
+#define STATIC_SYM_P(x) RB_STATIC_SYM_P(x)
+#define DYNAMIC_SYM_P(x) RB_DYNAMIC_SYM_P(x)
+#define SYMBOL_P(x) RB_SYMBOL_P(x)
+#define ID2SYM(x) RB_ID2SYM(x)
+#define SYM2ID(x) RB_SYM2ID(x)
 
 #ifndef USE_FLONUM
 #if SIZEOF_VALUE >= SIZEOF_DOUBLE
@@ -384,10 +408,11 @@ VALUE rb_id2sym(ID); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L408
 #endif
 
 #if USE_FLONUM
-#define FLONUM_P(x) ((((int)(SIGNED_VALUE)(x))&FLONUM_MASK) == FLONUM_FLAG)
+#define RB_FLONUM_P(x) ((((int)(SIGNED_VALUE)(x))&RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG)
 #else
-#define FLONUM_P(x) 0
+#define RB_FLONUM_P(x) 0
 #endif
+#define FLONUM_P(x) RB_FLONUM_P(x)
 
 /* Module#methods, #singleton_methods and so on return Symbols */
 #define USE_SYMBOL_AS_METHOD_NAME 1
@@ -499,22 +524,25 @@ enum ruby_value_type { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L524
 #define T_ZOMBIE RUBY_T_ZOMBIE
 #define T_MASK   RUBY_T_MASK
 
-#define BUILTIN_TYPE(x) (int)(((struct RBasic*)(x))->flags & T_MASK)
+#define RB_BUILTIN_TYPE(x) (int)(((struct RBasic*)(x))->flags & RUBY_T_MASK)
+#define BUILTIN_TYPE(x) RB_BUILTIN_TYPE(x)
 
 static inline int rb_type(VALUE obj);
 #define TYPE(x) rb_type((VALUE)(x))
 
-#define RB_FLOAT_TYPE_P(obj) (FLONUM_P(obj) || (!SPECIAL_CONST_P(obj) && BUILTIN_TYPE(obj) == T_FLOAT))
+#define RB_FLOAT_TYPE_P(obj) (\
+	RB_FLONUM_P(obj) || \
+	(!RB_SPECIAL_CONST_P(obj) && RB_BUILTIN_TYPE(obj) == RUBY_T_FLOAT))
 
 #define RB_TYPE_P(obj, type) ( \
-	((type) == T_FIXNUM) ? FIXNUM_P(obj) : \
-	((type) == T_TRUE) ? ((obj) == Qtrue) : \
-	((type) == T_FALSE) ? ((obj) == Qfalse) : \
-	((type) == T_NIL) ? ((obj) == Qnil) : \
-	((type) == T_UNDEF) ? ((obj) == Qundef) : \
-	((type) == T_SYMBOL) ? SYMBOL_P(obj) : \
-	((type) == T_FLOAT) ? RB_FLOAT_TYPE_P(obj) : \
-	(!SPECIAL_CONST_P(obj) && BUILTIN_TYPE(obj) == (type)))
+	((type) == RUBY_T_FIXNUM) ? RB_FIXNUM_P(obj) : \
+	((type) == RUBY_T_TRUE) ? ((obj) == RUBY_Qtrue) : \
+	((type) == RUBY_T_FALSE) ? ((obj) == RUBY_Qfalse) : \
+	((type) == RUBY_T_NIL) ? ((obj) == RUBY_Qnil) : \
+	((type) == RUBY_T_UNDEF) ? ((obj) == RUBY_Qundef) : \
+	((type) == RUBY_T_SYMBOL) ? RB_SYMBOL_P(obj) : \
+	((type) == RUBY_T_FLOAT) ? RB_FLOAT_TYPE_P(obj) : \
+	(!RB_SPECIAL_CONST_P(obj) && RB_BUILTIN_TYPE(obj) == (type)))
 
 /* RB_GC_GUARD_PTR() is an intermediate macro, and has no effect by
  * itself.  don't use it directly */
@@ -625,63 +653,72 @@ unsigned long rb_num2ulong(VALUE); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L653
 static inline long
 rb_num2long_inline(VALUE x)
 {
-    if (FIXNUM_P(x))
-	return FIX2LONG(x);
+    if (RB_FIXNUM_P(x))
+	return RB_FIX2LONG(x);
     else
 	return rb_num2long(x);
 }
-#define NUM2LONG(x) rb_num2long_inline(x)
+#define RB_NUM2LONG(x) rb_num2long_inline(x)
+#define NUM2LONG(x) RB_NUM2LONG(x)
 static inline unsigned long
 rb_num2ulong_inline(VALUE x)
 {
-    if (FIXNUM_P(x))
-	return (unsigned long)FIX2LONG(x);
+    if (RB_FIXNUM_P(x))
+	return RB_FIX2ULONG(x);
     else
 	return rb_num2ulong(x);
 }
-#define NUM2ULONG(x) rb_num2ulong_inline(x)
+#define RB_NUM2ULONG(x) rb_num2ulong_inline(x)
+#define NUM2ULONG(x) RB_NUM2ULONG(x)
 #if SIZEOF_INT < SIZEOF_LONG
 long rb_num2int(VALUE);
 long rb_fix2int(VALUE);
-#define FIX2INT(x) ((int)rb_fix2int((VALUE)(x)))
+#define RB_FIX2INT(x) ((int)rb_fix2int((VALUE)(x)))
 
 static inline int
 rb_num2int_inline(VALUE x)
 {
-    if (FIXNUM_P(x))
-	return FIX2INT(x);
+    if (RB_FIXNUM_P(x))
+	return (int)rb_fix2int(x);
     else
 	return (int)rb_num2int(x);
 }
-#define NUM2INT(x) rb_num2int_inline(x)
+#define RB_NUM2INT(x) rb_num2int_inline(x)
 
 unsigned long rb_num2uint(VALUE);
-#define NUM2UINT(x) ((unsigned int)rb_num2uint(x))
+#define RB_NUM2UINT(x) ((unsigned int)rb_num2uint(x))
 unsigned long rb_fix2uint(VALUE);
-#define FIX2UINT(x) ((unsigned int)rb_fix2uint(x))
+#define RB_FIX2UINT(x) ((unsigned int)rb_fix2uint(x))
 #else /* SIZEOF_INT < SIZEOF_LONG */
-#define NUM2INT(x) ((int)NUM2LONG(x))
-#define NUM2UINT(x) ((unsigned int)NUM2ULONG(x))
-#define FIX2INT(x) ((int)FIX2LONG(x))
-#define FIX2UINT(x) ((unsigned int)FIX2ULONG(x))
+#define RB_NUM2INT(x) ((int)RB_NUM2LONG(x))
+#define RB_NUM2UINT(x) ((unsigned int)RB_NUM2ULONG(x))
+#define RB_FIX2INT(x) ((int)RB_FIX2LONG(x))
+#define RB_FIX2UINT(x) ((unsigned int)RB_FIX2ULONG(x))
 #endif /* SIZEOF_INT < SIZEOF_LONG */
+#define NUM2INT(x)  RB_NUM2INT(x)
+#define NUM2UINT(x) RB_NUM2UINT(x)
+#define FIX2INT(x)  RB_FIX2INT(x)
+#define FIX2UINT(x) RB_FIX2UINT(x)
 
 short rb_num2short(VALUE);
 unsigned short rb_num2ushort(VALUE);
 short rb_fix2short(VALUE);
 unsigned short rb_fix2ushort(VALUE);
-#define FIX2SHORT(x) (rb_fix2short((VALUE)(x)))
+#define RB_FIX2SHORT(x) (rb_fix2short((VALUE)(x)))
+#define FIX2SHORT(x) RB_FIX2SHORT(x)
 static inline short
 rb_num2short_inline(VALUE x)
 {
-    if (FIXNUM_P(x))
-	return FIX2SHORT(x);
+    if (RB_FIXNUM_P(x))
+	return rb_fix2short(x);
     else
 	return rb_num2short(x);
 }
 
-#define NUM2SHORT(x) rb_num2short_inline(x)
-#define NUM2USHORT(x) rb_num2ushort(x)
+#define RB_NUM2SHORT(x) rb_num2short_inline(x)
+#define RB_NUM2USHORT(x) rb_num2ushort(x)
+#define NUM2SHORT(x) RB_NUM2SHORT(x)
+#define NUM2USHORT(x) RB_NUM2USHORT(x)
 
 #ifdef HAVE_LONG_LONG
 LONG_LONG rb_num2ll(VALUE);
@@ -689,13 +726,15 @@ unsigned LONG_LONG rb_num2ull(VALUE); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L726
 static inline LONG_LONG
 rb_num2ll_inline(VALUE x)
 {
-    if (FIXNUM_P(x))
-	return FIX2LONG(x);
+    if (RB_FIXNUM_P(x))
+	return RB_FIX2LONG(x);
     else
 	return rb_num2ll(x);
 }
-# define NUM2LL(x) rb_num2ll_inline(x)
-# define NUM2ULL(x) rb_num2ull(x)
+# define RB_NUM2LL(x) rb_num2ll_inline(x)
+# define RB_NUM2ULL(x) rb_num2ull(x)
+# define NUM2LL(x) RB_NUM2LL(x)
+# define NUM2ULL(x) RB_NUM2ULL(x)
 #endif
 
 #if !defined(NUM2OFFT)
@@ -723,18 +762,22 @@ VALUE rb_int2big(SIGNED_VALUE); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L762
 VALUE rb_newobj(void);
 VALUE rb_newobj_of(VALUE, VALUE);
 VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type);
-#define NEWOBJ(obj,type) type *(obj) = (type*)rb_newobj()
-#define NEWOBJ_OF(obj,type,klass,flags) type *(obj) = (type*)rb_newobj_of(klass, flags)
+#define RB_NEWOBJ(obj,type) type *(obj) = (type*)rb_newobj()
+#define RB_NEWOBJ_OF(obj,type,klass,flags) type *(obj) = (type*)rb_newobj_of(klass, flags)
+#define NEWOBJ(obj,type) RB_NEWOBJ(obj,type)
+#define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags)
 #define OBJSETUP(obj,c,t) rb_obj_setup(obj, c, t) /* use NEWOBJ_OF instead of NEWOBJ()+OBJSETUP() */
-#define CLONESETUP(clone,obj) do {\
-    OBJSETUP((clone),rb_singleton_class_clone((VALUE)(obj)),RBASIC(obj)->flags);\
+#define RB_CLONESETUP(clone,obj) do {\
+    rb_obj_setup((clone),rb_singleton_class_clone((VALUE)(obj)),RBASIC(obj)->flags);\
     rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)(clone));\
-    if (FL_TEST((obj), FL_EXIVAR)) rb_copy_generic_ivar((VALUE)(clone),(VALUE)(obj));\
+    if (RB_FL_TEST((obj), RUBY_FL_EXIVAR)) rb_copy_generic_ivar((VALUE)(clone),(VALUE)(obj));\
 } while (0)
-#define DUPSETUP(dup,obj) do {\
-    OBJSETUP((dup),rb_obj_class(obj), (RBASIC(obj)->flags)&(T_MASK|FL_EXIVAR|FL_TAINT)); \
-    if (FL_TEST((obj), FL_EXIVAR)) rb_copy_generic_ivar((VALUE)(dup),(VALUE)(obj));\
+#define RB_DUPSETUP(dup,obj) do {\
+    rb_obj_setup((dup),rb_obj_class(obj), (RBASIC(obj)->flags)&(RUBY_T_MASK|RUBY_FL_EXIVAR|RUBY_FL_TAINT)); \
+    if (RB_FL_TEST((obj), RUBY_FL_EXIVAR)) rb_copy_generic_ivar((VALUE)(dup),(VALUE)(obj));\
 } while (0)
+#define CLONESETUP(clone,obj) RB_CLONESETUP(clone,obj)
+#define DUPSETUP(dup,obj) RB_DUPSETUP(dup,obj)
 
 #ifndef USE_RGENGC
 #define USE_RGENGC 1
@@ -810,7 +853,7 @@ struct RObject { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L853
 	VALUE ary[ROBJECT_EMBED_LEN_MAX];
     } as;
 };
-#define ROBJECT_EMBED FL_USER1
+#define ROBJECT_EMBED RUBY_FL_USER1
 #define ROBJECT_NUMIV(o) \
     ((RBASIC(o)->flags & ROBJECT_EMBED) ? \
      ROBJECT_EMBED_LEN_MAX : \
@@ -836,9 +879,9 @@ struct RClass { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L879
 #define RMODULE_CONST_TBL(m) RCLASS_CONST_TBL(m)
 #define RMODULE_M_TBL(m) RCLASS_M_TBL(m)
 #define RMODULE_SUPER(m) RCLASS_SUPER(m)
-#define RMODULE_IS_OVERLAID FL_USER2
-#define RMODULE_IS_REFINEMENT FL_USER3
-#define RMODULE_INCLUDED_INTO_REFINEMENT FL_USER4
+#define RMODULE_IS_OVERLAID RUBY_FL_USER2
+#define RMODULE_IS_REFINEMENT RUBY_FL_USER3
+#define RMODULE_INCLUDED_INTO_REFINEMENT RUBY_FL_USER4
 
 double rb_float_value(VALUE);
 VALUE rb_float_new(double);
@@ -847,7 +890,8 @@ VALUE rb_float_new_in_heap(double); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L890
 #define RFLOAT_VALUE(v) rb_float_value(v)
 #define DBL2NUM(dbl)  rb_float_new(dbl)
 
-#define ELTS_SHARED FL_USER2
+#define RUBY_ELTS_SHARED RUBY_FL_USER2
+#define ELTS_SHARED RUBY_ELTS_SHARED
 
 #define RSTRING_EMBED_LEN_MAX ((int)((sizeof(VALUE)*3)/sizeof(char)-1))
 struct RString {
@@ -864,10 +908,10 @@ struct RString { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L908
 	char ary[RSTRING_EMBED_LEN_MAX + 1];
     } as;
 };
-#define RSTRING_NOEMBED FL_USER1
-#define RSTRING_FSTR FL_USER17
-#define RSTRING_EMBED_LEN_MASK (FL_USER2|FL_USER3|FL_USER4|FL_USER5|FL_USER6)
-#define RSTRING_EMBED_LEN_SHIFT (FL_USHIFT+2)
+#define RSTRING_NOEMBED RUBY_FL_USER1
+#define RSTRING_FSTR RUBY_FL_USER17
+#define RSTRING_EMBED_LEN_MASK (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)
+#define RSTRING_EMBED_LEN_SHIFT (RUBY_FL_USHIFT+2)
 #define RSTRING_EMBED_LEN(str) \
      (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
             (RSTRING_EMBED_LEN_MASK >> RSTRING_EMBED_LEN_SHIFT))
@@ -904,10 +948,10 @@ struct RArray { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L948
 	const VALUE ary[RARRAY_EMBED_LEN_MAX];
     } as;
 };
-#define RARRAY_EMBED_FLAG FL_USER1
-/* FL_USER2 is for ELTS_SHARED */
-#define RARRAY_EMBED_LEN_MASK (FL_USER4|FL_USER3)
-#define RARRAY_EMBED_LEN_SHIFT (FL_USHIFT+3)
+#define RARRAY_EMBED_FLAG RUBY_FL_USER1
+/* RUBY_FL_USER2 is for ELTS_SHARED */
+#define RARRAY_EMBED_LEN_MASK (RUBY_FL_USER4|RUBY_FL_USER3)
+#define RARRAY_EMBED_LEN_SHIFT (RUBY_FL_USHIFT+3)
 #define RARRAY_LEN(a) \
     ((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ? \
      (long)((RBASIC(a)->flags >> RARRAY_EMBED_LEN_SHIFT) & \
@@ -989,7 +1033,7 @@ struct rb_data_type_struct { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1033
     const rb_data_type_t *parent;
     void *data;        /* This area can be used for any purpose
                           by a programmer who define the type. */
-    VALUE flags;       /* FL_WB_PROTECTED */
+    VALUE flags;       /* RUBY_FL_WB_PROTECTED */
 };
 
 #define HAVE_TYPE_RB_DATA_TYPE_T 1
@@ -1036,8 +1080,8 @@ void *rb_check_typeddata(VALUE, const rb https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1080
 
 /* bits for rb_data_type_struct::flags */
 #define RUBY_TYPED_FREE_IMMEDIATELY  1 /* TYPE field */
-#define RUBY_TYPED_WB_PROTECTED      FL_WB_PROTECTED /* THIS FLAG DEPENDS ON Ruby version */
-#define RUBY_TYPED_PROMOTED1         FL_PROMOTED1    /* THIS FLAG DEPENDS ON Ruby version */
+#define RUBY_TYPED_WB_PROTECTED      RUBY_FL_WB_PROTECTED /* THIS FLAG DEPENDS ON Ruby version */
+#define RUBY_TYPED_PROMOTED1         RUBY_FL_PROMOTED1    /* THIS FLAG DEPENDS ON Ruby version */
 
 #define Data_Wrap_Struct(klass,mark,free,sval)\
     rb_data_object_wrap((klass),(sval),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free))
@@ -1094,8 +1138,8 @@ struct RStruct { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1138
 	const VALUE ary[RSTRUCT_EMBED_LEN_MAX];
     } as;
 };
-#define RSTRUCT_EMBED_LEN_MASK (FL_USER2|FL_USER1)
-#define RSTRUCT_EMBED_LEN_SHIFT (FL_USHIFT+1)
+#define RSTRUCT_EMBED_LEN_MASK (RUBY_FL_USER2|RUBY_FL_USER1)
+#define RSTRUCT_EMBED_LEN_SHIFT (RUBY_FL_USHIFT+1)
 #define RSTRUCT_LEN(st) \
     ((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ? \
      (long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \
@@ -1128,79 +1172,148 @@ struct RStruct { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1172
 #define RSTRUCT(obj) (R_CAST(RStruct)(obj))
 #define RFILE(obj)   (R_CAST(RFile)(obj))
 
-#define FL_SINGLETON FL_USER0
-#define FL_WB_PROTECTED (((VALUE)1)<<5)
-#define FL_PROMOTED0 (((VALUE)1)<<5)
-#define FL_PROMOTED1 (((VALUE)1)<<6)
-#define FL_FINALIZE  (((VALUE)1)<<7)
-#define FL_TAINT     (((VALUE)1)<<8)
-#define FL_UNTRUSTED FL_TAINT
-#define FL_EXIVAR    (((VALUE)1)<<10)
-#define FL_FREEZE    (((VALUE)1)<<11)
-
-#define FL_USHIFT    12
-
-#define FL_USER0     (((VALUE)1)<<(FL_USHIFT+0))
-#define FL_USER1     (((VALUE)1)<<(FL_USHIFT+1))
-#define FL_USER2     (((VALUE)1)<<(FL_USHIFT+2))
-#define FL_USER3     (((VALUE)1)<<(FL_USHIFT+3))
-#define FL_USER4     (((VALUE)1)<<(FL_USHIFT+4))
-#define FL_USER5     (((VALUE)1)<<(FL_USHIFT+5))
-#define FL_USER6     (((VALUE)1)<<(FL_USHIFT+6))
-#define FL_USER7     (((VALUE)1)<<(FL_USHIFT+7))
-#define FL_USER8     (((VALUE)1)<<(FL_USHIFT+8))
-#define FL_USER9     (((VALUE)1)<<(FL_USHIFT+9))
-#define FL_USER10    (((VALUE)1)<<(FL_USHIFT+10))
-#define FL_USER11    (((VALUE)1)<<(FL_USHIFT+11))
-#define FL_USER12    (((VALUE)1)<<(FL_USHIFT+12))
-#define FL_USER13    (((VALUE)1)<<(FL_USHIFT+13))
-#define FL_USER14    (((VALUE)1)<<(FL_USHIFT+14))
-#define FL_USER15    (((VALUE)1)<<(FL_USHIFT+15))
-#define FL_USER16    (((VALUE)1)<<(FL_USHIFT+16))
-#define FL_USER17    (((VALUE)1)<<(FL_USHIFT+17))
-#define FL_USER18    (((VALUE)1)<<(FL_USHIFT+18))
-#define FL_USER19    (((VALUE)1)<<(FL_USHIFT+19))
-
-#define SPECIAL_CONST_P(x) (IMMEDIATE_P(x) || !RTEST(x))
-
-#define FL_ABLE(x) (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) != T_NODE)
-#define FL_TEST_RAW(x,f) (RBASIC(x)->flags&(f))
-#define FL_TEST(x,f) (FL_ABLE(x)?FL_TEST_RAW( (... truncated)

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

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