json 1.1.5-x86-linux
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.
Potentially problematic release.
This version of json might be problematic. Click here for more details.
- data/CHANGES +106 -0
- data/GPL +340 -0
- data/README +78 -0
- data/RUBY +58 -0
- data/Rakefile +268 -0
- data/TODO +1 -0
- data/VERSION +1 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +52 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +900 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +901 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +261 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +262 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +82 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +34 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +900 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +901 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +81 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +82 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +82 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +82 -0
- data/benchmarks/generator_benchmark.rb +165 -0
- data/benchmarks/parser_benchmark.rb +197 -0
- data/bin/edit_json.rb +9 -0
- data/bin/prettify_json.rb +75 -0
- data/data/example.json +1 -0
- data/data/index.html +38 -0
- data/data/prototype.js +4184 -0
- data/doc-templates/main.txt +283 -0
- data/ext/json/ext/generator/extconf.rb +11 -0
- data/ext/json/ext/generator/generator.c +919 -0
- data/ext/json/ext/generator/unicode.c +182 -0
- data/ext/json/ext/generator/unicode.h +53 -0
- data/ext/json/ext/parser/extconf.rb +11 -0
- data/ext/json/ext/parser/parser.c +1829 -0
- data/ext/json/ext/parser/parser.rl +686 -0
- data/ext/json/ext/parser/unicode.c +154 -0
- data/ext/json/ext/parser/unicode.h +58 -0
- data/install.rb +26 -0
- data/lib/json.rb +10 -0
- data/lib/json/Array.xpm +21 -0
- data/lib/json/FalseClass.xpm +21 -0
- data/lib/json/Hash.xpm +21 -0
- data/lib/json/Key.xpm +73 -0
- data/lib/json/NilClass.xpm +21 -0
- data/lib/json/Numeric.xpm +28 -0
- data/lib/json/String.xpm +96 -0
- data/lib/json/TrueClass.xpm +21 -0
- data/lib/json/add/core.rb +135 -0
- data/lib/json/add/rails.rb +58 -0
- data/lib/json/common.rb +354 -0
- data/lib/json/editor.rb +1371 -0
- data/lib/json/ext.rb +15 -0
- data/lib/json/ext/generator.so +0 -0
- data/lib/json/ext/parser.so +0 -0
- data/lib/json/json.xpm +1499 -0
- data/lib/json/pure.rb +77 -0
- data/lib/json/pure/generator.rb +430 -0
- data/lib/json/pure/parser.rb +267 -0
- data/lib/json/version.rb +8 -0
- data/tests/fixtures/fail1.json +1 -0
- data/tests/fixtures/fail10.json +1 -0
- data/tests/fixtures/fail11.json +1 -0
- data/tests/fixtures/fail12.json +1 -0
- data/tests/fixtures/fail13.json +1 -0
- data/tests/fixtures/fail14.json +1 -0
- data/tests/fixtures/fail18.json +1 -0
- data/tests/fixtures/fail19.json +1 -0
- data/tests/fixtures/fail2.json +1 -0
- data/tests/fixtures/fail20.json +1 -0
- data/tests/fixtures/fail21.json +1 -0
- data/tests/fixtures/fail22.json +1 -0
- data/tests/fixtures/fail23.json +1 -0
- data/tests/fixtures/fail24.json +1 -0
- data/tests/fixtures/fail25.json +1 -0
- data/tests/fixtures/fail27.json +2 -0
- data/tests/fixtures/fail28.json +2 -0
- data/tests/fixtures/fail3.json +1 -0
- data/tests/fixtures/fail4.json +1 -0
- data/tests/fixtures/fail5.json +1 -0
- data/tests/fixtures/fail6.json +1 -0
- data/tests/fixtures/fail7.json +1 -0
- data/tests/fixtures/fail8.json +1 -0
- data/tests/fixtures/fail9.json +1 -0
- data/tests/fixtures/pass1.json +56 -0
- data/tests/fixtures/pass15.json +1 -0
- data/tests/fixtures/pass16.json +1 -0
- data/tests/fixtures/pass17.json +1 -0
- data/tests/fixtures/pass2.json +1 -0
- data/tests/fixtures/pass26.json +1 -0
- data/tests/fixtures/pass3.json +6 -0
- data/tests/test_json.rb +312 -0
- data/tests/test_json_addition.rb +164 -0
- data/tests/test_json_fixtures.rb +34 -0
- data/tests/test_json_generate.rb +106 -0
- data/tests/test_json_rails.rb +146 -0
- data/tests/test_json_unicode.rb +62 -0
- data/tools/fuzz.rb +139 -0
- data/tools/server.rb +61 -0
- metadata +200 -0
| @@ -0,0 +1,154 @@ | |
| 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 | 
            +
            }
         | 
