Hi,

	you must already hate me, but this could be really final patch
	for MACROS, I promise, matz :-)

	Here it is.

		Michal


Index: class.c
===================================================================
RCS file: /src/ruby/class.c,v
retrieving revision 1.39
diff -u -r1.39 class.c
--- class.c	2002/04/18 08:46:17	1.39
+++ class.c	2002/04/24 21:01:17
@@ -661,19 +661,23 @@
 
 #if 0
 
-#define SPECIAL_SINGLETON(x,c) if (obj == (x)) {\
-    if (!FL_TEST(c, FL_SINGLETON)) {\
-	c = rb_singleton_class_new(c);\
-	rb_singleton_class_attached(c,obj);\
+#define SPECIAL_SINGLETON(x,c) do {
+    if (obj == (x)) {\
+	if (!FL_TEST(c, FL_SINGLETON)) {\
+	    c = rb_singleton_class_new(c);\
+	    rb_singleton_class_attached(c,obj);\
+	}\
+	return c;\
     }\
-    return c;\
-}
+} while (0)
 
 #else
 
-#define SPECIAL_SINGLETON(x,c) if (obj == (x)) {\
-    return c;\
-}
+#define SPECIAL_SINGLETON(x,c) do {\
+    if (obj == (x)) {\
+	return c;\
+    }\
+} while (0)
 
 #endif
 
Index: eval.c
===================================================================
RCS file: /src/ruby/eval.c,v
retrieving revision 1.286
diff -u -r1.286 eval.c
--- eval.c	2002/04/24 05:58:34	1.286
+++ eval.c	2002/04/24 21:01:21
@@ -116,7 +116,7 @@
 #define SCOPE_PROTECTED 2
 #define SCOPE_MODFUNC   5
 #define SCOPE_MASK      7
-#define SCOPE_SET(f)  scope_vmode=(f)
+#define SCOPE_SET(f)  (scope_vmode=(f))
 #define SCOPE_TEST(f) (scope_vmode&(f))
 
 int ruby_safe_level = 0;
Index: gc.c
===================================================================
RCS file: /src/ruby/gc.c,v
retrieving revision 1.91
diff -u -r1.91 gc.c
--- gc.c	2002/04/24 05:07:07	1.91
+++ gc.c	2002/04/24 21:01:21
@@ -361,13 +361,16 @@
 #endif
 
 #ifdef C_ALLOCA
-# define SET_STACK_END VALUE stack_end; alloca(0);
+# define SET_STACK_END do {\
+    VALUE stack_end;\
+    alloca(0);\
+} while (0)
 # define STACK_END (&stack_end)
 #else
 # if defined(__GNUC__) && defined(USE_BUILTIN_FRAME_ADDRESS)
-#  define  SET_STACK_END    VALUE *stack_end = __builtin_frame_address(0);
+#  define  SET_STACK_END    VALUE *stack_end = __builtin_frame_address(0)
 # else
-#  define  SET_STACK_END    VALUE *stack_end = alloca(1);
+#  define  SET_STACK_END    VALUE *stack_end = alloca(1)
 # endif
 # define STACK_END (stack_end)
 #endif
@@ -381,7 +384,7 @@
 #define CHECK_STACK(ret) do {\
     SET_STACK_END;\
     (ret) = (STACK_LENGTH > STACK_LEVEL_MAX);\
-} while (0)\
+} while (0)
 
 int
 ruby_stack_length(p)
Index: pack.c
===================================================================
RCS file: /src/ruby/pack.c,v
retrieving revision 1.35
diff -u -r1.35 pack.c
--- pack.c	2002/04/15 07:48:45	1.35
+++ pack.c	2002/04/24 21:01:22
@@ -1046,12 +1046,11 @@
     PACK_LENGTH_ADJUST_SIZE(t__len);		\
 } while (0)
 #else
-#define PACK_LENGTH_ADJUST(type,sz) do {	\
-    PACK_LENGTH_ADJUST_SIZE(sizeof(type));	\
-} while (0)
+#define PACK_LENGTH_ADJUST(type,sz) 		\
+    PACK_LENGTH_ADJUST_SIZE(sizeof(type))
 #endif
 
-#define PACK_ITEM_ADJUST() while (tmp--) rb_ary_push(ary, Qnil);
+#define PACK_ITEM_ADJUST() while (tmp--) rb_ary_push(ary, Qnil)
 
 static VALUE
 pack_unpack(str, fmt)
Index: parse.y
===================================================================
RCS file: /src/ruby/parse.y,v
retrieving revision 1.167
diff -u -r1.167 parse.y
--- parse.y	2002/04/24 04:54:14	1.167
+++ parse.y	2002/04/24 21:01:23
@@ -68,12 +68,8 @@
 #endif
 
 static stack_type cond_stack = 0;
