rubynode 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/Changelog +5 -0
  2. data/README +2 -3
  3. data/doc/index.html +2 -3
  4. data/ext/rubynode_ext/extconf.rb +15 -6
  5. data/ext/rubynode_ext/ruby_src/{1.8.6_2007-03-13 → 061ef3a38d01ac9917e7aaff0bc5ff6be60becf3}/eval.c +0 -0
  6. data/ext/rubynode_ext/ruby_src/{1.8.6_2007-03-13 → 061ef3a38d01ac9917e7aaff0bc5ff6be60becf3}/gc.c +0 -0
  7. data/ext/rubynode_ext/ruby_src/{1.8.5_2006-08-25 → 4bfe0d24de6089aca6af9bf4d690df7a7f481276}/eval.c +0 -0
  8. data/ext/rubynode_ext/ruby_src/{1.8.5_2006-08-25 → 4bfe0d24de6089aca6af9bf4d690df7a7f481276}/gc.c +0 -0
  9. data/ext/rubynode_ext/ruby_src/{1.8.6_2007-06-07 → d03d2652e0a6a8ae8bd0575d58f0c093d97d694d}/eval.c +0 -0
  10. data/ext/rubynode_ext/ruby_src/{1.8.6_2007-06-07 → d03d2652e0a6a8ae8bd0575d58f0c093d97d694d}/gc.c +0 -0
  11. data/ext/rubynode_ext/ruby_src/{1.8.4_2005-12-24 → d0efe17fed21c8d9954851abd9dab16fac1e35b8}/eval.c +0 -0
  12. data/ext/rubynode_ext/ruby_src/{1.8.4_2005-12-24 → d0efe17fed21c8d9954851abd9dab16fac1e35b8}/gc.c +0 -0
  13. data/ext/rubynode_ext/rubynode_ext.c +2 -2
  14. data/lib/rubynode.rb +1 -1
  15. metadata +14 -42
  16. data/ext/rubynode_ext/ruby_src/1.8.4_2005-12-24/node.h +0 -381
  17. data/ext/rubynode_ext/ruby_src/1.8.5_2006-08-25/node.h +0 -378
  18. data/ext/rubynode_ext/ruby_src/1.8.5_2006-12-04/eval.c +0 -44
  19. data/ext/rubynode_ext/ruby_src/1.8.5_2006-12-04/gc.c +0 -272
  20. data/ext/rubynode_ext/ruby_src/1.8.5_2006-12-04/node.h +0 -378
  21. data/ext/rubynode_ext/ruby_src/1.8.5_2006-12-25/eval.c +0 -44
  22. data/ext/rubynode_ext/ruby_src/1.8.5_2006-12-25/gc.c +0 -272
  23. data/ext/rubynode_ext/ruby_src/1.8.5_2006-12-25/node.h +0 -378
  24. data/ext/rubynode_ext/ruby_src/1.8.5_2007-03-13/eval.c +0 -44
  25. data/ext/rubynode_ext/ruby_src/1.8.5_2007-03-13/gc.c +0 -272
  26. data/ext/rubynode_ext/ruby_src/1.8.5_2007-03-13/node.h +0 -378
  27. data/ext/rubynode_ext/ruby_src/1.8.5_2007-06-07/eval.c +0 -44
  28. data/ext/rubynode_ext/ruby_src/1.8.5_2007-06-07/gc.c +0 -272
  29. data/ext/rubynode_ext/ruby_src/1.8.5_2007-06-07/node.h +0 -378
  30. data/ext/rubynode_ext/ruby_src/1.8.5_2007-09-24/eval.c +0 -44
  31. data/ext/rubynode_ext/ruby_src/1.8.5_2007-09-24/gc.c +0 -272
  32. data/ext/rubynode_ext/ruby_src/1.8.5_2007-09-24/node.h +0 -378
  33. data/ext/rubynode_ext/ruby_src/1.8.6_2007-03-13/node.h +0 -474
  34. data/ext/rubynode_ext/ruby_src/1.8.6_2007-06-07/node.h +0 -474
  35. data/ext/rubynode_ext/ruby_src/1.8.6_2007-09-24/eval.c +0 -44
  36. data/ext/rubynode_ext/ruby_src/1.8.6_2007-09-24/gc.c +0 -272
  37. data/ext/rubynode_ext/ruby_src/1.8.6_2007-09-24/node.h +0 -474
