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;
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 //for (var o in JSDOC.opt) {
44 // JSDOC.opt.LOG.inform(" "+o+": "+JSDOC.opt[o]);
50 var template = Options.template; // || System.getProperty("jsdoc.template.dir");
51 println("Template: " + Options.template);
64 apply : function(o, c, defaults){
66 // no "this" reference for friendly out of scope calls
67 JSDOC.apply(o, defaults);
69 if(o && c && typeof c == 'object'){
79 * Qdump is used to generated cache dumps of objects
80 * @arg mixed t - object/array to dump
81 * @arg string prefix output with
82 * @arg string suffix output with
83 * @arg mixed defaults for the object - so they are not dumped..
86 toQDump : function(t, pref, suf, defs)
88 //println("got ToDump: " + pref +" ??? " + suf);
89 //var ret = "JSDOC.Symbol.fromDump(";
91 defs = (typeof(defs) == "undefined") ? {} : defs;
93 var isAr = t.constructor == Array;
97 // println("dump: " + i + " : " +typeof(t[i]));
100 k = typeof(i) == "number" ? i +":" : i.toSource()+":" ;
102 if (typeof(i) != "number") {
116 //if ((typeof(defs[i]) != 'undefined') && (v.toSource() == defs[i]).toSource()) {
134 if (!v.length) { // ?? skip empty!!
142 qret += k + v.toSource();
162 // println(k +"?:" + (v.constructor == Array ? "ARRAY" : "OBJECT"));
165 // what about raw objects...
166 if (v.constructor == Array) {
167 //println("ARRAYLEN:" + v.length);
168 var toadd = JSDOC.toQDump(v, '[', ']');
170 println("Array: " + toadd);
181 //println("AFT AR:" + qret);
184 if (v.constructor == Object) {
185 var toadd = JSDOC.toQDump(v, '{', '}');
194 //println("AFT AR:" + qret);
197 //println("v:toQdump" + typeof(v['toQDump']));
198 if (typeof(v['toQDump']) != "undefined") {
203 qret += k + v.toQDump(v);
206 println("SKIP " + i + " : " +typeof(t[i]) + ":" + t[i].toSource());
210 println("SKIP " + i + " : " +typeof(t[i]) );
218 return pref + qret + suf;
222 * Depreciated - use Script.prettyDump() - cant remember real name..
227 prettyDump : function(src)
229 // println("tidy SRC");
230 return Script.prettyDump(src);
232 var ar = Script.tokenize(src);
233 println("tidy" + ar.length);
238 // this is reallllllllly sloooooowwwwww!!! = perhaps we should just dump it straight to the file!!!
240 for( var i =0 ;i< ar.length; i++) {
242 //println(ar[i].toSource());
244 //println("tidy" + i + ":" + tok.val);
245 if ( (tok.val == '{') || (tok.val == '[') || (tok.val == '(') ) {
251 if ( (tok.val == '}') || (tok.val == ']') || (tok.val == ')') ) {
253 indent = indent.substring(2); // strip spaces..
254 if (i < (ar.length-1) && ar[i+1].val == ',') {
259 eret += (lbr ? "" : "\n" + indent ) + tok.val ;
263 if ( (tok.val == ',')) {
269 eret += "\n" + indent;