scout 5.1.2 → 5.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/lib/scout.rb +1 -1
- data/lib/scout/server.rb +4 -1
- data/vendor/json_pure/CHANGES +43 -0
- data/vendor/json_pure/{RUBY → COPYING} +1 -1
- data/vendor/json_pure/GPL +7 -7
- data/vendor/json_pure/README +319 -39
- data/vendor/json_pure/Rakefile +69 -47
- data/vendor/json_pure/VERSION +1 -1
- data/vendor/json_pure/benchmarks/generator2_benchmark.rb +222 -0
- data/vendor/json_pure/benchmarks/generator_benchmark.rb +64 -5
- data/vendor/json_pure/benchmarks/ohai.json +1216 -0
- data/vendor/json_pure/benchmarks/ohai.ruby +1 -0
- data/vendor/json_pure/benchmarks/parser2_benchmark.rb +251 -0
- data/vendor/json_pure/benchmarks/parser_benchmark.rb +67 -5
- data/vendor/json_pure/ext/json/ext/generator/extconf.rb +9 -4
- data/vendor/json_pure/ext/json/ext/generator/generator.c +831 -409
- data/vendor/json_pure/ext/json/ext/generator/generator.h +170 -0
- data/vendor/json_pure/ext/json/ext/parser/extconf.rb +8 -4
- data/vendor/json_pure/ext/json/ext/parser/parser.c +292 -186
- data/vendor/json_pure/ext/json/ext/parser/parser.h +71 -0
- data/vendor/json_pure/ext/json/ext/parser/parser.rl +218 -112
- data/vendor/json_pure/lib/json/add/core.rb +20 -7
- data/vendor/json_pure/lib/json/add/rails.rb +2 -2
- data/vendor/json_pure/lib/json/common.rb +85 -42
- data/vendor/json_pure/lib/json/pure.rb +3 -3
- data/vendor/json_pure/lib/json/pure/generator.rb +112 -90
- data/vendor/json_pure/lib/json/pure/parser.rb +42 -4
- data/vendor/json_pure/lib/json/version.rb +1 -1
- data/vendor/json_pure/tests/test_json.rb +46 -18
- data/vendor/json_pure/tests/test_json_addition.rb +4 -6
- data/vendor/json_pure/tests/test_json_encoding.rb +68 -0
- data/vendor/json_pure/tests/test_json_generate.rb +30 -14
- data/vendor/json_pure/tests/test_json_rails.rb +5 -7
- data/vendor/json_pure/tests/test_json_unicode.rb +20 -6
- metadata +26 -15
- data/vendor/json_pure/doc-templates/main.txt +0 -283
- data/vendor/json_pure/ext/json/ext/generator/unicode.c +0 -182
- data/vendor/json_pure/ext/json/ext/generator/unicode.h +0 -53
- data/vendor/json_pure/ext/json/ext/parser/unicode.c +0 -154
- data/vendor/json_pure/ext/json/ext/parser/unicode.h +0 -58
@@ -1,53 +0,0 @@
|
|
1
|
-
#include "ruby.h"
|
2
|
-
|
3
|
-
#ifndef _GENERATOR_UNICODE_H_
|
4
|
-
#define _GENERATOR_UNICODE_H_
|
5
|
-
|
6
|
-
typedef enum {
|
7
|
-
conversionOK = 0, /* conversion successful */
|
8
|
-
sourceExhausted, /* partial character in source, but hit end */
|
9
|
-
targetExhausted, /* insuff. room in target for conversion */
|
10
|
-
sourceIllegal /* source sequence is illegal/malformed */
|
11
|
-
} ConversionResult;
|
12
|
-
|
13
|
-
typedef enum {
|
14
|
-
strictConversion = 0,
|
15
|
-
lenientConversion
|
16
|
-
} ConversionFlags;
|
17
|
-
|
18
|
-
typedef unsigned long UTF32; /* at least 32 bits */
|
19
|
-
typedef unsigned short UTF16; /* at least 16 bits */
|
20
|
-
typedef unsigned char UTF8; /* typically 8 bits */
|
21
|
-
|
22
|
-
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
|
23
|
-
#define UNI_MAX_BMP (UTF32)0x0000FFFF
|
24
|
-
#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
|
25
|
-
#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
|
26
|
-
#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
|
27
|
-
|
28
|
-
#define UNI_SUR_HIGH_START (UTF32)0xD800
|
29
|
-
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
|
30
|
-
#define UNI_SUR_LOW_START (UTF32)0xDC00
|
31
|
-
#define UNI_SUR_LOW_END (UTF32)0xDFFF
|
32
|
-
|
33
|
-
static const int halfShift = 10; /* used for shifting by 10 bits */
|
34
|
-
|
35
|
-
static const UTF32 halfBase = 0x0010000UL;
|
36
|
-
static const UTF32 halfMask = 0x3FFUL;
|
37
|
-
|
38
|
-
void JSON_convert_UTF8_to_JSON(VALUE buffer, VALUE string, ConversionFlags flags);
|
39
|
-
|
40
|
-
#ifndef RARRAY_PTR
|
41
|
-
#define RARRAY_PTR(ARRAY) RARRAY(ARRAY)->ptr
|
42
|
-
#endif
|
43
|
-
#ifndef RARRAY_LEN
|
44
|
-
#define RARRAY_LEN(ARRAY) RARRAY(ARRAY)->len
|
45
|
-
#endif
|
46
|
-
#ifndef RSTRING_PTR
|
47
|
-
#define RSTRING_PTR(string) RSTRING(string)->ptr
|
48
|
-
#endif
|
49
|
-
#ifndef RSTRING_LEN
|
50
|
-
#define RSTRING_LEN(string) RSTRING(string)->len
|
51
|
-
#endif
|
52
|
-
|
53
|
-
#endif
|
@@ -1,154 +0,0 @@
|
|
1
|
-
#include "unicode.h"
|
2
|
-
|
3
|
-
/*
|
4
|
-
* Copyright 2001-2004 Unicode, Inc.
|
5
|
-
*
|
6
|
-
* Disclaimer
|
7
|
-
*
|
8
|
-
* This source code is provided as is by Unicode, Inc. No claims are
|
9
|
-
* made as to fitness for any particular purpose. No warranties of any
|
10
|
-
* kind are expressed or implied. The recipient agrees to determine
|
11
|
-
* applicability of information provided. If this file has been
|
12
|
-
* purchased on magnetic or optical media from Unicode, Inc., the
|
13
|
-
* sole remedy for any claim will be exchange of defective media
|
14
|
-
* within 90 days of receipt.
|
15
|
-
*
|
16
|
-
* Limitations on Rights to Redistribute This Code
|
17
|
-
*
|
18
|
-
* Unicode, Inc. hereby grants the right to freely use the information
|
19
|
-
* supplied in this file in the creation of products supporting the
|
20
|
-
* Unicode Standard, and to make copies of this file in any form
|
21
|
-
* for internal or external distribution as long as this notice
|
22
|
-
* remains attached.
|
23
|
-
*/
|
24
|
-
|
25
|
-
/*
|
26
|
-
* Index into the table below with the first byte of a UTF-8 sequence to
|
27
|
-
* get the number of trailing bytes that are supposed to follow it.
|
28
|
-
* Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
|
29
|
-
* left as-is for anyone who may want to do such conversion, which was
|
30
|
-
* allowed in earlier algorithms.
|
31
|
-
*/
|
32
|
-
static const char trailingBytesForUTF8[256] = {
|
33
|
-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
34
|
-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
35
|
-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
36
|
-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
37
|
-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
38
|
-
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
39
|
-
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
40
|
-
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
|
41
|
-
};
|
42
|
-
|
43
|
-
/*
|
44
|
-
* Magic values subtracted from a buffer value during UTF8 conversion.
|
45
|
-
* This table contains as many values as there might be trailing bytes
|
46
|
-
* in a UTF-8 sequence.
|
47
|
-
*/
|
48
|
-
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
|
49
|
-
0x03C82080UL, 0xFA082080UL, 0x82082080UL };
|
50
|
-
|
51
|
-
/*
|
52
|
-
* Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
|
53
|
-
* into the first byte, depending on how many bytes follow. There are
|
54
|
-
* as many entries in this table as there are UTF-8 sequence types.
|
55
|
-
* (I.e., one byte sequence, two byte... etc.). Remember that sequencs
|
56
|
-
* for *legal* UTF-8 will be 4 or fewer bytes total.
|
57
|
-
*/
|
58
|
-
static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
59
|
-
|
60
|
-
char *JSON_convert_UTF16_to_UTF8 (
|
61
|
-
VALUE buffer,
|
62
|
-
char *source,
|
63
|
-
char *sourceEnd,
|
64
|
-
ConversionFlags flags)
|
65
|
-
{
|
66
|
-
UTF16 *tmp, *tmpPtr, *tmpEnd;
|
67
|
-
char buf[5];
|
68
|
-
long n = 0, i;
|
69
|
-
char *p = source - 1;
|
70
|
-
|
71
|
-
while (p < sourceEnd && p[0] == '\\' && p[1] == 'u') {
|
72
|
-
p += 6;
|
73
|
-
n++;
|
74
|
-
}
|
75
|
-
p = source + 1;
|
76
|
-
buf[4] = 0;
|
77
|
-
tmpPtr = tmp = ALLOC_N(UTF16, n);
|
78
|
-
tmpEnd = tmp + n;
|
79
|
-
for (i = 0; i < n; i++) {
|
80
|
-
buf[0] = *p++;
|
81
|
-
buf[1] = *p++;
|
82
|
-
buf[2] = *p++;
|
83
|
-
buf[3] = *p++;
|
84
|
-
tmpPtr[i] = (UTF16)strtol(buf, NULL, 16);
|
85
|
-
p += 2;
|
86
|
-
}
|
87
|
-
|
88
|
-
while (tmpPtr < tmpEnd) {
|
89
|
-
UTF32 ch;
|
90
|
-
unsigned short bytesToWrite = 0;
|
91
|
-
const UTF32 byteMask = 0xBF;
|
92
|
-
const UTF32 byteMark = 0x80;
|
93
|
-
ch = *tmpPtr++;
|
94
|
-
/* If we have a surrogate pair, convert to UTF32 first. */
|
95
|
-
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
|
96
|
-
/* If the 16 bits following the high surrogate are in the source
|
97
|
-
* buffer... */
|
98
|
-
if (tmpPtr < tmpEnd) {
|
99
|
-
UTF32 ch2 = *tmpPtr;
|
100
|
-
/* If it's a low surrogate, convert to UTF32. */
|
101
|
-
if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
|
102
|
-
ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
|
103
|
-
+ (ch2 - UNI_SUR_LOW_START) + halfBase;
|
104
|
-
++tmpPtr;
|
105
|
-
} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
|
106
|
-
ruby_xfree(tmp);
|
107
|
-
rb_raise(rb_path2class("JSON::ParserError"),
|
108
|
-
"source sequence is illegal/malformed near %s", source);
|
109
|
-
}
|
110
|
-
} else { /* We don't have the 16 bits following the high surrogate. */
|
111
|
-
ruby_xfree(tmp);
|
112
|
-
rb_raise(rb_path2class("JSON::ParserError"),
|
113
|
-
"partial character in source, but hit end near %s", source);
|
114
|
-
break;
|
115
|
-
}
|
116
|
-
} else if (flags == strictConversion) {
|
117
|
-
/* UTF-16 surrogate values are illegal in UTF-32 */
|
118
|
-
if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
|
119
|
-
ruby_xfree(tmp);
|
120
|
-
rb_raise(rb_path2class("JSON::ParserError"),
|
121
|
-
"source sequence is illegal/malformed near %s", source);
|
122
|
-
}
|
123
|
-
}
|
124
|
-
/* Figure out how many bytes the result will require */
|
125
|
-
if (ch < (UTF32) 0x80) {
|
126
|
-
bytesToWrite = 1;
|
127
|
-
} else if (ch < (UTF32) 0x800) {
|
128
|
-
bytesToWrite = 2;
|
129
|
-
} else if (ch < (UTF32) 0x10000) {
|
130
|
-
bytesToWrite = 3;
|
131
|
-
} else if (ch < (UTF32) 0x110000) {
|
132
|
-
bytesToWrite = 4;
|
133
|
-
} else {
|
134
|
-
bytesToWrite = 3;
|
135
|
-
ch = UNI_REPLACEMENT_CHAR;
|
136
|
-
}
|
137
|
-
|
138
|
-
buf[0] = 0;
|
139
|
-
buf[1] = 0;
|
140
|
-
buf[2] = 0;
|
141
|
-
buf[3] = 0;
|
142
|
-
p = buf + bytesToWrite;
|
143
|
-
switch (bytesToWrite) { /* note: everything falls through. */
|
144
|
-
case 4: *--p = (UTF8) ((ch | byteMark) & byteMask); ch >>= 6;
|
145
|
-
case 3: *--p = (UTF8) ((ch | byteMark) & byteMask); ch >>= 6;
|
146
|
-
case 2: *--p = (UTF8) ((ch | byteMark) & byteMask); ch >>= 6;
|
147
|
-
case 1: *--p = (UTF8) (ch | firstByteMark[bytesToWrite]);
|
148
|
-
}
|
149
|
-
rb_str_buf_cat(buffer, p, bytesToWrite);
|
150
|
-
}
|
151
|
-
ruby_xfree(tmp);
|
152
|
-
source += 5 + (n - 1) * 6;
|
153
|
-
return source;
|
154
|
-
}
|
@@ -1,58 +0,0 @@
|
|
1
|
-
|
2
|
-
#ifndef _PARSER_UNICODE_H_
|
3
|
-
#define _PARSER_UNICODE_H_
|
4
|
-
|
5
|
-
#include "ruby.h"
|
6
|
-
|
7
|
-
typedef unsigned long UTF32; /* at least 32 bits */
|
8
|
-
typedef unsigned short UTF16; /* at least 16 bits */
|
9
|
-
typedef unsigned char UTF8; /* typically 8 bits */
|
10
|
-
|
11
|
-
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
|
12
|
-
#define UNI_MAX_BMP (UTF32)0x0000FFFF
|
13
|
-
#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
|
14
|
-
#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
|
15
|
-
#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
|
16
|
-
|
17
|
-
#define UNI_SUR_HIGH_START (UTF32)0xD800
|
18
|
-
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
|
19
|
-
#define UNI_SUR_LOW_START (UTF32)0xDC00
|
20
|
-
#define UNI_SUR_LOW_END (UTF32)0xDFFF
|
21
|
-
|
22
|
-
static const int halfShift = 10; /* used for shifting by 10 bits */
|
23
|
-
|
24
|
-
static const UTF32 halfBase = 0x0010000UL;
|
25
|
-
static const UTF32 halfMask = 0x3FFUL;
|
26
|
-
|
27
|
-
typedef enum {
|
28
|
-
conversionOK = 0, /* conversion successful */
|
29
|
-
sourceExhausted, /* partial character in source, but hit end */
|
30
|
-
targetExhausted, /* insuff. room in target for conversion */
|
31
|
-
sourceIllegal /* source sequence is illegal/malformed */
|
32
|
-
} ConversionResult;
|
33
|
-
|
34
|
-
typedef enum {
|
35
|
-
strictConversion = 0,
|
36
|
-
lenientConversion
|
37
|
-
} ConversionFlags;
|
38
|
-
|
39
|
-
char *JSON_convert_UTF16_to_UTF8 (
|
40
|
-
VALUE buffer,
|
41
|
-
char *source,
|
42
|
-
char *sourceEnd,
|
43
|
-
ConversionFlags flags);
|
44
|
-
|
45
|
-
#ifndef RARRAY_PTR
|
46
|
-
#define RARRAY_PTR(ARRAY) RARRAY(ARRAY)->ptr
|
47
|
-
#endif
|
48
|
-
#ifndef RARRAY_LEN
|
49
|
-
#define RARRAY_LEN(ARRAY) RARRAY(ARRAY)->len
|
50
|
-
#endif
|
51
|
-
#ifndef RSTRING_PTR
|
52
|
-
#define RSTRING_PTR(string) RSTRING(string)->ptr
|
53
|
-
#endif
|
54
|
-
#ifndef RSTRING_LEN
|
55
|
-
#define RSTRING_LEN(string) RSTRING(string)->len
|
56
|
-
#endif
|
57
|
-
|
58
|
-
#endif
|