| @@ -0,0 +1,58 @@ | |
| 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
         | 
    
        data/install.rb
    ADDED
    
    | @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'rbconfig'
         | 
| 4 | 
            +
            require 'fileutils'
         | 
| 5 | 
            +
            include FileUtils::Verbose
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            include Config
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            bindir = CONFIG["bindir"]
         | 
| 10 | 
            +
            cd 'bin' do
         | 
| 11 | 
            +
              filename = 'edit_json.rb'
         | 
| 12 | 
            +
              #install(filename, bindir)
         | 
| 13 | 
            +
            end
         | 
| 14 | 
            +
            sitelibdir = CONFIG["sitelibdir"]
         | 
| 15 | 
            +
            cd 'lib' do
         | 
| 16 | 
            +
              install('json.rb', sitelibdir)
         | 
| 17 | 
            +
              mkdir_p File.join(sitelibdir, 'json')
         | 
| 18 | 
            +
              for file in Dir['json/**/*.{rb,xpm}']
         | 
| 19 | 
            +
                d = File.join(sitelibdir, file)
         | 
| 20 | 
            +
                mkdir_p File.dirname(d)
         | 
| 21 | 
            +
                install(file, d)
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
              install(File.join('json', 'editor.rb'), File.join(sitelibdir,'json'))
         | 
| 24 | 
            +
              install(File.join('json', 'json.xpm'), File.join(sitelibdir,'json'))
         | 
| 25 | 
            +
            end
         | 
| 26 | 
            +
            warn " *** Installed PURE ruby library."
         | 
    
        data/lib/json.rb
    ADDED
    
    
    
        data/lib/json/Array.xpm
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            /* XPM */
         | 
| 2 | 
            +
            static char * Array_xpm[] = {
         | 
| 3 | 
            +
            "16 16 2 1",
         | 
| 4 | 
            +
            " 	c None",
         | 
| 5 | 
            +
            ".	c #000000",
         | 
| 6 | 
            +
            "                ",
         | 
| 7 | 
            +
            "                ",
         | 
| 8 | 
            +
            "                ",
         | 
| 9 | 
            +
            "   ..........   ",
         | 
| 10 | 
            +
            "   .        .   ",
         | 
| 11 | 
            +
            "   .        .   ",
         | 
| 12 | 
            +
            "   .        .   ",
         | 
| 13 | 
            +
            "   .        .   ",
         | 
| 14 | 
            +
            "   .        .   ",
         | 
| 15 | 
            +
            "   .        .   ",
         | 
| 16 | 
            +
            "   .        .   ",
         | 
| 17 | 
            +
            "   .        .   ",
         | 
| 18 | 
            +
            "   ..........   ",
         | 
| 19 | 
            +
            "                ",
         | 
| 20 | 
            +
            "                ",
         | 
| 21 | 
            +
            "                "};
         | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            /* XPM */
         | 
