binding_of_caller 0.7.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +5 -5
  2. data/.gemtest +0 -0
  3. data/.github/workflows/test.yml +108 -0
  4. data/.gitignore +12 -7
  5. data/.yardopts +0 -0
  6. data/Gemfile +6 -1
  7. data/LICENSE +0 -0
  8. data/README.md +17 -5
  9. data/Rakefile +4 -132
  10. data/binding_of_caller.gemspec +33 -35
  11. data/lib/binding_of_caller/jruby_interpreted.rb +123 -0
  12. data/lib/binding_of_caller/{mri2.rb → mri.rb} +8 -14
  13. data/lib/binding_of_caller/rubinius.rb +21 -28
  14. data/lib/binding_of_caller/version.rb +1 -1
  15. data/lib/binding_of_caller.rb +9 -10
  16. metadata +33 -109
  17. data/.travis.yml +0 -23
  18. data/HISTORY +0 -0
  19. data/examples/example.rb +0 -41
  20. data/ext/binding_of_caller/binding_of_caller.c +0 -225
  21. data/ext/binding_of_caller/extconf.rb +0 -33
  22. data/ext/binding_of_caller/ruby_headers/192/debug.h +0 -36
  23. data/ext/binding_of_caller/ruby_headers/192/dln.h +0 -41
  24. data/ext/binding_of_caller/ruby_headers/192/eval_intern.h +0 -232
  25. data/ext/binding_of_caller/ruby_headers/192/id.h +0 -173
  26. data/ext/binding_of_caller/ruby_headers/192/iseq.h +0 -104
  27. data/ext/binding_of_caller/ruby_headers/192/method.h +0 -103
  28. data/ext/binding_of_caller/ruby_headers/192/node.h +0 -483
  29. data/ext/binding_of_caller/ruby_headers/192/regenc.h +0 -211
  30. data/ext/binding_of_caller/ruby_headers/192/regint.h +0 -841
  31. data/ext/binding_of_caller/ruby_headers/192/regparse.h +0 -354
  32. data/ext/binding_of_caller/ruby_headers/192/rubys_gc.h +0 -77
  33. data/ext/binding_of_caller/ruby_headers/192/thread_pthread.h +0 -27
  34. data/ext/binding_of_caller/ruby_headers/192/thread_win32.h +0 -33
  35. data/ext/binding_of_caller/ruby_headers/192/timev.h +0 -21
  36. data/ext/binding_of_caller/ruby_headers/192/transcode_data.h +0 -109
  37. data/ext/binding_of_caller/ruby_headers/192/version.h +0 -55
  38. data/ext/binding_of_caller/ruby_headers/192/vm_core.h +0 -703
  39. data/ext/binding_of_caller/ruby_headers/192/vm_exec.h +0 -184
  40. data/ext/binding_of_caller/ruby_headers/192/vm_insnhelper.h +0 -208
  41. data/ext/binding_of_caller/ruby_headers/192/vm_opts.h +0 -51
  42. data/ext/binding_of_caller/ruby_headers/193/addr2line.h +0 -21
  43. data/ext/binding_of_caller/ruby_headers/193/atomic.h +0 -56
  44. data/ext/binding_of_caller/ruby_headers/193/constant.h +0 -34
  45. data/ext/binding_of_caller/ruby_headers/193/debug.h +0 -41
  46. data/ext/binding_of_caller/ruby_headers/193/dln.h +0 -50
  47. data/ext/binding_of_caller/ruby_headers/193/encdb.h +0 -167
  48. data/ext/binding_of_caller/ruby_headers/193/eval_intern.h +0 -234
  49. data/ext/binding_of_caller/ruby_headers/193/id.h +0 -175
  50. data/ext/binding_of_caller/ruby_headers/193/internal.h +0 -227
  51. data/ext/binding_of_caller/ruby_headers/193/iseq.h +0 -125
  52. data/ext/binding_of_caller/ruby_headers/193/method.h +0 -105
  53. data/ext/binding_of_caller/ruby_headers/193/node.h +0 -503
  54. data/ext/binding_of_caller/ruby_headers/193/parse.h +0 -186
  55. data/ext/binding_of_caller/ruby_headers/193/regenc.h +0 -219
  56. data/ext/binding_of_caller/ruby_headers/193/regint.h +0 -851
  57. data/ext/binding_of_caller/ruby_headers/193/regparse.h +0 -362
  58. data/ext/binding_of_caller/ruby_headers/193/revision.h +0 -1
  59. data/ext/binding_of_caller/ruby_headers/193/rubys_gc.h +0 -98
  60. data/ext/binding_of_caller/ruby_headers/193/thread_pthread.h +0 -51
  61. data/ext/binding_of_caller/ruby_headers/193/thread_win32.h +0 -40
  62. data/ext/binding_of_caller/ruby_headers/193/timev.h +0 -21
  63. data/ext/binding_of_caller/ruby_headers/193/transcode_data.h +0 -117
  64. data/ext/binding_of_caller/ruby_headers/193/transdb.h +0 -189
  65. data/ext/binding_of_caller/ruby_headers/193/version.h +0 -52
  66. data/ext/binding_of_caller/ruby_headers/193/vm_core.h +0 -755
  67. data/ext/binding_of_caller/ruby_headers/193/vm_exec.h +0 -184
  68. data/ext/binding_of_caller/ruby_headers/193/vm_insnhelper.h +0 -220
  69. data/ext/binding_of_caller/ruby_headers/193/vm_opts.h +0 -51
  70. data/test/test_binding_of_caller.rb +0 -161
