1 //<script type="text/javascript">
3 This is the main container for the JSDOC application.
7 Options = import.Options.Options;
8 XObject = import.XObject.XObject;
9 File = import.File.File;
10 /****************** INCLUDES ARE ALL AT THE BOTTOM OF THIS FILE!!!!! *******************/
12 // should not realy be here -- or anywhere...??
22 * apply properties to an object
24 * @param object to get properties (eg. JSDOC.Token.prototype)
25 * @param object of properties, - eg. a list of all the methods
26 * @param default (optional) -- no idea :)
30 build : function (opts)
33 XObject.extend(Options, opts);
40 Options.LOG.inform("JsDoc Toolkit main() running at "+new Date()+".");
41 Options.LOG.inform("With options: ");
43 if (!File.isDirectory(Options.cacheDirectory)) {
44 File.mkdir(Options.cacheDirectory)
47 // the -c option: use a configuration file - not supported at present..
62 apply : function(o, c, defaults){
64 // no "this" reference for friendly out of scope calls
65 JSDOC.apply(o, defaults);
67 if(o && c && typeof c == 'object'){
77 * Qdump is used to generated cache dumps of objects
78 * @arg mixed t - object/array to dump
79 * @arg string prefix output with
80 * @arg string suffix output with
81 * @arg mixed defaults for the object - so they are not dumped..
84 toQDump : function(t, pref, suf, defs)
86 //println("got ToDump: " + pref +" ??? " + suf);
87 //var ret = "JSDOC.Symbol.fromDump(";
89 defs = (typeof(defs) == "undefined") ? {} : defs;
91 var isAr = t.constructor == Array;
95 // println("dump: " + i + " : " +typeof(t[i]));
98 k = typeof(i) == "number" ? i +":" : i.toSource()+":" ;
100 if (typeof(i) != "number") {
114 //if ((typeof(defs[i]) != 'undefined') && (v.toSource() == defs[i]).toSource()) {
132 if (!v.length) { // ?? skip empty!!
140 qret += k + v.toSource();
160 // println(k +"?:" + (v.constructor == Array ? "ARRAY" : "OBJECT"));
163 // what about raw objects...
164 if (v.constructor == Array) {
165 //println("ARRAYLEN:" + v.length);
166 var toadd = JSDOC.toQDump(v, '[', ']');
168 println("Array: " + toadd);
179 //println("AFT AR:" + qret);
182 if (v.constructor == Object) {
183 var toadd = JSDOC.toQDump(v, '{', '}');
192 //println("AFT AR:" + qret);
195 //println("v:toQdump" + typeof(v['toQDump']));
196 if (typeof(v['toQDump']) != "undefined") {
201 qret += k + v.toQDump(v);
204 println("SKIP " + i + " : " +typeof(t[i]) + ":" + t[i].toSource());
208 println("SKIP " + i + " : " +typeof(t[i]) );
216 return pref + qret + suf;
220 * Depreciated - use Script.prettyDump() - cant remember real name..
225 prettyDump : function(src)
227 // println("tidy SRC");
228 return Script.prettyDump(src);
230 var ar = Script.tokenize(src);
231 println("tidy" + ar.length);
236 // this is reallllllllly sloooooowwwwww!!! = perhaps we should just dump it straight to the file!!!
238 for( var i =0 ;i< ar.length; i++) {
240 //println(ar[i].toSource());
242 //println("tidy" + i + ":" + tok.val);
243 if ( (tok.val == '{') || (tok.val == '[') || (tok.val == '(') ) {
249 if ( (tok.val == '}') || (tok.val == ']') || (tok.val == ')') ) {
251 indent = indent.substring(2); // strip spaces..
252 if (i < (ar.length-1) && ar[i+1].val == ',') {
257 eret += (lbr ? "" : "\n" + indent ) + tok.val ;
261 if ( (tok.val == ',')) {
267 eret += "\n" + indent;