data/Changelog CHANGED
@@ -1,5 +1,10 @@
1
1
  Changelog
2
2
 
3
+ -- 0.1.5
4
+
5
+ * Implement more flexible version detection based on the SHA1 digest of node.h
6
+ * Fix a possible segfault with OP_ASGN2 nodes (reported by Kirill A. Shutemov)
7
+
3
8
  -- 0.1.4
4
9
 
5
10
  * Out of the box 1.8.5-p114 and 1.8.6-p111 support
data/README CHANGED
@@ -17,7 +17,7 @@ Requirements
17
17
  RubyNode is tested with Ruby 1.8.4, 1.8.5 and 1.8.6, but it should also work
18
18
  with other 1.8 versions. RubyNode worked (and still does work) with older Ruby
19
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
+ currently does not work with the latest 1.9 snapshots and releases.
21
21
 
22
22
 
23
23
  Installation
@@ -26,8 +26,7 @@ Installation
26
26
  RubyNode generates some of its C source code from Ruby's source code, because
27
27
  the node types and other details differ between Ruby versions.
28
28
 
29
- For the official releases of Ruby 1.8.4, 1.8.5 (including patchlevels 2, 12,
30
- 35, 52 and 114) and 1.8.6 (including patchlevel 36 and 111) the needed source
29
+ For the official releases of Ruby 1.8.4, 1.8.5 and 1.8.6 the needed source
31
30
  files are included in the package. To compile RubyNode for any other Ruby
32
31
  version, you will need that version's source tar ball extracted somewhere.
33
32
 
@@ -27,7 +27,7 @@ s-expressions), which are easy to manipulate and work with.</p>
27
27
  <p>RubyNode is tested with Ruby 1.8.4, 1.8.5 and 1.8.6, but it should also work
28
28
  with other 1.8 versions. RubyNode worked (and still does work) with older Ruby
29
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
+ currently does not work with the latest 1.9 snapshots and releases.</p>
31
31
 
32
32
 
33
33
  <h2 id="section2">Download</h2>
@@ -46,8 +46,7 @@ currently does not work with the latest 1.9 snapshots.</p>
46
46
  the node types and other details differ between Ruby versions.</p>
47
47
 
48
48
 
49
- <p>For the official releases of Ruby 1.8.4, 1.8.5 (including patchlevels 2, 12,
50
- 35, 52 and 114) and 1.8.6 (including patchlevel 36 and 111) the needed source
49
+ <p>For the official releases of Ruby 1.8.4, 1.8.5 and 1.8.6 the needed source
51
50
  files are included in the package. To compile RubyNode for any other Ruby
52
51
  version, you will need that version&#8217;s source tar ball extracted somewhere.</p>
53
52
 
@@ -1,4 +1,5 @@
1
1
  require "mkmf"
2
+ require "digest/sha1"
2
3
 
3
4
  def ruby_source_dir_error(extra = nil)
4
5
  warn "==================== ERROR ====================="
@@ -12,19 +13,27 @@ def ruby_source_dir_error(extra = nil)
12
13
  end
13
14
 
14
15
  begin
15
- $rbsrcdir = ENV["RUBY_SOURCE_DIR"] || File.join(File.dirname(__FILE__), "ruby_src/#{RUBY_VERSION}_#{RUBY_RELEASE_DATE}")
16
+ # read node.h from installed ruby
17
+ node_h = IO.read(File.join($hdrdir, "node.h"))
18
+ # digest it
19
+ node_h_digest = Digest::SHA1.hexdigest(node_h)
20
+
21
+ $rbsrcdir = ENV["RUBY_SOURCE_DIR"] || File.join(File.dirname(__FILE__), "ruby_src/#{node_h_digest}")
16
22
 
17
23
  unless File.directory? $rbsrcdir
18
24
  ruby_source_dir_error
19
25
  end
20
26
 
21
- node_h = IO.read(File.join($rbsrcdir, "node.h"))
27
+ # read gc.c and eval.c from $rbsrcdir
22
28
  gc_c = IO.read(File.join($rbsrcdir, "gc.c"))