| 2 | 
            +
            static char * False_xpm[] = {
         | 
| 3 | 
            +
            "16 16 2 1",
         | 
| 4 | 
            +
            " 	c None",
         | 
| 5 | 
            +
            ".	c #FF0000",
         | 
| 6 | 
            +
            "                ",
         | 
| 7 | 
            +
            "                ",
         | 
| 8 | 
            +
            "                ",
         | 
| 9 | 
            +
            "     ......     ",
         | 
| 10 | 
            +
            "     .          ",
         | 
| 11 | 
            +
            "     .          ",
         | 
| 12 | 
            +
            "     .          ",
         | 
| 13 | 
            +
            "     ......     ",
         | 
| 14 | 
            +
            "     .          ",
         | 
| 15 | 
            +
            "     .          ",
         | 
| 16 | 
            +
            "     .          ",
         | 
| 17 | 
            +
            "     .          ",
         | 
| 18 | 
            +
            "     .          ",
         | 
| 19 | 
            +
            "                ",
         | 
| 20 | 
            +
            "                ",
         | 
| 21 | 
            +
            "                "};
         | 
    
        data/lib/json/Hash.xpm
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            /* XPM */
         | 
| 2 | 
            +
            static char * Hash_xpm[] = {
         | 
| 3 | 
            +
            "16 16 2 1",
         | 
| 4 | 
            +
            " 	c None",
         | 
| 5 | 
            +
            ".	c #000000",
         | 
| 6 | 
            +
            "                ",
         | 
| 7 | 
            +
            "                ",
         | 
| 8 | 
            +
            "                ",
         | 
| 9 | 
            +
            "       .  .     ",
         | 
| 10 | 
            +
            "       .  .     ",
         | 
| 11 | 
            +
            "       .  .     ",
         | 
| 12 | 
            +
            "    .........   ",
         | 
| 13 | 
            +
            "      .  .      ",
         | 
| 14 | 
            +
            "      .  .      ",
         | 
| 15 | 
            +
            "   .........    ",
         | 
| 16 | 
            +
            "     .  .       ",
         | 
| 17 | 
            +
            "     .  .       ",
         | 
| 18 | 
            +
            "     .  .       ",
         | 
| 19 | 
            +
            "                ",
         | 
| 20 | 
            +
            "                ",
         | 
| 21 | 
            +
            "                "};
         | 
    
        data/lib/json/Key.xpm
    ADDED
    
    | @@ -0,0 +1,73 @@ | |
| 1 | 
            +
            /* XPM */
         | 
