summaryrefslogtreecommitdiff
path: root/node.h
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-14 10:29:25 (GMT)
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-14 10:29:25 (GMT)
commit0b35e9e5ddb329dac027d72851db015a738852d7 (patch)
tree001a9eb630f1b96357a951357e9b3b2607149a58 /node.h
parent0d94434eca76abeb13dda88d2695777bbca7f31a (diff)
* enumerator.c (lazy_take): add Enumerable::Lazy#take.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'node.h')
-rw-r--r--node.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/node.h b/node.h
index f9571c7..16343c7 100644
--- a/node.h
+++ b/node.h
@@ -451,6 +451,14 @@ typedef struct RNode {
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
#define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
#define NEW_OPTBLOCK(a) NEW_NODE(NODE_OPTBLOCK,a,0,0)
+#define NEW_MEMO(a,b,c) NEW_NODE(NODE_MEMO,a,b,c)
+
+#define roomof(x, y) ((sizeof(x) + sizeof(y) - 1) / sizeof(y))
+#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
+#define NEW_MEMO_FOR(type, value) \
+ (rb_ary_set_len(((value) = rb_ary_tmp_new(roomof(type, VALUE))), \
+ roomof(type, VALUE)), \
+ MEMO_FOR(type, value))
#if defined __GNUC__ && __GNUC__ >= 4
#pragma GCC visibility push(default)