3 The contents of this file are subject to the Mozilla Public
4 License Version 1.1 (the "License"); you may not use this file
5 except in compliance with the License. You may obtain a copy of
6 the License at http://www.mozilla.org/MPL/
8 Software distributed under the License is distributed on an "AS
9 IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 implied. See the License for the specific language governing
11 rights and limitations under the License.
13 The Original Code is jslib team code.
14 The Initial Developer of the Original Code is jslib team.
16 Portions created by jslib team are
17 Copyright (C) 2000 jslib team. All
20 Original Author: Pete Collins <pete@mozdev.org>
22 Henrik Gemal <http://gemal.dk>
25 /************** DUBUG ******************/
26 if (typeof(JS_LIB_LOADED) == "boolean")
29 const JS_DEBUG_LOADED = true;
30 const JS_DEBUG_FILE = "debug.js";
32 /****************************************************************
33 * void jslibDebug(aOutString) *
34 * aOutString is an argument of string debug message *
37 * var msg="Testing function"; *
40 * outputs: Testing function *
41 ****************************************************************/
44 function jslib_debug(aOutString) { return jslibDebug(aOutString); }
46 function jslibDebug(aOutString)
51 if (JS_LIB_DEBUG_ALERT)
54 dump(aOutString+'\n');
58 function jslibPrint(aOutString)
60 dump(aOutString+'\n');
64 function jslibPrintDebug(aMsg, aOutString)
66 if (!aMsg) aMsg = "JSLIB_DEBUG: ";
67 dump(aMsg+aOutString+'\n');
71 function jslibPrintBracket(aOutString)
73 dump("["+aOutString+']\n');
77 function jslibPrintMsg(aOutStr1, aOutStr2)
79 dump(aOutStr1+": "+aOutStr2+"\n");
83 /****************************************************************
84 * void jslibError(e, aType, aResults, aCaller) *
85 * e - argument of results exception *
86 * aType - argument of string error type message *
87 * aResults - argument of string Components.results name *
88 * aCaller - argument of string caller filename and func name *
91 * jslibError(null, "Missing file path argument\n", *
92 * "NS_ERROR_XPC_NOT_ENOUGH_ARGS", *
93 * JS_LIB_FILE+": include"); *
96 * -----======[ ERROR ]=====----- *
97 * Error in jslib.js: include: Missing file path argument *
99 * NS_ERROR_NUMBER: NS_ERROR_XPC_NOT_ENOUGH_ARGS *
100 * ------------------------------ *
102 ****************************************************************/
104 function jslibError(e)
108 if (typeof(e) == 'object') {
109 var m, n, r, l, ln, fn = "";
117 errMsg+="FileName: "+fn+"\n" +
120 "LineNumber: "+ln+"\n";
123 errMsg = "\n-----======[ jsLib ERROR ]=====-----\n" + errMsg;
124 errMsg += "-------------------------------------\n";
131 function jslibErrorMsg (e)
137 function jslibErrorWarn (e)
139 jslibDebug("jsLib warn: "+e);
143 function jslibErrorMsg (e)
150 jslibDebug('*** load: '+JS_DEBUG_FILE+' OK');
151 jslibDebug(JS_LIB_HELP);
152 jslibDebug("\n\n*********************\nJS_LIB DEBUG IS ON\n*********************\n\n");