oj 3.13.0 → 3.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/oj/custom.c +1 -1
- data/ext/oj/dump.c +1 -4
- data/ext/oj/dump_object.c +2 -2
- data/ext/oj/fast.c +6 -17
- data/ext/oj/parser.c +3 -19
- data/ext/oj/rails.c +1 -1
- data/ext/oj/usual.c +2 -2
- data/lib/oj/version.rb +1 -1
- data/test/json_gem/json_common_interface_test.rb +1 -1
- metadata +2 -3
- data/ext/oj/hash_test.c +0 -464
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a72c9edbd99e2e73392b5f0f5d19bee2e00187e7b999822c5c9a9086c25cc8a3
|
4
|
+
data.tar.gz: 7be23afd3d15f172d845ab1f852a134fe2c9d3700a197fc14ba75dd7423a4a59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6d92e4bff747161aa6da5619d5ece4faad452d7fd737f4c973e52808641973cbc6d56c684395f99947f222bcfc4797524d93e4f35ef55748770a32ba73d9c44
|
7
|
+
data.tar.gz: 9780a00f4baef37702a0ddda2e9b8c56475c69286295fdaafad6643e70825cfe8f8a69bb3dfb74791e5cc9685b6bacccb48ec23dfc250c698a19dadea19c9b71
|
data/ext/oj/custom.c
CHANGED
@@ -833,7 +833,7 @@ static void dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
|
|
833
833
|
v = rb_struct_aref(obj, INT2FIX(i));
|
834
834
|
#endif
|
835
835
|
if (ma != Qnil) {
|
836
|
-
volatile VALUE s =
|
836
|
+
volatile VALUE s = rb_sym2str(rb_ary_entry(ma, i));
|
837
837
|
|
838
838
|
name = RSTRING_PTR(s);
|
839
839
|
len = (int)RSTRING_LEN(s);
|
data/ext/oj/dump.c
CHANGED
@@ -717,10 +717,7 @@ void oj_dump_str(VALUE obj, int depth, Out out, bool as_ok) {
|
|
717
717
|
}
|
718
718
|
|
719
719
|
void oj_dump_sym(VALUE obj, int depth, Out out, bool as_ok) {
|
720
|
-
|
721
|
-
// const char *sym = rb_id2name(SYM2ID(obj));
|
722
|
-
|
723
|
-
volatile VALUE s = rb_sym_to_s(obj);
|
720
|
+
volatile VALUE s = rb_sym2str(obj);
|
724
721
|
|
725
722
|
oj_dump_cstr(RSTRING_PTR(s), (int)RSTRING_LEN(s), 0, 0, out);
|
726
723
|
}
|
data/ext/oj/dump_object.c
CHANGED
@@ -208,7 +208,7 @@ static void dump_str(VALUE obj, int depth, Out out, bool as_ok) {
|
|
208
208
|
}
|
209
209
|
|
210
210
|
static void dump_sym(VALUE obj, int depth, Out out, bool as_ok) {
|
211
|
-
volatile VALUE s =
|
211
|
+
volatile VALUE s = rb_sym2str(obj);
|
212
212
|
|
213
213
|
oj_dump_cstr(RSTRING_PTR(s), (int)RSTRING_LEN(s), 1, 0, out);
|
214
214
|
}
|
@@ -694,7 +694,7 @@ static void dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
|
|
694
694
|
|
695
695
|
*out->cur++ = '[';
|
696
696
|
for (i = 0; i < cnt; i++) {
|
697
|
-
volatile VALUE s =
|
697
|
+
volatile VALUE s = rb_sym2str(rb_ary_entry(ma, i));
|
698
698
|
|
699
699
|
name = RSTRING_PTR(s);
|
700
700
|
len = (int)RSTRING_LEN(s);
|
data/ext/oj/fast.c
CHANGED
@@ -200,9 +200,7 @@ static VALUE leaf_value(Doc doc, Leaf leaf) {
|
|
200
200
|
break;
|
201
201
|
case T_ARRAY: return leaf_array_value(doc, leaf); break;
|
202
202
|
case T_HASH: return leaf_hash_value(doc, leaf); break;
|
203
|
-
default:
|
204
|
-
rb_raise(rb_const_get_at(Oj, rb_intern("Error")), "Unexpected type %02x.", leaf->rtype);
|
205
|
-
break;
|
203
|
+
default: rb_raise(rb_const_get_at(Oj, rb_intern("Error")), "Unexpected type %02x.", leaf->rtype); break;
|
206
204
|
}
|
207
205
|
}
|
208
206
|
return leaf->value;
|
@@ -773,7 +771,7 @@ static VALUE parse_json(VALUE clas, char *json, bool given, bool allocated) {
|
|
773
771
|
pi.doc = doc;
|
774
772
|
#if IS_WINDOWS
|
775
773
|
// assume a 1M stack and give half to ruby
|
776
|
-
pi.stack_min = (void
|
774
|
+
pi.stack_min = (void*)((char*)&pi - (512 * 1024));
|
777
775
|
#else
|
778
776
|
{
|
779
777
|
struct rlimit lim;
|
@@ -825,9 +823,7 @@ static Leaf get_doc_leaf(Doc doc, const char *path) {
|
|
825
823
|
size_t cnt = doc->where - doc->where_path;
|
826
824
|
|
827
825
|
if (MAX_STACK <= cnt) {
|
828
|
-
rb_raise(rb_const_get_at(Oj, rb_intern("DepthError")),
|
829
|
-
"Path too deep. Limit is %d levels.",
|
830
|
-
MAX_STACK);
|
826
|
+
rb_raise(rb_const_get_at(Oj, rb_intern("DepthError")), "Path too deep. Limit is %d levels.", MAX_STACK);
|
831
827
|
}
|
832
828
|
memcpy(stack, doc->where_path, sizeof(Leaf) * (cnt + 1));
|
833
829
|
lp = stack + cnt;
|
@@ -868,9 +864,7 @@ static Leaf get_leaf(Leaf *stack, Leaf *lp, const char *path) {
|
|
868
864
|
Leaf leaf = *lp;
|
869
865
|
|
870
866
|
if (MAX_STACK <= lp - stack) {
|
871
|
-
rb_raise(rb_const_get_at(Oj, rb_intern("DepthError")),
|
872
|
-
"Path too deep. Limit is %d levels.",
|
873
|
-
MAX_STACK);
|
867
|
+
rb_raise(rb_const_get_at(Oj, rb_intern("DepthError")), "Path too deep. Limit is %d levels.", MAX_STACK);
|
874
868
|
}
|
875
869
|
if ('\0' != *path) {
|
876
870
|
if ('.' == *path && '.' == *(path + 1)) {
|
@@ -946,9 +940,7 @@ static void each_leaf(Doc doc, VALUE self) {
|
|
946
940
|
|
947
941
|
doc->where++;
|
948
942
|
if (MAX_STACK <= doc->where - doc->where_path) {
|
949
|
-
rb_raise(rb_const_get_at(Oj, rb_intern("DepthError")),
|
950
|
-
"Path too deep. Limit is %d levels.",
|
951
|
-
MAX_STACK);
|
943
|
+
rb_raise(rb_const_get_at(Oj, rb_intern("DepthError")), "Path too deep. Limit is %d levels.", MAX_STACK);
|
952
944
|
}
|
953
945
|
do {
|
954
946
|
*doc->where = e;
|
@@ -964,9 +956,7 @@ static void each_leaf(Doc doc, VALUE self) {
|
|
964
956
|
|
965
957
|
static int move_step(Doc doc, const char *path, int loc) {
|
966
958
|
if (MAX_STACK <= doc->where - doc->where_path) {
|
967
|
-
rb_raise(rb_const_get_at(Oj, rb_intern("DepthError")),
|
968
|
-
"Path too deep. Limit is %d levels.",
|
969
|
-
MAX_STACK);
|
959
|
+
rb_raise(rb_const_get_at(Oj, rb_intern("DepthError")), "Path too deep. Limit is %d levels.", MAX_STACK);
|
970
960
|
}
|
971
961
|
if ('\0' == *path) {
|
972
962
|
loc = 0;
|
@@ -1264,7 +1254,6 @@ static VALUE doc_path(VALUE self) {
|
|
1264
1254
|
return doc_where(self);
|
1265
1255
|
}
|
1266
1256
|
|
1267
|
-
|
1268
1257
|
/* @overload local_key() => String, Fixnum, nil
|
1269
1258
|
*
|
1270
1259
|
* Returns the final key to the current location.
|
data/ext/oj/parser.c
CHANGED
@@ -1,24 +1,8 @@
|
|
1
1
|
// Copyright (c) 2020, 2021, Peter Ohler, All rights reserved.
|
2
2
|
|
3
|
-
#include "parser.h"
|
4
|
-
|
5
|
-
#include <errno.h>
|
6
3
|
#include <fcntl.h>
|
7
|
-
#include <limits.h>
|
8
|
-
#include <math.h>
|
9
|
-
#include <pthread.h>
|
10
|
-
#include <signal.h>
|
11
|
-
#include <stdarg.h>
|
12
|
-
#include <stdbool.h>
|
13
|
-
#include <stdint.h>
|
14
|
-
#include <stdio.h>
|
15
|
-
#include <stdlib.h>
|
16
|
-
#include <string.h>
|
17
|
-
#include <sys/stat.h>
|
18
|
-
#include <sys/time.h>
|
19
|
-
#include <time.h>
|
20
|
-
#include <unistd.h>
|
21
4
|
|
5
|
+
#include "parser.h"
|
22
6
|
#include "oj.h"
|
23
7
|
|
24
8
|
#define DEBUG 0
|
@@ -1217,7 +1201,7 @@ static VALUE parser_new(VALUE self, VALUE mode) {
|
|
1217
1201
|
|
1218
1202
|
switch (rb_type(mode)) {
|
1219
1203
|
case RUBY_T_SYMBOL:
|
1220
|
-
mode =
|
1204
|
+
mode = rb_sym2str(mode);
|
1221
1205
|
// fall through
|
1222
1206
|
case RUBY_T_STRING: ms = RSTRING_PTR(mode); break;
|
1223
1207
|
default:
|
@@ -1290,7 +1274,7 @@ static VALUE parser_missing(int argc, VALUE *argv, VALUE self) {
|
|
1290
1274
|
#endif
|
1291
1275
|
switch (rb_type(rkey)) {
|
1292
1276
|
case RUBY_T_SYMBOL:
|
1293
|
-
rkey =
|
1277
|
+
rkey = rb_sym2str(rkey);
|
1294
1278
|
// fall through
|
1295
1279
|
case RUBY_T_STRING: key = rb_string_value_ptr(&rkey); break;
|
1296
1280
|
default: rb_raise(rb_eArgError, "option method must be a symbol or string");
|
data/ext/oj/rails.c
CHANGED
@@ -157,7 +157,7 @@ static void dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
|
|
157
157
|
assure_size(out, 2);
|
158
158
|
*out->cur++ = '{';
|
159
159
|
for (i = 0; i < cnt; i++) {
|
160
|
-
volatile VALUE s =
|
160
|
+
volatile VALUE s = rb_sym2str(rb_ary_entry(ma, i));
|
161
161
|
|
162
162
|
name = RSTRING_PTR(s);
|
163
163
|
len = (int)RSTRING_LEN(s);
|
data/ext/oj/usual.c
CHANGED
@@ -903,7 +903,7 @@ static VALUE opt_decimal_set(ojParser p, VALUE value) {
|
|
903
903
|
switch (rb_type(value)) {
|
904
904
|
case T_STRING: mode = RSTRING_PTR(value); break;
|
905
905
|
case T_SYMBOL:
|
906
|
-
s =
|
906
|
+
s = rb_sym2str(value);
|
907
907
|
mode = RSTRING_PTR(s);
|
908
908
|
break;
|
909
909
|
default:
|
@@ -1020,7 +1020,7 @@ static VALUE opt_missing_class_set(ojParser p, VALUE value) {
|
|
1020
1020
|
switch (rb_type(value)) {
|
1021
1021
|
case T_STRING: mode = RSTRING_PTR(value); break;
|
1022
1022
|
case T_SYMBOL:
|
1023
|
-
s =
|
1023
|
+
s = rb_sym2str(value);
|
1024
1024
|
mode = RSTRING_PTR(s);
|
1025
1025
|
break;
|
1026
1026
|
default:
|
data/lib/oj/version.rb
CHANGED
@@ -23,7 +23,7 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase
|
|
23
23
|
'h' => 1000.0,
|
24
24
|
'i' => 0.001
|
25
25
|
}
|
26
|
-
# Tired of chasing floating point rounding and precision. Oj
|
26
|
+
# Tired of chasing floating point rounding and precision. Oj now uses the
|
27
27
|
# Ruby float parser in compat mode yet on i386 machines there are issues
|
28
28
|
# with this test when the float is included.
|
29
29
|
#@json = '{"a":2,"b":5.23683071,"c":"c","d":[1,"b",3.14],"e":{"foo":"bar"},'\
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.13.
|
4
|
+
version: 3.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -116,7 +116,6 @@ files:
|
|
116
116
|
- ext/oj/err.h
|
117
117
|
- ext/oj/extconf.rb
|
118
118
|
- ext/oj/fast.c
|
119
|
-
- ext/oj/hash_test.c
|
120
119
|
- ext/oj/intern.c
|
121
120
|
- ext/oj/intern.h
|
122
121
|
- ext/oj/mimic_json.c
|
data/ext/oj/hash_test.c
DELETED
@@ -1,464 +0,0 @@
|
|
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.
|
3
|
-
|
4
|
-
// if windows, comment out the whole file. It's only a performance test.
|
5
|
-
#ifndef _WIN32
|
6
|
-
#include "intern.h"
|
7
|
-
|
8
|
-
#include <stdint.h>
|
9
|
-
#include <sys/time.h>
|
10
|
-
#include <time.h>
|
11
|
-
|
12
|
-
/* Define printf formats for standard types, like PRIu64 for uint64_t. */
|
13
|
-
#define __STDC_FORMAT_MACROS
|
14
|
-
#include <inttypes.h>
|
15
|
-
|
16
|
-
typedef struct _strLen {
|
17
|
-
const char *str;
|
18
|
-
size_t len;
|
19
|
-
} * StrLen;
|
20
|
-
|
21
|
-
static struct _strLen data[] = {{"Gem::Version", 12},
|
22
|
-
{"TracePoint", 10},
|
23
|
-
{"Complex::compatible", 19},
|
24
|
-
{"Complex", 7},
|
25
|
-
{"Rational::compatible", 20},
|
26
|
-
{"Rational", 8},
|
27
|
-
{"FiberError", 10},
|
28
|
-
{"Fiber", 5},
|
29
|
-
{"ThreadError", 11},
|
30
|
-
{"Mutex", 5},
|
31
|
-
{"ThreadGroup", 11},
|
32
|
-
{"RubyVM::InstructionSequence", 27},
|
33
|
-
{"Thread::Backtrace::Location", 27},
|
34
|
-
{"Thread::Backtrace", 17},
|
35
|
-
{"Thread", 6},
|
36
|
-
{"RubyVM::Env", 11},
|
37
|
-
{"RubyVM", 6},
|
38
|
-
{"Enumerator::Yielder", 19},
|
39
|
-
{"Enumerator::Generator", 21},
|
40
|
-
{"StopIteration", 13},
|
41
|
-
{"Enumerator::Lazy", 16},
|
42
|
-
{"Enumerator", 10},
|
43
|
-
{"ObjectSpace::WeakMap", 20},
|
44
|
-
{"Math::DomainError", 17},
|
45
|
-
{"Binding", 7},
|
46
|
-
{"UnboundMethod", 13},
|
47
|
-
{"Method", 6},
|
48
|
-
{"SystemStackError", 16},
|
49
|
-
{"LocalJumpError", 14},
|
50
|
-
{"Proc", 4},
|
51
|
-
{"Struct::Tms", 11},
|
52
|
-
{"Process::Status", 15},
|
53
|
-
{"Random", 6},
|
54
|
-
{"Time", 4},
|
55
|
-
{"Dir", 3},
|
56
|
-
{"File::Stat", 10},
|
57
|
-
{"File", 4},
|
58
|
-
{"ARGF.class", 10},
|
59
|
-
{"IO", 2},
|
60
|
-
{"EOFError", 8},
|
61
|
-
{"IOError", 7},
|
62
|
-
{"Range", 5},
|
63
|
-
{"Encoding::Converter", 19},
|
64
|
-
{"Encoding::ConverterNotFoundError", 32},
|
65
|
-
{"Encoding::InvalidByteSequenceError", 34},
|
66
|
-
{"Encoding::UndefinedConversionError", 34},
|
67
|
-
{"MatchData", 9},
|
68
|
-
{"Regexp", 6},
|
69
|
-
{"RegexpError", 11},
|
70
|
-
{"Struct", 6},
|
71
|
-
{"Hash", 4},
|
72
|
-
{"Array", 5},
|
73
|
-
{"Errno::ERPCMISMATCH", 19},
|
74
|
-
{"Errno::EPROGUNAVAIL", 19},
|
75
|
-
{"Errno::EPROGMISMATCH", 20},
|
76
|
-
{"Errno::EPROCUNAVAIL", 19},
|
77
|
-
{"Errno::EPROCLIM", 15},
|
78
|
-
{"Errno::ENOTSUP", 14},
|
79
|
-
{"Errno::ENOATTR", 14},
|
80
|
-
{"Errno::ENEEDAUTH", 16},
|
81
|
-
{"Errno::EFTYPE", 13},
|
82
|
-
{"Errno::EBADRPC", 14},
|
83
|
-
{"Errno::EAUTH", 12},
|
84
|
-
{"Errno::EOWNERDEAD", 17},
|
85
|
-
{"Errno::ENOTRECOVERABLE", 22},
|
86
|
-
{"Errno::ECANCELED", 16},
|
87
|
-
{"Errno::EDQUOT", 13},
|
88
|
-
{"Errno::ESTALE", 13},
|
89
|
-
{"Errno::EINPROGRESS", 18},
|
90
|
-
{"Errno::EALREADY", 15},
|
91
|
-
{"Errno::EHOSTUNREACH", 19},
|
92
|
-
{"Errno::EHOSTDOWN", 16},
|
93
|
-
{"Errno::ECONNREFUSED", 19},
|
94
|
-
{"Errno::ETIMEDOUT", 16},
|
95
|
-
{"Errno::ETOOMANYREFS", 19},
|
96
|
-
{"Errno::ESHUTDOWN", 16},
|
97
|
-
{"Errno::ENOTCONN", 15},
|
98
|
-
{"Errno::EISCONN", 14},
|
99
|
-
{"Errno::ENOBUFS", 14},
|
100
|
-
{"Errno::ECONNRESET", 17},
|
101
|
-
{"Errno::ECONNABORTED", 19},
|
102
|
-
{"Errno::ENETRESET", 16},
|
103
|
-
{"Errno::ENETUNREACH", 18},
|
104
|
-
{"Errno::ENETDOWN", 15},
|
105
|
-
{"Errno::EADDRNOTAVAIL", 20},
|
106
|
-
{"Errno::EADDRINUSE", 17},
|
107
|
-
{"Errno::EAFNOSUPPORT", 19},
|
108
|
-
{"Errno::EPFNOSUPPORT", 19},
|
109
|
-
{"Errno::EOPNOTSUPP", 17},
|
110
|
-
{"Errno::ESOCKTNOSUPPORT", 22},
|
111
|
-
{"Errno::EPROTONOSUPPORT", 22},
|
112
|
-
{"Errno::ENOPROTOOPT", 18},
|
113
|
-
{"Errno::EPROTOTYPE", 17},
|
114
|
-
{"Errno::EMSGSIZE", 15},
|
115
|
-
{"Errno::EDESTADDRREQ", 19},
|
116
|
-
{"Errno::ENOTSOCK", 15},
|
117
|
-
{"Errno::EUSERS", 13},
|
118
|
-
{"Errno::EILSEQ", 13},
|
119
|
-
{"Errno::EOVERFLOW", 16},
|
120
|
-
{"Errno::EBADMSG", 14},
|
121
|
-
{"Errno::EMULTIHOP", 16},
|
122
|
-
{"Errno::EPROTO", 13},
|
123
|
-
{"Errno::ENOLINK", 14},
|
124
|
-
{"Errno::EREMOTE", 14},
|
125
|
-
{"Errno::ENOSR", 12},
|
126
|
-
{"Errno::ETIME", 12},
|
127
|
-
{"Errno::ENODATA", 14},
|
128
|
-
{"Errno::ENOSTR", 13},
|
129
|
-
{"Errno::EIDRM", 12},
|
130
|
-
{"Errno::ENOMSG", 13},
|
131
|
-
{"Errno::ELOOP", 12},
|
132
|
-
{"Errno::ENOTEMPTY", 16},
|
133
|
-
{"Errno::ENOSYS", 13},
|
134
|
-
{"Errno::ENOLCK", 13},
|
135
|
-
{"Errno::ENAMETOOLONG", 19},
|
136
|
-
{"Errno::EDEADLK", 14},
|
137
|
-
{"Errno::ERANGE", 13},
|
138
|
-
{"Errno::EDOM", 11},
|
139
|
-
{"Errno::EPIPE", 12},
|
140
|
-
{"Errno::EMLINK", 13},
|
141
|
-
{"Errno::EROFS", 12},
|
142
|
-
{"Errno::ESPIPE", 13},
|
143
|
-
{"Errno::ENOSPC", 13},
|
144
|
-
{"Errno::EFBIG", 12},
|
145
|
-
{"Errno::ETXTBSY", 14},
|
146
|
-
{"Errno::ENOTTY", 13},
|
147
|
-
{"Errno::EMFILE", 13},
|
148
|
-
{"Errno::ENFILE", 13},
|
149
|
-
{"Errno::EINVAL", 13},
|
150
|
-
{"Errno::EISDIR", 13},
|
151
|
-
{"Errno::ENOTDIR", 14},
|
152
|
-
{"Errno::ENODEV", 13},
|
153
|
-
{"Errno::EXDEV", 12},
|
154
|
-
{"Errno::EEXIST", 13},
|
155
|
-
{"Errno::EBUSY", 12},
|
156
|
-
{"Errno::ENOTBLK", 14},
|
157
|
-
{"Errno::EFAULT", 13},
|
158
|
-
{"Errno::EACCES", 13},
|
159
|
-
{"Errno::ENOMEM", 13},
|
160
|
-
{"Errno::EAGAIN", 13},
|
161
|
-
{"Errno::ECHILD", 13},
|
162
|
-
{"Errno::EBADF", 12},
|
163
|
-
{"Errno::ENOEXEC", 14},
|
164
|
-
{"Errno::E2BIG", 12},
|
165
|
-
{"Errno::ENXIO", 12},
|
166
|
-
{"Errno::EIO", 10},
|
167
|
-
{"Errno::EINTR", 12},
|
168
|
-
{"Errno::ESRCH", 12},
|
169
|
-
{"Errno::ENOENT", 13},
|
170
|
-
{"Errno::EPERM", 12},
|
171
|
-
{"Errno::NOERROR", 14},
|
172
|
-
{"Bignum", 6},
|
173
|
-
{"Float", 5},
|
174
|
-
{"Fixnum", 6},
|
175
|
-
{"Integer", 7},
|
176
|
-
{"Numeric", 7},
|
177
|
-
{"FloatDomainError", 16},
|
178
|
-
{"ZeroDivisionError", 17},
|
179
|
-
{"SystemCallError", 15},
|
180
|
-
{"Encoding::CompatibilityError", 28},
|
181
|
-
{"EncodingError", 13},
|
182
|
-
{"NoMemoryError", 13},
|
183
|
-
{"SecurityError", 13},
|
184
|
-
{"RuntimeError", 12},
|
185
|
-
{"NoMethodError", 13},
|
186
|
-
{"NameError::message", 18},
|
187
|
-
{"NameError", 9},
|
188
|
-
{"NotImplementedError", 19},
|
189
|
-
{"LoadError", 9},
|
190
|
-
{"SyntaxError", 11},
|
191
|
-
{"ScriptError", 11},
|
192
|
-
{"RangeError", 10},
|
193
|
-
{"KeyError", 8},
|
194
|
-
{"IndexError", 10},
|
195
|
-
{"ArgumentError", 13},
|
196
|
-
{"TypeError", 9},
|
197
|
-
{"StandardError", 13},
|
198
|
-
{"Interrupt", 9},
|
199
|
-
{"SignalException", 15},
|
200
|
-
{"SystemExit", 10},
|
201
|
-
{"Exception", 9},
|
202
|
-
{"Symbol", 6},
|
203
|
-
{"String", 6},
|
204
|
-
{"Encoding", 8},
|
205
|
-
{"FalseClass", 10},
|
206
|
-
{"TrueClass", 9},
|
207
|
-
{"Data", 4},
|
208
|
-
{"NilClass", 8},
|
209
|
-
{"Class", 5},
|
210
|
-
{"Module", 6},
|
211
|
-
{"Object", 6},
|
212
|
-
{"BasicObject", 11},
|
213
|
-
{"Gem::Requirement::BadRequirementError", 37},
|
214
|
-
{"Gem::Requirement", 16},
|
215
|
-
{"Gem::SourceFetchProblem", 23},
|
216
|
-
{"Gem::PlatformMismatch", 21},
|
217
|
-
{"Gem::ErrorReason", 16},
|
218
|
-
{"Gem::LoadError", 14},
|
219
|
-
{"Gem::RemoteSourceException", 26},
|
220
|
-
{"Gem::RemoteInstallationSkipped", 30},
|
221
|
-
{"Gem::RemoteInstallationCancelled", 32},
|
222
|
-
{"Gem::RemoteError", 16},
|
223
|
-
{"Gem::OperationNotSupportedError", 31},
|
224
|
-
{"Gem::InvalidSpecificationException", 34},
|
225
|
-
{"Gem::InstallError", 17},
|
226
|
-
{"Gem::Specification", 18},
|
227
|
-
{"Date", 4},
|
228
|
-
{"Gem::Platform", 13},
|
229
|
-
{"Gem::SpecificGemNotFoundException", 33},
|
230
|
-
{"Gem::GemNotFoundException", 25},
|
231
|
-
{"Gem::FormatException", 20},
|
232
|
-
{"Gem::FilePermissionError", 24},
|
233
|
-
{"Gem::EndOfYAMLException", 23},
|
234
|
-
{"Gem::DocumentError", 18},
|
235
|
-
{"Gem::GemNotInHomeException", 26},
|
236
|
-
{"Gem::DependencyRemovalException", 31},
|
237
|
-
{"Gem::DependencyError", 20},
|
238
|
-
{"Gem::CommandLineError", 21},
|
239
|
-
{"Gem::Exception", 14},
|
240
|
-
{"IRB::SLex", 9},
|
241
|
-
{"IRB::Notifier::NoMsgNotifier", 28},
|
242
|
-
{"IRB::Notifier::LeveledNotifier", 30},
|
243
|
-
{"IRB::Notifier::CompositeNotifier", 32},
|
244
|
-
{"IRB::Notifier::AbstractNotifier", 31},
|
245
|
-
{"IRB::Notifier::ErrUnrecognizedLevel", 35},
|
246
|
-
{"IRB::Notifier::ErrUndefinedNotifier", 35},
|
247
|
-
{"IRB::StdioOutputMethod", 22},
|
248
|
-
{"IRB::OutputMethod::NotImplementedError", 38},
|
249
|
-
{"IRB::OutputMethod", 17},
|
250
|
-
{"IRB::IllegalRCGenerator", 23},
|
251
|
-
{"IRB::UndefinedPromptMode", 24},
|
252
|
-
{"IRB::CantChangeBinding", 22},
|
253
|
-
{"IRB::CantShiftToMultiIrbMode", 28},
|
254
|
-
{"IRB::NoSuchJob", 14},
|
255
|
-
{"IRB::IrbSwitchedToCurrentThread", 31},
|
256
|
-
{"IRB::IrbAlreadyDead", 19},
|
257
|
-
{"IRB::IllegalParameter", 21},
|
258
|
-
{"IRB::CantReturnToNormalMode", 27},
|
259
|
-
{"IRB::NotImplementedError", 24},
|
260
|
-
{"IRB::UnrecognizedSwitch", 23},
|
261
|
-
{"IRB::Irb", 8},
|
262
|
-
{"IRB::Abort", 10},
|
263
|
-
{"IRB::Locale", 11},
|
264
|
-
{"IRB::SLex::ErrNodeNothing", 25},
|
265
|
-
{"IRB::SLex::ErrNodeAlreadyExists", 31},
|
266
|
-
{"RubyLex", 7},
|
267
|
-
{"IRB::SLex::Node", 15},
|
268
|
-
{"Gem::SystemExitException", 24},
|
269
|
-
{"Gem::VerificationError", 22},
|
270
|
-
{"RubyToken::TkError", 18},
|
271
|
-
{"RubyToken::TkUnknownChar", 24},
|
272
|
-
{"RubyToken::TkOPASGN", 19},
|
273
|
-
{"RubyToken::TkOp", 15},
|
274
|
-
{"RubyToken::TkVal", 16},
|
275
|
-
{"RubyToken::TkId", 15},
|
276
|
-
{"RubyToken::TkNode", 17},
|
277
|
-
{"RubyToken::Token", 16},
|
278
|
-
{"RubyToken::TkUNDEF", 18},
|
279
|
-
{"RubyToken::TkDEF", 16},
|
280
|
-
{"RubyToken::TkMODULE", 19},
|
281
|
-
{"RubyToken::TkCLASS", 18},
|
282
|
-
{"RubyToken::TkWHILE", 18},
|
283
|
-
{"RubyToken::TkWHEN", 17},
|
284
|
-
{"RubyToken::TkCASE", 17},
|
285
|
-
{"RubyToken::TkELSE", 17},
|
286
|
-
{"RubyToken::TkELSIF", 18},
|
287
|
-
{"RubyToken::TkTHEN", 17},
|
288
|
-
{"RubyToken::TkUNLESS", 19},
|
289
|
-
{"RubyToken::TkIF", 15},
|
290
|
-
{"RubyToken::TkEND", 16},
|
291
|
-
{"RubyToken::TkENSURE", 19},
|
292
|
-
{"RubyToken::TkRESCUE", 19},
|
293
|
-
{"RubyToken::TkBEGIN", 18},
|
294
|
-
{"RubyToken::TkDO", 15},
|
295
|
-
{"RubyToken::TkIN", 15},
|
296
|
-
{"RubyToken::TkRETRY", 18},
|
297
|
-
{"RubyToken::TkREDO", 17},
|
298
|
-
{"RubyToken::TkNEXT", 17},
|
299
|
-
{"RubyToken::TkBREAK", 18},
|
300
|
-
{"RubyToken::TkFOR", 16},
|
301
|
-
{"RubyToken::TkUNTIL", 18},
|
302
|
-
{"RubyToken::TkTRUE", 17},
|
303
|
-
{"RubyToken::TkNIL", 16},
|
304
|
-
{"RubyToken::TkSELF", 17},
|
305
|
-
{"RubyToken::TkSUPER", 18},
|
306
|
-
{"RubyToken::TkYIELD", 18},
|
307
|
-
{"RubyToken::TkRETURN", 19},
|
308
|
-
{"RubyToken::TkAND", 16},
|
309
|
-
{"RubyToken::TkFALSE", 18},
|
310
|
-
{"RubyToken::TkUNLESS_MOD", 23},
|
311
|
-
{"RubyToken::TkIF_MOD", 19},
|
312
|
-
{"RubyToken::TkNOT", 16},
|
313
|
-
{"RubyToken::TkOR", 15},
|
314
|
-
{"RubyToken::TkALIAS", 18},
|
315
|
-
{"RubyToken::TkUNTIL_MOD", 22},
|
316
|
-
{"RubyToken::TkWHILE_MOD", 22},
|
317
|
-
{"RubyToken::TkGVAR", 17},
|
318
|
-
{"RubyToken::TkFID", 16},
|
319
|
-
{"RubyToken::TkIDENTIFIER", 23},
|
320
|
-
{"RubyToken::Tk__FILE__", 21},
|
321
|
-
{"RubyToken::Tk__LINE__", 21},
|
322
|
-
{"RubyToken::TklEND", 17},
|
323
|
-
{"RubyToken::TklBEGIN", 19},
|
324
|
-
{"RubyToken::TkDEFINED", 20},
|
325
|
-
{"RubyToken::TkDREGEXP", 20},
|
326
|
-
{"RubyToken::TkDXSTRING", 21},
|
327
|
-
{"RubyToken::TkDSTRING", 20},
|
328
|
-
{"RubyToken::TkSYMBOL", 19},
|
329
|
-
{"RubyToken::TkREGEXP", 19},
|
330
|
-
{"RubyToken::TkXSTRING", 20},
|
331
|
-
{"RubyToken::TkSTRING", 19},
|
332
|
-
{"RubyToken::TkFLOAT", 18},
|
333
|
-
{"RubyToken::TkINTEGER", 20},
|
334
|
-
{"RubyToken::TkCONSTANT", 21},
|
335
|
-
{"RubyToken::TkIVAR", 17},
|
336
|
-
{"RubyToken::TkCVAR", 17},
|
337
|
-
{"RubyToken::TkNEQ", 16},
|
338
|
-
{"RubyToken::TkEQQ", 16},
|
339
|
-
{"RubyToken::TkEQ", 15},
|
340
|
-
{"RubyToken::TkCMP", 16},
|
341
|
-
{"RubyToken::TkPOW", 16},
|
342
|
-
{"RubyToken::TkUMINUS", 19},
|
343
|
-
{"RubyToken::TkUPLUS", 18},
|
344
|
-
{"Exception2MessageMapper::ErrNotRegisteredException", 50},
|
345
|
-
{"RubyToken::TkBACK_REF", 21},
|
346
|
-
{"RubyToken::TkNTH_REF", 20},
|
347
|
-
{"RubyToken::TkLSHFT", 18},
|
348
|
-
{"RubyToken::TkASET", 17},
|
349
|
-
{"RubyToken::TkAREF", 17},
|
350
|
-
{"RubyToken::TkDOT3", 17},
|
351
|
-
{"RubyToken::TkDOT2", 17},
|
352
|
-
{"RubyToken::TkNMATCH", 19},
|
353
|
-
{"RubyToken::TkMATCH", 18},
|
354
|
-
{"RubyToken::TkOROP", 17},
|
355
|
-
{"RubyToken::TkANDOP", 18},
|
356
|
-
{"RubyToken::TkLEQ", 16},
|
357
|
-
{"RubyToken::TkGEQ", 16},
|
358
|
-
{"RubyToken::TkAMPER", 18},
|
359
|
-
{"RubyToken::TkSTAR", 17},
|
360
|
-
{"RubyToken::TkfLBRACE", 20},
|
361
|
-
{"RubyToken::TkfLBRACK", 20},
|
362
|
-
{"RubyToken::TkfLPAREN", 20},
|
363
|
-
{"RubyToken::TkCOLON", 18},
|
364
|
-
{"RubyToken::TkQUESTION", 21},
|
365
|
-
{"RubyToken::TkASSOC", 18},
|
366
|
-
{"RubyToken::TkCOLON3", 19},
|
367
|
-
{"RubyToken::TkCOLON2", 19},
|
368
|
-
{"RubyToken::TkRSHFT", 18},
|
369
|
-
{"RubyToken::TkBITAND", 19},
|
370
|
-
{"RubyToken::TkBITXOR", 19},
|
371
|
-
{"RubyToken::TkBITOR", 18},
|
372
|
-
{"RubyToken::TkMOD", 16},
|
373
|
-
{"RubyToken::TkDIV", 16},
|
374
|
-
{"RubyToken::TkMULT", 17},
|
375
|
-
{"RubyToken::TkMINUS", 18},
|
376
|
-
{"RubyToken::TkPLUS", 17},
|
377
|
-
{"RubyToken::TkLT", 15},
|
378
|
-
{"RubyToken::TkGT", 15},
|
379
|
-
{"RubyToken::TkSYMBEG", 19},
|
380
|
-
{"IRB::DefaultEncodings", 21},
|
381
|
-
{"RubyToken::TkRPAREN", 19},
|
382
|
-
{"RubyToken::TkLBRACE", 19},
|
383
|
-
{"RubyToken::TkLBRACK", 19},
|
384
|
-
{"RubyToken::TkLPAREN", 19},
|
385
|
-
{"RubyToken::TkDOT", 16},
|
386
|
-
{"RubyToken::TkASSIGN", 19},
|
387
|
-
{"RubyToken::TkBACKQUOTE", 22},
|
388
|
-
{"RubyToken::TkNOTOP", 18},
|
389
|
-
{"RubyToken::TkBITNOT", 19},
|
390
|
-
{"RubyToken::TkDOLLAR", 19},
|
391
|
-
{"RubyToken::TkAT", 15},
|
392
|
-
{"RubyToken::TkBACKSLASH", 22},
|
393
|
-
{"RubyToken::TkEND_OF_SCRIPT", 26},
|
394
|
-
{"RubyToken::TkNL", 15},
|
395
|
-
{"RubyToken::TkSPACE", 18},
|
396
|
-
{"RubyToken::TkRD_COMMENT", 23},
|
397
|
-
{"RubyToken::TkCOMMENT", 20},
|
398
|
-
{"RubyToken::TkSEMICOLON", 22},
|
399
|
-
{"RubyToken::TkCOMMA", 18},
|
400
|
-
{"RubyToken::TkRBRACE", 19},
|
401
|
-
{"RubyToken::TkRBRACK", 19},
|
402
|
-
{"RubyLex::TerminateLineInput", 27},
|
403
|
-
{"RubyLex::SyntaxError", 20},
|
404
|
-
{"RubyLex::TkReading2TokenDuplicateError", 38},
|
405
|
-
{"RubyLex::TkSymbol2TokenNoKey", 28},
|
406
|
-
{"RubyLex::TkReading2TokenNoKey", 29},
|
407
|
-
{"RubyLex::AlreadyDefinedToken", 28},
|
408
|
-
{"IRB::FileInputMethod", 20},
|
409
|
-
{"IRB::StdioInputMethod", 21},
|
410
|
-
{"IRB::InputMethod", 16},
|
411
|
-
{"IRB::ReadlineInputMethod", 24},
|
412
|
-
{"IRB::Context", 12},
|
413
|
-
{"IRB::Inspector", 14},
|
414
|
-
{"IRB::WorkSpace", 14},
|
415
|
-
{0, 0}};
|
416
|
-
|
417
|
-
static uint64_t micro_time() {
|
418
|
-
struct timeval tv;
|
419
|
-
|
420
|
-
gettimeofday(&tv, NULL);
|
421
|
-
|
422
|
-
return (uint64_t)tv.tv_sec * 1000000ULL + (uint64_t)tv.tv_usec;
|
423
|
-
}
|
424
|
-
|
425
|
-
static void perf() {
|
426
|
-
StrLen d;
|
427
|
-
uint64_t dt, start;
|
428
|
-
int i, iter = 1000000;
|
429
|
-
int dataCnt = sizeof(data) / sizeof(*data);
|
430
|
-
|
431
|
-
oj_hash_init();
|
432
|
-
start = micro_time();
|
433
|
-
for (i = iter; 0 < i; i--) {
|
434
|
-
for (d = data; 0 != d->str; d++) {
|
435
|
-
oj_class_intern(d->str, d->len, false, NULL, false, Qnil);
|
436
|
-
}
|
437
|
-
}
|
438
|
-
dt = micro_time() - start;
|
439
|
-
#if IS_WINDOWS
|
440
|
-
printf("%d iterations took %ld msecs, %ld gets/msec\n",
|
441
|
-
iter,
|
442
|
-
(long)(dt / 1000),
|
443
|
-
(long)(iter * dataCnt / (dt / 1000)));
|
444
|
-
#else
|
445
|
-
printf("%d iterations took %" PRIu64 " msecs, %ld gets/msec\n",
|
446
|
-
iter,
|
447
|
-
dt / 1000,
|
448
|
-
(long)(iter * dataCnt / (dt / 1000)));
|
449
|
-
#endif
|
450
|
-
}
|
451
|
-
|
452
|
-
void oj_hash_test() {
|
453
|
-
StrLen d;
|
454
|
-
|
455
|
-
oj_hash_init();
|
456
|
-
for (d = data; 0 != d->str; d++) {
|
457
|
-
oj_class_intern(d->str, d->len, false, NULL, false, Qnil);
|
458
|
-
/*oj_hash_print(c);*/
|
459
|
-
}
|
460
|
-
printf("*** ---------- hash table ------------\n");
|
461
|
-
oj_hash_print();
|
462
|
-
perf();
|
463
|
-
}
|
464
|
-
#endif
|