@@ -1,14 +1,13 @@
1
- dlext = RbConfig::CONFIG['DLEXT']
1
+ require "binding_of_caller/version"
2
2
 
3
- def mri_2?
4
- defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" &&
5
- RUBY_VERSION =~ /^2/
6
- end
7
-
8
- if mri_2?
9
- require 'binding_of_caller/mri2'
10
- elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby"
11
- require "binding_of_caller.#{dlext}"
3
+ if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby"
4
+ if RUBY_VERSION =~ /^[23]/
5
+ require 'binding_of_caller/mri'
6
+ else
7
+ puts "This version of binding_of_caller doesn't support this version of Ruby"
8
+ end
12
9
  elsif defined?(Rubinius)
13
10
  require 'binding_of_caller/rubinius'
11
+ elsif defined?(JRuby)
12
+ require 'binding_of_caller/jruby_interpreted'
14
13
  end
metadata CHANGED
@@ -1,154 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binding_of_caller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mair (banisterfiend)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-07 00:00:00.000000000 Z
11
+ date: 2024-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debug_inspector
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.1
19
+ version: 1.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.1
27
- - !ruby/object:Gem::Dependency
28
- name: bacon
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- description: Retrieve the binding of a method's caller. Can also retrieve bindings
56
- even further up the stack.
57
- email: jrmair@gmail.com
26
+ version: 1.2.0
27
+ description: |
28
+ Provides the Binding#of_caller method.
29
+
30
+ Using binding_of_caller we can grab bindings from higher up the call stack and evaluate code in that context.
31
+ Allows access to bindings arbitrarily far up the call stack, not limited to just the immediate caller.
32
+
33
+ Recommended for use only in debugging situations. Do not use this in production apps.
34
+ email:
35
+ - jrmair@gmail.com
58
36
  executables: []
59
- extensions:
60
- - ext/binding_of_caller/extconf.rb
37
+ extensions: []
61
38
  extra_rdoc_files: []
62
39
  files:
63
- - .gemtest
64
- - .gitignore
65
- - .travis.yml
66
- - .yardopts
40
+ - ".gemtest"
41
+ - ".github/workflows/test.yml"
42
+ - ".gitignore"
43
+ - ".yardopts"
67
44
  - Gemfile
68
- - HISTORY
69
45
  - LICENSE
70
46
  - README.md
71
47
  - Rakefile
