static string JS_common_bootstrap_print = string("") + "/*jslint indent: 2,\n" + " nomen: true,\n" + " maxlen: 100,\n" + " sloppy: true,\n" + " vars: true,\n" + " white: true,\n" + " plusplus: true */\n" + "/*global require, print */\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief printing\n" + "///\n" + "/// @file\n" + "///\n" + "/// DISCLAIMER\n" + "///\n" + "/// Copyright 2010-2012 triagens GmbH, Cologne, Germany\n" + "///\n" + "/// Licensed under the Apache License, Version 2.0 (the \"License\");\n" + "/// you may not use this file except in compliance with the License.\n" + "/// You may obtain a copy of the License at\n" + "///\n" + "/// http://www.apache.org/licenses/LICENSE-2.0\n" + "///\n" + "/// Unless required by applicable law or agreed to in writing, software\n" + "/// distributed under the License is distributed on an \"AS IS\" BASIS,\n" + "/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + "/// See the License for the specific language governing permissions and\n" + "/// limitations under the License.\n" + "///\n" + "/// Copyright holder is triAGENS GmbH, Cologne, Germany\n" + "///\n" + "/// @author Dr. Frank Celler\n" + "/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "(function () {\n" + " var internal = require(\"internal\");\n" + "\n" + "// -----------------------------------------------------------------------------\n" + "// --SECTION-- Module \"internal\"\n" + "// -----------------------------------------------------------------------------\n" + "\n" + "// -----------------------------------------------------------------------------\n" + "// --SECTION-- private functions\n" + "// -----------------------------------------------------------------------------\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @addtogroup V8Shell\n" + "/// @{\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief prints objects to standard output\n" + "///\n" + "/// @FUN{internal.printShell(@FA{arg1}, @FA{arg2}, @FA{arg3}, ...)}\n" + "///\n" + "/// Only available in shell mode.\n" + "///\n" + "/// Prints the arguments. If an argument is an object having a\n" + "/// function @FN{_PRINT}, then this function is called. Otherwise @FN{toJson} is\n" + "/// used. A final newline is printed\n" + "///\n" + "/// @verbinclude fluent40\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + " internal.printShell = function () {\n" + " var i;\n" + "\n" + " for (i = 0; i < arguments.length; ++i) {\n" + " if (0 < i) {\n" + " internal.output(\" \");\n" + " }\n" + "\n" + " if (typeof(arguments[i]) === \"string\") {\n" + " internal.output(arguments[i]);\n" + " }\n" + " else {\n" + " internal.printRecursive(arguments[i], [], \"~\", [], 0);\n" + " }\n" + " }\n" + "\n" + " if (internal.COLOR_OUTPUT) {\n" + " internal.output(internal.COLOR_OUTPUT_RESET);\n" + " }\n" + "\n" + " internal.output(\"\\n\");\n" + " };\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief quote cache\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + " internal.characterQuoteCache = {\n" + " '\\b': '\\\\b', // ASCII 8, Backspace\n" + " '\\t': '\\\\t', // ASCII 9, Tab\n" + " '\\n': '\\\\n', // ASCII 10, Newline\n" + " '\\f': '\\\\f', // ASCII 12, Formfeed\n" + " '\\r': '\\\\r', // ASCII 13, Carriage Return\n" + " '\\\"': '\\\\\"',\n" + " '\\\\': '\\\\\\\\'\n" + " };\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief quotes a single character\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + " internal.quoteSingleJsonCharacter = function (c) {\n" + " if (internal.characterQuoteCache.hasOwnProperty[c]) {\n" + " return internal.characterQuoteCache[c];\n" + " }\n" + "\n" + " var charCode = c.charCodeAt(0);\n" + " var result;\n" + "\n" + " if (charCode < 16) {\n" + " result = '\\\\u000';\n" + " }\n" + " else if (charCode < 256) {\n" + " result = '\\\\u00';\n" + " }\n" + " else if (charCode < 4096) {\n" + " result = '\\\\u0';\n" + " }\n" + " else {\n" + " result = '\\\\u';\n" + " }\n" + "\n" + " result += charCode.toString(16);\n" + " internal.characterQuoteCache[c] = result;\n" + "\n" + " return result;\n" + " };\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief quotes a string character\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + " internal.quoteJsonString = function (str) {\n" + " var quotable = /[\\\\\\\"\\x00-\\x1f]/g;\n" + " return '\"' + str.replace(quotable, internal.quoteSingleJsonCharacter) + '\"';\n" + " };\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief prints objects to standard output without a new-line\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + " internal.printRecursive = function (value, seen, path, names, level) {\n" + " var p;\n" + "\n" + " if (seen === undefined) {\n" + " seen = [];\n" + " names = [];\n" + " }\n" + "\n" + " p = seen.indexOf(value);\n" + "\n" + " if (0 <= p) {\n" + " internal.output(names[p]);\n" + " }\n" + " else {\n" + " if (value instanceof Object) {\n" + " seen.push(value);\n" + " names.push(path);\n" + " }\n" + "\n" + " if (value instanceof Object) {\n" + " if ('_PRINT' in value) {\n" + " value._PRINT(seen, path, names, level);\n" + " }\n" + " else if (value instanceof Array) {\n" + " internal.printArray(value, seen, path, names, level);\n" + " }\n" + " else if (value.__proto__ === Object.prototype) {\n" + " internal.printObject(value, seen, path, names, level);\n" + " }\n" + " else if ('toString' in value) {\n" + " internal.output(value.toString());\n" + " }\n" + " else {\n" + " internal.printObject(value, seen, path, names, level);\n" + " }\n" + " }\n" + " else if (value === undefined) {\n" + " internal.output(\"undefined\");\n" + " }\n" + " else {\n" + " if (typeof(value) === \"string\") {\n" + " internal.output(internal.quoteJsonString(value));\n" + " }\n" + " else {\n" + " internal.output(String(value));\n" + " }\n" + " }\n" + " }\n" + " };\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief prints the ident for pretty printing\n" + "///\n" + "/// @FUN{internal.printIndent(@FA{level})}\n" + "///\n" + "/// Only available in shell mode.\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + " internal.printIndent = function (level) {\n" + " var j;\n" + "\n" + " if (internal.PRETTY_PRINT) {\n" + " internal.output(\"\\n\");\n" + "\n" + " for (j = 0; j < level; ++j) {\n" + " internal.output(\" \");\n" + " }\n" + " }\n" + " };\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief JSON representation of an array\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + " internal.printArray = function (object, seen, path, names, level) {\n" + " if (object.length === 0) {\n" + " internal.output(\"[ ]\");\n" + " }\n" + " else {\n" + " var i;\n" + " var sep = \"\";\n" + "\n" + " internal.output(\"[\");\n" + "\n" + " var newLevel = level + 1;\n" + "\n" + " for (i = 0; i < object.length; i++) {\n" + " internal.output(sep);\n" + "\n" + " internal.printIndent(newLevel);\n" + "\n" + " internal.printRecursive(object[i],\n" + " seen,\n" + " path + \"[\" + i + \"]\",\n" + " names,\n" + " newLevel);\n" + " sep = \", \";\n" + " }\n" + "\n" + " internal.printIndent(level);\n" + "\n" + " internal.output(\"]\");\n" + " }\n" + " };\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief prints an object\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + " internal.printObject = function (object, seen, path, names, level) {\n" + " var sep = \" \";\n" + " var k;\n" + "\n" + " internal.output(\"{\");\n" + "\n" + " var newLevel = level + 1;\n" + "\n" + " for (k in object) {\n" + " if (object.hasOwnProperty(k)) {\n" + " var val = object[k];\n" + "\n" + " internal.output(sep);\n" + "\n" + " internal.printIndent(newLevel);\n" + "\n" + " if (internal.COLOR_OUTPUT) {\n" + " internal.output(internal.COLOR_OUTPUT_DEFAULT,\n" + " k,\n" + " internal.COLOR_OUTPUT_RESET, \n" + " \" : \");\n" + " }\n" + " else {\n" + " internal.output(internal.quoteJsonString(k), \" : \");\n" + " }\n" + "\n" + " internal.printRecursive(val,\n" + " seen,\n" + " path + \"[\" + k + \"]\",\n" + " names,\n" + " newLevel);\n" + " sep = \", \";\n" + " }\n" + " }\n" + "\n" + " internal.printIndent(level);\n" + "\n" + " internal.output(\" }\");\n" + " };\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @}\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "}());\n" + "\n" + "// -----------------------------------------------------------------------------\n" + "// --SECTION-- global functions\n" + "// -----------------------------------------------------------------------------\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @addtogroup V8Shell\n" + "/// @{\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief global print\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "// must be a variable definition for the browser\n" + "if (typeof require(\"internal\").printBrowser === \"function\") {\n" + " print = require(\"internal\").print = require(\"internal\").printBrowser;\n" + "}\n" + "else {\n" + " print = require(\"internal\").print = require(\"internal\").printShell;\n" + "}\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @}\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "// Local Variables:\n" + "// mode: outline-minor\n" + "// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @}\\\\)\"\n" + "// End:\n" ;