rubynode 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,5 +1,9 @@
1
1
  Changelog
2
2
 
3
+ -- 0.1.3
4
+
5
+ * Out of the box 1.8.5-p35, 1.8.5-p52, 1.8.6 and 1.8.6-p36 support
6
+
3
7
  -- 0.1.2
4
8
 
5
9
  * Out of the box 1.8.5-p2 and 1.8.5-p12 support
data/README CHANGED
@@ -14,9 +14,10 @@ s-expressions), which are easy to manipulate and work with.
14
14
  Requirements
15
15
  ------------
16
16
 
17
- RubyNode is tested with Ruby 1.8.4 and 1.8.5 (including patchlevels 2 and 12),
18
- but it should also work with other 1.8 versions and also with 1.9 (but there
19
- might be some node types that are not fully supported).
17
+ RubyNode is tested with Ruby 1.8.4, 1.8.5 and 1.8.6, but it should also work
18
+ with other 1.8 versions. RubyNode worked (and still does work) with older Ruby
19
+ 1.9 snapshots (possibly some node types are not fully supported), but it
20
+ currently does not work with the latest 1.9 snapshots.
20
21
 
21
22
 
22
23
  Installation
@@ -25,12 +26,12 @@ Installation
25
26
  RubyNode generates some of its C source code from Ruby's source code, because
26
27
  the node types and other details differ between Ruby versions.
27
28
 
28
- For the official releases of Ruby 1.8.4 and 1.8.5 (including patchlevels 2 and
29
- 12) the needed source files are included in the package. To compile RubyNode
30
- for any other Ruby version, you will need that version's source tar ball
31
- extracted somewhere.
29
+ For the official releases of Ruby 1.8.4, 1.8.5 (including patchlevels 2, 12, 35
30
+ and 52) and 1.8.6 (including patchlevel 36) the needed source files are
31
+ included in the package. To compile RubyNode for any other Ruby version, you
32
+ will need that version's source tar ball extracted somewhere.
32
33
 
33
- So, for Ruby 1.8.4 and 1.8.5 just run (as root):
34
+ So, for Ruby 1.8.4, 1.8.5 and 1.8.6 just run (as root):
34
35
 
35
36
  gem install rubynode
36
37
 
@@ -53,31 +54,16 @@ Or if you do not use the gem:
53
54
  RUBY_SOURCE_DIR="/path/to/ruby_source" ruby setup.rb
54
55
 
55
56
 
56
- Usage
57
- -----
57
+ Documentation
58
+ -------------
58
59
 
59
- See doc/index.html and doc/api.html.
60
-
61
-
62
- Feedback
63
- --------
64
-
65
- If you find a bug, think that something doesn't work as it should or have other
66
- suggestions, then please don't hesitate to contact me (dbatml@gmx.de) and tell
67
- me about it.
68
-
69
-
70
- Thanks
71
- ------
72
-
73
- I would like to thank Paul Brannan for writing Nodewrap, which inspired me to
74
- write RubyNode and also gave me some ideas and code.
60
+ Please see doc/index.html for more documentation.
75
61
 
76
62
 
77
63
  License
78
64
  -------
79
65
 
80
- Copyright 2006 Dominik Bathon <dbatml@gmx.de>
66
+ Copyright 2006-2007 Dominik Bathon <dbatml@gmx.de>
81
67
 
82
68
  RubyNode is licensed under the same terms as Ruby.
83
69
 
data/doc/index.html CHANGED
@@ -24,9 +24,10 @@ s-expressions), which are easy to manipulate and work with.</p>
24
24
  <h2 id="section1">Requirements</h2>
25
25
 
26
26
 
27
- <p>RubyNode is tested with Ruby 1.8.4 and 1.8.5 (including patchlevels 2 and 12),
28
- but it should also work with other 1.8 versions and also with 1.9 (but there
29
- might be some node types that are not fully supported).</p>
27
+ <p>RubyNode is tested with Ruby 1.8.4, 1.8.5 and 1.8.6, but it should also work
28
+ with other 1.8 versions. RubyNode worked (and still does work) with older Ruby
29
+ 1.9 snapshots (possibly some node types are not fully supported), but it
30
+ currently does not work with the latest 1.9 snapshots.</p>
30
31
 
31
32
 