| 2 | 
            +
            static char * Key_xpm[] = {
         | 
| 3 | 
            +
            "16 16 54 1",
         | 
| 4 | 
            +
            " 	c None",
         | 
| 5 | 
            +
            ".	c #110007",
         | 
| 6 | 
            +
            "+	c #0E0900",
         | 
| 7 | 
            +
            "@	c #000013",
         | 
| 8 | 
            +
            "#	c #070600",
         | 
| 9 | 
            +
            "$	c #F6F006",
         | 
| 10 | 
            +
            "%	c #ECE711",
         | 
| 11 | 
            +
            "&	c #E5EE00",
         | 
| 12 | 
            +
            "*	c #16021E",
         | 
| 13 | 
            +
            "=	c #120900",
         | 
| 14 | 
            +
            "-	c #EDF12B",
         | 
| 15 | 
            +
            ";	c #000033",
         | 
| 16 | 
            +
            ">	c #0F0000",
         | 
| 17 | 
            +
            ",	c #FFFE03",
         | 
| 18 | 
            +
            "'	c #E6E500",
         | 
| 19 | 
            +
            ")	c #16021B",
         | 
| 20 | 
            +
            "!	c #F7F502",
         | 
| 21 | 
            +
            "~	c #000E00",
         | 
| 22 | 
            +
            "{	c #130000",
         | 
| 23 | 
            +
            "]	c #FFF000",
         | 
| 24 | 
            +
            "^	c #FFE711",
         | 
| 25 | 
            +
            "/	c #140005",
         | 
| 26 | 
            +
            "(	c #190025",
         | 
| 27 | 
            +
            "_	c #E9DD27",
         | 
| 28 | 
            +
            ":	c #E7DC04",
         | 
| 29 | 
            +
            "<	c #FFEC09",
         | 
| 30 | 
            +
            "[	c #FFE707",
         | 
| 31 | 
            +
            "}	c #FFDE10",
         | 
| 32 | 
            +
            "|	c #150021",
         | 
| 33 | 
            +
            "1	c #160700",
         | 
| 34 | 
            +
            "2	c #FAF60E",
         | 
| 35 | 
            +
            "3	c #EFE301",
         | 
| 36 | 
            +
            "4	c #FEF300",
         | 
| 37 | 
            +
            "5	c #E7E000",
         | 
| 38 | 
            +
            "6	c #FFFF08",
         | 
| 39 | 
            +
            "7	c #0E0206",
         | 
| 40 | 
            +
            "8	c #040000",
         | 
| 41 | 
            +
            "9	c #03052E",
         | 
| 42 | 
            +
            "0	c #041212",
         | 
| 43 | 
            +
            "a	c #070300",
         | 
| 44 | 
            +
            "b	c #F2E713",
         | 
| 45 | 
            +
            "c	c #F9DE13",
         | 
| 46 | 
            +
            "d	c #36091E",
         | 
| 47 | 
            +
            "e	c #00001C",
         | 
| 48 | 
            +
            "f	c #1F0010",
         | 
| 49 | 
            +
            "g	c #FFF500",
         | 
| 50 | 
            +
            "h	c #DEDE00",
         | 
| 51 | 
            +
            "i	c #050A00",
         | 
| 52 | 
            +
            "j	c #FAF14A",
         | 
| 53 | 
            +
            "k	c #F5F200",
         | 
| 54 | 
            +
            "l	c #040404",
         | 
| 55 | 
            +
            "m	c #1A0D00",
         | 
| 56 | 
            +
            "n	c #EDE43D",
         | 
| 57 | 
            +
            "o	c #ECE007",
         | 
| 58 | 
            +
            "                ",
         | 
| 59 | 
            +
            "                ",
         | 
| 60 | 
            +
            "    .+@         ",
         | 
| 61 | 
            +
            "   #$%&*        ",
         | 
| 62 | 
            +
            "  =-;>,')       ",
         | 
| 63 | 
            +
            "  >!~{]^/       ",
         | 
| 64 | 
            +
            "  (_:<[}|       ",
         | 
| 65 | 
            +
            "   1234567      ",
         | 
| 66 | 
            +
            "    890abcd     ",
         | 
| 67 | 
            +
            "       efghi    ",
         | 
| 68 | 
            +
            "         >jkl   ",
         | 
| 69 | 
            +
            "          mnol  ",
         | 
| 70 | 
            +
            "           >kl  ",
         | 
| 71 | 
            +
            "            ll  ",
         | 
| 72 | 
            +
            "                ",
         | 
| 73 | 
            +
            "                "};
         | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            /* XPM */
         | 
| 2 | 
            +
            static char * False_xpm[] = {
         | 
| 3 | 
            +
            "16 16 2 1",
         | 
| 4 | 
            +
            " 	c None",
         | 
| 5 | 
            +
            ".	c #000000",
         | 
| 6 | 
            +
            "                ",
         | 
| 7 | 
            +
            "                ",
         | 
| 8 | 
            +
            "                ",
         | 
| 9 | 
            +
            "       ...      ",
         | 
| 10 | 
            +
            "      .   .     ",
         | 
| 11 | 
            +
            "     .     .    ",
         | 
| 12 | 
            +
            "     .     .    ",
         | 
| 13 | 
            +
            "     .     .    ",
         | 
| 14 | 
            +
            "     .     .    ",
         | 
| 15 | 
            +
            "     .     .    ",
         | 
| 16 | 
            +
            "     .     .    ",
         | 
| 17 | 
            +
            "      .   .     ",
         | 
| 18 | 
            +
            "       ...      ",
         | 
| 19 | 
            +
            "                ",
         | 
| 20 | 
            +
            "                ",
         | 
| 21 | 
            +
            "                "};
         | 
| @@ -0,0 +1,28 @@ | |
| 1 | 
            +
            /* XPM */
         | 
