oj 3.7.4 → 3.13.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1352 -0
- data/README.md +29 -8
- data/RELEASE_NOTES.md +61 -0
- data/ext/oj/buf.h +53 -72
- data/ext/oj/cache.c +326 -0
- data/ext/oj/cache.h +21 -0
- data/ext/oj/cache8.c +61 -64
- data/ext/oj/cache8.h +12 -39
- data/ext/oj/circarray.c +37 -43
- data/ext/oj/circarray.h +16 -17
- data/ext/oj/code.c +165 -179
- data/ext/oj/code.h +27 -29
- data/ext/oj/compat.c +174 -194
- data/ext/oj/custom.c +809 -866
- data/ext/oj/debug.c +132 -0
- data/ext/oj/dump.c +848 -863
- data/ext/oj/dump.h +81 -67
- data/ext/oj/dump_compat.c +85 -123
- data/ext/oj/dump_leaf.c +100 -188
- data/ext/oj/dump_object.c +527 -656
- data/ext/oj/dump_strict.c +315 -338
- data/ext/oj/encode.h +7 -34
- data/ext/oj/encoder.c +43 -0
- data/ext/oj/err.c +40 -29
- data/ext/oj/err.h +48 -48
- data/ext/oj/extconf.rb +17 -4
- data/ext/oj/fast.c +1070 -1087
- data/ext/oj/intern.c +301 -0
- data/ext/oj/intern.h +26 -0
- data/ext/oj/mimic_json.c +469 -436
- data/ext/oj/object.c +525 -593
- data/ext/oj/odd.c +154 -138
- data/ext/oj/odd.h +37 -38
- data/ext/oj/oj.c +1325 -986
- data/ext/oj/oj.h +333 -316
- data/ext/oj/parse.c +1002 -846
- data/ext/oj/parse.h +92 -87
- data/ext/oj/parser.c +1557 -0
- data/ext/oj/parser.h +91 -0
- data/ext/oj/rails.c +888 -878
- data/ext/oj/rails.h +11 -14
- data/ext/oj/reader.c +141 -147
- data/ext/oj/reader.h +73 -89
- data/ext/oj/resolve.c +41 -62
- data/ext/oj/resolve.h +7 -9
- data/ext/oj/rxclass.c +71 -75
- data/ext/oj/rxclass.h +18 -19
- data/ext/oj/saj.c +443 -486
- data/ext/oj/saj2.c +602 -0
- data/ext/oj/scp.c +88 -113
- data/ext/oj/sparse.c +787 -709
- data/ext/oj/stream_writer.c +133 -159
- data/ext/oj/strict.c +127 -118
- data/ext/oj/string_writer.c +230 -249
- data/ext/oj/trace.c +34 -41
- data/ext/oj/trace.h +19 -19
- data/ext/oj/usual.c +1254 -0
- data/ext/oj/util.c +136 -0
- data/ext/oj/util.h +20 -0
- data/ext/oj/val_stack.c +59 -67
- data/ext/oj/val_stack.h +91 -129
- data/ext/oj/validate.c +46 -0
- data/ext/oj/wab.c +342 -353
- data/lib/oj/bag.rb +1 -0
- data/lib/oj/easy_hash.rb +5 -4
- data/lib/oj/error.rb +1 -1
- data/lib/oj/json.rb +1 -1
- data/lib/oj/mimic.rb +48 -14
- data/lib/oj/saj.rb +20 -6
- data/lib/oj/state.rb +8 -7
- data/lib/oj/version.rb +2 -2
- data/lib/oj.rb +0 -8
- data/pages/Compatibility.md +1 -1
- data/pages/JsonGem.md +15 -0
- data/pages/Modes.md +53 -46
- data/pages/Options.md +72 -11
- data/pages/Parser.md +309 -0
- data/pages/Rails.md +73 -22
- data/pages/Security.md +1 -1
- data/test/activerecord/result_test.rb +7 -2
- data/test/activesupport5/abstract_unit.rb +45 -0
- data/test/activesupport5/decoding_test.rb +68 -60
- data/test/activesupport5/encoding_test.rb +111 -96
- data/test/activesupport5/encoding_test_cases.rb +33 -25
- data/test/activesupport5/test_helper.rb +43 -21
- data/test/activesupport5/time_zone_test_helpers.rb +18 -3
- data/test/activesupport6/abstract_unit.rb +44 -0
- data/test/activesupport6/decoding_test.rb +133 -0
- data/test/activesupport6/encoding_test.rb +507 -0
- data/test/activesupport6/encoding_test_cases.rb +98 -0
- data/test/activesupport6/test_common.rb +17 -0
- data/test/activesupport6/test_helper.rb +163 -0
- data/test/activesupport6/time_zone_test_helpers.rb +39 -0
- data/test/activesupport7/abstract_unit.rb +49 -0
- data/test/activesupport7/decoding_test.rb +125 -0
- data/test/activesupport7/encoding_test.rb +486 -0
- data/test/activesupport7/encoding_test_cases.rb +104 -0
- data/test/activesupport7/time_zone_test_helpers.rb +47 -0
- data/test/bar.rb +6 -12
- data/test/baz.rb +16 -0
- data/test/bug.rb +16 -0
- data/test/foo.rb +69 -75
- data/test/helper.rb +16 -0
- data/test/json_gem/json_common_interface_test.rb +8 -3
- data/test/json_gem/json_generator_test.rb +18 -4
- data/test/json_gem/json_parser_test.rb +9 -0
- data/test/json_gem/test_helper.rb +12 -0
- data/test/mem.rb +33 -0
- data/test/perf.rb +1 -1
- data/test/perf_dump.rb +50 -0
- data/test/perf_once.rb +58 -0
- data/test/perf_parser.rb +189 -0
- data/test/perf_scp.rb +11 -10
- data/test/perf_strict.rb +17 -23
- data/test/prec.rb +23 -0
- data/test/sample_json.rb +1 -1
- data/test/test_compat.rb +46 -10
- data/test/test_custom.rb +147 -8
- data/test/test_fast.rb +62 -2
- data/test/test_file.rb +25 -2
- data/test/test_gc.rb +13 -0
- data/test/test_generate.rb +21 -0
- data/test/test_hash.rb +11 -1
- data/test/test_integer_range.rb +7 -2
- data/test/test_object.rb +85 -9
- data/test/test_parser.rb +27 -0
- data/test/test_parser_saj.rb +335 -0
- data/test/test_parser_usual.rb +217 -0
- data/test/test_rails.rb +35 -0
- data/test/test_saj.rb +1 -1
- data/test/test_scp.rb +5 -5
- data/test/test_strict.rb +26 -1
- data/test/test_various.rb +87 -65
- data/test/test_wab.rb +2 -0
- data/test/test_writer.rb +19 -2
- data/test/tests.rb +1 -1
- data/test/zoo.rb +13 -0
- metadata +60 -110
- data/ext/oj/hash.c +0 -163
- data/ext/oj/hash.h +0 -46
- data/ext/oj/hash_test.c +0 -512
data/ext/oj/oj.h
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2011 Peter Ohler. All rights reserved.
|
2
|
+
// Licensed under the MIT License. See LICENSE file in the project root for license details.
|
5
3
|
|
6
|
-
#ifndef
|
7
|
-
#define
|
4
|
+
#ifndef OJ_H
|
5
|
+
#define OJ_H
|
8
6
|
|
9
|
-
#if defined(
|
7
|
+
#if defined(cplusplus)
|
10
8
|
extern "C" {
|
11
9
|
#if 0
|
12
10
|
} /* satisfy cc-mode */
|
@@ -15,13 +13,13 @@ extern "C" {
|
|
15
13
|
|
16
14
|
#define RSTRING_NOT_MODIFIED
|
17
15
|
|
16
|
+
#include <stdbool.h>
|
17
|
+
#include <stdint.h>
|
18
|
+
|
18
19
|
#include "ruby.h"
|
19
20
|
#include "ruby/encoding.h"
|
20
21
|
|
21
|
-
#
|
22
|
-
#include <stdbool.h>
|
23
|
-
|
24
|
-
#if HAVE_LIBPTHREAD
|
22
|
+
#ifdef HAVE_PTHREAD_MUTEX_INIT
|
25
23
|
#include <pthread.h>
|
26
24
|
#endif
|
27
25
|
#include "cache8.h"
|
@@ -29,352 +27,371 @@ extern "C" {
|
|
29
27
|
#ifdef RUBINIUS_RUBY
|
30
28
|
#undef T_RATIONAL
|
31
29
|
#undef T_COMPLEX
|
32
|
-
enum st_retval {ST_CONTINUE = 0, ST_STOP = 1, ST_DELETE = 2, ST_CHECK};
|
30
|
+
enum st_retval { ST_CONTINUE = 0, ST_STOP = 1, ST_DELETE = 2, ST_CHECK };
|
33
31
|
#else
|
34
32
|
#include "ruby/st.h"
|
35
33
|
#endif
|
36
34
|
|
37
|
-
#include "rxclass.h"
|
38
35
|
#include "err.h"
|
36
|
+
#include "rxclass.h"
|
39
37
|
|
40
|
-
#define INF_VAL
|
41
|
-
#define NINF_VAL
|
42
|
-
#define NAN_VAL
|
38
|
+
#define INF_VAL "3.0e14159265358979323846"
|
39
|
+
#define NINF_VAL "-3.0e14159265358979323846"
|
40
|
+
#define NAN_VAL "3.3e14159265358979323846"
|
43
41
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
#if __STDC_VERSION__ >= 199901L
|
43
|
+
// To avoid using ruby_snprintf with C99.
|
44
|
+
#undef snprintf
|
45
|
+
#include <stdio.h>
|
46
|
+
#endif
|
47
|
+
|
48
|
+
// To avoid using ruby_nonempty_memcpy().
|
49
|
+
#undef memcpy
|
50
|
+
#include <string.h>
|
51
|
+
|
52
|
+
typedef enum { Yes = 'y', No = 'n', NotSet = 0 } YesNo;
|
49
53
|
|
50
54
|
typedef enum {
|
51
|
-
StrictMode
|
52
|
-
ObjectMode
|
53
|
-
NullMode
|
54
|
-
CompatMode
|
55
|
-
RailsMode
|
56
|
-
CustomMode
|
57
|
-
WabMode
|
55
|
+
StrictMode = 's',
|
56
|
+
ObjectMode = 'o',
|
57
|
+
NullMode = 'n',
|
58
|
+
CompatMode = 'c',
|
59
|
+
RailsMode = 'r',
|
60
|
+
CustomMode = 'C',
|
61
|
+
WabMode = 'w',
|
58
62
|
} Mode;
|
59
63
|
|
60
|
-
typedef enum {
|
61
|
-
UnixTime = 'u',
|
62
|
-
UnixZTime = 'z',
|
63
|
-
XmlTime = 'x',
|
64
|
-
RubyTime = 'r'
|
65
|
-
} TimeFormat;
|
64
|
+
typedef enum { UnixTime = 'u', UnixZTime = 'z', XmlTime = 'x', RubyTime = 'r' } TimeFormat;
|
66
65
|
|
67
66
|
typedef enum {
|
68
|
-
NLEsc
|
69
|
-
JSONEsc
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
67
|
+
NLEsc = 'n',
|
68
|
+
JSONEsc = 'j',
|
69
|
+
SlashEsc = 's',
|
70
|
+
XSSEsc = 'x',
|
71
|
+
ASCIIEsc = 'a',
|
72
|
+
JXEsc = 'g', // json gem
|
73
|
+
RailsXEsc = 'r', // rails xss mode
|
74
|
+
RailsEsc = 'R', // rails non escape
|
74
75
|
} Encoding;
|
75
76
|
|
76
77
|
typedef enum {
|
77
|
-
BigDec
|
78
|
-
FloatDec
|
79
|
-
AutoDec
|
78
|
+
BigDec = 'b',
|
79
|
+
FloatDec = 'f',
|
80
|
+
AutoDec = 'a',
|
81
|
+
FastDec = 'F',
|
82
|
+
RubyDec = 'r',
|
80
83
|
} BigLoad;
|
81
84
|
|
82
85
|
typedef enum {
|
83
|
-
ArrayNew
|
84
|
-
ArrayType
|
85
|
-
ObjectNew
|
86
|
-
ObjectType
|
86
|
+
ArrayNew = 'A',
|
87
|
+
ArrayType = 'a',
|
88
|
+
ObjectNew = 'O',
|
89
|
+
ObjectType = 'o',
|
87
90
|
} DumpType;
|
88
91
|
|
89
92
|
typedef enum {
|
90
|
-
AutoNan
|
91
|
-
NullNan
|
92
|
-
HugeNan
|
93
|
-
WordNan
|
94
|
-
RaiseNan
|
93
|
+
AutoNan = 'a',
|
94
|
+
NullNan = 'n',
|
95
|
+
HugeNan = 'h',
|
96
|
+
WordNan = 'w',
|
97
|
+
RaiseNan = 'r',
|
95
98
|
} NanDump;
|
96
99
|
|
97
100
|
typedef enum {
|
98
|
-
STRING_IO
|
99
|
-
STREAM_IO
|
100
|
-
FILE_IO
|
101
|
+
STRING_IO = 'c',
|
102
|
+
STREAM_IO = 's',
|
103
|
+
FILE_IO = 'f',
|
101
104
|
} StreamWriterType;
|
102
105
|
|
103
106
|
typedef enum {
|
104
|
-
CALLER_DUMP
|
105
|
-
CALLER_TO_JSON
|
106
|
-
CALLER_GENERATE
|
107
|
+
CALLER_DUMP = 'd',
|
108
|
+
CALLER_TO_JSON = 't',
|
109
|
+
CALLER_GENERATE = 'g',
|
107
110
|
// Add the fast versions if necessary. Maybe unparse as well if needed.
|
108
111
|
} DumpCaller;
|
109
112
|
|
110
|
-
typedef struct
|
111
|
-
bool
|
112
|
-
char
|
113
|
-
char
|
114
|
-
char
|
115
|
-
char
|
116
|
-
char
|
117
|
-
uint8_t
|
118
|
-
uint8_t
|
119
|
-
uint8_t
|
120
|
-
uint8_t
|
121
|
-
uint8_t
|
122
|
-
char
|
123
|
-
bool
|
124
|
-
int
|
125
|
-
} *DumpOpts;
|
126
|
-
|
127
|
-
typedef struct
|
128
|
-
int
|
129
|
-
char
|
130
|
-
char
|
131
|
-
char
|
132
|
-
char
|
133
|
-
char
|
134
|
-
char
|
135
|
-
char
|
136
|
-
char
|
137
|
-
char
|
138
|
-
char
|
139
|
-
char
|
140
|
-
char
|
141
|
-
char
|
142
|
-
char
|
143
|
-
char
|
144
|
-
char
|
145
|
-
char
|
146
|
-
char
|
147
|
-
char
|
148
|
-
char
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
char
|
155
|
-
char
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
113
|
+
typedef struct _dumpOpts {
|
114
|
+
bool use;
|
115
|
+
char indent_str[16];
|
116
|
+
char before_sep[16];
|
117
|
+
char after_sep[16];
|
118
|
+
char hash_nl[16];
|
119
|
+
char array_nl[16];
|
120
|
+
uint8_t indent_size;
|
121
|
+
uint8_t before_size;
|
122
|
+
uint8_t after_size;
|
123
|
+
uint8_t hash_size;
|
124
|
+
uint8_t array_size;
|
125
|
+
char nan_dump; // NanDump
|
126
|
+
bool omit_nil;
|
127
|
+
int max_depth;
|
128
|
+
} * DumpOpts;
|
129
|
+
|
130
|
+
typedef struct _options {
|
131
|
+
int indent; // indention for dump, default 2
|
132
|
+
char circular; // YesNo
|
133
|
+
char auto_define; // YesNo
|
134
|
+
char sym_key; // YesNo
|
135
|
+
char escape_mode; // Escape_Mode
|
136
|
+
char mode; // Mode
|
137
|
+
char class_cache; // YesNo
|
138
|
+
char time_format; // TimeFormat
|
139
|
+
char bigdec_as_num; // YesNo
|
140
|
+
char bigdec_load; // BigLoad
|
141
|
+
char compat_bigdec; // boolean (0 or 1)
|
142
|
+
char to_hash; // YesNo
|
143
|
+
char to_json; // YesNo
|
144
|
+
char as_json; // YesNo
|
145
|
+
char raw_json; // YesNo
|
146
|
+
char nilnil; // YesNo
|
147
|
+
char empty_string; // YesNo
|
148
|
+
char allow_gc; // allow GC during parse
|
149
|
+
char quirks_mode; // allow single JSON values instead of documents
|
150
|
+
char allow_invalid; // YesNo - allow invalid unicode
|
151
|
+
char create_ok; // YesNo allow create_id
|
152
|
+
char allow_nan; // YEsyNo for parsing only
|
153
|
+
char trace; // YesNo
|
154
|
+
char safe; // YesNo
|
155
|
+
char sec_prec_set; // boolean (0 or 1)
|
156
|
+
char ignore_under; // YesNo - ignore attrs starting with _ if true in object and custom modes
|
157
|
+
char cache_keys; // YesNo
|
158
|
+
char cache_str; // string short than or equal to this are cache
|
159
|
+
int64_t int_range_min; // dump numbers below as string
|
160
|
+
int64_t int_range_max; // dump numbers above as string
|
161
|
+
const char * create_id; // 0 or string
|
162
|
+
size_t create_id_len; // length of create_id
|
163
|
+
int sec_prec; // second precision when dumping time
|
164
|
+
char float_prec; // float precision, linked to float_fmt
|
165
|
+
char float_fmt[7]; // float format for dumping, if empty use Ruby
|
166
|
+
VALUE hash_class; // class to use in place of Hash on load
|
167
|
+
VALUE array_class; // class to use in place of Array on load
|
168
|
+
struct _dumpOpts dump_opts;
|
169
|
+
struct _rxClass str_rx;
|
170
|
+
VALUE * ignore; // Qnil terminated array of classes or NULL
|
171
|
+
} * Options;
|
172
|
+
|
173
|
+
struct _out;
|
174
|
+
typedef void (*DumpFunc)(VALUE obj, int depth, struct _out *out, bool as_ok);
|
165
175
|
|
166
176
|
// rails optimize
|
167
|
-
typedef struct
|
168
|
-
VALUE
|
169
|
-
bool
|
170
|
-
DumpFunc
|
171
|
-
} *ROpt;
|
172
|
-
|
173
|
-
typedef struct
|
174
|
-
int
|
175
|
-
int
|
176
|
-
ROpt
|
177
|
-
} *ROptTable;
|
178
|
-
|
179
|
-
typedef struct
|
180
|
-
char
|
181
|
-
char
|
182
|
-
char
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
int
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
bool
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
struct
|
200
|
-
|
201
|
-
|
202
|
-
char
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
int
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
};
|
221
|
-
|
222
|
-
typedef struct _Leaf {
|
223
|
-
struct _Leaf *next;
|
177
|
+
typedef struct _rOpt {
|
178
|
+
VALUE clas;
|
179
|
+
bool on;
|
180
|
+
DumpFunc dump;
|
181
|
+
} * ROpt;
|
182
|
+
|
183
|
+
typedef struct _rOptTable {
|
184
|
+
int len;
|
185
|
+
int alen;
|
186
|
+
ROpt table;
|
187
|
+
} * ROptTable;
|
188
|
+
|
189
|
+
typedef struct _out {
|
190
|
+
char stack_buffer[4096];
|
191
|
+
char * buf;
|
192
|
+
char * end;
|
193
|
+
char * cur;
|
194
|
+
Cache8 circ_cache;
|
195
|
+
slot_t circ_cnt;
|
196
|
+
int indent;
|
197
|
+
int depth; // used by dump_hash
|
198
|
+
Options opts;
|
199
|
+
uint32_t hash_cnt;
|
200
|
+
bool allocated;
|
201
|
+
bool omit_nil;
|
202
|
+
int argc;
|
203
|
+
VALUE * argv;
|
204
|
+
DumpCaller caller; // used for the mimic json only
|
205
|
+
ROptTable ropts;
|
206
|
+
} * Out;
|
207
|
+
|
208
|
+
typedef struct _strWriter {
|
209
|
+
struct _out out;
|
210
|
+
struct _options opts;
|
211
|
+
int depth;
|
212
|
+
char * types; // DumpType
|
213
|
+
char * types_end;
|
214
|
+
int keyWritten;
|
215
|
+
|
216
|
+
} * StrWriter;
|
217
|
+
|
218
|
+
typedef struct _streamWriter {
|
219
|
+
struct _strWriter sw;
|
220
|
+
StreamWriterType type;
|
221
|
+
VALUE stream;
|
222
|
+
int fd;
|
223
|
+
int flush_limit; // indicator of when to flush
|
224
|
+
} * StreamWriter;
|
225
|
+
|
226
|
+
enum { NO_VAL = 0x00, STR_VAL = 0x01, COL_VAL = 0x02, RUBY_VAL = 0x03 };
|
227
|
+
|
228
|
+
typedef struct _leaf {
|
229
|
+
struct _leaf *next;
|
224
230
|
union {
|
225
|
-
|
226
|
-
|
231
|
+
const char *key; // hash key
|
232
|
+
size_t index; // array index, 0 is not set
|
227
233
|
};
|
228
234
|
union {
|
229
|
-
|
230
|
-
|
231
|
-
|
235
|
+
char * str; // pointer to location in json string or allocated
|
236
|
+
struct _leaf *elements; // array and hash elements
|
237
|
+
VALUE value;
|
232
238
|
};
|
233
|
-
uint8_t
|
234
|
-
uint8_t
|
235
|
-
uint8_t
|
236
|
-
} *Leaf;
|
237
|
-
|
238
|
-
extern VALUE
|
239
|
-
extern VALUE
|
240
|
-
|
241
|
-
extern VALUE
|
242
|
-
extern VALUE
|
243
|
-
extern VALUE
|
244
|
-
extern VALUE
|
245
|
-
extern VALUE
|
246
|
-
extern VALUE
|
247
|
-
extern VALUE
|
248
|
-
|
249
|
-
extern VALUE
|
250
|
-
extern VALUE
|
251
|
-
extern VALUE
|
252
|
-
extern VALUE
|
253
|
-
|
254
|
-
extern
|
255
|
-
|
256
|
-
|
257
|
-
extern void
|
258
|
-
extern void
|
259
|
-
|
260
|
-
extern void
|
261
|
-
extern void
|
262
|
-
|
263
|
-
extern void
|
264
|
-
|
265
|
-
extern void
|
266
|
-
extern void
|
267
|
-
extern void
|
268
|
-
extern void
|
269
|
-
extern void
|
270
|
-
|
271
|
-
extern void
|
272
|
-
|
273
|
-
extern void
|
274
|
-
extern void
|
275
|
-
extern
|
276
|
-
extern
|
277
|
-
extern VALUE
|
278
|
-
extern
|
279
|
-
|
280
|
-
extern
|
281
|
-
|
282
|
-
extern
|
283
|
-
|
284
|
-
extern
|
285
|
-
|
286
|
-
extern VALUE
|
287
|
-
|
288
|
-
extern
|
289
|
-
|
290
|
-
extern
|
291
|
-
extern
|
292
|
-
|
293
|
-
extern VALUE
|
294
|
-
extern VALUE
|
295
|
-
extern VALUE
|
296
|
-
extern VALUE
|
297
|
-
extern VALUE
|
298
|
-
extern VALUE
|
299
|
-
extern VALUE
|
300
|
-
extern VALUE
|
301
|
-
extern VALUE
|
302
|
-
extern VALUE
|
303
|
-
|
304
|
-
extern VALUE
|
305
|
-
extern VALUE
|
306
|
-
|
307
|
-
extern VALUE
|
308
|
-
extern VALUE
|
309
|
-
extern VALUE
|
310
|
-
extern VALUE
|
311
|
-
extern VALUE
|
312
|
-
extern VALUE
|
313
|
-
extern VALUE
|
314
|
-
extern VALUE
|
315
|
-
extern VALUE
|
316
|
-
extern VALUE
|
317
|
-
extern VALUE
|
318
|
-
|
319
|
-
extern VALUE
|
320
|
-
|
321
|
-
extern
|
322
|
-
extern
|
323
|
-
|
324
|
-
extern
|
325
|
-
|
326
|
-
extern ID
|
327
|
-
extern ID
|
328
|
-
extern ID
|
329
|
-
extern ID
|
330
|
-
extern ID
|
331
|
-
extern ID
|
332
|
-
extern ID
|
333
|
-
extern ID
|
334
|
-
extern ID
|
335
|
-
extern ID
|
336
|
-
extern ID
|
337
|
-
extern ID
|
338
|
-
extern ID
|
339
|
-
extern ID
|
340
|
-
extern ID
|
341
|
-
extern ID
|
342
|
-
extern ID
|
343
|
-
extern ID
|
344
|
-
extern ID
|
345
|
-
extern ID
|
346
|
-
extern ID
|
347
|
-
extern ID
|
348
|
-
extern ID
|
349
|
-
extern ID
|
350
|
-
extern ID
|
351
|
-
extern ID
|
352
|
-
extern ID
|
353
|
-
extern ID
|
354
|
-
extern ID
|
355
|
-
extern ID
|
356
|
-
extern ID
|
357
|
-
extern ID
|
358
|
-
extern ID
|
359
|
-
extern ID
|
360
|
-
extern ID
|
361
|
-
extern ID
|
362
|
-
extern ID
|
363
|
-
extern ID
|
364
|
-
|
365
|
-
extern
|
366
|
-
extern
|
367
|
-
|
368
|
-
|
369
|
-
extern
|
239
|
+
uint8_t rtype;
|
240
|
+
uint8_t parent_type;
|
241
|
+
uint8_t value_type;
|
242
|
+
} * Leaf;
|
243
|
+
|
244
|
+
extern VALUE oj_saj_parse(int argc, VALUE *argv, VALUE self);
|
245
|
+
extern VALUE oj_sc_parse(int argc, VALUE *argv, VALUE self);
|
246
|
+
|
247
|
+
extern VALUE oj_strict_parse(int argc, VALUE *argv, VALUE self);
|
248
|
+
extern VALUE oj_strict_sparse(int argc, VALUE *argv, VALUE self);
|
249
|
+
extern VALUE oj_compat_parse(int argc, VALUE *argv, VALUE self);
|
250
|
+
extern VALUE oj_compat_load(int argc, VALUE *argv, VALUE self);
|
251
|
+
extern VALUE oj_object_parse(int argc, VALUE *argv, VALUE self);
|
252
|
+
extern VALUE oj_custom_parse(int argc, VALUE *argv, VALUE self);
|
253
|
+
extern VALUE oj_wab_parse(int argc, VALUE *argv, VALUE self);
|
254
|
+
|
255
|
+
extern VALUE oj_strict_parse_cstr(int argc, VALUE *argv, char *json, size_t len);
|
256
|
+
extern VALUE oj_compat_parse_cstr(int argc, VALUE *argv, char *json, size_t len);
|
257
|
+
extern VALUE oj_object_parse_cstr(int argc, VALUE *argv, char *json, size_t len);
|
258
|
+
extern VALUE oj_custom_parse_cstr(int argc, VALUE *argv, char *json, size_t len);
|
259
|
+
|
260
|
+
extern bool oj_hash_has_key(VALUE hash, VALUE key);
|
261
|
+
extern void oj_parse_options(VALUE ropts, Options copts);
|
262
|
+
|
263
|
+
extern void oj_dump_obj_to_json(VALUE obj, Options copts, Out out);
|
264
|
+
extern void
|
265
|
+
oj_dump_obj_to_json_using_params(VALUE obj, Options copts, Out out, int argc, VALUE *argv);
|
266
|
+
extern void oj_write_obj_to_file(VALUE obj, const char *path, Options copts);
|
267
|
+
extern void oj_write_obj_to_stream(VALUE obj, VALUE stream, Options copts);
|
268
|
+
extern void oj_dump_leaf_to_json(Leaf leaf, Options copts, Out out);
|
269
|
+
extern void oj_write_leaf_to_file(Leaf leaf, const char *path, Options copts);
|
270
|
+
|
271
|
+
extern void oj_str_writer_push_key(StrWriter sw, const char *key);
|
272
|
+
extern void oj_str_writer_push_object(StrWriter sw, const char *key);
|
273
|
+
extern void oj_str_writer_push_array(StrWriter sw, const char *key);
|
274
|
+
extern void oj_str_writer_push_value(StrWriter sw, VALUE val, const char *key);
|
275
|
+
extern void oj_str_writer_push_json(StrWriter sw, const char *json, const char *key);
|
276
|
+
extern void oj_str_writer_pop(StrWriter sw);
|
277
|
+
extern void oj_str_writer_pop_all(StrWriter sw);
|
278
|
+
|
279
|
+
extern void oj_init_doc(void);
|
280
|
+
extern void oj_string_writer_init(void);
|
281
|
+
extern void oj_stream_writer_init(void);
|
282
|
+
extern void oj_str_writer_init(StrWriter sw, int buf_size);
|
283
|
+
extern VALUE oj_define_mimic_json(int argc, VALUE *argv, VALUE self);
|
284
|
+
extern VALUE oj_mimic_generate(int argc, VALUE *argv, VALUE self);
|
285
|
+
extern VALUE oj_mimic_pretty_generate(int argc, VALUE *argv, VALUE self);
|
286
|
+
extern void oj_parse_mimic_dump_options(VALUE ropts, Options copts);
|
287
|
+
|
288
|
+
extern VALUE oj_mimic_parse(int argc, VALUE *argv, VALUE self);
|
289
|
+
extern VALUE oj_get_json_err_class(const char *err_classname);
|
290
|
+
extern void oj_parse_opt_match_string(RxClass rc, VALUE ropts);
|
291
|
+
|
292
|
+
extern VALUE oj_rails_encode(int argc, VALUE *argv, VALUE self);
|
293
|
+
|
294
|
+
extern VALUE Oj;
|
295
|
+
extern struct _options oj_default_options;
|
296
|
+
extern rb_encoding * oj_utf8_encoding;
|
297
|
+
extern int oj_utf8_encoding_index;
|
298
|
+
|
299
|
+
extern VALUE oj_bag_class;
|
300
|
+
extern VALUE oj_bigdecimal_class;
|
301
|
+
extern VALUE oj_cstack_class;
|
302
|
+
extern VALUE oj_date_class;
|
303
|
+
extern VALUE oj_datetime_class;
|
304
|
+
extern VALUE oj_doc_class;
|
305
|
+
extern VALUE oj_enumerable_class;
|
306
|
+
extern VALUE oj_json_generator_error_class;
|
307
|
+
extern VALUE oj_json_parser_error_class;
|
308
|
+
extern VALUE oj_stream_writer_class;
|
309
|
+
extern VALUE oj_string_writer_class;
|
310
|
+
extern VALUE oj_stringio_class;
|
311
|
+
extern VALUE oj_struct_class;
|
312
|
+
|
313
|
+
extern VALUE oj_allow_nan_sym;
|
314
|
+
extern VALUE oj_array_class_sym;
|
315
|
+
extern VALUE oj_array_nl_sym;
|
316
|
+
extern VALUE oj_ascii_only_sym;
|
317
|
+
extern VALUE oj_create_additions_sym;
|
318
|
+
extern VALUE oj_decimal_class_sym;
|
319
|
+
extern VALUE oj_hash_class_sym;
|
320
|
+
extern VALUE oj_indent_sym;
|
321
|
+
extern VALUE oj_max_nesting_sym;
|
322
|
+
extern VALUE oj_object_class_sym;
|
323
|
+
extern VALUE oj_object_nl_sym;
|
324
|
+
extern VALUE oj_quirks_mode_sym;
|
325
|
+
extern VALUE oj_space_before_sym;
|
326
|
+
extern VALUE oj_space_sym;
|
327
|
+
extern VALUE oj_symbolize_names_sym;
|
328
|
+
extern VALUE oj_trace_sym;
|
329
|
+
|
330
|
+
extern VALUE oj_slash_string;
|
331
|
+
|
332
|
+
extern ID oj_add_value_id;
|
333
|
+
extern ID oj_array_append_id;
|
334
|
+
extern ID oj_array_end_id;
|
335
|
+
extern ID oj_array_start_id;
|
336
|
+
extern ID oj_as_json_id;
|
337
|
+
extern ID oj_begin_id;
|
338
|
+
extern ID oj_bigdecimal_id;
|
339
|
+
extern ID oj_end_id;
|
340
|
+
extern ID oj_error_id;
|
341
|
+
extern ID oj_exclude_end_id;
|
342
|
+
extern ID oj_file_id;
|
343
|
+
extern ID oj_fileno_id;
|
344
|
+
extern ID oj_ftype_id;
|
345
|
+
extern ID oj_hash_end_id;
|
346
|
+
extern ID oj_hash_key_id;
|
347
|
+
extern ID oj_hash_set_id;
|
348
|
+
extern ID oj_hash_start_id;
|
349
|
+
extern ID oj_iconv_id;
|
350
|
+
extern ID oj_json_create_id;
|
351
|
+
extern ID oj_length_id;
|
352
|
+
extern ID oj_new_id;
|
353
|
+
extern ID oj_parse_id;
|
354
|
+
extern ID oj_pos_id;
|
355
|
+
extern ID oj_read_id;
|
356
|
+
extern ID oj_readpartial_id;
|
357
|
+
extern ID oj_replace_id;
|
358
|
+
extern ID oj_stat_id;
|
359
|
+
extern ID oj_string_id;
|
360
|
+
extern ID oj_raw_json_id;
|
361
|
+
extern ID oj_to_h_id;
|
362
|
+
extern ID oj_to_hash_id;
|
363
|
+
extern ID oj_to_json_id;
|
364
|
+
extern ID oj_to_s_id;
|
365
|
+
extern ID oj_to_sym_id;
|
366
|
+
extern ID oj_to_time_id;
|
367
|
+
extern ID oj_tv_nsec_id;
|
368
|
+
extern ID oj_tv_sec_id;
|
369
|
+
extern ID oj_tv_usec_id;
|
370
|
+
extern ID oj_utc_id;
|
371
|
+
extern ID oj_utc_offset_id;
|
372
|
+
extern ID oj_utcq_id;
|
373
|
+
extern ID oj_write_id;
|
374
|
+
|
375
|
+
extern bool oj_use_hash_alt;
|
376
|
+
extern bool oj_use_array_alt;
|
377
|
+
extern bool string_writer_optimized;
|
378
|
+
|
379
|
+
#define APPEND_CHARS(buffer, chars, size) \
|
380
|
+
{ \
|
381
|
+
memcpy(buffer, chars, size); \
|
382
|
+
buffer += size; \
|
383
|
+
}
|
384
|
+
|
385
|
+
#ifdef HAVE_PTHREAD_MUTEX_INIT
|
386
|
+
extern pthread_mutex_t oj_cache_mutex;
|
370
387
|
#else
|
371
|
-
extern VALUE
|
388
|
+
extern VALUE oj_cache_mutex;
|
372
389
|
#endif
|
373
390
|
|
374
|
-
#if defined(
|
391
|
+
#if defined(cplusplus)
|
375
392
|
#if 0
|
376
393
|
{ /* satisfy cc-mode */
|
377
394
|
#endif
|
378
|
-
}
|
395
|
+
} /* extern "C" { */
|
379
396
|
#endif
|
380
|
-
#endif /*
|
397
|
+
#endif /* OJ_H */
|