therubyracer 0.10.2 → 0.11.0beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of therubyracer might be problematic. Click here for more details.
- data/.gitignore +21 -11
- data/.travis.yml +2 -1
- data/Changelog.md +46 -0
- data/Gemfile +16 -1
- data/README.md +31 -13
- data/Rakefile +42 -23
- data/benchmarks.rb +217 -0
- data/ext/v8/accessor.cc +181 -0
- data/ext/v8/array.cc +26 -0
- data/ext/v8/backref.cc +56 -0
- data/ext/v8/build.rb +51 -0
- data/ext/v8/constants.cc +34 -0
- data/ext/v8/constraints.cc +52 -0
- data/ext/v8/context.cc +130 -0
- data/ext/v8/date.cc +18 -0
- data/ext/v8/exception.cc +38 -0
- data/ext/v8/extconf.rb +14 -18
- data/ext/v8/external.cc +43 -0
- data/ext/v8/function.cc +58 -0
- data/ext/v8/gc.cc +43 -0
- data/ext/v8/handles.cc +34 -0
- data/ext/v8/heap.cc +31 -0
- data/ext/v8/init.cc +39 -0
- data/ext/v8/invocation.cc +86 -0
- data/ext/v8/locker.cc +77 -0
- data/ext/v8/message.cc +51 -0
- data/ext/v8/object.cc +334 -0
- data/ext/v8/primitive.cc +8 -0
- data/ext/v8/rr.cc +83 -0
- data/ext/v8/rr.h +878 -36
- data/ext/v8/script.cc +80 -0
- data/ext/v8/signature.cc +18 -0
- data/ext/v8/stack.cc +75 -0
- data/ext/v8/string.cc +47 -0
- data/ext/v8/template.cc +175 -0
- data/ext/v8/trycatch.cc +86 -0
- data/ext/v8/v8.cc +87 -0
- data/ext/v8/value.cc +239 -0
- data/lib/v8.rb +30 -22
- data/lib/v8/access.rb +5 -87
- data/lib/v8/access/indices.rb +40 -0
- data/lib/v8/access/invocation.rb +47 -0
- data/lib/v8/access/names.rb +65 -0
- data/lib/v8/array.rb +19 -10
- data/lib/v8/context.rb +85 -78
- data/lib/v8/conversion.rb +35 -0
- data/lib/v8/conversion/array.rb +11 -0
- data/lib/v8/conversion/class.rb +120 -0
- data/lib/v8/conversion/code.rb +38 -0
- data/lib/v8/conversion/fundamental.rb +11 -0
- data/lib/v8/conversion/hash.rb +11 -0
- data/lib/v8/conversion/indentity.rb +31 -0
- data/lib/v8/conversion/method.rb +26 -0
- data/lib/v8/conversion/object.rb +28 -0
- data/lib/v8/conversion/primitive.rb +7 -0
- data/lib/v8/conversion/proc.rb +5 -0
- data/lib/v8/conversion/reference.rb +16 -0
- data/lib/v8/conversion/string.rb +12 -0
- data/lib/v8/conversion/symbol.rb +7 -0
- data/lib/v8/conversion/time.rb +13 -0
- data/lib/v8/error.rb +18 -123
- data/lib/v8/error/protect.rb +20 -0
- data/lib/v8/error/try.rb +15 -0
- data/lib/v8/function.rb +18 -34
- data/lib/v8/object.rb +48 -52
- data/lib/v8/util/weakcell.rb +29 -0
- data/lib/v8/version.rb +2 -2
- data/spec/c/array_spec.rb +17 -0
- data/spec/c/constants_spec.rb +20 -0
- data/spec/c/exception_spec.rb +26 -0
- data/spec/c/external_spec.rb +9 -0
- data/spec/c/function_spec.rb +46 -0
- data/spec/c/handles_spec.rb +35 -0
- data/spec/c/locker_spec.rb +38 -0
- data/spec/c/object_spec.rb +46 -0
- data/spec/c/script_spec.rb +28 -0
- data/spec/c/string_spec.rb +16 -0
- data/spec/c/template_spec.rb +30 -0
- data/spec/c/trycatch_spec.rb +51 -0
- data/spec/mem/blunt_spec.rb +42 -0
- data/spec/redjs_spec.rb +10 -0
- data/spec/spec_helper.rb +40 -4
- data/spec/threading_spec.rb +52 -0
- data/spec/v8/context_spec.rb +19 -0
- data/spec/v8/conversion_spec.rb +9 -0
- data/spec/v8/error_spec.rb +15 -125
- data/spec/v8/function_spec.rb +9 -0
- data/therubyracer.gemspec +15 -24
- metadata +102 -135
- data/.gitmodules +0 -3
- data/.rspec +0 -1
- data/.yardopts +0 -1
- data/bin/therubyracer +0 -11
- data/ext/v8/rr.cpp +0 -189
- data/ext/v8/v8.cpp +0 -48
- data/ext/v8/v8_array.cpp +0 -48
- data/ext/v8/v8_array.h +0 -8
- data/ext/v8/v8_callbacks.cpp +0 -81
- data/ext/v8/v8_callbacks.h +0 -8
- data/ext/v8/v8_context.cpp +0 -92
- data/ext/v8/v8_context.h +0 -6
- data/ext/v8/v8_date.cpp +0 -34
- data/ext/v8/v8_date.h +0 -6
- data/ext/v8/v8_debug.cpp +0 -17
- data/ext/v8/v8_debug.h +0 -6
- data/ext/v8/v8_exception.cpp +0 -133
- data/ext/v8/v8_exception.h +0 -11
- data/ext/v8/v8_external.cpp +0 -70
- data/ext/v8/v8_external.h +0 -8
- data/ext/v8/v8_function.cpp +0 -69
- data/ext/v8/v8_function.h +0 -11
- data/ext/v8/v8_handle.cpp +0 -186
- data/ext/v8/v8_handle.h +0 -48
- data/ext/v8/v8_locker.cpp +0 -139
- data/ext/v8/v8_locker.h +0 -6
- data/ext/v8/v8_message.cpp +0 -67
- data/ext/v8/v8_message.h +0 -10
- data/ext/v8/v8_object.cpp +0 -122
- data/ext/v8/v8_object.h +0 -10
- data/ext/v8/v8_script.cpp +0 -36
- data/ext/v8/v8_script.h +0 -8
- data/ext/v8/v8_string.cpp +0 -52
- data/ext/v8/v8_string.h +0 -9
- data/ext/v8/v8_template.cpp +0 -344
- data/ext/v8/v8_template.h +0 -8
- data/ext/v8/v8_try_catch.cpp +0 -70
- data/ext/v8/v8_try_catch.h +0 -5
- data/ext/v8/v8_v8.cpp +0 -35
- data/ext/v8/v8_v8.h +0 -6
- data/ext/v8/v8_value.cpp +0 -175
- data/ext/v8/v8_value.h +0 -10
- data/ext/v8/v8_weakref.cpp +0 -61
- data/ext/v8/v8_weakref.h +0 -29
- data/lib/v8/c/locker.rb +0 -18
- data/lib/v8/cli.rb +0 -133
- data/lib/v8/portal.rb +0 -86
- data/lib/v8/portal/caller.rb +0 -37
- data/lib/v8/portal/constructor.rb +0 -98
- data/lib/v8/portal/function.rb +0 -63
- data/lib/v8/portal/interceptors.rb +0 -152
- data/lib/v8/portal/proxies.rb +0 -151
- data/lib/v8/portal/templates.rb +0 -73
- data/lib/v8/stack.rb +0 -66
- data/lib/v8/tap.rb +0 -9
- data/spec/ext/array_spec.rb +0 -15
- data/spec/ext/cxt_spec.rb +0 -57
- data/spec/ext/ext_spec_helper.rb +0 -27
- data/spec/ext/func_spec.rb +0 -64
- data/spec/ext/object_spec.rb +0 -10
- data/spec/ext/string_spec.rb +0 -11
- data/spec/ext/try_catch_spec.rb +0 -60
- data/spec/redjs_helper.rb +0 -3
- data/spec/v8/portal/proxies_spec.rb +0 -106
- data/specmem/handle_memspec.rb +0 -41
- data/specmem/object_memspec.rb +0 -14
- data/specmem/proxies_memspec.rb +0 -49
- data/specmem/spec_helper.rb +0 -24
- data/specthread/spec_helper.rb +0 -2
- data/specthread/threading_spec.rb +0 -13
metadata
CHANGED
@@ -1,74 +1,25 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: therubyracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.11.0beta1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Charles Lowell
|
9
|
-
- Bill Robertson
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2012-
|
12
|
+
date: 2012-06-22 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
|
-
requirements:
|
20
|
-
- - ~>
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 3.3.10
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ~>
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 3.3.10
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
|
-
name: rake
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
|
-
requirements:
|
36
|
-
- - ! '>='
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: '0'
|
39
|
-
type: :development
|
40
|
-
prerelease: false
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ! '>='
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: rspec
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '2.0'
|
55
|
-
type: :development
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '2.0'
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: rake-compiler
|
15
|
+
name: ref
|
65
16
|
requirement: !ruby/object:Gem::Requirement
|
66
17
|
none: false
|
67
18
|
requirements:
|
68
19
|
- - ! '>='
|
69
20
|
- !ruby/object:Gem::Version
|
70
21
|
version: '0'
|
71
|
-
type: :
|
22
|
+
type: :runtime
|
72
23
|
prerelease: false
|
73
24
|
version_requirements: !ruby/object:Gem::Requirement
|
74
25
|
none: false
|
@@ -78,101 +29,100 @@ dependencies:
|
|
78
29
|
version: '0'
|
79
30
|
description: Call javascript code and manipulate javascript objects from ruby. Call
|
80
31
|
ruby code and manipulate ruby objects from javascript.
|
81
|
-
email:
|
82
|
-
|
83
|
-
|
32
|
+
email:
|
33
|
+
- javascript-and-friends@googlegroups.com
|
34
|
+
executables: []
|
84
35
|
extensions:
|
85
36
|
- ext/v8/extconf.rb
|
86
37
|
extra_rdoc_files: []
|
87
38
|
files:
|
88
39
|
- .gitignore
|
89
|
-
- .gitmodules
|
90
|
-
- .rspec
|
91
40
|
- .travis.yml
|
92
|
-
- .yardopts
|
93
41
|
- Changelog.md
|
94
42
|
- Gemfile
|
95
43
|
- README.md
|
96
44
|
- Rakefile
|
97
|
-
-
|
45
|
+
- benchmarks.rb
|
46
|
+
- ext/v8/accessor.cc
|
47
|
+
- ext/v8/array.cc
|
48
|
+
- ext/v8/backref.cc
|
49
|
+
- ext/v8/build.rb
|
50
|
+
- ext/v8/constants.cc
|
51
|
+
- ext/v8/constraints.cc
|
52
|
+
- ext/v8/context.cc
|
53
|
+
- ext/v8/date.cc
|
54
|
+
- ext/v8/exception.cc
|
98
55
|
- ext/v8/extconf.rb
|
99
|
-
- ext/v8/
|
56
|
+
- ext/v8/external.cc
|
57
|
+
- ext/v8/function.cc
|
58
|
+
- ext/v8/gc.cc
|
59
|
+
- ext/v8/handles.cc
|
60
|
+
- ext/v8/heap.cc
|
61
|
+
- ext/v8/init.cc
|
62
|
+
- ext/v8/invocation.cc
|
63
|
+
- ext/v8/locker.cc
|
64
|
+
- ext/v8/message.cc
|
65
|
+
- ext/v8/object.cc
|
66
|
+
- ext/v8/primitive.cc
|
67
|
+
- ext/v8/rr.cc
|
100
68
|
- ext/v8/rr.h
|
101
|
-
- ext/v8/
|
102
|
-
- ext/v8/
|
103
|
-
- ext/v8/
|
104
|
-
- ext/v8/
|
105
|
-
- ext/v8/
|
106
|
-
- ext/v8/
|
107
|
-
- ext/v8/
|
108
|
-
- ext/v8/
|
109
|
-
- ext/v8/v8_date.h
|
110
|
-
- ext/v8/v8_debug.cpp
|
111
|
-
- ext/v8/v8_debug.h
|
112
|
-
- ext/v8/v8_exception.cpp
|
113
|
-
- ext/v8/v8_exception.h
|
114
|
-
- ext/v8/v8_external.cpp
|
115
|
-
- ext/v8/v8_external.h
|
116
|
-
- ext/v8/v8_function.cpp
|
117
|
-
- ext/v8/v8_function.h
|
118
|
-
- ext/v8/v8_handle.cpp
|
119
|
-
- ext/v8/v8_handle.h
|
120
|
-
- ext/v8/v8_locker.cpp
|
121
|
-
- ext/v8/v8_locker.h
|
122
|
-
- ext/v8/v8_message.cpp
|
123
|
-
- ext/v8/v8_message.h
|
124
|
-
- ext/v8/v8_object.cpp
|
125
|
-
- ext/v8/v8_object.h
|
126
|
-
- ext/v8/v8_script.cpp
|
127
|
-
- ext/v8/v8_script.h
|
128
|
-
- ext/v8/v8_string.cpp
|
129
|
-
- ext/v8/v8_string.h
|
130
|
-
- ext/v8/v8_template.cpp
|
131
|
-
- ext/v8/v8_template.h
|
132
|
-
- ext/v8/v8_try_catch.cpp
|
133
|
-
- ext/v8/v8_try_catch.h
|
134
|
-
- ext/v8/v8_v8.cpp
|
135
|
-
- ext/v8/v8_v8.h
|
136
|
-
- ext/v8/v8_value.cpp
|
137
|
-
- ext/v8/v8_value.h
|
138
|
-
- ext/v8/v8_weakref.cpp
|
139
|
-
- ext/v8/v8_weakref.h
|
69
|
+
- ext/v8/script.cc
|
70
|
+
- ext/v8/signature.cc
|
71
|
+
- ext/v8/stack.cc
|
72
|
+
- ext/v8/string.cc
|
73
|
+
- ext/v8/template.cc
|
74
|
+
- ext/v8/trycatch.cc
|
75
|
+
- ext/v8/v8.cc
|
76
|
+
- ext/v8/value.cc
|
140
77
|
- lib/v8.rb
|
141
78
|
- lib/v8/access.rb
|
79
|
+
- lib/v8/access/indices.rb
|
80
|
+
- lib/v8/access/invocation.rb
|
81
|
+
- lib/v8/access/names.rb
|
142
82
|
- lib/v8/array.rb
|
143
|
-
- lib/v8/c/locker.rb
|
144
|
-
- lib/v8/cli.rb
|
145
83
|
- lib/v8/context.rb
|
84
|
+
- lib/v8/conversion.rb
|
85
|
+
- lib/v8/conversion/array.rb
|
86
|
+
- lib/v8/conversion/class.rb
|
87
|
+
- lib/v8/conversion/code.rb
|
88
|
+
- lib/v8/conversion/fundamental.rb
|
89
|
+
- lib/v8/conversion/hash.rb
|
90
|
+
- lib/v8/conversion/indentity.rb
|
91
|
+
- lib/v8/conversion/method.rb
|
92
|
+
- lib/v8/conversion/object.rb
|
93
|
+
- lib/v8/conversion/primitive.rb
|
94
|
+
- lib/v8/conversion/proc.rb
|
95
|
+
- lib/v8/conversion/reference.rb
|
96
|
+
- lib/v8/conversion/string.rb
|
97
|
+
- lib/v8/conversion/symbol.rb
|
98
|
+
- lib/v8/conversion/time.rb
|
146
99
|
- lib/v8/error.rb
|
100
|
+
- lib/v8/error/protect.rb
|
101
|
+
- lib/v8/error/try.rb
|
147
102
|
- lib/v8/function.rb
|
148
103
|
- lib/v8/object.rb
|
149
|
-
- lib/v8/
|
150
|
-
- lib/v8/portal/caller.rb
|
151
|
-
- lib/v8/portal/constructor.rb
|
152
|
-
- lib/v8/portal/function.rb
|
153
|
-
- lib/v8/portal/interceptors.rb
|
154
|
-
- lib/v8/portal/proxies.rb
|
155
|
-
- lib/v8/portal/templates.rb
|
156
|
-
- lib/v8/stack.rb
|
157
|
-
- lib/v8/tap.rb
|
104
|
+
- lib/v8/util/weakcell.rb
|
158
105
|
- lib/v8/version.rb
|
159
|
-
- spec/
|
160
|
-
- spec/
|
161
|
-
- spec/
|
162
|
-
- spec/
|
163
|
-
- spec/
|
164
|
-
- spec/
|
165
|
-
- spec/
|
166
|
-
- spec/
|
106
|
+
- spec/c/array_spec.rb
|
107
|
+
- spec/c/constants_spec.rb
|
108
|
+
- spec/c/exception_spec.rb
|
109
|
+
- spec/c/external_spec.rb
|
110
|
+
- spec/c/function_spec.rb
|
111
|
+
- spec/c/handles_spec.rb
|
112
|
+
- spec/c/locker_spec.rb
|
113
|
+
- spec/c/object_spec.rb
|
114
|
+
- spec/c/script_spec.rb
|
115
|
+
- spec/c/string_spec.rb
|
116
|
+
- spec/c/template_spec.rb
|
117
|
+
- spec/c/trycatch_spec.rb
|
118
|
+
- spec/mem/blunt_spec.rb
|
119
|
+
- spec/redjs_spec.rb
|
167
120
|
- spec/spec_helper.rb
|
121
|
+
- spec/threading_spec.rb
|
122
|
+
- spec/v8/context_spec.rb
|
123
|
+
- spec/v8/conversion_spec.rb
|
168
124
|
- spec/v8/error_spec.rb
|
169
|
-
- spec/v8/
|
170
|
-
- specmem/handle_memspec.rb
|
171
|
-
- specmem/object_memspec.rb
|
172
|
-
- specmem/proxies_memspec.rb
|
173
|
-
- specmem/spec_helper.rb
|
174
|
-
- specthread/spec_helper.rb
|
175
|
-
- specthread/threading_spec.rb
|
125
|
+
- spec/v8/function_spec.rb
|
176
126
|
- thefrontside.png
|
177
127
|
- therubyracer.gemspec
|
178
128
|
homepage: http://github.com/cowboyd/therubyracer
|
@@ -190,20 +140,37 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
140
|
version: '0'
|
191
141
|
segments:
|
192
142
|
- 0
|
193
|
-
hash: -
|
143
|
+
hash: -4333973813536710638
|
194
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
145
|
none: false
|
196
146
|
requirements:
|
197
|
-
- - ! '
|
147
|
+
- - ! '>'
|
198
148
|
- !ruby/object:Gem::Version
|
199
|
-
version:
|
200
|
-
segments:
|
201
|
-
- 0
|
202
|
-
hash: -3773835089454614167
|
149
|
+
version: 1.3.1
|
203
150
|
requirements: []
|
204
|
-
rubyforge_project:
|
151
|
+
rubyforge_project:
|
205
152
|
rubygems_version: 1.8.24
|
206
153
|
signing_key:
|
207
154
|
specification_version: 3
|
208
155
|
summary: Embed the V8 Javascript interpreter into Ruby
|
209
|
-
test_files:
|
156
|
+
test_files:
|
157
|
+
- spec/c/array_spec.rb
|
158
|
+
- spec/c/constants_spec.rb
|
159
|
+
- spec/c/exception_spec.rb
|
160
|
+
- spec/c/external_spec.rb
|
161
|
+
- spec/c/function_spec.rb
|
162
|
+
- spec/c/handles_spec.rb
|
163
|
+
- spec/c/locker_spec.rb
|
164
|
+
- spec/c/object_spec.rb
|
165
|
+
- spec/c/script_spec.rb
|
166
|
+
- spec/c/string_spec.rb
|
167
|
+
- spec/c/template_spec.rb
|
168
|
+
- spec/c/trycatch_spec.rb
|
169
|
+
- spec/mem/blunt_spec.rb
|
170
|
+
- spec/redjs_spec.rb
|
171
|
+
- spec/spec_helper.rb
|
172
|
+
- spec/threading_spec.rb
|
173
|
+
- spec/v8/context_spec.rb
|
174
|
+
- spec/v8/conversion_spec.rb
|
175
|
+
- spec/v8/error_spec.rb
|
176
|
+
- spec/v8/function_spec.rb
|
data/.gitmodules
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour
|
data/.yardopts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
lib/**/*.rb ext/**/*.cpp
|
data/bin/therubyracer
DELETED
data/ext/v8/rr.cpp
DELETED
@@ -1,189 +0,0 @@
|
|
1
|
-
#include "rr.h"
|
2
|
-
#include "v8_context.h"
|
3
|
-
#include "v8_handle.h"
|
4
|
-
#include "v8_value.h"
|
5
|
-
#include "v8_object.h"
|
6
|
-
#include "v8_function.h"
|
7
|
-
#include "v8_array.h"
|
8
|
-
#include "v8_string.h"
|
9
|
-
#include "v8_date.h"
|
10
|
-
#include "v8_message.h"
|
11
|
-
#include "v8_external.h"
|
12
|
-
#include "v8_exception.h"
|
13
|
-
|
14
|
-
using namespace v8;
|
15
|
-
|
16
|
-
VALUE rr_define_class(const char *name, VALUE superclass) {
|
17
|
-
VALUE V8 = rb_define_module("V8");
|
18
|
-
VALUE V8_C = rb_define_module_under(V8, "C");
|
19
|
-
VALUE klass = rb_define_class_under(V8_C, name, superclass);
|
20
|
-
rb_funcall(klass, rb_intern("private_class_method"), 1, rb_str_new2("new"));
|
21
|
-
return klass;
|
22
|
-
}
|
23
|
-
|
24
|
-
VALUE rr_define_module(const char *name) {
|
25
|
-
VALUE V8 = rb_define_module("V8");
|
26
|
-
VALUE V8_C = rb_define_module_under(V8, "C");
|
27
|
-
return rb_define_module_under(V8_C, name);
|
28
|
-
}
|
29
|
-
|
30
|
-
VALUE rr_define_const(const char *name, VALUE value) {
|
31
|
-
VALUE V8 = rb_define_module("V8");
|
32
|
-
VALUE V8_C = rb_define_module_under(V8, "C");
|
33
|
-
rb_define_const(V8_C, name, value);
|
34
|
-
return value;
|
35
|
-
}
|
36
|
-
|
37
|
-
VALUE rr_const_get(const char *name) {
|
38
|
-
VALUE V8 = rb_define_module("V8");
|
39
|
-
VALUE V8_C = rb_define_module_under(V8, "C");
|
40
|
-
return rb_const_get(V8_C, rb_intern(name));
|
41
|
-
}
|
42
|
-
|
43
|
-
VALUE rr_define_finalizer(VALUE object, void* finalizer, VALUE data) {
|
44
|
-
VALUE finalizer_proc = rb_proc_new((VALUE (*)(...))finalizer, data);
|
45
|
-
rb_iv_set(finalizer_proc, "data", data);
|
46
|
-
VALUE ospace = rb_const_get(rb_cObject, rb_intern("ObjectSpace"));
|
47
|
-
rb_funcall(ospace, rb_intern("define_finalizer"), 2, object, finalizer_proc);
|
48
|
-
}
|
49
|
-
|
50
|
-
VALUE rr_v82rb(Handle<Value> value) {
|
51
|
-
if (value.IsEmpty()) {
|
52
|
-
return rr_v8_value_empty();
|
53
|
-
}
|
54
|
-
if (value->IsUndefined() || value->IsNull()) {
|
55
|
-
return Qnil;
|
56
|
-
}
|
57
|
-
if (value->IsExternal()) {
|
58
|
-
return rr_reflect_v8_external(value);
|
59
|
-
}
|
60
|
-
if (value->IsUint32()) {
|
61
|
-
return UINT2NUM(value->Uint32Value());
|
62
|
-
}
|
63
|
-
if (value->IsInt32()) {
|
64
|
-
return INT2FIX(value->Int32Value());
|
65
|
-
}
|
66
|
-
if (value->IsBoolean()) {
|
67
|
-
return value->BooleanValue() ? Qtrue : Qfalse;
|
68
|
-
}
|
69
|
-
if (value->IsNumber()) {
|
70
|
-
return rb_float_new(value->NumberValue());
|
71
|
-
}
|
72
|
-
if (value->IsString()) {
|
73
|
-
return rr_reflect_v8_string(value);
|
74
|
-
}
|
75
|
-
if (value->IsFunction()) {
|
76
|
-
return rr_reflect_v8_function(value);
|
77
|
-
}
|
78
|
-
if (value->IsArray()) {
|
79
|
-
return rr_reflect_v8_array(value);
|
80
|
-
}
|
81
|
-
if (value->IsDate()) {
|
82
|
-
return rr_reflect_v8_date(value);
|
83
|
-
}
|
84
|
-
if (value->IsObject()) {
|
85
|
-
return rr_reflect_v8_object(value);
|
86
|
-
}
|
87
|
-
return rr_wrap_v8_value(value);
|
88
|
-
}
|
89
|
-
|
90
|
-
VALUE rr_v82rb(Handle<Message> value) {
|
91
|
-
return rr_reflect_v8_message(value);
|
92
|
-
}
|
93
|
-
VALUE rr_v82rb(Handle<StackTrace> value) {
|
94
|
-
return rr_reflect_v8_stacktrace(value);
|
95
|
-
}
|
96
|
-
VALUE rr_v82rb(Handle<StackFrame> value) {
|
97
|
-
return rr_reflect_v8_stackframe(value);
|
98
|
-
}
|
99
|
-
|
100
|
-
VALUE rr_v82rb(Handle<Boolean> value) {
|
101
|
-
return rr_v82rb((Handle<Value>)value);
|
102
|
-
}
|
103
|
-
VALUE rr_v82rb(Handle<Number> value) {
|
104
|
-
return rr_v82rb((Handle<Value>)value);
|
105
|
-
}
|
106
|
-
VALUE rr_v82rb(Handle<String> value) {
|
107
|
-
return rr_v82rb((Handle<Value>)value);
|
108
|
-
}
|
109
|
-
VALUE rr_v82rb(Handle<Object> value) {
|
110
|
-
return rr_v82rb((Handle<Value>)value);
|
111
|
-
}
|
112
|
-
VALUE rr_v82rb(Handle<Array> value) {
|
113
|
-
return rr_v82rb((Handle<Value>)value);
|
114
|
-
}
|
115
|
-
VALUE rr_v82rb(v8::Handle<v8::Function> value) {
|
116
|
-
return rr_v82rb((Handle<Value>)value);
|
117
|
-
}
|
118
|
-
VALUE rr_v82rb(Handle<Integer> value) {
|
119
|
-
return rr_v82rb((Handle<Value>)value);
|
120
|
-
}
|
121
|
-
VALUE rr_v82rb(Handle<Uint32> value) {
|
122
|
-
return rr_v82rb((Handle<Value>)value);
|
123
|
-
}
|
124
|
-
VALUE rr_v82rb(Handle<Int32> value) {
|
125
|
-
return rr_v82rb((Handle<Value>)value);
|
126
|
-
}
|
127
|
-
VALUE rr_v82rb(bool value) {
|
128
|
-
return value ? Qtrue : Qfalse;
|
129
|
-
}
|
130
|
-
VALUE rr_v82rb(double value) {
|
131
|
-
return rb_float_new(value);
|
132
|
-
}
|
133
|
-
VALUE rr_v82rb(int64_t value) {
|
134
|
-
return LONG2NUM(value);
|
135
|
-
}
|
136
|
-
VALUE rr_v82rb(uint32_t value) {
|
137
|
-
return UINT2NUM(value);
|
138
|
-
}
|
139
|
-
VALUE rr_v82rb(int32_t value) {
|
140
|
-
return INT2FIX(value);
|
141
|
-
}
|
142
|
-
|
143
|
-
Handle<Value> rr_rb2v8(VALUE value) {
|
144
|
-
switch (TYPE(value)) {
|
145
|
-
case T_FIXNUM:
|
146
|
-
// TODO: use this conversion if value will fit in 32 bits.
|
147
|
-
// return Integer::New(FIX2LONG(value));
|
148
|
-
case T_FLOAT:
|
149
|
-
return Number::New(NUM2DBL(value));
|
150
|
-
case T_STRING:
|
151
|
-
return String::New(RSTRING_PTR(value), RSTRING_LEN(value));
|
152
|
-
case T_NIL:
|
153
|
-
return Null();
|
154
|
-
case T_TRUE:
|
155
|
-
return True();
|
156
|
-
case T_FALSE:
|
157
|
-
return False();
|
158
|
-
case T_DATA:
|
159
|
-
return rr_v8_handle<Value>(value);
|
160
|
-
case T_OBJECT:
|
161
|
-
case T_CLASS:
|
162
|
-
case T_ICLASS:
|
163
|
-
case T_MODULE:
|
164
|
-
case T_REGEXP:
|
165
|
-
case T_MATCH:
|
166
|
-
case T_ARRAY:
|
167
|
-
case T_HASH:
|
168
|
-
case T_STRUCT:
|
169
|
-
case T_BIGNUM:
|
170
|
-
case T_FILE:
|
171
|
-
case T_SYMBOL:
|
172
|
-
// case T_BLKTAG: (not in 1.9)
|
173
|
-
case T_UNDEF:
|
174
|
-
// case T_VARMAP: (not in 1.9)
|
175
|
-
// case T_SCOPE: (not in 1.9)
|
176
|
-
case T_NODE:
|
177
|
-
default:
|
178
|
-
rb_warn("unknown conversion to V8 for: %s", RSTRING_PTR(rb_inspect(value)));
|
179
|
-
return String::New("Undefined Conversion");
|
180
|
-
}
|
181
|
-
|
182
|
-
return Undefined();
|
183
|
-
}
|
184
|
-
// VALUE rr_v82rb(v8::ScriptData *data) {
|
185
|
-
// return rr_thunk(rr_wrap_script_data(data));
|
186
|
-
// }
|
187
|
-
|
188
|
-
|
189
|
-
|