72
48
  - binding_of_caller.gemspec
73
- - examples/example.rb
74
- - ext/binding_of_caller/binding_of_caller.c
75
- - ext/binding_of_caller/extconf.rb
76
- - ext/binding_of_caller/ruby_headers/192/debug.h
77
- - ext/binding_of_caller/ruby_headers/192/dln.h
78
- - ext/binding_of_caller/ruby_headers/192/eval_intern.h
79
- - ext/binding_of_caller/ruby_headers/192/id.h
80
- - ext/binding_of_caller/ruby_headers/192/iseq.h
81
- - ext/binding_of_caller/ruby_headers/192/method.h
82
- - ext/binding_of_caller/ruby_headers/192/node.h
83
- - ext/binding_of_caller/ruby_headers/192/regenc.h
84
- - ext/binding_of_caller/ruby_headers/192/regint.h
85
- - ext/binding_of_caller/ruby_headers/192/regparse.h
86
- - ext/binding_of_caller/ruby_headers/192/rubys_gc.h
87
- - ext/binding_of_caller/ruby_headers/192/thread_pthread.h
88
- - ext/binding_of_caller/ruby_headers/192/thread_win32.h
89
- - ext/binding_of_caller/ruby_headers/192/timev.h
90
- - ext/binding_of_caller/ruby_headers/192/transcode_data.h
91
- - ext/binding_of_caller/ruby_headers/192/version.h
92
- - ext/binding_of_caller/ruby_headers/192/vm_core.h
93
- - ext/binding_of_caller/ruby_headers/192/vm_exec.h
94
- - ext/binding_of_caller/ruby_headers/192/vm_insnhelper.h
95
- - ext/binding_of_caller/ruby_headers/192/vm_opts.h
96
- - ext/binding_of_caller/ruby_headers/193/addr2line.h
97
- - ext/binding_of_caller/ruby_headers/193/atomic.h
98
- - ext/binding_of_caller/ruby_headers/193/constant.h
99
- - ext/binding_of_caller/ruby_headers/193/debug.h
100
- - ext/binding_of_caller/ruby_headers/193/dln.h
101
- - ext/binding_of_caller/ruby_headers/193/encdb.h
102
- - ext/binding_of_caller/ruby_headers/193/eval_intern.h
103
- - ext/binding_of_caller/ruby_headers/193/id.h
104
- - ext/binding_of_caller/ruby_headers/193/internal.h
105
- - ext/binding_of_caller/ruby_headers/193/iseq.h
106
- - ext/binding_of_caller/ruby_headers/193/method.h
107
- - ext/binding_of_caller/ruby_headers/193/node.h
108
- - ext/binding_of_caller/ruby_headers/193/parse.h
109
- - ext/binding_of_caller/ruby_headers/193/regenc.h
110
- - ext/binding_of_caller/ruby_headers/193/regint.h
111
- - ext/binding_of_caller/ruby_headers/193/regparse.h
112
- - ext/binding_of_caller/ruby_headers/193/revision.h
113
- - ext/binding_of_caller/ruby_headers/193/rubys_gc.h
114
- - ext/binding_of_caller/ruby_headers/193/thread_pthread.h
115
- - ext/binding_of_caller/ruby_headers/193/thread_win32.h
116
- - ext/binding_of_caller/ruby_headers/193/timev.h
117
- - ext/binding_of_caller/ruby_headers/193/transcode_data.h
118
- - ext/binding_of_caller/ruby_headers/193/transdb.h
119
- - ext/binding_of_caller/ruby_headers/193/version.h
120
- - ext/binding_of_caller/ruby_headers/193/vm_core.h
121
- - ext/binding_of_caller/ruby_headers/193/vm_exec.h
122
- - ext/binding_of_caller/ruby_headers/193/vm_insnhelper.h
123
- - ext/binding_of_caller/ruby_headers/193/vm_opts.h
124
49
  - lib/binding_of_caller.rb