| 2 | 
            +
            static char * Numeric_xpm[] = {
         | 
| 3 | 
            +
            "16 16 9 1",
         | 
| 4 | 
            +
            " 	c None",
         | 
| 5 | 
            +
            ".	c #FF0000",
         | 
| 6 | 
            +
            "+	c #0000FF",
         | 
| 7 | 
            +
            "@	c #0023DB",
         | 
| 8 | 
            +
            "#	c #00EA14",
         | 
| 9 | 
            +
            "$	c #00FF00",
         | 
| 10 | 
            +
            "%	c #004FAF",
         | 
| 11 | 
            +
            "&	c #0028D6",
         | 
| 12 | 
            +
            "*	c #00F20C",
         | 
| 13 | 
            +
            "                ",
         | 
| 14 | 
            +
            "                ",
         | 
| 15 | 
            +
            "                ",
         | 
| 16 | 
            +
            " ... +++@#$$$$  ",
         | 
| 17 | 
            +
            "   .+   %&   $$ ",
         | 
| 18 | 
            +
            "   .     +    $ ",
         | 
| 19 | 
            +
            "   .     +   $$ ",
         | 
| 20 | 
            +
            "   .    ++$$$$  ",
         | 
| 21 | 
            +
            "   .    +    $$ ",
         | 
| 22 | 
            +
            "   .   +      $ ",
         | 
| 23 | 
            +
            "   .  +       $ ",
         | 
| 24 | 
            +
            "   . +  $    $$ ",
         | 
| 25 | 
            +
            " .....++++*$$   ",
         | 
| 26 | 
            +
            "                ",
         | 
| 27 | 
            +
            "                ",
         | 
| 28 | 
            +
            "                "};
         | 
    
        data/lib/json/String.xpm
    ADDED
    
    | @@ -0,0 +1,96 @@ | |
| 1 | 
            +
            /* XPM */
         | 
