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