oj 3.7.4 → 3.13.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1352 -0
- data/README.md +29 -8
- data/RELEASE_NOTES.md +61 -0
- data/ext/oj/buf.h +53 -72
- data/ext/oj/cache.c +326 -0
- data/ext/oj/cache.h +21 -0
- data/ext/oj/cache8.c +61 -64
- data/ext/oj/cache8.h +12 -39
- data/ext/oj/circarray.c +37 -43
- data/ext/oj/circarray.h +16 -17
- data/ext/oj/code.c +165 -179
- data/ext/oj/code.h +27 -29
- data/ext/oj/compat.c +174 -194
- data/ext/oj/custom.c +809 -866
- data/ext/oj/debug.c +132 -0
- data/ext/oj/dump.c +848 -863
- data/ext/oj/dump.h +81 -67
- data/ext/oj/dump_compat.c +85 -123
- data/ext/oj/dump_leaf.c +100 -188
- data/ext/oj/dump_object.c +527 -656
- data/ext/oj/dump_strict.c +315 -338
- data/ext/oj/encode.h +7 -34
- data/ext/oj/encoder.c +43 -0
- data/ext/oj/err.c +40 -29
- data/ext/oj/err.h +48 -48
- data/ext/oj/extconf.rb +17 -4
- data/ext/oj/fast.c +1070 -1087
- data/ext/oj/intern.c +301 -0
- data/ext/oj/intern.h +26 -0
- data/ext/oj/mimic_json.c +469 -436
- data/ext/oj/object.c +525 -593
- data/ext/oj/odd.c +154 -138
- data/ext/oj/odd.h +37 -38
- data/ext/oj/oj.c +1325 -986
- data/ext/oj/oj.h +333 -316
- data/ext/oj/parse.c +1002 -846
- data/ext/oj/parse.h +92 -87
- data/ext/oj/parser.c +1557 -0
- data/ext/oj/parser.h +91 -0
- data/ext/oj/rails.c +888 -878
- data/ext/oj/rails.h +11 -14
- data/ext/oj/reader.c +141 -147
- data/ext/oj/reader.h +73 -89
- data/ext/oj/resolve.c +41 -62
- data/ext/oj/resolve.h +7 -9
- data/ext/oj/rxclass.c +71 -75
- data/ext/oj/rxclass.h +18 -19
- data/ext/oj/saj.c +443 -486
- data/ext/oj/saj2.c +602 -0
- data/ext/oj/scp.c +88 -113
- data/ext/oj/sparse.c +787 -709
- data/ext/oj/stream_writer.c +133 -159
- data/ext/oj/strict.c +127 -118
- data/ext/oj/string_writer.c +230 -249
- data/ext/oj/trace.c +34 -41
- data/ext/oj/trace.h +19 -19
- data/ext/oj/usual.c +1254 -0
- data/ext/oj/util.c +136 -0
- data/ext/oj/util.h +20 -0
- data/ext/oj/val_stack.c +59 -67
- data/ext/oj/val_stack.h +91 -129
- data/ext/oj/validate.c +46 -0
- data/ext/oj/wab.c +342 -353
- data/lib/oj/bag.rb +1 -0
- data/lib/oj/easy_hash.rb +5 -4
- data/lib/oj/error.rb +1 -1
- data/lib/oj/json.rb +1 -1
- data/lib/oj/mimic.rb +48 -14
- data/lib/oj/saj.rb +20 -6
- data/lib/oj/state.rb +8 -7
- data/lib/oj/version.rb +2 -2
- data/lib/oj.rb +0 -8
- data/pages/Compatibility.md +1 -1
- data/pages/JsonGem.md +15 -0
- data/pages/Modes.md +53 -46
- data/pages/Options.md +72 -11
- data/pages/Parser.md +309 -0
- data/pages/Rails.md +73 -22
- data/pages/Security.md +1 -1
- data/test/activerecord/result_test.rb +7 -2
- data/test/activesupport5/abstract_unit.rb +45 -0
- data/test/activesupport5/decoding_test.rb +68 -60
- data/test/activesupport5/encoding_test.rb +111 -96
- data/test/activesupport5/encoding_test_cases.rb +33 -25
- data/test/activesupport5/test_helper.rb +43 -21
- data/test/activesupport5/time_zone_test_helpers.rb +18 -3
- data/test/activesupport6/abstract_unit.rb +44 -0
- data/test/activesupport6/decoding_test.rb +133 -0
- data/test/activesupport6/encoding_test.rb +507 -0
- data/test/activesupport6/encoding_test_cases.rb +98 -0
- data/test/activesupport6/test_common.rb +17 -0
- data/test/activesupport6/test_helper.rb +163 -0
- data/test/activesupport6/time_zone_test_helpers.rb +39 -0
- data/test/activesupport7/abstract_unit.rb +49 -0
- data/test/activesupport7/decoding_test.rb +125 -0
- data/test/activesupport7/encoding_test.rb +486 -0
- data/test/activesupport7/encoding_test_cases.rb +104 -0
- data/test/activesupport7/time_zone_test_helpers.rb +47 -0
- data/test/bar.rb +6 -12
- data/test/baz.rb +16 -0
- data/test/bug.rb +16 -0
- data/test/foo.rb +69 -75
- data/test/helper.rb +16 -0
- data/test/json_gem/json_common_interface_test.rb +8 -3
- data/test/json_gem/json_generator_test.rb +18 -4
- data/test/json_gem/json_parser_test.rb +9 -0
- data/test/json_gem/test_helper.rb +12 -0
- data/test/mem.rb +33 -0
- data/test/perf.rb +1 -1
- data/test/perf_dump.rb +50 -0
- data/test/perf_once.rb +58 -0
- data/test/perf_parser.rb +189 -0
- 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 +46 -10
- data/test/test_custom.rb +147 -8
- data/test/test_fast.rb +62 -2
- data/test/test_file.rb +25 -2
- data/test/test_gc.rb +13 -0
- data/test/test_generate.rb +21 -0
- data/test/test_hash.rb +11 -1
- data/test/test_integer_range.rb +7 -2
- data/test/test_object.rb +85 -9
- data/test/test_parser.rb +27 -0
- data/test/test_parser_saj.rb +335 -0
- data/test/test_parser_usual.rb +217 -0
- data/test/test_rails.rb +35 -0
- data/test/test_saj.rb +1 -1
- data/test/test_scp.rb +5 -5
- data/test/test_strict.rb +26 -1
- data/test/test_various.rb +87 -65
- data/test/test_wab.rb +2 -0
- data/test/test_writer.rb +19 -2
- data/test/tests.rb +1 -1
- data/test/zoo.rb +13 -0
- metadata +60 -110
- data/ext/oj/hash.c +0 -163
- data/ext/oj/hash.h +0 -46
- data/ext/oj/hash_test.c +0 -512
data/ext/oj/hash_test.c
DELETED
@@ -1,512 +0,0 @@
|
|
1
|
-
/* hash_test.c
|
2
|
-
* Copyright (c) 2011, Peter Ohler
|
3
|
-
* All rights reserved.
|
4
|
-
*
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
6
|
-
* modification, are permitted provided that the following conditions are met:
|
7
|
-
*
|
8
|
-
* - Redistributions of source code must retain the above copyright notice, this
|
9
|
-
* list of conditions and the following disclaimer.
|
10
|
-
*
|
11
|
-
* - Redistributions in binary form must reproduce the above copyright notice,
|
12
|
-
* this list of conditions and the following disclaimer in the documentation
|
13
|
-
* and/or other materials provided with the distribution.
|
14
|
-
*
|
15
|
-
* - Neither the name of Peter Ohler nor the names of its contributors may be
|
16
|
-
* used to endorse or promote products derived from this software without
|
17
|
-
* specific prior written permission.
|
18
|
-
*
|
19
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
22
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
23
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
25
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
26
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
27
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
-
*/
|
30
|
-
|
31
|
-
// if windows, comment out the whole file. It's only a performance test.
|
32
|
-
#ifndef _WIN32
|
33
|
-
#include <sys/time.h>
|
34
|
-
#include <time.h>
|
35
|
-
#include "hash.h"
|
36
|
-
#include <stdint.h>
|
37
|
-
|
38
|
-
/* Define printf formats for standard types, like PRIu64 for uint64_t. */
|
39
|
-
#define __STDC_FORMAT_MACROS
|
40
|
-
#include <inttypes.h>
|
41
|
-
|
42
|
-
typedef struct _StrLen {
|
43
|
-
const char *str;
|
44
|
-
size_t len;
|
45
|
-
} *StrLen;
|
46
|
-
|
47
|
-
static struct _StrLen data[] = {
|
48
|
-
{ "Gem::Version", 12 },
|
49
|
-
{ "TracePoint", 10 },
|
50
|
-
{ "Complex::compatible", 19 },
|
51
|
-
{ "Complex", 7 },
|
52
|
-
{ "Rational::compatible", 20 },
|
53
|
-
{ "Rational", 8 },
|
54
|
-
{ "FiberError", 10 },
|
55
|
-
{ "Fiber", 5 },
|
56
|
-
{ "ThreadError", 11 },
|
57
|
-
{ "Mutex", 5 },
|
58
|
-
{ "ThreadGroup", 11 },
|
59
|
-
{ "RubyVM::InstructionSequence", 27 },
|
60
|
-
{ "Thread::Backtrace::Location", 27 },
|
61
|
-
{ "Thread::Backtrace", 17 },
|
62
|
-
{ "Thread", 6 },
|
63
|
-
{ "RubyVM::Env", 11 },
|
64
|
-
{ "RubyVM", 6 },
|
65
|
-
{ "Enumerator::Yielder", 19 },
|
66
|
-
{ "Enumerator::Generator", 21 },
|
67
|
-
{ "StopIteration", 13 },
|
68
|
-
{ "Enumerator::Lazy", 16 },
|
69
|
-
{ "Enumerator", 10 },
|
70
|
-
{ "ObjectSpace::WeakMap", 20 },
|
71
|
-
{ "Math::DomainError", 17 },
|
72
|
-
{ "Binding", 7 },
|
73
|
-
{ "UnboundMethod", 13 },
|
74
|
-
{ "Method", 6 },
|
75
|
-
{ "SystemStackError", 16 },
|
76
|
-
{ "LocalJumpError", 14 },
|
77
|
-
{ "Proc", 4 },
|
78
|
-
{ "Struct::Tms", 11 },
|
79
|
-
{ "Process::Status", 15 },
|
80
|
-
{ "Random", 6 },
|
81
|
-
{ "Time", 4 },
|
82
|
-
{ "Dir", 3 },
|
83
|
-
{ "File::Stat", 10 },
|
84
|
-
{ "File", 4 },
|
85
|
-
{ "ARGF.class", 10 },
|
86
|
-
{ "IO", 2 },
|
87
|
-
{ "EOFError", 8 },
|
88
|
-
{ "IOError", 7 },
|
89
|
-
{ "Range", 5 },
|
90
|
-
{ "Encoding::Converter", 19 },
|
91
|
-
{ "Encoding::ConverterNotFoundError", 32 },
|
92
|
-
{ "Encoding::InvalidByteSequenceError", 34 },
|
93
|
-
{ "Encoding::UndefinedConversionError", 34 },
|
94
|
-
{ "MatchData", 9 },
|
95
|
-
{ "Regexp", 6 },
|
96
|
-
{ "RegexpError", 11 },
|
97
|
-
{ "Struct", 6 },
|
98
|
-
{ "Hash", 4 },
|
99
|
-
{ "Array", 5 },
|
100
|
-
{ "Errno::ERPCMISMATCH", 19 },
|
101
|
-
{ "Errno::EPROGUNAVAIL", 19 },
|
102
|
-
{ "Errno::EPROGMISMATCH", 20 },
|
103
|
-
{ "Errno::EPROCUNAVAIL", 19 },
|
104
|
-
{ "Errno::EPROCLIM", 15 },
|
105
|
-
{ "Errno::ENOTSUP", 14 },
|
106
|
-
{ "Errno::ENOATTR", 14 },
|
107
|
-
{ "Errno::ENEEDAUTH", 16 },
|
108
|
-
{ "Errno::EFTYPE", 13 },
|
109
|
-
{ "Errno::EBADRPC", 14 },
|
110
|
-
{ "Errno::EAUTH", 12 },
|
111
|
-
{ "Errno::EOWNERDEAD", 17 },
|
112
|
-
{ "Errno::ENOTRECOVERABLE", 22 },
|
113
|
-
{ "Errno::ECANCELED", 16 },
|
114
|
-
{ "Errno::EDQUOT", 13 },
|
115
|
-
{ "Errno::ESTALE", 13 },
|
116
|
-
{ "Errno::EINPROGRESS", 18 },
|
117
|
-
{ "Errno::EALREADY", 15 },
|
118
|
-
{ "Errno::EHOSTUNREACH", 19 },
|
119
|
-
{ "Errno::EHOSTDOWN", 16 },
|
120
|
-
{ "Errno::ECONNREFUSED", 19 },
|
121
|
-
{ "Errno::ETIMEDOUT", 16 },
|
122
|
-
{ "Errno::ETOOMANYREFS", 19 },
|
123
|
-
{ "Errno::ESHUTDOWN", 16 },
|
124
|
-
{ "Errno::ENOTCONN", 15 },
|
125
|
-
{ "Errno::EISCONN", 14 },
|
126
|
-
{ "Errno::ENOBUFS", 14 },
|
127
|
-
{ "Errno::ECONNRESET", 17 },
|
128
|
-
{ "Errno::ECONNABORTED", 19 },
|
129
|
-
{ "Errno::ENETRESET", 16 },
|
130
|
-
{ "Errno::ENETUNREACH", 18 },
|
131
|
-
{ "Errno::ENETDOWN", 15 },
|
132
|
-
{ "Errno::EADDRNOTAVAIL", 20 },
|
133
|
-
{ "Errno::EADDRINUSE", 17 },
|
134
|
-
{ "Errno::EAFNOSUPPORT", 19 },
|
135
|
-
{ "Errno::EPFNOSUPPORT", 19 },
|
136
|
-
{ "Errno::EOPNOTSUPP", 17 },
|
137
|
-
{ "Errno::ESOCKTNOSUPPORT", 22 },
|
138
|
-
{ "Errno::EPROTONOSUPPORT", 22 },
|
139
|
-
{ "Errno::ENOPROTOOPT", 18 },
|
140
|
-
{ "Errno::EPROTOTYPE", 17 },
|
141
|
-
{ "Errno::EMSGSIZE", 15 },
|
142
|
-
{ "Errno::EDESTADDRREQ", 19 },
|
143
|
-
{ "Errno::ENOTSOCK", 15 },
|
144
|
-
{ "Errno::EUSERS", 13 },
|
145
|
-
{ "Errno::EILSEQ", 13 },
|
146
|
-
{ "Errno::EOVERFLOW", 16 },
|
147
|
-
{ "Errno::EBADMSG", 14 },
|
148
|
-
{ "Errno::EMULTIHOP", 16 },
|
149
|
-
{ "Errno::EPROTO", 13 },
|
150
|
-
{ "Errno::ENOLINK", 14 },
|
151
|
-
{ "Errno::EREMOTE", 14 },
|
152
|
-
{ "Errno::ENOSR", 12 },
|
153
|
-
{ "Errno::ETIME", 12 },
|
154
|
-
{ "Errno::ENODATA", 14 },
|
155
|
-
{ "Errno::ENOSTR", 13 },
|
156
|
-
{ "Errno::EIDRM", 12 },
|
157
|
-
{ "Errno::ENOMSG", 13 },
|
158
|
-
{ "Errno::ELOOP", 12 },
|
159
|
-
{ "Errno::ENOTEMPTY", 16 },
|
160
|
-
{ "Errno::ENOSYS", 13 },
|
161
|
-
{ "Errno::ENOLCK", 13 },
|
162
|
-
{ "Errno::ENAMETOOLONG", 19 },
|
163
|
-
{ "Errno::EDEADLK", 14 },
|
164
|
-
{ "Errno::ERANGE", 13 },
|
165
|
-
{ "Errno::EDOM", 11 },
|
166
|
-
{ "Errno::EPIPE", 12 },
|
167
|
-
{ "Errno::EMLINK", 13 },
|
168
|
-
{ "Errno::EROFS", 12 },
|
169
|
-
{ "Errno::ESPIPE", 13 },
|
170
|
-
{ "Errno::ENOSPC", 13 },
|
171
|
-
{ "Errno::EFBIG", 12 },
|
172
|
-
{ "Errno::ETXTBSY", 14 },
|
173
|
-
{ "Errno::ENOTTY", 13 },
|
174
|
-
{ "Errno::EMFILE", 13 },
|
175
|
-
{ "Errno::ENFILE", 13 },
|
176
|
-
{ "Errno::EINVAL", 13 },
|
177
|
-
{ "Errno::EISDIR", 13 },
|
178
|
-
{ "Errno::ENOTDIR", 14 },
|
179
|
-
{ "Errno::ENODEV", 13 },
|
180
|
-
{ "Errno::EXDEV", 12 },
|
181
|
-
{ "Errno::EEXIST", 13 },
|
182
|
-
{ "Errno::EBUSY", 12 },
|
183
|
-
{ "Errno::ENOTBLK", 14 },
|
184
|
-
{ "Errno::EFAULT", 13 },
|
185
|
-
{ "Errno::EACCES", 13 },
|
186
|
-
{ "Errno::ENOMEM", 13 },
|
187
|
-
{ "Errno::EAGAIN", 13 },
|
188
|
-
{ "Errno::ECHILD", 13 },
|
189
|
-
{ "Errno::EBADF", 12 },
|
190
|
-
{ "Errno::ENOEXEC", 14 },
|
191
|
-
{ "Errno::E2BIG", 12 },
|
192
|
-
{ "Errno::ENXIO", 12 },
|
193
|
-
{ "Errno::EIO", 10 },
|
194
|
-
{ "Errno::EINTR", 12 },
|
195
|
-
{ "Errno::ESRCH", 12 },
|
196
|
-
{ "Errno::ENOENT", 13 },
|
197
|
-
{ "Errno::EPERM", 12 },
|
198
|
-
{ "Errno::NOERROR", 14 },
|
199
|
-
{ "Bignum", 6 },
|
200
|
-
{ "Float", 5 },
|
201
|
-
{ "Fixnum", 6 },
|
202
|
-
{ "Integer", 7 },
|
203
|
-
{ "Numeric", 7 },
|
204
|
-
{ "FloatDomainError", 16 },
|
205
|
-
{ "ZeroDivisionError", 17 },
|
206
|
-
{ "SystemCallError", 15 },
|
207
|
-
{ "Encoding::CompatibilityError", 28 },
|
208
|
-
{ "EncodingError", 13 },
|
209
|
-
{ "NoMemoryError", 13 },
|
210
|
-
{ "SecurityError", 13 },
|
211
|
-
{ "RuntimeError", 12 },
|
212
|
-
{ "NoMethodError", 13 },
|
213
|
-
{ "NameError::message", 18 },
|
214
|
-
{ "NameError", 9 },
|
215
|
-
{ "NotImplementedError", 19 },
|
216
|
-
{ "LoadError", 9 },
|
217
|
-
{ "SyntaxError", 11 },
|
218
|
-
{ "ScriptError", 11 },
|
219
|
-
{ "RangeError", 10 },
|
220
|
-
{ "KeyError", 8 },
|
221
|
-
{ "IndexError", 10 },
|
222
|
-
{ "ArgumentError", 13 },
|
223
|
-
{ "TypeError", 9 },
|
224
|
-
{ "StandardError", 13 },
|
225
|
-
{ "Interrupt", 9 },
|
226
|
-
{ "SignalException", 15 },
|
227
|
-
{ "SystemExit", 10 },
|
228
|
-
{ "Exception", 9 },
|
229
|
-
{ "Symbol", 6 },
|
230
|
-
{ "String", 6 },
|
231
|
-
{ "Encoding", 8 },
|
232
|
-
{ "FalseClass", 10 },
|
233
|
-
{ "TrueClass", 9 },
|
234
|
-
{ "Data", 4 },
|
235
|
-
{ "NilClass", 8 },
|
236
|
-
{ "Class", 5 },
|
237
|
-
{ "Module", 6 },
|
238
|
-
{ "Object", 6 },
|
239
|
-
{ "BasicObject", 11 },
|
240
|
-
{ "Gem::Requirement::BadRequirementError", 37 },
|
241
|
-
{ "Gem::Requirement", 16 },
|
242
|
-
{ "Gem::SourceFetchProblem", 23 },
|
243
|
-
{ "Gem::PlatformMismatch", 21 },
|
244
|
-
{ "Gem::ErrorReason", 16 },
|
245
|
-
{ "Gem::LoadError", 14 },
|
246
|
-
{ "Gem::RemoteSourceException", 26 },
|
247
|
-
{ "Gem::RemoteInstallationSkipped", 30 },
|
248
|
-
{ "Gem::RemoteInstallationCancelled", 32 },
|
249
|
-
{ "Gem::RemoteError", 16 },
|
250
|
-
{ "Gem::OperationNotSupportedError", 31 },
|
251
|
-
{ "Gem::InvalidSpecificationException", 34 },
|
252
|
-
{ "Gem::InstallError", 17 },
|
253
|
-
{ "Gem::Specification", 18 },
|
254
|
-
{ "Date", 4 },
|
255
|
-
{ "Gem::Platform", 13 },
|
256
|
-
{ "Gem::SpecificGemNotFoundException", 33 },
|
257
|
-
{ "Gem::GemNotFoundException", 25 },
|
258
|
-
{ "Gem::FormatException", 20 },
|
259
|
-
{ "Gem::FilePermissionError", 24 },
|
260
|
-
{ "Gem::EndOfYAMLException", 23 },
|
261
|
-
{ "Gem::DocumentError", 18 },
|
262
|
-
{ "Gem::GemNotInHomeException", 26 },
|
263
|
-
{ "Gem::DependencyRemovalException", 31 },
|
264
|
-
{ "Gem::DependencyError", 20 },
|
265
|
-
{ "Gem::CommandLineError", 21 },
|
266
|
-
{ "Gem::Exception", 14 },
|
267
|
-
{ "IRB::SLex", 9 },
|
268
|
-
{ "IRB::Notifier::NoMsgNotifier", 28 },
|
269
|
-
{ "IRB::Notifier::LeveledNotifier", 30 },
|
270
|
-
{ "IRB::Notifier::CompositeNotifier", 32 },
|
271
|
-
{ "IRB::Notifier::AbstractNotifier", 31 },
|
272
|
-
{ "IRB::Notifier::ErrUnrecognizedLevel", 35 },
|
273
|
-
{ "IRB::Notifier::ErrUndefinedNotifier", 35 },
|
274
|
-
{ "IRB::StdioOutputMethod", 22 },
|
275
|
-
{ "IRB::OutputMethod::NotImplementedError", 38 },
|
276
|
-
{ "IRB::OutputMethod", 17 },
|
277
|
-
{ "IRB::IllegalRCGenerator", 23 },
|
278
|
-
{ "IRB::UndefinedPromptMode", 24 },
|
279
|
-
{ "IRB::CantChangeBinding", 22 },
|
280
|
-
{ "IRB::CantShiftToMultiIrbMode", 28 },
|
281
|
-
{ "IRB::NoSuchJob", 14 },
|
282
|
-
{ "IRB::IrbSwitchedToCurrentThread", 31 },
|
283
|
-
{ "IRB::IrbAlreadyDead", 19 },
|
284
|
-
{ "IRB::IllegalParameter", 21 },
|
285
|
-
{ "IRB::CantReturnToNormalMode", 27 },
|
286
|
-
{ "IRB::NotImplementedError", 24 },
|
287
|
-
{ "IRB::UnrecognizedSwitch", 23 },
|
288
|
-
{ "IRB::Irb", 8 },
|
289
|
-
{ "IRB::Abort", 10 },
|
290
|
-
{ "IRB::Locale", 11 },
|
291
|
-
{ "IRB::SLex::ErrNodeNothing", 25 },
|
292
|
-
{ "IRB::SLex::ErrNodeAlreadyExists", 31 },
|
293
|
-
{ "RubyLex", 7 },
|
294
|
-
{ "IRB::SLex::Node", 15 },
|
295
|
-
{ "Gem::SystemExitException", 24 },
|
296
|
-
{ "Gem::VerificationError", 22 },
|
297
|
-
{ "RubyToken::TkError", 18 },
|
298
|
-
{ "RubyToken::TkUnknownChar", 24 },
|
299
|
-
{ "RubyToken::TkOPASGN", 19 },
|
300
|
-
{ "RubyToken::TkOp", 15 },
|
301
|
-
{ "RubyToken::TkVal", 16 },
|
302
|
-
{ "RubyToken::TkId", 15 },
|
303
|
-
{ "RubyToken::TkNode", 17 },
|
304
|
-
{ "RubyToken::Token", 16 },
|
305
|
-
{ "RubyToken::TkUNDEF", 18 },
|
306
|
-
{ "RubyToken::TkDEF", 16 },
|
307
|
-
{ "RubyToken::TkMODULE", 19 },
|
308
|
-
{ "RubyToken::TkCLASS", 18 },
|
309
|
-
{ "RubyToken::TkWHILE", 18 },
|
310
|
-
{ "RubyToken::TkWHEN", 17 },
|
311
|
-
{ "RubyToken::TkCASE", 17 },
|
312
|
-
{ "RubyToken::TkELSE", 17 },
|
313
|
-
{ "RubyToken::TkELSIF", 18 },
|
314
|
-
{ "RubyToken::TkTHEN", 17 },
|
315
|
-
{ "RubyToken::TkUNLESS", 19 },
|
316
|
-
{ "RubyToken::TkIF", 15 },
|
317
|
-
{ "RubyToken::TkEND", 16 },
|
318
|
-
{ "RubyToken::TkENSURE", 19 },
|
319
|
-
{ "RubyToken::TkRESCUE", 19 },
|
320
|
-
{ "RubyToken::TkBEGIN", 18 },
|
321
|
-
{ "RubyToken::TkDO", 15 },
|
322
|
-
{ "RubyToken::TkIN", 15 },
|
323
|
-
{ "RubyToken::TkRETRY", 18 },
|
324
|
-
{ "RubyToken::TkREDO", 17 },
|
325
|
-
{ "RubyToken::TkNEXT", 17 },
|
326
|
-
{ "RubyToken::TkBREAK", 18 },
|
327
|
-
{ "RubyToken::TkFOR", 16 },
|
328
|
-
{ "RubyToken::TkUNTIL", 18 },
|
329
|
-
{ "RubyToken::TkTRUE", 17 },
|
330
|
-
{ "RubyToken::TkNIL", 16 },
|
331
|
-
{ "RubyToken::TkSELF", 17 },
|
332
|
-
{ "RubyToken::TkSUPER", 18 },
|
333
|
-
{ "RubyToken::TkYIELD", 18 },
|
334
|
-
{ "RubyToken::TkRETURN", 19 },
|
335
|
-
{ "RubyToken::TkAND", 16 },
|
336
|
-
{ "RubyToken::TkFALSE", 18 },
|
337
|
-
{ "RubyToken::TkUNLESS_MOD", 23 },
|
338
|
-
{ "RubyToken::TkIF_MOD", 19 },
|
339
|
-
{ "RubyToken::TkNOT", 16 },
|
340
|
-
{ "RubyToken::TkOR", 15 },
|
341
|
-
{ "RubyToken::TkALIAS", 18 },
|
342
|
-
{ "RubyToken::TkUNTIL_MOD", 22 },
|
343
|
-
{ "RubyToken::TkWHILE_MOD", 22 },
|
344
|
-
{ "RubyToken::TkGVAR", 17 },
|
345
|
-
{ "RubyToken::TkFID", 16 },
|
346
|
-
{ "RubyToken::TkIDENTIFIER", 23 },
|
347
|
-
{ "RubyToken::Tk__FILE__", 21 },
|
348
|
-
{ "RubyToken::Tk__LINE__", 21 },
|
349
|
-
{ "RubyToken::TklEND", 17 },
|
350
|
-
{ "RubyToken::TklBEGIN", 19 },
|
351
|
-
{ "RubyToken::TkDEFINED", 20 },
|
352
|
-
{ "RubyToken::TkDREGEXP", 20 },
|
353
|
-
{ "RubyToken::TkDXSTRING", 21 },
|
354
|
-
{ "RubyToken::TkDSTRING", 20 },
|
355
|
-
{ "RubyToken::TkSYMBOL", 19 },
|
356
|
-
{ "RubyToken::TkREGEXP", 19 },
|
357
|
-
{ "RubyToken::TkXSTRING", 20 },
|
358
|
-
{ "RubyToken::TkSTRING", 19 },
|
359
|
-
{ "RubyToken::TkFLOAT", 18 },
|
360
|
-
{ "RubyToken::TkINTEGER", 20 },
|
361
|
-
{ "RubyToken::TkCONSTANT", 21 },
|
362
|
-
{ "RubyToken::TkIVAR", 17 },
|
363
|
-
{ "RubyToken::TkCVAR", 17 },
|
364
|
-
{ "RubyToken::TkNEQ", 16 },
|
365
|
-
{ "RubyToken::TkEQQ", 16 },
|
366
|
-
{ "RubyToken::TkEQ", 15 },
|
367
|
-
{ "RubyToken::TkCMP", 16 },
|
368
|
-
{ "RubyToken::TkPOW", 16 },
|
369
|
-
{ "RubyToken::TkUMINUS", 19 },
|
370
|
-
{ "RubyToken::TkUPLUS", 18 },
|
371
|
-
{ "Exception2MessageMapper::ErrNotRegisteredException", 50 },
|
372
|
-
{ "RubyToken::TkBACK_REF", 21 },
|
373
|
-
{ "RubyToken::TkNTH_REF", 20 },
|
374
|
-
{ "RubyToken::TkLSHFT", 18 },
|
375
|
-
{ "RubyToken::TkASET", 17 },
|
376
|
-
{ "RubyToken::TkAREF", 17 },
|
377
|
-
{ "RubyToken::TkDOT3", 17 },
|
378
|
-
{ "RubyToken::TkDOT2", 17 },
|
379
|
-
{ "RubyToken::TkNMATCH", 19 },
|
380
|
-
{ "RubyToken::TkMATCH", 18 },
|
381
|
-
{ "RubyToken::TkOROP", 17 },
|
382
|
-
{ "RubyToken::TkANDOP", 18 },
|
383
|
-
{ "RubyToken::TkLEQ", 16 },
|
384
|
-
{ "RubyToken::TkGEQ", 16 },
|
385
|
-
{ "RubyToken::TkAMPER", 18 },
|
386
|
-
{ "RubyToken::TkSTAR", 17 },
|
387
|
-
{ "RubyToken::TkfLBRACE", 20 },
|
388
|
-
{ "RubyToken::TkfLBRACK", 20 },
|
389
|
-
{ "RubyToken::TkfLPAREN", 20 },
|
390
|
-
{ "RubyToken::TkCOLON", 18 },
|
391
|
-
{ "RubyToken::TkQUESTION", 21 },
|
392
|
-
{ "RubyToken::TkASSOC", 18 },
|
393
|
-
{ "RubyToken::TkCOLON3", 19 },
|
394
|
-
{ "RubyToken::TkCOLON2", 19 },
|
395
|
-
{ "RubyToken::TkRSHFT", 18 },
|
396
|
-
{ "RubyToken::TkBITAND", 19 },
|
397
|
-
{ "RubyToken::TkBITXOR", 19 },
|
398
|
-
{ "RubyToken::TkBITOR", 18 },
|
399
|
-
{ "RubyToken::TkMOD", 16 },
|
400
|
-
{ "RubyToken::TkDIV", 16 },
|
401
|
-
{ "RubyToken::TkMULT", 17 },
|
402
|
-
{ "RubyToken::TkMINUS", 18 },
|
403
|
-
{ "RubyToken::TkPLUS", 17 },
|
404
|
-
{ "RubyToken::TkLT", 15 },
|
405
|
-
{ "RubyToken::TkGT", 15 },
|
406
|
-
{ "RubyToken::TkSYMBEG", 19 },
|
407
|
-
{ "IRB::DefaultEncodings", 21 },
|
408
|
-
{ "RubyToken::TkRPAREN", 19 },
|
409
|
-
{ "RubyToken::TkLBRACE", 19 },
|
410
|
-
{ "RubyToken::TkLBRACK", 19 },
|
411
|
-
{ "RubyToken::TkLPAREN", 19 },
|
412
|
-
{ "RubyToken::TkDOT", 16 },
|
413
|
-
{ "RubyToken::TkASSIGN", 19 },
|
414
|
-
{ "RubyToken::TkBACKQUOTE", 22 },
|
415
|
-
{ "RubyToken::TkNOTOP", 18 },
|
416
|
-
{ "RubyToken::TkBITNOT", 19 },
|
417
|
-
{ "RubyToken::TkDOLLAR", 19 },
|
418
|
-
{ "RubyToken::TkAT", 15 },
|
419
|
-
{ "RubyToken::TkBACKSLASH", 22 },
|
420
|
-
{ "RubyToken::TkEND_OF_SCRIPT", 26 },
|
421
|
-
{ "RubyToken::TkNL", 15 },
|
422
|
-
{ "RubyToken::TkSPACE", 18 },
|
423
|
-
{ "RubyToken::TkRD_COMMENT", 23 },
|
424
|
-
{ "RubyToken::TkCOMMENT", 20 },
|
425
|
-
{ "RubyToken::TkSEMICOLON", 22 },
|
426
|
-
{ "RubyToken::TkCOMMA", 18 },
|
427
|
-
{ "RubyToken::TkRBRACE", 19 },
|
428
|
-
{ "RubyToken::TkRBRACK", 19 },
|
429
|
-
{ "RubyLex::TerminateLineInput", 27 },
|
430
|
-
{ "RubyLex::SyntaxError", 20 },
|
431
|
-
{ "RubyLex::TkReading2TokenDuplicateError", 38 },
|
432
|
-
{ "RubyLex::TkSymbol2TokenNoKey", 28 },
|
433
|
-
{ "RubyLex::TkReading2TokenNoKey", 29 },
|
434
|
-
{ "RubyLex::AlreadyDefinedToken", 28 },
|
435
|
-
{ "IRB::FileInputMethod", 20 },
|
436
|
-
{ "IRB::StdioInputMethod", 21 },
|
437
|
-
{ "IRB::InputMethod", 16 },
|
438
|
-
{ "IRB::ReadlineInputMethod", 24 },
|
439
|
-
{ "IRB::Context", 12 },
|
440
|
-
{ "IRB::Inspector", 14 },
|
441
|
-
{ "IRB::WorkSpace", 14 },
|
442
|
-
{ 0, 0 }
|
443
|
-
};
|
444
|
-
|
445
|
-
static uint64_t
|
446
|
-
micro_time() {
|
447
|
-
struct timeval tv;
|
448
|
-
|
449
|
-
gettimeofday(&tv, NULL);
|
450
|
-
|
451
|
-
return (uint64_t)tv.tv_sec * 1000000ULL + (uint64_t)tv.tv_usec;
|
452
|
-
}
|
453
|
-
|
454
|
-
static void
|
455
|
-
perf() {
|
456
|
-
StrLen d;
|
457
|
-
VALUE v;
|
458
|
-
VALUE *slot = 0;
|
459
|
-
uint64_t dt, start;
|
460
|
-
int i, iter = 1000000;
|
461
|
-
int dataCnt = sizeof(data) / sizeof(*data);
|
462
|
-
|
463
|
-
oj_hash_init();
|
464
|
-
start = micro_time();
|
465
|
-
for (i = iter; 0 < i; i--) {
|
466
|
-
for (d = data; 0 != d->str; d++) {
|
467
|
-
v = oj_class_hash_get(d->str, d->len, &slot);
|
468
|
-
if (Qundef == v) {
|
469
|
-
if (0 != slot) {
|
470
|
-
v = ID2SYM(rb_intern(d->str));
|
471
|
-
*slot = v;
|
472
|
-
}
|
473
|
-
}
|
474
|
-
}
|
475
|
-
}
|
476
|
-
dt = micro_time() - start;
|
477
|
-
#if IS_WINDOWS
|
478
|
-
printf("%d iterations took %ld msecs, %ld gets/msec\n", iter, (long)(dt / 1000), (long)(iter * dataCnt / (dt / 1000)));
|
479
|
-
#else
|
480
|
-
printf("%d iterations took %"PRIu64" msecs, %ld gets/msec\n", iter, dt / 1000, (long)(iter * dataCnt / (dt / 1000)));
|
481
|
-
#endif
|
482
|
-
}
|
483
|
-
|
484
|
-
void
|
485
|
-
oj_hash_test() {
|
486
|
-
StrLen d;
|
487
|
-
VALUE v;
|
488
|
-
VALUE *slot = 0;;
|
489
|
-
|
490
|
-
oj_hash_init();
|
491
|
-
for (d = data; 0 != d->str; d++) {
|
492
|
-
char *s = oj_strndup(d->str, d->len);
|
493
|
-
v = oj_class_hash_get(d->str, d->len, &slot);
|
494
|
-
if (Qnil == v) {
|
495
|
-
if (0 == slot) {
|
496
|
-
printf("*** failed to get a slot for %s\n", s);
|
497
|
-
} else {
|
498
|
-
v = ID2SYM(rb_intern(d->str));
|
499
|
-
*slot = v;
|
500
|
-
}
|
501
|
-
} else {
|
502
|
-
VALUE rs = rb_funcall2(v, rb_intern("to_s"), 0, 0);
|
503
|
-
|
504
|
-
printf("*** get on '%s' returned '%s' (%s)\n", s, StringValuePtr(rs), rb_class2name(rb_obj_class(v)));
|
505
|
-
}
|
506
|
-
/*oj_hash_print(c);*/
|
507
|
-
}
|
508
|
-
printf("*** ---------- hash table ------------\n");
|
509
|
-
oj_hash_print();
|
510
|
-
perf();
|
511
|
-
}
|
512
|
-
#endif
|