-#define COND_PUSH(n) do {\
-    cond_stack = (cond_stack<<1)|((n)&1);\
-} while(0)
-#define COND_POP() do {\
-    cond_stack >>= 1;\
-} while (0)
+#define COND_PUSH(n) (cond_stack = (cond_stack<<1)|((n)&1))
+#define COND_POP() (cond_stack >>= 1)
 #define COND_LEXPOP() do {\
     int last = COND_P();\
     cond_stack >>= 1;\
@@ -82,12 +78,8 @@
 #define COND_P() (cond_stack&1)
 
 static stack_type cmdarg_stack = 0;
-#define CMDARG_PUSH(n) do {\
-    cmdarg_stack = (cmdarg_stack<<1)|((n)&1);\
-} while(0)
-#define CMDARG_POP() do {\
-    cmdarg_stack >>= 1;\
-} while (0)
+#define CMDARG_PUSH(n) (cmdarg_stack = (cmdarg_stack<<1)|((n)&1))
+#define CMDARG_POP() (cmdarg_stack >>= 1)
 #define CMDARG_LEXPOP() do {\
     int last = CMDARG_P();\
     cmdarg_stack >>= 1;\
Index: random.c
===================================================================
RCS file: /src/ruby/random.c,v
retrieving revision 1.19
diff -u -r1.19 random.c
--- random.c	2002/04/18 08:46:18	1.19
+++ random.c	2002/04/24 21:01:23
@@ -127,7 +127,7 @@
     }
     old = rand_init(seed);
 
-    return rb_uint2inum(old);
+    return UINT2NUM(old);
 }
 
 static VALUE
@@ -170,7 +170,7 @@
     val = max*RANDOM_NUMBER;
 
     if (val < 0) val = -val;
-    return rb_int2inum(val);
+    return LONG2NUM(val);
 }
 
 void
Index: regex.c
===================================================================
RCS file: /src/ruby/regex.c,v
retrieving revision 1.69
diff -u -r1.69 regex.c
--- regex.c	2002/04/24 04:54:14	1.69
+++ regex.c	2002/04/24 21:01:25
@@ -69,9 +69,11 @@
 extern int rb_trap_pending;
 void rb_trap_exec _((void));
 
-# define CHECK_INTS if (!rb_prohibit_interrupt) {\
-    if (rb_trap_pending) rb_trap_exec();\
-}
+# define CHECK_INTS do {\
+    if (!rb_prohibit_interrupt) {\
+	if (rb_trap_pending) rb_trap_exec();\
+    }\
+} while (0)
 #endif
 
 /* Make alloca work the best possible way.  */
@@ -419,7 +421,6 @@
     return 0;
 }
 
-
/* Macros for re_compile_pattern, which is found below these definitions. */ #define TRANSLATE_P() ((options&RE_OPTION_IGNORECASE) && translate) Index: st.c =================================================================== RCS file: /src/ruby/st.c,v retrieving revision 1.20 diff -u -r1.20 st.c --- st.c 2002/03/22 07:26:35 1.20 +++ st.c 2002/04/24 21:01:25 @@ -233,16 +233,17 @@ #define COLLISION #endif -#define FIND_ENTRY(table, ptr, hash_val, bin_pos) \ -bin_pos = hash_val%(table)->num_bins;\ -ptr = (table)->bins[bin_pos];\ -if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) {\ - COLLISION;\ - while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\ +#define FIND_ENTRY(table, ptr, hash_val, bin_pos) do {\ + bin_pos = hash_val%(table)->num_bins;\ + ptr = (table)->bins[bin_pos];\ + if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) {\ + COLLISION;\ + while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\ + ptr = ptr->next;\ + }\ ptr = ptr->next;\ }\ - ptr = ptr->next;\ -} +} while (0) int st_lookup(table, key, value) @@ -266,7 +267,7 @@ } #define ADD_DIRECT(table, key, value, hash_val, bin_pos)\ -{\ +do {\ st_table_entry *entry;\ if (table->num_entries/(table->num_bins) > ST_DEFAULT_MAX_DENSITY) {\ rehash(table);\ @@ -281,7 +282,7 @@ entry->next = table->bins[bin_pos];\ table->bins[bin_pos] = entry;\ table->num_entries++;\ -} +} while (0) int st_insert(table, key, value) -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Michal Rokos Czech Technical University, Prague E-mail:m.rokos / sh.cvut.cz ICQ:36118339 Jabber:majkl / jabber.sh.cvut.cz -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-