oj 3.9.1 → 3.16.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1452 -0
- data/README.md +21 -6
- data/RELEASE_NOTES.md +61 -0
- data/ext/oj/buf.h +50 -68
- data/ext/oj/cache.c +329 -0
- data/ext/oj/cache.h +22 -0
- data/ext/oj/cache8.c +60 -62
- data/ext/oj/cache8.h +9 -36
- data/ext/oj/circarray.c +38 -42
- data/ext/oj/circarray.h +12 -13
- data/ext/oj/code.c +158 -179
- data/ext/oj/code.h +20 -22
- data/ext/oj/compat.c +145 -205
- data/ext/oj/custom.c +740 -880
- data/ext/oj/debug.c +126 -0
- data/ext/oj/dump.c +1145 -844
- data/ext/oj/dump.h +71 -57
- data/ext/oj/dump_compat.c +575 -655
- data/ext/oj/dump_leaf.c +96 -186
- data/ext/oj/dump_object.c +533 -660
- data/ext/oj/dump_strict.c +306 -340
- data/ext/oj/encode.h +4 -33
- data/ext/oj/encoder.c +43 -0
- data/ext/oj/err.c +28 -28
- data/ext/oj/err.h +39 -42
- data/ext/oj/extconf.rb +28 -7
- data/ext/oj/fast.c +1052 -1113
- data/ext/oj/intern.c +313 -0
- data/ext/oj/intern.h +22 -0
- data/ext/oj/mem.c +318 -0
- data/ext/oj/mem.h +53 -0
- data/ext/oj/mimic_json.c +471 -430
- data/ext/oj/object.c +532 -580
- data/ext/oj/odd.c +156 -142
- data/ext/oj/odd.h +25 -26
- data/ext/oj/oj.c +1346 -961
- data/ext/oj/oj.h +307 -290
- data/ext/oj/parse.c +954 -858
- data/ext/oj/parse.h +74 -72
- data/ext/oj/parser.c +1600 -0
- data/ext/oj/parser.h +103 -0
- data/ext/oj/rails.c +819 -836
- data/ext/oj/rails.h +8 -11
- data/ext/oj/reader.c +136 -147
- data/ext/oj/reader.h +69 -83
- data/ext/oj/resolve.c +41 -63
- data/ext/oj/resolve.h +4 -6
- data/ext/oj/rxclass.c +69 -72
- data/ext/oj/rxclass.h +12 -13
- data/ext/oj/saj.c +440 -485
- data/ext/oj/saj2.c +584 -0
- data/ext/oj/saj2.h +23 -0
- data/ext/oj/scp.c +79 -118
- data/ext/oj/simd.h +10 -0
- data/ext/oj/sparse.c +739 -709
- data/ext/oj/stream_writer.c +141 -175
- data/ext/oj/strict.c +103 -128
- data/ext/oj/string_writer.c +244 -261
- data/ext/oj/trace.c +34 -41
- data/ext/oj/trace.h +42 -15
- data/ext/oj/usual.c +1218 -0
- data/ext/oj/usual.h +69 -0
- data/ext/oj/util.c +107 -107
- data/ext/oj/util.h +4 -3
- data/ext/oj/val_stack.c +61 -78
- data/ext/oj/val_stack.h +80 -114
- data/ext/oj/validate.c +46 -0
- data/ext/oj/wab.c +316 -361
- data/lib/oj/active_support_helper.rb +1 -3
- data/lib/oj/bag.rb +8 -1
- data/lib/oj/easy_hash.rb +9 -9
- data/lib/oj/error.rb +1 -2
- data/lib/oj/json.rb +162 -150
- data/lib/oj/mimic.rb +54 -20
- data/lib/oj/saj.rb +20 -6
- data/lib/oj/schandler.rb +5 -4
- data/lib/oj/state.rb +12 -8
- data/lib/oj/version.rb +1 -2
- data/lib/oj.rb +2 -8
- data/pages/Compatibility.md +1 -1
- data/pages/Encoding.md +1 -1
- data/pages/InstallOptions.md +20 -0
- data/pages/JsonGem.md +15 -0
- data/pages/Modes.md +9 -3
- data/pages/Options.md +62 -12
- data/pages/Parser.md +309 -0
- data/pages/Rails.md +73 -22
- metadata +68 -192
- data/ext/oj/hash.c +0 -163
- data/ext/oj/hash.h +0 -46
- data/ext/oj/hash_test.c +0 -512
- data/test/_test_active.rb +0 -76
- data/test/_test_active_mimic.rb +0 -96
- data/test/_test_mimic_rails.rb +0 -126
- data/test/activerecord/result_test.rb +0 -27
- data/test/activesupport4/decoding_test.rb +0 -108
- data/test/activesupport4/encoding_test.rb +0 -531
- data/test/activesupport4/test_helper.rb +0 -41
- data/test/activesupport5/decoding_test.rb +0 -125
- data/test/activesupport5/encoding_test.rb +0 -485
- data/test/activesupport5/encoding_test_cases.rb +0 -90
- data/test/activesupport5/test_helper.rb +0 -50
- data/test/activesupport5/time_zone_test_helpers.rb +0 -24
- data/test/bar.rb +0 -25
- data/test/files.rb +0 -29
- data/test/foo.rb +0 -21
- data/test/helper.rb +0 -26
- data/test/isolated/shared.rb +0 -308
- data/test/isolated/test_mimic_after.rb +0 -13
- data/test/isolated/test_mimic_alone.rb +0 -12
- data/test/isolated/test_mimic_as_json.rb +0 -45
- data/test/isolated/test_mimic_before.rb +0 -13
- data/test/isolated/test_mimic_define.rb +0 -28
- data/test/isolated/test_mimic_rails_after.rb +0 -22
- data/test/isolated/test_mimic_rails_before.rb +0 -21
- data/test/isolated/test_mimic_redefine.rb +0 -15
- data/test/json_gem/json_addition_test.rb +0 -216
- data/test/json_gem/json_common_interface_test.rb +0 -148
- data/test/json_gem/json_encoding_test.rb +0 -107
- data/test/json_gem/json_ext_parser_test.rb +0 -20
- data/test/json_gem/json_fixtures_test.rb +0 -35
- data/test/json_gem/json_generator_test.rb +0 -383
- data/test/json_gem/json_generic_object_test.rb +0 -90
- data/test/json_gem/json_parser_test.rb +0 -470
- data/test/json_gem/json_string_matching_test.rb +0 -42
- data/test/json_gem/test_helper.rb +0 -18
- data/test/perf.rb +0 -107
- data/test/perf_compat.rb +0 -130
- data/test/perf_fast.rb +0 -164
- data/test/perf_file.rb +0 -64
- data/test/perf_object.rb +0 -138
- data/test/perf_saj.rb +0 -109
- data/test/perf_scp.rb +0 -151
- data/test/perf_simple.rb +0 -287
- data/test/perf_strict.rb +0 -145
- data/test/perf_wab.rb +0 -131
- data/test/sample/change.rb +0 -14
- data/test/sample/dir.rb +0 -19
- data/test/sample/doc.rb +0 -36
- data/test/sample/file.rb +0 -48
- data/test/sample/group.rb +0 -16
- data/test/sample/hasprops.rb +0 -16
- data/test/sample/layer.rb +0 -12
- data/test/sample/line.rb +0 -20
- data/test/sample/oval.rb +0 -10
- data/test/sample/rect.rb +0 -10
- data/test/sample/shape.rb +0 -35
- data/test/sample/text.rb +0 -20
- data/test/sample.rb +0 -54
- data/test/sample_json.rb +0 -37
- data/test/test_compat.rb +0 -509
- data/test/test_custom.rb +0 -503
- data/test/test_debian.rb +0 -53
- data/test/test_fast.rb +0 -470
- data/test/test_file.rb +0 -239
- data/test/test_gc.rb +0 -49
- data/test/test_hash.rb +0 -29
- data/test/test_integer_range.rb +0 -73
- data/test/test_null.rb +0 -376
- data/test/test_object.rb +0 -1018
- data/test/test_saj.rb +0 -186
- data/test/test_scp.rb +0 -433
- data/test/test_strict.rb +0 -410
- data/test/test_various.rb +0 -741
- data/test/test_wab.rb +0 -307
- data/test/test_writer.rb +0 -380
- data/test/tests.rb +0 -24
- data/test/tests_mimic.rb +0 -14
- data/test/tests_mimic_addition.rb +0 -7
- data/test/zoo.rb +0 -13
data/ext/oj/resolve.c
CHANGED
@@ -1,102 +1,80 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2012 Peter Ohler. All rights reserved.
|
2
|
+
// Licensed under the MIT License. See LICENSE file in the project root for license details.
|
5
3
|
|
6
|
-
#include <stdlib.h>
|
7
4
|
#include <stdio.h>
|
5
|
+
#include <stdlib.h>
|
8
6
|
#include <string.h>
|
9
7
|
#ifdef HAVE_PTHREAD_MUTEX_INIT
|
10
8
|
#include <pthread.h>
|
11
9
|
#endif
|
12
10
|
|
13
|
-
#include "oj.h"
|
14
11
|
#include "err.h"
|
12
|
+
#include "intern.h"
|
13
|
+
#include "oj.h"
|
15
14
|
#include "parse.h"
|
16
|
-
#include "hash.h"
|
17
15
|
|
18
|
-
inline static VALUE
|
19
|
-
|
20
|
-
|
21
|
-
ID ci = rb_intern(classname);
|
16
|
+
inline static VALUE resolve_classname(VALUE mod, const char *classname, int auto_define) {
|
17
|
+
VALUE clas;
|
18
|
+
ID ci = rb_intern(classname);
|
22
19
|
|
23
20
|
if (rb_const_defined_at(mod, ci)) {
|
24
|
-
|
21
|
+
clas = rb_const_get_at(mod, ci);
|
25
22
|
} else if (auto_define) {
|
26
|
-
|
23
|
+
clas = rb_define_class_under(mod, classname, oj_bag_class);
|
27
24
|
} else {
|
28
|
-
|
25
|
+
clas = Qundef;
|
29
26
|
}
|
30
27
|
return clas;
|
31
28
|
}
|
32
29
|
|
33
|
-
static VALUE
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
char
|
38
|
-
char
|
39
|
-
const char *n = name;
|
30
|
+
static VALUE resolve_classpath(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class) {
|
31
|
+
char class_name[1024];
|
32
|
+
VALUE clas;
|
33
|
+
char *end = class_name + sizeof(class_name) - 1;
|
34
|
+
char *s;
|
35
|
+
const char *n = name;
|
40
36
|
|
41
37
|
clas = rb_cObject;
|
42
38
|
for (s = class_name; 0 < len; n++, len--) {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
39
|
+
if (':' == *n) {
|
40
|
+
*s = '\0';
|
41
|
+
n++;
|
42
|
+
len--;
|
43
|
+
if (':' != *n) {
|
44
|
+
return Qundef;
|
45
|
+
}
|
46
|
+
if (Qundef == (clas = resolve_classname(clas, class_name, auto_define))) {
|
47
|
+
return Qundef;
|
48
|
+
}
|
49
|
+
s = class_name;
|
50
|
+
} else if (end <= s) {
|
51
|
+
return Qundef;
|
52
|
+
} else {
|
53
|
+
*s++ = *n;
|
54
|
+
}
|
59
55
|
}
|
60
56
|
*s = '\0';
|
61
57
|
if (Qundef == (clas = resolve_classname(clas, class_name, auto_define))) {
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
oj_set_error_at(pi, error_class, __FILE__, __LINE__, "class %s is not defined", name);
|
59
|
+
if (Qnil != error_class) {
|
60
|
+
pi->err_class = error_class;
|
61
|
+
}
|
66
62
|
}
|
67
63
|
return clas;
|
68
64
|
}
|
69
65
|
|
70
66
|
VALUE
|
71
67
|
oj_name2class(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class) {
|
72
|
-
VALUE clas;
|
73
|
-
VALUE *slot;
|
74
|
-
|
75
68
|
if (No == pi->options.class_cache) {
|
76
|
-
|
69
|
+
return resolve_classpath(pi, name, len, auto_define, error_class);
|
77
70
|
}
|
78
|
-
|
79
|
-
pthread_mutex_lock(&oj_cache_mutex);
|
80
|
-
#else
|
81
|
-
rb_mutex_lock(oj_cache_mutex);
|
82
|
-
#endif
|
83
|
-
if (Qnil == (clas = oj_class_hash_get(name, len, &slot))) {
|
84
|
-
if (Qundef != (clas = resolve_classpath(pi, name, len, auto_define, error_class))) {
|
85
|
-
*slot = clas;
|
86
|
-
}
|
87
|
-
}
|
88
|
-
#ifdef HAVE_PTHREAD_MUTEX_INIT
|
89
|
-
pthread_mutex_unlock(&oj_cache_mutex);
|
90
|
-
#else
|
91
|
-
rb_mutex_unlock(oj_cache_mutex);
|
92
|
-
#endif
|
93
|
-
return clas;
|
71
|
+
return oj_class_intern(name, len, true, pi, auto_define, error_class);
|
94
72
|
}
|
95
73
|
|
96
74
|
VALUE
|
97
75
|
oj_name2struct(ParseInfo pi, VALUE nameVal, VALUE error_class) {
|
98
|
-
size_t
|
99
|
-
const char
|
76
|
+
size_t len = RSTRING_LEN(nameVal);
|
77
|
+
const char *str = StringValuePtr(nameVal);
|
100
78
|
|
101
79
|
return resolve_classpath(pi, str, len, 0, error_class);
|
102
80
|
}
|
data/ext/oj/resolve.h
CHANGED
@@ -1,14 +1,12 @@
|
|
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_RESOLVE_H
|
7
5
|
#define OJ_RESOLVE_H
|
8
6
|
|
9
7
|
#include "ruby.h"
|
10
8
|
|
11
|
-
extern VALUE
|
12
|
-
extern VALUE
|
9
|
+
extern VALUE oj_name2class(ParseInfo pi, const char *name, size_t len, int auto_define, VALUE error_class);
|
10
|
+
extern VALUE oj_name2struct(ParseInfo pi, VALUE nameVal, VALUE error_class);
|
13
11
|
|
14
12
|
#endif /* OJ_RESOLVE_H */
|
data/ext/oj/rxclass.c
CHANGED
@@ -1,79 +1,77 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2017 Peter Ohler. All rights reserved.
|
2
|
+
// Licensed under the MIT License. See LICENSE file in the project root for license details.
|
5
3
|
|
6
|
-
#include <sys/types.h>
|
7
|
-
#include <stdlib.h>
|
8
4
|
#include <errno.h>
|
9
|
-
#include <string.h>
|
10
5
|
#include <stdio.h>
|
6
|
+
#include <stdlib.h>
|
7
|
+
#include <string.h>
|
8
|
+
#include <sys/types.h>
|
11
9
|
#if !IS_WINDOWS
|
12
10
|
#include <regex.h>
|
13
11
|
#endif
|
14
12
|
|
13
|
+
#include "mem.h"
|
15
14
|
#include "rxclass.h"
|
16
15
|
|
17
16
|
typedef struct _rxC {
|
18
|
-
struct _rxC
|
19
|
-
VALUE
|
17
|
+
struct _rxC *next;
|
18
|
+
VALUE rrx;
|
20
19
|
#if !IS_WINDOWS
|
21
|
-
regex_t
|
20
|
+
regex_t rx;
|
22
21
|
#endif
|
23
|
-
VALUE
|
24
|
-
char
|
22
|
+
VALUE clas;
|
23
|
+
char src[256];
|
25
24
|
} *RxC;
|
26
25
|
|
27
|
-
void
|
28
|
-
oj_rxclass_init(RxClass rc) {
|
26
|
+
void oj_rxclass_init(RxClass rc) {
|
29
27
|
*rc->err = '\0';
|
30
28
|
rc->head = NULL;
|
31
29
|
rc->tail = NULL;
|
32
30
|
}
|
33
31
|
|
34
|
-
void
|
35
|
-
|
36
|
-
RxC rxc;
|
32
|
+
void oj_rxclass_cleanup(RxClass rc) {
|
33
|
+
RxC rxc;
|
37
34
|
|
38
35
|
while (NULL != (rxc = rc->head)) {
|
39
|
-
|
36
|
+
rc->head = rc->head->next;
|
40
37
|
#if !IS_WINDOWS
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
if (Qnil == rxc->rrx) {
|
39
|
+
regfree(&rxc->rx);
|
40
|
+
}
|
41
|
+
OJ_R_FREE(rxc);
|
45
42
|
#endif
|
46
43
|
}
|
47
44
|
}
|
48
45
|
|
49
|
-
void
|
50
|
-
|
51
|
-
RxC rxc = ALLOC_N(struct _rxC, 1);
|
46
|
+
void oj_rxclass_rappend(RxClass rc, VALUE rx, VALUE clas) {
|
47
|
+
RxC rxc = OJ_R_ALLOC_N(struct _rxC, 1);
|
52
48
|
|
53
49
|
memset(rxc, 0, sizeof(struct _rxC));
|
54
|
-
rxc->rrx
|
50
|
+
rxc->rrx = rx;
|
55
51
|
rxc->clas = clas;
|
56
52
|
if (NULL == rc->tail) {
|
57
|
-
|
53
|
+
rc->head = rxc;
|
58
54
|
} else {
|
59
|
-
|
55
|
+
rc->tail->next = rxc;
|
60
56
|
}
|
61
57
|
rc->tail = rxc;
|
62
58
|
}
|
63
59
|
|
64
60
|
// Attempt to compile the expression. If it fails populate the error code..
|
65
|
-
int
|
66
|
-
|
67
|
-
RxC rxc;
|
61
|
+
int oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
|
62
|
+
RxC rxc;
|
68
63
|
#if !IS_WINDOWS
|
69
|
-
int
|
70
|
-
int
|
64
|
+
int err;
|
65
|
+
int flags = 0;
|
71
66
|
#endif
|
72
67
|
if (sizeof(rxc->src) <= strlen(expr)) {
|
73
|
-
|
74
|
-
|
68
|
+
snprintf(rc->err,
|
69
|
+
sizeof(rc->err),
|
70
|
+
"expressions must be less than %lu characters",
|
71
|
+
(unsigned long)sizeof(rxc->src));
|
72
|
+
return EINVAL;
|
75
73
|
}
|
76
|
-
rxc
|
74
|
+
rxc = OJ_R_ALLOC_N(struct _rxC, 1);
|
77
75
|
rxc->next = 0;
|
78
76
|
rxc->clas = clas;
|
79
77
|
|
@@ -82,15 +80,15 @@ oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
|
|
82
80
|
#else
|
83
81
|
rxc->rrx = Qnil;
|
84
82
|
if (0 != (err = regcomp(&rxc->rx, expr, flags))) {
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
regerror(err, &rxc->rx, rc->err, sizeof(rc->err));
|
84
|
+
OJ_FREE(rxc);
|
85
|
+
return err;
|
88
86
|
}
|
89
87
|
#endif
|
90
88
|
if (NULL == rc->tail) {
|
91
|
-
|
89
|
+
rc->head = rxc;
|
92
90
|
} else {
|
93
|
-
|
91
|
+
rc->tail->next = rxc;
|
94
92
|
}
|
95
93
|
rc->tail = rxc;
|
96
94
|
|
@@ -99,49 +97,48 @@ oj_rxclass_append(RxClass rc, const char *expr, VALUE clas) {
|
|
99
97
|
|
100
98
|
VALUE
|
101
99
|
oj_rxclass_match(RxClass rc, const char *str, int len) {
|
102
|
-
RxC
|
103
|
-
char
|
104
|
-
|
100
|
+
RxC rxc;
|
101
|
+
char buf[4096];
|
102
|
+
|
105
103
|
for (rxc = rc->head; NULL != rxc; rxc = rxc->next) {
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
104
|
+
if (Qnil != rxc->rrx) {
|
105
|
+
// Must use a valiabel for this to work.
|
106
|
+
volatile VALUE rstr = rb_str_new(str, len);
|
107
|
+
|
108
|
+
// if (Qtrue == rb_funcall(rxc->rrx, rb_intern("match?"), 1, rstr)) {
|
109
|
+
if (Qnil != rb_funcall(rxc->rrx, rb_intern("match"), 1, rstr)) {
|
110
|
+
return rxc->clas;
|
111
|
+
}
|
112
|
+
} else if (len < (int)sizeof(buf)) {
|
115
113
|
#if !IS_WINDOWS
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
114
|
+
// string is not \0 terminated so copy and attempt a match
|
115
|
+
memcpy(buf, str, len);
|
116
|
+
buf[len] = '\0';
|
117
|
+
if (0 == regexec(&rxc->rx, buf, 0, NULL, 0)) { // match
|
118
|
+
return rxc->clas;
|
119
|
+
}
|
122
120
|
#endif
|
123
|
-
|
124
|
-
|
125
|
-
|
121
|
+
} else {
|
122
|
+
// TBD allocate a larger buffer and attempt
|
123
|
+
}
|
126
124
|
}
|
127
125
|
return Qnil;
|
128
126
|
}
|
129
127
|
|
130
|
-
void
|
131
|
-
oj_rxclass_copy(RxClass src, RxClass dest) {
|
128
|
+
void oj_rxclass_copy(RxClass src, RxClass dest) {
|
132
129
|
dest->head = NULL;
|
133
130
|
dest->tail = NULL;
|
134
131
|
if (NULL != src->head) {
|
135
|
-
|
132
|
+
RxC rxc;
|
136
133
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
134
|
+
for (rxc = src->head; NULL != rxc; rxc = rxc->next) {
|
135
|
+
if (Qnil != rxc->rrx) {
|
136
|
+
oj_rxclass_rappend(dest, rxc->rrx, rxc->clas);
|
137
|
+
} else {
|
141
138
|
#if !IS_WINDOWS
|
142
|
-
|
139
|
+
oj_rxclass_append(dest, rxc->src, rxc->clas);
|
143
140
|
#endif
|
144
|
-
|
145
|
-
|
141
|
+
}
|
142
|
+
}
|
146
143
|
}
|
147
144
|
}
|
data/ext/oj/rxclass.h
CHANGED
@@ -1,27 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* All rights reserved.
|
4
|
-
*/
|
1
|
+
// Copyright (c) 2017 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_RXCLASS_H
|
7
5
|
#define OJ_RXCLASS_H
|
8
6
|
|
9
7
|
#include <stdbool.h>
|
8
|
+
|
10
9
|
#include "ruby.h"
|
11
10
|
|
12
11
|
struct _rxC;
|
13
12
|
|
14
13
|
typedef struct _rxClass {
|
15
|
-
struct _rxC
|
16
|
-
struct _rxC
|
17
|
-
char
|
14
|
+
struct _rxC *head;
|
15
|
+
struct _rxC *tail;
|
16
|
+
char err[128];
|
18
17
|
} *RxClass;
|
19
18
|
|
20
|
-
extern void
|
21
|
-
extern void
|
22
|
-
extern int
|
23
|
-
extern VALUE
|
24
|
-
extern void
|
25
|
-
extern void
|
19
|
+
extern void oj_rxclass_init(RxClass rc);
|
20
|
+
extern void oj_rxclass_cleanup(RxClass rc);
|
21
|
+
extern int oj_rxclass_append(RxClass rc, const char *expr, VALUE clas);
|
22
|
+
extern VALUE oj_rxclass_match(RxClass rc, const char *str, int len);
|
23
|
+
extern void oj_rxclass_copy(RxClass src, RxClass dest);
|
24
|
+
extern void oj_rxclass_rappend(RxClass rc, VALUE rx, VALUE clas);
|
26
25
|
|
27
26
|
#endif /* OJ_RXCLASS_H */
|