ffi-yajl 0.0.4-universal-java → 0.1.0-universal-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +114 -30
  3. data/ext/ffi_yajl/ext/encoder/extconf.rb +5 -5
  4. data/ext/ffi_yajl/ext/parser/extconf.rb +5 -5
  5. data/lib/ffi_yajl/ffi.rb +2 -1
  6. data/lib/ffi_yajl/version.rb +1 -1
  7. data/spec/ffi_yajl/encoder_spec.rb +6 -6
  8. data/spec/ffi_yajl/json_gem_spec.rb +13 -13
  9. data/spec/ffi_yajl/parser_spec.rb +9 -9
  10. metadata +17 -175
  11. data/ext/libyajl2/extconf.rb +0 -60
  12. data/ext/libyajl2/vendored/.gitignore +0 -3
  13. data/ext/libyajl2/vendored/BUILDING +0 -23
  14. data/ext/libyajl2/vendored/BUILDING.win32 +0 -27
  15. data/ext/libyajl2/vendored/CMakeLists.txt +0 -79
  16. data/ext/libyajl2/vendored/COPYING +0 -13
  17. data/ext/libyajl2/vendored/ChangeLog +0 -175
  18. data/ext/libyajl2/vendored/README +0 -74
  19. data/ext/libyajl2/vendored/TODO +0 -9
  20. data/ext/libyajl2/vendored/YAJLDoc.cmake +0 -26
  21. data/ext/libyajl2/vendored/configure +0 -79
  22. data/ext/libyajl2/vendored/example/CMakeLists.txt +0 -23
  23. data/ext/libyajl2/vendored/example/README.md +0 -7
  24. data/ext/libyajl2/vendored/example/parse_config.c +0 -69
  25. data/ext/libyajl2/vendored/example/sample.config +0 -101
  26. data/ext/libyajl2/vendored/perf/CMakeLists.txt +0 -23
  27. data/ext/libyajl2/vendored/perf/documents.c +0 -1418
  28. data/ext/libyajl2/vendored/perf/documents.h +0 -28
  29. data/ext/libyajl2/vendored/perf/perftest.c +0 -134
  30. data/ext/libyajl2/vendored/reformatter/CMakeLists.txt +0 -39
  31. data/ext/libyajl2/vendored/reformatter/json_reformat.c +0 -194
  32. data/ext/libyajl2/vendored/src/CMakeLists.txt +0 -86
  33. data/ext/libyajl2/vendored/src/YAJL.dxy +0 -1258
  34. data/ext/libyajl2/vendored/src/api/yajl_common.h +0 -75
  35. data/ext/libyajl2/vendored/src/api/yajl_gen.h +0 -157
  36. data/ext/libyajl2/vendored/src/api/yajl_parse.h +0 -226
  37. data/ext/libyajl2/vendored/src/api/yajl_tree.h +0 -185
  38. data/ext/libyajl2/vendored/src/api/yajl_version.h.cmake +0 -23
  39. data/ext/libyajl2/vendored/src/yajl +0 -33
  40. data/ext/libyajl2/vendored/src/yajl.c +0 -175
  41. data/ext/libyajl2/vendored/src/yajl.pc.cmake +0 -9
  42. data/ext/libyajl2/vendored/src/yajl_alloc.c +0 -52
  43. data/ext/libyajl2/vendored/src/yajl_alloc.h +0 -34
  44. data/ext/libyajl2/vendored/src/yajl_buf.c +0 -103
  45. data/ext/libyajl2/vendored/src/yajl_buf.h +0 -57
  46. data/ext/libyajl2/vendored/src/yajl_bytestack.h +0 -69
  47. data/ext/libyajl2/vendored/src/yajl_encode.c +0 -220
  48. data/ext/libyajl2/vendored/src/yajl_encode.h +0 -34
  49. data/ext/libyajl2/vendored/src/yajl_gen.c +0 -354
  50. data/ext/libyajl2/vendored/src/yajl_lex.c +0 -763
  51. data/ext/libyajl2/vendored/src/yajl_lex.h +0 -117
  52. data/ext/libyajl2/vendored/src/yajl_parser.c +0 -498
  53. data/ext/libyajl2/vendored/src/yajl_parser.h +0 -78
  54. data/ext/libyajl2/vendored/src/yajl_tree.c +0 -503
  55. data/ext/libyajl2/vendored/src/yajl_version.c +0 -7
  56. data/ext/libyajl2/vendored/test/CMakeLists.txt +0 -23
  57. data/ext/libyajl2/vendored/test/cases/ac_difficult_json_c_test_case_with_comments.json +0 -1
  58. data/ext/libyajl2/vendored/test/cases/ac_difficult_json_c_test_case_with_comments.json.gold +0 -36
  59. data/ext/libyajl2/vendored/test/cases/ac_simple_with_comments.json +0 -11
  60. data/ext/libyajl2/vendored/test/cases/ac_simple_with_comments.json.gold +0 -9
  61. data/ext/libyajl2/vendored/test/cases/ag_false_then_garbage.json +0 -1
  62. data/ext/libyajl2/vendored/test/cases/ag_false_then_garbage.json.gold +0 -2
  63. data/ext/libyajl2/vendored/test/cases/ag_null_then_garbage.json +0 -1
  64. data/ext/libyajl2/vendored/test/cases/ag_null_then_garbage.json.gold +0 -2
  65. data/ext/libyajl2/vendored/test/cases/ag_true_then_garbage.json +0 -1
  66. data/ext/libyajl2/vendored/test/cases/ag_true_then_garbage.json.gold +0 -2
  67. data/ext/libyajl2/vendored/test/cases/am_eof.json +0 -1
  68. data/ext/libyajl2/vendored/test/cases/am_eof.json.gold +0 -4
  69. data/ext/libyajl2/vendored/test/cases/am_integers.json +0 -1
  70. data/ext/libyajl2/vendored/test/cases/am_integers.json.gold +0 -3
  71. data/ext/libyajl2/vendored/test/cases/am_multiple.json +0 -3
  72. data/ext/libyajl2/vendored/test/cases/am_multiple.json.gold +0 -5
  73. data/ext/libyajl2/vendored/test/cases/am_stuff.json +0 -7
  74. data/ext/libyajl2/vendored/test/cases/am_stuff.json.gold +0 -14
  75. data/ext/libyajl2/vendored/test/cases/ap_array_open.json +0 -1
  76. data/ext/libyajl2/vendored/test/cases/ap_array_open.json.gold +0 -2
  77. data/ext/libyajl2/vendored/test/cases/ap_eof_str.json +0 -1
  78. data/ext/libyajl2/vendored/test/cases/ap_eof_str.json.gold +0 -1
  79. data/ext/libyajl2/vendored/test/cases/ap_map_open.json +0 -1
  80. data/ext/libyajl2/vendored/test/cases/ap_map_open.json.gold +0 -2
  81. data/ext/libyajl2/vendored/test/cases/ap_partial_ok.json +0 -1
  82. data/ext/libyajl2/vendored/test/cases/ap_partial_ok.json.gold +0 -4
  83. data/ext/libyajl2/vendored/test/cases/array.json +0 -6
  84. data/ext/libyajl2/vendored/test/cases/array.json.gold +0 -22
  85. data/ext/libyajl2/vendored/test/cases/array_close.json +0 -1
  86. data/ext/libyajl2/vendored/test/cases/array_close.json.gold +0 -2
  87. data/ext/libyajl2/vendored/test/cases/bignums.json +0 -1
  88. data/ext/libyajl2/vendored/test/cases/bignums.json.gold +0 -5
  89. data/ext/libyajl2/vendored/test/cases/bogus_char.json +0 -4
  90. data/ext/libyajl2/vendored/test/cases/bogus_char.json.gold +0 -10
  91. data/ext/libyajl2/vendored/test/cases/codepoints_from_unicode_org.json +0 -1
  92. data/ext/libyajl2/vendored/test/cases/codepoints_from_unicode_org.json.gold +0 -2
  93. data/ext/libyajl2/vendored/test/cases/deep_arrays.json +0 -1
  94. data/ext/libyajl2/vendored/test/cases/deep_arrays.json.gold +0 -2049
  95. data/ext/libyajl2/vendored/test/cases/difficult_json_c_test_case.json +0 -1
  96. data/ext/libyajl2/vendored/test/cases/difficult_json_c_test_case.json.gold +0 -36
  97. data/ext/libyajl2/vendored/test/cases/doubles.json +0 -1
  98. data/ext/libyajl2/vendored/test/cases/doubles.json.gold +0 -7
  99. data/ext/libyajl2/vendored/test/cases/doubles_in_array.json +0 -1
  100. data/ext/libyajl2/vendored/test/cases/doubles_in_array.json.gold +0 -8
  101. data/ext/libyajl2/vendored/test/cases/empty_array.json +0 -1
  102. data/ext/libyajl2/vendored/test/cases/empty_array.json.gold +0 -3
  103. data/ext/libyajl2/vendored/test/cases/empty_string.json +0 -1
  104. data/ext/libyajl2/vendored/test/cases/empty_string.json.gold +0 -2
  105. data/ext/libyajl2/vendored/test/cases/escaped_bulgarian.json +0 -4
  106. data/ext/libyajl2/vendored/test/cases/escaped_bulgarian.json.gold +0 -7
  107. data/ext/libyajl2/vendored/test/cases/escaped_foobar.json +0 -1
  108. data/ext/libyajl2/vendored/test/cases/escaped_foobar.json.gold +0 -2
  109. data/ext/libyajl2/vendored/test/cases/false.json +0 -1
  110. data/ext/libyajl2/vendored/test/cases/false.json.gold +0 -2
  111. data/ext/libyajl2/vendored/test/cases/fg_false_then_garbage.json +0 -1
  112. data/ext/libyajl2/vendored/test/cases/fg_false_then_garbage.json.gold +0 -3
  113. data/ext/libyajl2/vendored/test/cases/fg_issue_7.json +0 -1
  114. data/ext/libyajl2/vendored/test/cases/fg_issue_7.json.gold +0 -3
  115. data/ext/libyajl2/vendored/test/cases/fg_null_then_garbage.json +0 -1
  116. data/ext/libyajl2/vendored/test/cases/fg_null_then_garbage.json.gold +0 -3
  117. data/ext/libyajl2/vendored/test/cases/fg_true_then_garbage.json +0 -1
  118. data/ext/libyajl2/vendored/test/cases/fg_true_then_garbage.json.gold +0 -3
  119. data/ext/libyajl2/vendored/test/cases/four_byte_utf8.json +0 -2
  120. data/ext/libyajl2/vendored/test/cases/four_byte_utf8.json.gold +0 -5
  121. data/ext/libyajl2/vendored/test/cases/high_overflow.json +0 -1
  122. data/ext/libyajl2/vendored/test/cases/high_overflow.json.gold +0 -2
  123. data/ext/libyajl2/vendored/test/cases/integers.json +0 -3
  124. data/ext/libyajl2/vendored/test/cases/integers.json.gold +0 -14
  125. data/ext/libyajl2/vendored/test/cases/invalid_utf8.json +0 -1
  126. data/ext/libyajl2/vendored/test/cases/invalid_utf8.json.gold +0 -3
  127. data/ext/libyajl2/vendored/test/cases/isolated_surrogate_marker.json +0 -1
  128. data/ext/libyajl2/vendored/test/cases/isolated_surrogate_marker.json.gold +0 -2
  129. data/ext/libyajl2/vendored/test/cases/leading_zero_in_number.json +0 -1
  130. data/ext/libyajl2/vendored/test/cases/leading_zero_in_number.json.gold +0 -5
  131. data/ext/libyajl2/vendored/test/cases/lonely_minus_sign.json +0 -7
  132. data/ext/libyajl2/vendored/test/cases/lonely_minus_sign.json.gold +0 -9
  133. data/ext/libyajl2/vendored/test/cases/lonely_number.json +0 -1
  134. data/ext/libyajl2/vendored/test/cases/lonely_number.json.gold +0 -2
  135. data/ext/libyajl2/vendored/test/cases/low_overflow.json +0 -1
  136. data/ext/libyajl2/vendored/test/cases/low_overflow.json.gold +0 -2
  137. data/ext/libyajl2/vendored/test/cases/map_close.json +0 -1
  138. data/ext/libyajl2/vendored/test/cases/map_close.json.gold +0 -2
  139. data/ext/libyajl2/vendored/test/cases/missing_integer_after_decimal_point.json +0 -1
  140. data/ext/libyajl2/vendored/test/cases/missing_integer_after_decimal_point.json.gold +0 -2
  141. data/ext/libyajl2/vendored/test/cases/missing_integer_after_exponent.json +0 -1
  142. data/ext/libyajl2/vendored/test/cases/missing_integer_after_exponent.json.gold +0 -2
  143. data/ext/libyajl2/vendored/test/cases/multiple.json +0 -3
  144. data/ext/libyajl2/vendored/test/cases/multiple.json.gold +0 -4
  145. data/ext/libyajl2/vendored/test/cases/non_utf8_char_in_string.json +0 -1
  146. data/ext/libyajl2/vendored/test/cases/non_utf8_char_in_string.json.gold +0 -8
  147. data/ext/libyajl2/vendored/test/cases/np_partial_bad.json +0 -1
  148. data/ext/libyajl2/vendored/test/cases/np_partial_bad.json.gold +0 -5
  149. data/ext/libyajl2/vendored/test/cases/null.json +0 -1
  150. data/ext/libyajl2/vendored/test/cases/null.json.gold +0 -2
  151. data/ext/libyajl2/vendored/test/cases/nulls_and_bools.json +0 -5
  152. data/ext/libyajl2/vendored/test/cases/nulls_and_bools.json.gold +0 -9
  153. data/ext/libyajl2/vendored/test/cases/simple.json +0 -5
  154. data/ext/libyajl2/vendored/test/cases/simple.json.gold +0 -9
  155. data/ext/libyajl2/vendored/test/cases/simple_with_comments.json +0 -11
  156. data/ext/libyajl2/vendored/test/cases/simple_with_comments.json.gold +0 -5
  157. data/ext/libyajl2/vendored/test/cases/string_invalid_escape.json +0 -1
  158. data/ext/libyajl2/vendored/test/cases/string_invalid_escape.json.gold +0 -3
  159. data/ext/libyajl2/vendored/test/cases/string_invalid_hex_char.json +0 -1
  160. data/ext/libyajl2/vendored/test/cases/string_invalid_hex_char.json.gold +0 -2
  161. data/ext/libyajl2/vendored/test/cases/string_with_escapes.json +0 -3
  162. data/ext/libyajl2/vendored/test/cases/string_with_escapes.json.gold +0 -7
  163. data/ext/libyajl2/vendored/test/cases/string_with_invalid_newline.json +0 -2
  164. data/ext/libyajl2/vendored/test/cases/string_with_invalid_newline.json.gold +0 -2
  165. data/ext/libyajl2/vendored/test/cases/three_byte_utf8.json +0 -1
  166. data/ext/libyajl2/vendored/test/cases/three_byte_utf8.json.gold +0 -7
  167. data/ext/libyajl2/vendored/test/cases/true.json +0 -1
  168. data/ext/libyajl2/vendored/test/cases/true.json.gold +0 -2
  169. data/ext/libyajl2/vendored/test/cases/unescaped_bulgarian.json +0 -1
  170. data/ext/libyajl2/vendored/test/cases/unescaped_bulgarian.json.gold +0 -4
  171. data/ext/libyajl2/vendored/test/cases/zerobyte.json +0 -1
  172. data/ext/libyajl2/vendored/test/cases/zerobyte.json.gold +0 -0
  173. data/ext/libyajl2/vendored/test/run_tests.sh +0 -94
  174. data/ext/libyajl2/vendored/test/yajl_test.c +0 -281
  175. data/ext/libyajl2/vendored/verify/CMakeLists.txt +0 -39
  176. data/ext/libyajl2/vendored/verify/json_verify.c +0 -116
  177. data/lib/libyajl.so +0 -0
  178. data/lib/libyajl.so.2 +0 -0
  179. data/lib/libyajl.so.2.0.5 +0 -0
  180. data/lib/libyajl_s.a +0 -0
