better_caller 0.0.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +20 -0
- data/{LICENSE → LICENSE.txt} +1 -1
- data/README.textile +71 -0
- data/Rakefile +36 -0
- data/VERSION +1 -0
- data/better_caller.gemspec +94 -0
- data/ext/better_caller.c +3 -44
- data/ext/debug.h +1 -1
- data/ext/dln.h +3 -3
- data/ext/encdb.h +18 -2
- data/ext/eval_intern.h +23 -6
- data/ext/extconf.rb +1 -0
- data/ext/gc.h +6 -4
- data/ext/id.h +25 -18
- data/ext/iseq.h +10 -9
- data/ext/method.h +103 -0
- data/ext/node.h +14 -47
- data/ext/parse.h +12 -14
- data/ext/regenc.h +7 -3
- data/ext/regint.h +16 -17
- data/ext/regparse.h +4 -1
- data/ext/revision.h +1 -1
- data/ext/thread_pthread.h +4 -1
- data/ext/thread_win32.h +1 -1
- data/ext/timev.h +21 -0
- data/ext/transcode_data.h +17 -14
- data/ext/transdb.h +32 -0
- data/ext/version.h +17 -17
- data/ext/vm_core.h +105 -45
- data/ext/vm_insnhelper.h +26 -14
- data/ext/vm_opts.h +1 -1
- data/lib/better_caller/extensions.rb +14 -0
- metadata +103 -53
- data/README.rdoc +0 -69
- data/spec/better_caller_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -8
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: da7bccbac5aea167c768fb4c8b74703eb13cca8896f3718b1cfc74a1bac0b473
|
|
4
|
+
data.tar.gz: 522737eaacca956092fd04c90583ab193d1e896490987531b38cd594326056a5
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 61c3c0aff0780808e9ed72d2911146f7ef8263f9193d6d75503781f8acccb6028ec02e421f5e4f7b80f7639f8f2c8b10f1f3986c6d02ef2750085cac35b49847
|
|
7
|
+
data.tar.gz: d3ccfd79904cbac4ba9215ccf2752615835e3f183cc6405ccf805a1fb63aa61461e0beb5e4c5a5f74826ad76a352be794bb2fc4fc33d359e46884b36ba17d9e7
|
data/.document
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: http://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
RedCloth (4.2.3)
|
|
5
|
+
git (1.2.5)
|
|
6
|
+
jeweler (1.5.2)
|
|
7
|
+
bundler (~> 1.0.0)
|
|
8
|
+
git (>= 1.2.5)
|
|
9
|
+
rake
|
|
10
|
+
rake (0.8.7)
|
|
11
|
+
yard (0.6.4)
|
|
12
|
+
|
|
13
|
+
PLATFORMS
|
|
14
|
+
ruby
|
|
15
|
+
|
|
16
|
+
DEPENDENCIES
|
|
17
|
+
RedCloth
|
|
18
|
+
bundler (~> 1.0.0)
|
|
19
|
+
jeweler (~> 1.5.2)
|
|
20
|
+
yard (~> 0.6.0)
|
data/{LICENSE → LICENSE.txt}
RENAMED
data/README.textile
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
h2. ⚠️ DEPRECATED
|
|
2
|
+
|
|
3
|
+
*This gem is no longer maintained.* Ruby's modern @caller_locations@ builtin (added in 2.0) covers most use cases.
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
h1. better_caller
|
|
8
|
+
|
|
9
|
+
| *Author* | Tim Morgan |
|
|
10
|
+
| *Date* | Dec 23, 2009 |
|
|
11
|
+
| *License* | MIT (see @LICENSE.txt@ for details) |
|
|
12
|
+
|
|
13
|
+
h2. Introduction by example
|
|
14
|
+
|
|
15
|
+
Actions speak louder than words. Gone are the days of this old suckageness:
|
|
16
|
+
|
|
17
|
+
<pre><code>
|
|
18
|
+
caller #=> ["test.rb:8:in `foo'", "test.rb:16:in `<main>'"]
|
|
19
|
+
</code></pre>
|
|
20
|
+
|
|
21
|
+
With better_caller, you get this new hotness:
|
|
22
|
+
|
|
23
|
+
<pre><code>
|
|
24
|
+
require 'better_caller'
|
|
25
|
+
better_caller #=> [["test.rb", 8, :foo, #<Binding:0x000001010cae50>], ["test.rb", 16, :"<main>", #<Binding:0x000001010caef8>]]
|
|
26
|
+
</code></pre>
|
|
27
|
+
|
|
28
|
+
There are a couple of things you may notice. First of all, the okay-that's-nice
|
|
29
|
+
thing: String parsing is a thing of the past. You get the file, line, and method
|
|
30
|
+
as separate elements. This happens *at the Ruby interpreter level*.
|
|
31
|
+
|
|
32
|
+
Now, the holy-shit-that's-awesome feature: *You get bindings, all the way up
|
|
33
|
+
the stack.* Yes, that's right, you can do this:
|
|
34
|
+
|
|
35
|
+
<pre><code>
|
|
36
|
+
eval "local_variables", better_caller.first.last #=> [ :var1, :var2, :foo ]
|
|
37
|
+
</code></pre>
|
|
38
|
+
|
|
39
|
+
You also get this stuff in exception, mondo excellent for debugging:
|
|
40
|
+
|
|
41
|
+
<pre><code>
|
|
42
|
+
$!.better_backtrace # now you can figure out what your local variables were at the time of the exception!
|
|
43
|
+
</code></pre>
|
|
44
|
+
|
|
45
|
+
h2. This is horribly slow, right? You're using some @set_trace_func@ magic
|
|
46
|
+
that's going to make my Ruby 1,000,000% slower, right?
|
|
47
|
+
|
|
48
|
+
No. better_caller is a C function that uses the internal Ruby memory structures
|
|
49
|
+
to build its output. Absolutely no @set_trace_func@ and no speed hit.
|
|
50
|
+
|
|
51
|
+
h2. Super ominous alpha warning
|
|
52
|
+
|
|
53
|
+
better_caller is extremely, hyperbolically alpha right now. Here are some known
|
|
54
|
+
obstacles currently preventing it from blowing minds:
|
|
55
|
+
|
|
56
|
+
* *It only works with a very specific version of Ruby (in particular,
|
|
57
|
+
1.9.2-p136).* This is because it uses some private Ruby C functions to work
|
|
58
|
+
its magic, so it keeps a copy of some header files that you're not really
|
|
59
|
+
supposed to be using.
|
|
60
|
+
* *Storing local variables in exceptions isn't quite working yet.* Hopefully
|
|
61
|
+
I'll have a fix soon; be patient.
|
|
62
|
+
|
|
63
|
+
Despite that, it does work sometimes, and when it does, I think it rocks. If you
|
|
64
|
+
do too, please do me the honor of contributing to this project, _especially_ if
|
|
65
|
+
you're one of the three people on the planet that understand the workings of
|
|
66
|
+
Ruby frame pointers. That would be swell.
|
|
67
|
+
|
|
68
|
+
h3. Additional to-do items
|
|
69
|
+
|
|
70
|
+
* Comments
|
|
71
|
+
* Some way of doing specs?
|
data/Rakefile
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler'
|
|
3
|
+
begin
|
|
4
|
+
Bundler.setup(:default, :development)
|
|
5
|
+
rescue Bundler::BundlerError => e
|
|
6
|
+
$stderr.puts e.message
|
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
|
8
|
+
exit e.status_code
|
|
9
|
+
end
|
|
10
|
+
require 'rake'
|
|
11
|
+
|
|
12
|
+
require 'jeweler'
|
|
13
|
+
Jeweler::Tasks.new do |gem|
|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
15
|
+
gem.name = "better_caller"
|
|
16
|
+
gem.homepage = "http://github.com/RISCfuture/better_caller"
|
|
17
|
+
gem.license = "MIT"
|
|
18
|
+
gem.summary = %Q{Symbolic call stack with bindings}
|
|
19
|
+
gem.description = %Q{A more programmer-friendly call stack complete with bindings for each level: no more string parsing\!}
|
|
20
|
+
gem.email = "git@timothymorgan.info"
|
|
21
|
+
gem.authors = ["Tim Morgan"]
|
|
22
|
+
gem.extensions = [ 'ext/extconf.rb' ]
|
|
23
|
+
end
|
|
24
|
+
Jeweler::RubygemsDotOrgTasks.new
|
|
25
|
+
|
|
26
|
+
require 'yard'
|
|
27
|
+
YARD::Rake::YardocTask.new('doc') do |doc|
|
|
28
|
+
doc.options << "-m" << "textile"
|
|
29
|
+
doc.options << "--protected"
|
|
30
|
+
doc.options << "--no-private"
|
|
31
|
+
doc.options << "-r" << "README.textile"
|
|
32
|
+
doc.options << "-o" << "doc"
|
|
33
|
+
doc.options << "--title" << "better_caller Documentation".inspect
|
|
34
|
+
|
|
35
|
+
doc.files = [ 'lib/**/*', 'README.textile' ]
|
|
36
|
+
end
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.2
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = %q{better_caller}
|
|
8
|
+
s.version = "0.1.2"
|
|
9
|
+
|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
+
s.authors = ["Tim Morgan"]
|
|
12
|
+
s.date = %q{2011-01-04}
|
|
13
|
+
s.description = %q{A more programmer-friendly call stack complete with bindings for each level: no more string parsing!}
|
|
14
|
+
s.email = %q{git@timothymorgan.info}
|
|
15
|
+
s.extensions = ["ext/extconf.rb"]
|
|
16
|
+
s.extra_rdoc_files = [
|
|
17
|
+
"LICENSE.txt",
|
|
18
|
+
"README.textile"
|
|
19
|
+
]
|
|
20
|
+
s.files = [
|
|
21
|
+
".document",
|
|
22
|
+
"Gemfile",
|
|
23
|
+
"Gemfile.lock",
|
|
24
|
+
"LICENSE.txt",
|
|
25
|
+
"README.textile",
|
|
26
|
+
"Rakefile",
|
|
27
|
+
"VERSION",
|
|
28
|
+
"better_caller.gemspec",
|
|
29
|
+
"ext/better_caller.c",
|
|
30
|
+
"ext/debug.h",
|
|
31
|
+
"ext/dln.h",
|
|
32
|
+
"ext/encdb.h",
|
|
33
|
+
"ext/eval_intern.h",
|
|
34
|
+
"ext/extconf.rb",
|
|
35
|
+
"ext/gc.h",
|
|
36
|
+
"ext/id.h",
|
|
37
|
+
"ext/iseq.h",
|
|
38
|
+
"ext/method.h",
|
|
39
|
+
"ext/node.h",
|
|
40
|
+
"ext/parse.h",
|
|
41
|
+
"ext/regenc.h",
|
|
42
|
+
"ext/regint.h",
|
|
43
|
+
"ext/regparse.h",
|
|
44
|
+
"ext/revision.h",
|
|
45
|
+
"ext/thread_pthread.h",
|
|
46
|
+
"ext/thread_win32.h",
|
|
47
|
+
"ext/timev.h",
|
|
48
|
+
"ext/transcode_data.h",
|
|
49
|
+
"ext/transdb.h",
|
|
50
|
+
"ext/version.h",
|
|
51
|
+
"ext/vm_core.h",
|
|
52
|
+
"ext/vm_exec.h",
|
|
53
|
+
"ext/vm_insnhelper.h",
|
|
54
|
+
"ext/vm_opts.h",
|
|
55
|
+
"lib/better_caller/extensions.rb"
|
|
56
|
+
]
|
|
57
|
+
s.homepage = %q{http://github.com/RISCfuture/better_caller}
|
|
58
|
+
s.licenses = ["MIT"]
|
|
59
|
+
s.require_paths = ["lib"]
|
|
60
|
+
s.rubygems_version = %q{1.3.7}
|
|
61
|
+
s.summary = %q{[DEPRECATED] Symbolic call stack with bindings}
|
|
62
|
+
s.post_install_message = <<~MSG
|
|
63
|
+
|
|
64
|
+
⚠️ DEPRECATED: better_caller is no longer maintained.
|
|
65
|
+
|
|
66
|
+
Ruby's modern `caller_locations` builtin (added in 2.0) covers most use cases.
|
|
67
|
+
|
|
68
|
+
This is the final release. No further updates are planned.
|
|
69
|
+
|
|
70
|
+
MSG
|
|
71
|
+
|
|
72
|
+
if s.respond_to? :specification_version then
|
|
73
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
74
|
+
s.specification_version = 3
|
|
75
|
+
|
|
76
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
77
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
78
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
|
79
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
|
80
|
+
s.add_development_dependency(%q<RedCloth>, [">= 0"])
|
|
81
|
+
else
|
|
82
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
83
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
|
84
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
|
85
|
+
s.add_dependency(%q<RedCloth>, [">= 0"])
|
|
86
|
+
end
|
|
87
|
+
else
|
|
88
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
89
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
|
90
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
|
91
|
+
s.add_dependency(%q<RedCloth>, [">= 0"])
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
data/ext/better_caller.c
CHANGED
|
@@ -47,7 +47,7 @@ static VALUE backtrace_each(rb_thread_t *th, const rb_control_frame_t *limit_cfp
|
|
|
47
47
|
elem = rb_ary_new();
|
|
48
48
|
rb_ary_push(elem, rb_str_new2(file));
|
|
49
49
|
rb_ary_push(elem, INT2FIX(line_no));
|
|
50
|
-
rb_ary_push(elem, ID2SYM(cfp->
|
|
50
|
+
rb_ary_push(elem, ID2SYM(cfp->me->def ? cfp->me->def->original_id : cfp->me->called_id));
|
|
51
51
|
rb_ary_push(elem, Qnil);
|
|
52
52
|
rb_ary_push(ary, elem);
|
|
53
53
|
}
|
|
@@ -88,61 +88,20 @@ static VALUE better_caller(int argc, VALUE *argv) {
|
|
|
88
88
|
return backtrace(GET_THREAD(), lev);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
// static VALUE thread_bindings(VALUE self) {
|
|
92
|
-
// VALUE bindings = rb_iv_get(self, "@bindings");
|
|
93
|
-
// if (bindings == Qnil) return Qnil;
|
|
94
|
-
// return rb_ary_subseq(bindings, 0, RARRAY_LEN(bindings) - 1);
|
|
95
|
-
// }
|
|
96
|
-
//
|
|
97
91
|
static VALUE exception_better_backtrace(VALUE self) {
|
|
98
92
|
return rb_iv_get(self, "@better_backtrace");
|
|
99
93
|
}
|
|
100
|
-
|
|
94
|
+
|
|
101
95
|
static void process_event(rb_event_flag_t event, VALUE data, VALUE self, ID id, VALUE klass) {
|
|
102
|
-
// VALUE thread = rb_thread_current();
|
|
103
|
-
// VALUE subarray;
|
|
104
|
-
//
|
|
105
|
-
// VALUE bindings = rb_iv_get(thread, "@bindings");
|
|
106
|
-
// if (bindings == Qnil) {
|
|
107
|
-
// bindings = rb_ary_new();
|
|
108
|
-
// rb_iv_set(thread, "@bindings", bindings);
|
|
109
|
-
// }
|
|
110
|
-
//
|
|
111
96
|
switch (event) {
|
|
112
|
-
// // case RUBY_EVENT_LINE:
|
|
113
|
-
// // if (RARRAY_LEN(bindings) == 0) rb_ary_push(bindings, rb_binding_new());
|
|
114
|
-
// // break;
|
|
115
|
-
//
|
|
116
|
-
// case RUBY_EVENT_CLASS:
|
|
117
|
-
// case RUBY_EVENT_CALL:
|
|
118
|
-
// case RUBY_EVENT_C_CALL:
|
|
119
|
-
// subarray = rb_ary_new();
|
|
120
|
-
// rb_ary_push(subarray, rb_str_new2(rb_sourcefile()));
|
|
121
|
-
// rb_ary_push(subarray, id ? ID2SYM(id) : Qnil);
|
|
122
|
-
// rb_ary_push(subarray, rb_binding_new());
|
|
123
|
-
// rb_ary_push(bindings, subarray);
|
|
124
|
-
// break;
|
|
125
|
-
//
|
|
126
|
-
// case RUBY_EVENT_END:
|
|
127
|
-
// case RUBY_EVENT_RETURN:
|
|
128
|
-
// case RUBY_EVENT_C_RETURN:
|
|
129
|
-
// rb_ary_pop(bindings);
|
|
130
|
-
// break;
|
|
131
|
-
//
|
|
132
97
|
case RUBY_EVENT_RAISE:
|
|
133
|
-
|
|
134
|
-
// rb_iv_set(rb_gv_get("$!"), "@bindings", bindings);
|
|
135
|
-
// rb_ary_pop(bindings);
|
|
98
|
+
rb_funcall(rb_gv_get("$!"), rb_intern("set_better_backtrace"), 1, better_caller(0, 0));
|
|
136
99
|
break;
|
|
137
100
|
}
|
|
138
101
|
}
|
|
139
102
|
|
|
140
103
|
void Init_better_caller() {
|
|
141
104
|
rb_define_method(rb_eException, "better_backtrace", exception_better_backtrace, 0);
|
|
142
|
-
// rb_define_method(rb_cThread, "bindings", thread_bindings, 0);
|
|
143
105
|
rb_define_global_function("better_caller", better_caller, -1);
|
|
144
|
-
// int events = RUBY_EVENT_CLASS|RUBY_EVENT_CALL|RUBY_EVENT_C_CALL|RUBY_EVENT_END|RUBY_EVENT_RETURN|RUBY_EVENT_C_RETURN|RUBY_EVENT_RAISE;
|
|
145
|
-
// rb_add_event_hook(process_event, events, Qnil);
|
|
146
|
-
// rb_add_event_hook(process_event, RUBY_EVENT_ALL, Qnil);
|
|
147
106
|
rb_add_event_hook(process_event, RUBY_EVENT_RAISE, Qnil);
|
|
148
107
|
}
|
data/ext/debug.h
CHANGED
data/ext/dln.h
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
dln.h -
|
|
4
4
|
|
|
5
|
-
$Author:
|
|
5
|
+
$Author: akr $
|
|
6
6
|
created at: Wed Jan 19 16:53:09 JST 1994
|
|
7
7
|
|
|
8
8
|
Copyright (C) 1993-2007 Yukihiro Matsumoto
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
|
|
31
31
|
DEPRECATED(char *dln_find_exe(const char*,const char*));
|
|
32
32
|
DEPRECATED(char *dln_find_file(const char*,const char*));
|
|
33
|
-
char *dln_find_exe_r(const char*,const char*,char*,
|
|
34
|
-
char *dln_find_file_r(const char*,const char*,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
35
|
|
|
36
36
|
#ifdef USE_DLN_A_OUT
|
|
37
37
|
extern char *dln_argv0;
|
data/ext/encdb.h
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
ENC_DEFINE("ASCII-8BIT");
|
|
2
2
|
ENC_DEFINE("Big5");
|
|
3
|
+
ENC_DEFINE("Big5-HKSCS");
|
|
4
|
+
ENC_DEFINE("Big5-UAO");
|
|
3
5
|
ENC_DEFINE("CP949");
|
|
4
6
|
ENC_DEFINE("Emacs-Mule");
|
|
5
7
|
ENC_DEFINE("EUC-JP");
|
|
@@ -76,7 +78,10 @@ ENC_REPLICATE("macRomania", "ASCII-8BIT");
|
|
|
76
78
|
ENC_REPLICATE("macThai", "ASCII-8BIT");
|
|
77
79
|
ENC_REPLICATE("macTurkish", "ASCII-8BIT");
|
|
78
80
|
ENC_REPLICATE("macUkraine", "ASCII-8BIT");
|
|
79
|
-
ENC_ALIAS("CP950", "
|
|
81
|
+
ENC_ALIAS("CP950", "Big5");
|
|
82
|
+
ENC_SET_BASE("Big5-HKSCS", "Big5");
|
|
83
|
+
ENC_ALIAS("CP951", "Big5-HKSCS");
|
|
84
|
+
ENC_SET_BASE("Big5-UAO", "Big5");
|
|
80
85
|
ENC_REPLICATE("stateless-ISO-2022-JP", "Emacs-Mule");
|
|
81
86
|
ENC_ALIAS("eucJP", "EUC-JP") /* UI-OSF Application Platform Profile for Japanese Environment Version 1.1 */;
|
|
82
87
|
ENC_REPLICATE("eucJP-ms", "EUC-JP") /* TOG/JVC CDE/Motif Technical WG */;
|
|
@@ -92,6 +97,8 @@ ENC_DUMMY("ISO-2022-JP");
|
|
|
92
97
|
ENC_ALIAS("ISO2022-JP", "ISO-2022-JP");
|
|
93
98
|
ENC_REPLICATE("ISO-2022-JP-2", "ISO-2022-JP");
|
|
94
99
|
ENC_ALIAS("ISO2022-JP2", "ISO-2022-JP-2");
|
|
100
|
+
ENC_REPLICATE("CP50220", "ISO-2022-JP");
|
|
101
|
+
ENC_REPLICATE("CP50221", "ISO-2022-JP");
|
|
95
102
|
ENC_ALIAS("ISO8859-1", "ISO-8859-1");
|
|
96
103
|
ENC_REPLICATE("Windows-1252", "ISO-8859-1");
|
|
97
104
|
ENC_ALIAS("CP1252", "Windows-1252");
|
|
@@ -139,9 +146,18 @@ ENC_ALIAS("CP65000", "UTF-7");
|
|
|
139
146
|
ENC_ALIAS("CP65001", "UTF-8");
|
|
140
147
|
ENC_REPLICATE("UTF8-MAC", "UTF-8");
|
|
141
148
|
ENC_ALIAS("UTF-8-MAC", "UTF8-MAC");
|
|
149
|
+
ENC_ALIAS("UTF-8-HFS", "UTF8-MAC") /* Emacs 23.2 */;
|
|
142
150
|
ENC_ALIAS("UCS-2BE", "UTF-16BE");
|
|
143
151
|
ENC_ALIAS("UCS-4BE", "UTF-32BE");
|
|
144
152
|
ENC_ALIAS("UCS-4LE", "UTF-32LE");
|
|
145
153
|
ENC_ALIAS("CP1251", "Windows-1251");
|
|
154
|
+
ENC_REPLICATE("UTF8-DoCoMo", "UTF-8");
|
|
155
|
+
ENC_REPLICATE("SJIS-DoCoMo", "Windows-31J");
|
|
156
|
+
ENC_REPLICATE("UTF8-KDDI", "UTF-8");
|
|
157
|
+
ENC_REPLICATE("SJIS-KDDI", "Windows-31J");
|
|
158
|
+
ENC_REPLICATE("ISO-2022-JP-KDDI", "ISO-2022-JP");
|
|
159
|
+
ENC_REPLICATE("stateless-ISO-2022-JP-KDDI", "stateless-ISO-2022-JP");
|
|
160
|
+
ENC_REPLICATE("UTF8-SoftBank", "UTF-8");
|
|
161
|
+
ENC_REPLICATE("SJIS-SoftBank", "Windows-31J");
|
|
146
162
|
|
|
147
|
-
#define ENCODING_COUNT
|
|
163
|
+
#define ENCODING_COUNT 95
|
data/ext/eval_intern.h
CHANGED
|
@@ -157,7 +157,7 @@ enum ruby_tag_type {
|
|
|
157
157
|
#define TAG_MASK RUBY_TAG_MASK
|
|
158
158
|
|
|
159
159
|
#define NEW_THROW_OBJECT(val, pt, st) \
|
|
160
|
-
((VALUE)
|
|
160
|
+
((VALUE)rb_node_newnode(NODE_LIT, (VALUE)(val), (VALUE)(pt), (VALUE)(st)))
|
|
161
161
|
#define SET_THROWOBJ_CATCH_POINT(obj, val) \
|
|
162
162
|
(RNODE((obj))->u2.value = (val))
|
|
163
163
|
#define SET_THROWOBJ_STATE(obj, val) \
|
|
@@ -172,7 +172,7 @@ enum ruby_tag_type {
|
|
|
172
172
|
#define SCOPE_SET(f) (rb_vm_cref()->nd_visi = (f))
|
|
173
173
|
|
|
174
174
|
#define CHECK_STACK_OVERFLOW(cfp, margin) do \
|
|
175
|
-
if (((VALUE *)(cfp)->sp) + (margin) + sizeof(rb_control_frame_t) >= ((VALUE *)cfp)) { \
|
|
175
|
+
if ((VALUE *)((char *)(((VALUE *)(cfp)->sp) + (margin)) + sizeof(rb_control_frame_t)) >= ((VALUE *)cfp)) { \
|
|
176
176
|
rb_exc_raise(sysstack_error); \
|
|
177
177
|
} \
|
|
178
178
|
while (0)
|
|
@@ -185,8 +185,8 @@ enum {
|
|
|
185
185
|
RAISED_STACKOVERFLOW = 2,
|
|
186
186
|
RAISED_NOMEMORY = 4
|
|
187
187
|
};
|
|
188
|
-
int
|
|
189
|
-
int
|
|
188
|
+
int rb_threadptr_set_raised(rb_thread_t *th);
|
|
189
|
+
int rb_threadptr_reset_raised(rb_thread_t *th);
|
|
190
190
|
#define rb_thread_raised_set(th, f) ((th)->raised_flag |= (f))
|
|
191
191
|
#define rb_thread_raised_reset(th, f) ((th)->raised_flag &= ~(f))
|
|
192
192
|
#define rb_thread_raised_p(th, f) (((th)->raised_flag & (f)) != 0)
|
|
@@ -205,11 +205,28 @@ NORETURN(void rb_raise_method_missing(rb_thread_t *th, int argc, VALUE *argv,
|
|
|
205
205
|
|
|
206
206
|
VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
|
|
207
207
|
NODE *rb_vm_cref(void);
|
|
208
|
-
VALUE
|
|
209
|
-
|
|
208
|
+
VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename, VALUE filepath);
|
|
209
|
+
void rb_vm_set_progname(VALUE filename);
|
|
210
210
|
void rb_thread_terminate_all(void);
|
|
211
211
|
VALUE rb_vm_top_self();
|
|
212
212
|
VALUE rb_vm_cbase(void);
|
|
213
|
+
int rb_vm_get_sourceline(const rb_control_frame_t *);
|
|
213
214
|
void rb_trap_restore_mask(void);
|
|
214
215
|
|
|
216
|
+
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
|
|
217
|
+
#define CharNext(p) ((p) + mblen(p, RUBY_MBCHAR_MAXSIZE))
|
|
218
|
+
#endif
|
|
219
|
+
|
|
220
|
+
#if defined DOSISH || defined __CYGWIN__
|
|
221
|
+
static inline void
|
|
222
|
+
translit_char(char *p, int from, int to)
|
|
223
|
+
{
|
|
224
|
+
while (*p) {
|
|
225
|
+
if ((unsigned char)*p == from)
|
|
226
|
+
*p = to;
|
|
227
|
+
p = CharNext(p);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
#endif
|
|
231
|
+
|
|
215
232
|
#endif /* RUBY_EVAL_INTERN_H */
|
data/ext/extconf.rb
CHANGED
data/ext/gc.h
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
#ifndef RUBY_GC_H
|
|
3
3
|
#define RUBY_GC_H 1
|
|
4
4
|
|
|
5
|
-
#if defined(
|
|
6
|
-
#define SET_MACHINE_STACK_END(p) __asm__("
|
|
5
|
+
#if defined(__x86_64__) && defined(__GNUC__)
|
|
6
|
+
#define SET_MACHINE_STACK_END(p) __asm__("movq\t%%rsp, %0" : "=r" (*p))
|
|
7
|
+
#elif defined(__i386) && defined(__GNUC__)
|
|
8
|
+
#define SET_MACHINE_STACK_END(p) __asm__("movl\t%%esp, %0" : "=r" (*p))
|
|
7
9
|
#else
|
|
8
10
|
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
|
|
9
11
|
#define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
|
|
@@ -26,7 +28,7 @@ rb_gc_debug_indent(void)
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
static void
|
|
29
|
-
rb_gc_debug_body(char *mode, char *msg, int st, void *ptr)
|
|
31
|
+
rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
|
|
30
32
|
{
|
|
31
33
|
if (st == 0) {
|
|
32
34
|
ruby_gc_debug_indent--;
|
|
@@ -64,7 +66,7 @@ rb_gc_debug_body(char *mode, char *msg, int st, void *ptr)
|
|
|
64
66
|
# define STACK_UPPER(x, a, b) b
|
|
65
67
|
#else
|
|
66
68
|
RUBY_EXTERN int ruby_stack_grow_direction;
|
|
67
|
-
int ruby_get_stack_grow_direction(VALUE *addr);
|
|
69
|
+
int ruby_get_stack_grow_direction(volatile VALUE *addr);
|
|
68
70
|
# define stack_growup_p(x) ( \
|
|
69
71
|
(ruby_stack_grow_direction ? \
|
|
70
72
|
ruby_stack_grow_direction : \
|
data/ext/id.h
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* DO NOT EDIT THIS FILE DIRECTLY */
|
|
2
2
|
/**********************************************************************
|
|
3
3
|
|
|
4
|
-
id.h -
|
|
4
|
+
id.h -
|
|
5
5
|
|
|
6
|
-
$Author:
|
|
6
|
+
$Author: akr $
|
|
7
7
|
created at: Sun Oct 19 21:12:51 2008
|
|
8
8
|
|
|
9
9
|
Copyright (C) 2007 Koichi Sasada
|
|
@@ -61,15 +61,20 @@ enum ruby_method_ids {
|
|
|
61
61
|
idRespond_to = 366,
|
|
62
62
|
idIFUNC = 367,
|
|
63
63
|
idCFUNC = 368,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
tLAST_TOKEN = 376,
|
|
64
|
+
id_core_set_method_alias = 369,
|
|
65
|
+
id_core_set_variable_alias = 370,
|
|
66
|
+
id_core_undef_method = 371,
|
|
67
|
+
id_core_define_method = 372,
|
|
68
|
+
id_core_define_singleton_method = 373,
|
|
69
|
+
id_core_set_postexe = 374,
|
|
70
|
+
tLAST_TOKEN = 375,
|
|
72
71
|
#endif
|
|
72
|
+
idDot2 = tDOT2,
|
|
73
|
+
idDot3 = tDOT3,
|
|
74
|
+
idUPlus = tUPLUS,
|
|
75
|
+
idUMinus = tUMINUS,
|
|
76
|
+
idPow = tPOW,
|
|
77
|
+
idCmp = tCMP,
|
|
73
78
|
idPLUS = '+',
|
|
74
79
|
idMINUS = '-',
|
|
75
80
|
idMULT = '*',
|
|
@@ -86,12 +91,14 @@ enum ruby_method_ids {
|
|
|
86
91
|
idNot = '!',
|
|
87
92
|
idBackquote = '`',
|
|
88
93
|
idEqTilde = tMATCH,
|
|
94
|
+
idNeqTilde = tNMATCH,
|
|
89
95
|
idAREF = tAREF,
|
|
90
96
|
idASET = tASET,
|
|
91
97
|
idLAST_TOKEN = tLAST_TOKEN >> ID_SCOPE_SHIFT,
|
|
92
98
|
tIntern,
|
|
93
99
|
tMethodMissing,
|
|
94
100
|
tLength,
|
|
101
|
+
tSize,
|
|
95
102
|
tGets,
|
|
96
103
|
tSucc,
|
|
97
104
|
tEach,
|
|
@@ -112,6 +119,7 @@ enum ruby_method_ids {
|
|
|
112
119
|
TOKEN2ID(Intern),
|
|
113
120
|
TOKEN2ID(MethodMissing),
|
|
114
121
|
TOKEN2ID(Length),
|
|
122
|
+
TOKEN2ID(Size),
|
|
115
123
|
TOKEN2ID(Gets),
|
|
116
124
|
TOKEN2ID(Succ),
|
|
117
125
|
TOKEN2ID(Each),
|
|
@@ -149,14 +157,13 @@ ruby_method_id_check_for(idNULL, 365);
|
|
|
149
157
|
ruby_method_id_check_for(idRespond_to, 366);
|
|
150
158
|
ruby_method_id_check_for(idIFUNC, 367);
|
|
151
159
|
ruby_method_id_check_for(idCFUNC, 368);
|
|
152
|
-
ruby_method_id_check_for(
|
|
153
|
-
ruby_method_id_check_for(
|
|
154
|
-
ruby_method_id_check_for(
|
|
155
|
-
ruby_method_id_check_for(
|
|
156
|
-
ruby_method_id_check_for(
|
|
157
|
-
ruby_method_id_check_for(
|
|
158
|
-
ruby_method_id_check_for(
|
|
159
|
-
ruby_method_id_check_for(tLAST_TOKEN, 376);
|
|
160
|
+
ruby_method_id_check_for(id_core_set_method_alias, 369);
|
|
161
|
+
ruby_method_id_check_for(id_core_set_variable_alias, 370);
|
|
162
|
+
ruby_method_id_check_for(id_core_undef_method, 371);
|
|
163
|
+
ruby_method_id_check_for(id_core_define_method, 372);
|
|
164
|
+
ruby_method_id_check_for(id_core_define_singleton_method, 373);
|
|
165
|
+
ruby_method_id_check_for(id_core_set_postexe, 374);
|
|
166
|
+
ruby_method_id_check_for(tLAST_TOKEN, 375);
|
|
160
167
|
};
|
|
161
168
|
#endif
|
|
162
169
|
|
data/ext/iseq.h
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
iseq.h -
|
|
4
4
|
|
|
5
|
-
$Author:
|
|
5
|
+
$Author: mame $
|
|
6
6
|
created at: 04/01/01 23:36:57 JST
|
|
7
7
|
|
|
8
8
|
Copyright (C) 2004-2008 Koichi Sasada
|
|
@@ -19,7 +19,7 @@ VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
|
|
|
19
19
|
VALUE exception, VALUE body);
|
|
20
20
|
|
|
21
21
|
/* iseq.c */
|
|
22
|
-
VALUE
|
|
22
|
+
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
|
|
23
23
|
struct st_table *ruby_insn_make_insn_table(void);
|
|
24
24
|
|
|
25
25
|
#define ISEQ_TYPE_TOP INT2FIX(1)
|
|
@@ -32,12 +32,12 @@ struct st_table *ruby_insn_make_insn_table(void);
|
|
|
32
32
|
#define ISEQ_TYPE_MAIN INT2FIX(8)
|
|
33
33
|
#define ISEQ_TYPE_DEFINED_GUARD INT2FIX(9)
|
|
34
34
|
|
|
35
|
-
#define CATCH_TYPE_RESCUE INT2FIX(1)
|
|
36
|
-
#define CATCH_TYPE_ENSURE INT2FIX(2)
|
|
37
|
-
#define CATCH_TYPE_RETRY INT2FIX(3)
|
|
38
|
-
#define CATCH_TYPE_BREAK INT2FIX(4)
|
|
39
|
-
#define CATCH_TYPE_REDO INT2FIX(5)
|
|
40
|
-
#define CATCH_TYPE_NEXT INT2FIX(6)
|
|
35
|
+
#define CATCH_TYPE_RESCUE ((int)INT2FIX(1))
|
|
36
|
+
#define CATCH_TYPE_ENSURE ((int)INT2FIX(2))
|
|
37
|
+
#define CATCH_TYPE_RETRY ((int)INT2FIX(3))
|
|
38
|
+
#define CATCH_TYPE_BREAK ((int)INT2FIX(4))
|
|
39
|
+
#define CATCH_TYPE_REDO ((int)INT2FIX(5))
|
|
40
|
+
#define CATCH_TYPE_NEXT ((int)INT2FIX(6))
|
|
41
41
|
|
|
42
42
|
struct iseq_insn_info_entry {
|
|
43
43
|
unsigned short position;
|
|
@@ -74,14 +74,15 @@ struct iseq_compile_data {
|
|
|
74
74
|
struct iseq_label_data *end_label;
|
|
75
75
|
struct iseq_label_data *redo_label;
|
|
76
76
|
VALUE current_block;
|
|
77
|
-
VALUE loopval_popped; /* used by NODE_BREAK */
|
|
78
77
|
VALUE ensure_node;
|
|
79
78
|
VALUE for_iseq;
|
|
80
79
|
struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
|
|
80
|
+
int loopval_popped; /* used by NODE_BREAK */
|
|
81
81
|
int cached_const;
|
|
82
82
|
struct iseq_compile_data_storage *storage_head;
|
|
83
83
|
struct iseq_compile_data_storage *storage_current;
|
|
84
84
|
int last_line;
|
|
85
|
+
int last_coverable_line;
|
|
85
86
|
int flip_cnt;
|
|
86
87
|
int label_no;
|
|
87
88
|
int node_level;
|