32
33
  <h2 id="section2">Download</h2>
@@ -45,13 +46,13 @@ might be some node types that are not fully supported).</p>
45
46
  the node types and other details differ between Ruby versions.</p>
46
47
 
47
48
 
48
- <p>For the official releases of Ruby 1.8.4 and 1.8.5 (including patchlevels 2 and
49
- 12) the needed source files are included in the package. To compile RubyNode
50
- for any other Ruby version, you will need that version&#8217;s source tar ball
51
- extracted somewhere.</p>
49
+ <p>For the official releases of Ruby 1.8.4, 1.8.5 (including patchlevels 2, 12,
50
+ 35 and 52) and 1.8.6 (including patchlevel 36) the needed source files are
51
+ included in the package. To compile RubyNode for any other Ruby version, you
52
+ will need that version&#8217;s source tar ball extracted somewhere.</p>
52
53
 
53
54
 
54
- <p>So, for <strong>Ruby 1.8.4</strong> and <strong>1.8.5</strong> just run (as root):</p>
55
+ <p>So, for <strong>Ruby 1.8.4</strong>, <strong>1.8.5</strong> and <strong>1.8.6</strong> just run (as root):</p>
55
56
 
56
57
 
57
58
  <pre><code>gem install rubynode
@@ -163,7 +164,7 @@ write RubyNode and also gave me some ideas and code.</p>
163
164
  <h2 id="section7">License</h2>
164
165
 
165
166
 
166
- <p>Copyright 2006 <a href="mailto:dbatml@remove_nospam.gmx.de">Dominik Bathon</a>.</p>
167
+ <p>Copyright 2006-2007 <a href="mailto:dbatml@remove_nospam.gmx.de">Dominik Bathon</a>.</p>
167
168
 
168
169
 
169
170
  <p>RubyNode is licensed under the same terms as Ruby.</p>
