+++ /dev/null
-// coding: utf-8\r
-// Copyright 2008 Grégory Burri\r
-//\r
-// This file is part of Euphorik.\r
-//\r
-// Euphorik is free software: you can redistribute it and/or modify\r
-// it under the terms of the GNU General Public License as published by\r
-// the Free Software Foundation, either version 3 of the License, or\r
-// (at your option) any later version.\r
-//\r
-// Euphorik is distributed in the hope that it will be useful,\r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-// GNU General Public License for more details.\r
-//\r
-// You should have received a copy of the GNU General Public License\r
-// along with Euphorik. If not, see <http://www.gnu.org/licenses/>.\r
-\r
-/**
- * Affiche un objet quelconque sur la sortie du navigateur.
- */
-var dumpObj = function(obj, name)
-{
- if (typeof(dump) == "undefined")
- return
-
- dump("---" + (name == undefined ? "" : " : " + name) + "\n")
- dump(obj2text(obj))
- dump("\n---\n")
-}
-
-var obj2text = function(obj, curDepth)
-{
- if (curDepth == undefined)
- curDepth = 0;
-
- var acc = ""
-
- if (obj == undefined)
- {
- acc += "<undefined>"
- }
- else if (typeof(obj) == "string")
- {
- acc += "\"" + obj + "\""
- }
- else if (obj.length != undefined) // array
- {
- acc += "["
-
- var i = 0
- for (; i < obj.length; i++)
- {
- if (i != 0) acc += ","
- acc += "\n" + indent(curDepth + 1, obj2text(obj[i], curDepth + 1))
- }
-
- acc += (i == 0 ? "]" : "\n" + indent(curDepth, "]"))
- }
- else if (typeof(obj) == "object")
- {
- acc += "{"
- var i = 0
- for (prop in obj)
- {
- if (i != 0) acc += ","
- acc += "\n" + indent(curDepth + 1, prop + " : " + obj2text(obj[prop], curDepth + 1))
- i += 1
- }
- acc += "\n" + indent(curDepth, "}")
- }
- else if (typeof(obj) == "function")
- {
- acc += "<function>"
- }
- else // value
- {
- acc += obj
- }
-
- return acc
-}
-
-var indent = function(depth, text)
-{
- var indentText = ""
- for (var i = 0; i < depth * 3; i++)
- indentText += " "
- return indentText + text
-}