125
- - lib/binding_of_caller/mri2.rb
50
+ - lib/binding_of_caller/jruby_interpreted.rb
51
+ - lib/binding_of_caller/mri.rb
126
52
  - lib/binding_of_caller/rubinius.rb
127
53
  - lib/binding_of_caller/version.rb
128
- - test/test_binding_of_caller.rb
129
- homepage: http://github.com/banister/binding_of_caller
130
- licenses: []
131
- metadata: {}
54
+ homepage: https://github.com/banister/binding_of_caller
55
+ licenses:
56
+ - MIT
57
+ metadata:
58
+ changelog_uri: https://github.com/banister/binding_of_caller/releases
132
59
  post_install_message:
133
60
  rdoc_options: []
134
61
  require_paths:
135
62
  - lib
136
63
  required_ruby_version: !ruby/object:Gem::Requirement
137
64
  requirements:
138
- - - '>='
65
+ - - ">="
139
66
  - !ruby/object:Gem::Version
140
- version: '0'
67
+ version: 2.0.0
141
68
  required_rubygems_version: !ruby/object:Gem::Requirement
142
69
  requirements:
143
- - - '>='
70
+ - - ">="
144
71
  - !ruby/object:Gem::Version
145
72
  version: '0'
146
73
  requirements: []
147
- rubyforge_project:
148
- rubygems_version: 2.0.3
74
+ rubygems_version: 3.0.3.1
149
75
  signing_key:
150
76
  specification_version: 4