@@ -0,0 +1,44 @@
1
+ /**********************************************************************
2
+
3
+ eval.c -
4
+
5
+ $Author: shyouhei $
6
+ $Date: 2007/01/27 15:45:49 $
7
+ created at: Thu Jun 10 14:22:17 JST 1993
8
+
9
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
10
+ Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
11
+ Copyright (C) 2000 Information-technology Promotion Agency, Japan
12
+
13
+ **********************************************************************/
14
+
15
+ /* extract from eval.c from ruby 1.8.5 */
16
+
17
+ struct BLOCK {
18
+ NODE *var;
19
+ NODE *body;
20
+ VALUE self;
21
+ struct FRAME frame;
22
+ struct SCOPE *scope;
23
+ VALUE klass;
24
+ NODE *cref;
25
+ int iter;
26
+ int vmode;
27
+ int flags;
28
+ int uniq;
29
+ struct RVarmap *dyna_vars;
30
+ VALUE orig_thread;
31
+ VALUE wrapper;
32
+ VALUE block_obj;
33
+ struct BLOCK *outer;
34
+ struct BLOCK *prev;
35
+ };
36
+
37
+ struct METHOD {
38
+ VALUE klass, rklass;
39
+ VALUE recv;
40
+ ID id, oid;
41
+ int safe_level;
42
+ NODE *body;
43
+ };
44
+
@@ -0,0 +1,272 @@
1
+ /**********************************************************************
2
+
3
+ gc.c -
4
+
5
+ $Author: matz $
6
+ $Date: 2006/08/25 08:12:46 $
7
+ created at: Tue Oct 5 09:44:46 JST 1993
8
+
9
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
10
+ Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
11
+ Copyright (C) 2000 Information-technology Promotion Agency, Japan
12
+
13
+ **********************************************************************/
14
+
15
+ /* extract from gc.c from ruby 1.8.5 */
16
+
17
+ static void
18
+ gc_mark_children(ptr, lev)
19
+ VALUE ptr;
20
+ int lev;
21
+ {
22
+ register RVALUE *obj = RANY(ptr);
23
+
24
+ goto marking; /* skip */
25
+
26
+ again:
27
+ obj = RANY(ptr);
28
+ if (rb_special_const_p(ptr)) return; /* special const not marked */
29
+ if (obj->as.basic.flags == 0) return; /* free cell */
30
+ if (obj->as.basic.flags & FL_MARK) return; /* already marked */
31
+ obj->as.basic.flags |= FL_MARK;
32
+
33
+ marking:
34
+ if (FL_TEST(obj, FL_EXIVAR)) {
35
+ rb_mark_generic_ivar(ptr);
36
+ }
37
+
38
+ switch (obj->as.basic.flags & T_MASK) {
39
+ case T_NIL:
40
+ case T_FIXNUM:
41
+ rb_bug("rb_gc_mark() called for broken object");
42
+ break;
43
+
44
+ case T_NODE:
45
+ mark_source_filename(obj->as.node.nd_file);
46
+ switch (nd_type(obj)) {
47
+ case NODE_IF: /* 1,2,3 */
48
+ case NODE_FOR:
49
+ case NODE_ITER:
50
+ case NODE_CREF:
51
+ case NODE_WHEN:
52
+ case NODE_MASGN:
53
+ case NODE_RESCUE:
54
+ case NODE_RESBODY:
55
+ case NODE_CLASS:
56
+ gc_mark((VALUE)obj->as.node.u2.node, lev);
57
+ /* fall through */
58
+ case NODE_BLOCK: /* 1,3 */
59
+ case NODE_ARRAY:
60
+ case NODE_DSTR:
61
+ case NODE_DXSTR:
62
+ case NODE_DREGX:
63
+ case NODE_DREGX_ONCE:
64
+ case NODE_FBODY:
65
+ case NODE_ENSURE:
66
+ case NODE_CALL:
67
+ case NODE_DEFS:
68
+ case NODE_OP_ASGN1:
69
+ gc_mark((VALUE)obj->as.node.u1.node, lev);
70
+ /* fall through */
71
+ case NODE_SUPER: /* 3 */
72
+ case NODE_FCALL:
73
+ case NODE_DEFN:
74
+ case NODE_NEWLINE:
75
+ ptr = (VALUE)obj->as.node.u3.node;
76
+ goto again;
77
+
78
+ case NODE_WHILE: /* 1,2 */
79
+ case NODE_UNTIL:
80
+ case NODE_AND:
81
+ case NODE_OR:
82
+ case NODE_CASE:
83
+ case NODE_SCLASS:
84
+ case NODE_DOT2:
85
+ case NODE_DOT3:
86
+ case NODE_FLIP2:
87
+ case NODE_FLIP3:
88
+ case NODE_MATCH2:
89
+ case NODE_MATCH3:
90
+ case NODE_OP_ASGN_OR:
91
+ case NODE_OP_ASGN_AND:
92
+ case NODE_MODULE:
93
+ case NODE_ALIAS:
94
+ case NODE_VALIAS:
95
+ case NODE_ARGS:
96
+ gc_mark((VALUE)obj->as.node.u1.node, lev);
97
+ /* fall through */
98
+ case NODE_METHOD: /* 2 */
99
+ case NODE_NOT:
100
+ case NODE_GASGN:
101
+ case NODE_LASGN:
102
+ case NODE_DASGN:
103
+ case NODE_DASGN_CURR:
104
+ case NODE_IASGN:
105
+ case NODE_CVDECL:
106
+ case NODE_CVASGN:
107
+ case NODE_COLON3:
108
+ case NODE_OPT_N:
109
+ case NODE_EVSTR:
110
+ case NODE_UNDEF:
111
+ ptr = (VALUE)obj->as.node.u2.node;
112
+ goto again;
113
+
114
+ case NODE_HASH: /* 1 */
115
+ case NODE_LIT:
116
+ case NODE_STR:
117
+ case NODE_XSTR:
118
+ case NODE_DEFINED:
119
+ case NODE_MATCH:
120
+ case NODE_RETURN:
121
+ case NODE_BREAK:
122
+ case NODE_NEXT:
123
+ case NODE_YIELD:
124
+ case NODE_COLON2:
125
+ case NODE_SPLAT:
126
+ case NODE_TO_ARY:
127
+ case NODE_SVALUE:
128
+ ptr = (VALUE)obj->as.node.u1.node;
129
+ goto again;
130
+
131
+ case NODE_SCOPE: /* 2,3 */
132
+ case NODE_BLOCK_PASS:
133
+ case NODE_CDECL:
134
+ gc_mark((VALUE)obj->as.node.u3.node, lev);
135
+ ptr = (VALUE)obj->as.node.u2.node;
136
+ goto again;
137
+
138
+ case NODE_ZARRAY: /* - */
139
+ case NODE_ZSUPER:
140
+ case NODE_CFUNC:
141
+ case NODE_VCALL:
142
+ case NODE_GVAR:
143
+ case NODE_LVAR:
144
+ case NODE_DVAR:
145
+ case NODE_IVAR:
146
+ case NODE_CVAR:
147
+ case NODE_NTH_REF:
148
+ case NODE_BACK_REF:
149
+ case NODE_REDO:
150
+ case NODE_RETRY:
151
+ case NODE_SELF:
152
+ case NODE_NIL:
153
+ case NODE_TRUE:
154
+ case NODE_FALSE:
155
+ case NODE_ATTRSET:
156
+ case NODE_BLOCK_ARG:
157
+ case NODE_POSTEXE:
158
+ break;
159
+ case NODE_ALLOCA:
160
+ mark_locations_array((VALUE*)obj->as.node.u1.value,
161
+ obj->as.node.u3.cnt);
162
+ ptr = (VALUE)obj->as.node.u2.node;
163
+ goto again;
164
+
165
+ default: /* unlisted NODE */
166
+ if (is_pointer_to_heap(obj->as.node.u1.node)) {
167
+ gc_mark((VALUE)obj->as.node.u1.node, lev);
168
+ }
169
+ if (is_pointer_to_heap(obj->as.node.u2.node)) {
170
+ gc_mark((VALUE)obj->as.node.u2.node, lev);
171
+ }
172
+ if (is_pointer_to_heap(obj->as.node.u3.node)) {
173
+ gc_mark((VALUE)obj->as.node.u3.node, lev);
174
+ }
175
+ }
176
+ return; /* no need to mark class. */
177
+ }
178
+
179
+ gc_mark(obj->as.basic.klass, lev);
180
+ switch (obj->as.basic.flags & T_MASK) {
181
+ case T_ICLASS:
182
+ case T_CLASS:
183
+ case T_MODULE:
184
+ mark_tbl(obj->as.klass.m_tbl, lev);
185
+ mark_tbl(obj->as.klass.iv_tbl, lev);
186
+ ptr = obj->as.klass.super;
187
+ goto again;
188
+
189
+ case T_ARRAY:
190
+ if (FL_TEST(obj, ELTS_SHARED)) {
191
+ ptr = obj->as.array.aux.shared;
192
+ goto again;
193
+ }
194
+ else {
195
+ long i, len = obj->as.array.len;
196
+ VALUE *ptr = obj->as.array.ptr;
197
+
198
+ for (i=0; i < len; i++) {
199
+ gc_mark(*ptr++, lev);
200
+ }
201
+ }
202
+ break;
203
+
204
+ case T_HASH:
205
+ mark_hash(obj->as.hash.tbl, lev);
206
+ ptr = obj->as.hash.ifnone;
207
+ goto again;
208
+
209
+ case T_STRING:
210
+ #define STR_ASSOC FL_USER3 /* copied from string.c */
211
+ if (FL_TEST(obj, ELTS_SHARED|STR_ASSOC)) {
212
+ ptr = obj->as.string.aux.shared;
213
+ goto again;
214
+ }
215
+ break;
216
+
217
+ case T_DATA:
218
+ if (obj->as.data.dmark) (*obj->as.data.dmark)(DATA_PTR(obj));
219
+ break;
220
+
221
+ case T_OBJECT:
222
+ mark_tbl(obj->as.object.iv_tbl, lev);
223
+ break;
224
+
225
+ case T_FILE:
226
+ case T_REGEXP:
227
+ case T_FLOAT:
228
+ case T_BIGNUM:
229
+ case T_BLKTAG:
230
+ break;
231
+
232
+ case T_MATCH:
233
+ if (obj->as.match.str) {
234
+ ptr = obj->as.match.str;
235
+ goto again;
236
+ }
237
+ break;
238
+
239
+ case T_VARMAP:
240
+ gc_mark(obj->as.varmap.val, lev);
241
+ ptr = (VALUE)obj->as.varmap.next;
242
+ goto again;
243
+
244
+ case T_SCOPE:
245
+ if (obj->as.scope.local_vars && (obj->as.scope.flags & SCOPE_MALLOC)) {
246
+ int n = obj->as.scope.local_tbl[0]+1;
247
+ VALUE *vars = &obj->as.scope.local_vars[-1];
248
+
249
+ while (n--) {
250
+ gc_mark(*vars++, lev);
251
+ }
252
+ }
253
+ break;
254
+
255
+ case T_STRUCT:
256
+ {
257
+ long len = obj->as.rstruct.len;
258
+ VALUE *ptr = obj->as.rstruct.ptr;
259
+
260
+ while (len--) {
261
+ gc_mark(*ptr++, lev);
262
+ }
263
+ }
264
+ break;
265
+
266
+ default:
267
+ rb_bug("rb_gc_mark(): unknown data type 0x%lx(0x%lx) %s",
268
+ obj->as.basic.flags & T_MASK, obj,
269
+ is_pointer_to_heap(obj) ? "corrupted object" : "non object");
270
+ }
271
+ }
272
+
@@ -0,0 +1,378 @@
1
+ /**********************************************************************
2
+
3
+ node.h -
4
+
5
+ $Author: matz $
6
+ $Date: 2006/02/13 09:10:53 $
7
+ created at: Fri May 28 15:14:02 JST 1993
8
+
9
+ Copyright (C) 1993-2003 Yukihiro Matsumoto
10
+
11
+ **********************************************************************/
12
+
13
+ #ifndef NODE_H
14
+ #define NODE_H
15
+
16
+ #if defined(__cplusplus)
17
+ extern "C" {
18
+ #endif
19
+
20
+ enum node_type {
21
+ NODE_METHOD,
22
+ NODE_FBODY,
23
+ NODE_CFUNC,
24
+ NODE_SCOPE,
25
+ NODE_BLOCK,
26
+ NODE_IF,
27
+ NODE_CASE,
28
+ NODE_WHEN,
29
+ NODE_OPT_N,
30
+ NODE_WHILE,
31
+ NODE_UNTIL,
32
+ NODE_ITER,
33
+ NODE_FOR,
34
+ NODE_BREAK,
35
+ NODE_NEXT,
36
+ NODE_REDO,
37
+ NODE_RETRY,
38
+ NODE_BEGIN,
39
+ NODE_RESCUE,
40
+ NODE_RESBODY,
41
+ NODE_ENSURE,
42
+ NODE_AND,
43
+ NODE_OR,
44
+ NODE_NOT,
45
+ NODE_MASGN,
46
+ NODE_LASGN,
47
+ NODE_DASGN,
48
+ NODE_DASGN_CURR,
49
+ NODE_GASGN,
50
+ NODE_IASGN,
51
+ NODE_CDECL,
52
+ NODE_CVASGN,
53
+ NODE_CVDECL,
54
+ NODE_OP_ASGN1,
55
+ NODE_OP_ASGN2,
56
+ NODE_OP_ASGN_AND,
57
+ NODE_OP_ASGN_OR,
58
+ NODE_CALL,
59
+ NODE_FCALL,
60
+ NODE_VCALL,
61
+ NODE_SUPER,
62
+ NODE_ZSUPER,
63
+ NODE_ARRAY,
64
+ NODE_ZARRAY,
65
+ NODE_HASH,
66
+ NODE_RETURN,
67
+ NODE_YIELD,
68
+ NODE_LVAR,
69
+ NODE_DVAR,
70
+ NODE_GVAR,
71
+ NODE_IVAR,
72
+ NODE_CONST,
73
+ NODE_CVAR,
74
+ NODE_NTH_REF,
75
+ NODE_BACK_REF,
76
+ NODE_MATCH,
77
+ NODE_MATCH2,
78
+ NODE_MATCH3,
79
+ NODE_LIT,
80
+ NODE_STR,
81
+ NODE_DSTR,
82
+ NODE_XSTR,
83
+ NODE_DXSTR,
84
+ NODE_EVSTR,
85
+ NODE_DREGX,
86
+ NODE_DREGX_ONCE,
87
+ NODE_ARGS,
88
+ NODE_ARGSCAT,
89
+ NODE_ARGSPUSH,
90
+ NODE_SPLAT,
91
+ NODE_TO_ARY,
92
+ NODE_SVALUE,
93
+ NODE_BLOCK_ARG,
94
+ NODE_BLOCK_PASS,
95
+ NODE_DEFN,
96
+ NODE_DEFS,
97
+ NODE_ALIAS,
98
+ NODE_VALIAS,
99
+ NODE_UNDEF,
100
+ NODE_CLASS,
101
+ NODE_MODULE,
102
+ NODE_SCLASS,
103
+ NODE_COLON2,
104
+ NODE_COLON3,
105
+ NODE_CREF,
106
+ NODE_DOT2,
107
+ NODE_DOT3,
108
+ NODE_FLIP2,
109
+ NODE_FLIP3,
110
+ NODE_ATTRSET,
111
+ NODE_SELF,
112
+ NODE_NIL,
113
+ NODE_TRUE,
114
+ NODE_FALSE,
115
+ NODE_DEFINED,
116
+ NODE_NEWLINE,
117
+ NODE_POSTEXE,
118
+ NODE_ALLOCA,
119
+ NODE_DMETHOD,
120
+ NODE_BMETHOD,
121
+ NODE_MEMO,
122
+ NODE_IFUNC,
123
+ NODE_DSYM,
124
+ NODE_ATTRASGN,
125
+ NODE_LAST
126
+ };
127
+
128
+ typedef struct RNode {
129
+ unsigned long flags;
130
+ char *nd_file;
131
+ union {
132
+ struct RNode *node;
133
+ ID id;
134
+ VALUE value;
135
+ VALUE (*cfunc)(ANYARGS);
136
+ ID *tbl;
137
+ } u1;
138
+ union {
139
+ struct RNode *node;
140
+ ID id;
141
+ long argc;
142
+ VALUE value;
143
+ } u2;
144
+ union {
145
+ struct RNode *node;
146
+ ID id;
147
+ long state;
148
+ struct global_entry *entry;
149
+ long cnt;
150
+ VALUE value;
151
+ } u3;
152
+ } NODE;
153
+
154
+ #define RNODE(obj) (R_CAST(RNode)(obj))
155
+
156
+ #define nd_type(n) ((int)(((RNODE(n))->flags>>FL_USHIFT)&0xff))
157
+ #define nd_set_type(n,t) \
158
+ RNODE(n)->flags=((RNODE(n)->flags&~FL_UMASK)|(((t)<<FL_USHIFT)&FL_UMASK))
159
+
160
+ #define NODE_LSHIFT (FL_USHIFT+8)
161
+ #define NODE_LMASK (((long)1<<(sizeof(NODE*)*CHAR_BIT-NODE_LSHIFT))-1)
162
+ #define nd_line(n) ((unsigned int)(((RNODE(n))->flags>>NODE_LSHIFT)&NODE_LMASK))
163
+ #define nd_set_line(n,l) \
164
+ RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
165
+
166
+ #define nd_head u1.node
167
+ #define nd_alen u2.argc
168
+ #define nd_next u3.node
169
+
170
+ #define nd_cond u1.node
171
+ #define nd_body u2.node
172
+ #define nd_else u3.node
173
+
174
+ #define nd_orig u3.value
175
+
176
+ #define nd_resq u2.node
177
+ #define nd_ensr u3.node
178
+
179
+ #define nd_1st u1.node
180
+ #define nd_2nd u2.node
181
+
182
+ #define nd_stts u1.node
183
+
184
+ #define nd_entry u3.entry
185
+ #define nd_vid u1.id
186
+ #define nd_cflag u2.id
187
+ #define nd_cval u3.value
188
+
189
+ #define nd_cnt u3.cnt
190
+ #define nd_tbl u1.tbl
191
+
192
+ #define nd_var u1.node
193
+ #define nd_ibdy u2.node
194
+ #define nd_iter u3.node
195
+
196
+ #define nd_value u2.node
197
+ #define nd_aid u3.id
198
+
199
+ #define nd_lit u1.value
200
+
201
+ #define nd_frml u1.node
202
+ #define nd_rest u2.node
203
+ #define nd_opt u1.node
204
+
205
+ #define nd_recv u1.node
206
+ #define nd_mid u2.id
207
+ #define nd_args u3.node
208
+
209
+ #define nd_noex u1.id
210
+ #define nd_defn u3.node
211
+
212
+ #define nd_cfnc u1.cfunc
213
+ #define nd_argc u2.argc
214
+
215
+ #define nd_cpath u1.node
216
+ #define nd_super u3.node
217
+
218
+ #define nd_modl u1.id
219
+ #define nd_clss u1.value
220
+
221
+ #define nd_beg u1.node
222
+ #define nd_end u2.node
223
+ #define nd_state u3.state
224
+ #define nd_rval u2.value
225
+
226
+ #define nd_nth u2.argc
227
+
228
+ #define nd_tag u1.id
229
+ #define nd_tval u2.value
230
+
231
+ #define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
232
+
233
+ #define NEW_METHOD(n,x) NEW_NODE(NODE_METHOD,x,n,0)
234
+ #define NEW_FBODY(n,i,o) NEW_NODE(NODE_FBODY,n,i,o)
235
+ #define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,p,i,NEW_RFUNC(a,d))
236
+ #define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_RFUNC(a,d))
237
+ #define NEW_CFUNC(f,c) NEW_NODE(NODE_CFUNC,f,c,0)
238
+ #define NEW_IFUNC(f,c) NEW_NODE(NODE_IFUNC,f,c,0)
239
+ #define NEW_RFUNC(b1,b2) NEW_SCOPE(block_append(b1,b2))
240
+ #define NEW_SCOPE(b) NEW_NODE(NODE_SCOPE,local_tbl(),0,(b))
241
+ #define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
242
+ #define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
243
+ #define NEW_UNLESS(c,t,e) NEW_IF(c,e,t)
244
+ #define NEW_CASE(h,b) NEW_NODE(NODE_CASE,h,b,0)
245
+ #define NEW_WHEN(c,t,e) NEW_NODE(NODE_WHEN,c,t,e)
246
+ #define NEW_OPT_N(b) NEW_NODE(NODE_OPT_N,0,b,0)
247
+ #define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
248
+ #define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
249
+ #define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
250
+ #define NEW_ITER(v,i,b) NEW_NODE(NODE_ITER,v,b,i)
251
+ #define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
252
+ #define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
253
+ #define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
254
+ #define NEW_RETRY() NEW_NODE(NODE_RETRY,0,0,0)
255
+ #define NEW_BEGIN(b) NEW_NODE(NODE_BEGIN,0,b,0)
256
+ #define NEW_RESCUE(b,res,e) NEW_NODE(NODE_RESCUE,b,res,e)
257
+ #define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
258
+ #define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
259
+ #define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
260
+ #define NEW_YIELD(a,s) NEW_NODE(NODE_YIELD,a,0,s)
261
+ #define NEW_LIST(a) NEW_ARRAY(a)
262
+ #define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
263
+ #define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
264
+ #define NEW_HASH(a) NEW_NODE(NODE_HASH,a,0,0)
265
+ #define NEW_NOT(a) NEW_NODE(NODE_NOT,0,a,0)
266
+ #define NEW_MASGN(l,r) NEW_NODE(NODE_MASGN,l,0,r)
267
+ #define NEW_GASGN(v,val) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v))
268
+ #define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,local_cnt(v))
269
+ #define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
270
+ #define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
271
+ #define NEW_IASGN(v,val) NEW_NODE(NODE_IASGN,v,val,0)
272
+ #define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
273
+ #define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
274
+ #define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
275
+ #define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
276
+ #define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
277
+ #define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset(i))
278
+ #define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
279
+ #define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
280
+ #define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v))
281
+ #define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,local_cnt(v))
282
+ #define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
283
+ #define NEW_IVAR(v) NEW_NODE(NODE_IVAR,v,0,0)
284
+ #define NEW_CONST(v) NEW_NODE(NODE_CONST,v,0,0)
285
+ #define NEW_CVAR(v) NEW_NODE(NODE_CVAR,v,0,0)
286
+ #define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,local_cnt('~'))
287
+ #define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,local_cnt('~'))
288
+ #define NEW_MATCH(c) NEW_NODE(NODE_MATCH,c,0,0)
289
+ #define NEW_MATCH2(n1,n2) NEW_NODE(NODE_MATCH2,n1,n2,0)
290
+ #define NEW_MATCH3(r,n2) NEW_NODE(NODE_MATCH3,r,n2,0)
291
+ #define NEW_LIT(l) NEW_NODE(NODE_LIT,l,0,0)
292
+ #define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
293
+ #define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,1,0)
294
+ #define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
295
+ #define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
296
+ #define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
297
+ #define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
298
+ #define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
299
+ #define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
300
+ #define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
301
+ #define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
302
+ #define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
303
+ #define NEW_ARGS(f,o,r) NEW_NODE(NODE_ARGS,o,r,f)
304
+ #define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
305
+ #define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
306
+ #define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0)
307
+ #define NEW_TO_ARY(a) NEW_NODE(NODE_TO_ARY,a,0,0)
308
+ #define NEW_SVALUE(a) NEW_NODE(NODE_SVALUE,a,0,0)
309
+ #define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v))
310
+ #define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
311
+ #define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,n,o,0)
312
+ #define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,n,o,0)
313
+ #define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0)
314
+ #define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(b),(s))
315
+ #define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(b),0)
316
+ #define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(b),0)
317
+ #define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
318
+ #define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
319
+ #define NEW_CREF(c) (NEW_NODE(NODE_CREF,0,0,c))
320
+ #define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
321
+ #define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
322
+ #define NEW_ATTRSET(a) NEW_NODE(NODE_ATTRSET,a,0,0)
323
+ #define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
324
+ #define NEW_NIL() NEW_NODE(NODE_NIL,0,0,0)
325
+ #define NEW_TRUE() NEW_NODE(NODE_TRUE,0,0,0)
326
+ #define NEW_FALSE() NEW_NODE(NODE_FALSE,0,0,0)
327
+ #define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
328
+ #define NEW_NEWLINE(n) NEW_NODE(NODE_NEWLINE,0,0,n)
329
+ #define NEW_PREEXE(b) NEW_SCOPE(b)
330
+ #define NEW_POSTEXE() NEW_NODE(NODE_POSTEXE,0,0,0)
331
+ #define NEW_DMETHOD(b) NEW_NODE(NODE_DMETHOD,0,0,b)
332
+ #define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
333
+ #define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
334
+
335
+ #define NOEX_PUBLIC 0
336
+ #define NOEX_NOSUPER 1
337
+ #define NOEX_PRIVATE 2
338
+ #define NOEX_PROTECTED 4
339
+ #define NOEX_MASK 6
340
+
341
+ #define NOEX_UNDEF NOEX_NOSUPER
342
+
343
+ NODE *rb_compile_cstr _((const char*, const char*, int, int));
344
+ NODE *rb_compile_string _((const char*, VALUE, int));
345
+ NODE *rb_compile_file _((const char*, VALUE, int));
346
+
347
+ void rb_add_method _((VALUE, ID, NODE *, int));
348
+ NODE *rb_node_newnode _((enum node_type,VALUE,VALUE,VALUE));
349
+
350
+ NODE* rb_method_node _((VALUE klass, ID id));
351
+
352
+ struct global_entry *rb_global_entry _((ID));
353
+ VALUE rb_gvar_get _((struct global_entry *));
354
+ VALUE rb_gvar_set _((struct global_entry *, VALUE));
355
+ VALUE rb_gvar_defined _((struct global_entry *));
356
+
357
+ typedef unsigned int rb_event_t;
358
+
359
+ #define RUBY_EVENT_NONE 0x00
360
+ #define RUBY_EVENT_LINE 0x01
361
+ #define RUBY_EVENT_CLASS 0x02
362
+ #define RUBY_EVENT_END 0x04
363
+ #define RUBY_EVENT_CALL 0x08
364
+ #define RUBY_EVENT_RETURN 0x10
365
+ #define RUBY_EVENT_C_CALL 0x20
366
+ #define RUBY_EVENT_C_RETURN 0x40
367
+ #define RUBY_EVENT_RAISE 0x80
368
+ #define RUBY_EVENT_ALL 0xff
369
+
370
+ typedef void (*rb_event_hook_func_t) _((rb_event_t,NODE*,VALUE,ID,VALUE));
371
+ void rb_add_event_hook _((rb_event_hook_func_t,rb_event_t));
372
+ int rb_remove_event_hook _((rb_event_hook_func_t));
373
+
374
+ #if defined(__cplusplus)
375
+ } /* extern "C" { */
376
+ #endif
377
+
378
+ #endif