23
29
  eval_c = IO.read(File.join($rbsrcdir, "eval.c"))
24
- # check if $hdrdir is "compatible" with $rbsrcdir
25
- unless node_h == IO.read(File.join($hdrdir, "node.h"))
26
- ruby_source_dir_error(File.join($hdrdir, "node.h") +
27
- "\nis different from\n" + File.join($rbsrcdir, "node.h"))
30
+
31
+ if ENV["RUBY_SOURCE_DIR"]
32
+ # if RUBY_SOURCE_DIR was set, check if it is actually "compatible" with $hdrdir
33
+ unless node_h == IO.read(File.join($rbsrcdir, "node.h"))
34
+ ruby_source_dir_error(File.join($hdrdir, "node.h") +
35
+ "\nis different from\n" + File.join($rbsrcdir, "node.h"))
36
+ end
28
37
  end
29
38
 
30
39
  raise "node.h does not contain 'enum node_type'" unless node_h =~ /enum node_type \{(.*?)\};/m
@@ -101,10 +101,10 @@ static VALUE value_or_node_to_value(VALUE val, enum node_type nd_type, int union
101
101
  if (union_idx == 1) break;
102
102
  else return Qnil;
103
103
  case NODE_OP_ASGN2:
104
- /* either 3 ids: nd_vid, nd_mid, nd_aid
104
+ /* either 3 ids: nd_vid, nd_mid, nd_aid (actually nd_mid might be 0 or 1 instead of an id)
105
105
  * or 3 values: nd_recv, nd_value, nd_next
106
106
  */
107
- if (rb_id2name(node->nd_vid) && rb_id2name(node->nd_mid) && rb_id2name(node->nd_aid))
107
+ if (rb_id2name(node->nd_vid) && id_to_value(node->nd_mid) != Qnil && rb_id2name(node->nd_aid))
108
108
  return Qnil;
109
109
  else break;
110
110
  #ifdef HAVE_NODE_PRELUDE
@@ -3,7 +3,7 @@ require "rubynode_ext"
3
3
 
4
4
  class RubyNode
5
5
 
6
- VERSION = "0.1.4"
6
+ VERSION = "0.1.5"
7
7
 
8
8
  NODE_ATTRIBS = {
9
9
  :alias =>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubynode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Bathon
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2007-12-05 00:00:00 +01:00
12
+ date: 2008-02-14 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -24,46 +24,18 @@ extra_rdoc_files: []
24
24
  files:
25
25
  - ext/rubynode_ext
26
26
  - ext/rubynode_ext/ruby_src
27
- - ext/rubynode_ext/ruby_src/1.8.4_2005-12-24
28
- - ext/rubynode_ext/ruby_src/1.8.4_2005-12-24/gc.c
29
- - ext/rubynode_ext/ruby_src/1.8.4_2005-12-24/eval.c
30
- - ext/rubynode_ext/ruby_src/1.8.4_2005-12-24/node.h
31
- - ext/rubynode_ext/ruby_src/1.8.5_2006-08-25
32
- - ext/rubynode_ext/ruby_src/1.8.5_2006-08-25/gc.c
33
- - ext/rubynode_ext/ruby_src/1.8.5_2006-08-25/eval.c
34
- - ext/rubynode_ext/ruby_src/1.8.5_2006-08-25/node.h
35
- - ext/rubynode_ext/ruby_src/1.8.5_2006-12-04
36
- - ext/rubynode_ext/ruby_src/1.8.5_2006-12-04/gc.c
37
- - ext/rubynode_ext/ruby_src/1.8.5_2006-12-04/eval.c
38
- - ext/rubynode_ext/ruby_src/1.8.5_2006-12-04/node.h
39
- - ext/rubynode_ext/ruby_src/1.8.5_2006-12-25
40
- - ext/rubynode_ext/ruby_src/1.8.5_2006-12-25/gc.c
41
- - ext/rubynode_ext/ruby_src/1.8.5_2006-12-25/eval.c
42
- - ext/rubynode_ext/ruby_src/1.8.5_2006-12-25/node.h
43
- - ext/rubynode_ext/ruby_src/1.8.5_2007-03-13
44
- - ext/rubynode_ext/ruby_src/1.8.5_2007-03-13/gc.c
45
- - ext/rubynode_ext/ruby_src/1.8.5_2007-03-13/eval.c
46
- - ext/rubynode_ext/ruby_src/1.8.5_2007-03-13/node.h
47
- - ext/rubynode_ext/ruby_src/1.8.5_2007-06-07
48
- - ext/rubynode_ext/ruby_src/1.8.5_2007-06-07/gc.c
49
- - ext/rubynode_ext/ruby_src/1.8.5_2007-06-07/eval.c
50
- - ext/rubynode_ext/ruby_src/1.8.5_2007-06-07/node.h
51
- - ext/rubynode_ext/ruby_src/1.8.5_2007-09-24
52
- - ext/rubynode_ext/ruby_src/1.8.5_2007-09-24/gc.c
53
- - ext/rubynode_ext/ruby_src/1.8.5_2007-09-24/eval.c
54
- - ext/rubynode_ext/ruby_src/1.8.5_2007-09-24/node.h
55
- - ext/rubynode_ext/ruby_src/1.8.6_2007-03-13
56
- - ext/rubynode_ext/ruby_src/1.8.6_2007-03-13/gc.c
57
- - ext/rubynode_ext/ruby_src/1.8.6_2007-03-13/eval.c
58
- - ext/rubynode_ext/ruby_src/1.8.6_2007-03-13/node.h
59
- - ext/rubynode_ext/ruby_src/1.8.6_2007-06-07
60
- - ext/rubynode_ext/ruby_src/1.8.6_2007-06-07/gc.c
61
- - ext/rubynode_ext/ruby_src/1.8.6_2007-06-07/eval.c
62
- - ext/rubynode_ext/ruby_src/1.8.6_2007-06-07/node.h
63
- - ext/rubynode_ext/ruby_src/1.8.6_2007-09-24
64
- - ext/rubynode_ext/ruby_src/1.8.6_2007-09-24/gc.c
65
- - ext/rubynode_ext/ruby_src/1.8.6_2007-09-24/eval.c
66
- - ext/rubynode_ext/ruby_src/1.8.6_2007-09-24/node.h
27
+ - ext/rubynode_ext/ruby_src/d0efe17fed21c8d9954851abd9dab16fac1e35b8
28
+ - ext/rubynode_ext/ruby_src/d0efe17fed21c8d9954851abd9dab16fac1e35b8/gc.c
29
+ - ext/rubynode_ext/ruby_src/d0efe17fed21c8d9954851abd9dab16fac1e35b8/eval.c
30
+ - ext/rubynode_ext/ruby_src/4bfe0d24de6089aca6af9bf4d690df7a7f481276
31
+ - ext/rubynode_ext/ruby_src/4bfe0d24de6089aca6af9bf4d690df7a7f481276/gc.c
32
+ - ext/rubynode_ext/ruby_src/4bfe0d24de6089aca6af9bf4d690df7a7f481276/eval.c
33
+ - ext/rubynode_ext/ruby_src/061ef3a38d01ac9917e7aaff0bc5ff6be60becf3
34
+ - ext/rubynode_ext/ruby_src/061ef3a38d01ac9917e7aaff0bc5ff6be60becf3/gc.c
35
+ - ext/rubynode_ext/ruby_src/061ef3a38d01ac9917e7aaff0bc5ff6be60becf3/eval.c
36
+ - ext/rubynode_ext/ruby_src/d03d2652e0a6a8ae8bd0575d58f0c093d97d694d
37
+ - ext/rubynode_ext/ruby_src/d03d2652e0a6a8ae8bd0575d58f0c093d97d694d/gc.c
38
+ - ext/rubynode_ext/ruby_src/d03d2652e0a6a8ae8bd0575d58f0c093d97d694d/eval.c
67
39
  - ext/rubynode_ext/extconf.rb
68
40
  - ext/rubynode_ext/rubynode_ext.c
69
41
  - lib/rubynode.rb
@@ -1,381 +0,0 @@
1
- /**********************************************************************
2
-
3
- node.h -
4
-
5
- $Author: nobu $
6
- $Date: 2005/10/08 09:57:12 $
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.argc
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_old u1.id
213
- #define nd_new u2.id
214
-
215
- #define nd_cfnc u1.cfunc
216
- #define nd_argc u2.argc
217
-
218
- #define nd_cpath u1.node
219
- #define nd_super u3.node
220
-
221
- #define nd_modl u1.id
222
- #define nd_clss u1.value
223
-
224
- #define nd_beg u1.node
225
- #define nd_end u2.node
226
- #define nd_state u3.state
227
- #define nd_rval u2.value
228
-
229
- #define nd_nth u2.argc
230
-
231
- #define nd_tag u1.id
232
- #define nd_tval u2.value
233
-
234
- #define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
235
-
236
- #define NEW_METHOD(n,x) NEW_NODE(NODE_METHOD,x,n,0)
237
- #define NEW_FBODY(n,i,o) NEW_NODE(NODE_FBODY,n,i,o)
238
- #define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,p,i,NEW_RFUNC(a,d))
239
- #define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_RFUNC(a,d))
240
- #define NEW_CFUNC(f,c) NEW_NODE(NODE_CFUNC,f,c,0)
241
- #define NEW_IFUNC(f,c) NEW_NODE(NODE_IFUNC,f,c,0)
242
- #define NEW_RFUNC(b1,b2) NEW_SCOPE(block_append(b1,b2))
243
- #define NEW_SCOPE(b) NEW_NODE(NODE_SCOPE,local_tbl(),0,(b))
244
- #define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
245
- #define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
246
- #define NEW_UNLESS(c,t,e) NEW_IF(c,e,t)
247
- #define NEW_CASE(h,b) NEW_NODE(NODE_CASE,h,b,0)
248
- #define NEW_WHEN(c,t,e) NEW_NODE(NODE_WHEN,c,t,e)
249
- #define NEW_OPT_N(b) NEW_NODE(NODE_OPT_N,0,b,0)
250
- #define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
251
- #define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
252
- #define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
253
- #define NEW_ITER(v,i,b) NEW_NODE(NODE_ITER,v,b,i)
254
- #define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
255
- #define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
256
- #define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
257
- #define NEW_RETRY() NEW_NODE(NODE_RETRY,0,0,0)
258
- #define NEW_BEGIN(b) NEW_NODE(NODE_BEGIN,0,b,0)
259
- #define NEW_RESCUE(b,res,e) NEW_NODE(NODE_RESCUE,b,res,e)
260
- #define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
261
- #define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
262
- #define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
263
- #define NEW_YIELD(a,s) NEW_NODE(NODE_YIELD,a,0,s)
264
- #define NEW_LIST(a) NEW_ARRAY(a)
265
- #define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
266
- #define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
267
- #define NEW_HASH(a) NEW_NODE(NODE_HASH,a,0,0)
268
- #define NEW_NOT(a) NEW_NODE(NODE_NOT,0,a,0)
269
- #define NEW_MASGN(l,r) NEW_NODE(NODE_MASGN,l,0,r)
270
- #define NEW_GASGN(v,val) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v))
271
- #define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,local_cnt(v))
272
- #define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
273
- #define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
274
- #define NEW_IASGN(v,val) NEW_NODE(NODE_IASGN,v,val,0)
275
- #define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
276
- #define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
277
- #define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
278
- #define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
279
- #define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
280
- #define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset(i))
281
- #define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
282
- #define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
283
- #define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v))
284
- #define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,local_cnt(v))
285
- #define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
286
- #define NEW_IVAR(v) NEW_NODE(NODE_IVAR,v,0,0)
287
- #define NEW_CONST(v) NEW_NODE(NODE_CONST,v,0,0)
288
- #define NEW_CVAR(v) NEW_NODE(NODE_CVAR,v,0,0)
289
- #define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,local_cnt('~'))
290
- #define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,local_cnt('~'))
291
- #define NEW_MATCH(c) NEW_NODE(NODE_MATCH,c,0,0)
292
- #define NEW_MATCH2(n1,n2) NEW_NODE(NODE_MATCH2,n1,n2,0)
293
- #define NEW_MATCH3(r,n2) NEW_NODE(NODE_MATCH3,r,n2,0)
294
- #define NEW_LIT(l) NEW_NODE(NODE_LIT,l,0,0)
295
- #define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
296
- #define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,1,0)
297
- #define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
298
- #define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
299
- #define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
300
- #define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
301
- #define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
302
- #define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
303
- #define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
304
- #define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
305
- #define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
306
- #define NEW_ARGS(f,o,r) NEW_NODE(NODE_ARGS,o,r,f)
307
- #define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
308
- #define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
309
- #define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0)
310
- #define NEW_TO_ARY(a) NEW_NODE(NODE_TO_ARY,a,0,0)
311
- #define NEW_SVALUE(a) NEW_NODE(NODE_SVALUE,a,0,0)
312
- #define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v))
313
- #define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
314
- #define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,o,n,0)
315
- #define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,o,n,0)
316
- #define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0)
317
- #define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(b),(s))
318
- #define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(b),0)
319
- #define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(b),0)
320
- #define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
321
- #define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
322
- #define NEW_CREF(c) (NEW_NODE(NODE_CREF,0,0,c))
323
- #define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
324
- #define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
325
- #define NEW_ATTRSET(a) NEW_NODE(NODE_ATTRSET,a,0,0)
326
- #define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
327
- #define NEW_NIL() NEW_NODE(NODE_NIL,0,0,0)
328
- #define NEW_TRUE() NEW_NODE(NODE_TRUE,0,0,0)
329
- #define NEW_FALSE() NEW_NODE(NODE_FALSE,0,0,0)
330
- #define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
331
- #define NEW_NEWLINE(n) NEW_NODE(NODE_NEWLINE,0,0,n)
332
- #define NEW_PREEXE(b) NEW_SCOPE(b)
333
- #define NEW_POSTEXE() NEW_NODE(NODE_POSTEXE,0,0,0)
334
- #define NEW_DMETHOD(b) NEW_NODE(NODE_DMETHOD,0,0,b)
335
- #define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
336
- #define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
337
-
338
- #define NOEX_PUBLIC 0
339
- #define NOEX_NOSUPER 1
340
- #define NOEX_PRIVATE 2
341
- #define NOEX_PROTECTED 4
342
- #define NOEX_MASK 6
343
-
344
- #define NOEX_UNDEF NOEX_NOSUPER
345
-
346
- NODE *rb_compile_cstr _((const char*, const char*, int, int));
347
- NODE *rb_compile_string _((const char*, VALUE, int));
348
- NODE *rb_compile_file _((const char*, VALUE, int));
349
-
350
- void rb_add_method _((VALUE, ID, NODE *, int));
351
- NODE *rb_node_newnode _((enum node_type,VALUE,VALUE,VALUE));
352
-
353
- NODE* rb_method_node _((VALUE klass, ID id));
354
-
355
- struct global_entry *rb_global_entry _((ID));
356
- VALUE rb_gvar_get _((struct global_entry *));
357
- VALUE rb_gvar_set _((struct global_entry *, VALUE));
358
- VALUE rb_gvar_defined _((struct global_entry *));
359
-
360
- typedef unsigned int rb_event_t;
361
-
362
- #define RUBY_EVENT_NONE 0x00
363
- #define RUBY_EVENT_LINE 0x01
364
- #define RUBY_EVENT_CLASS 0x02
365
- #define RUBY_EVENT_END 0x04
366
- #define RUBY_EVENT_CALL 0x08
367
- #define RUBY_EVENT_RETURN 0x10
368
- #define RUBY_EVENT_C_CALL 0x20
369
- #define RUBY_EVENT_C_RETURN 0x40
370
- #define RUBY_EVENT_RAISE 0x80
371
- #define RUBY_EVENT_ALL 0xff
372
-
373
- typedef void (*rb_event_hook_func_t) _((rb_event_t,NODE*,VALUE,ID,VALUE));
374
- void rb_add_event_hook _((rb_event_hook_func_t,rb_event_t));
375
- int rb_remove_event_hook _((rb_event_hook_func_t));
376
-
377
- #if defined(__cplusplus)
378
- } /* extern "C" { */
379
- #endif
380
-
381
- #endif