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