From 6bd324502763b85914e98bcd9eb97615306146a4 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 3 Nov 2011 13:04:02 +0100 Subject: always raise type error when parsing nil --- ext/json/ext/parser/parser.c | 35 ++++++++++++++++++----------------- ext/json/ext/parser/parser.rl | 1 + lib/json/pure/parser.rb | 9 +++++++-- tests/test_json.rb | 2 ++ 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index 4ea663c..4bbc0c7 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1704,6 +1704,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) json->object_class = Qnil; json->array_class = Qnil; } + source = rb_convert_type(source, T_STRING, "String", "to_str"); if (!json->quirks_mode) { source = convert_encoding(StringValue(source)); } @@ -1715,7 +1716,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) } -#line 1719 "parser.c" +#line 1720 "parser.c" static const int JSON_start = 1; static const int JSON_first_final = 10; static const int JSON_error = 0; @@ -1723,7 +1724,7 @@ static const int JSON_error = 0; static const int JSON_en_main = 1; -#line 726 "parser.rl" +#line 727 "parser.rl" static VALUE cParser_parse_strict(VALUE self) @@ -1734,16 +1735,16 @@ static VALUE cParser_parse_strict(VALUE self) GET_PARSER; -#line 1738 "parser.c" +#line 1739 "parser.c" { cs = JSON_start; } -#line 736 "parser.rl" +#line 737 "parser.rl" p = json->source; pe = p + json->len; -#line 1747 "parser.c" +#line 1748 "parser.c" { if ( p == pe ) goto _test_eof; @@ -1799,7 +1800,7 @@ case 5: goto st1; goto st5; tr3: -#line 715 "parser.rl" +#line 716 "parser.rl" { char *np; json->current_nesting = 1; @@ -1808,7 +1809,7 @@ tr3: } goto st10; tr4: -#line 708 "parser.rl" +#line 709 "parser.rl" { char *np; json->current_nesting = 1; @@ -1820,7 +1821,7 @@ st10: if ( ++p == pe ) goto _test_eof10; case 10: -#line 1824 "parser.c" +#line 1825 "parser.c" switch( (*p) ) { case 13: goto st10; case 32: goto st10; @@ -1877,7 +1878,7 @@ case 9: _out: {} } -#line 739 "parser.rl" +#line 740 "parser.rl" if (cs >= JSON_first_final && p == pe) { return result; @@ -1889,7 +1890,7 @@ case 9: -#line 1893 "parser.c" +#line 1894 "parser.c" static const int JSON_quirks_mode_start = 1; static const int JSON_quirks_mode_first_final = 10; static const int JSON_quirks_mode_error = 0; @@ -1897,7 +1898,7 @@ static const int JSON_quirks_mode_error = 0; static const int JSON_quirks_mode_en_main = 1; -#line 764 "parser.rl" +#line 765 "parser.rl" static VALUE cParser_parse_quirks_mode(VALUE self) @@ -1908,16 +1909,16 @@ static VALUE cParser_parse_quirks_mode(VALUE self) GET_PARSER; -#line 1912 "parser.c" +#line 1913 "parser.c" { cs = JSON_quirks_mode_start; } -#line 774 "parser.rl" +#line 775 "parser.rl" p = json->source; pe = p + json->len; -#line 1921 "parser.c" +#line 1922 "parser.c" { if ( p == pe ) goto _test_eof; @@ -1951,7 +1952,7 @@ st0: cs = 0; goto _out; tr2: -#line 756 "parser.rl" +#line 757 "parser.rl" { char *np = JSON_parse_value(json, p, pe, &result); if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;} @@ -1961,7 +1962,7 @@ st10: if ( ++p == pe ) goto _test_eof10; case 10: -#line 1965 "parser.c" +#line 1966 "parser.c" switch( (*p) ) { case 13: goto st10; case 32: goto st10; @@ -2050,7 +2051,7 @@ case 9: _out: {} } -#line 777 "parser.rl" +#line 778 "parser.rl" if (cs >= JSON_quirks_mode_first_final && p == pe) { return result; diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index e7d47e1..8c4681d 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -688,6 +688,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) json->object_class = Qnil; json->array_class = Qnil; } + source = rb_convert_type(source, T_STRING, "String", "to_str"); if (!json->quirks_mode) { source = convert_encoding(StringValue(source)); } diff --git a/lib/json/pure/parser.rb b/lib/json/pure/parser.rb index e24aac1..84eb67f 100644 --- a/lib/json/pure/parser.rb +++ b/lib/json/pure/parser.rb @@ -73,7 +73,7 @@ module JSON def initialize(source, opts = {}) opts ||= {} unless @quirks_mode = opts[:quirks_mode] - source = determine_encoding source + source = convert_encoding source end super source if !opts.key?(:max_nesting) # defaults to 19 @@ -145,7 +145,12 @@ module JSON private - def determine_encoding(source) + def convert_encoding(source) + if source.respond_to?(:to_str) + source = source.to_str + else + raise TypeError, "#{source.inspect} is not like a string" + end if defined?(::Encoding) if source.encoding == ::Encoding::ASCII_8BIT b = source[0, 4].bytes.to_a diff --git a/tests/test_json.rb b/tests/test_json.rb index eafd758..5492b8e 100755 --- a/tests/test_json.rb +++ b/tests/test_json.rb @@ -107,6 +107,8 @@ class TC_JSON < Test::Unit::TestCase def test_parse_json_primitive_values assert_raise(JSON::ParserError) { JSON.parse('') } assert_raise(JSON::ParserError) { JSON.parse('', :quirks_mode => true) } + assert_raise(TypeError) { JSON.parse(nil) } + assert_raise(TypeError) { JSON.parse(nil, :quirks_mode => true) } assert_raise(JSON::ParserError) { JSON.parse(' /* foo */ ') } assert_raise(JSON::ParserError) { JSON.parse(' /* foo */ ', :quirks_mode => true) } parser = JSON::Parser.new('null') -- cgit v1.2.1 From b50b1bdeaec8759bdf0d11e1c1f942e0ed6542f5 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 3 Nov 2011 13:19:21 +0100 Subject: probe for read before calling it --- lib/json/common.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/json/common.rb b/lib/json/common.rb index 43e249c..e0d55a0 100644 --- a/lib/json/common.rb +++ b/lib/json/common.rb @@ -296,7 +296,7 @@ module JSON source = source.to_str elsif source.respond_to? :to_io source = source.to_io.read - else + elsif source.respond_to?(:read) source = source.read end result = parse(source, :max_nesting => false, :allow_nan => true) -- cgit v1.2.1 From 75a3b423f28088db9c90c338200fbffc2354c9f3 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Wed, 9 Nov 2011 01:53:01 +0100 Subject: start to make buffer_initial_length configurable --- benchmarks/generator2_benchmark.rb | 2 +- benchmarks/generator_benchmark.rb | 2 +- benchmarks/parser2_benchmark.rb | 2 +- benchmarks/parser_benchmark.rb | 2 +- ext/json/ext/generator/generator.c | 76 ++++++++++++++++++++++++++++---------- ext/json/ext/generator/generator.h | 6 +-- lib/json/pure/generator.rb | 29 ++++++++++----- tests/test_json_generate.rb | 74 ++++++++++++++++++++++--------------- 8 files changed, 128 insertions(+), 65 deletions(-) diff --git a/benchmarks/generator2_benchmark.rb b/benchmarks/generator2_benchmark.rb index 9885143..90fc711 100755 --- a/benchmarks/generator2_benchmark.rb +++ b/benchmarks/generator2_benchmark.rb @@ -199,7 +199,7 @@ if $0 == __FILE__ system "#{RAKE_PATH} clean" system "#{RUBY_PATH} #$0 rails" system "#{RUBY_PATH} #$0 pure" - system "#{RAKE_PATH} compile_ext" + system "#{RAKE_PATH} compile" system "#{RUBY_PATH} #$0 ext" system "#{RUBY_PATH} #$0 yajl" Bullshit.compare do diff --git a/benchmarks/generator_benchmark.rb b/benchmarks/generator_benchmark.rb index 83fa577..0554bca 100755 --- a/benchmarks/generator_benchmark.rb +++ b/benchmarks/generator_benchmark.rb @@ -201,7 +201,7 @@ if $0 == __FILE__ system "#{RAKE_PATH} clean" system "#{RUBY_PATH} #$0 rails" system "#{RUBY_PATH} #$0 pure" - system "#{RAKE_PATH} compile_ext" + system "#{RAKE_PATH} compile" system "#{RUBY_PATH} #$0 ext" system "#{RUBY_PATH} #$0 yajl" Bullshit.compare do diff --git a/benchmarks/parser2_benchmark.rb b/benchmarks/parser2_benchmark.rb index 95a510d..8798660 100755 --- a/benchmarks/parser2_benchmark.rb +++ b/benchmarks/parser2_benchmark.rb @@ -233,7 +233,7 @@ if $0 == __FILE__ system "#{RUBY_PATH} #$0 yaml" system "#{RUBY_PATH} #$0 rails" system "#{RUBY_PATH} #$0 pure" - system "#{RAKE_PATH} compile_ext" + system "#{RAKE_PATH} compile" system "#{RUBY_PATH} #$0 ext" system "#{RUBY_PATH} #$0 yajl" Bullshit.compare do diff --git a/benchmarks/parser_benchmark.rb b/benchmarks/parser_benchmark.rb index 9ce7e25..ed2331a 100755 --- a/benchmarks/parser_benchmark.rb +++ b/benchmarks/parser_benchmark.rb @@ -241,7 +241,7 @@ if $0 == __FILE__ system "#{RUBY_PATH} #$0 yaml" system "#{RUBY_PATH} #$0 rails" system "#{RUBY_PATH} #$0 pure" - system "#{RAKE_PATH} compile_ext" + system "#{RAKE_PATH} compile" system "#{RUBY_PATH} #$0 ext" system "#{RUBY_PATH} #$0 yajl" Bullshit.compare do diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index 781e9e6..d82973e 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -14,7 +14,8 @@ static VALUE mJSON, mExt, mGenerator, cState, mGeneratorMethods, mObject, static ID i_to_s, i_to_json, i_new, i_indent, i_space, i_space_before, i_object_nl, i_array_nl, i_max_nesting, i_allow_nan, i_ascii_only, i_quirks_mode, i_pack, i_unpack, i_create_id, i_extend, i_key_p, - i_aref, i_send, i_respond_to_p, i_match, i_keys, i_depth, i_dup; + i_aref, i_send, i_respond_to_p, i_match, i_keys, i_depth, + i_buffer_initial_length, i_dup; /* * Copyright 2001-2004 Unicode, Inc. @@ -294,18 +295,10 @@ static char *fstrndup(const char *ptr, unsigned long len) { /* fbuffer implementation */ -static FBuffer *fbuffer_alloc() -{ - FBuffer *fb = ALLOC(FBuffer); - memset((void *) fb, 0, sizeof(FBuffer)); - fb->initial_length = FBUFFER_INITIAL_LENGTH; - return fb; -} - -static FBuffer *fbuffer_alloc_with_length(unsigned long initial_length) +static FBuffer *fbuffer_alloc(unsigned long initial_length) { FBuffer *fb; - assert(initial_length > 0); + if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT; fb = ALLOC(FBuffer); memset((void *) fb, 0, sizeof(FBuffer)); fb->initial_length = initial_length; @@ -400,11 +393,10 @@ static FBuffer *fbuffer_dup(FBuffer *fb) unsigned long len = fb->len; FBuffer *result; + assert(len > 0); if (len > 0) { - result = fbuffer_alloc_with_length(len); + result = fbuffer_alloc(len); fbuffer_append(result, FBUFFER_PAIR(fb)); - } else { - result = fbuffer_alloc(); } return result; } @@ -694,6 +686,16 @@ static VALUE cState_configure(VALUE self, VALUE opts) state->depth = 0; } } + tmp = ID2SYM(i_buffer_initial_length); + if (option_given_p(opts, tmp)) { + VALUE buffer_initial_length = rb_hash_aref(opts, tmp); + if (RTEST(buffer_initial_length)) { + long initial_length; + Check_Type(buffer_initial_length, T_FIXNUM); + initial_length = FIX2LONG(buffer_initial_length); + if (initial_length > 0) state->buffer_initial_length = initial_length; + } + } tmp = rb_hash_aref(opts, ID2SYM(i_allow_nan)); state->allow_nan = RTEST(tmp); tmp = rb_hash_aref(opts, ID2SYM(i_ascii_only)); @@ -723,6 +725,7 @@ static VALUE cState_to_h(VALUE self) rb_hash_aset(result, ID2SYM(i_quirks_mode), state->quirks_mode ? Qtrue : Qfalse); rb_hash_aset(result, ID2SYM(i_max_nesting), LONG2FIX(state->max_nesting)); rb_hash_aset(result, ID2SYM(i_depth), LONG2FIX(state->depth)); + rb_hash_aset(result, ID2SYM(i_buffer_initial_length), LONG2FIX(state->buffer_initial_length)); return result; } @@ -920,19 +923,20 @@ static void generate_json(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *s static FBuffer *cState_prepare_buffer(VALUE self) { - FBuffer *buffer = fbuffer_alloc(); + FBuffer *buffer; GET_STATE(self); + buffer = fbuffer_alloc(state->buffer_initial_length); if (state->object_delim) { fbuffer_clear(state->object_delim); } else { - state->object_delim = fbuffer_alloc_with_length(16); + state->object_delim = fbuffer_alloc(16); } fbuffer_append_char(state->object_delim, ','); if (state->object_delim2) { fbuffer_clear(state->object_delim2); } else { - state->object_delim2 = fbuffer_alloc_with_length(16); + state->object_delim2 = fbuffer_alloc(16); } fbuffer_append_char(state->object_delim2, ':'); if (state->space) fbuffer_append(state->object_delim2, state->space, state->space_len); @@ -940,7 +944,7 @@ static FBuffer *cState_prepare_buffer(VALUE self) if (state->array_delim) { fbuffer_clear(state->array_delim); } else { - state->array_delim = fbuffer_alloc_with_length(16); + state->array_delim = fbuffer_alloc(16); } fbuffer_append_char(state->array_delim, ','); if (state->array_nl) fbuffer_append(state->array_delim, state->array_nl, state->array_nl_len); @@ -1009,6 +1013,7 @@ static VALUE cState_initialize(int argc, VALUE *argv, VALUE self) VALUE opts; GET_STATE(self); state->max_nesting = 19; + state->buffer_initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT; rb_scan_args(argc, argv, "01", &opts); if (!NIL_P(opts)) cState_configure(self, opts); return self; @@ -1349,7 +1354,37 @@ static VALUE cState_depth_set(VALUE self, VALUE depth) { GET_STATE(self); Check_Type(depth, T_FIXNUM); - return state->depth = FIX2LONG(depth); + state->depth = FIX2LONG(depth); + return Qnil; +} + +/* + * call-seq: buffer_initial_length + * + * This integer returns the current inital length of the buffer. + */ +static VALUE cState_buffer_initial_length(VALUE self) +{ + GET_STATE(self); + return LONG2FIX(state->buffer_initial_length); +} + +/* + * call-seq: buffer_initial_length=(length) + * + * This sets the initial length of the buffer to +length+, if +length+ > 0, + * otherwise it's set to the default value. + */ +static VALUE cState_buffer_initial_length_set(VALUE self, VALUE buffer_initial_length) +{ + long initial_length; + GET_STATE(self); + Check_Type(buffer_initial_length, T_FIXNUM); + initial_length = FIX2LONG(buffer_initial_length); + if (initial_length > 0) { + state->buffer_initial_length = initial_length; + } + return Qnil; } /* @@ -1391,6 +1426,8 @@ void Init_generator() rb_define_method(cState, "quirks_mode=", cState_quirks_mode_set, 1); rb_define_method(cState, "depth", cState_depth, 0); rb_define_method(cState, "depth=", cState_depth_set, 1); + rb_define_method(cState, "buffer_initial_length", cState_buffer_initial_length, 0); + rb_define_method(cState, "buffer_initial_length=", cState_buffer_initial_length_set, 1); rb_define_method(cState, "configure", cState_configure, 1); rb_define_alias(cState, "merge", "configure"); rb_define_method(cState, "to_h", cState_to_h, 0); @@ -1438,6 +1475,7 @@ void Init_generator() i_ascii_only = rb_intern("ascii_only"); i_quirks_mode = rb_intern("quirks_mode"); i_depth = rb_intern("depth"); + i_buffer_initial_length = rb_intern("buffer_initial_length"); i_pack = rb_intern("pack"); i_unpack = rb_intern("unpack"); i_create_id = rb_intern("create_id"); diff --git a/ext/json/ext/generator/generator.h b/ext/json/ext/generator/generator.h index 1fdd351..ec6cb2a 100644 --- a/ext/json/ext/generator/generator.h +++ b/ext/json/ext/generator/generator.h @@ -57,7 +57,7 @@ typedef struct FBufferStruct { unsigned long capa; } FBuffer; -#define FBUFFER_INITIAL_LENGTH 4096 +#define FBUFFER_INITIAL_LENGTH_DEFAULT 4096 #define FBUFFER_PTR(fb) (fb->ptr) #define FBUFFER_LEN(fb) (fb->len) @@ -65,8 +65,7 @@ typedef struct FBufferStruct { #define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb) static char *fstrndup(const char *ptr, unsigned long len); -static FBuffer *fbuffer_alloc(); -static FBuffer *fbuffer_alloc_with_length(unsigned long initial_length); +static FBuffer *fbuffer_alloc(unsigned long initial_length); static void fbuffer_free(FBuffer *fb); static void fbuffer_clear(FBuffer *fb); static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len); @@ -126,6 +125,7 @@ typedef struct JSON_Generator_StateStruct { char ascii_only; char quirks_mode; long depth; + long buffer_initial_length; } JSON_Generator_State; #define GET_STATE(self) \ diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb index 7c9b2ad..9c776a1 100644 --- a/lib/json/pure/generator.rb +++ b/lib/json/pure/generator.rb @@ -136,14 +136,15 @@ module JSON # * *quirks_mode*: Enables quirks_mode for parser, that is for example # generating single JSON values instead of documents is possible. def initialize(opts = {}) - @indent = '' - @space = '' - @space_before = '' - @object_nl = '' - @array_nl = '' - @allow_nan = false - @ascii_only = false - @quirks_mode = false + @indent = '' + @space = '' + @space_before = '' + @object_nl = '' + @array_nl = '' + @allow_nan = false + @ascii_only = false + @quirks_mode = false + @buffer_initial_length = 4096 configure opts end @@ -172,6 +173,16 @@ module JSON # it's disabled. attr_accessor :quirks_mode + # XXX + attr_reader :buffer_initial_length + + # XXX + def buffer_initial_length=(length) + if length > 0 + @buffer_initial_length = length + end + end + # This integer returns the current depth data structure nesting in the # generated JSON. attr_accessor :depth @@ -233,7 +244,7 @@ module JSON # passed to the configure method. def to_h result = {} - for iv in %w[indent space space_before object_nl array_nl allow_nan max_nesting ascii_only quirks_mode depth] + for iv in %w[indent space space_before object_nl array_nl allow_nan max_nesting ascii_only quirks_mode buffer_initial_length depth] result[iv.intern] = instance_variable_get("@#{iv}") end result diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb index da96603..58deb3b 100755 --- a/tests/test_json_generate.rb +++ b/tests/test_json_generate.rb @@ -121,48 +121,51 @@ EOT def test_pretty_state state = PRETTY_STATE_PROTOTYPE.dup assert_equal({ - :allow_nan => false, - :array_nl => "\n", - :ascii_only => false, - :quirks_mode => false, - :depth => 0, - :indent => " ", - :max_nesting => 19, - :object_nl => "\n", - :space => " ", - :space_before => "", + :allow_nan => false, + :array_nl => "\n", + :ascii_only => false, + :buffer_initial_length => 4096, + :quirks_mode => false, + :depth => 0, + :indent => " ", + :max_nesting => 19, + :object_nl => "\n", + :space => " ", + :space_before => "", }.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s }) end def test_safe_state state = SAFE_STATE_PROTOTYPE.dup assert_equal({ - :allow_nan => false, - :array_nl => "", - :ascii_only => false, - :quirks_mode => false, - :depth => 0, - :indent => "", - :max_nesting => 19, - :object_nl => "", - :space => "", - :space_before => "", + :allow_nan => false, + :array_nl => "", + :ascii_only => false, + :buffer_initial_length => 4096, + :quirks_mode => false, + :depth => 0, + :indent => "", + :max_nesting => 19, + :object_nl => "", + :space => "", + :space_before => "", }.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s }) end def test_fast_state state = FAST_STATE_PROTOTYPE.dup assert_equal({ - :allow_nan => false, - :array_nl => "", - :ascii_only => false, - :quirks_mode => false, - :depth => 0, - :indent => "", - :max_nesting => 0, - :object_nl => "", - :space => "", - :space_before => "", + :allow_nan => false, + :array_nl => "", + :ascii_only => false, + :buffer_initial_length => 4096, + :quirks_mode => false, + :depth => 0, + :indent => "", + :max_nesting => 0, + :object_nl => "", + :space => "", + :space_before => "", }.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s }) end @@ -198,6 +201,17 @@ EOT assert_equal 19, s.depth end + def test_buffer_initial_length + s = JSON.state.new + assert_equal 4096, s.buffer_initial_length + s.buffer_initial_length = 0 + assert_equal 4096, s.buffer_initial_length + s.buffer_initial_length = -1 + assert_equal 4096, s.buffer_initial_length + s.buffer_initial_length = 128 + assert_equal 128, s.buffer_initial_length + end + def test_gc bignum_too_long_to_embed_as_string = 1234567890123456789012345 expect = bignum_too_long_to_embed_as_string.to_s -- cgit v1.2.1 From 4ee26ac90981bbe5d7b5114ddd5036a5cea24251 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Mon, 29 Aug 2011 23:12:58 +0200 Subject: Add testcase for a possible crash with bignum --- tests/test_json_generate.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb index da96603..2110eba 100755 --- a/tests/test_json_generate.rb +++ b/tests/test_json_generate.rb @@ -210,4 +210,24 @@ EOT ensure GC.stress = stress end if GC.respond_to?(:stress=) + + def test_broken_bignum # [ruby-core:38867] + pid = fork do + Bignum.class_eval do + def to_s + end + end + begin + JSON::Ext::Generator::State.new.generate(1<<64) + exit 1 + rescue TypeError + exit 0 + end + end + _, status = Process.waitpid2(pid) + assert status.success? + rescue NotImplementedError + # forking to avoid modifying core class of a parent process and + # introducing race conditions of tests are run in parallel + end if defined?(JSON::Ext) end -- cgit v1.2.1 From a4e599122fc0a6b849350c7cf4aa0721b0d45c3c Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Wed, 9 Nov 2011 01:53:01 +0100 Subject: start to make buffer_initial_length configurable --- benchmarks/generator2_benchmark.rb | 2 +- benchmarks/generator_benchmark.rb | 2 +- benchmarks/parser2_benchmark.rb | 2 +- benchmarks/parser_benchmark.rb | 2 +- ext/json/ext/generator/generator.c | 76 ++++++++++++++++++++++++++++---------- ext/json/ext/generator/generator.h | 6 +-- lib/json/pure/generator.rb | 29 ++++++++++----- tests/test_json_generate.rb | 72 +++++++++++++++++++++--------------- 8 files changed, 126 insertions(+), 65 deletions(-) diff --git a/benchmarks/generator2_benchmark.rb b/benchmarks/generator2_benchmark.rb index 9885143..90fc711 100755 --- a/benchmarks/generator2_benchmark.rb +++ b/benchmarks/generator2_benchmark.rb @@ -199,7 +199,7 @@ if $0 == __FILE__ system "#{RAKE_PATH} clean" system "#{RUBY_PATH} #$0 rails" system "#{RUBY_PATH} #$0 pure" - system "#{RAKE_PATH} compile_ext" + system "#{RAKE_PATH} compile" system "#{RUBY_PATH} #$0 ext" system "#{RUBY_PATH} #$0 yajl" Bullshit.compare do diff --git a/benchmarks/generator_benchmark.rb b/benchmarks/generator_benchmark.rb index 83fa577..0554bca 100755 --- a/benchmarks/generator_benchmark.rb +++ b/benchmarks/generator_benchmark.rb @@ -201,7 +201,7 @@ if $0 == __FILE__ system "#{RAKE_PATH} clean" system "#{RUBY_PATH} #$0 rails" system "#{RUBY_PATH} #$0 pure" - system "#{RAKE_PATH} compile_ext" + system "#{RAKE_PATH} compile" system "#{RUBY_PATH} #$0 ext" system "#{RUBY_PATH} #$0 yajl" Bullshit.compare do diff --git a/benchmarks/parser2_benchmark.rb b/benchmarks/parser2_benchmark.rb index 95a510d..8798660 100755 --- a/benchmarks/parser2_benchmark.rb +++ b/benchmarks/parser2_benchmark.rb @@ -233,7 +233,7 @@ if $0 == __FILE__ system "#{RUBY_PATH} #$0 yaml" system "#{RUBY_PATH} #$0 rails" system "#{RUBY_PATH} #$0 pure" - system "#{RAKE_PATH} compile_ext" + system "#{RAKE_PATH} compile" system "#{RUBY_PATH} #$0 ext" system "#{RUBY_PATH} #$0 yajl" Bullshit.compare do diff --git a/benchmarks/parser_benchmark.rb b/benchmarks/parser_benchmark.rb index 9ce7e25..ed2331a 100755 --- a/benchmarks/parser_benchmark.rb +++ b/benchmarks/parser_benchmark.rb @@ -241,7 +241,7 @@ if $0 == __FILE__ system "#{RUBY_PATH} #$0 yaml" system "#{RUBY_PATH} #$0 rails" system "#{RUBY_PATH} #$0 pure" - system "#{RAKE_PATH} compile_ext" + system "#{RAKE_PATH} compile" system "#{RUBY_PATH} #$0 ext" system "#{RUBY_PATH} #$0 yajl" Bullshit.compare do diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index 781e9e6..d82973e 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -14,7 +14,8 @@ static VALUE mJSON, mExt, mGenerator, cState, mGeneratorMethods, mObject, static ID i_to_s, i_to_json, i_new, i_indent, i_space, i_space_before, i_object_nl, i_array_nl, i_max_nesting, i_allow_nan, i_ascii_only, i_quirks_mode, i_pack, i_unpack, i_create_id, i_extend, i_key_p, - i_aref, i_send, i_respond_to_p, i_match, i_keys, i_depth, i_dup; + i_aref, i_send, i_respond_to_p, i_match, i_keys, i_depth, + i_buffer_initial_length, i_dup; /* * Copyright 2001-2004 Unicode, Inc. @@ -294,18 +295,10 @@ static char *fstrndup(const char *ptr, unsigned long len) { /* fbuffer implementation */ -static FBuffer *fbuffer_alloc() -{ - FBuffer *fb = ALLOC(FBuffer); - memset((void *) fb, 0, sizeof(FBuffer)); - fb->initial_length = FBUFFER_INITIAL_LENGTH; - return fb; -} - -static FBuffer *fbuffer_alloc_with_length(unsigned long initial_length) +static FBuffer *fbuffer_alloc(unsigned long initial_length) { FBuffer *fb; - assert(initial_length > 0); + if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT; fb = ALLOC(FBuffer); memset((void *) fb, 0, sizeof(FBuffer)); fb->initial_length = initial_length; @@ -400,11 +393,10 @@ static FBuffer *fbuffer_dup(FBuffer *fb) unsigned long len = fb->len; FBuffer *result; + assert(len > 0); if (len > 0) { - result = fbuffer_alloc_with_length(len); + result = fbuffer_alloc(len); fbuffer_append(result, FBUFFER_PAIR(fb)); - } else { - result = fbuffer_alloc(); } return result; } @@ -694,6 +686,16 @@ static VALUE cState_configure(VALUE self, VALUE opts) state->depth = 0; } } + tmp = ID2SYM(i_buffer_initial_length); + if (option_given_p(opts, tmp)) { + VALUE buffer_initial_length = rb_hash_aref(opts, tmp); + if (RTEST(buffer_initial_length)) { + long initial_length; + Check_Type(buffer_initial_length, T_FIXNUM); + initial_length = FIX2LONG(buffer_initial_length); + if (initial_length > 0) state->buffer_initial_length = initial_length; + } + } tmp = rb_hash_aref(opts, ID2SYM(i_allow_nan)); state->allow_nan = RTEST(tmp); tmp = rb_hash_aref(opts, ID2SYM(i_ascii_only)); @@ -723,6 +725,7 @@ static VALUE cState_to_h(VALUE self) rb_hash_aset(result, ID2SYM(i_quirks_mode), state->quirks_mode ? Qtrue : Qfalse); rb_hash_aset(result, ID2SYM(i_max_nesting), LONG2FIX(state->max_nesting)); rb_hash_aset(result, ID2SYM(i_depth), LONG2FIX(state->depth)); + rb_hash_aset(result, ID2SYM(i_buffer_initial_length), LONG2FIX(state->buffer_initial_length)); return result; } @@ -920,19 +923,20 @@ static void generate_json(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *s static FBuffer *cState_prepare_buffer(VALUE self) { - FBuffer *buffer = fbuffer_alloc(); + FBuffer *buffer; GET_STATE(self); + buffer = fbuffer_alloc(state->buffer_initial_length); if (state->object_delim) { fbuffer_clear(state->object_delim); } else { - state->object_delim = fbuffer_alloc_with_length(16); + state->object_delim = fbuffer_alloc(16); } fbuffer_append_char(state->object_delim, ','); if (state->object_delim2) { fbuffer_clear(state->object_delim2); } else { - state->object_delim2 = fbuffer_alloc_with_length(16); + state->object_delim2 = fbuffer_alloc(16); } fbuffer_append_char(state->object_delim2, ':'); if (state->space) fbuffer_append(state->object_delim2, state->space, state->space_len); @@ -940,7 +944,7 @@ static FBuffer *cState_prepare_buffer(VALUE self) if (state->array_delim) { fbuffer_clear(state->array_delim); } else { - state->array_delim = fbuffer_alloc_with_length(16); + state->array_delim = fbuffer_alloc(16); } fbuffer_append_char(state->array_delim, ','); if (state->array_nl) fbuffer_append(state->array_delim, state->array_nl, state->array_nl_len); @@ -1009,6 +1013,7 @@ static VALUE cState_initialize(int argc, VALUE *argv, VALUE self) VALUE opts; GET_STATE(self); state->max_nesting = 19; + state->buffer_initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT; rb_scan_args(argc, argv, "01", &opts); if (!NIL_P(opts)) cState_configure(self, opts); return self; @@ -1349,7 +1354,37 @@ static VALUE cState_depth_set(VALUE self, VALUE depth) { GET_STATE(self); Check_Type(depth, T_FIXNUM); - return state->depth = FIX2LONG(depth); + state->depth = FIX2LONG(depth); + return Qnil; +} + +/* + * call-seq: buffer_initial_length + * + * This integer returns the current inital length of the buffer. + */ +static VALUE cState_buffer_initial_length(VALUE self) +{ + GET_STATE(self); + return LONG2FIX(state->buffer_initial_length); +} + +/* + * call-seq: buffer_initial_length=(length) + * + * This sets the initial length of the buffer to +length+, if +length+ > 0, + * otherwise it's set to the default value. + */ +static VALUE cState_buffer_initial_length_set(VALUE self, VALUE buffer_initial_length) +{ + long initial_length; + GET_STATE(self); + Check_Type(buffer_initial_length, T_FIXNUM); + initial_length = FIX2LONG(buffer_initial_length); + if (initial_length > 0) { + state->buffer_initial_length = initial_length; + } + return Qnil; } /* @@ -1391,6 +1426,8 @@ void Init_generator() rb_define_method(cState, "quirks_mode=", cState_quirks_mode_set, 1); rb_define_method(cState, "depth", cState_depth, 0); rb_define_method(cState, "depth=", cState_depth_set, 1); + rb_define_method(cState, "buffer_initial_length", cState_buffer_initial_length, 0); + rb_define_method(cState, "buffer_initial_length=", cState_buffer_initial_length_set, 1); rb_define_method(cState, "configure", cState_configure, 1); rb_define_alias(cState, "merge", "configure"); rb_define_method(cState, "to_h", cState_to_h, 0); @@ -1438,6 +1475,7 @@ void Init_generator() i_ascii_only = rb_intern("ascii_only"); i_quirks_mode = rb_intern("quirks_mode"); i_depth = rb_intern("depth"); + i_buffer_initial_length = rb_intern("buffer_initial_length"); i_pack = rb_intern("pack"); i_unpack = rb_intern("unpack"); i_create_id = rb_intern("create_id"); diff --git a/ext/json/ext/generator/generator.h b/ext/json/ext/generator/generator.h index 1fdd351..ec6cb2a 100644 --- a/ext/json/ext/generator/generator.h +++ b/ext/json/ext/generator/generator.h @@ -57,7 +57,7 @@ typedef struct FBufferStruct { unsigned long capa; } FBuffer; -#define FBUFFER_INITIAL_LENGTH 4096 +#define FBUFFER_INITIAL_LENGTH_DEFAULT 4096 #define FBUFFER_PTR(fb) (fb->ptr) #define FBUFFER_LEN(fb) (fb->len) @@ -65,8 +65,7 @@ typedef struct FBufferStruct { #define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb) static char *fstrndup(const char *ptr, unsigned long len); -static FBuffer *fbuffer_alloc(); -static FBuffer *fbuffer_alloc_with_length(unsigned long initial_length); +static FBuffer *fbuffer_alloc(unsigned long initial_length); static void fbuffer_free(FBuffer *fb); static void fbuffer_clear(FBuffer *fb); static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len); @@ -126,6 +125,7 @@ typedef struct JSON_Generator_StateStruct { char ascii_only; char quirks_mode; long depth; + long buffer_initial_length; } JSON_Generator_State; #define GET_STATE(self) \ diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb index 7c9b2ad..9c776a1 100644 --- a/lib/json/pure/generator.rb +++ b/lib/json/pure/generator.rb @@ -136,14 +136,15 @@ module JSON # * *quirks_mode*: Enables quirks_mode for parser, that is for example # generating single JSON values instead of documents is possible. def initialize(opts = {}) - @indent = '' - @space = '' - @space_before = '' - @object_nl = '' - @array_nl = '' - @allow_nan = false - @ascii_only = false - @quirks_mode = false + @indent = '' + @space = '' + @space_before = '' + @object_nl = '' + @array_nl = '' + @allow_nan = false + @ascii_only = false + @quirks_mode = false + @buffer_initial_length = 4096 configure opts end @@ -172,6 +173,16 @@ module JSON # it's disabled. attr_accessor :quirks_mode + # XXX + attr_reader :buffer_initial_length + + # XXX + def buffer_initial_length=(length) + if length > 0 + @buffer_initial_length = length + end + end + # This integer returns the current depth data structure nesting in the # generated JSON. attr_accessor :depth @@ -233,7 +244,7 @@ module JSON # passed to the configure method. def to_h result = {} - for iv in %w[indent space space_before object_nl array_nl allow_nan max_nesting ascii_only quirks_mode depth] + for iv in %w[indent space space_before object_nl array_nl allow_nan max_nesting ascii_only quirks_mode buffer_initial_length depth] result[iv.intern] = instance_variable_get("@#{iv}") end result diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb index 2110eba..a528209 100755 --- a/tests/test_json_generate.rb +++ b/tests/test_json_generate.rb @@ -121,48 +121,51 @@ EOT def test_pretty_state state = PRETTY_STATE_PROTOTYPE.dup assert_equal({ - :allow_nan => false, - :array_nl => "\n", - :ascii_only => false, - :quirks_mode => false, - :depth => 0, - :indent => " ", - :max_nesting => 19, - :object_nl => "\n", - :space => " ", - :space_before => "", + :allow_nan => false, + :array_nl => "\n", + :ascii_only => false, + :buffer_initial_length => 4096, + :quirks_mode => false, + :depth => 0, + :indent => " ", + :max_nesting => 19, + :object_nl => "\n", + :space => " ", + :space_before => "", }.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s }) end def test_safe_state state = SAFE_STATE_PROTOTYPE.dup assert_equal({ - :allow_nan => false, - :array_nl => "", - :ascii_only => false, - :quirks_mode => false, - :depth => 0, - :indent => "", - :max_nesting => 19, - :object_nl => "", - :space => "", - :space_before => "", + :allow_nan => false, + :array_nl => "", + :ascii_only => false, + :buffer_initial_length => 4096, + :quirks_mode => false, + :depth => 0, + :indent => "", + :max_nesting => 19, + :object_nl => "", + :space => "", + :space_before => "", }.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s }) end def test_fast_state state = FAST_STATE_PROTOTYPE.dup assert_equal({ - :allow_nan => false, - :array_nl => "", - :ascii_only => false, - :quirks_mode => false, - :depth => 0, - :indent => "", - :max_nesting => 0, - :object_nl => "", - :space => "", - :space_before => "", + :allow_nan => false, + :array_nl => "", + :ascii_only => false, + :buffer_initial_length => 4096, + :quirks_mode => false, + :depth => 0, + :indent => "", + :max_nesting => 0, + :object_nl => "", + :space => "", + :space_before => "", }.sort_by { |n,| n.to_s }, state.to_h.sort_by { |n,| n.to_s }) end @@ -198,6 +201,15 @@ EOT assert_equal 19, s.depth end + def test_buffer_initial_length + s = JSON.state.new + assert_equal 4096, s.buffer_initial_length + s.buffer_initial_length = 0 + assert_equal 4096, s.buffer_initial_length + s.buffer_initial_length = -1 + assert_equal 4096, s.buffer_initial_length + end + def test_gc bignum_too_long_to_embed_as_string = 1234567890123456789012345 expect = bignum_too_long_to_embed_as_string.to_s -- cgit v1.2.1 From f1f0090a8b4bf3afd1f8e7d790236691386fd398 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Wed, 9 Nov 2011 01:53:01 +0100 Subject: start to make buffer_initial_length configurable --- tests/test_json_generate.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb index a528209..29ea7ce 100755 --- a/tests/test_json_generate.rb +++ b/tests/test_json_generate.rb @@ -208,6 +208,8 @@ EOT assert_equal 4096, s.buffer_initial_length s.buffer_initial_length = -1 assert_equal 4096, s.buffer_initial_length + s.buffer_initial_length = 128 + assert_equal 128, s.buffer_initial_length end def test_gc -- cgit v1.2.1 From 70bcd0f0ebef2808aa65d59ac77560a6fff6e5c5 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 10 Nov 2011 08:44:21 +0100 Subject: change documentation --- ext/json/ext/generator/generator.c | 4 +++- lib/json/pure/generator.rb | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index d82973e..b878984 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -1007,6 +1007,8 @@ static VALUE cState_generate(VALUE self, VALUE obj) * encountered. This options defaults to false. * * *quirks_mode*: Enables quirks_mode for parser, that is for example * generating single JSON values instead of documents is possible. + * * *buffer_initial_length*: sets the initial length of the generator's + * internal buffer. */ static VALUE cState_initialize(int argc, VALUE *argv, VALUE self) { @@ -1373,7 +1375,7 @@ static VALUE cState_buffer_initial_length(VALUE self) * call-seq: buffer_initial_length=(length) * * This sets the initial length of the buffer to +length+, if +length+ > 0, - * otherwise it's set to the default value. + * otherwise its value isn't changed. */ static VALUE cState_buffer_initial_length_set(VALUE self, VALUE buffer_initial_length) { diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb index 9c776a1..baa94d8 100644 --- a/lib/json/pure/generator.rb +++ b/lib/json/pure/generator.rb @@ -173,15 +173,15 @@ module JSON # it's disabled. attr_accessor :quirks_mode - # XXX + # :stopdoc: attr_reader :buffer_initial_length - # XXX def buffer_initial_length=(length) if length > 0 @buffer_initial_length = length end end + # :startdoc: # This integer returns the current depth data structure nesting in the # generated JSON. -- cgit v1.2.1 From e3784346b6524d2350baa2da2845377557d840ec Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Wed, 16 Nov 2011 12:04:46 +0100 Subject: MEMZERO effectively sets everything to Qfalse, not Qnil --- ext/json/ext/parser/parser.c | 12 ++++++------ ext/json/ext/parser/parser.rl | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index b44b396..07d1c17 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -2093,12 +2093,12 @@ static JSON_Parser *JSON_allocate() { JSON_Parser *json = ALLOC(JSON_Parser); MEMZERO(json, JSON_Parser, 1); - json->dwrapped_parser = Qnil; - json->Vsource = Qnil; - json->create_id = Qnil; - json->object_class = Qnil; - json->array_class = Qnil; - json->match_string = Qnil; + json->dwrapped_parser = Qfalse; + json->Vsource = Qfalse; + json->create_id = Qfalse; + json->object_class = Qfalse; + json->array_class = Qfalse; + json->match_string = Qfalse; return json; } diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index 56e1a11..b07c599 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -816,12 +816,12 @@ static JSON_Parser *JSON_allocate() { JSON_Parser *json = ALLOC(JSON_Parser); MEMZERO(json, JSON_Parser, 1); - json->dwrapped_parser = Qnil; - json->Vsource = Qnil; - json->create_id = Qnil; - json->object_class = Qnil; - json->array_class = Qnil; - json->match_string = Qnil; + json->dwrapped_parser = Qfalse; + json->Vsource = Qfalse; + json->create_id = Qfalse; + json->object_class = Qfalse; + json->array_class = Qfalse; + json->match_string = Qfalse; return json; } -- cgit v1.2.1 From a04856d8ea1bc5e98e9a8ef299dffd6bee365fc1 Mon Sep 17 00:00:00 2001 From: Josh Partlow Date: Fri, 18 Nov 2011 21:38:06 -0800 Subject: Fix for Time.json_create ensures == Time instances for roundtrip through JSON serialization in Ruby 1.9.2. --- lib/json/add/time.rb | 4 ++-- tests/test_json_addition.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/json/add/time.rb b/lib/json/add/time.rb index abc807a..9755707 100644 --- a/lib/json/add/time.rb +++ b/lib/json/add/time.rb @@ -10,8 +10,8 @@ class Time if usec = object.delete('u') # used to be tv_usec -> tv_nsec object['n'] = usec * 1000 end - if respond_to?(:tv_nsec) - at(*object.values_at('s', 'n')) + if instance_methods.include?(:tv_nsec) + at(object['s'], Rational(object['n'], 1000)) else at(object['s'], object['n'] / 1000) end diff --git a/tests/test_json_addition.rb b/tests/test_json_addition.rb index b9cc6d1..49ff437 100755 --- a/tests/test_json_addition.rb +++ b/tests/test_json_addition.rb @@ -129,7 +129,7 @@ class TC_JSONAddition < Test::Unit::TestCase def test_core t = Time.now - assert_equal t.inspect, JSON(JSON(t)).inspect + assert_equal t, JSON(JSON(t)) d = Date.today assert_equal d, JSON(JSON(d)) d = DateTime.civil(2007, 6, 14, 14, 57, 10, Rational(1, 12), 2299161) -- cgit v1.2.1 From 1f2e458686fec42a4ee3cf3b7d5ab1b6d9ee4b93 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Mon, 21 Nov 2011 19:45:11 +0100 Subject: Add support for OpenStruct --- Gemfile | 4 ++++ json.gemspec | 30 +++++++++++++++--------------- json_pure.gemspec | 28 ++++++++++++++-------------- lib/json/add/ostruct.rb | 31 +++++++++++++++++++++++++++++++ lib/json/ext.rb | 6 ++++++ lib/json/pure.rb | 6 ++++++ tests/test_json_addition.rb | 8 ++++++++ 7 files changed, 84 insertions(+), 29 deletions(-) create mode 100644 lib/json/add/ostruct.rb diff --git a/Gemfile b/Gemfile index eb44418..0beb1f0 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,7 @@ source :rubygems gemspec :name => 'json' gemspec :name => 'json_pure' gemspec :name => 'json-java' + +group :development do + gem 'simplecov', :platform => :mri_19 +end diff --git a/json.gemspec b/json.gemspec index 65bead0..eec0617 100644 --- a/json.gemspec +++ b/json.gemspec @@ -1,24 +1,24 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| - s.name = %q{json} + s.name = "json" s.version = "1.6.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= - s.authors = [%q{Florian Frank}] - s.date = %q{2011-09-18} - s.description = %q{This is a JSON implementation as a Ruby extension in C.} - s.email = %q{flori@ping.de} - s.extensions = [%q{ext/json/ext/parser/extconf.rb}, %q{ext/json/ext/generator/extconf.rb}] - s.extra_rdoc_files = [%q{README.rdoc}] - s.files = [%q{tests}, %q{tests/test_json_string_matching.rb}, %q{tests/test_json_fixtures.rb}, %q{tests/setup_variant.rb}, %q{tests/fixtures}, %q{tests/fixtures/fail6.json}, %q{tests/fixtures/fail9.json}, %q{tests/fixtures/fail10.json}, %q{tests/fixtures/fail24.json}, %q{tests/fixtures/fail28.json}, %q{tests/fixtures/fail13.json}, %q{tests/fixtures/fail4.json}, %q{tests/fixtures/pass3.json}, %q{tests/fixtures/fail11.json}, %q{tests/fixtures/fail14.json}, %q{tests/fixtures/fail3.json}, %q{tests/fixtures/fail12.json}, %q{tests/fixtures/pass16.json}, %q{tests/fixtures/pass15.json}, %q{tests/fixtures/fail20.json}, %q{tests/fixtures/fail8.json}, %q{tests/fixtures/pass2.json}, %q{tests/fixtures/fail5.json}, %q{tests/fixtures/fail1.json}, %q{tests/fixtures/fail25.json}, %q{tests/fixtures/pass17.json}, %q{tests/fixtures/fail7.json}, %q{tests/fixtures/pass26.json}, %q{tests/fixtures/fail21.json}, %q{tests/fixtures/pass1.json}, %q{tests/fixtures/fail23.json}, %q{tests/fixtures/fail18.json}, %q{tests/fixtures/fail2.json}, %q{tests/fixtures/fail22.json}, %q{tests/fixtures/fail27.json}, %q{tests/fixtures/fail19.json}, %q{tests/test_json_unicode.rb}, %q{tests/test_json_addition.rb}, %q{tests/test_json_generate.rb}, %q{tests/test_json_encoding.rb}, %q{tests/test_json.rb}, %q{COPYING}, %q{TODO}, %q{Rakefile}, %q{benchmarks}, %q{benchmarks/data-p4-3GHz-ruby18}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat}, %q{benchmarks/parser2_benchmark.rb}, %q{benchmarks/parser_benchmark.rb}, %q{benchmarks/generator2_benchmark.rb}, %q{benchmarks/generator_benchmark.rb}, %q{benchmarks/ohai.ruby}, %q{benchmarks/data}, %q{benchmarks/ohai.json}, %q{lib}, %q{lib/json}, %q{lib/json/version.rb}, %q{lib/json/add}, %q{lib/json/add/symbol.rb}, %q{lib/json/add/struct.rb}, %q{lib/json/add/complex.rb}, %q{lib/json/add/rational.rb}, %q{lib/json/add/exception.rb}, %q{lib/json/add/time.rb}, %q{lib/json/add/date_time.rb}, %q{lib/json/add/core.rb}, %q{lib/json/add/range.rb}, %q{lib/json/add/date.rb}, %q{lib/json/add/regexp.rb}, %q{lib/json/common.rb}, %q{lib/json/pure}, %q{lib/json/pure/generator.rb}, %q{lib/json/pure/parser.rb}, %q{lib/json/ext.rb}, %q{lib/json/pure.rb}, %q{lib/json/ext}, %q{lib/json.rb}, %q{Gemfile}, %q{README.rdoc}, %q{json_pure.gemspec}, %q{GPL}, %q{CHANGES}, %q{COPYING-json-jruby}, %q{ext}, %q{ext/json}, %q{ext/json/ext}, %q{ext/json/ext/parser}, %q{ext/json/ext/parser/parser.h}, %q{ext/json/ext/parser/extconf.rb}, %q{ext/json/ext/parser/parser.rl}, %q{ext/json/ext/parser/parser.c}, %q{ext/json/ext/generator}, %q{ext/json/ext/generator/generator.c}, %q{ext/json/ext/generator/extconf.rb}, %q{ext/json/ext/generator/generator.h}, %q{VERSION}, %q{data}, %q{data/prototype.js}, %q{data/index.html}, %q{data/example.json}, %q{json.gemspec}, %q{java}, %q{java/src}, %q{java/src/json}, %q{java/src/json/ext}, %q{java/src/json/ext/Parser.java}, %q{java/src/json/ext/RuntimeInfo.java}, %q{java/src/json/ext/GeneratorState.java}, %q{java/src/json/ext/OptionsReader.java}, %q{java/src/json/ext/ParserService.java}, %q{java/src/json/ext/Parser.rl}, %q{java/src/json/ext/StringEncoder.java}, %q{java/src/json/ext/GeneratorService.java}, %q{java/src/json/ext/Utils.java}, %q{java/src/json/ext/StringDecoder.java}, %q{java/src/json/ext/Generator.java}, %q{java/src/json/ext/ByteListTranscoder.java}, %q{java/src/json/ext/GeneratorMethods.java}, %q{java/lib}, %q{java/lib/bytelist-1.0.6.jar}, %q{java/lib/jcodings.jar}, %q{diagrams}, %q{README-json-jruby.markdown}, %q{install.rb}, %q{json-java.gemspec}, %q{tools}, %q{tools/fuzz.rb}, %q{tools/server.rb}, %q{./tests/test_json_string_matching.rb}, %q{./tests/test_json_fixtures.rb}, %q{./tests/test_json_unicode.rb}, %q{./tests/test_json_addition.rb}, %q{./tests/test_json_generate.rb}, %q{./tests/test_json_encoding.rb}, %q{./tests/test_json.rb}] - s.homepage = %q{http://flori.github.com/json} - s.rdoc_options = [%q{--title}, %q{JSON implemention for Ruby}, %q{--main}, %q{README.rdoc}] - s.require_paths = [%q{ext/json/ext}, %q{ext}, %q{lib}] - s.rubyforge_project = %q{json} - s.rubygems_version = %q{1.8.6} - s.summary = %q{JSON Implementation for Ruby} - s.test_files = [%q{./tests/test_json_string_matching.rb}, %q{./tests/test_json_fixtures.rb}, %q{./tests/test_json_unicode.rb}, %q{./tests/test_json_addition.rb}, %q{./tests/test_json_generate.rb}, %q{./tests/test_json_encoding.rb}, %q{./tests/test_json.rb}] + s.authors = ["Florian Frank"] + s.date = "2011-11-21" + s.description = "This is a JSON implementation as a Ruby extension in C." + s.email = "flori@ping.de" + s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"] + s.extra_rdoc_files = ["README.rdoc"] + s.files = ["benchmarks", "benchmarks/data", "benchmarks/data-p4-3GHz-ruby18", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "CHANGES", "COPYING", "COPYING-json-jruby", "data", "data/example.json", "data/index.html", "data/prototype.js", "diagrams", "ext", "ext/json", "ext/json/ext", "ext/json/ext/generator", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "Gemfile", "GPL", "install.rb", "java", "java/lib", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src", "java/src/json", "java/src/json/ext", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib", "lib/json", "lib/json/add", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext", "lib/json/ext.rb", "lib/json/pure", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/pure.rb", "lib/json/version.rb", "lib/json.rb", "Rakefile", "README-json-jruby.markdown", "README.rdoc", "tests", "tests/fixtures", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "TODO", "tools", "tools/fuzz.rb", "tools/server.rb", "VERSION", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.homepage = "http://flori.github.com/json" + s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.rdoc"] + s.require_paths = ["ext/json/ext", "ext", "lib"] + s.rubyforge_project = "json" + s.rubygems_version = "1.8.11" + s.summary = "JSON Implementation for Ruby" + s.test_files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] if s.respond_to? :specification_version then s.specification_version = 3 diff --git a/json_pure.gemspec b/json_pure.gemspec index 5b8cb04..f5ed410 100644 --- a/json_pure.gemspec +++ b/json_pure.gemspec @@ -1,23 +1,23 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| - s.name = %q{json_pure} + s.name = "json_pure" s.version = "1.6.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= - s.authors = [%q{Florian Frank}] - s.date = %q{2011-09-18} - s.description = %q{This is a JSON implementation in pure Ruby.} - s.email = %q{flori@ping.de} - s.extra_rdoc_files = [%q{README.rdoc}] - s.files = [%q{tests}, %q{tests/test_json_string_matching.rb}, %q{tests/test_json_fixtures.rb}, %q{tests/setup_variant.rb}, %q{tests/fixtures}, %q{tests/fixtures/fail6.json}, %q{tests/fixtures/fail9.json}, %q{tests/fixtures/fail10.json}, %q{tests/fixtures/fail24.json}, %q{tests/fixtures/fail28.json}, %q{tests/fixtures/fail13.json}, %q{tests/fixtures/fail4.json}, %q{tests/fixtures/pass3.json}, %q{tests/fixtures/fail11.json}, %q{tests/fixtures/fail14.json}, %q{tests/fixtures/fail3.json}, %q{tests/fixtures/fail12.json}, %q{tests/fixtures/pass16.json}, %q{tests/fixtures/pass15.json}, %q{tests/fixtures/fail20.json}, %q{tests/fixtures/fail8.json}, %q{tests/fixtures/pass2.json}, %q{tests/fixtures/fail5.json}, %q{tests/fixtures/fail1.json}, %q{tests/fixtures/fail25.json}, %q{tests/fixtures/pass17.json}, %q{tests/fixtures/fail7.json}, %q{tests/fixtures/pass26.json}, %q{tests/fixtures/fail21.json}, %q{tests/fixtures/pass1.json}, %q{tests/fixtures/fail23.json}, %q{tests/fixtures/fail18.json}, %q{tests/fixtures/fail2.json}, %q{tests/fixtures/fail22.json}, %q{tests/fixtures/fail27.json}, %q{tests/fixtures/fail19.json}, %q{tests/test_json_unicode.rb}, %q{tests/test_json_addition.rb}, %q{tests/test_json_generate.rb}, %q{tests/test_json_encoding.rb}, %q{tests/test_json.rb}, %q{COPYING}, %q{TODO}, %q{Rakefile}, %q{benchmarks}, %q{benchmarks/data-p4-3GHz-ruby18}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat}, %q{benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat}, %q{benchmarks/parser2_benchmark.rb}, %q{benchmarks/parser_benchmark.rb}, %q{benchmarks/generator2_benchmark.rb}, %q{benchmarks/generator_benchmark.rb}, %q{benchmarks/ohai.ruby}, %q{benchmarks/data}, %q{benchmarks/ohai.json}, %q{lib}, %q{lib/json}, %q{lib/json/version.rb}, %q{lib/json/add}, %q{lib/json/add/symbol.rb}, %q{lib/json/add/struct.rb}, %q{lib/json/add/complex.rb}, %q{lib/json/add/rational.rb}, %q{lib/json/add/exception.rb}, %q{lib/json/add/time.rb}, %q{lib/json/add/date_time.rb}, %q{lib/json/add/core.rb}, %q{lib/json/add/range.rb}, %q{lib/json/add/date.rb}, %q{lib/json/add/regexp.rb}, %q{lib/json/common.rb}, %q{lib/json/pure}, %q{lib/json/pure/generator.rb}, %q{lib/json/pure/parser.rb}, %q{lib/json/ext.rb}, %q{lib/json/pure.rb}, %q{lib/json/ext}, %q{lib/json.rb}, %q{Gemfile}, %q{README.rdoc}, %q{json_pure.gemspec}, %q{GPL}, %q{CHANGES}, %q{COPYING-json-jruby}, %q{ext}, %q{ext/json}, %q{ext/json/ext}, %q{ext/json/ext/parser}, %q{ext/json/ext/parser/parser.h}, %q{ext/json/ext/parser/extconf.rb}, %q{ext/json/ext/parser/parser.rl}, %q{ext/json/ext/parser/parser.c}, %q{ext/json/ext/generator}, %q{ext/json/ext/generator/generator.c}, %q{ext/json/ext/generator/extconf.rb}, %q{ext/json/ext/generator/generator.h}, %q{VERSION}, %q{data}, %q{data/prototype.js}, %q{data/index.html}, %q{data/example.json}, %q{json.gemspec}, %q{java}, %q{java/src}, %q{java/src/json}, %q{java/src/json/ext}, %q{java/src/json/ext/Parser.java}, %q{java/src/json/ext/RuntimeInfo.java}, %q{java/src/json/ext/GeneratorState.java}, %q{java/src/json/ext/OptionsReader.java}, %q{java/src/json/ext/ParserService.java}, %q{java/src/json/ext/Parser.rl}, %q{java/src/json/ext/StringEncoder.java}, %q{java/src/json/ext/GeneratorService.java}, %q{java/src/json/ext/Utils.java}, %q{java/src/json/ext/StringDecoder.java}, %q{java/src/json/ext/Generator.java}, %q{java/src/json/ext/ByteListTranscoder.java}, %q{java/src/json/ext/GeneratorMethods.java}, %q{java/lib}, %q{java/lib/bytelist-1.0.6.jar}, %q{java/lib/jcodings.jar}, %q{diagrams}, %q{README-json-jruby.markdown}, %q{install.rb}, %q{json-java.gemspec}, %q{tools}, %q{tools/fuzz.rb}, %q{tools/server.rb}, %q{./tests/test_json_string_matching.rb}, %q{./tests/test_json_fixtures.rb}, %q{./tests/test_json_unicode.rb}, %q{./tests/test_json_addition.rb}, %q{./tests/test_json_generate.rb}, %q{./tests/test_json_encoding.rb}, %q{./tests/test_json.rb}] - s.homepage = %q{http://flori.github.com/json} - s.rdoc_options = [%q{--title}, %q{JSON implemention for ruby}, %q{--main}, %q{README.rdoc}] - s.require_paths = [%q{lib}] - s.rubyforge_project = %q{json} - s.rubygems_version = %q{1.8.6} - s.summary = %q{JSON Implementation for Ruby} - s.test_files = [%q{./tests/test_json_string_matching.rb}, %q{./tests/test_json_fixtures.rb}, %q{./tests/test_json_unicode.rb}, %q{./tests/test_json_addition.rb}, %q{./tests/test_json_generate.rb}, %q{./tests/test_json_encoding.rb}, %q{./tests/test_json.rb}] + s.authors = ["Florian Frank"] + s.date = "2011-11-21" + s.description = "This is a JSON implementation in pure Ruby." + s.email = "flori@ping.de" + s.extra_rdoc_files = ["README.rdoc"] + s.files = ["benchmarks", "benchmarks/data", "benchmarks/data-p4-3GHz-ruby18", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "CHANGES", "COPYING", "COPYING-json-jruby", "data", "data/example.json", "data/index.html", "data/prototype.js", "diagrams", "ext", "ext/json", "ext/json/ext", "ext/json/ext/generator", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "Gemfile", "GPL", "install.rb", "java", "java/lib", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src", "java/src/json", "java/src/json/ext", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib", "lib/json", "lib/json/add", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext", "lib/json/ext.rb", "lib/json/pure", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/pure.rb", "lib/json/version.rb", "lib/json.rb", "Rakefile", "README-json-jruby.markdown", "README.rdoc", "tests", "tests/fixtures", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "TODO", "tools", "tools/fuzz.rb", "tools/server.rb", "VERSION", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.homepage = "http://flori.github.com/json" + s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"] + s.require_paths = ["lib"] + s.rubyforge_project = "json" + s.rubygems_version = "1.8.11" + s.summary = "JSON Implementation for Ruby" + s.test_files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] if s.respond_to? :specification_version then s.specification_version = 3 diff --git a/lib/json/add/ostruct.rb b/lib/json/add/ostruct.rb new file mode 100644 index 0000000..da81e10 --- /dev/null +++ b/lib/json/add/ostruct.rb @@ -0,0 +1,31 @@ +unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED + require 'json' +end +require 'ostruct' + +# OpenStruct serialization/deserialization +class OpenStruct + + # Deserializes JSON string by constructing new Struct object with values + # v serialized by to_json. + def self.json_create(object) + new(object['t'] || object[:t]) + end + + # Returns a hash, that will be turned into a JSON object and represent this + # object. + def as_json(*) + klass = self.class.name + klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!" + { + JSON.create_id => klass, + 't' => table, + } + end + + # Stores class name (OpenStruct) with this struct's values v as a + # JSON string. + def to_json(*args) + as_json.to_json(*args) + end +end diff --git a/lib/json/ext.rb b/lib/json/ext.rb index 7264a85..c5f8131 100644 --- a/lib/json/ext.rb +++ b/lib/json/ext.rb @@ -1,3 +1,9 @@ +if ENV['SIMPLECOV_COVERAGE'].to_i == 1 + require 'simplecov' + SimpleCov.start do + add_filter "/tests/" + end +end require 'json/common' module JSON diff --git a/lib/json/pure.rb b/lib/json/pure.rb index dbac93c..b68668b 100644 --- a/lib/json/pure.rb +++ b/lib/json/pure.rb @@ -1,3 +1,9 @@ +if ENV['SIMPLECOV_COVERAGE'].to_i == 1 + require 'simplecov' + SimpleCov.start do + add_filter "/tests/" + end +end require 'json/common' require 'json/pure/parser' require 'json/pure/generator' diff --git a/tests/test_json_addition.rb b/tests/test_json_addition.rb index b9cc6d1..1b85e02 100755 --- a/tests/test_json_addition.rb +++ b/tests/test_json_addition.rb @@ -7,6 +7,7 @@ require 'json/add/core' require 'json/add/complex' require 'json/add/rational' require 'json/add/bigdecimal' +require 'json/add/ostruct' require 'date' class TC_JSONAddition < Test::Unit::TestCase @@ -177,4 +178,11 @@ class TC_JSONAddition < Test::Unit::TestCase assert_equal BigDecimal('3.141', 23), JSON(JSON(BigDecimal('3.141', 23))) assert_equal BigDecimal('3.141', 666), JSON(JSON(BigDecimal('3.141', 666))) end + + def test_ostruct + o = OpenStruct.new + # XXX this won't work; o.foo = { :bar => true } + o.foo = { 'bar' => true } + assert_equal o, JSON(JSON(o)) + end end -- cgit v1.2.1 From 95e76412ae545357727420bf06e2e4744ce830fa Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Tue, 22 Nov 2011 08:42:51 +0100 Subject: Prepare new version 1.6.2 --- CHANGES | 3 +++ VERSION | 2 +- json.gemspec | 4 ++-- json_pure.gemspec | 4 ++-- lib/json/version.rb | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 736ebb3..314de04 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2011-11-21 (1.6.2) + * Add support for OpenStruct and BigDecimal. + * Fix bug when parsing nil in quirks_mode. 2011-09-18 (1.6.1) * Using -target 1.5 to force Java bits to compile with 1.5. 2011-09-12 (1.6.0) diff --git a/VERSION b/VERSION index 9c6d629..fdd3be6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.6.1 +1.6.2 diff --git a/json.gemspec b/json.gemspec index eec0617..ba0f8a2 100644 --- a/json.gemspec +++ b/json.gemspec @@ -2,11 +2,11 @@ Gem::Specification.new do |s| s.name = "json" - s.version = "1.6.1" + s.version = "1.6.2" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Florian Frank"] - s.date = "2011-11-21" + s.date = "2011-11-22" s.description = "This is a JSON implementation as a Ruby extension in C." s.email = "flori@ping.de" s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"] diff --git a/json_pure.gemspec b/json_pure.gemspec index f5ed410..77dec15 100644 --- a/json_pure.gemspec +++ b/json_pure.gemspec @@ -2,11 +2,11 @@ Gem::Specification.new do |s| s.name = "json_pure" - s.version = "1.6.1" + s.version = "1.6.2" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Florian Frank"] - s.date = "2011-11-21" + s.date = "2011-11-22" s.description = "This is a JSON implementation in pure Ruby." s.email = "flori@ping.de" s.extra_rdoc_files = ["README.rdoc"] diff --git a/lib/json/version.rb b/lib/json/version.rb index 5983945..ee9a95a 100644 --- a/lib/json/version.rb +++ b/lib/json/version.rb @@ -1,6 +1,6 @@ module JSON # JSON version - VERSION = '1.6.1' + VERSION = '1.6.2' VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc: VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc: VERSION_MINOR = VERSION_ARRAY[1] # :nodoc: -- cgit v1.2.1 From 8828e9cd225ac0591b3a5015a53cb91b7232bd83 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Tue, 22 Nov 2011 10:19:59 +0100 Subject: Make JSON.dump and JSON.load support Rails better --- CHANGES | 2 ++ lib/json/common.rb | 42 ++++++++++++++++++++++++++++++++++++++---- tests/test_json.rb | 15 ++++++++++++++- tests/test_json_generate.rb | 2 ++ 4 files changed, 56 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 314de04..d78ba98 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ 2011-11-21 (1.6.2) * Add support for OpenStruct and BigDecimal. * Fix bug when parsing nil in quirks_mode. + * Make JSON.dump and JSON.load methods better cooperate with Rails' serialize + method. Just use: serialize :value, JSON 2011-09-18 (1.6.1) * Using -target 1.5 to force Java bits to compile with 1.5. 2011-09-12 (1.6.0) diff --git a/lib/json/common.rb b/lib/json/common.rb index e0d55a0..fcb1f82 100644 --- a/lib/json/common.rb +++ b/lib/json/common.rb @@ -284,22 +284,39 @@ module JSON module_function :pretty_unparse # :startdoc: + class << self + # The global default options for the JSON.load method: + # :max_nesting: false + # :allow_nan: true + # :quirks_mode: true + attr_accessor :load_default_options + end + self.load_default_options = { + :max_nesting => false, + :allow_nan => true, + :quirks_mode => true, + } + # Load a ruby data structure from a JSON _source_ and return it. A source can # either be a string-like object, an IO-like object, or an object responding # to the read method. If _proc_ was given, it will be called with any nested - # Ruby object as an argument recursively in depth first order. + # Ruby object as an argument recursively in depth first order. The default + # options for the parser can be changed via the load_default_options method. # # This method is part of the implementation of the load/dump interface of # Marshal and YAML. def load(source, proc = nil) + opts = load_default_options if source.respond_to? :to_str source = source.to_str elsif source.respond_to? :to_io source = source.to_io.read elsif source.respond_to?(:read) source = source.read + elsif source.nil? && opts[:quirks_mode] + source = 'null' end - result = parse(source, :max_nesting => false, :allow_nan => true) + result = parse(source, opts) recurse_proc(result, &proc) if proc result end @@ -321,6 +338,19 @@ module JSON alias restore load module_function :restore + class << self + # The global default options for the JSON.dump method: + # :max_nesting: false + # :allow_nan: true + # :quirks_mode: true + attr_accessor :dump_default_options + end + self.dump_default_options = { + :max_nesting => false, + :allow_nan => true, + :quirks_mode => true, + } + # Dumps _obj_ as a JSON string, i.e. calls generate on the object and returns # the result. # @@ -331,6 +361,9 @@ module JSON # exception is raised. This argument is similar (but not exactly the # same!) to the _limit_ argument in Marshal.dump. # + # The default options for the generator can be changed via the + # dump_default_options method. + # # This method is part of the implementation of the load/dump interface of # Marshal and YAML. def dump(obj, anIO = nil, limit = nil) @@ -341,8 +374,9 @@ module JSON anIO = nil end end - limit ||= 0 - result = generate(obj, :allow_nan => true, :max_nesting => limit) + opts = JSON.dump_default_options + limit and opts.update(:max_nesting => limit) + result = generate(obj, opts) if anIO anIO.write result anIO diff --git a/tests/test_json.rb b/tests/test_json.rb index 5492b8e..40774b3 100755 --- a/tests/test_json.rb +++ b/tests/test_json.rb @@ -4,6 +4,7 @@ require 'test/unit' require File.join(File.dirname(__FILE__), 'setup_variant') require 'stringio' +require 'tempfile' unless Array.method_defined?(:permutation) begin @@ -416,7 +417,19 @@ EOT JSON.parse('{"foo":"bar", "baz":"quux"}', :symbolize_names => true)) end - def test_load_dump + def test_load + assert_equal @hash, JSON.load(@json) + tempfile = Tempfile.open('json') + tempfile.write @json + tempfile.rewind + assert_equal @hash, JSON.load(tempfile) + stringio = StringIO.new(@json) + stringio.rewind + assert_equal @hash, JSON.load(stringio) + assert_equal nil, JSON.load(nil) + end + + def test_dump too_deep = '[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]' assert_equal too_deep, JSON.dump(eval(too_deep)) assert_kind_of String, Marshal.dump(eval(too_deep)) diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb index 2110eba..a8741a5 100755 --- a/tests/test_json_generate.rb +++ b/tests/test_json_generate.rb @@ -43,6 +43,8 @@ EOT def test_generate json = generate(@hash) assert_equal(JSON.parse(@json2), JSON.parse(json)) + json = JSON[@hash] + assert_equal(JSON.parse(@json2), JSON.parse(json)) parsed_json = parse(json) assert_equal(@hash, parsed_json) json = generate({1=>2}) -- cgit v1.2.1 From 60cf748653ec0d847155e9d65c835b10c47f5e50 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Tue, 22 Nov 2011 10:34:34 +0100 Subject: Change the CHANGES --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index d78ba98..28ee937 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,8 @@ * Fix bug when parsing nil in quirks_mode. * Make JSON.dump and JSON.load methods better cooperate with Rails' serialize method. Just use: serialize :value, JSON + * Fix bug with time serialization concerning nanoseconds. Thanks for the + patch go to Josh Partlow (jpartlow@github). 2011-09-18 (1.6.1) * Using -target 1.5 to force Java bits to compile with 1.5. 2011-09-12 (1.6.0) -- cgit v1.2.1 From 3c7ba7f2a73223b83febaaa0396bd2920adb0c11 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Wed, 23 Nov 2011 01:02:01 +0100 Subject: Extract fbuffer and use it in parser and generator --- ext/json/ext/generator/fbuffer.h | 156 ++++++++++++++++++++++++++++++++ ext/json/ext/generator/generator.c | 117 +----------------------- ext/json/ext/generator/generator.h | 39 +------- ext/json/ext/parser/fbuffer.h | 1 + ext/json/ext/parser/parser.c | 177 +++++++++++++++++++------------------ ext/json/ext/parser/parser.h | 7 +- ext/json/ext/parser/parser.rl | 13 ++- lib/json/pure/generator.rb | 2 +- tests/test_json_generate.rb | 12 +-- 9 files changed, 271 insertions(+), 253 deletions(-) create mode 100644 ext/json/ext/generator/fbuffer.h create mode 120000 ext/json/ext/parser/fbuffer.h diff --git a/ext/json/ext/generator/fbuffer.h b/ext/json/ext/generator/fbuffer.h new file mode 100644 index 0000000..7d1dad7 --- /dev/null +++ b/ext/json/ext/generator/fbuffer.h @@ -0,0 +1,156 @@ + +#ifndef _FBUFFER_H_ +#define _FBUFFER_H_ + +#include +#include "ruby.h" + +#ifdef HAVE_RUBY_ENCODING_H +#include "ruby/encoding.h" +#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding()) +#else +#define FORCE_UTF8(obj) +#endif + +/* We don't need to guard objects for rbx, so let's do nothing at all. */ +#ifndef RB_GC_GUARD +#define RB_GC_GUARD(object) +#endif + +typedef struct FBufferStruct { + unsigned long initial_length; + char *ptr; + unsigned long len; + unsigned long capa; +} FBuffer; + +#define FBUFFER_INITIAL_LENGTH_DEFAULT 1024 + +#define FBUFFER_PTR(fb) (fb->ptr) +#define FBUFFER_LEN(fb) (fb->len) +#define FBUFFER_CAPA(fb) (fb->capa) +#define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb) + +static FBuffer *fbuffer_alloc(unsigned long initial_length); +static void fbuffer_free(FBuffer *fb); +static void fbuffer_clear(FBuffer *fb); +static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len); +static void fbuffer_append_long(FBuffer *fb, long number); +static void fbuffer_append_char(FBuffer *fb, char newchr); +static FBuffer *fbuffer_dup(FBuffer *fb); +static VALUE fbuffer_to_s(FBuffer *fb); + +static FBuffer *fbuffer_alloc(unsigned long initial_length) +{ + FBuffer *fb; + if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT; + fb = ALLOC(FBuffer); + memset((void *) fb, 0, sizeof(FBuffer)); + fb->initial_length = initial_length; + return fb; +} + +static void fbuffer_free(FBuffer *fb) +{ + if (fb->ptr) ruby_xfree(fb->ptr); + ruby_xfree(fb); +} + +static void fbuffer_clear(FBuffer *fb) +{ + fb->len = 0; +} + +static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested) +{ + unsigned long required; + + if (!fb->ptr) { + fb->ptr = ALLOC_N(char, fb->initial_length); + fb->capa = fb->initial_length; + } + + for (required = fb->capa; requested > required - fb->len; required <<= 1); + + if (required > fb->capa) { + REALLOC_N(fb->ptr, char, required); + fb->capa = required; + } +} + +static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len) +{ + if (len > 0) { + fbuffer_inc_capa(fb, len); + MEMCPY(fb->ptr + fb->len, newstr, char, len); + fb->len += len; + } +} + +static void fbuffer_append_str(FBuffer *fb, VALUE str) +{ + const char *newstr = StringValuePtr(str); + unsigned long len = RSTRING_LEN(str); + + RB_GC_GUARD(str); + + fbuffer_append(fb, newstr, len); +} + +static void fbuffer_append_char(FBuffer *fb, char newchr) +{ + fbuffer_inc_capa(fb, 1); + *(fb->ptr + fb->len) = newchr; + fb->len++; +} + +static void freverse(char *start, char *end) +{ + char c; + + while (end > start) { + c = *end, *end-- = *start, *start++ = c; + } +} + +static long fltoa(long number, char *buf) +{ + static char digits[] = "0123456789"; + long sign = number; + char* tmp = buf; + + if (sign < 0) number = -number; + do *tmp++ = digits[number % 10]; while (number /= 10); + if (sign < 0) *tmp++ = '-'; + freverse(buf, tmp - 1); + return tmp - buf; +} + +static void fbuffer_append_long(FBuffer *fb, long number) +{ + char buf[20]; + unsigned long len = fltoa(number, buf); + fbuffer_append(fb, buf, len); +} + +static FBuffer *fbuffer_dup(FBuffer *fb) +{ + unsigned long len = fb->len; + FBuffer *result; + + assert(len > 0); + if (len > 0) { + result = fbuffer_alloc(len); + fbuffer_append(result, FBUFFER_PAIR(fb)); + } + return result; +} + +static VALUE fbuffer_to_s(FBuffer *fb) +{ + VALUE result = rb_str_new(FBUFFER_PAIR(fb)); + fbuffer_free(fb); + FORCE_UTF8(result); + return result; +} +#endif diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index b878984..cc313bc 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -1,3 +1,4 @@ +#include "fbuffer.h" #include "generator.h" #ifdef HAVE_RUBY_ENCODING_H @@ -293,114 +294,6 @@ static char *fstrndup(const char *ptr, unsigned long len) { return result; } -/* fbuffer implementation */ - -static FBuffer *fbuffer_alloc(unsigned long initial_length) -{ - FBuffer *fb; - if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT; - fb = ALLOC(FBuffer); - memset((void *) fb, 0, sizeof(FBuffer)); - fb->initial_length = initial_length; - return fb; -} - -static void fbuffer_free(FBuffer *fb) -{ - if (fb->ptr) ruby_xfree(fb->ptr); - ruby_xfree(fb); -} - -static void fbuffer_clear(FBuffer *fb) -{ - fb->len = 0; -} - -static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested) -{ - unsigned long required; - - if (!fb->ptr) { - fb->ptr = ALLOC_N(char, fb->initial_length); - fb->capa = fb->initial_length; - } - - for (required = fb->capa; requested > required - fb->len; required <<= 1); - - if (required > fb->capa) { - REALLOC_N(fb->ptr, char, required); - fb->capa = required; - } -} - -static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len) -{ - if (len > 0) { - fbuffer_inc_capa(fb, len); - MEMCPY(fb->ptr + fb->len, newstr, char, len); - fb->len += len; - } -} - -static void fbuffer_append_str(FBuffer *fb, VALUE str) -{ - const char *newstr = StringValuePtr(str); - unsigned long len = RSTRING_LEN(str); - - RB_GC_GUARD(str); - - fbuffer_append(fb, newstr, len); -} - -static void fbuffer_append_char(FBuffer *fb, char newchr) -{ - fbuffer_inc_capa(fb, 1); - *(fb->ptr + fb->len) = newchr; - fb->len++; -} - -static void freverse(char *start, char *end) -{ - char c; - - while (end > start) { - c = *end, *end-- = *start, *start++ = c; - } -} - -static long fltoa(long number, char *buf) -{ - static char digits[] = "0123456789"; - long sign = number; - char* tmp = buf; - - if (sign < 0) number = -number; - do *tmp++ = digits[number % 10]; while (number /= 10); - if (sign < 0) *tmp++ = '-'; - freverse(buf, tmp - 1); - return tmp - buf; -} - -static void fbuffer_append_long(FBuffer *fb, long number) -{ - char buf[20]; - unsigned long len = fltoa(number, buf); - fbuffer_append(fb, buf, len); -} - -static FBuffer *fbuffer_dup(FBuffer *fb) -{ - unsigned long len = fb->len; - FBuffer *result; - - assert(len > 0); - if (len > 0) { - result = fbuffer_alloc(len); - fbuffer_append(result, FBUFFER_PAIR(fb)); - } - return result; -} - /* * Document-module: JSON::Ext::Generator * @@ -951,14 +844,6 @@ static FBuffer *cState_prepare_buffer(VALUE self) return buffer; } -static VALUE fbuffer_to_s(FBuffer *fb) -{ - VALUE result = rb_str_new(FBUFFER_PAIR(fb)); - fbuffer_free(fb); - FORCE_UTF8(result); - return result; -} - static VALUE cState_partial_generate(VALUE self, VALUE obj) { FBuffer *buffer = cState_prepare_buffer(self); diff --git a/ext/json/ext/generator/generator.h b/ext/json/ext/generator/generator.h index ec6cb2a..3220178 100644 --- a/ext/json/ext/generator/generator.h +++ b/ext/json/ext/generator/generator.h @@ -13,13 +13,6 @@ #include "re.h" #endif -#ifdef HAVE_RUBY_ENCODING_H -#include "ruby/encoding.h" -#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding()) -#else -#define FORCE_UTF8(obj) -#endif - #define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key)) #ifndef RHASH_SIZE @@ -43,37 +36,6 @@ #define RSTRING_LEN(string) RSTRING(string)->len #endif -/* We don't need to guard objects for rbx, so let's do nothing at all. */ -#ifndef RB_GC_GUARD -#define RB_GC_GUARD(object) -#endif - -/* fbuffer implementation */ - -typedef struct FBufferStruct { - unsigned long initial_length; - char *ptr; - unsigned long len; - unsigned long capa; -} FBuffer; - -#define FBUFFER_INITIAL_LENGTH_DEFAULT 4096 - -#define FBUFFER_PTR(fb) (fb->ptr) -#define FBUFFER_LEN(fb) (fb->len) -#define FBUFFER_CAPA(fb) (fb->capa) -#define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb) - -static char *fstrndup(const char *ptr, unsigned long len); -static FBuffer *fbuffer_alloc(unsigned long initial_length); -static void fbuffer_free(FBuffer *fb); -static void fbuffer_clear(FBuffer *fb); -static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len); -static void fbuffer_append_long(FBuffer *fb, long number); -static void fbuffer_append_char(FBuffer *fb, char newchr); -static FBuffer *fbuffer_dup(FBuffer *fb); -static VALUE fbuffer_to_s(FBuffer *fb); - /* unicode defintions */ #define UNI_STRICT_CONVERSION 1 @@ -103,6 +65,7 @@ static void unicode_escape(char *buf, UTF16 character); static void unicode_escape_to_buffer(FBuffer *buffer, char buf[6], UTF16 character); static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string); static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string); +static char *fstrndup(const char *ptr, unsigned long len); /* ruby api and some helpers */ diff --git a/ext/json/ext/parser/fbuffer.h b/ext/json/ext/parser/fbuffer.h new file mode 120000 index 0000000..d29509f --- /dev/null +++ b/ext/json/ext/parser/fbuffer.h @@ -0,0 +1 @@ +../generator/fbuffer.h \ No newline at end of file diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index 4bbc0c7..5e4b2b6 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1,5 +1,6 @@ #line 1 "parser.rl" +#include "fbuffer.h" #include "parser.h" /* unicode */ @@ -83,11 +84,11 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions, i_match_string, i_aset, i_leftshift; -#line 109 "parser.rl" +#line 110 "parser.rl" -#line 91 "parser.c" +#line 92 "parser.c" static const int JSON_object_start = 1; static const int JSON_object_first_final = 27; static const int JSON_object_error = 0; @@ -95,7 +96,7 @@ static const int JSON_object_error = 0; static const int JSON_object_en_main = 1; -#line 150 "parser.rl" +#line 151 "parser.rl" static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result) @@ -111,14 +112,14 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu *result = NIL_P(object_class) ? rb_hash_new() : rb_class_new_instance(0, 0, object_class); -#line 115 "parser.c" +#line 116 "parser.c" { cs = JSON_object_start; } -#line 165 "parser.rl" +#line 166 "parser.rl" -#line 122 "parser.c" +#line 123 "parser.c" { if ( p == pe ) goto _test_eof; @@ -146,7 +147,7 @@ case 2: goto st2; goto st0; tr2: -#line 132 "parser.rl" +#line 133 "parser.rl" { char *np; json->parsing_name = 1; @@ -159,7 +160,7 @@ st3: if ( ++p == pe ) goto _test_eof3; case 3: -#line 163 "parser.c" +#line 164 "parser.c" switch( (*p) ) { case 13: goto st3; case 32: goto st3; @@ -226,7 +227,7 @@ case 8: goto st8; goto st0; tr11: -#line 117 "parser.rl" +#line 118 "parser.rl" { VALUE v = Qnil; char *np = JSON_parse_value(json, p, pe, &v); @@ -246,7 +247,7 @@ st9: if ( ++p == pe ) goto _test_eof9; case 9: -#line 250 "parser.c" +#line 251 "parser.c" switch( (*p) ) { case 13: goto st9; case 32: goto st9; @@ -335,14 +336,14 @@ case 18: goto st9; goto st18; tr4: -#line 140 "parser.rl" +#line 141 "parser.rl" { p--; {p++; cs = 27; goto _out;} } goto st27; st27: if ( ++p == pe ) goto _test_eof27; case 27: -#line 346 "parser.c" +#line 347 "parser.c" goto st0; st19: if ( ++p == pe ) @@ -440,7 +441,7 @@ case 26: _out: {} } -#line 166 "parser.rl" +#line 167 "parser.rl" if (cs >= JSON_object_first_final) { if (json->create_additions) { @@ -460,7 +461,7 @@ case 26: -#line 464 "parser.c" +#line 465 "parser.c" static const int JSON_value_start = 1; static const int JSON_value_first_final = 21; static const int JSON_value_error = 0; @@ -468,7 +469,7 @@ static const int JSON_value_error = 0; static const int JSON_value_en_main = 1; -#line 265 "parser.rl" +#line 266 "parser.rl" static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result) @@ -476,14 +477,14 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul int cs = EVIL; -#line 480 "parser.c" +#line 481 "parser.c" { cs = JSON_value_start; } -#line 272 "parser.rl" +#line 273 "parser.rl" -#line 487 "parser.c" +#line 488 "parser.c" { if ( p == pe ) goto _test_eof; @@ -508,14 +509,14 @@ st0: cs = 0; goto _out; tr0: -#line 213 "parser.rl" +#line 214 "parser.rl" { char *np = JSON_parse_string(json, p, pe, result); if (np == NULL) { p--; {p++; cs = 21; goto _out;} } else {p = (( np))-1;} } goto st21; tr2: -#line 218 "parser.rl" +#line 219 "parser.rl" { char *np; if(pe > p + 9 - json->quirks_mode && !strncmp(MinusInfinity, p, 9)) { @@ -535,7 +536,7 @@ tr2: } goto st21; tr5: -#line 236 "parser.rl" +#line 237 "parser.rl" { char *np; json->current_nesting++; @@ -545,7 +546,7 @@ tr5: } goto st21; tr9: -#line 244 "parser.rl" +#line 245 "parser.rl" { char *np; json->current_nesting++; @@ -555,7 +556,7 @@ tr9: } goto st21; tr16: -#line 206 "parser.rl" +#line 207 "parser.rl" { if (json->allow_nan) { *result = CInfinity; @@ -565,7 +566,7 @@ tr16: } goto st21; tr18: -#line 199 "parser.rl" +#line 200 "parser.rl" { if (json->allow_nan) { *result = CNaN; @@ -575,19 +576,19 @@ tr18: } goto st21; tr22: -#line 193 "parser.rl" +#line 194 "parser.rl" { *result = Qfalse; } goto st21; tr25: -#line 190 "parser.rl" +#line 191 "parser.rl" { *result = Qnil; } goto st21; tr28: -#line 196 "parser.rl" +#line 197 "parser.rl" { *result = Qtrue; } @@ -596,9 +597,9 @@ st21: if ( ++p == pe ) goto _test_eof21; case 21: -#line 252 "parser.rl" +#line 253 "parser.rl" { p--; {p++; cs = 21; goto _out;} } -#line 602 "parser.c" +#line 603 "parser.c" goto st0; st2: if ( ++p == pe ) @@ -759,7 +760,7 @@ case 20: _out: {} } -#line 273 "parser.rl" +#line 274 "parser.rl" if (cs >= JSON_value_first_final) { return p; @@ -769,7 +770,7 @@ case 20: } -#line 773 "parser.c" +#line 774 "parser.c" static const int JSON_integer_start = 1; static const int JSON_integer_first_final = 3; static const int JSON_integer_error = 0; @@ -777,7 +778,7 @@ static const int JSON_integer_error = 0; static const int JSON_integer_en_main = 1; -#line 289 "parser.rl" +#line 290 "parser.rl" static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result) @@ -785,15 +786,15 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res int cs = EVIL; -#line 789 "parser.c" +#line 790 "parser.c" { cs = JSON_integer_start; } -#line 296 "parser.rl" +#line 297 "parser.rl" json->memo = p; -#line 797 "parser.c" +#line 798 "parser.c" { if ( p == pe ) goto _test_eof; @@ -827,14 +828,14 @@ case 3: goto st0; goto tr4; tr4: -#line 286 "parser.rl" +#line 287 "parser.rl" { p--; {p++; cs = 4; goto _out;} } goto st4; st4: if ( ++p == pe ) goto _test_eof4; case 4: -#line 838 "parser.c" +#line 839 "parser.c" goto st0; st5: if ( ++p == pe ) @@ -853,11 +854,14 @@ case 5: _out: {} } -#line 298 "parser.rl" +#line 299 "parser.rl" if (cs >= JSON_integer_first_final) { long len = p - json->memo; - *result = rb_Integer(rb_str_new(json->memo, len)); + fbuffer_clear(json->fbuffer); + fbuffer_append(json->fbuffer, json->memo, len); + fbuffer_append_char(json->fbuffer, '\0'); + *result = rb_cstr2inum(FBUFFER_PTR(json->fbuffer), 10); return p + 1; } else { return NULL; @@ -865,7 +869,7 @@ case 5: } -#line 869 "parser.c" +#line 873 "parser.c" static const int JSON_float_start = 1; static const int JSON_float_first_final = 8; static const int JSON_float_error = 0; @@ -873,7 +877,7 @@ static const int JSON_float_error = 0; static const int JSON_float_en_main = 1; -#line 320 "parser.rl" +#line 324 "parser.rl" static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result) @@ -881,15 +885,15 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul int cs = EVIL; -#line 885 "parser.c" +#line 889 "parser.c" { cs = JSON_float_start; } -#line 327 "parser.rl" +#line 331 "parser.rl" json->memo = p; -#line 893 "parser.c" +#line 897 "parser.c" { if ( p == pe ) goto _test_eof; @@ -947,14 +951,14 @@ case 8: goto st0; goto tr9; tr9: -#line 314 "parser.rl" +#line 318 "parser.rl" { p--; {p++; cs = 9; goto _out;} } goto st9; st9: if ( ++p == pe ) goto _test_eof9; case 9: -#line 958 "parser.c" +#line 962 "parser.c" goto st0; st5: if ( ++p == pe ) @@ -1015,11 +1019,14 @@ case 7: _out: {} } -#line 329 "parser.rl" +#line 333 "parser.rl" if (cs >= JSON_float_first_final) { long len = p - json->memo; - *result = rb_Float(rb_str_new(json->memo, len)); + fbuffer_clear(json->fbuffer); + fbuffer_append(json->fbuffer, json->memo, len); + fbuffer_append_char(json->fbuffer, '\0'); + *result = rb_float_new(rb_cstr_to_dbl(FBUFFER_PTR(json->fbuffer), 1)); return p + 1; } else { return NULL; @@ -1028,7 +1035,7 @@ case 7: -#line 1032 "parser.c" +#line 1039 "parser.c" static const int JSON_array_start = 1; static const int JSON_array_first_final = 17; static const int JSON_array_error = 0; @@ -1036,7 +1043,7 @@ static const int JSON_array_error = 0; static const int JSON_array_en_main = 1; -#line 369 "parser.rl" +#line 376 "parser.rl" static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result) @@ -1050,14 +1057,14 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul *result = NIL_P(array_class) ? rb_ary_new() : rb_class_new_instance(0, 0, array_class); -#line 1054 "parser.c" +#line 1061 "parser.c" { cs = JSON_array_start; } -#line 382 "parser.rl" +#line 389 "parser.rl" -#line 1061 "parser.c" +#line 1068 "parser.c" { if ( p == pe ) goto _test_eof; @@ -1096,7 +1103,7 @@ case 2: goto st2; goto st0; tr2: -#line 346 "parser.rl" +#line 353 "parser.rl" { VALUE v = Qnil; char *np = JSON_parse_value(json, p, pe, &v); @@ -1116,7 +1123,7 @@ st3: if ( ++p == pe ) goto _test_eof3; case 3: -#line 1120 "parser.c" +#line 1127 "parser.c" switch( (*p) ) { case 13: goto st3; case 32: goto st3; @@ -1216,14 +1223,14 @@ case 12: goto st3; goto st12; tr4: -#line 361 "parser.rl" +#line 368 "parser.rl" { p--; {p++; cs = 17; goto _out;} } goto st17; st17: if ( ++p == pe ) goto _test_eof17; case 17: -#line 1227 "parser.c" +#line 1234 "parser.c" goto st0; st13: if ( ++p == pe ) @@ -1279,7 +1286,7 @@ case 16: _out: {} } -#line 383 "parser.rl" +#line 390 "parser.rl" if(cs >= JSON_array_first_final) { return p + 1; @@ -1360,7 +1367,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd) } -#line 1364 "parser.c" +#line 1371 "parser.c" static const int JSON_string_start = 1; static const int JSON_string_first_final = 8; static const int JSON_string_error = 0; @@ -1368,7 +1375,7 @@ static const int JSON_string_error = 0; static const int JSON_string_en_main = 1; -#line 482 "parser.rl" +#line 489 "parser.rl" static int @@ -1390,15 +1397,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu *result = rb_str_buf_new(0); -#line 1394 "parser.c" +#line 1401 "parser.c" { cs = JSON_string_start; } -#line 503 "parser.rl" +#line 510 "parser.rl" json->memo = p; -#line 1402 "parser.c" +#line 1409 "parser.c" { if ( p == pe ) goto _test_eof; @@ -1423,7 +1430,7 @@ case 2: goto st0; goto st2; tr2: -#line 468 "parser.rl" +#line 475 "parser.rl" { *result = json_string_unescape(*result, json->memo + 1, p); if (NIL_P(*result)) { @@ -1434,14 +1441,14 @@ tr2: {p = (( p + 1))-1;} } } -#line 479 "parser.rl" +#line 486 "parser.rl" { p--; {p++; cs = 8; goto _out;} } goto st8; st8: if ( ++p == pe ) goto _test_eof8; case 8: -#line 1445 "parser.c" +#line 1452 "parser.c" goto st0; st3: if ( ++p == pe ) @@ -1517,7 +1524,7 @@ case 7: _out: {} } -#line 505 "parser.rl" +#line 512 "parser.rl" if (json->create_additions && RTEST(match_string = json->match_string)) { VALUE klass; @@ -1716,7 +1723,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) } -#line 1720 "parser.c" +#line 1727 "parser.c" static const int JSON_start = 1; static const int JSON_first_final = 10; static const int JSON_error = 0; @@ -1724,7 +1731,7 @@ static const int JSON_error = 0; static const int JSON_en_main = 1; -#line 727 "parser.rl" +#line 734 "parser.rl" static VALUE cParser_parse_strict(VALUE self) @@ -1735,16 +1742,16 @@ static VALUE cParser_parse_strict(VALUE self) GET_PARSER; -#line 1739 "parser.c" +#line 1746 "parser.c" { cs = JSON_start; } -#line 737 "parser.rl" +#line 744 "parser.rl" p = json->source; pe = p + json->len; -#line 1748 "parser.c" +#line 1755 "parser.c" { if ( p == pe ) goto _test_eof; @@ -1800,7 +1807,7 @@ case 5: goto st1; goto st5; tr3: -#line 716 "parser.rl" +#line 723 "parser.rl" { char *np; json->current_nesting = 1; @@ -1809,7 +1816,7 @@ tr3: } goto st10; tr4: -#line 709 "parser.rl" +#line 716 "parser.rl" { char *np; json->current_nesting = 1; @@ -1821,7 +1828,7 @@ st10: if ( ++p == pe ) goto _test_eof10; case 10: -#line 1825 "parser.c" +#line 1832 "parser.c" switch( (*p) ) { case 13: goto st10; case 32: goto st10; @@ -1878,7 +1885,7 @@ case 9: _out: {} } -#line 740 "parser.rl" +#line 747 "parser.rl" if (cs >= JSON_first_final && p == pe) { return result; @@ -1890,7 +1897,7 @@ case 9: -#line 1894 "parser.c" +#line 1901 "parser.c" static const int JSON_quirks_mode_start = 1; static const int JSON_quirks_mode_first_final = 10; static const int JSON_quirks_mode_error = 0; @@ -1898,7 +1905,7 @@ static const int JSON_quirks_mode_error = 0; static const int JSON_quirks_mode_en_main = 1; -#line 765 "parser.rl" +#line 772 "parser.rl" static VALUE cParser_parse_quirks_mode(VALUE self) @@ -1909,16 +1916,16 @@ static VALUE cParser_parse_quirks_mode(VALUE self) GET_PARSER; -#line 1913 "parser.c" +#line 1920 "parser.c" { cs = JSON_quirks_mode_start; } -#line 775 "parser.rl" +#line 782 "parser.rl" p = json->source; pe = p + json->len; -#line 1922 "parser.c" +#line 1929 "parser.c" { if ( p == pe ) goto _test_eof; @@ -1952,7 +1959,7 @@ st0: cs = 0; goto _out; tr2: -#line 757 "parser.rl" +#line 764 "parser.rl" { char *np = JSON_parse_value(json, p, pe, &result); if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;} @@ -1962,7 +1969,7 @@ st10: if ( ++p == pe ) goto _test_eof10; case 10: -#line 1966 "parser.c" +#line 1973 "parser.c" switch( (*p) ) { case 13: goto st10; case 32: goto st10; @@ -2051,7 +2058,7 @@ case 9: _out: {} } -#line 778 "parser.rl" +#line 785 "parser.rl" if (cs >= JSON_quirks_mode_first_final && p == pe) { return result; @@ -2083,6 +2090,7 @@ static JSON_Parser *JSON_allocate() { JSON_Parser *json = ALLOC(JSON_Parser); MEMZERO(json, JSON_Parser, 1); + json->fbuffer = fbuffer_alloc(0); return json; } @@ -2097,6 +2105,7 @@ static void JSON_mark(JSON_Parser *json) static void JSON_free(JSON_Parser *json) { + fbuffer_free(json->fbuffer); ruby_xfree(json); } diff --git a/ext/json/ext/parser/parser.h b/ext/json/ext/parser/parser.h index da6fc5c..b192064 100644 --- a/ext/json/ext/parser/parser.h +++ b/ext/json/ext/parser/parser.h @@ -7,12 +7,6 @@ #include "re.h" #endif -#ifdef HAVE_RUBY_ENCODING_H -#include "ruby/encoding.h" -#define FORCE_UTF8(obj) ((obj) = rb_enc_associate(rb_str_dup(obj), rb_utf8_encoding())) -#else -#define FORCE_UTF8(obj) -#endif #ifdef HAVE_RUBY_ST_H #include "ruby/st.h" #else @@ -49,6 +43,7 @@ typedef struct JSON_ParserStruct { VALUE array_class; int create_additions; VALUE match_string; + FBuffer *fbuffer; } JSON_Parser; #define GET_PARSER \ diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index 8c4681d..f0c3b8e 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -1,3 +1,4 @@ +#include "fbuffer.h" #include "parser.h" /* unicode */ @@ -298,7 +299,10 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res if (cs >= JSON_integer_first_final) { long len = p - json->memo; - *result = rb_Integer(rb_str_new(json->memo, len)); + fbuffer_clear(json->fbuffer); + fbuffer_append(json->fbuffer, json->memo, len); + fbuffer_append_char(json->fbuffer, '\0'); + *result = rb_cstr2inum(FBUFFER_PTR(json->fbuffer), 10); return p + 1; } else { return NULL; @@ -329,7 +333,10 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul if (cs >= JSON_float_first_final) { long len = p - json->memo; - *result = rb_Float(rb_str_new(json->memo, len)); + fbuffer_clear(json->fbuffer); + fbuffer_append(json->fbuffer, json->memo, len); + fbuffer_append_char(json->fbuffer, '\0'); + *result = rb_float_new(rb_cstr_to_dbl(FBUFFER_PTR(json->fbuffer), 1)); return p + 1; } else { return NULL; @@ -806,6 +813,7 @@ static JSON_Parser *JSON_allocate() { JSON_Parser *json = ALLOC(JSON_Parser); MEMZERO(json, JSON_Parser, 1); + json->fbuffer = fbuffer_alloc(0); return json; } @@ -820,6 +828,7 @@ static void JSON_mark(JSON_Parser *json) static void JSON_free(JSON_Parser *json) { + fbuffer_free(json->fbuffer); ruby_xfree(json); } diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb index baa94d8..9141ae5 100644 --- a/lib/json/pure/generator.rb +++ b/lib/json/pure/generator.rb @@ -144,7 +144,7 @@ module JSON @allow_nan = false @ascii_only = false @quirks_mode = false - @buffer_initial_length = 4096 + @buffer_initial_length = 1024 configure opts end diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb index 29ea7ce..db24a13 100755 --- a/tests/test_json_generate.rb +++ b/tests/test_json_generate.rb @@ -124,7 +124,7 @@ EOT :allow_nan => false, :array_nl => "\n", :ascii_only => false, - :buffer_initial_length => 4096, + :buffer_initial_length => 1024, :quirks_mode => false, :depth => 0, :indent => " ", @@ -141,7 +141,7 @@ EOT :allow_nan => false, :array_nl => "", :ascii_only => false, - :buffer_initial_length => 4096, + :buffer_initial_length => 1024, :quirks_mode => false, :depth => 0, :indent => "", @@ -158,7 +158,7 @@ EOT :allow_nan => false, :array_nl => "", :ascii_only => false, - :buffer_initial_length => 4096, + :buffer_initial_length => 1024, :quirks_mode => false, :depth => 0, :indent => "", @@ -203,11 +203,11 @@ EOT def test_buffer_initial_length s = JSON.state.new - assert_equal 4096, s.buffer_initial_length + assert_equal 1024, s.buffer_initial_length s.buffer_initial_length = 0 - assert_equal 4096, s.buffer_initial_length + assert_equal 1024, s.buffer_initial_length s.buffer_initial_length = -1 - assert_equal 4096, s.buffer_initial_length + assert_equal 1024, s.buffer_initial_length s.buffer_initial_length = 128 assert_equal 128, s.buffer_initial_length end -- cgit v1.2.1 From 93d641a9e9d3b6b314e122765dc5c179005852a7 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Wed, 23 Nov 2011 01:26:29 +0100 Subject: avoid symlink --- ext/json/ext/fbuffer.h | 156 +++++++++++++++++++++++++++++++++++++ ext/json/ext/generator/fbuffer.h | 156 ------------------------------------- ext/json/ext/generator/generator.c | 2 +- ext/json/ext/parser/fbuffer.h | 1 - ext/json/ext/parser/parser.c | 2 +- ext/json/ext/parser/parser.rl | 2 +- 6 files changed, 159 insertions(+), 160 deletions(-) create mode 100644 ext/json/ext/fbuffer.h delete mode 100644 ext/json/ext/generator/fbuffer.h delete mode 120000 ext/json/ext/parser/fbuffer.h diff --git a/ext/json/ext/fbuffer.h b/ext/json/ext/fbuffer.h new file mode 100644 index 0000000..7d1dad7 --- /dev/null +++ b/ext/json/ext/fbuffer.h @@ -0,0 +1,156 @@ + +#ifndef _FBUFFER_H_ +#define _FBUFFER_H_ + +#include +#include "ruby.h" + +#ifdef HAVE_RUBY_ENCODING_H +#include "ruby/encoding.h" +#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding()) +#else +#define FORCE_UTF8(obj) +#endif + +/* We don't need to guard objects for rbx, so let's do nothing at all. */ +#ifndef RB_GC_GUARD +#define RB_GC_GUARD(object) +#endif + +typedef struct FBufferStruct { + unsigned long initial_length; + char *ptr; + unsigned long len; + unsigned long capa; +} FBuffer; + +#define FBUFFER_INITIAL_LENGTH_DEFAULT 1024 + +#define FBUFFER_PTR(fb) (fb->ptr) +#define FBUFFER_LEN(fb) (fb->len) +#define FBUFFER_CAPA(fb) (fb->capa) +#define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb) + +static FBuffer *fbuffer_alloc(unsigned long initial_length); +static void fbuffer_free(FBuffer *fb); +static void fbuffer_clear(FBuffer *fb); +static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len); +static void fbuffer_append_long(FBuffer *fb, long number); +static void fbuffer_append_char(FBuffer *fb, char newchr); +static FBuffer *fbuffer_dup(FBuffer *fb); +static VALUE fbuffer_to_s(FBuffer *fb); + +static FBuffer *fbuffer_alloc(unsigned long initial_length) +{ + FBuffer *fb; + if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT; + fb = ALLOC(FBuffer); + memset((void *) fb, 0, sizeof(FBuffer)); + fb->initial_length = initial_length; + return fb; +} + +static void fbuffer_free(FBuffer *fb) +{ + if (fb->ptr) ruby_xfree(fb->ptr); + ruby_xfree(fb); +} + +static void fbuffer_clear(FBuffer *fb) +{ + fb->len = 0; +} + +static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested) +{ + unsigned long required; + + if (!fb->ptr) { + fb->ptr = ALLOC_N(char, fb->initial_length); + fb->capa = fb->initial_length; + } + + for (required = fb->capa; requested > required - fb->len; required <<= 1); + + if (required > fb->capa) { + REALLOC_N(fb->ptr, char, required); + fb->capa = required; + } +} + +static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len) +{ + if (len > 0) { + fbuffer_inc_capa(fb, len); + MEMCPY(fb->ptr + fb->len, newstr, char, len); + fb->len += len; + } +} + +static void fbuffer_append_str(FBuffer *fb, VALUE str) +{ + const char *newstr = StringValuePtr(str); + unsigned long len = RSTRING_LEN(str); + + RB_GC_GUARD(str); + + fbuffer_append(fb, newstr, len); +} + +static void fbuffer_append_char(FBuffer *fb, char newchr) +{ + fbuffer_inc_capa(fb, 1); + *(fb->ptr + fb->len) = newchr; + fb->len++; +} + +static void freverse(char *start, char *end) +{ + char c; + + while (end > start) { + c = *end, *end-- = *start, *start++ = c; + } +} + +static long fltoa(long number, char *buf) +{ + static char digits[] = "0123456789"; + long sign = number; + char* tmp = buf; + + if (sign < 0) number = -number; + do *tmp++ = digits[number % 10]; while (number /= 10); + if (sign < 0) *tmp++ = '-'; + freverse(buf, tmp - 1); + return tmp - buf; +} + +static void fbuffer_append_long(FBuffer *fb, long number) +{ + char buf[20]; + unsigned long len = fltoa(number, buf); + fbuffer_append(fb, buf, len); +} + +static FBuffer *fbuffer_dup(FBuffer *fb) +{ + unsigned long len = fb->len; + FBuffer *result; + + assert(len > 0); + if (len > 0) { + result = fbuffer_alloc(len); + fbuffer_append(result, FBUFFER_PAIR(fb)); + } + return result; +} + +static VALUE fbuffer_to_s(FBuffer *fb) +{ + VALUE result = rb_str_new(FBUFFER_PAIR(fb)); + fbuffer_free(fb); + FORCE_UTF8(result); + return result; +} +#endif diff --git a/ext/json/ext/generator/fbuffer.h b/ext/json/ext/generator/fbuffer.h deleted file mode 100644 index 7d1dad7..0000000 --- a/ext/json/ext/generator/fbuffer.h +++ /dev/null @@ -1,156 +0,0 @@ - -#ifndef _FBUFFER_H_ -#define _FBUFFER_H_ - -#include -#include "ruby.h" - -#ifdef HAVE_RUBY_ENCODING_H -#include "ruby/encoding.h" -#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding()) -#else -#define FORCE_UTF8(obj) -#endif - -/* We don't need to guard objects for rbx, so let's do nothing at all. */ -#ifndef RB_GC_GUARD -#define RB_GC_GUARD(object) -#endif - -typedef struct FBufferStruct { - unsigned long initial_length; - char *ptr; - unsigned long len; - unsigned long capa; -} FBuffer; - -#define FBUFFER_INITIAL_LENGTH_DEFAULT 1024 - -#define FBUFFER_PTR(fb) (fb->ptr) -#define FBUFFER_LEN(fb) (fb->len) -#define FBUFFER_CAPA(fb) (fb->capa) -#define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb) - -static FBuffer *fbuffer_alloc(unsigned long initial_length); -static void fbuffer_free(FBuffer *fb); -static void fbuffer_clear(FBuffer *fb); -static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len); -static void fbuffer_append_long(FBuffer *fb, long number); -static void fbuffer_append_char(FBuffer *fb, char newchr); -static FBuffer *fbuffer_dup(FBuffer *fb); -static VALUE fbuffer_to_s(FBuffer *fb); - -static FBuffer *fbuffer_alloc(unsigned long initial_length) -{ - FBuffer *fb; - if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT; - fb = ALLOC(FBuffer); - memset((void *) fb, 0, sizeof(FBuffer)); - fb->initial_length = initial_length; - return fb; -} - -static void fbuffer_free(FBuffer *fb) -{ - if (fb->ptr) ruby_xfree(fb->ptr); - ruby_xfree(fb); -} - -static void fbuffer_clear(FBuffer *fb) -{ - fb->len = 0; -} - -static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested) -{ - unsigned long required; - - if (!fb->ptr) { - fb->ptr = ALLOC_N(char, fb->initial_length); - fb->capa = fb->initial_length; - } - - for (required = fb->capa; requested > required - fb->len; required <<= 1); - - if (required > fb->capa) { - REALLOC_N(fb->ptr, char, required); - fb->capa = required; - } -} - -static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len) -{ - if (len > 0) { - fbuffer_inc_capa(fb, len); - MEMCPY(fb->ptr + fb->len, newstr, char, len); - fb->len += len; - } -} - -static void fbuffer_append_str(FBuffer *fb, VALUE str) -{ - const char *newstr = StringValuePtr(str); - unsigned long len = RSTRING_LEN(str); - - RB_GC_GUARD(str); - - fbuffer_append(fb, newstr, len); -} - -static void fbuffer_append_char(FBuffer *fb, char newchr) -{ - fbuffer_inc_capa(fb, 1); - *(fb->ptr + fb->len) = newchr; - fb->len++; -} - -static void freverse(char *start, char *end) -{ - char c; - - while (end > start) { - c = *end, *end-- = *start, *start++ = c; - } -} - -static long fltoa(long number, char *buf) -{ - static char digits[] = "0123456789"; - long sign = number; - char* tmp = buf; - - if (sign < 0) number = -number; - do *tmp++ = digits[number % 10]; while (number /= 10); - if (sign < 0) *tmp++ = '-'; - freverse(buf, tmp - 1); - return tmp - buf; -} - -static void fbuffer_append_long(FBuffer *fb, long number) -{ - char buf[20]; - unsigned long len = fltoa(number, buf); - fbuffer_append(fb, buf, len); -} - -static FBuffer *fbuffer_dup(FBuffer *fb) -{ - unsigned long len = fb->len; - FBuffer *result; - - assert(len > 0); - if (len > 0) { - result = fbuffer_alloc(len); - fbuffer_append(result, FBUFFER_PAIR(fb)); - } - return result; -} - -static VALUE fbuffer_to_s(FBuffer *fb) -{ - VALUE result = rb_str_new(FBUFFER_PAIR(fb)); - fbuffer_free(fb); - FORCE_UTF8(result); - return result; -} -#endif diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index cc313bc..2f768ac 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -1,4 +1,4 @@ -#include "fbuffer.h" +#include "../fbuffer.h" #include "generator.h" #ifdef HAVE_RUBY_ENCODING_H diff --git a/ext/json/ext/parser/fbuffer.h b/ext/json/ext/parser/fbuffer.h deleted file mode 120000 index d29509f..0000000 --- a/ext/json/ext/parser/fbuffer.h +++ /dev/null @@ -1 +0,0 @@ -../generator/fbuffer.h \ No newline at end of file diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index 5e4b2b6..067aef4 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1,6 +1,6 @@ #line 1 "parser.rl" -#include "fbuffer.h" +#include "../fbuffer.h" #include "parser.h" /* unicode */ diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index f0c3b8e..d9ae84c 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -1,4 +1,4 @@ -#include "fbuffer.h" +#include "../fbuffer.h" #include "parser.h" /* unicode */ -- cgit v1.2.1 From f8cb4c25b67a32bbd2c233684e16f514ae7be034 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Wed, 23 Nov 2011 01:35:48 +0100 Subject: Use git ls-files to determine package files --- Rakefile | 3 +-- json.gemspec | 4 ++-- json_pure.gemspec | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index 4b51571..986f427 100644 --- a/Rakefile +++ b/Rakefile @@ -22,14 +22,13 @@ MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') } PKG_NAME = 'json' PKG_TITLE = 'JSON Implementation for Ruby' PKG_VERSION = File.read('VERSION').chomp -PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\.|\.iml\Z/).exclude(/\.(so|bundle|o|class|#{CONFIG['DLEXT']})$/) +PKG_FILES = FileList[`git ls-files`.split(/\n/)] EXT_ROOT_DIR = 'ext/json/ext' EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser" EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}" RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl" EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c" -PKG_FILES << EXT_PARSER_SRC EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator" EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}" EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c" diff --git a/json.gemspec b/json.gemspec index ba0f8a2..b3d300f 100644 --- a/json.gemspec +++ b/json.gemspec @@ -6,12 +6,12 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Florian Frank"] - s.date = "2011-11-22" + s.date = "2011-11-23" s.description = "This is a JSON implementation as a Ruby extension in C." s.email = "flori@ping.de" s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"] s.extra_rdoc_files = ["README.rdoc"] - s.files = ["benchmarks", "benchmarks/data", "benchmarks/data-p4-3GHz-ruby18", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "CHANGES", "COPYING", "COPYING-json-jruby", "data", "data/example.json", "data/index.html", "data/prototype.js", "diagrams", "ext", "ext/json", "ext/json/ext", "ext/json/ext/generator", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "Gemfile", "GPL", "install.rb", "java", "java/lib", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src", "java/src/json", "java/src/json/ext", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib", "lib/json", "lib/json/add", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext", "lib/json/ext.rb", "lib/json/pure", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/pure.rb", "lib/json/version.rb", "lib/json.rb", "Rakefile", "README-json-jruby.markdown", "README.rdoc", "tests", "tests/fixtures", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "TODO", "tools", "tools/fuzz.rb", "tools/server.rb", "VERSION", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks/data-p4-3GHz-ruby18/.keep", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data/.keep", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] s.homepage = "http://flori.github.com/json" s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.rdoc"] s.require_paths = ["ext/json/ext", "ext", "lib"] diff --git a/json_pure.gemspec b/json_pure.gemspec index 77dec15..03a8b0a 100644 --- a/json_pure.gemspec +++ b/json_pure.gemspec @@ -6,11 +6,11 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Florian Frank"] - s.date = "2011-11-22" + s.date = "2011-11-23" s.description = "This is a JSON implementation in pure Ruby." s.email = "flori@ping.de" s.extra_rdoc_files = ["README.rdoc"] - s.files = ["benchmarks", "benchmarks/data", "benchmarks/data-p4-3GHz-ruby18", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "CHANGES", "COPYING", "COPYING-json-jruby", "data", "data/example.json", "data/index.html", "data/prototype.js", "diagrams", "ext", "ext/json", "ext/json/ext", "ext/json/ext/generator", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "Gemfile", "GPL", "install.rb", "java", "java/lib", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src", "java/src/json", "java/src/json/ext", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib", "lib/json", "lib/json/add", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext", "lib/json/ext.rb", "lib/json/pure", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/pure.rb", "lib/json/version.rb", "lib/json.rb", "Rakefile", "README-json-jruby.markdown", "README.rdoc", "tests", "tests/fixtures", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "TODO", "tools", "tools/fuzz.rb", "tools/server.rb", "VERSION", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks/data-p4-3GHz-ruby18/.keep", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data/.keep", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] s.homepage = "http://flori.github.com/json" s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"] s.require_paths = ["lib"] -- cgit v1.2.1 From b1b366d5da6582d3417adc03c1746a2a81b92aa2 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Wed, 23 Nov 2011 11:29:54 +0100 Subject: support buffer length settings --- java/src/json/ext/GeneratorState.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/java/src/json/ext/GeneratorState.java b/java/src/json/ext/GeneratorState.java index 78524a1..65ee984 100644 --- a/java/src/json/ext/GeneratorState.java +++ b/java/src/json/ext/GeneratorState.java @@ -83,6 +83,12 @@ public class GeneratorState extends RubyObject { */ private boolean quirksMode = DEFAULT_QUIRKS_MODE; static final boolean DEFAULT_QUIRKS_MODE = false; + /** + * The initial buffer length of this state. (This isn't really used on all + * non-C implementations.) + */ + private int bufferInitialLength = DEFAULT_BUFFER_INITIAL_LENGTH; + static final int DEFAULT_BUFFER_INITIAL_LENGTH = 1024; /** * The current depth (inside a #to_json call) @@ -189,6 +195,7 @@ public class GeneratorState extends RubyObject { this.allowNaN = orig.allowNaN; this.asciiOnly = orig.asciiOnly; this.quirksMode = orig.quirksMode; + this.bufferInitialLength = orig.bufferInitialLength; this.depth = orig.depth; return this; } @@ -385,6 +392,18 @@ public class GeneratorState extends RubyObject { return quirks_mode.getRuntime().newBoolean(quirksMode); } + @JRubyMethod(name="buffer_initial_length") + public RubyInteger buffer_initial_length_get(ThreadContext context) { + return context.getRuntime().newFixnum(bufferInitialLength); + } + + @JRubyMethod(name="buffer_initial_length=") + public IRubyObject buffer_initial_length_set(IRubyObject buffer_initial_length) { + int newLength = RubyNumeric.fix2int(buffer_initial_length); + if (newLength > 0) bufferInitialLength = newLength; + return buffer_initial_length; + } + @JRubyMethod(name="quirks_mode?") public RubyBoolean quirks_mode_p(ThreadContext context) { return context.getRuntime().newBoolean(quirksMode); @@ -445,6 +464,7 @@ public class GeneratorState extends RubyObject { allowNaN = opts.getBool("allow_nan", DEFAULT_ALLOW_NAN); asciiOnly = opts.getBool("ascii_only", DEFAULT_ASCII_ONLY); quirksMode = opts.getBool("quirks_mode", DEFAULT_QUIRKS_MODE); + bufferInitialLength = opts.getInt("buffer_initial_length", DEFAULT_BUFFER_INITIAL_LENGTH); depth = opts.getInt("depth", 0); @@ -473,6 +493,7 @@ public class GeneratorState extends RubyObject { result.op_aset(context, runtime.newSymbol("quirks_mode"), quirks_mode_p(context)); result.op_aset(context, runtime.newSymbol("max_nesting"), max_nesting_get(context)); result.op_aset(context, runtime.newSymbol("depth"), depth_get(context)); + result.op_aset(context, runtime.newSymbol("buffer_initial_length"), buffer_initial_length_get(context)); return result; } -- cgit v1.2.1 From 9424b65371c9ef601837fae5688e46bad5cd7f76 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Mon, 28 Nov 2011 10:57:00 +0100 Subject: Add change to CHANGES --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index 28ee937..491a665 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,9 @@ method. Just use: serialize :value, JSON * Fix bug with time serialization concerning nanoseconds. Thanks for the patch go to Josh Partlow (jpartlow@github). + * Improve parsing speed for JSON numbers (integers and floats) in a similar way to + what Evan Phoenix suggested in: + https://github.com/flori/json/pull/103 2011-09-18 (1.6.1) * Using -target 1.5 to force Java bits to compile with 1.5. 2011-09-12 (1.6.0) -- cgit v1.2.1 From 1f9ce918db77bf37215e6fa77f437446dc008a92 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Mon, 28 Nov 2011 11:42:32 +0100 Subject: Move fbuffer in its own directory --- ext/json/ext/fbuffer.h | 156 ------------------------------------- ext/json/ext/fbuffer/fbuffer.h | 156 +++++++++++++++++++++++++++++++++++++ ext/json/ext/generator/generator.c | 2 +- ext/json/ext/parser/parser.c | 2 +- ext/json/ext/parser/parser.rl | 2 +- 5 files changed, 159 insertions(+), 159 deletions(-) delete mode 100644 ext/json/ext/fbuffer.h create mode 100644 ext/json/ext/fbuffer/fbuffer.h diff --git a/ext/json/ext/fbuffer.h b/ext/json/ext/fbuffer.h deleted file mode 100644 index 7d1dad7..0000000 --- a/ext/json/ext/fbuffer.h +++ /dev/null @@ -1,156 +0,0 @@ - -#ifndef _FBUFFER_H_ -#define _FBUFFER_H_ - -#include -#include "ruby.h" - -#ifdef HAVE_RUBY_ENCODING_H -#include "ruby/encoding.h" -#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding()) -#else -#define FORCE_UTF8(obj) -#endif - -/* We don't need to guard objects for rbx, so let's do nothing at all. */ -#ifndef RB_GC_GUARD -#define RB_GC_GUARD(object) -#endif - -typedef struct FBufferStruct { - unsigned long initial_length; - char *ptr; - unsigned long len; - unsigned long capa; -} FBuffer; - -#define FBUFFER_INITIAL_LENGTH_DEFAULT 1024 - -#define FBUFFER_PTR(fb) (fb->ptr) -#define FBUFFER_LEN(fb) (fb->len) -#define FBUFFER_CAPA(fb) (fb->capa) -#define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb) - -static FBuffer *fbuffer_alloc(unsigned long initial_length); -static void fbuffer_free(FBuffer *fb); -static void fbuffer_clear(FBuffer *fb); -static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len); -static void fbuffer_append_long(FBuffer *fb, long number); -static void fbuffer_append_char(FBuffer *fb, char newchr); -static FBuffer *fbuffer_dup(FBuffer *fb); -static VALUE fbuffer_to_s(FBuffer *fb); - -static FBuffer *fbuffer_alloc(unsigned long initial_length) -{ - FBuffer *fb; - if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT; - fb = ALLOC(FBuffer); - memset((void *) fb, 0, sizeof(FBuffer)); - fb->initial_length = initial_length; - return fb; -} - -static void fbuffer_free(FBuffer *fb) -{ - if (fb->ptr) ruby_xfree(fb->ptr); - ruby_xfree(fb); -} - -static void fbuffer_clear(FBuffer *fb) -{ - fb->len = 0; -} - -static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested) -{ - unsigned long required; - - if (!fb->ptr) { - fb->ptr = ALLOC_N(char, fb->initial_length); - fb->capa = fb->initial_length; - } - - for (required = fb->capa; requested > required - fb->len; required <<= 1); - - if (required > fb->capa) { - REALLOC_N(fb->ptr, char, required); - fb->capa = required; - } -} - -static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len) -{ - if (len > 0) { - fbuffer_inc_capa(fb, len); - MEMCPY(fb->ptr + fb->len, newstr, char, len); - fb->len += len; - } -} - -static void fbuffer_append_str(FBuffer *fb, VALUE str) -{ - const char *newstr = StringValuePtr(str); - unsigned long len = RSTRING_LEN(str); - - RB_GC_GUARD(str); - - fbuffer_append(fb, newstr, len); -} - -static void fbuffer_append_char(FBuffer *fb, char newchr) -{ - fbuffer_inc_capa(fb, 1); - *(fb->ptr + fb->len) = newchr; - fb->len++; -} - -static void freverse(char *start, char *end) -{ - char c; - - while (end > start) { - c = *end, *end-- = *start, *start++ = c; - } -} - -static long fltoa(long number, char *buf) -{ - static char digits[] = "0123456789"; - long sign = number; - char* tmp = buf; - - if (sign < 0) number = -number; - do *tmp++ = digits[number % 10]; while (number /= 10); - if (sign < 0) *tmp++ = '-'; - freverse(buf, tmp - 1); - return tmp - buf; -} - -static void fbuffer_append_long(FBuffer *fb, long number) -{ - char buf[20]; - unsigned long len = fltoa(number, buf); - fbuffer_append(fb, buf, len); -} - -static FBuffer *fbuffer_dup(FBuffer *fb) -{ - unsigned long len = fb->len; - FBuffer *result; - - assert(len > 0); - if (len > 0) { - result = fbuffer_alloc(len); - fbuffer_append(result, FBUFFER_PAIR(fb)); - } - return result; -} - -static VALUE fbuffer_to_s(FBuffer *fb) -{ - VALUE result = rb_str_new(FBUFFER_PAIR(fb)); - fbuffer_free(fb); - FORCE_UTF8(result); - return result; -} -#endif diff --git a/ext/json/ext/fbuffer/fbuffer.h b/ext/json/ext/fbuffer/fbuffer.h new file mode 100644 index 0000000..7d1dad7 --- /dev/null +++ b/ext/json/ext/fbuffer/fbuffer.h @@ -0,0 +1,156 @@ + +#ifndef _FBUFFER_H_ +#define _FBUFFER_H_ + +#include +#include "ruby.h" + +#ifdef HAVE_RUBY_ENCODING_H +#include "ruby/encoding.h" +#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding()) +#else +#define FORCE_UTF8(obj) +#endif + +/* We don't need to guard objects for rbx, so let's do nothing at all. */ +#ifndef RB_GC_GUARD +#define RB_GC_GUARD(object) +#endif + +typedef struct FBufferStruct { + unsigned long initial_length; + char *ptr; + unsigned long len; + unsigned long capa; +} FBuffer; + +#define FBUFFER_INITIAL_LENGTH_DEFAULT 1024 + +#define FBUFFER_PTR(fb) (fb->ptr) +#define FBUFFER_LEN(fb) (fb->len) +#define FBUFFER_CAPA(fb) (fb->capa) +#define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb) + +static FBuffer *fbuffer_alloc(unsigned long initial_length); +static void fbuffer_free(FBuffer *fb); +static void fbuffer_clear(FBuffer *fb); +static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len); +static void fbuffer_append_long(FBuffer *fb, long number); +static void fbuffer_append_char(FBuffer *fb, char newchr); +static FBuffer *fbuffer_dup(FBuffer *fb); +static VALUE fbuffer_to_s(FBuffer *fb); + +static FBuffer *fbuffer_alloc(unsigned long initial_length) +{ + FBuffer *fb; + if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT; + fb = ALLOC(FBuffer); + memset((void *) fb, 0, sizeof(FBuffer)); + fb->initial_length = initial_length; + return fb; +} + +static void fbuffer_free(FBuffer *fb) +{ + if (fb->ptr) ruby_xfree(fb->ptr); + ruby_xfree(fb); +} + +static void fbuffer_clear(FBuffer *fb) +{ + fb->len = 0; +} + +static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested) +{ + unsigned long required; + + if (!fb->ptr) { + fb->ptr = ALLOC_N(char, fb->initial_length); + fb->capa = fb->initial_length; + } + + for (required = fb->capa; requested > required - fb->len; required <<= 1); + + if (required > fb->capa) { + REALLOC_N(fb->ptr, char, required); + fb->capa = required; + } +} + +static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len) +{ + if (len > 0) { + fbuffer_inc_capa(fb, len); + MEMCPY(fb->ptr + fb->len, newstr, char, len); + fb->len += len; + } +} + +static void fbuffer_append_str(FBuffer *fb, VALUE str) +{ + const char *newstr = StringValuePtr(str); + unsigned long len = RSTRING_LEN(str); + + RB_GC_GUARD(str); + + fbuffer_append(fb, newstr, len); +} + +static void fbuffer_append_char(FBuffer *fb, char newchr) +{ + fbuffer_inc_capa(fb, 1); + *(fb->ptr + fb->len) = newchr; + fb->len++; +} + +static void freverse(char *start, char *end) +{ + char c; + + while (end > start) { + c = *end, *end-- = *start, *start++ = c; + } +} + +static long fltoa(long number, char *buf) +{ + static char digits[] = "0123456789"; + long sign = number; + char* tmp = buf; + + if (sign < 0) number = -number; + do *tmp++ = digits[number % 10]; while (number /= 10); + if (sign < 0) *tmp++ = '-'; + freverse(buf, tmp - 1); + return tmp - buf; +} + +static void fbuffer_append_long(FBuffer *fb, long number) +{ + char buf[20]; + unsigned long len = fltoa(number, buf); + fbuffer_append(fb, buf, len); +} + +static FBuffer *fbuffer_dup(FBuffer *fb) +{ + unsigned long len = fb->len; + FBuffer *result; + + assert(len > 0); + if (len > 0) { + result = fbuffer_alloc(len); + fbuffer_append(result, FBUFFER_PAIR(fb)); + } + return result; +} + +static VALUE fbuffer_to_s(FBuffer *fb) +{ + VALUE result = rb_str_new(FBUFFER_PAIR(fb)); + fbuffer_free(fb); + FORCE_UTF8(result); + return result; +} +#endif diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index 2f768ac..21fef2b 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -1,4 +1,4 @@ -#include "../fbuffer.h" +#include "../fbuffer/fbuffer.h" #include "generator.h" #ifdef HAVE_RUBY_ENCODING_H diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index 067aef4..7d6092f 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1,6 +1,6 @@ #line 1 "parser.rl" -#include "../fbuffer.h" +#include "../fbuffer/fbuffer.h" #include "parser.h" /* unicode */ diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index d9ae84c..c91b4b0 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -1,4 +1,4 @@ -#include "../fbuffer.h" +#include "../fbuffer/fbuffer.h" #include "parser.h" /* unicode */ -- cgit v1.2.1 From b0ee15f984e3ff056f646d253b142c3e47a35e0f Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Mon, 28 Nov 2011 13:07:33 +0100 Subject: Create new gemspecs --- json.gemspec | 4 ++-- json_pure.gemspec | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/json.gemspec b/json.gemspec index b3d300f..87878e8 100644 --- a/json.gemspec +++ b/json.gemspec @@ -6,12 +6,12 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Florian Frank"] - s.date = "2011-11-23" + s.date = "2011-11-28" s.description = "This is a JSON implementation as a Ruby extension in C." s.email = "flori@ping.de" s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"] s.extra_rdoc_files = ["README.rdoc"] - s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks/data-p4-3GHz-ruby18/.keep", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data/.keep", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks/data-p4-3GHz-ruby18/.keep", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data/.keep", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] s.homepage = "http://flori.github.com/json" s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.rdoc"] s.require_paths = ["ext/json/ext", "ext", "lib"] diff --git a/json_pure.gemspec b/json_pure.gemspec index 03a8b0a..f169dbf 100644 --- a/json_pure.gemspec +++ b/json_pure.gemspec @@ -6,11 +6,11 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Florian Frank"] - s.date = "2011-11-23" + s.date = "2011-11-28" s.description = "This is a JSON implementation in pure Ruby." s.email = "flori@ping.de" s.extra_rdoc_files = ["README.rdoc"] - s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks/data-p4-3GHz-ruby18/.keep", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data/.keep", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks/data-p4-3GHz-ruby18/.keep", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data/.keep", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] s.homepage = "http://flori.github.com/json" s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"] s.require_paths = ["lib"] -- cgit v1.2.1 From 0eb6ed53a2cb24d5932690c2206511a0622ab10c Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 1 Dec 2011 08:42:49 +0100 Subject: Small fix: JSON.load('') # => nil --- CHANGES | 3 +++ VERSION | 2 +- json.gemspec | 4 ++-- json_pure.gemspec | 4 ++-- lib/json/common.rb | 3 ++- lib/json/version.rb | 2 +- tests/test_json.rb | 1 + 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 491a665..6bab4d7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2011-12-01 (1.6.3) + * Let JSON.load('') return nil as well to make mysql text columns (default to + '') work better for serialization. 2011-11-21 (1.6.2) * Add support for OpenStruct and BigDecimal. * Fix bug when parsing nil in quirks_mode. diff --git a/VERSION b/VERSION index fdd3be6..266146b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.6.2 +1.6.3 diff --git a/json.gemspec b/json.gemspec index 87878e8..205757e 100644 --- a/json.gemspec +++ b/json.gemspec @@ -2,11 +2,11 @@ Gem::Specification.new do |s| s.name = "json" - s.version = "1.6.2" + s.version = "1.6.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Florian Frank"] - s.date = "2011-11-28" + s.date = "2011-12-01" s.description = "This is a JSON implementation as a Ruby extension in C." s.email = "flori@ping.de" s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"] diff --git a/json_pure.gemspec b/json_pure.gemspec index f169dbf..3bdb216 100644 --- a/json_pure.gemspec +++ b/json_pure.gemspec @@ -2,11 +2,11 @@ Gem::Specification.new do |s| s.name = "json_pure" - s.version = "1.6.2" + s.version = "1.6.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Florian Frank"] - s.date = "2011-11-28" + s.date = "2011-12-01" s.description = "This is a JSON implementation in pure Ruby." s.email = "flori@ping.de" s.extra_rdoc_files = ["README.rdoc"] diff --git a/lib/json/common.rb b/lib/json/common.rb index fcb1f82..cf7a8b9 100644 --- a/lib/json/common.rb +++ b/lib/json/common.rb @@ -313,7 +313,8 @@ module JSON source = source.to_io.read elsif source.respond_to?(:read) source = source.read - elsif source.nil? && opts[:quirks_mode] + end + if opts[:quirks_mode] && (source.nil? || source.empty?) source = 'null' end result = parse(source, opts) diff --git a/lib/json/version.rb b/lib/json/version.rb index ee9a95a..9272c53 100644 --- a/lib/json/version.rb +++ b/lib/json/version.rb @@ -1,6 +1,6 @@ module JSON # JSON version - VERSION = '1.6.2' + VERSION = '1.6.3' VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc: VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc: VERSION_MINOR = VERSION_ARRAY[1] # :nodoc: diff --git a/tests/test_json.rb b/tests/test_json.rb index 40774b3..c308933 100755 --- a/tests/test_json.rb +++ b/tests/test_json.rb @@ -427,6 +427,7 @@ EOT stringio.rewind assert_equal @hash, JSON.load(stringio) assert_equal nil, JSON.load(nil) + assert_equal nil, JSON.load('') end def test_dump -- cgit v1.2.1 From e7927d3f04973d8ed1618215c3750aebf80681d4 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 1 Dec 2011 09:08:30 +0100 Subject: This makes all the difference, I am sure. --- json.gemspec | 6 +++--- json_pure.gemspec | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/json.gemspec b/json.gemspec index 205757e..b073283 100644 --- a/json.gemspec +++ b/json.gemspec @@ -9,16 +9,16 @@ Gem::Specification.new do |s| s.date = "2011-12-01" s.description = "This is a JSON implementation as a Ruby extension in C." s.email = "flori@ping.de" - s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"] + s.extensions = ["ext/json/ext/parser/extconf.rb", "ext/json/ext/generator/extconf.rb"] s.extra_rdoc_files = ["README.rdoc"] - s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks/data-p4-3GHz-ruby18/.keep", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data/.keep", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks/data-p4-3GHz-ruby18/.keep", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data/.keep", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_unicode.rb", "./tests/test_json_addition.rb", "./tests/test_json_generate.rb", "./tests/test_json_encoding.rb", "./tests/test_json.rb"] s.homepage = "http://flori.github.com/json" s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.rdoc"] s.require_paths = ["ext/json/ext", "ext", "lib"] s.rubyforge_project = "json" s.rubygems_version = "1.8.11" s.summary = "JSON Implementation for Ruby" - s.test_files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.test_files = ["./tests/test_json_string_matching.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_unicode.rb", "./tests/test_json_addition.rb", "./tests/test_json_generate.rb", "./tests/test_json_encoding.rb", "./tests/test_json.rb"] if s.respond_to? :specification_version then s.specification_version = 3 diff --git a/json_pure.gemspec b/json_pure.gemspec index 3bdb216..b9e7ca1 100644 --- a/json_pure.gemspec +++ b/json_pure.gemspec @@ -10,14 +10,14 @@ Gem::Specification.new do |s| s.description = "This is a JSON implementation in pure Ruby." s.email = "flori@ping.de" s.extra_rdoc_files = ["README.rdoc"] - s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks/data-p4-3GHz-ruby18/.keep", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data/.keep", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.files = [".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "benchmarks/data-p4-3GHz-ruby18/.keep", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat", "benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat", "benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log", "benchmarks/data/.keep", "benchmarks/generator2_benchmark.rb", "benchmarks/generator_benchmark.rb", "benchmarks/ohai.json", "benchmarks/ohai.ruby", "benchmarks/parser2_benchmark.rb", "benchmarks/parser_benchmark.rb", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "install.rb", "java/lib/bytelist-1.0.6.jar", "java/lib/jcodings.jar", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_unicode.rb", "./tests/test_json_addition.rb", "./tests/test_json_generate.rb", "./tests/test_json_encoding.rb", "./tests/test_json.rb"] s.homepage = "http://flori.github.com/json" s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"] s.require_paths = ["lib"] s.rubyforge_project = "json" s.rubygems_version = "1.8.11" s.summary = "JSON Implementation for Ruby" - s.test_files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.test_files = ["./tests/test_json_string_matching.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_unicode.rb", "./tests/test_json_addition.rb", "./tests/test_json_generate.rb", "./tests/test_json_encoding.rb", "./tests/test_json.rb"] if s.respond_to? :specification_version then s.specification_version = 3 -- cgit v1.2.1