summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-23 04:44:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-23 04:44:04 +0000
commit443ddb09699926f74798fdb8440a24ebda358088 (patch)
tree7597494ff8efc15f8ee1d6b7d7b6c2fc7d434fd3
parent38d2bcf47cf52dd00a3632aef16ab1b258def01b (diff)
* parse.y: integrate operations for stack_type. [ruby-dev:21681]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--parse.y29
2 files changed, 17 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index c3c6bb74a7..c785a4cd46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Oct 23 13:44:00 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y: integrate operations for stack_type. [ruby-dev:21681]
+
Thu Oct 23 00:41:45 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/soap/calc/*, test/soap/helloworld/*: set logging threshold
diff --git a/parse.y b/parse.y
index 2b466a997f..3f738e2cde 100644
--- a/parse.y
+++ b/parse.y
@@ -83,25 +83,22 @@ typedef unsigned LONG_LONG stack_type;
typedef unsigned long stack_type;
#endif
+#define BITSTACK_PUSH(stack, n) (stack = (stack<<1)|((n)&1))
+#define BITSTACK_POP(stack) (stack >>= 1)
+#define BITSTACK_LEXPOP(stack) (stack = (stack >> 1) | (stack & 1))
+#define BITSTACK_SET_P(stack) (stack&1)
+
static stack_type cond_stack = 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;\
- if (last) cond_stack |= 1;\
-} while (0)
-#define COND_P() (cond_stack&1)
+#define COND_PUSH(n) BITSTACK_PUSH(cond_stack, n)
+#define COND_POP() BITSTACK_POP(cond_stack)
+#define COND_LEXPOP() BITSTACK_LEXPOP(cond_stack)
+#define COND_P() BITSTACK_SET_P(cond_stack)
static stack_type cmdarg_stack = 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;\
- if (last) cmdarg_stack |= 1;\
-} while (0)
-#define CMDARG_P() (cmdarg_stack&1)
+#define CMDARG_PUSH(n) BITSTACK_PUSH(cmdarg_stack, n)
+#define CMDARG_POP() BITSTACK_POP(cmdarg_stack)
+#define CMDARG_LEXPOP() BITSTACK_LEXPOP(cmdarg_stack)
+#define CMDARG_P() BITSTACK_SET_P(cmdarg_stack)
static int class_nest = 0;
static int in_single = 0;