diff -r 8f9580309846 -r c8f47f0b6697 thirdparty/jsdoctoolkit/app/frame/Dumper.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/thirdparty/jsdoctoolkit/app/frame/Dumper.js Sun Oct 25 19:15:44 2009 +0000 @@ -0,0 +1,144 @@ +/** + * @class +
+This is a lightly modified version of Kevin Jones' JavaScript +library Data.Dump. To download the original visit: + http://openjsan.org/doc/k/ke/kevinj/Data/Dump/ + +AUTHORS + +The Data.Dump JavaScript module is written by Kevin Jones +(kevinj@cpan.org), based on Data::Dump by Gisle Aas (gisle@aas.no), +based on Data::Dumper by Gurusamy Sarathy (gsar@umich.edu). + +COPYRIGHT + +Copyright 2007 Kevin Jones. Copyright 1998-2000,2003-2004 Gisle Aas. +Copyright 1996-1998 Gurusamy Sarathy. + +This program is free software; you can redistribute it and/or modify +it under the terms of the Perl Artistic License + +See http://www.perl.com/perl/misc/Artistic.html ++ * @static + */ +Dumper = { + /** @param [...] The objects to dump. */ + dump: function () { + if (arguments.length > 1) + return this._dump(arguments); + else if (arguments.length == 1) + return this._dump(arguments[0]); + else + return "()"; + }, + + _dump: function (obj) { + if (typeof obj == 'undefined') return 'undefined'; + var out; + if (obj.serialize) { return obj.serialize(); } + var type = this._typeof(obj); + if (obj.circularReference) obj.circularReference++; + switch (type) { + case 'circular': + out = "{ //circularReference\n}"; + break; + case 'object': + var pairs = new Array; + + for (var prop in obj) { + if (prop != "circularReference" && obj.hasOwnProperty(prop)) { //hide inherited properties + pairs.push(prop + ': ' + this._dump(obj[prop])); + } + } + + out = '{' + this._format_list(pairs) + '}'; + break; + + case 'string': + for (var prop in Dumper.ESC) { + if (Dumper.ESC.hasOwnProperty(prop)) { + obj = obj.replace(prop, Dumper.ESC[prop]); + } + } + + // Escape UTF-8 Strings + if (obj.match(/^[\x00-\x7f]*$/)) { + out = '"' + obj.replace(/\"/g, "\\\"").replace(/([\n\r]+)/g, "\\$1") + '"'; + } + else { + out = "unescape('"+escape(obj)+"')"; + } + break; + + case 'array': + var elems = new Array; + + for (var i=0; i