head 1.4; access; symbols OPENPKG_E1_MP_HEAD:1.2 OPENPKG_E1_MP:1.2 OPENPKG_E1_MP_2_STABLE:1.2.2.2 OPENPKG_E1_FP:1.2.2.2 OPENPKG_2_STABLE_MP:1.2 OPENPKG_2_STABLE_20061018:1.2.2.2 OPENPKG_2_STABLE:1.2.0.2; locks; strict; comment @# @; 1.4 date 2009.11.18.19.08.25; author rse; state Exp; branches; next 1.3; commitid vC2hqSla03to92cu; 1.3 date 2007.03.12.13.53.07; author rse; state dead; branches; next 1.2; commitid AQrsvAzHl22gYN9s; 1.2 date 2006.10.16.06.21.56; author rse; state Exp; branches 1.2.2.1; next 1.1; commitid DBC9r33qUtIqcSQr; 1.1 date 2006.06.29.06.42.33; author rse; state Exp; branches; next ; commitid 6Z7l9hECK36JORCr; 1.2.2.1 date 2006.10.16.06.21.56; author rse; state dead; branches; next 1.2.2.2; commitid iZxwRSmmWscPXUQr; 1.2.2.2 date 2006.10.16.14.51.29; author rse; state Exp; branches; next ; commitid iZxwRSmmWscPXUQr; desc @@ 1.4 log @modifying package: json-20090929 20091115 -> 20091118 @ text @Index: zzjson-1.1.0/src/zzjson_parse.c --- zzjson-1.1.0/src/zzjson_parse.c.orig 2009-08-16 02:49:38 +0200 +++ zzjson-1.1.0/src/zzjson_parse.c 2009-11-18 19:49:55 +0100 @@@@ -9,6 +9,7 @@@@ #include #include +#undef getchar #define GETC() config->getchar(config->ihandle) #define UNGETC(c) config->ungetchar(c, config->ihandle) #define SKIPWS() skipws(config) @ 1.3 log @upgrade JSON JavaScript part and add new JSON::DWIW module @ text @d1 11 a11 69 Index: json.js --- json.js.orig 2006-10-16 08:16:54 +0200 +++ json.js 2006-10-16 08:20:19 +0200 @@@@ -4,16 +4,19 @@@@ This file adds these methods to JavaScript: + JSON.encode(object) object.toJSONString() This method produces a JSON text from an object. The object must not contain any cyclical references. + JSON.encode(array) array.toJSONString() This method produces a JSON text from an array. The array must not contain any cyclical references. + JSON.decode(string) string.parseJSON() This method parses a JSON text to produce an object or @@@@ -23,7 +26,8 @@@@ JavaScript Programming Language in the Fourth Edition of the ECMAScript standard. */ -(function () { +var JSON = {}; +JSON.encode = function (obj) { var m = { '\b': '\\b', '\t': '\\t', @@@@ -103,21 +107,22 @@@@ return '"' + x + '"'; } }; - - Object.prototype.toJSONString = function () { - return s.object(this); - }; - - Array.prototype.toJSONString = function () { - return s.array(this); - }; -})(); - -String.prototype.parseJSON = function () { + return s.object(obj); +}; +JSON.decode = function (str) { try { - return (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(this)) && - eval('(' + this + ')'); + return (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(str)) && + eval('(' + str + ')'); } catch (e) { return false; } }; +String.prototype.parseJSON = function () { + return JSON.decode(this); +}; +Object.prototype.toJSONString = function () { + return JSON.encode(this); +}; +Array.prototype.toJSONString = function () { + return JSON.encode(this); +}; @ 1.2 log @upgrading package: json 20060629 -> 20061016 @ text @@ 1.2.2.1 log @file json.patch was added on branch OPENPKG_2_STABLE on 2006-10-16 14:51:29 +0000 @ text @d1 69 @ 1.2.2.2 log @Mass merge from CURRENT to 2-STABLE (all packages except those of JUNK class) @ text @a0 69 Index: json.js --- json.js.orig 2006-10-16 08:16:54 +0200 +++ json.js 2006-10-16 08:20:19 +0200 @@@@ -4,16 +4,19 @@@@ This file adds these methods to JavaScript: + JSON.encode(object) object.toJSONString() This method produces a JSON text from an object. The object must not contain any cyclical references. + JSON.encode(array) array.toJSONString() This method produces a JSON text from an array. The array must not contain any cyclical references. + JSON.decode(string) string.parseJSON() This method parses a JSON text to produce an object or @@@@ -23,7 +26,8 @@@@ JavaScript Programming Language in the Fourth Edition of the ECMAScript standard. */ -(function () { +var JSON = {}; +JSON.encode = function (obj) { var m = { '\b': '\\b', '\t': '\\t', @@@@ -103,21 +107,22 @@@@ return '"' + x + '"'; } }; - - Object.prototype.toJSONString = function () { - return s.object(this); - }; - - Array.prototype.toJSONString = function () { - return s.array(this); - }; -})(); - -String.prototype.parseJSON = function () { + return s.object(obj); +}; +JSON.decode = function (str) { try { - return (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(this)) && - eval('(' + this + ')'); + return (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(str)) && + eval('(' + str + ')'); } catch (e) { return false; } }; +String.prototype.parseJSON = function () { + return JSON.decode(this); +}; +Object.prototype.toJSONString = function () { + return JSON.encode(this); +}; +Array.prototype.toJSONString = function () { + return JSON.encode(this); +}; @ 1.1 log @The JSON JavaScript interface is very elegant but breaks at least Yahoo User Interface library and all similar code which iterates over all properties of an object or array. So, provide an explicit JSON.{encode,decode}() interface which always exist and let applications just delete the overloaded String/Object/Array methods if required. @ text @d2 3 a4 3 --- json.js.orig 2006-06-29 08:25:57 +0200 +++ json.js 2006-06-29 08:36:15 +0200 @@@@ -4,22 +4,28 @@@@ d24 3 a26 1 array. It will return false if there is an error. a28 1 + a29 1 + d34 1 a34 1 @@@@ -99,22 +105,28 @@@@ d38 1 a38 3 + return s.object(obj); +}; d49 2 d53 1 a53 2 return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( - this.replace(/"(\\.|[^"\\])*"/g, ''))) && d55 1 a55 1 + str.replace(/"(\\.|[^"\\])*"/g, ''))) && a60 1 + a63 1 + a66 1 + a69 1 + @