151
- summary: Retrieve the binding of a method's caller. Can also retrieve bindings even
152
- further up the stack.
153
- test_files:
154
- - test/test_binding_of_caller.rb
77
+ summary: Retrieve the binding of a method's caller, or further up the stack.
78
+ test_files: []
data/.travis.yml DELETED
@@ -1,23 +0,0 @@
1
- rvm:
2
- - 1.9.2
3
- - 1.9.3
4
- - 2.0.0
5
- - rbx-19mode
6
-
7
- notifications:
8
- irc: "irc.freenode.org#pry"
9
- recipients:
10
- - jrmair@gmail.com
11
-
12
- branches:
13
- only:
14
- - master
15
-
16
- #script: rake test --trace
17
- #
18
- #before_install:
19
- # - gem update --system
20
- # - gem --version
21
- # - gem install rake bacon
22
- # - rake gem
23
- # - gem install pkg/*.gem
data/HISTORY DELETED
File without changes
data/examples/example.rb DELETED
@@ -1,41 +0,0 @@
1
- unless Object.const_defined? :BindingOfCaller
2
- $:.unshift File.expand_path '../../lib', __FILE__
3
- require 'binding_of_caller'
4
- require 'binding_of_caller/version'
5
- end
6
-
7
- outer = 10
8
-
9
- class Z
10
- def z
11
- u = 10
12
- A.new.a
13
- end
14
- end
15
-
16
- class A
17
- def a
18
- y = 10
19
- B.new.b
20
- end
21
- end
22
-
23
- class B
24
- def b
25
- x = 10
26
- puts binding.of_caller(0).eval('local_variables')
27
- puts binding.of_caller(1).eval('local_variables')
28
- puts binding.of_caller(2).eval('local_variables')
29
- puts binding.of_caller(3).eval('local_variables')
30
- puts binding.of_caller(400).eval('local_variables')
31
- end
32
- end
33
-
34
- Z.new.z
35
-
36
- # output:
37
- # => x
38
- # => y
39
- # => u
40
- # => outer
41
- # Exception
@@ -1,225 +0,0 @@
1
- /* (c) 2011 John Mair (banisterfiend), MIT license */
2
-
3
- #include <ruby.h>
4
- #include "vm_core.h"
5
- #include "rubys_gc.h"
6
-
7
- typedef enum { false, true } bool;
8
-
9
- static VALUE
10
- string2sym(const char * string)
11
- {
12
- return ID2SYM(rb_intern(string));
13
- }
14
-
15
- static inline const rb_data_type_t *
16
- threadptr_data_type(void)
17
- {
18
- static const rb_data_type_t *thread_data_type;
19
- if (!thread_data_type) {
20
- VALUE current_thread = rb_thread_current();
21
- thread_data_type = RTYPEDDATA_TYPE(current_thread);
22
- }
23
- return thread_data_type;
24
- }
25
-
26
- #define ruby_thread_data_type *threadptr_data_type()
27
- #define ruby_threadptr_data_type *threadptr_data_type()
28
-
29
- #define ruby_current_thread ((rb_thread_t *)RTYPEDDATA_DATA(rb_thread_current()))
30
-
31
- static size_t
32
- binding_memsize(const void *ptr)
33
- {
34
- return ptr ? sizeof(rb_binding_t) : 0;
35
- }
36
-
37
- static void
38
- binding_free(void *ptr)
39
- {
40
- rb_binding_t *bind;
41
- RUBY_FREE_ENTER("binding");
42
- if (ptr) {
43
- bind = ptr;
44
- ruby_xfree(ptr);
45
- }
46
- RUBY_FREE_LEAVE("binding");
47
- }
48
-
49
- static void
50
- binding_mark(void *ptr)
51
- {
52
- rb_binding_t *bind;
53
- RUBY_MARK_ENTER("binding");
54
- if (ptr) {
55
- bind = ptr;
56
- RUBY_MARK_UNLESS_NULL(bind->env);
57
-
58
- #ifdef RUBY_192
59
- RUBY_MARK_UNLESS_NULL(bind->filename);
60
- #endif
61
-
62
- }
63
- RUBY_MARK_LEAVE("binding");
64
- }
65
-
66
- static const rb_data_type_t binding_data_type = {
67
- "binding",
68
- binding_mark,
69
- binding_free,
70
- binding_memsize,
71
- };
72
-
73
- static VALUE
74
- binding_alloc(VALUE klass)
75
- {
76
- VALUE obj;
77
- rb_binding_t *bind;
78
- obj = TypedData_Make_Struct(klass, rb_binding_t, &binding_data_type, bind);
79
- return obj;
80
- }
81
-
82
- static bool ifunc_p(rb_control_frame_t * cfp) {
83
- return (cfp->flag & VM_FRAME_MAGIC_MASK) == VM_FRAME_MAGIC_IFUNC;
84
- }
85
-
86
- static bool valid_frame_p(rb_control_frame_t * cfp, rb_control_frame_t * limit_cfp) {
87
- return cfp->iseq && !ifunc_p(cfp) && !NIL_P(cfp->self);
88
- }
89
-
90
- static rb_control_frame_t * find_valid_frame(rb_control_frame_t * cfp, rb_control_frame_t * limit_cfp) {
91
- while (cfp < limit_cfp) {
92
- cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
93
-
94
- if (cfp >= limit_cfp)
95
- return NULL;
96
-
97
- if (valid_frame_p(cfp, limit_cfp))
98
- return cfp;
99
- }
100
-
101
- // beyond end of stack
102
- return NULL;
103
- }
104
-
105
- static VALUE
106
- frametype_name(VALUE flag)
107
- {
108
- switch (flag & VM_FRAME_MAGIC_MASK) {
109
- case VM_FRAME_MAGIC_METHOD: return string2sym("method");
110
- case VM_FRAME_MAGIC_BLOCK: return string2sym("block");
111
- case VM_FRAME_MAGIC_CLASS: return string2sym("class");
112
- case VM_FRAME_MAGIC_TOP: return string2sym("top");
113
- case VM_FRAME_MAGIC_CFUNC: return string2sym("cfunc");
114
- case VM_FRAME_MAGIC_PROC: return string2sym("proc");
115
- case VM_FRAME_MAGIC_IFUNC: return string2sym("ifunc");
116
- case VM_FRAME_MAGIC_EVAL: return string2sym("eval");
117
- case VM_FRAME_MAGIC_LAMBDA: return string2sym("lambda");
118
- default:
119
- rb_raise(rb_eRuntimeError, "Unknown frame type! got flag: %d", FIX2INT(flag));
120
- }
121
- }
122
-
123
- static VALUE binding_of_caller(VALUE self, VALUE rb_level)
124
- {
125
- rb_thread_t *th;
126
- GetThreadPtr(rb_thread_current(), th);
127
-
128
- rb_control_frame_t *cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
129
- rb_control_frame_t *limit_cfp = (void *)(th->stack + th->stack_size);
130
- int level = FIX2INT(rb_level);
131
-
132
- // attempt to locate the nth parent control frame
133
- for (int i = 0; i < level; i++) {
134
- cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
135
-
136
- if (cfp >= limit_cfp)
137
- rb_raise(rb_eRuntimeError, "Invalid frame, gone beyond end of stack!");
138
-
139
- // skip invalid frames
140
- if (!valid_frame_p(cfp, limit_cfp))
141
- cfp = find_valid_frame(cfp, limit_cfp);
142
- }
143
-
144
- VALUE bindval = binding_alloc(rb_cBinding);
145
- rb_binding_t *bind;
146
-
147
- if (cfp == 0)
148
- rb_raise(rb_eRuntimeError, "Can't create Binding Object on top of Fiber.");
149
-
150
- GetBindingPtr(bindval, bind);
151
-
152
- bind->env = rb_vm_make_env_object(th, cfp);
153
- bind->filename = cfp->iseq->filename;
154
- bind->line_no = rb_vm_get_sourceline(cfp);
155
-
156
- rb_iv_set(bindval, "@frame_type", frametype_name(cfp->flag));
157
- rb_iv_set(bindval, "@frame_description", cfp->iseq->name);
158
-
159
- return bindval;
160
- }
161
-
162
- static VALUE
163
- frame_type(VALUE self)
164
- {
165
- return rb_iv_get(self, "@frame_type");
166
- }
167
-
168
- static VALUE
169
- frame_description(VALUE self)
170
- {
171
- return rb_iv_get(self, "@frame_description");
172
- }
173
-
174
- static VALUE frame_count(VALUE self)
175
- {
176
- rb_thread_t *th;
177
- GetThreadPtr(rb_thread_current(), th);
178
-
179
- rb_control_frame_t *cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
180
- rb_control_frame_t *limit_cfp = (void *)(th->stack + th->stack_size);
181
-
182
- int i = 1;
183
- while (cfp < limit_cfp) {
184
- cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
185
-
186
- if (cfp >= limit_cfp)
187
- return INT2FIX(i);
188
-
189
- // skip invalid frames
190
- if (!valid_frame_p(cfp, limit_cfp))
191
- cfp = find_valid_frame(cfp, limit_cfp);
192
-
193
- if (!cfp)
194
- break;
195
-
196
- i++;
197
- }
198
-
199
- return INT2FIX(i);
200
- }
201
-
202
- static VALUE
203
- callers(VALUE self)
204
- {
205
- VALUE ary = rb_ary_new();
206
-
207
- for (int i = 0; i < FIX2INT(frame_count(self)); i++)
208
- rb_ary_push(ary, binding_of_caller(self, INT2FIX(i)));
209
-
210
- return ary;
211
- }
212
-
213
- void
214
- Init_binding_of_caller()
215
- {
216
- VALUE mBindingOfCaller = rb_define_module("BindingOfCaller");
217
-
218
- rb_define_method(mBindingOfCaller, "of_caller", binding_of_caller, 1);
219
- rb_define_method(mBindingOfCaller, "frame_count", frame_count, 0);
220
- rb_define_method(mBindingOfCaller, "frame_type", frame_type, 0);
221
- rb_define_method(mBindingOfCaller, "frame_description", frame_description, 0);
222
- rb_define_method(mBindingOfCaller, "callers", callers, 0);
223
- rb_include_module(rb_cBinding, mBindingOfCaller);
224
- }
225
-
@@ -1,33 +0,0 @@
1
- def fake_makefile
2
- File.open(File.join(File.dirname(__FILE__), "Makefile"), "w") do |f|
3
- f.puts %[install:\n\techo "Nada."]
4
- end
5
- end
6
-
7
- def mri_2?
8
- defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" &&
9
- RUBY_VERSION =~ /^2/
10
- end
11
-
12
- def rbx?
13
- defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /rbx/
14
- end
15
-
16
- if mri_2? || rbx?
17
- fake_makefile
18
- else
19
- require 'mkmf'
20
-
21
- $CFLAGS += " -O0"
22
- $CFLAGS += " -std=c99"
23
-
24
- case RUBY_VERSION
25
- when /1.9.2/
26
- $CFLAGS += " -I./ruby_headers/192/ -DRUBY_192"
27
- when /1.9.3/
28
- $CFLAGS += " -I./ruby_headers/193/ -DRUBY_193"
29
- end
30
-
31
- create_makefile('binding_of_caller')
32
- end
33
-
@@ -1,36 +0,0 @@
1
- /**********************************************************************
2
-
3
- debug.h - YARV Debug function interface
4
-
5
- $Author$
6
- created at: 04/08/25 02:33:49 JST
7
-
8
- Copyright (C) 2004-2007 Koichi Sasada
9
-
10
- **********************************************************************/
11
-
12
- #ifndef RUBY_DEBUG_H
13
- #define RUBY_DEBUG_H
14
-
15
- #include "ruby/ruby.h"
16
- #include "node.h"
17
-
18
- #define dpv(h,v) ruby_debug_print_value(-1, 0, h, v)
19
- #define dp(v) ruby_debug_print_value(-1, 0, "", v)
20
- #define dpi(i) ruby_debug_print_id(-1, 0, "", i)
21
- #define dpn(n) ruby_debug_print_node(-1, 0, "", n)
22
-
23
- #define bp() ruby_debug_breakpoint()
24
-
25
- VALUE ruby_debug_print_value(int level, int debug_level, const char *header, VALUE v);
26
- ID ruby_debug_print_id(int level, int debug_level, const char *header, ID id);
27
- NODE *ruby_debug_print_node(int level, int debug_level, const char *header, const NODE *node);
28
- int ruby_debug_print_indent(int level, int debug_level, int indent_level);
29
- void ruby_debug_breakpoint(void);
30
- void ruby_debug_gc_check_func(void);
31
-
32
- #ifdef RUBY_DEBUG_ENV
33
- void ruby_set_debug_option(const char *str);
34
- #endif
35
-
36
- #endif /* RUBY_DEBUG_H */
@@ -1,41 +0,0 @@
1
- /**********************************************************************
2
-
3
- dln.h -
4
-
5
- $Author$
6
- created at: Wed Jan 19 16:53:09 JST 1994
7
-
8
- Copyright (C) 1993-2007 Yukihiro Matsumoto
9
-
10
- **********************************************************************/
11
-
12
- #ifndef DLN_H
13
- #define DLN_H
14
-
15
- #ifdef __cplusplus
16
- # ifndef HAVE_PROTOTYPES
17
- # define HAVE_PROTOTYPES 1
18
- # endif
19
- # ifndef HAVE_STDARG_PROTOTYPES
20
- # define HAVE_STDARG_PROTOTYPES 1
21
- # endif
22
- #endif
23
-
24
- #undef _
25
- #ifdef HAVE_PROTOTYPES
26
- # define _(args) args
27
- #else
28
- # define _(args) ()
29
- #endif
30
-
31
- DEPRECATED(char *dln_find_exe(const char*,const char*));
32
- DEPRECATED(char *dln_find_file(const char*,const char*));
33
- char *dln_find_exe_r(const char*,const char*,char*,size_t);
34
- char *dln_find_file_r(const char*,const char*,char*,size_t);
35
-
36
- #ifdef USE_DLN_A_OUT
37
- extern char *dln_argv0;
38
- #endif
39
-
40
- void *dln_load(const char*);
41
- #endif