1 //<script type="text/javascript">
3 GI = imports.gi.GIRepository;
6 imports['Object.js'].load(Object);
8 console = imports['console.js'].console;
9 JSDOC = imports['JSDOC.js'].JSDOC;
11 Introspect = imports['JSDOC/Introspect.js'].Introspect;
12 Basic = imports['JSDOC/Introspect/Basic.js'].Basic;
14 * Methods, functions or consturctors
20 Method = Object.define(
21 function(m, memberOf, saveto, keylist) {
22 this.propertyType = 'Method';
24 var flags = GI.function_info_get_flags (m);
25 var n = GI.base_info_get_name(m);
26 var n_original = n + '';
28 if (n.match(/_(ref|unref)$/) || n.match(/^(ref|unref|weakref|weakunref)$/)) {
29 return false; // skip these!
39 type : this.typeToName(GI.callable_info_get_return_type(m)),
40 desc : Introspect.doc(memberOf.alias + '.' + n_original + '.return-value')
45 var args = this.argsToArrays(m, retval);
48 if ((n == 'c_new') && !args.length && memberOf.constructors.length) {
50 memberOf.constructors[0].doc = Introspect.doc(memberOf.alias + '.' + n_original);
52 return false; // skip.
59 //console.log(GI.base_info_get_name(m));
60 // console.dump(GI.base_info_get_attribute(m, 'doc') );
62 // this is a bit messy, as we probably loose the doc's on new..
69 isConstructor : flags & GI.IFunctionInfoFlags.IS_CONSTRUCTOR,
70 isStatic : !(flags & GI.IFunctionInfoFlags.IS_METHOD),
71 memberOf : memberOf.alias,
73 desc : Introspect.doc(memberOf.alias + '.' + n_original)
75 // add descriptions to the arguments..
76 this.params.map(function(p) {
79 p.desc = Introspect.doc(memberOf.alias + '.' + n_original + '.' + p.name);
80 //Seed.print(memberOf.alias + '.' + n_original + '.' + p.name + ':' + p.desc);
85 // collect references...
86 var addedto = [ memberOf.alias ]; // do not add to self...
88 for(var i =0; i < args.length;i++) {
89 var ty = args[i].type;
90 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
93 if (addedto.indexOf(ty) > -1) {
99 Introspect.references[ty] = Introspect.references[ty] || [];
100 Introspect.references[ty].push(this);
105 // decide what to add to...
107 if (this.isConstructor) {
109 if (this.name.match(/^new_/)) {
110 this.name = this.name.substring(4);
114 memberOf.constructors.push(this);
117 // return values = only applicable to non-constructors..
118 for(var i =0; i < retval.length;i++) {
119 var ty = retval[i].type;
120 if (typeof(ty) != 'string' || ty.indexOf('.') < 0) {
123 if (addedto.indexOf(ty) > -1) {
129 Introspect.references[ty] = Introspect.references[ty] || [];
130 Introspect.references[ty].push(this);
137 memberOf.functions.push(this);
142 memberOf.methods.push(this);
143 keylist.push(this.name);