oj 3.11.3 → 3.11.4

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