X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JSDOC%2FBuildDocs.js;h=8c8552e39bd43923087604ce4316791c25743863;hp=ee50d33412cbb742bd5710237432798570fbc21d;hb=HEAD;hpb=2fb8698138c0c88852f7a640fc056be8a33de305 diff --git a/JSDOC/BuildDocs.js b/JSDOC/BuildDocs.js index ee50d33..8c8552e 100644 --- a/JSDOC/BuildDocs.js +++ b/JSDOC/BuildDocs.js @@ -83,7 +83,10 @@ BuildDocs = { for (var i = 0; i < Options.src.length; i++) { // add to sourcefiles.. - + if (!File.isDirectory(Options.src[i])) { + _this.srcFiles.push(Options.src[i]); + continue; + } File.list(Options.src[i] ).forEach(function($) { if (Options['exclude-src'].indexOf($) > -1) { return; @@ -131,26 +134,28 @@ BuildDocs = { if (c_mt > o_mt) { // cached time > original time! // use the cached mtimes.. + print("Read " + cacheFile); var syms = JSON.parse(File.read(cacheFile), function(k, v) { + //print(k); if (typeof(v) != 'object') { return v; } - if (typeof(v._object) == 'undefined') { + if (typeof(v['*object']) == 'undefined') { return v; } - var cls = imports[v._object]; - delete v._object; + var cls = imports[v['*object']][v['*object']]; + //print(v['*object']); + delete v['*object']; var ret = new cls(); XObject.extend(ret, v); return ret; + }); - - throw "Conversion of cache not done yet!"; - - for (var sy in syms) { - //println("ADD:" + sy ); - Parser.symbols.addSymbol(syms[sy]); + //print("Add sybmols " + cacheFile); + for (var sy in syms._index) { + // print("ADD:" + sy ); + Parser.symbols.addSymbol(syms._index[sy]); } continue; } @@ -260,8 +265,8 @@ BuildDocs = { function isaFile($) { return ($.is("FILE")) } - function isaClass($) { - return ($.is("CONSTRUCTOR") || $.isNamespace); + function isaClass($) { + return ($.is("CONSTRUCTOR") || $.isNamespace || $.isClass); } @@ -282,6 +287,7 @@ BuildDocs = { var targetDir = Options.target + "/symbols/src/"; this.makeSrcFile(file, targetDir); } + //print(JSON.stringify(symbols,null,4)); var classes = symbols.filter(isaClass).sort(makeSortby("alias")); @@ -380,12 +386,17 @@ BuildDocs = { var p =''; for(var i =0; i < cfgProperties.length;i++) { p = cfgProperties[i]; - props.push( { + var add = { name : p.name, type : p.type, desc : p.desc, + memberOf : p.memberOf == data.alias ? '' : p.memberOf - }); + } + if (p.optvalues) { + add.optvals = p.optvalues; + } + props.push(add ); } @@ -405,6 +416,24 @@ BuildDocs = { desc : m.desc }); } + + var ownMethods = data.methods.filter( function(e){ + return !e.isEvent && !e.comment.getTag('hide').length; + }).sort(makeSortby("name")); + + + var methods = []; + + for(var i =0; i < ownMethods.length;i++) { + m = ownMethods[i]; + methods.push( { + name : m.name, + sig : this.makeMethodSkel(m.params), + type : 'function', + desc : m.desc + }); + } + //println(props.toSource()); // we need to output: //classname => { @@ -415,7 +444,8 @@ BuildDocs = { var ret = { props : props, - events: events + events: events, + methods : methods, }; return ret; @@ -467,8 +497,17 @@ BuildDocs = { } ).map( function($) { return $.name == 'this' ? '_self' : $.name; } ).join(", ") + ")\n{\n\n}"; + }, + makeMethodSkel :function(params) { + if (!params) return "()"; + return "(" + + params.filter( + function($) { + return $.name.indexOf(".") == -1; // don't show config params in signature + } + ).map( function($) { return $.type + " " +( $.name == 'this' ? '_self' : $.name ); } ).join(", ") + + ")"; } - };