Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/ab0adbca6459
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 01:22:20 2012
Кодировка:
allpy: ab0adbca6459

allpy

changeset 857:ab0adbca6459

Removed some downloaded files from blocks3d/www (see #93)
author Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru>
date Thu, 21 Jul 2011 14:50:20 +0400
parents a5fa8ab4622f
children d1a3d3ee0843
files blocks3d/www/Makefile blocks3d/www/input/crc32.js blocks3d/www/input/dechex.js blocks3d/www/input/json2.js
diffstat 4 files changed, 20 insertions(+), 545 deletions(-) [+]
line diff
     1.1 --- a/blocks3d/www/Makefile	Thu Jul 21 14:23:12 2011 +0400
     1.2 +++ b/blocks3d/www/Makefile	Thu Jul 21 14:50:20 2011 +0400
     1.3 @@ -1,7 +1,23 @@
     1.4 +build: input/conservative_groups.js input/crc32.js input/dechex.js input/json2.js
     1.5 +	mkdir -p output
     1.6 +	r2w
     1.7  
     1.8 -build:
     1.9 -	mkdir -p output
    1.10 -	python ../../sequence_based_blocks_search/functional_groups_to_javascript.py > input/conservative_groups.js
    1.11 -	r2w
    1.12 +test: build
    1.13  	python test.py > output/test.html
    1.14  
    1.15 +input/conservative_groups.js:
    1.16 +	python \
    1.17 +		../../sequence_based_blocks_search/functional_groups_to_javascript.py \
    1.18 +		> $@
    1.19 +
    1.20 +input/crc32.js:
    1.21 +	wget -O $@ \
    1.22 +		http://github.com/kvz/phpjs/raw/master/functions/strings/crc32.js
    1.23 +
    1.24 +input/dechex.js:
    1.25 +	wget -O $@ \
    1.26 +		https://raw.github.com/kvz/phpjs/master/functions/math/dechex.js
    1.27 +
    1.28 +input/json2.js:
    1.29 +	wget -O $@ \
    1.30 +		https://raw.github.com/douglascrockford/JSON-js/master/json2.js
     2.1 --- a/blocks3d/www/input/crc32.js	Thu Jul 21 14:23:12 2011 +0400
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,27 +0,0 @@
     2.4 -
     2.5 -function crc32 ( str ) {
     2.6 -    // http://kevin.vanzonneveld.net
     2.7 -    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
     2.8 -    // +   improved by: T0bsn
     2.9 -    // -    depends on: utf8_encode
    2.10 -    // *     example 1: crc32('Kevin van Zonneveld');
    2.11 -    // *     returns 1: 1249991249
    2.12 -
    2.13 -    //str = this.utf8_encode(str); // commented by bnagaev
    2.14 -
    2.15 -    var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
    2.16 -
    2.17 -    var crc = 0;
    2.18 -    var x = 0;
    2.19 -    var y = 0;
    2.20 -
    2.21 -    crc = crc ^ (-1);
    2.22 -    for (var i = 0, iTop = str.length; i < iTop; i++) {
    2.23 -        y = ( crc ^ str.charCodeAt( i ) ) & 0xFF;
    2.24 -        x = "0x" + table.substr( y * 9, 8 );
    2.25 -        crc = ( crc >>> 8 ) ^ x;
    2.26 -    }
    2.27 -
    2.28 -    return crc ^ (-1);
    2.29 -}
    2.30 -
     3.1 --- a/blocks3d/www/input/dechex.js	Thu Jul 21 14:23:12 2011 +0400
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,19 +0,0 @@
     3.4 -
     3.5 -function dechex (number) {
     3.6 -    // http://kevin.vanzonneveld.net
     3.7 -    // +   original by: Philippe Baumann
     3.8 -    // +   bugfixed by: Onno Marsman
     3.9 -    // +   improved by: http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript
    3.10 -    // +   input by: pilus
    3.11 -    // *     example 1: dechex(10);
    3.12 -    // *     returns 1: 'a'
    3.13 -    // *     example 2: dechex(47);
    3.14 -    // *     returns 2: '2f'
    3.15 -    // *     example 3: dechex(-1415723993);
    3.16 -    // *     returns 3: 'ab9dc427'
    3.17 -    if (number < 0) {
    3.18 -        number = 0xFFFFFFFF + number + 1;
    3.19 -    }
    3.20 -    return parseInt(number, 10).toString(16);
    3.21 -}
    3.22 -
     4.1 --- a/blocks3d/www/input/json2.js	Thu Jul 21 14:23:12 2011 +0400
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,495 +0,0 @@
     4.4 -/*
     4.5 -    http://www.JSON.org/json2.js
     4.6 -    2009-06-29
     4.7 -
     4.8 -    Public Domain.
     4.9 -
    4.10 -    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
    4.11 -
    4.12 -    See http://www.JSON.org/js.html
    4.13 -
    4.14 -    This file creates a global JSON object containing two methods: stringify
    4.15 -    and parse.
    4.16 -
    4.17 -        JSON.stringify(value, replacer, space)
    4.18 -            value       any JavaScript value, usually an object or array.
    4.19 -
    4.20 -            replacer    an optional parameter that determines how object
    4.21 -                        values are stringified for objects. It can be a
    4.22 -                        function or an array of strings.
    4.23 -
    4.24 -            space       an optional parameter that specifies the indentation
    4.25 -                        of nested structures. If it is omitted, the text will
    4.26 -                        be packed without extra whitespace. If it is a number,
    4.27 -                        it will specify the number of spaces to indent at each
    4.28 -                        level. If it is a string (such as '\t' or '&nbsp;'),
    4.29 -                        it contains the characters used to indent at each level.
    4.30 -
    4.31 -            This method produces a JSON text from a JavaScript value.
    4.32 -
    4.33 -            When an object value is found, if the object contains a toJSON
    4.34 -            method, its toJSON method will be called and the result will be
    4.35 -            stringified. A toJSON method does not serialize: it returns the
    4.36 -            value represented by the name/value pair that should be serialized,
    4.37 -            or undefined if nothing should be serialized. The toJSON method
    4.38 -            will be passed the key associated with the value, and this will be
    4.39 -            bound to the object holding the key.
    4.40 -
    4.41 -            For example, this would serialize Dates as ISO strings.
    4.42 -
    4.43 -                Date.prototype.toJSON = function (key) {
    4.44 -                    function f(n) {
    4.45 -                        // Format integers to have at least two digits.
    4.46 -                        return n < 10 ? '0' + n : n;
    4.47 -                    }
    4.48 -
    4.49 -                    return this.getUTCFullYear()   + '-' +
    4.50 -                         f(this.getUTCMonth() + 1) + '-' +
    4.51 -                         f(this.getUTCDate())      + 'T' +
    4.52 -                         f(this.getUTCHours())     + ':' +
    4.53 -                         f(this.getUTCMinutes())   + ':' +
    4.54 -                         f(this.getUTCSeconds())   + 'Z';
    4.55 -                };
    4.56 -
    4.57 -            You can provide an optional replacer method. It will be passed the
    4.58 -            key and value of each member, with this bound to the containing
    4.59 -            object. The value that is returned from your method will be
    4.60 -            serialized. If your method returns undefined, then the member will
    4.61 -            be excluded from the serialization.
    4.62 -
    4.63 -            If the replacer parameter is an array of strings, then it will be
    4.64 -            used to select the members to be serialized. It filters the results
    4.65 -            such that only members with keys listed in the replacer array are
    4.66 -            stringified.
    4.67 -
    4.68 -            Values that do not have JSON representations, such as undefined or
    4.69 -            functions, will not be serialized. Such values in objects will be
    4.70 -            dropped; in arrays they will be replaced with null. You can use
    4.71 -            a replacer function to replace those with JSON values.
    4.72 -            JSON.stringify(undefined) returns undefined.
    4.73 -
    4.74 -            The optional space parameter produces a stringification of the
    4.75 -            value that is filled with line breaks and indentation to make it
    4.76 -            easier to read.
    4.77 -
    4.78 -            If the space parameter is a non-empty string, then that string will
    4.79 -            be used for indentation. If the space parameter is a number, then
    4.80 -            the indentation will be that many spaces.
    4.81 -
    4.82 -            Example:
    4.83 -
    4.84 -            text = JSON.stringify(['e', {pluribus: 'unum'}]);
    4.85 -            // text is '["e",{"pluribus":"unum"}]'
    4.86 -
    4.87 -
    4.88 -            text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
    4.89 -            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
    4.90 -
    4.91 -            text = JSON.stringify([new Date()], function (key, value) {
    4.92 -                return this[key] instanceof Date ?
    4.93 -                    'Date(' + this[key] + ')' : value;
    4.94 -            });
    4.95 -            // text is '["Date(---current time---)"]'
    4.96 -
    4.97 -
    4.98 -        JSON.parse(text, reviver)
    4.99 -            This method parses a JSON text to produce an object or array.
   4.100 -            It can throw a SyntaxError exception.
   4.101 -
   4.102 -            The optional reviver parameter is a function that can filter and
   4.103 -            transform the results. It receives each of the keys and values,
   4.104 -            and its return value is used instead of the original value.
   4.105 -            If it returns what it received, then the structure is not modified.
   4.106 -            If it returns undefined then the member is deleted.
   4.107 -
   4.108 -            Example:
   4.109 -
   4.110 -            // Parse the text. Values that look like ISO date strings will
   4.111 -            // be converted to Date objects.
   4.112 -
   4.113 -            myData = JSON.parse(text, function (key, value) {
   4.114 -                var a;
   4.115 -                if (typeof value === 'string') {
   4.116 -                    a =
   4.117 -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
   4.118 -                    if (a) {
   4.119 -                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
   4.120 -                            +a[5], +a[6]));
   4.121 -                    }
   4.122 -                }
   4.123 -                return value;
   4.124 -            });
   4.125 -
   4.126 -            myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
   4.127 -                var d;
   4.128 -                if (typeof value === 'string' &&
   4.129 -                        value.slice(0, 5) === 'Date(' &&
   4.130 -                        value.slice(-1) === ')') {
   4.131 -                    d = new Date(value.slice(5, -1));
   4.132 -                    if (d) {
   4.133 -                        return d;
   4.134 -                    }
   4.135 -                }
   4.136 -                return value;
   4.137 -            });
   4.138 -
   4.139 -
   4.140 -    This is a reference implementation. You are free to copy, modify, or
   4.141 -    redistribute.
   4.142 -
   4.143 -    This code should be minified before deployment.
   4.144 -    See http://javascript.crockford.com/jsmin.html
   4.145 -
   4.146 -    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
   4.147 -    NOT CONTROL.
   4.148 -*/
   4.149 -
   4.150 -/*jslint evil: true */
   4.151 -
   4.152 -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
   4.153 -    call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
   4.154 -    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
   4.155 -    lastIndex, length, parse, prototype, push, replace, slice, stringify,
   4.156 -    test, toJSON, toString, valueOf
   4.157 -*/
   4.158 -
   4.159 -// Create a JSON object only if one does not already exist. We create the
   4.160 -// methods in a closure to avoid creating global variables.
   4.161 -
   4.162 -var JSON = JSON || {};
   4.163 -
   4.164 -(function () {
   4.165 -
   4.166 -    function f(n) {
   4.167 -        // Format integers to have at least two digits.
   4.168 -        return n < 10 ? '0' + n : n;
   4.169 -    }
   4.170 -
   4.171 -    if (typeof Date.prototype.toJSON !== 'function') {
   4.172 -
   4.173 -        Date.prototype.toJSON = function (key) {
   4.174 -
   4.175 -            return isFinite(this.valueOf()) ?
   4.176 -                   this.getUTCFullYear()   + '-' +
   4.177 -                 f(this.getUTCMonth() + 1) + '-' +
   4.178 -                 f(this.getUTCDate())      + 'T' +
   4.179 -                 f(this.getUTCHours())     + ':' +
   4.180 -                 f(this.getUTCMinutes())   + ':' +
   4.181 -                 f(this.getUTCSeconds())   + 'Z' : null;
   4.182 -        };
   4.183 -
   4.184 -        String.prototype.toJSON =
   4.185 -        Number.prototype.toJSON =
   4.186 -        Boolean.prototype.toJSON = function (key) {
   4.187 -            return this.valueOf();
   4.188 -        };
   4.189 -    }
   4.190 -
   4.191 -    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
   4.192 -        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
   4.193 -        gap,
   4.194 -        indent,
   4.195 -        meta = {    // table of character substitutions
   4.196 -            '\b': '\\b',
   4.197 -            '\t': '\\t',
   4.198 -            '\n': '\\n',
   4.199 -            '\f': '\\f',
   4.200 -            '\r': '\\r',
   4.201 -            '"' : '\\"',
   4.202 -            '\\': '\\\\'
   4.203 -        },
   4.204 -        rep;
   4.205 -
   4.206 -
   4.207 -    function quote(string) {
   4.208 -
   4.209 -// If the string contains no control characters, no quote characters, and no
   4.210 -// backslash characters, then we can safely slap some quotes around it.
   4.211 -// Otherwise we must also replace the offending characters with safe escape
   4.212 -// sequences.
   4.213 -
   4.214 -        escapable.lastIndex = 0;
   4.215 -        return escapable.test(string) ?
   4.216 -            '"' + string.replace(escapable, function (a) {
   4.217 -                var c = meta[a];
   4.218 -                return typeof c === 'string' ? c :
   4.219 -                    '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
   4.220 -            }) + '"' :
   4.221 -            '"' + string + '"';
   4.222 -    }
   4.223 -
   4.224 -
   4.225 -    function str(key, holder) {
   4.226 -
   4.227 -// Produce a string from holder[key].
   4.228 -
   4.229 -        var i,          // The loop counter.
   4.230 -            k,          // The member key.
   4.231 -            v,          // The member value.
   4.232 -            length,
   4.233 -            mind = gap,
   4.234 -            partial,
   4.235 -            value = holder[key];
   4.236 -
   4.237 -// If the value has a toJSON method, call it to obtain a replacement value.
   4.238 -
   4.239 -        if (value && typeof value === 'object' &&
   4.240 -                typeof value.toJSON === 'function') {
   4.241 -            value = value.toJSON(key);
   4.242 -        }
   4.243 -
   4.244 -// If we were called with a replacer function, then call the replacer to
   4.245 -// obtain a replacement value.
   4.246 -
   4.247 -        if (typeof rep === 'function') {
   4.248 -            value = rep.call(holder, key, value);
   4.249 -        }
   4.250 -
   4.251 -// What happens next depends on the value's type.
   4.252 -
   4.253 -        switch (typeof value) {
   4.254 -        case 'string':
   4.255 -            return quote(value);
   4.256 -
   4.257 -        case 'number':
   4.258 -
   4.259 -// JSON numbers must be finite. Encode non-finite numbers as null.
   4.260 -
   4.261 -            return isFinite(value) ? String(value) : 'null';
   4.262 -
   4.263 -        case 'boolean':
   4.264 -        case 'null':
   4.265 -
   4.266 -// If the value is a boolean or null, convert it to a string. Note:
   4.267 -// typeof null does not produce 'null'. The case is included here in
   4.268 -// the remote chance that this gets fixed someday.
   4.269 -
   4.270 -            return String(value);
   4.271 -
   4.272 -// If the type is 'object', we might be dealing with an object or an array or
   4.273 -// null.
   4.274 -
   4.275 -        case 'object':
   4.276 -
   4.277 -// Due to a specification blunder in ECMAScript, typeof null is 'object',
   4.278 -// so watch out for that case.
   4.279 -
   4.280 -            if (!value) {
   4.281 -                return 'null';
   4.282 -            }
   4.283 -
   4.284 -// Make an array to hold the partial results of stringifying this object value.
   4.285 -
   4.286 -            gap += indent;
   4.287 -            partial = [];
   4.288 -
   4.289 -// Is the value an array?
   4.290 -
   4.291 -            if (Object.prototype.toString.apply(value) === '[object Array]') {
   4.292 -
   4.293 -// The value is an array. Stringify every element. Use null as a placeholder
   4.294 -// for non-JSON values.
   4.295 -
   4.296 -                length = value.length;
   4.297 -                for (i = 0; i < length; i += 1) {
   4.298 -                    partial[i] = str(i, value) || 'null';
   4.299 -                }
   4.300 -
   4.301 -// Join all of the elements together, separated with commas, and wrap them in
   4.302 -// brackets.
   4.303 -
   4.304 -                v = partial.length === 0 ? '[]' :
   4.305 -                    gap ? '[\n' + gap +
   4.306 -                            partial.join(',\n' + gap) + '\n' +
   4.307 -                                mind + ']' :
   4.308 -                          '[' + partial.join(',') + ']';
   4.309 -                gap = mind;
   4.310 -                return v;
   4.311 -            }
   4.312 -
   4.313 -// If the replacer is an array, use it to select the members to be stringified.
   4.314 -
   4.315 -            if (rep && typeof rep === 'object') {
   4.316 -                length = rep.length;
   4.317 -                for (i = 0; i < length; i += 1) {
   4.318 -                    k = rep[i];
   4.319 -                    if (typeof k === 'string') {
   4.320 -                        v = str(k, value);
   4.321 -                        if (v) {
   4.322 -                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
   4.323 -                        }
   4.324 -                    }
   4.325 -                }
   4.326 -            } else {
   4.327 -
   4.328 -// Otherwise, iterate through all of the keys in the object.
   4.329 -
   4.330 -                for (k in value) {
   4.331 -                    if (Object.hasOwnProperty.call(value, k)) {
   4.332 -                        v = str(k, value);
   4.333 -                        if (v) {
   4.334 -                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
   4.335 -                        }
   4.336 -                    }
   4.337 -                }
   4.338 -            }
   4.339 -
   4.340 -// Join all of the member texts together, separated with commas,
   4.341 -// and wrap them in braces.
   4.342 -
   4.343 -            v = partial.length === 0 ? '{}' :
   4.344 -                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
   4.345 -                        mind + '}' : '{' + partial.join(',') + '}';
   4.346 -            gap = mind;
   4.347 -            return v;
   4.348 -        }
   4.349 -    }
   4.350 -
   4.351 -// If the JSON object does not yet have a stringify method, give it one.
   4.352 -
   4.353 -    if (typeof JSON.stringify !== 'function') {
   4.354 -        JSON.stringify = function (value, replacer, space) {
   4.355 -
   4.356 -// The stringify method takes a value and an optional replacer, and an optional
   4.357 -// space parameter, and returns a JSON text. The replacer can be a function
   4.358 -// that can replace values, or an array of strings that will select the keys.
   4.359 -// A default replacer method can be provided. Use of the space parameter can
   4.360 -// produce text that is more easily readable.
   4.361 -
   4.362 -            var i;
   4.363 -            gap = '';
   4.364 -            indent = '';
   4.365 -
   4.366 -// If the space parameter is a number, make an indent string containing that
   4.367 -// many spaces.
   4.368 -
   4.369 -            if (typeof space === 'number') {
   4.370 -                for (i = 0; i < space; i += 1) {
   4.371 -                    indent += ' ';
   4.372 -                }
   4.373 -
   4.374 -// If the space parameter is a string, it will be used as the indent string.
   4.375 -
   4.376 -            } else if (typeof space === 'string') {
   4.377 -                indent = space;
   4.378 -            }
   4.379 -
   4.380 -// If there is a replacer, it must be a function or an array.
   4.381 -// Otherwise, throw an error.
   4.382 -
   4.383 -            rep = replacer;
   4.384 -            if (replacer && typeof replacer !== 'function' &&
   4.385 -                    (typeof replacer !== 'object' ||
   4.386 -                     typeof replacer.length !== 'number')) {
   4.387 -                throw new Error('JSON.stringify');
   4.388 -            }
   4.389 -
   4.390 -// Make a fake root object containing our value under the key of ''.
   4.391 -// Return the result of stringifying the value.
   4.392 -
   4.393 -            return str('', {'': value});
   4.394 -        };
   4.395 -    }
   4.396 -
   4.397 -
   4.398 -// If the JSON object does not yet have a parse method, give it one.
   4.399 -
   4.400 -    if (typeof JSON.parse !== 'function') {
   4.401 -        JSON.parse = function (text, reviver) {
   4.402 -
   4.403 -// The parse method takes a text and an optional reviver function, and returns
   4.404 -// a JavaScript value if the text is a valid JSON text.
   4.405 -
   4.406 -            var j;
   4.407 -
   4.408 -            function walk(holder, key) {
   4.409 -
   4.410 -// The walk method is used to recursively walk the resulting structure so
   4.411 -// that modifications can be made.
   4.412 -
   4.413 -                var k, v, value = holder[key];
   4.414 -                if (value && typeof value === 'object') {
   4.415 -                    for (k in value) {
   4.416 -                        if (Object.hasOwnProperty.call(value, k)) {
   4.417 -                            v = walk(value, k);
   4.418 -                            if (v !== undefined) {
   4.419 -                                value[k] = v;
   4.420 -                            } else {
   4.421 -                                delete value[k];
   4.422 -                            }
   4.423 -                        }
   4.424 -                    }
   4.425 -                }
   4.426 -                return reviver.call(holder, key, value);
   4.427 -            }
   4.428 -
   4.429 -
   4.430 -// Parsing happens in four stages. In the first stage, we replace certain
   4.431 -// Unicode characters with escape sequences. JavaScript handles many characters
   4.432 -// incorrectly, either silently deleting them, or treating them as line endings.
   4.433 -
   4.434 -            cx.lastIndex = 0;
   4.435 -            if (cx.test(text)) {
   4.436 -                text = text.replace(cx, function (a) {
   4.437 -                    return '\\u' +
   4.438 -                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
   4.439 -                });
   4.440 -            }
   4.441 -
   4.442 -// In the second stage, we run the text against regular expressions that look
   4.443 -// for non-JSON patterns. We are especially concerned with '()' and 'new'
   4.444 -// because they can cause invocation, and '=' because it can cause mutation.
   4.445 -// But just to be safe, we want to reject all unexpected forms.
   4.446 -
   4.447 -// We split the second stage into 4 regexp operations in order to work around
   4.448 -// crippling inefficiencies in IE's and Safari's regexp engines. First we
   4.449 -// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
   4.450 -// replace all simple value tokens with ']' characters. Third, we delete all
   4.451 -// open brackets that follow a colon or comma or that begin the text. Finally,
   4.452 -// we look to see that the remaining characters are only whitespace or ']' or
   4.453 -// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
   4.454 -
   4.455 -            if (/^[\],:{}\s]*$/.
   4.456 -test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
   4.457 -replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
   4.458 -replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
   4.459 -
   4.460 -// In the third stage we use the eval function to compile the text into a
   4.461 -// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
   4.462 -// in JavaScript: it can begin a block or an object literal. We wrap the text
   4.463 -// in parens to eliminate the ambiguity.
   4.464 -
   4.465 -                j = eval('(' + text + ')');
   4.466 -
   4.467 -// In the optional fourth stage, we recursively walk the new structure, passing
   4.468 -// each name/value pair to a reviver function for possible transformation.
   4.469 -
   4.470 -                return typeof reviver === 'function' ?
   4.471 -                    walk({'': j}, '') : j;
   4.472 -            }
   4.473 -
   4.474 -// If the text is not JSON parseable, then a SyntaxError is thrown.
   4.475 -
   4.476 -            throw new SyntaxError('JSON.parse');
   4.477 -        };
   4.478 -    }
   4.479 -}());
   4.480 -
   4.481 -
   4.482 -
   4.483 -
   4.484 -// JSON
   4.485 -function json(obj7)
   4.486 -{
   4.487 -    if (typeof(obj7) == 'string')
   4.488 -    {
   4.489 -        // decode
   4.490 -        return JSON.parse(obj7);
   4.491 -    }
   4.492 -    else
   4.493 -    {
   4.494 -        // encode
   4.495 -        return JSON.stringify(obj7);
   4.496 -    }
   4.497 -}
   4.498 -