| 2 | 
            +
            static char * String_xpm[] = {
         | 
| 3 | 
            +
            "16 16 77 1",
         | 
| 4 | 
            +
            " 	c None",
         | 
| 5 | 
            +
            ".	c #000000",
         | 
| 6 | 
            +
            "+	c #040404",
         | 
| 7 | 
            +
            "@	c #080806",
         | 
| 8 | 
            +
            "#	c #090606",
         | 
| 9 | 
            +
            "$	c #EEEAE1",
         | 
| 10 | 
            +
            "%	c #E7E3DA",
         | 
| 11 | 
            +
            "&	c #E0DBD1",
         | 
| 12 | 
            +
            "*	c #D4B46F",
         | 
| 13 | 
            +
            "=	c #0C0906",
         | 
| 14 | 
            +
            "-	c #E3C072",
         | 
| 15 | 
            +
            ";	c #E4C072",
         | 
| 16 | 
            +
            ">	c #060505",
         | 
| 17 | 
            +
            ",	c #0B0A08",
         | 
| 18 | 
            +
            "'	c #D5B264",
         | 
| 19 | 
            +
            ")	c #D3AF5A",
         | 
| 20 | 
            +
            "!	c #080602",
         | 
| 21 | 
            +
            "~	c #E1B863",
         | 
| 22 | 
            +
            "{	c #DDB151",
         | 
| 23 | 
            +
            "]	c #DBAE4A",
         | 
| 24 | 
            +
            "^	c #DDB152",
         | 
| 25 | 
            +
            "/	c #DDB252",
         | 
| 26 | 
            +
            "(	c #070705",
         | 
| 27 | 
            +
            "_	c #0C0A07",
         | 
| 28 | 
            +
            ":	c #D3A33B",
         | 
| 29 | 
            +
            "<	c #020201",
         | 
| 30 | 
            +
            "[	c #DAAA41",
         | 
| 31 | 
            +
            "}	c #040302",
         | 
| 32 | 
            +
            "|	c #E4D9BF",
         | 
| 33 | 
            +
            "1	c #0B0907",
         | 
| 34 | 
            +
            "2	c #030201",
         | 
| 35 | 
            +
            "3	c #020200",
         | 
| 36 | 
            +
            "4	c #C99115",
         | 
| 37 | 
            +
            "5	c #080704",
         | 
| 38 | 
            +
            "6	c #DBC8A2",
         | 
| 39 | 
            +
            "7	c #E7D7B4",
         | 
| 40 | 
            +
            "8	c #E0CD9E",
         | 
| 41 | 
            +
            "9	c #080601",
         | 
| 42 | 
            +
            "0	c #040400",
         | 
| 43 | 
            +
            "a	c #010100",
         | 
| 44 | 
            +
            "b	c #0B0B08",
         | 
| 45 | 
            +
            "c	c #DCBF83",
         | 
| 46 | 
            +
            "d	c #DCBC75",
         | 
| 47 | 
            +
            "e	c #DEB559",
         | 
| 48 | 
            +
            "f	c #040301",
         | 
| 49 | 
            +
            "g	c #BC8815",
         | 
| 50 | 
            +
            "h	c #120E07",
         | 
| 51 | 
            +
            "i	c #060402",
         | 
| 52 | 
            +
            "j	c #0A0804",
         | 
| 53 | 
            +
            "k	c #D4A747",
         | 
| 54 | 
            +
            "l	c #D6A12F",
         | 
| 55 | 
            +
            "m	c #0E0C05",
         | 
| 56 | 
            +
            "n	c #C8C1B0",
         | 
| 57 | 
            +
            "o	c #1D1B15",
         | 
| 58 | 
            +
            "p	c #D7AD51",
         | 
| 59 | 
            +
            "q	c #070502",
         | 
| 60 | 
            +
            "r	c #080804",
         | 
| 61 | 
            +
            "s	c #BC953B",
         | 
| 62 | 
            +
            "t	c #C4BDAD",
         | 
| 63 | 
            +
            "u	c #0B0807",
         | 
| 64 | 
            +
            "v	c #DBAC47",
         | 
| 65 | 
            +
            "w	c #1B150A",
         | 
| 66 | 
            +
            "x	c #B78A2C",
         | 
| 67 | 
            +
            "y	c #D8A83C",
         | 
| 68 | 
            +
            "z	c #D4A338",
         | 
| 69 | 
            +
            "A	c #0F0B03",
         | 
| 70 | 
            +
            "B	c #181105",
         | 
| 71 | 
            +
            "C	c #C59325",
         | 
| 72 | 
            +
            "D	c #C18E1F",
         | 
| 73 | 
            +
            "E	c #060600",
         | 
| 74 | 
            +
            "F	c #CC992D",
         | 
| 75 | 
            +
            "G	c #B98B25",
         | 
| 76 | 
            +
            "H	c #B3831F",
         | 
| 77 | 
            +
            "I	c #C08C1C",
         | 
| 78 | 
            +
            "J	c #060500",
         | 
| 79 | 
            +
            "K	c #0E0C03",
         | 
| 80 | 
            +
            "L	c #0D0A00",
         | 
| 81 | 
            +
            "                ",
         | 
| 82 | 
            +
            "   .+@#         ",
         | 
| 83 | 
            +
            "  .$%&*=        ",
         | 
| 84 | 
            +
            " .-;>,')!       ",
         | 
| 85 | 
            +
            " .~.  .{].      ",
         | 
| 86 | 
            +
            " .^/. (_:<      ",
         | 
| 87 | 
            +
            "  .[.}|$12      ",
         | 
| 88 | 
            +
            "   345678}90    ",
         | 
| 89 | 
            +
            "    a2bcdefgh   ",
         | 
| 90 | 
            +
            "      ijkl.mno  ",
         | 
| 91 | 
            +
            "      <pq. rstu ",
         | 
| 92 | 
            +
            "      .]v.  wx= ",
         | 
| 93 | 
            +
            "       .yzABCDE ",
         | 
| 94 | 
            +
            "        .FGHIJ  ",
         | 
| 95 | 
            +
            "         0KL0   ",
         | 
| 96 | 
            +
            "                "};
         |