json_pure 1.4.0 → 1.4.6
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.
- data/CHANGES +32 -0
- data/README +5 -7
- data/Rakefile +21 -17
- data/VERSION +1 -1
- data/benchmarks/parser2_benchmark.rb +5 -5
- data/ext/json/ext/{extconf_generator.rb → generator/extconf.rb} +7 -3
- data/ext/json/ext/{generator.c → generator/generator.c} +306 -223
- data/ext/json/ext/{generator.h → generator/generator.h} +31 -4
- data/ext/json/ext/{extconf_parser.rb → parser/extconf.rb} +1 -1
- data/ext/json/ext/{parser.c → parser/parser.c} +2 -1
- data/ext/json/ext/{parser.rl → parser/parser.rl} +2 -1
- data/lib/json/common.rb +11 -17
- data/lib/json/pure/generator.rb +63 -76
- data/lib/json/pure/parser.rb +29 -27
- data/lib/json/version.rb +1 -1
- data/tests/test_json.rb +70 -3
- data/tests/test_json_addition.rb +6 -6
- data/tests/test_json_generate.rb +59 -0
- metadata +9 -9
- /data/ext/json/ext/{parser.h → parser/parser.h} +0 -0
data/CHANGES
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
2010-08-09 (1.4.6)
|
|
2
|
+
* Fixed oversight reported in http://github.com/flori/json/issues/closed#issue/23,
|
|
3
|
+
always create a new object from the state prototype.
|
|
4
|
+
* Made pure and ext api more similar again.
|
|
5
|
+
2010-08-07 (1.4.5)
|
|
6
|
+
* Manage data structure nesting depth in state object during generation. This
|
|
7
|
+
should reduce problems with to_json method definіtions that only have one
|
|
8
|
+
argument.
|
|
9
|
+
* Some fixes in the state objects and additional tests.
|
|
10
|
+
2010-08-06 (1.4.4)
|
|
11
|
+
* Fixes build problem for rubinius under OS X, http://github.com/flori/json/issues/closed#issue/25
|
|
12
|
+
* Fixes crashes described in http://github.com/flori/json/issues/closed#issue/21 and
|
|
13
|
+
http://github.com/flori/json/issues/closed#issue/23
|
|
14
|
+
2010-05-05 (1.4.3)
|
|
15
|
+
* Fixed some test assertions, from Ruby r27587 and r27590, patch by nobu.
|
|
16
|
+
* Fixed issue http://github.com/flori/json/issues/#issue/20 reported by
|
|
17
|
+
electronicwhisper@github. Thx!
|
|
18
|
+
2010-04-26 (1.4.2)
|
|
19
|
+
* Applied patch from naruse Yui NARUSE <naruse@airemix.com> to make building with
|
|
20
|
+
Microsoft Visual C possible again.
|
|
21
|
+
* Applied patch from devrandom <c1.github@niftybox.net> in order to allow building of
|
|
22
|
+
json_pure if extensiontask is not present.
|
|
23
|
+
* Thanks to Dustin Schneider <dustin@stocktwits.com>, who reported a memory
|
|
24
|
+
leak, which is fixed in this release.
|
|
25
|
+
* Applied 993f261ccb8f911d2ae57e9db48ec7acd0187283 patch from josh@github.
|
|
26
|
+
2010-04-25 (1.4.1)
|
|
27
|
+
* Fix for a bug reported by Dan DeLeo <dan@kallistec.com>, caused by T_FIXNUM
|
|
28
|
+
being different on 32bit/64bit architectures.
|
|
29
|
+
2010-04-23 (1.4.0)
|
|
30
|
+
* Major speed improvements and building with simplified
|
|
31
|
+
directory/file-structure.
|
|
32
|
+
* Extension should at least be comapatible with MRI, YARV and Rubinius.
|
|
1
33
|
2010-04-07 (1.2.4)
|
|
2
34
|
* Triger const_missing callback to make Rails' dynamic class loading work.
|
|
3
35
|
2010-03-11 (1.2.3)
|
data/README
CHANGED
|
@@ -11,13 +11,11 @@ will be two variants available:
|
|
|
11
11
|
generated by the ragel state machine compiler
|
|
12
12
|
http://www.cs.queensu.ca/~thurston/ragel .
|
|
13
13
|
|
|
14
|
-
Both variants of the JSON generator
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
that don't expect UTF-8 encoded texts. On the negative side this may lead to a
|
|
20
|
-
bit longer strings than necessarry.
|
|
14
|
+
Both variants of the JSON generator generate UTF-8 character sequences by
|
|
15
|
+
default. If an :ascii_only option with a true value is given, they escape all
|
|
16
|
+
non-ASCII and control characters with \uXXXX escape sequences, and support
|
|
17
|
+
UTF-16 surrogate pairs in order to be able to generate the whole range of
|
|
18
|
+
unicode code points.
|
|
21
19
|
|
|
22
20
|
All strings, that are to be encoded as JSON strings, should be UTF-8 byte
|
|
23
21
|
sequences on the Ruby side. To encode raw binary strings, that aren't UTF-8
|
data/Rakefile
CHANGED
|
@@ -24,14 +24,16 @@ PKG_TITLE = 'JSON Implementation for Ruby'
|
|
|
24
24
|
PKG_VERSION = File.read('VERSION').chomp
|
|
25
25
|
PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\./).exclude(/\.(so|bundle|o|#{CONFIG['DLEXT']})$/)
|
|
26
26
|
EXT_ROOT_DIR = 'ext/json/ext'
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
|
|
28
|
+
EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}"
|
|
29
|
+
EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
|
|
29
30
|
PKG_FILES << EXT_PARSER_SRC
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
|
|
32
|
+
EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
|
|
33
|
+
EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
|
|
32
34
|
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
|
|
33
35
|
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
|
|
34
|
-
RAGEL_PATH = "#{
|
|
36
|
+
RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
|
|
35
37
|
|
|
36
38
|
def myruby(*args, &block)
|
|
37
39
|
@myruby ||= File.join(CONFIG['bindir'], CONFIG['ruby_install_name'])
|
|
@@ -73,17 +75,19 @@ desc "Compiling extension"
|
|
|
73
75
|
task :compile_ext => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
|
|
74
76
|
|
|
75
77
|
file EXT_PARSER_DL => EXT_PARSER_SRC do
|
|
76
|
-
cd
|
|
77
|
-
myruby '
|
|
78
|
+
cd EXT_PARSER_DIR do
|
|
79
|
+
myruby 'extconf.rb'
|
|
78
80
|
sh MAKE
|
|
79
81
|
end
|
|
82
|
+
cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
|
80
83
|
end
|
|
81
84
|
|
|
82
85
|
file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
|
|
83
|
-
cd
|
|
84
|
-
myruby '
|
|
86
|
+
cd EXT_GENERATOR_DIR do
|
|
87
|
+
myruby 'extconf.rb'
|
|
85
88
|
sh MAKE
|
|
86
89
|
end
|
|
90
|
+
cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
|
87
91
|
end
|
|
88
92
|
|
|
89
93
|
desc "Generate parser with ragel"
|
|
@@ -94,7 +98,7 @@ task :ragel_clean do
|
|
|
94
98
|
end
|
|
95
99
|
|
|
96
100
|
file EXT_PARSER_SRC => RAGEL_PATH do
|
|
97
|
-
cd
|
|
101
|
+
cd EXT_PARSER_DIR do
|
|
98
102
|
if RAGEL_CODEGEN == 'ragel'
|
|
99
103
|
sh "ragel parser.rl -G2 -o parser.c"
|
|
100
104
|
else
|
|
@@ -170,10 +174,10 @@ task :benchmark => [ :benchmark_parser, :benchmark_generator ]
|
|
|
170
174
|
|
|
171
175
|
desc "Create RDOC documentation"
|
|
172
176
|
task :doc => [ :version, EXT_PARSER_SRC ] do
|
|
173
|
-
sh "
|
|
177
|
+
sh "sdoc -o doc -t '#{PKG_TITLE}' -m README README lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
|
|
174
178
|
end
|
|
175
179
|
|
|
176
|
-
if defined?(Gem) and defined?(Rake::GemPackageTask)
|
|
180
|
+
if defined?(Gem) and defined?(Rake::GemPackageTask)
|
|
177
181
|
spec_pure = Gem::Specification.new do |s|
|
|
178
182
|
s.name = 'json_pure'
|
|
179
183
|
s.version = PKG_VERSION
|
|
@@ -204,7 +208,9 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension
|
|
|
204
208
|
pkg.need_tar = true
|
|
205
209
|
pkg.package_files = PKG_FILES
|
|
206
210
|
end
|
|
211
|
+
end
|
|
207
212
|
|
|
213
|
+
if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::ExtensionTask)
|
|
208
214
|
spec_ext = Gem::Specification.new do |s|
|
|
209
215
|
s.name = 'json'
|
|
210
216
|
s.version = PKG_VERSION
|
|
@@ -213,7 +219,7 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension
|
|
|
213
219
|
|
|
214
220
|
s.files = PKG_FILES
|
|
215
221
|
|
|
216
|
-
s.extensions = FileList['ext/**/
|
|
222
|
+
s.extensions = FileList['ext/**/extconf.rb']
|
|
217
223
|
|
|
218
224
|
s.require_path = EXT_ROOT_DIR
|
|
219
225
|
s.require_paths << 'ext'
|
|
@@ -242,21 +248,19 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension
|
|
|
242
248
|
|
|
243
249
|
Rake::ExtensionTask.new do |ext|
|
|
244
250
|
ext.name = 'parser'
|
|
245
|
-
ext.config_script = 'extconf_parser.rb'
|
|
246
251
|
ext.gem_spec = spec_ext
|
|
247
252
|
ext.cross_compile = true
|
|
248
253
|
ext.cross_platform = %w[i386-mswin32 i386-mingw32]
|
|
249
|
-
ext.ext_dir = 'ext/json/ext'
|
|
254
|
+
ext.ext_dir = 'ext/json/ext/parser'
|
|
250
255
|
ext.lib_dir = 'lib/json/ext'
|
|
251
256
|
end
|
|
252
257
|
|
|
253
258
|
Rake::ExtensionTask.new do |ext|
|
|
254
259
|
ext.name = 'generator'
|
|
255
|
-
ext.config_script = 'extconf_generator.rb'
|
|
256
260
|
ext.gem_spec = spec_ext
|
|
257
261
|
ext.cross_compile = true
|
|
258
262
|
ext.cross_platform = %w[i386-mswin32 i386-mingw32]
|
|
259
|
-
ext.ext_dir = 'ext/json/ext'
|
|
263
|
+
ext.ext_dir = 'ext/json/ext/generator'
|
|
260
264
|
ext.lib_dir = 'lib/json/ext'
|
|
261
265
|
end
|
|
262
266
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.4.
|
|
1
|
+
1.4.6
|
|
@@ -39,7 +39,7 @@ class Parser2BenchmarkExt < Bullshit::RepeatCase
|
|
|
39
39
|
include Parser2BenchmarkCommon
|
|
40
40
|
|
|
41
41
|
warmup yes
|
|
42
|
-
iterations
|
|
42
|
+
iterations 2000
|
|
43
43
|
|
|
44
44
|
truncate_data do
|
|
45
45
|
enabled false
|
|
@@ -76,7 +76,7 @@ class Parser2BenchmarkPure < Bullshit::RepeatCase
|
|
|
76
76
|
include Parser2BenchmarkCommon
|
|
77
77
|
|
|
78
78
|
warmup yes
|
|
79
|
-
iterations
|
|
79
|
+
iterations 400
|
|
80
80
|
|
|
81
81
|
truncate_data do
|
|
82
82
|
enabled false
|
|
@@ -111,7 +111,7 @@ end
|
|
|
111
111
|
|
|
112
112
|
class Parser2BenchmarkYAML < Bullshit::RepeatCase
|
|
113
113
|
warmup yes
|
|
114
|
-
iterations
|
|
114
|
+
iterations 400
|
|
115
115
|
|
|
116
116
|
truncate_data do
|
|
117
117
|
enabled false
|
|
@@ -146,7 +146,7 @@ end
|
|
|
146
146
|
|
|
147
147
|
class Parser2BenchmarkRails < Bullshit::RepeatCase
|
|
148
148
|
warmup yes
|
|
149
|
-
iterations
|
|
149
|
+
iterations 400
|
|
150
150
|
|
|
151
151
|
truncate_data do
|
|
152
152
|
alpha_level 0.05
|
|
@@ -182,7 +182,7 @@ end
|
|
|
182
182
|
|
|
183
183
|
class Parser2BenchmarkYajl < Bullshit::RepeatCase
|
|
184
184
|
warmup yes
|
|
185
|
-
iterations
|
|
185
|
+
iterations 2000
|
|
186
186
|
|
|
187
187
|
truncate_data do
|
|
188
188
|
alpha_level 0.05
|
|
@@ -11,6 +11,10 @@ if CONFIG['CC'] =~ /gcc/
|
|
|
11
11
|
#end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
have_header("
|
|
16
|
-
|
|
14
|
+
if RUBY_VERSION < "1.9"
|
|
15
|
+
have_header("re.h")
|
|
16
|
+
else
|
|
17
|
+
have_header("ruby/re.h")
|
|
18
|
+
have_header("ruby/encoding.h")
|
|
19
|
+
end
|
|
20
|
+
create_makefile 'json/ext/generator'
|