ffi-yajl 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +201 -0
- data/README.md +17 -0
- data/Rakefile +62 -0
- data/bin/ffi-yajl-bench +36 -0
- data/ext/ffi_yajl/ext/encoder/encoder.c +240 -0
- data/ext/ffi_yajl/ext/encoder/extconf.rb +29 -0
- data/ext/ffi_yajl/ext/parser/extconf.rb +29 -0
- data/ext/ffi_yajl/ext/parser/parser.c +199 -0
- data/ext/libyajl2/extconf.rb +65 -0
- data/ext/libyajl2/vendored/.gitignore +3 -0
- data/ext/libyajl2/vendored/BUILDING +23 -0
- data/ext/libyajl2/vendored/BUILDING.win32 +27 -0
- data/ext/libyajl2/vendored/CMakeLists.txt +79 -0
- data/ext/libyajl2/vendored/COPYING +13 -0
- data/ext/libyajl2/vendored/ChangeLog +175 -0
- data/ext/libyajl2/vendored/README +74 -0
- data/ext/libyajl2/vendored/TODO +9 -0
- data/ext/libyajl2/vendored/YAJLDoc.cmake +26 -0
- data/ext/libyajl2/vendored/configure +79 -0
- data/ext/libyajl2/vendored/example/CMakeLists.txt +23 -0
- data/ext/libyajl2/vendored/example/README.md +7 -0
- data/ext/libyajl2/vendored/example/parse_config.c +69 -0
- data/ext/libyajl2/vendored/example/sample.config +101 -0
- data/ext/libyajl2/vendored/perf/CMakeLists.txt +23 -0
- data/ext/libyajl2/vendored/perf/documents.c +1418 -0
- data/ext/libyajl2/vendored/perf/documents.h +28 -0
- data/ext/libyajl2/vendored/perf/perftest.c +134 -0
- data/ext/libyajl2/vendored/reformatter/CMakeLists.txt +39 -0
- data/ext/libyajl2/vendored/reformatter/json_reformat.c +194 -0
- data/ext/libyajl2/vendored/src/CMakeLists.txt +86 -0
- data/ext/libyajl2/vendored/src/YAJL.dxy +1258 -0
- data/ext/libyajl2/vendored/src/api/yajl_common.h +75 -0
- data/ext/libyajl2/vendored/src/api/yajl_gen.h +157 -0
- data/ext/libyajl2/vendored/src/api/yajl_parse.h +226 -0
- data/ext/libyajl2/vendored/src/api/yajl_tree.h +185 -0
- data/ext/libyajl2/vendored/src/api/yajl_version.h.cmake +23 -0
- data/ext/libyajl2/vendored/src/yajl +33 -0
- data/ext/libyajl2/vendored/src/yajl.c +175 -0
- data/ext/libyajl2/vendored/src/yajl.pc.cmake +9 -0
- data/ext/libyajl2/vendored/src/yajl_alloc.c +52 -0
- data/ext/libyajl2/vendored/src/yajl_alloc.h +34 -0
- data/ext/libyajl2/vendored/src/yajl_buf.c +103 -0
- data/ext/libyajl2/vendored/src/yajl_buf.h +57 -0
- data/ext/libyajl2/vendored/src/yajl_bytestack.h +69 -0
- data/ext/libyajl2/vendored/src/yajl_encode.c +220 -0
- data/ext/libyajl2/vendored/src/yajl_encode.h +34 -0
- data/ext/libyajl2/vendored/src/yajl_gen.c +354 -0
- data/ext/libyajl2/vendored/src/yajl_lex.c +763 -0
- data/ext/libyajl2/vendored/src/yajl_lex.h +117 -0
- data/ext/libyajl2/vendored/src/yajl_parser.c +498 -0
- data/ext/libyajl2/vendored/src/yajl_parser.h +78 -0
- data/ext/libyajl2/vendored/src/yajl_tree.c +503 -0
- data/ext/libyajl2/vendored/src/yajl_version.c +7 -0
- data/ext/libyajl2/vendored/test/CMakeLists.txt +23 -0
- data/ext/libyajl2/vendored/test/cases/ac_difficult_json_c_test_case_with_comments.json +1 -0
- data/ext/libyajl2/vendored/test/cases/ac_difficult_json_c_test_case_with_comments.json.gold +36 -0
- data/ext/libyajl2/vendored/test/cases/ac_simple_with_comments.json +11 -0
- data/ext/libyajl2/vendored/test/cases/ac_simple_with_comments.json.gold +9 -0
- data/ext/libyajl2/vendored/test/cases/ag_false_then_garbage.json +1 -0
- data/ext/libyajl2/vendored/test/cases/ag_false_then_garbage.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/ag_null_then_garbage.json +1 -0
- data/ext/libyajl2/vendored/test/cases/ag_null_then_garbage.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/ag_true_then_garbage.json +1 -0
- data/ext/libyajl2/vendored/test/cases/ag_true_then_garbage.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/am_eof.json +1 -0
- data/ext/libyajl2/vendored/test/cases/am_eof.json.gold +4 -0
- data/ext/libyajl2/vendored/test/cases/am_integers.json +1 -0
- data/ext/libyajl2/vendored/test/cases/am_integers.json.gold +3 -0
- data/ext/libyajl2/vendored/test/cases/am_multiple.json +3 -0
- data/ext/libyajl2/vendored/test/cases/am_multiple.json.gold +5 -0
- data/ext/libyajl2/vendored/test/cases/am_stuff.json +7 -0
- data/ext/libyajl2/vendored/test/cases/am_stuff.json.gold +14 -0
- data/ext/libyajl2/vendored/test/cases/ap_array_open.json +1 -0
- data/ext/libyajl2/vendored/test/cases/ap_array_open.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/ap_eof_str.json +1 -0
- data/ext/libyajl2/vendored/test/cases/ap_eof_str.json.gold +1 -0
- data/ext/libyajl2/vendored/test/cases/ap_map_open.json +1 -0
- data/ext/libyajl2/vendored/test/cases/ap_map_open.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/ap_partial_ok.json +1 -0
- data/ext/libyajl2/vendored/test/cases/ap_partial_ok.json.gold +4 -0
- data/ext/libyajl2/vendored/test/cases/array.json +6 -0
- data/ext/libyajl2/vendored/test/cases/array.json.gold +22 -0
- data/ext/libyajl2/vendored/test/cases/array_close.json +1 -0
- data/ext/libyajl2/vendored/test/cases/array_close.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/bignums.json +1 -0
- data/ext/libyajl2/vendored/test/cases/bignums.json.gold +5 -0
- data/ext/libyajl2/vendored/test/cases/bogus_char.json +4 -0
- data/ext/libyajl2/vendored/test/cases/bogus_char.json.gold +10 -0
- data/ext/libyajl2/vendored/test/cases/codepoints_from_unicode_org.json +1 -0
- data/ext/libyajl2/vendored/test/cases/codepoints_from_unicode_org.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/deep_arrays.json +1 -0
- data/ext/libyajl2/vendored/test/cases/deep_arrays.json.gold +2049 -0
- data/ext/libyajl2/vendored/test/cases/difficult_json_c_test_case.json +1 -0
- data/ext/libyajl2/vendored/test/cases/difficult_json_c_test_case.json.gold +36 -0
- data/ext/libyajl2/vendored/test/cases/doubles.json +1 -0
- data/ext/libyajl2/vendored/test/cases/doubles.json.gold +7 -0
- data/ext/libyajl2/vendored/test/cases/doubles_in_array.json +1 -0
- data/ext/libyajl2/vendored/test/cases/doubles_in_array.json.gold +8 -0
- data/ext/libyajl2/vendored/test/cases/empty_array.json +1 -0
- data/ext/libyajl2/vendored/test/cases/empty_array.json.gold +3 -0
- data/ext/libyajl2/vendored/test/cases/empty_string.json +1 -0
- data/ext/libyajl2/vendored/test/cases/empty_string.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/escaped_bulgarian.json +4 -0
- data/ext/libyajl2/vendored/test/cases/escaped_bulgarian.json.gold +7 -0
- data/ext/libyajl2/vendored/test/cases/escaped_foobar.json +1 -0
- data/ext/libyajl2/vendored/test/cases/escaped_foobar.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/false.json +1 -0
- data/ext/libyajl2/vendored/test/cases/false.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/fg_false_then_garbage.json +1 -0
- data/ext/libyajl2/vendored/test/cases/fg_false_then_garbage.json.gold +3 -0
- data/ext/libyajl2/vendored/test/cases/fg_issue_7.json +1 -0
- data/ext/libyajl2/vendored/test/cases/fg_issue_7.json.gold +3 -0
- data/ext/libyajl2/vendored/test/cases/fg_null_then_garbage.json +1 -0
- data/ext/libyajl2/vendored/test/cases/fg_null_then_garbage.json.gold +3 -0
- data/ext/libyajl2/vendored/test/cases/fg_true_then_garbage.json +1 -0
- data/ext/libyajl2/vendored/test/cases/fg_true_then_garbage.json.gold +3 -0
- data/ext/libyajl2/vendored/test/cases/four_byte_utf8.json +2 -0
- data/ext/libyajl2/vendored/test/cases/four_byte_utf8.json.gold +5 -0
- data/ext/libyajl2/vendored/test/cases/high_overflow.json +1 -0
- data/ext/libyajl2/vendored/test/cases/high_overflow.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/integers.json +3 -0
- data/ext/libyajl2/vendored/test/cases/integers.json.gold +14 -0
- data/ext/libyajl2/vendored/test/cases/invalid_utf8.json +1 -0
- data/ext/libyajl2/vendored/test/cases/invalid_utf8.json.gold +3 -0
- data/ext/libyajl2/vendored/test/cases/isolated_surrogate_marker.json +1 -0
- data/ext/libyajl2/vendored/test/cases/isolated_surrogate_marker.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/leading_zero_in_number.json +1 -0
- data/ext/libyajl2/vendored/test/cases/leading_zero_in_number.json.gold +5 -0
- data/ext/libyajl2/vendored/test/cases/lonely_minus_sign.json +7 -0
- data/ext/libyajl2/vendored/test/cases/lonely_minus_sign.json.gold +9 -0
- data/ext/libyajl2/vendored/test/cases/lonely_number.json +1 -0
- data/ext/libyajl2/vendored/test/cases/lonely_number.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/low_overflow.json +1 -0
- data/ext/libyajl2/vendored/test/cases/low_overflow.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/map_close.json +1 -0
- data/ext/libyajl2/vendored/test/cases/map_close.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/missing_integer_after_decimal_point.json +1 -0
- data/ext/libyajl2/vendored/test/cases/missing_integer_after_decimal_point.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/missing_integer_after_exponent.json +1 -0
- data/ext/libyajl2/vendored/test/cases/missing_integer_after_exponent.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/multiple.json +3 -0
- data/ext/libyajl2/vendored/test/cases/multiple.json.gold +4 -0
- data/ext/libyajl2/vendored/test/cases/non_utf8_char_in_string.json +1 -0
- data/ext/libyajl2/vendored/test/cases/non_utf8_char_in_string.json.gold +8 -0
- data/ext/libyajl2/vendored/test/cases/np_partial_bad.json +1 -0
- data/ext/libyajl2/vendored/test/cases/np_partial_bad.json.gold +5 -0
- data/ext/libyajl2/vendored/test/cases/null.json +1 -0
- data/ext/libyajl2/vendored/test/cases/null.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/nulls_and_bools.json +5 -0
- data/ext/libyajl2/vendored/test/cases/nulls_and_bools.json.gold +9 -0
- data/ext/libyajl2/vendored/test/cases/simple.json +5 -0
- data/ext/libyajl2/vendored/test/cases/simple.json.gold +9 -0
- data/ext/libyajl2/vendored/test/cases/simple_with_comments.json +11 -0
- data/ext/libyajl2/vendored/test/cases/simple_with_comments.json.gold +5 -0
- data/ext/libyajl2/vendored/test/cases/string_invalid_escape.json +1 -0
- data/ext/libyajl2/vendored/test/cases/string_invalid_escape.json.gold +3 -0
- data/ext/libyajl2/vendored/test/cases/string_invalid_hex_char.json +1 -0
- data/ext/libyajl2/vendored/test/cases/string_invalid_hex_char.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/string_with_escapes.json +3 -0
- data/ext/libyajl2/vendored/test/cases/string_with_escapes.json.gold +7 -0
- data/ext/libyajl2/vendored/test/cases/string_with_invalid_newline.json +2 -0
- data/ext/libyajl2/vendored/test/cases/string_with_invalid_newline.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/three_byte_utf8.json +1 -0
- data/ext/libyajl2/vendored/test/cases/three_byte_utf8.json.gold +7 -0
- data/ext/libyajl2/vendored/test/cases/true.json +1 -0
- data/ext/libyajl2/vendored/test/cases/true.json.gold +2 -0
- data/ext/libyajl2/vendored/test/cases/unescaped_bulgarian.json +1 -0
- data/ext/libyajl2/vendored/test/cases/unescaped_bulgarian.json.gold +4 -0
- data/ext/libyajl2/vendored/test/cases/zerobyte.json +1 -0
- data/ext/libyajl2/vendored/test/cases/zerobyte.json.gold +0 -0
- data/ext/libyajl2/vendored/test/run_tests.sh +94 -0
- data/ext/libyajl2/vendored/test/yajl_test.c +281 -0
- data/ext/libyajl2/vendored/verify/CMakeLists.txt +39 -0
- data/ext/libyajl2/vendored/verify/json_verify.c +116 -0
- data/lib/ffi_yajl.rb +14 -0
- data/lib/ffi_yajl/benchmark.rb +7 -0
- data/lib/ffi_yajl/benchmark/MIT-LICENSE +20 -0
- data/lib/ffi_yajl/benchmark/encode.rb +135 -0
- data/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb +42 -0
- data/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb +53 -0
- data/lib/ffi_yajl/benchmark/encode_profile.rb +38 -0
- data/lib/ffi_yajl/benchmark/http.rb +32 -0
- data/lib/ffi_yajl/benchmark/parse.rb +133 -0
- data/lib/ffi_yajl/benchmark/parse_json_and_marshal.rb +50 -0
- data/lib/ffi_yajl/benchmark/parse_json_and_yaml.rb +55 -0
- data/lib/ffi_yajl/benchmark/parse_profile.rb +37 -0
- data/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb +39 -0
- data/lib/ffi_yajl/benchmark/parse_stream.rb +54 -0
- data/lib/ffi_yajl/benchmark/subjects/item.json +1 -0
- data/lib/ffi_yajl/benchmark/subjects/ohai.json +1216 -0
- data/lib/ffi_yajl/benchmark/subjects/ohai.marshal_dump +0 -0
- data/lib/ffi_yajl/benchmark/subjects/ohai.yml +975 -0
- data/lib/ffi_yajl/benchmark/subjects/twitter_search.json +1 -0
- data/lib/ffi_yajl/benchmark/subjects/twitter_stream.json +430 -0
- data/lib/ffi_yajl/benchmark/subjects/unicode.json +1 -0
- data/lib/ffi_yajl/encoder.rb +53 -0
- data/lib/ffi_yajl/ext.rb +22 -0
- data/lib/ffi_yajl/ext/.keep +0 -0
- data/lib/ffi_yajl/ffi.rb +129 -0
- data/lib/ffi_yajl/ffi/encoder.rb +175 -0
- data/lib/ffi_yajl/ffi/parser.rb +145 -0
- data/lib/ffi_yajl/json_gem.rb +121 -0
- data/lib/ffi_yajl/parser.rb +23 -0
- data/lib/ffi_yajl/version.rb +3 -0
- data/lib/libyajl.so +0 -0
- data/lib/libyajl.so.2 +0 -0
- data/lib/libyajl.so.2.0.5 +0 -0
- data/lib/libyajl_s.a +0 -0
- data/spec/ffi_yajl/encoder_spec.rb +39 -0
- data/spec/ffi_yajl/json_gem_spec.rb +355 -0
- data/spec/ffi_yajl/parser_spec.rb +78 -0
- data/spec/spec_helper.rb +14 -0
- metadata +332 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>
|
2
|
+
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
4
|
+
purpose with or without fee is hereby granted, provided that the above
|
5
|
+
copyright notice and this permission notice appear in all copies.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
10
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
12
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
13
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
@@ -0,0 +1,175 @@
|
|
1
|
+
2.0.4
|
2
|
+
* @jcekstrom - additional checking in integer parsing
|
3
|
+
* @jcekstrom - fix a bug in yajl_tree that would cause valid json integersto fail to parse
|
4
|
+
* @plaguemorin - fix a memory leak in yajl_tree (error strings were being leaked)
|
5
|
+
* @7AC - reset errno
|
6
|
+
* @ConradIrwin - include flags to reformatter to allow toggling of escape solidus option
|
7
|
+
|
8
|
+
2.0.3
|
9
|
+
* John Stamp generation of a pkgconfig file at build time.
|
10
|
+
* @robzuber bugfix in yajl_tree_get()
|
11
|
+
* @lloyd - fix for compilation on 64 bit windows
|
12
|
+
|
13
|
+
2.0.2
|
14
|
+
* lth fix typos in yajl_tree.h macros YAJL_IS_INTEGER and YAJL_IS_DOUBLE,
|
15
|
+
contributed by Artem S Vybornov.
|
16
|
+
* lth add #ifdef __cplusplus wrappers to yajl_tree to allow proper
|
17
|
+
usage from many populer C++ compilers.
|
18
|
+
|
19
|
+
2.0.1
|
20
|
+
* lth generator flag to allow client to specify they want
|
21
|
+
escaped solidi '/'. issue #28
|
22
|
+
* lth crash fix when yajl_parse() is never called. issue #27
|
23
|
+
|
24
|
+
2.0.0
|
25
|
+
* lth YAJL is now ISC licensed: http://en.wikipedia.org/wiki/ISC_license
|
26
|
+
* lth 20-35% (osx and linux respectively) parsing performance
|
27
|
+
improvement attained by tweaking string scanning (idea: @michaelrhanson).
|
28
|
+
* Florian Forster & lth - yajl_tree interface introduced as a higher level
|
29
|
+
interface to the parser (eats JSON, poops a memory representation)
|
30
|
+
* lth require a C99 compiler
|
31
|
+
* lth integers are now represented with long long (64bit+) on all platforms.
|
32
|
+
* lth size_t now used throughout to represent buffer lengths, so you can
|
33
|
+
safely manage buffers greater than 4GB.
|
34
|
+
* gno semantic improvements to yajl's API regarding partial value parsing and
|
35
|
+
trailing garbage
|
36
|
+
* lth new configuration mechanism for yajl, see yajl_config() and
|
37
|
+
yajl_gen_config()
|
38
|
+
* gno more allocation checking in more places
|
39
|
+
* gno remove usage of strtol, replace with custom implementation that cares
|
40
|
+
not about your locale.
|
41
|
+
* lth yajl_parse_complete renamed to yajl_complete_parse.
|
42
|
+
* lth add a switch to validate utf8 strings as they are generated.
|
43
|
+
* lth tests are a lot quieter in their output.
|
44
|
+
* lth addition of a little in tree performance benchmark, `perftest` in
|
45
|
+
perf/perftest.c
|
46
|
+
|
47
|
+
1.0.12
|
48
|
+
* Conrad Irwin - Parse null bytes correctly
|
49
|
+
* Mirek Rusin - fix LLVM warnings
|
50
|
+
* gno - Don't generate numbers for keys. closes #13
|
51
|
+
* lth - various win32 fixes, including build documentation improvements
|
52
|
+
* John Stamp - Don't export private symbols.
|
53
|
+
* John Stamp - Install yajl_version.h, not the template.
|
54
|
+
* John Stamp - Don't use -fPIC for static lib. Cmake will automatically add it for the shared.
|
55
|
+
* lth 0 fix paths embedded in dylib upon installation on osx. closes #11
|
56
|
+
|
57
|
+
1.0.11
|
58
|
+
* lth remove -Wno-missing-field-initializers for greater gcc compat (3.4.6)
|
59
|
+
|
60
|
+
1.0.10
|
61
|
+
* Brian Maher - yajl is now buildable without a c++ compiler present
|
62
|
+
* Brian Maher - fix header installation on OSX with cmake 2.8.0 installed
|
63
|
+
* lth & vitali - allow builder to specify alternate lib directory
|
64
|
+
for installation (i.e. lib64)
|
65
|
+
* Vitali Lovich - yajl version number now programatically accessible
|
66
|
+
* lth - prevent cmake from embedding rpaths in binaries. Static linking
|
67
|
+
makes this unneccesary.
|
68
|
+
|
69
|
+
1.0.9
|
70
|
+
* lth - fix inverted logic causing yajl_gen_double() to always fail on
|
71
|
+
win32 (thanks to Fredrik Kihlander for the report)
|
72
|
+
|
73
|
+
1.0.8
|
74
|
+
* Randall E. Barker - move dllexport defnitions so dlls with proper
|
75
|
+
exports can again be generated on windows
|
76
|
+
* lth - add yajl_get_bytes_consumed() which allows the client to
|
77
|
+
determine the offset as an error, as well as determine how
|
78
|
+
many bytes of an input buffer were consumed.
|
79
|
+
* lth - fixes to keep "error offset" up to date (like when the
|
80
|
+
client callback returns 0)
|
81
|
+
* Brian Maher - allow client to specify a printing function in
|
82
|
+
generation
|
83
|
+
|
84
|
+
1.0.7
|
85
|
+
* lth fix win32 build (isinf and isnan)
|
86
|
+
|
87
|
+
1.0.6
|
88
|
+
* lth fix several compiler warnings
|
89
|
+
* lth fix generation of invalid json from yajl_gen_double
|
90
|
+
(NaN is not JSON)
|
91
|
+
* jstamp support for combining short options in tools
|
92
|
+
* jstamp exit properly on errors from tools
|
93
|
+
* octo test success no longer depends on integer size
|
94
|
+
* max fix configure --prefix
|
95
|
+
|
96
|
+
1.0.5
|
97
|
+
* lth several performance improvements related to function
|
98
|
+
inlinin'
|
99
|
+
|
100
|
+
1.0.4
|
101
|
+
* lth fix broken utf8 validation for three & four byte represenations.
|
102
|
+
thanks to http://github.com/brianmario and
|
103
|
+
http://github.com/technoweenie
|
104
|
+
|
105
|
+
1.0.3
|
106
|
+
* lth fix syntax error in cplusplus extern "C" statements for wider
|
107
|
+
compiler support
|
108
|
+
|
109
|
+
1.0.2
|
110
|
+
* lth update doxygen documentation with new sample code, passing NULL
|
111
|
+
for allocation functions added in 1.0.0
|
112
|
+
|
113
|
+
1.0.1
|
114
|
+
* lth resolve crash in json_reformatter due to incorrectly ordered
|
115
|
+
parameters.
|
116
|
+
|
117
|
+
1.0.0
|
118
|
+
* lth add 'make install' rules, thaks to Andrei Soroker for the
|
119
|
+
contribution.
|
120
|
+
* lth client may override allocation routines at generator or parser
|
121
|
+
allocation time
|
122
|
+
* tjw add yajl_parse_complete routine to allow client to explicitly
|
123
|
+
specify end-of-input, solving the "lonely number" case, where
|
124
|
+
json text consists only of an element with no explicit syntactic
|
125
|
+
end.
|
126
|
+
* tjw many new test cases
|
127
|
+
* tjw cleanup of code for symmetry and ease of reading
|
128
|
+
* lth integration of patches from Robert Varga which cleanup
|
129
|
+
compilation warnings on 64 bit linux
|
130
|
+
|
131
|
+
0.4.0
|
132
|
+
* lth buffer overflow bug in yajl_gen_double s/%lf/%g/ - thanks to
|
133
|
+
Eric Bergstrome
|
134
|
+
* lth yajl_number callback to allow passthrough of arbitrary precision
|
135
|
+
numbers to client. Thanks to Hatem Nassrat.
|
136
|
+
* lth yajl_integer now deals in long, instead of long long. This
|
137
|
+
combined with yajl_number improves compiler compatibility while
|
138
|
+
maintaining precision.
|
139
|
+
* lth better ./configure && make experience (still requires cmake and
|
140
|
+
ruby)
|
141
|
+
* lth fix handling of special characters hex 0F and 1F in yajl_encode
|
142
|
+
(thanks to Robert Geiger)
|
143
|
+
* lth allow leading zeros in exponents (thanks to Hatem Nassrat)
|
144
|
+
|
145
|
+
0.3.0
|
146
|
+
* lth doxygen documentation (html & man) generated as part of the
|
147
|
+
build
|
148
|
+
* lth many documentation updates.
|
149
|
+
* lth fix to work with older versions of cmake (don't use LOOSE_LOOP
|
150
|
+
constructs)
|
151
|
+
* lth work around different behavior of freebsd 4 scanf. initialize
|
152
|
+
parameter to scanf to zero.
|
153
|
+
* lth all tests run 32x with ranging buffer sizes to stress stream
|
154
|
+
parsing
|
155
|
+
* lth yajl_test accepts -b option to allow read buffer size to be
|
156
|
+
set
|
157
|
+
* lth option to validate UTF8 added to parser (argument in
|
158
|
+
yajl_parser_cfg)
|
159
|
+
* lth fix buffer overrun when chunk ends inside \u escaped text
|
160
|
+
* lth support client cancelation
|
161
|
+
|
162
|
+
0.2.2
|
163
|
+
* lth on windows build debug with C7 symbols and no pdb files.
|
164
|
+
|
165
|
+
0.2.1
|
166
|
+
* fix yajl_reformat and yajl_verify to work on arbitrarily sized
|
167
|
+
inputs.
|
168
|
+
* fix win32 build break, clean up all errors and warnings.
|
169
|
+
* fix optimized build flags.
|
170
|
+
|
171
|
+
0.2.0
|
172
|
+
* optionally support comments in input text
|
173
|
+
|
174
|
+
0.1.0
|
175
|
+
* Initial release
|
@@ -0,0 +1,74 @@
|
|
1
|
+
**********************************************************************
|
2
|
+
This is YAJL 2. For the legacy version of YAJL see
|
3
|
+
https://github.com/lloyd/yajl/tree/1.x
|
4
|
+
**********************************************************************
|
5
|
+
|
6
|
+
Welcome to Yet Another JSON Library (YAJL)
|
7
|
+
|
8
|
+
## Why does the world need another C library for parsing JSON?
|
9
|
+
|
10
|
+
Good question. In a review of current C JSON parsing libraries I was
|
11
|
+
unable to find one that satisfies my requirements. Those are,
|
12
|
+
0. written in C
|
13
|
+
1. portable
|
14
|
+
2. robust -- as close to "crash proof" as possible
|
15
|
+
3. data representation independent
|
16
|
+
4. fast
|
17
|
+
5. generates verbose, useful error messages including context of where
|
18
|
+
the error occurs in the input text.
|
19
|
+
6. can parse JSON data off a stream, incrementally
|
20
|
+
7. simple to use
|
21
|
+
8. tiny
|
22
|
+
|
23
|
+
Numbers 3, 5, 6, and 7 were particularly hard to find, and were what
|
24
|
+
caused me to ultimately create YAJL. This document is a tour of some
|
25
|
+
of the more important aspects of YAJL.
|
26
|
+
|
27
|
+
## YAJL is Free.
|
28
|
+
|
29
|
+
Permissive licensing means you can use it in open source and
|
30
|
+
commercial products alike without any fees. My request beyond the
|
31
|
+
licensing is that if you find bugs drop me a email, or better yet,
|
32
|
+
fork and fix.
|
33
|
+
|
34
|
+
Porting YAJL should be trivial, the implementation is ANSI C. If you
|
35
|
+
port to new systems I'd love to hear of it and integrate your patches.
|
36
|
+
|
37
|
+
## YAJL is data representation independent.
|
38
|
+
|
39
|
+
BYODR! Many JSON libraries impose a structure based data representation
|
40
|
+
on you. This is a benefit in some cases and a drawback in others.
|
41
|
+
YAJL uses callbacks to remain agnostic of the in-memory representation.
|
42
|
+
So if you wish to build up an in-memory representation, you may do so
|
43
|
+
using YAJL, but you must bring the code that defines and populates the
|
44
|
+
in memory structure.
|
45
|
+
|
46
|
+
This also means that YAJL can be used by other (higher level) JSON
|
47
|
+
libraries if so desired.
|
48
|
+
|
49
|
+
## YAJL supports stream parsing
|
50
|
+
|
51
|
+
This means you do not need to hold the whole JSON representation in
|
52
|
+
textual form in memory. This makes YAJL ideal for filtering projects,
|
53
|
+
where you're converting YAJL from one form to another (i.e. XML). The
|
54
|
+
included JSON pretty printer is an example of such a filter program.
|
55
|
+
|
56
|
+
## YAJL is fast
|
57
|
+
|
58
|
+
Minimal memory copying is performed. YAJL, when possible, returns
|
59
|
+
pointers into the client provided text (i.e. for strings that have no
|
60
|
+
embedded escape chars, hopefully the common case). I've put a lot of
|
61
|
+
effort into profiling and tuning performance, but I have ignored a
|
62
|
+
couple possible performance improvements to keep the interface clean,
|
63
|
+
small, and flexible. My hope is that YAJL will perform comparably to
|
64
|
+
the fastest JSON parser out there.
|
65
|
+
|
66
|
+
YAJL should impose both minimal CPU and memory requirements on your
|
67
|
+
application.
|
68
|
+
|
69
|
+
## YAJL is tiny.
|
70
|
+
|
71
|
+
Fat free. No whip.
|
72
|
+
|
73
|
+
enjoy,
|
74
|
+
Lloyd - July, 2007
|
@@ -0,0 +1,9 @@
|
|
1
|
+
* add a test for 0x1F bug
|
2
|
+
* numeric overflow in integers and double
|
3
|
+
* line and char offsets in the lexer and in error messages
|
4
|
+
* testing:
|
5
|
+
a. the permuter
|
6
|
+
b. some performance comparison against json_checker.
|
7
|
+
* investigate pull instead of push parsing
|
8
|
+
* Handle memory allocation failures gracefully
|
9
|
+
* cygwin/msys support on win32
|
@@ -0,0 +1,26 @@
|
|
1
|
+
FIND_PROGRAM(doxygenPath doxygen)
|
2
|
+
|
3
|
+
IF (doxygenPath)
|
4
|
+
SET (YAJL_VERSION ${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO})
|
5
|
+
SET(yajlDirName yajl-${YAJL_VERSION})
|
6
|
+
SET(docPath
|
7
|
+
"${CMAKE_CURRENT_BINARY_DIR}/${yajlDirName}/share/doc/${yajlDirName}")
|
8
|
+
MESSAGE("** using doxygen at: ${doxygenPath}")
|
9
|
+
MESSAGE("** documentation output to: ${docPath}")
|
10
|
+
|
11
|
+
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/YAJL.dxy
|
12
|
+
${CMAKE_CURRENT_BINARY_DIR}/YAJL.dxy @ONLY)
|
13
|
+
|
14
|
+
FILE(MAKE_DIRECTORY "${docPath}")
|
15
|
+
|
16
|
+
ADD_CUSTOM_TARGET(doc
|
17
|
+
${doxygenPath} YAJL.dxy
|
18
|
+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
19
|
+
|
20
|
+
ELSE (doxygenPath)
|
21
|
+
MESSAGE("!! doxygen not found, not generating documentation")
|
22
|
+
ADD_CUSTOM_TARGET(
|
23
|
+
doc
|
24
|
+
echo doxygen not installed, not generating documentation
|
25
|
+
)
|
26
|
+
ENDIF (doxygenPath)
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>
|
4
|
+
#
|
5
|
+
# Permission to use, copy, modify, and/or distribute this software for any
|
6
|
+
# purpose with or without fee is hereby granted, provided that the above
|
7
|
+
# copyright notice and this permission notice appear in all copies.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
10
|
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
11
|
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
12
|
+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
13
|
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
14
|
+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
15
|
+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
16
|
+
|
17
|
+
require 'fileutils'
|
18
|
+
require 'optparse'
|
19
|
+
|
20
|
+
prefix = "/usr/local"
|
21
|
+
options = {}
|
22
|
+
OptionParser.new do |opts|
|
23
|
+
opts.banner = "Usage: configure [options]"
|
24
|
+
opts.on("-p", "--prefix PATH", "Set installation prefix") do |p|
|
25
|
+
prefix = p
|
26
|
+
end
|
27
|
+
opts.on_tail("-h", "--help", "Output usage summary") do
|
28
|
+
puts opts
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
|
32
|
+
opts.parse!(ARGV)
|
33
|
+
end
|
34
|
+
|
35
|
+
puts "== removing old build files"
|
36
|
+
FileUtils.rm_rf("build")
|
37
|
+
FileUtils.rm_f("Makefile")
|
38
|
+
puts "== running CMake in build directory"
|
39
|
+
FileUtils.mkdir("build")
|
40
|
+
FileUtils.cd("build") do
|
41
|
+
if (!system("cmake -DCMAKE_INSTALL_PREFIX='#{prefix}' .."))
|
42
|
+
puts "The \"cmake\" program is required to configure yajl. It's"
|
43
|
+
puts "available from most ports/packaging systems and http://cmake.org"
|
44
|
+
exit 1
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# now generate a Makefile
|
49
|
+
puts "== Generating Makefile"
|
50
|
+
File.open("Makefile", "w+") do |f|
|
51
|
+
f.puts ".PHONY: all clean distclean install package test distro"
|
52
|
+
f.puts "all: distro doc test"
|
53
|
+
f.puts
|
54
|
+
f.puts "distro:"
|
55
|
+
f.puts " @cd build && make"
|
56
|
+
f.puts
|
57
|
+
f.puts "doc:"
|
58
|
+
f.puts " @cd build && make doc"
|
59
|
+
f.puts
|
60
|
+
f.puts "test:"
|
61
|
+
f.puts " @cd build && make test"
|
62
|
+
f.puts
|
63
|
+
f.puts "clean:"
|
64
|
+
f.puts " @cd build && make clean"
|
65
|
+
f.puts
|
66
|
+
f.puts "distclean:"
|
67
|
+
f.puts " @rm -rf Makefile build"
|
68
|
+
f.puts " @rm -f yajl-*.tgz"
|
69
|
+
f.puts
|
70
|
+
f.puts "install: all"
|
71
|
+
f.puts " @cd build && make install"
|
72
|
+
f.puts
|
73
|
+
f.puts "package: all"
|
74
|
+
f.puts " @echo \"compressing to `basename build/yajl-*`.tgz\""
|
75
|
+
f.puts " @cd build && tar czf ../`basename yajl-*`.tgz yajl-*"
|
76
|
+
end
|
77
|
+
|
78
|
+
puts "== Configured with installation prefix: #{prefix}"
|
79
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>
|
2
|
+
#
|
3
|
+
# Permission to use, copy, modify, and/or distribute this software for any
|
4
|
+
# purpose with or without fee is hereby granted, provided that the above
|
5
|
+
# copyright notice and this permission notice appear in all copies.
|
6
|
+
#
|
7
|
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
10
|
+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
12
|
+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
13
|
+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
14
|
+
|
15
|
+
SET (SRCS parse_config.c)
|
16
|
+
|
17
|
+
# use the library we build, duh.
|
18
|
+
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include)
|
19
|
+
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
|
20
|
+
|
21
|
+
ADD_EXECUTABLE(parse_config ${SRCS})
|
22
|
+
|
23
|
+
TARGET_LINK_LIBRARIES(parse_config yajl_s)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
This directory holds an example of how one might use yajl in the
|
2
|
+
simplest possible way, to do something like parse and extract values
|
3
|
+
from a configuration file.
|
4
|
+
|
5
|
+
Note that use of the yajl_tree.h utility is completely optional, and
|
6
|
+
yajl_parse.h offers a lower level stream parsing API that is more
|
7
|
+
efficient and flexible at the cost of some complexity.
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2011, Lloyd Hilaiel <lloyd@hilaiel.com>
|
3
|
+
*
|
4
|
+
* Permission to use, copy, modify, and/or distribute this software for any
|
5
|
+
* purpose with or without fee is hereby granted, provided that the above
|
6
|
+
* copyright notice and this permission notice appear in all copies.
|
7
|
+
*
|
8
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
9
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
10
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
11
|
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
12
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
13
|
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
14
|
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
15
|
+
*/
|
16
|
+
|
17
|
+
#include <stdio.h>
|
18
|
+
#include <string.h>
|
19
|
+
|
20
|
+
#include "yajl/yajl_tree.h"
|
21
|
+
|
22
|
+
static unsigned char fileData[65536];
|
23
|
+
|
24
|
+
int
|
25
|
+
main(void)
|
26
|
+
{
|
27
|
+
size_t rd;
|
28
|
+
yajl_val node;
|
29
|
+
char errbuf[1024];
|
30
|
+
|
31
|
+
/* null plug buffers */
|
32
|
+
fileData[0] = errbuf[0] = 0;
|
33
|
+
|
34
|
+
/* read the entire config file */
|
35
|
+
rd = fread((void *) fileData, 1, sizeof(fileData) - 1, stdin);
|
36
|
+
|
37
|
+
/* file read error handling */
|
38
|
+
if (rd == 0 && !feof(stdin)) {
|
39
|
+
fprintf(stderr, "error encountered on file read\n");
|
40
|
+
return 1;
|
41
|
+
} else if (rd >= sizeof(fileData) - 1) {
|
42
|
+
fprintf(stderr, "config file too big\n");
|
43
|
+
return 1;
|
44
|
+
}
|
45
|
+
|
46
|
+
/* we have the whole config file in memory. let's parse it ... */
|
47
|
+
node = yajl_tree_parse((const char *) fileData, errbuf, sizeof(errbuf));
|
48
|
+
|
49
|
+
/* parse error handling */
|
50
|
+
if (node == NULL) {
|
51
|
+
fprintf(stderr, "parse_error: ");
|
52
|
+
if (strlen(errbuf)) fprintf(stderr, " %s", errbuf);
|
53
|
+
else fprintf(stderr, "unknown error");
|
54
|
+
fprintf(stderr, "\n");
|
55
|
+
return 1;
|
56
|
+
}
|
57
|
+
|
58
|
+
/* ... and extract a nested value from the config file */
|
59
|
+
{
|
60
|
+
const char * path[] = { "Logging", "timeFormat", (const char *) 0 };
|
61
|
+
yajl_val v = yajl_tree_get(node, path, yajl_t_string);
|
62
|
+
if (v) printf("%s/%s: %s\n", path[0], path[1], YAJL_GET_STRING(v));
|
63
|
+
else printf("no such node: %s/%s\n", path[0], path[1]);
|
64
|
+
}
|
65
|
+
|
66
|
+
yajl_tree_free(node);
|
67
|
+
|
68
|
+
return 0;
|
69
|
+
}
|