@@ -1,75 +0,0 @@
1
- /*
2
- * Copyright (c) 2007-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
- #ifndef __YAJL_COMMON_H__
18
- #define __YAJL_COMMON_H__
19
-
20
- #include <stddef.h>
21
-
22
- #ifdef __cplusplus
23
- extern "C" {
24
- #endif
25
-
26
- #define YAJL_MAX_DEPTH 128
27
-
28
- /* msft dll export gunk. To build a DLL on windows, you
29
- * must define WIN32, YAJL_SHARED, and YAJL_BUILD. To use a shared
30
- * DLL, you must define YAJL_SHARED and WIN32 */
31
- #if (defined(_WIN32) || defined(WIN32)) && defined(YAJL_SHARED)
32
- # ifdef YAJL_BUILD
33
- # define YAJL_API __declspec(dllexport)
34
- # else
35
- # define YAJL_API __declspec(dllimport)
36
- # endif
37
- #else
38
- # if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
39
- # define YAJL_API __attribute__ ((visibility("default")))
40
- # else
41
- # define YAJL_API
42
- # endif
43
- #endif
44
-
45
- /** pointer to a malloc function, supporting client overriding memory
46
- * allocation routines */
47
- typedef void * (*yajl_malloc_func)(void *ctx, size_t sz);
48
-
49
- /** pointer to a free function, supporting client overriding memory
50
- * allocation routines */
51
- typedef void (*yajl_free_func)(void *ctx, void * ptr);
52
-
53
- /** pointer to a realloc function which can resize an allocation. */
54
- typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, size_t sz);
55
-
56
- /** A structure which can be passed to yajl_*_alloc routines to allow the
57
- * client to specify memory allocation functions to be used. */
58
- typedef struct
59
- {
60
- /** pointer to a function that can allocate uninitialized memory */
61
- yajl_malloc_func malloc;
62
- /** pointer to a function that can resize memory allocations */
63
- yajl_realloc_func realloc;
64
- /** pointer to a function that can free memory allocated using
65
- * reallocFunction or mallocFunction */
66
- yajl_free_func free;
67
- /** a context pointer that will be passed to above allocation routines */
68
- void * ctx;
69
- } yajl_alloc_funcs;
70
-
71
- #ifdef __cplusplus
72
- }
73
- #endif
74
-
75
- #endif
@@ -1,157 +0,0 @@
1
- /*
2
- * Copyright (c) 2007-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
- /**
18
- * \file yajl_gen.h
19
- * Interface to YAJL's JSON generation facilities.
20
- */
21
-
22
- #include <yajl/yajl_common.h>
23
-
24
- #ifndef __YAJL_GEN_H__
25
- #define __YAJL_GEN_H__
26
-
27
- #include <stddef.h>
28
-
29
- #ifdef __cplusplus
30
- extern "C" {
31
- #endif
32
- /** generator status codes */
33
- typedef enum {
34
- /** no error */
35
- yajl_gen_status_ok = 0,
36
- /** at a point where a map key is generated, a function other than
37
- * yajl_gen_string was called */
38
- yajl_gen_keys_must_be_strings,
39
- /** YAJL's maximum generation depth was exceeded. see
40
- * YAJL_MAX_DEPTH */
41
- yajl_max_depth_exceeded,
42
- /** A generator function (yajl_gen_XXX) was called while in an error
43
- * state */
44
- yajl_gen_in_error_state,
45
- /** A complete JSON document has been generated */
46
- yajl_gen_generation_complete,
47
- /** yajl_gen_double was passed an invalid floating point value
48
- * (infinity or NaN). */
49
- yajl_gen_invalid_number,
50
- /** A print callback was passed in, so there is no internal
51
- * buffer to get from */
52
- yajl_gen_no_buf,
53
- /** returned from yajl_gen_string() when the yajl_gen_validate_utf8
54
- * option is enabled and an invalid was passed by client code.
55
- */
56
- yajl_gen_invalid_string
57
- } yajl_gen_status;
58
-
59
- /** an opaque handle to a generator */
60
- typedef struct yajl_gen_t * yajl_gen;
61
-
62
- /** a callback used for "printing" the results. */
63
- typedef void (*yajl_print_t)(void * ctx,
64
- const char * str,
65
- size_t len);
66
-
67
- /** configuration parameters for the parser, these may be passed to
68
- * yajl_gen_config() along with option specific argument(s). In general,
69
- * all configuration parameters default to *off*. */
70
- typedef enum {
71
- /** generate indented (beautiful) output */
72
- yajl_gen_beautify = 0x01,
73
- /**
74
- * Set an indent string which is used when yajl_gen_beautify
75
- * is enabled. Maybe something like \\t or some number of
76
- * spaces. The default is four spaces ' '.
77
- */
78
- yajl_gen_indent_string = 0x02,
79
- /**
80
- * Set a function and context argument that should be used to
81
- * output generated json. the function should conform to the
82
- * yajl_print_t prototype while the context argument is a
83
- * void * of your choosing.
84
- *
85
- * example:
86
- * yajl_gen_config(g, yajl_gen_print_callback, myFunc, myVoidPtr);
87
- */
88
- yajl_gen_print_callback = 0x04,
89
- /**
90
- * Normally the generator does not validate that strings you
91
- * pass to it via yajl_gen_string() are valid UTF8. Enabling
92
- * this option will cause it to do so.
93
- */
94
- yajl_gen_validate_utf8 = 0x08,
95
- /**
96
- * the forward solidus (slash or '/' in human) is not required to be
97
- * escaped in json text. By default, YAJL will not escape it in the
98
- * iterest of saving bytes. Setting this flag will cause YAJL to
99
- * always escape '/' in generated JSON strings.
100
- */
101
- yajl_gen_escape_solidus = 0x10
102
- } yajl_gen_option;
103
-
104
- /** allow the modification of generator options subsequent to handle
105
- * allocation (via yajl_alloc)
106
- * \returns zero in case of errors, non-zero otherwise
107
- */
108
- YAJL_API int yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...);
109
-
110
- /** allocate a generator handle
111
- * \param allocFuncs an optional pointer to a structure which allows
112
- * the client to overide the memory allocation
113
- * used by yajl. May be NULL, in which case
114
- * malloc/free/realloc will be used.
115
- *
116
- * \returns an allocated handle on success, NULL on failure (bad params)
117
- */
118
- YAJL_API yajl_gen yajl_gen_alloc(const yajl_alloc_funcs * allocFuncs);
119
-
120
- /** free a generator handle */
121
- YAJL_API void yajl_gen_free(yajl_gen handle);
122
-
123
- YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long long int number);
124
- /** generate a floating point number. number may not be infinity or
125
- * NaN, as these have no representation in JSON. In these cases the
126
- * generator will return 'yajl_gen_invalid_number' */
127
- YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number);
128
- YAJL_API yajl_gen_status yajl_gen_number(yajl_gen hand,
129
- const char * num,
130
- size_t len);
131
- YAJL_API yajl_gen_status yajl_gen_string(yajl_gen hand,
132
- const unsigned char * str,
133
- size_t len);
134
- YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand);
135
- YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean);
136
- YAJL_API yajl_gen_status yajl_gen_map_open(yajl_gen hand);
137
- YAJL_API yajl_gen_status yajl_gen_map_close(yajl_gen hand);
138
- YAJL_API yajl_gen_status yajl_gen_array_open(yajl_gen hand);
139
- YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand);
140
-
141
- /** access the null terminated generator buffer. If incrementally
142
- * outputing JSON, one should call yajl_gen_clear to clear the
143
- * buffer. This allows stream generation. */
144
- YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand,
145
- const unsigned char ** buf,
146
- size_t * len);
147
-
148
- /** clear yajl's output buffer, but maintain all internal generation
149
- * state. This function will not "reset" the generator state, and is
150
- * intended to enable incremental JSON outputing. */
151
- YAJL_API void yajl_gen_clear(yajl_gen hand);
152
-
153
- #ifdef __cplusplus
154
- }
155
- #endif
156
-
157
- #endif
@@ -1,226 +0,0 @@
1
- /*
2
- * Copyright (c) 2007-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
- /**
18
- * \file yajl_parse.h
19
- * Interface to YAJL's JSON stream parsing facilities.
20
- */
21
-
22
- #include <yajl/yajl_common.h>
23
-
24
- #ifndef __YAJL_PARSE_H__
25
- #define __YAJL_PARSE_H__
26
-
27
- #include <stddef.h>
28
-
29
- #ifdef __cplusplus
30
- extern "C" {
31
- #endif
32
- /** error codes returned from this interface */
33
- typedef enum {
34
- /** no error was encountered */
35
- yajl_status_ok,
36
- /** a client callback returned zero, stopping the parse */
37
- yajl_status_client_canceled,
38
- /** An error occured during the parse. Call yajl_get_error for
39
- * more information about the encountered error */
40
- yajl_status_error
41
- } yajl_status;
42
-
43
- /** attain a human readable, english, string for an error */
44
- YAJL_API const char * yajl_status_to_string(yajl_status code);
45
-
46
- /** an opaque handle to a parser */
47
- typedef struct yajl_handle_t * yajl_handle;
48
-
49
- /** yajl is an event driven parser. this means as json elements are
50
- * parsed, you are called back to do something with the data. The
51
- * functions in this table indicate the various events for which
52
- * you will be called back. Each callback accepts a "context"
53
- * pointer, this is a void * that is passed into the yajl_parse
54
- * function which the client code may use to pass around context.
55
- *
56
- * All callbacks return an integer. If non-zero, the parse will
57
- * continue. If zero, the parse will be canceled and
58
- * yajl_status_client_canceled will be returned from the parse.
59
- *
60
- * \attention {
61
- * A note about the handling of numbers:
62
- *
63
- * yajl will only convert numbers that can be represented in a
64
- * double or a 64 bit (long long) int. All other numbers will
65
- * be passed to the client in string form using the yajl_number
66
- * callback. Furthermore, if yajl_number is not NULL, it will
67
- * always be used to return numbers, that is yajl_integer and
68
- * yajl_double will be ignored. If yajl_number is NULL but one
69
- * of yajl_integer or yajl_double are defined, parsing of a
70
- * number larger than is representable in a double or 64 bit
71
- * integer will result in a parse error.
72
- * }
73
- */
74
- typedef struct {
75
- int (* yajl_null)(void * ctx);
76
- int (* yajl_boolean)(void * ctx, int boolVal);
77
- int (* yajl_integer)(void * ctx, long long integerVal);
78
- int (* yajl_double)(void * ctx, double doubleVal);
79
- /** A callback which passes the string representation of the number
80
- * back to the client. Will be used for all numbers when present */
81
- int (* yajl_number)(void * ctx, const char * numberVal,
82
- size_t numberLen);
83
-
84
- /** strings are returned as pointers into the JSON text when,
85
- * possible, as a result, they are _not_ null padded */
86
- int (* yajl_string)(void * ctx, const unsigned char * stringVal,
87
- size_t stringLen);
88
-
89
- int (* yajl_start_map)(void * ctx);
90
- int (* yajl_map_key)(void * ctx, const unsigned char * key,
91
- size_t stringLen);
92
- int (* yajl_end_map)(void * ctx);
93
-
94
- int (* yajl_start_array)(void * ctx);
95
- int (* yajl_end_array)(void * ctx);
96
- } yajl_callbacks;
97
-
98
- /** allocate a parser handle
99
- * \param callbacks a yajl callbacks structure specifying the
100
- * functions to call when different JSON entities
101
- * are encountered in the input text. May be NULL,
102
- * which is only useful for validation.
103
- * \param afs memory allocation functions, may be NULL for to use
104
- * C runtime library routines (malloc and friends)
105
- * \param ctx a context pointer that will be passed to callbacks.
106
- */
107
- YAJL_API yajl_handle yajl_alloc(const yajl_callbacks * callbacks,
108
- yajl_alloc_funcs * afs,
109
- void * ctx);
110
-
111
-
112
- /** configuration parameters for the parser, these may be passed to
113
- * yajl_config() along with option specific argument(s). In general,
114
- * all configuration parameters default to *off*. */
115
- typedef enum {
116
- /** Ignore javascript style comments present in
117
- * JSON input. Non-standard, but rather fun
118
- * arguments: toggled off with integer zero, on otherwise.
119
- *
120
- * example:
121
- * yajl_config(h, yajl_allow_comments, 1); // turn comment support on
122
- */
123
- yajl_allow_comments = 0x01,
124
- /**
125
- * When set the parser will verify that all strings in JSON input are
126
- * valid UTF8 and will emit a parse error if this is not so. When set,
127
- * this option makes parsing slightly more expensive (~7% depending
128
- * on processor and compiler in use)
129
- *
130
- * example:
131
- * yajl_config(h, yajl_dont_validate_strings, 1); // disable utf8 checking
132
- */
133
- yajl_dont_validate_strings = 0x02,
134
- /**
135
- * By default, upon calls to yajl_complete_parse(), yajl will
136
- * ensure the entire input text was consumed and will raise an error
137
- * otherwise. Enabling this flag will cause yajl to disable this
138
- * check. This can be useful when parsing json out of a that contains more
139
- * than a single JSON document.
140
- */
141
- yajl_allow_trailing_garbage = 0x04,
142
- /**
143
- * Allow multiple values to be parsed by a single handle. The
144
- * entire text must be valid JSON, and values can be seperated
145
- * by any kind of whitespace. This flag will change the
146
- * behavior of the parser, and cause it continue parsing after
147
- * a value is parsed, rather than transitioning into a
148
- * complete state. This option can be useful when parsing multiple
149
- * values from an input stream.
150
- */
151
- yajl_allow_multiple_values = 0x08,
152
- /**
153
- * When yajl_complete_parse() is called the parser will
154
- * check that the top level value was completely consumed. I.E.,
155
- * if called whilst in the middle of parsing a value
156
- * yajl will enter an error state (premature EOF). Setting this
157
- * flag suppresses that check and the corresponding error.
158
- */
159
- yajl_allow_partial_values = 0x10
160
- } yajl_option;
161
-
162
- /** allow the modification of parser options subsequent to handle
163
- * allocation (via yajl_alloc)
164
- * \returns zero in case of errors, non-zero otherwise
165
- */
166
- YAJL_API int yajl_config(yajl_handle h, yajl_option opt, ...);
167
-
168
- /** free a parser handle */
169
- YAJL_API void yajl_free(yajl_handle handle);
170
-
171
- /** Parse some json!
172
- * \param hand - a handle to the json parser allocated with yajl_alloc
173
- * \param jsonText - a pointer to the UTF8 json text to be parsed
174
- * \param jsonTextLength - the length, in bytes, of input text
175
- */
176
- YAJL_API yajl_status yajl_parse(yajl_handle hand,
177
- const unsigned char * jsonText,
178
- size_t jsonTextLength);
179
-
180
- /** Parse any remaining buffered json.
181
- * Since yajl is a stream-based parser, without an explicit end of
182
- * input, yajl sometimes can't decide if content at the end of the
183
- * stream is valid or not. For example, if "1" has been fed in,
184
- * yajl can't know whether another digit is next or some character
185
- * that would terminate the integer token.
186
- *
187
- * \param hand - a handle to the json parser allocated with yajl_alloc
188
- */
189
- YAJL_API yajl_status yajl_complete_parse(yajl_handle hand);
190
-
191
- /** get an error string describing the state of the
192
- * parse.
193
- *
194
- * If verbose is non-zero, the message will include the JSON
195
- * text where the error occured, along with an arrow pointing to
196
- * the specific char.
197
- *
198
- * \returns A dynamically allocated string will be returned which should
199
- * be freed with yajl_free_error
200
- */
201
- YAJL_API unsigned char * yajl_get_error(yajl_handle hand, int verbose,
202
- const unsigned char * jsonText,
203
- size_t jsonTextLength);
204
-
205
- /**
206
- * get the amount of data consumed from the last chunk passed to YAJL.
207
- *
208
- * In the case of a successful parse this can help you understand if
209
- * the entire buffer was consumed (which will allow you to handle
210
- * "junk at end of input").
211
- *
212
- * In the event an error is encountered during parsing, this function
213
- * affords the client a way to get the offset into the most recent
214
- * chunk where the error occured. 0 will be returned if no error
215
- * was encountered.
216
- */
217
- YAJL_API size_t yajl_get_bytes_consumed(yajl_handle hand);
218
-
219
- /** free an error returned from yajl_get_error */
220
- YAJL_API void yajl_free_error(yajl_handle hand, unsigned char * str);
221
-
222
- #ifdef __cplusplus
223
- }
224
- #endif
225
-
226
- #endif